Add camera component

This commit is contained in:
Riyyi
2021-01-13 20:37:18 +01:00
parent 1580794521
commit e884d68ce0
2 changed files with 46 additions and 4 deletions
+19
View File
@@ -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;
}
}
+27 -4
View File
@@ -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