8#ifndef GALAXY_GRAPHICS_CAMERA_HPP_
9#define GALAXY_GRAPHICS_CAMERA_HPP_
11#include "galaxy/fs/Serializable.hpp"
13#include "galaxy/utils/Globals.hpp"
19 class CameraController;
29 friend class input::CameraController;
35 struct alignas(16)
Data final
58 Camera(
const nlohmann::json& json);
93 void set_viewport(
const float width,
const float height);
101 void translate(
const float x,
const float y)
override;
108 void rotate(
const float degrees)
override;
155 void deserialize(
const nlohmann::json& json)
override;
166 void set_projection(
const float left,
const float right,
const float bottom,
const float top);
const glm::mat4 & get_proj()
Get the Camera projection.
void set_viewport(const float width, const float height)
Set Viewport.
const glm::vec2 & get_viewport() const
Get camera viewport.
float m_translation_speed
Movement speed.
void set_projection(const float left, const float right, const float bottom, const float top)
Set camera projection.
nlohmann::json serialize() override
Serializes object.
void translate(const float x, const float y) override
Translate (move) position.
Camera & operator=(Camera &&)
Move assignment operator.
void deserialize(const nlohmann::json &json) override
Deserializes from object.
glm::vec2 m_viewport
Camera viewport size.
virtual ~Camera()
Destructor.
void recalculate()
Recalculates the model view matrix.
Data & get_data()
Get camera view and proj.
void rotate(const float degrees) override
Rotate entity.
bool m_allow_rotation
Allow camera to rotate.
const glm::mat4 & get_model_view()
Retrieve internal transformation matrix.
float m_rotation_speed
Rotational speed.
glm::mat4 m_model_view
Combined transformation matrix.
glm::mat4 m_projection
Camera projection matrix.