Files
2025-07-16 13:38:02 +02:00

42 lines
743 B
C++

#pragma once
#include <td/Maths.h>
#include <td/misc/Signal.h>
namespace td {
namespace render {
class Camera {
private:
Mat4f m_ViewMatrix;
Mat4f m_ProjectionMatrix;
Mat4f m_InvViewMatrix;
Mat4f m_InvProjectionMatrix;
float m_CamDistance = 25.0f;
Vec3f m_CamPos{0, m_CamDistance, 0};
Vec2f m_CamLook{};
float m_Yaw = -PI / 2.0f;
float m_Pitch = -PI / 2.0f + 0.0000001f;
public:
utils::Signal<> OnPerspectiveChange;
utils::Signal<> OnViewChange;
const Mat4f& GetViewMatrix() const {
return m_ViewMatrix;
}
const Mat4f& GetProjectionMatrix() const {
return m_ProjectionMatrix;
}
void UpdatePerspective(float a_AspectRatio);
void SetCamPos(const Vec3f& a_NewPos);
};
} // namespace render
} // namespace td