2025-12-15 20:37:01 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
// libs
|
|
|
|
|
#define GLM_FORCE_RADIANS
|
|
|
|
|
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
|
|
|
|
|
|
namespace hk
|
|
|
|
|
{
|
|
|
|
|
class Camera
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Camera() = default;
|
|
|
|
|
~Camera() = default;
|
|
|
|
|
|
|
|
|
|
void setOrthographicProjection(float left, float right, float top, float bottom, float near, float far);
|
|
|
|
|
void setPerspectiveProjection(float fovY, float aspect, float near, float far);
|
|
|
|
|
|
2025-12-15 22:26:53 +08:00
|
|
|
void setViewDirection(glm::vec3 position, glm::vec3 direction, glm::vec3 up = glm::vec3{0.f, -1.f, 0.f});
|
|
|
|
|
void setViewTarget(glm::vec3 position, glm::vec3 target, glm::vec3 up = glm::vec3{0.f, -1.f, 0.f});
|
|
|
|
|
void setViewYXZ(glm::vec3 position, glm::vec3 rotation);
|
|
|
|
|
|
2025-12-15 20:37:01 +08:00
|
|
|
const glm::mat4& getProjection() const { return m_projectionMatrix; }
|
2025-12-15 22:26:53 +08:00
|
|
|
const glm::mat4& getView() const { return m_viewMatrix; }
|
2025-12-15 20:37:01 +08:00
|
|
|
private:
|
|
|
|
|
glm::mat4 m_projectionMatrix{1.0f};
|
2025-12-15 22:26:53 +08:00
|
|
|
glm::mat4 m_viewMatrix{1.0f};
|
2025-12-15 20:37:01 +08:00
|
|
|
};
|
|
|
|
|
} // namespace hk
|