![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Orthographic 2D camera. More...
#include <Camera.hpp>
Inheritance diagram for galaxy::graphics::Camera:
Collaboration diagram for galaxy::graphics::Camera:Classes | |
| struct | Data |
| Camera data. More... | |
Public Member Functions | |
| Camera () | |
| Constructor. | |
| Camera (const nlohmann::json &json) | |
| JSON constructor. | |
| Camera (Camera &&) | |
| Move constructor. | |
| Camera & | operator= (Camera &&) |
| Move assignment operator. | |
| Camera (const Camera &) | |
| Copy constructor. | |
| Camera & | operator= (const Camera &) |
| Copy assignment operator. | |
| virtual | ~Camera () |
| Destructor. | |
| void | set_viewport (const float width, const float height) |
| Set Viewport. | |
| void | translate (const float x, const float y) override |
| Translate (move) position. | |
| void | rotate (const float degrees) override |
| Rotate entity. | |
| const glm::vec2 & | get_viewport () const |
| Get camera viewport. | |
| const glm::mat4 & | get_model_view () |
| Retrieve internal transformation matrix. | |
| const glm::mat4 & | get_proj () |
| Get the Camera projection. | |
| Data & | get_data () |
| Get camera view and proj. | |
| nlohmann::json | serialize () override |
| Serializes object. | |
| void | deserialize (const nlohmann::json &json) override |
| Deserializes from object. | |
Public Member Functions inherited from galaxy::graphics::Transform | |
| Transform () | |
| Constructor. | |
| Transform (Transform &&) | |
| Move constructor. | |
| Transform & | operator= (Transform &&) |
| Move assignment operator. | |
| Transform (const Transform &) | |
| Copy constructor. | |
| Transform & | operator= (const Transform &) |
| Copy assignment operator. | |
| virtual | ~Transform () |
| Destructor. | |
| void | scale (const float scale) |
| Set entity scale. | |
| void | set_scale_horizontal (const float x) |
| Set entity scale. | |
| void | set_scale_vertical (const float y) |
| Set entity scale. | |
| void | set_pos (const float x, const float y) |
| Sets position without moving the entity. | |
| void | set_rotation (const float degrees) |
| Set the entity rotation. | |
| void | set_origin (const float x, const float y) |
| Set the origin point. | |
| void | reset () |
| Reset transform. | |
| const glm::vec2 & | get_pos () const |
| Get stored position. | |
| float | get_rotation () const |
| Get stored rotation. | |
| const glm::vec2 & | get_scale () const |
| Get stored scale. | |
| const glm::vec2 & | get_origin () const |
| Get origin point. | |
| glm::mat4 & | get_transform () |
| Retrieve internal transformation matrix. | |
Public Attributes | |
| bool | m_allow_rotation |
| Allow camera to rotate. | |
| float | m_translation_speed |
| Movement speed. | |
| float | m_rotation_speed |
| Rotational speed. | |
Private Member Functions | |
| void | set_projection (const float left, const float right, const float bottom, const float top) |
| Set camera projection. | |
| void | recalculate () |
| Recalculates the model view matrix. | |
Private Attributes | |
| Data | m_data |
| Camera data. | |
| glm::vec2 | m_viewport |
| Camera viewport size. | |
Additional Inherited Members | |
Protected Attributes inherited from galaxy::graphics::Transform | |
| glm::vec2 | m_pos |
| Cached for easy retrieval. Pos. | |
| float | m_rotation |
| Cached for easy retrieval. Rotation. | |
| glm::vec2 | m_scale |
| Cached for easy retrieval. Scale. | |
| glm::vec2 | m_origin |
| Transform origin point. | |
| bool | m_dirty |
| Flag to see if transform needs to be recalculated. | |
| glm::mat4 | m_transform |
| Combined transform. | |
Orthographic 2D camera.
Definition at line 27 of file Camera.hpp.
| galaxy::graphics::Camera::Camera | ( | ) |
Constructor.
Definition at line 17 of file Camera.cpp.
| galaxy::graphics::Camera::Camera | ( | const nlohmann::json & | json | ) |
JSON constructor.
| json | JSON object. |
Definition at line 24 of file Camera.cpp.
Here is the call graph for this function:| galaxy::graphics::Camera::Camera | ( | Camera && | c | ) |
Move constructor.
Definition at line 32 of file Camera.cpp.
| galaxy::graphics::Camera::Camera | ( | const Camera & | c | ) |
Copy constructor.
Definition at line 60 of file Camera.cpp.
|
virtual |
Destructor.
Definition at line 88 of file Camera.cpp.
Move assignment operator.
Definition at line 43 of file Camera.cpp.
Here is the call graph for this function:Copy assignment operator.
Definition at line 71 of file Camera.cpp.
Here is the call graph for this function:| void galaxy::graphics::Camera::set_viewport | ( | const float | width, |
| const float | height ) |
Set Viewport.
Calls set_projection().
| width | Width of viewport, independant of window size. |
| height | Height of viewport, independant of window size. |
Definition at line 92 of file Camera.cpp.
Here is the call graph for this function:
|
overridevirtual |
Translate (move) position.
| x | How far to translate on x axis. |
| y | How far to translate on y axis. |
Reimplemented from galaxy::graphics::Transform.
Definition at line 97 of file Camera.cpp.
|
overridevirtual |
Rotate entity.
| degrees | Additive. Min -360, max 360. |
Reimplemented from galaxy::graphics::Transform.
Definition at line 105 of file Camera.cpp.
|
nodiscard |
|
nodiscard |
Retrieve internal transformation matrix.
Definition at line 118 of file Camera.cpp.
Here is the call graph for this function:
|
nodiscard |
Get the Camera projection.
Definition at line 124 of file Camera.cpp.
Here is the call graph for this function:
|
nodiscard |
Get camera view and proj.
Definition at line 130 of file Camera.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
nodiscardoverride |
Serializes object.
Definition at line 158 of file Camera.cpp.
|
override |
Deserializes from object.
| json | Json object to retrieve data from. |
Definition at line 173 of file Camera.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Set camera projection.
| left | Left point of ortho perspective. |
| right | Right point of ortho perspective. |
| bottom | Bottom point of ortho perspective. |
| top | Top point of ortho perspective. |
Definition at line 136 of file Camera.cpp.
Here is the caller graph for this function:
|
private |
Recalculates the model view matrix.
Definition at line 149 of file Camera.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| bool galaxy::graphics::Camera::m_allow_rotation |
Allow camera to rotate.
Definition at line 177 of file Camera.hpp.
| float galaxy::graphics::Camera::m_translation_speed |
Movement speed.
Definition at line 182 of file Camera.hpp.
| float galaxy::graphics::Camera::m_rotation_speed |
Rotational speed.
Definition at line 187 of file Camera.hpp.
|
private |
Camera data.
Definition at line 193 of file Camera.hpp.
|
private |
Camera viewport size.
Definition at line 198 of file Camera.hpp.