![]() |
Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
|
Represents a 3D transformable scene component with position, rotation, and scale. More...
#include <scene_component.hpp>
Public Member Functions | |
| SceneComponent () | |
| Constructs a SceneComponent with default transform (origin, identity rotation, unit scale). More... | |
| virtual | ~SceneComponent ()=default |
| Destructor. More... | |
| void | UpdateLocalMatrix () |
| Updates the world transformation matrix from the current position, rotation, and scale. More... | |
| void | UpdateWorldMatrix () |
| const glm::mat4 & | GetWorldMatrix () |
| Returns the world transformation matrix (model matrix). More... | |
| void | SetPosition (const glm::vec3 &position) |
| Sets the position of the component in world space. More... | |
| void | SetRotation (const glm::quat &rotation) |
| Sets the rotation using a quaternion. More... | |
| void | SetRotation (const glm::vec3 &rotation) |
| Sets the rotation using Euler angles (in degrees). More... | |
| void | SetScale (const glm::vec3 &scale) |
| Sets the scale for each dimension. More... | |
| const glm::vec3 & | GetPosition () const |
| Gets the current position. More... | |
| const glm::quat & | GetRotationQuat () const |
| Gets the current rotation as a quaternion. More... | |
| const glm::vec3 & | GetRotation () const |
| Gets the current rotation as Euler angles (in radians). More... | |
| const glm::vec3 & | GetScale () const |
| Gets the current scale. More... | |
| glm::vec3 | GetForward () const |
| Returns the forward (local X+) direction vector in world space. More... | |
| glm::vec3 | GetRight () const |
| Returns the right (local Y+) direction vector in world space. More... | |
| glm::vec3 | GetUp () const |
| Returns the up (local Z+) direction vector in world space. More... | |
| glm::vec3 | GetWorldPosition () const |
| Returns the world-space position of this component. More... | |
| glm::quat | GetWorldRotation () const |
| Returns the world-space rotation of this component. More... | |
| glm::vec3 | GetWorldScale () const |
| Returns the world-space scale of this component. More... | |
| void | AttachTo (SceneComponent *parent) |
| Attaches this scene component to a parent scene component. More... | |
| SceneComponent (const SceneComponent &rhs)=delete | |
| SceneComponent & | operator= (const SceneComponent &rhs)=delete |
Protected Attributes | |
| glm::vec3 | mPosition |
| glm::quat | mRotation |
| glm::vec3 | mEulerRotation |
| glm::vec3 | mScale |
| glm::mat4 | mLocalMatrix |
| glm::mat4 | mWorldMatrix |
| SceneComponent * | mParent |
| bool | bIsDirty |
Represents a 3D transformable scene component with position, rotation, and scale.
SceneComponent holds the core kinematic properties required for positioning and orienting objects in a 3D scene. It provides methods to set and get position, rotation (as both quaternion and Euler angles, in radians), and scale. The world transformation matrix is updated automatically when any of these properties change. Axis direction vectors (forward, right, up) are derived from the current rotation.
Definition at line 42 of file scene_component.hpp.
| rendering_engine::SceneComponent::SceneComponent | ( | ) |
Constructs a SceneComponent with default transform (origin, identity rotation, unit scale).
Definition at line 6 of file scene_component.cpp.
|
virtualdefault |
Destructor.
|
delete |
| void rendering_engine::SceneComponent::AttachTo | ( | SceneComponent * | parent | ) |
Attaches this scene component to a parent scene component.
After attachment, this component's transform becomes relative to the parent. The world transformation is computed by combining the parent's world transform with this component's local transform.
Passing nullptr detaches the component and makes it a root-level component.
| parent | Pointer to the parent SceneComponent, or nullptr to detach. |
Definition at line 130 of file scene_component.cpp.
| glm::vec3 rendering_engine::SceneComponent::GetForward | ( | ) | const |
Returns the forward (local X+) direction vector in world space.
Definition at line 91 of file scene_component.cpp.
|
inline |
Gets the current position.
Definition at line 102 of file scene_component.hpp.
| glm::vec3 rendering_engine::SceneComponent::GetRight | ( | ) | const |
Returns the right (local Y+) direction vector in world space.
Definition at line 96 of file scene_component.cpp.
|
inline |
Gets the current rotation as Euler angles (in radians).
Definition at line 117 of file scene_component.hpp.
|
inline |
Gets the current rotation as a quaternion.
Definition at line 108 of file scene_component.hpp.
|
inline |
Gets the current scale.
Definition at line 123 of file scene_component.hpp.
| glm::vec3 rendering_engine::SceneComponent::GetUp | ( | ) | const |
Returns the up (local Z+) direction vector in world space.
Definition at line 101 of file scene_component.cpp.
| const glm::mat4 & rendering_engine::SceneComponent::GetWorldMatrix | ( | ) |
Returns the world transformation matrix (model matrix).
Definition at line 44 of file scene_component.cpp.
| glm::vec3 rendering_engine::SceneComponent::GetWorldPosition | ( | ) | const |
Returns the world-space position of this component.
Definition at line 106 of file scene_component.cpp.
| glm::quat rendering_engine::SceneComponent::GetWorldRotation | ( | ) | const |
Returns the world-space rotation of this component.
Definition at line 112 of file scene_component.cpp.
| glm::vec3 rendering_engine::SceneComponent::GetWorldScale | ( | ) | const |
Returns the world-space scale of this component.
Definition at line 120 of file scene_component.cpp.
|
delete |
| void rendering_engine::SceneComponent::SetPosition | ( | const glm::vec3 & | position | ) |
Sets the position of the component in world space.
| position | The new position as a glm::vec3. |
Definition at line 53 of file scene_component.cpp.
| void rendering_engine::SceneComponent::SetRotation | ( | const glm::quat & | rotation | ) |
Sets the rotation using a quaternion.
| rotation | The rotation as a glm::quat. |
Definition at line 60 of file scene_component.cpp.
| void rendering_engine::SceneComponent::SetRotation | ( | const glm::vec3 & | rotation | ) |
Sets the rotation using Euler angles (in degrees).
| rotation | Euler angles in degrees: (pitch, yaw, roll).
|
Definition at line 73 of file scene_component.cpp.
| void rendering_engine::SceneComponent::SetScale | ( | const glm::vec3 & | scale | ) |
Sets the scale for each dimension.
| scale | The new scale as a glm::vec3. |
Definition at line 84 of file scene_component.cpp.
| void rendering_engine::SceneComponent::UpdateLocalMatrix | ( | ) |
Updates the world transformation matrix from the current position, rotation, and scale.
Normally called automatically after setters; call manually if you modify transform members directly.
Definition at line 18 of file scene_component.cpp.
| void rendering_engine::SceneComponent::UpdateWorldMatrix | ( | ) |
Definition at line 30 of file scene_component.cpp.
|
protected |
Definition at line 192 of file scene_component.hpp.
|
protected |
Definition at line 185 of file scene_component.hpp.
|
protected |
Definition at line 188 of file scene_component.hpp.
|
protected |
Definition at line 191 of file scene_component.hpp.
|
protected |
Definition at line 183 of file scene_component.hpp.
|
protected |
Definition at line 184 of file scene_component.hpp.
|
protected |
Definition at line 186 of file scene_component.hpp.
|
protected |
Definition at line 189 of file scene_component.hpp.