![]() |
Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
|
Represents a 2D transformable scene component with position, rotation, and scale. More...
#include <scene_component_2d.hpp>
Public Member Functions | |
| SceneComponent2D () | |
| Constructs a SceneComponent2D at the origin, with zero rotation and unit scale. | |
| virtual | ~SceneComponent2D ()=default |
| Destructor. | |
| void | SetPosition (const glm::vec2 &position) |
| Sets the position in 2D space. | |
| void | SetRotation (float angleDegrees) |
| Sets the rotation angle in degrees. | |
| void | SetScale (const glm::vec2 &scale) |
| Sets the scale in each dimension. | |
| const glm::vec2 & | GetPosition () const |
| Gets the current position. | |
| float | GetRotation () const |
| Gets the current rotation angle (in degrees). | |
| const glm::vec2 & | GetScale () const |
| Gets the current scale. | |
| const glm::mat4 & | GetModelMatrix () const |
| Gets the model matrix for this component. | |
| void | UpdateModelMatrix () |
| Updates the model matrix from the current position, rotation, and scale. | |
Protected Attributes | |
| glm::vec2 | mPosition |
| float | mRotation |
| glm::vec2 | mScale |
| glm::mat4 | mModelMatrix |
Represents a 2D transformable scene component with position, rotation, and scale.
SceneComponent2D holds position (in 2D), rotation (in degrees, counterclockwise), and scale. It provides methods to set and get each component and maintains the current model matrix.
The engine uses a left-handed coordinate system:
The model matrix is updated automatically after any property change, and can be used to transform object-local coordinates into world (scene) coordinates.
Transform order is: scale, then rotate, then translate (S→R→T), matching typical 2D graphics pipelines.
Definition at line 29 of file scene_component_2d.hpp.
| rendering_engine::SceneComponent2D::SceneComponent2D | ( | ) |
Constructs a SceneComponent2D at the origin, with zero rotation and unit scale.
Definition at line 8 of file scene_component_2d.cpp.
|
virtualdefault |
Destructor.
|
inline |
Gets the model matrix for this component.
Definition at line 84 of file scene_component_2d.hpp.
|
inline |
Gets the current position.
Definition at line 64 of file scene_component_2d.hpp.
|
inline |
Gets the current rotation angle (in degrees).
Definition at line 70 of file scene_component_2d.hpp.
|
inline |
Gets the current scale.
Definition at line 76 of file scene_component_2d.hpp.
| void rendering_engine::SceneComponent2D::SetPosition | ( | const glm::vec2 & | position | ) |
Sets the position in 2D space.
| position | New position as glm::vec2. |
Definition at line 18 of file scene_component_2d.cpp.
| void rendering_engine::SceneComponent2D::SetRotation | ( | float | angleDegrees | ) |
Sets the rotation angle in degrees.
| angleDegrees | Angle in degrees (counterclockwise). |
Definition at line 24 of file scene_component_2d.cpp.
| void rendering_engine::SceneComponent2D::SetScale | ( | const glm::vec2 & | scale | ) |
Sets the scale in each dimension.
| scale | New scale as glm::vec2. |
Definition at line 30 of file scene_component_2d.cpp.
| void rendering_engine::SceneComponent2D::UpdateModelMatrix | ( | ) |
Updates the model matrix from the current position, rotation, and scale.
Called automatically after property changes, but can be called manually if needed.
Definition at line 36 of file scene_component_2d.cpp.
|
protected |
Definition at line 98 of file scene_component_2d.hpp.
|
protected |
Definition at line 94 of file scene_component_2d.hpp.
|
protected |
Definition at line 95 of file scene_component_2d.hpp.
|
protected |
Definition at line 96 of file scene_component_2d.hpp.