![]() |
Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
|
Represents a 2D camera with position, rotation, and zoom control. More...
#include <camera_2d.hpp>
Public Member Functions | |
| Camera2D (IApplication &app) | |
| Constructs a 2D camera at the origin, with no rotation and unit zoom. | |
| virtual | ~Camera2D ()=default |
| Virtual destructor. | |
| virtual void | Initialize () |
| Initializes the camera (calls Reset()). | |
| virtual void | Update (float deltaTime) |
| Updates the camera logic (no-op for now). | |
| void | SetViewportSize (float width, float height) |
| Sets the viewport dimensions used to compute the projection matrix. | |
| glm::mat4 | GetProjectionMatrix () const |
| Returns the current orthographic projection matrix. | |
| void | SetPosition (const glm::vec2 &position) |
| Sets the camera position. | |
| void | SetRotation (float angleDegrees) |
| Sets the camera rotation angle in degrees (counterclockwise, around Z). | |
| void | SetZoom (float zoom) |
| Sets the camera zoom (uniform scale). | |
| void | Reset () |
| Resets the camera to the default view (origin, zero rotation, unit zoom). | |
| glm::vec2 | GetPosition () const |
| Gets the camera position. | |
| float | GetRotation () const |
| Gets the camera rotation angle in degrees. | |
| float | GetZoom () const |
| Gets the current zoom factor. | |
| const glm::mat4 & | GetWorldView () const |
| Gets the world-view (model) matrix for the camera. | |
Protected Member Functions | |
| glm::mat4 | ComputeOrthographicMatrix (float left, float right, float top, float bottom, float nearPlane, float farPlane) const |
Protected Attributes | |
| IApplication & | mApp |
| std::unique_ptr< SceneComponent2D > | mSceneComponent |
| glm::vec2 | mViewportSize |
Represents a 2D camera with position, rotation, and zoom control.
Camera2D defines the view in a 2D scene, using a SceneComponent2D for transform (position, rotation, zoom). The camera provides basic pan, rotation, and uniform zoom features.
The engine uses a left-handed coordinate system:
By default, the camera is at the origin, with zero rotation and unit zoom.
Definition at line 35 of file camera_2d.hpp.
| rendering_engine::Camera2D::Camera2D | ( | IApplication & | app | ) |
Constructs a 2D camera at the origin, with no rotation and unit zoom.
Definition at line 8 of file camera_2d.cpp.
|
virtualdefault |
Virtual destructor.
|
protected |
Definition at line 92 of file camera_2d.cpp.
| glm::vec2 rendering_engine::Camera2D::GetPosition | ( | ) | const |
Gets the camera position.
Definition at line 72 of file camera_2d.cpp.
| glm::mat4 rendering_engine::Camera2D::GetProjectionMatrix | ( | ) | const |
Returns the current orthographic projection matrix.
The matrix is built from the camera�s viewport size, and is typically multiplied with the view (world) matrix to transform coordinates into clip space.
Definition at line 30 of file camera_2d.cpp.
| float rendering_engine::Camera2D::GetRotation | ( | ) | const |
Gets the camera rotation angle in degrees.
Definition at line 77 of file camera_2d.cpp.
| const glm::mat4 & rendering_engine::Camera2D::GetWorldView | ( | ) | const |
Gets the world-view (model) matrix for the camera.
Definition at line 87 of file camera_2d.cpp.
| float rendering_engine::Camera2D::GetZoom | ( | ) | const |
|
virtual |
Initializes the camera (calls Reset()).
Definition at line 15 of file camera_2d.cpp.
| void rendering_engine::Camera2D::Reset | ( | ) |
Resets the camera to the default view (origin, zero rotation, unit zoom).
Definition at line 60 of file camera_2d.cpp.
| void rendering_engine::Camera2D::SetPosition | ( | const glm::vec2 & | position | ) |
Sets the camera position.
| position | 2D position (glm::vec2). |
Definition at line 45 of file camera_2d.cpp.
| void rendering_engine::Camera2D::SetRotation | ( | float | angleDegrees | ) |
Sets the camera rotation angle in degrees (counterclockwise, around Z).
| angleDegrees | Angle in degrees. |
Definition at line 50 of file camera_2d.cpp.
| void rendering_engine::Camera2D::SetViewportSize | ( | float | width, |
| float | height ) |
Sets the viewport dimensions used to compute the projection matrix.
This defines the visible area of the camera in screen-space units. The projection matrix will be recomputed based on these dimensions.
| width | Viewport width in pixels or world units. |
| height | Viewport height in pixels or world units. |
Definition at line 25 of file camera_2d.cpp.
| void rendering_engine::Camera2D::SetZoom | ( | float | zoom | ) |
Sets the camera zoom (uniform scale).
| zoom | Zoom factor (1.0 = no zoom). |
Definition at line 55 of file camera_2d.cpp.
|
virtual |
Updates the camera logic (no-op for now).
| deltaTime | Time since last update (seconds). |
Definition at line 21 of file camera_2d.cpp.
|
protected |
Definition at line 135 of file camera_2d.hpp.
|
protected |
Definition at line 136 of file camera_2d.hpp.
|
protected |
Definition at line 137 of file camera_2d.hpp.