Orthographic 2D camera.
More...
#include <Camera.hpp>
|
| | Camera () noexcept |
| | Constructor.
|
| |
| | Camera (Camera &&) noexcept |
| | Move constructor.
|
| |
| Camera & | operator= (Camera &&) noexcept |
| | Move assignment operator.
|
| |
| | Camera (const Camera &) noexcept |
| | Copy constructor.
|
| |
| Camera & | operator= (const Camera &) noexcept |
| | Copy assignment operator.
|
| |
| | ~Camera () noexcept |
| | Destructor.
|
| |
| void | set_projection (const float left, const float right, const float bottom, const float top) noexcept |
| | Set camera projection.
|
| |
| void | move (const float x, const float y) noexcept |
| | Move position.
|
| |
| void | move_x (const float x) noexcept |
| | Move on x axis.
|
| |
| void | move_y (const float y) noexcept |
| | Move on y axis.
|
| |
| void | rotate (const float degrees) noexcept |
| | Rotate entity.
|
| |
| void | scale (const float scale) noexcept |
| | Set entity scale.
|
| |
| void | set_scale_horizontal (const float x) noexcept |
| | Set entity scale.
|
| |
| void | set_scale_vertical (const float y) noexcept |
| | Set entity scale.
|
| |
| void | set_rotation (const float degrees) noexcept |
| | Set camera rotation.
|
| |
| void | set_positon (const float x, const float y) noexcept |
| | Set postion of camera.
|
| |
| void | set_positon_horizontal (const float x) noexcept |
| | Set postion of camera.
|
| |
| void | set_positon_vertical (const float y) noexcept |
| | Set postion of camera.
|
| |
| void | set_origin (const float x, const float y) noexcept |
| | Set the origin point.
|
| |
| void | reset () noexcept |
| | Reset transform.
|
| |
| const glm::vec2 & | get_pos () const noexcept |
| | Get stored position.
|
| |
| float | get_rotation () const noexcept |
| | Get stored rotation.
|
| |
| const glm::vec2 & | get_scale () const noexcept |
| | Get stored scale.
|
| |
| const glm::vec2 & | get_origin () const noexcept |
| | Get origin point.
|
| |
| glm::mat4 & | get_transform () noexcept |
| | Retrieve internal transformation matrix.
|
| |
| const glm::mat4 & | get_model_view () noexcept |
| | Retrieve internal transformation matrix.
|
| |
| const glm::mat4 & | get_proj () noexcept |
| | Get the Camera projection.
|
| |
| Data & | get_data () noexcept |
| | Get camera view and proj.
|
| |
|
| void | recalculate () noexcept |
| | Recalculates the model view matrix.
|
| |
|
| Data | m_data |
| | Camera data.
|
| |
| 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 19 of file Camera.hpp.
◆ Camera() [1/3]
| galaxy::Camera::Camera |
( |
| ) |
|
|
noexcept |
◆ Camera() [2/3]
| galaxy::Camera::Camera |
( |
Camera && | c | ) |
|
|
noexcept |
◆ Camera() [3/3]
| galaxy::Camera::Camera |
( |
const Camera & | c | ) |
|
|
noexcept |
◆ ~Camera()
| galaxy::Camera::~Camera |
( |
| ) |
|
|
noexcept |
◆ operator=() [1/2]
Move assignment operator.
Definition at line 47 of file Camera.cpp.
◆ operator=() [2/2]
Copy assignment operator.
Definition at line 82 of file Camera.cpp.
◆ set_projection()
| void galaxy::Camera::set_projection |
( |
const float | left, |
|
|
const float | right, |
|
|
const float | bottom, |
|
|
const float | top ) |
|
noexcept |
Set camera projection.
By default sets origin to center of right, bottom.
- Parameters
-
| 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 106 of file Camera.cpp.
◆ move()
| void galaxy::Camera::move |
( |
const float | x, |
|
|
const float | y ) |
|
noexcept |
Move position.
- Parameters
-
| x | How far to translate on x axis. |
| y | How far to translate on y axis. |
Definition at line 117 of file Camera.cpp.
◆ move_x()
| void galaxy::Camera::move_x |
( |
const float | x | ) |
|
|
noexcept |
Move on x axis.
- Parameters
-
| x | How far to translate on x axis. |
Definition at line 125 of file Camera.cpp.
◆ move_y()
| void galaxy::Camera::move_y |
( |
const float | y | ) |
|
|
noexcept |
Move on y axis.
- Parameters
-
| y | How far to translate on y axis. |
Definition at line 131 of file Camera.cpp.
◆ rotate()
| void galaxy::Camera::rotate |
( |
const float | degrees | ) |
|
|
noexcept |
Rotate entity.
- Parameters
-
| degrees | Additive. Min 0, max 360. |
Definition at line 137 of file Camera.cpp.
◆ scale()
| void galaxy::Camera::scale |
( |
const float | scale | ) |
|
|
noexcept |
Set entity scale.
- Parameters
-
Definition at line 145 of file Camera.cpp.
◆ set_scale_horizontal()
| void galaxy::Camera::set_scale_horizontal |
( |
const float | x | ) |
|
|
noexcept |
Set entity scale.
- Parameters
-
| x | Value to scale horizontal axis by. |
Definition at line 153 of file Camera.cpp.
◆ set_scale_vertical()
| void galaxy::Camera::set_scale_vertical |
( |
const float | y | ) |
|
|
noexcept |
Set entity scale.
- Parameters
-
| y | Value to scale vertical axis by. |
Definition at line 159 of file Camera.cpp.
◆ set_rotation()
| void galaxy::Camera::set_rotation |
( |
const float | degrees | ) |
|
|
noexcept |
Set camera rotation.
- Parameters
-
Definition at line 165 of file Camera.cpp.
◆ set_positon()
| void galaxy::Camera::set_positon |
( |
const float | x, |
|
|
const float | y ) |
|
noexcept |
Set postion of camera.
- Parameters
-
Definition at line 171 of file Camera.cpp.
◆ set_positon_horizontal()
| void galaxy::Camera::set_positon_horizontal |
( |
const float | x | ) |
|
|
noexcept |
Set postion of camera.
- Parameters
-
Definition at line 179 of file Camera.cpp.
◆ set_positon_vertical()
| void galaxy::Camera::set_positon_vertical |
( |
const float | y | ) |
|
|
noexcept |
Set postion of camera.
- Parameters
-
Definition at line 185 of file Camera.cpp.
◆ set_origin()
| void galaxy::Camera::set_origin |
( |
const float | x, |
|
|
const float | y ) |
|
noexcept |
Set the origin point.
Only affects rotation and scale.
- Parameters
-
| x | X position to set origin to. |
| y | Y position to set origin to. |
Definition at line 191 of file Camera.cpp.
◆ reset()
| void galaxy::Camera::reset |
( |
| ) |
|
|
noexcept |
◆ get_pos()
| const glm::vec2 & galaxy::Camera::get_pos |
( |
| ) |
const |
|
nodiscardnoexcept |
Get stored position.
- Returns
- Const glm::vec2 reference.
Definition at line 209 of file Camera.cpp.
◆ get_rotation()
| float galaxy::Camera::get_rotation |
( |
| ) |
const |
|
nodiscardnoexcept |
Get stored rotation.
- Returns
- Float.
Definition at line 214 of file Camera.cpp.
◆ get_scale()
| const glm::vec2 & galaxy::Camera::get_scale |
( |
| ) |
const |
|
nodiscardnoexcept |
Get stored scale.
- Returns
- Const glm::vec2 reference.
Definition at line 219 of file Camera.cpp.
◆ get_origin()
| const glm::vec2 & galaxy::Camera::get_origin |
( |
| ) |
const |
|
nodiscardnoexcept |
Get origin point.
- Returns
- Const glm::vec2 reference.
Definition at line 224 of file Camera.cpp.
◆ get_transform()
| glm::mat4 & galaxy::Camera::get_transform |
( |
| ) |
|
|
nodiscardnoexcept |
Retrieve internal transformation matrix.
- Returns
- glm::mat4 reference.
Definition at line 229 of file Camera.cpp.
◆ get_model_view()
| const glm::mat4 & galaxy::Camera::get_model_view |
( |
| ) |
|
|
nodiscardnoexcept |
Retrieve internal transformation matrix.
- Returns
- Reference to internal glm::mat4.
Definition at line 235 of file Camera.cpp.
◆ get_proj()
| const glm::mat4 & galaxy::Camera::get_proj |
( |
| ) |
|
|
nodiscardnoexcept |
Get the Camera projection.
- Returns
- Const glm::mat4 reference.
Definition at line 241 of file Camera.cpp.
◆ get_data()
Get camera view and proj.
- Returns
- Reference to camera data.
Definition at line 246 of file Camera.cpp.
◆ recalculate()
| void galaxy::Camera::recalculate |
( |
| ) |
|
|
privatenoexcept |
Recalculates the model view matrix.
Definition at line 252 of file Camera.cpp.
◆ m_allow_rotation
| bool galaxy::Camera::m_allow_rotation |
Allow camera to rotate.
Definition at line 248 of file Camera.hpp.
◆ m_translation_speed
| float galaxy::Camera::m_translation_speed |
◆ m_rotation_speed
| float galaxy::Camera::m_rotation_speed |
◆ m_data
| Data galaxy::Camera::m_data |
|
private |
◆ m_pos
| glm::vec2 galaxy::Camera::m_pos |
|
private |
Cached for easy retrieval. Pos.
Definition at line 270 of file Camera.hpp.
◆ m_rotation
| float galaxy::Camera::m_rotation |
|
private |
Cached for easy retrieval. Rotation.
Definition at line 276 of file Camera.hpp.
◆ m_scale
| glm::vec2 galaxy::Camera::m_scale |
|
private |
Cached for easy retrieval. Scale.
Definition at line 282 of file Camera.hpp.
◆ m_origin
| glm::vec2 galaxy::Camera::m_origin |
|
private |
Transform origin point.
Definition at line 287 of file Camera.hpp.
◆ m_dirty
| bool galaxy::Camera::m_dirty |
|
private |
Flag to see if transform needs to be recalculated.
Definition at line 292 of file Camera.hpp.
◆ m_transform
| glm::mat4 galaxy::Camera::m_transform |
|
private |
The documentation for this class was generated from the following files: