Add camera component
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#include "inferno/scene/components.h"
|
||||
|
||||
namespace Inferno {
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const glm::vec3& value)
|
||||
{
|
||||
stream << "{ " << value.x << ", " << value.y << ", " << value.z << " }";
|
||||
return stream;
|
||||
}
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const glm::mat4& value)
|
||||
{
|
||||
stream << "mat4 "
|
||||
<< value[0] << "\n " << value[1] << "\n "
|
||||
<< value[2] << "\n " << value[3];
|
||||
return stream;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,10 @@
|
||||
|
||||
#include <string> // std::string
|
||||
|
||||
#include "glm/ext/vector_float3.hpp" // glm::vec3
|
||||
#include "glm/ext/matrix_float4x4.hpp" // glm::mat4
|
||||
#include "glm/ext/vector_float3.hpp" // glm::vec3
|
||||
|
||||
#include "inferno/log.h"
|
||||
|
||||
namespace Inferno {
|
||||
|
||||
@@ -18,11 +21,31 @@ namespace Inferno {
|
||||
};
|
||||
|
||||
struct TransformComponent {
|
||||
glm::vec3 translate = { 0.0f, 0.0f, 0.0f };
|
||||
glm::vec3 rotate = { 0.0f, 0.0f, 0.0f } ;
|
||||
glm::vec3 scale = { 1.0f, 1.0f, 1.0f };
|
||||
glm::vec3 translate { 0.0f, 0.0f, 0.0f };
|
||||
glm::vec3 rotate { 0.0f, 0.0f, 0.0f } ;
|
||||
glm::vec3 scale { 1.0f, 1.0f, 1.0f };
|
||||
glm::mat4 transform { 1.0f }; // Identity matrix
|
||||
};
|
||||
|
||||
struct OrthographicCameraComponment {
|
||||
float zoomLevel = 1.0f;
|
||||
glm::vec3 rotateAxis { 0.0f, 0.0f, 1.0f };
|
||||
glm::mat4 projection { 1.0f }; // Identity matrix
|
||||
};
|
||||
|
||||
struct PerspectiveCameraComponent {
|
||||
float fov = 90.0f;
|
||||
float pitch = 0.0f;
|
||||
float yaw = -90.0f;
|
||||
glm::vec3 up { 0.0f, 1.0f, 0.0f };
|
||||
glm::mat4 projection { 1.0f }; // Identity matrix
|
||||
};
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
const LogStream& operator<<(const LogStream& stream, const glm::vec3& value);
|
||||
const LogStream& operator<<(const LogStream& stream, const glm::mat4& value);
|
||||
|
||||
}
|
||||
|
||||
#endif // COMPONENTS_H
|
||||
|
||||
Reference in New Issue
Block a user