|
SleakEngine 0.1.0
C++23 multi-backend game engine
|
Represents the position, rotation, and scale of an entity in 3D space. More...
#include <TransformComponent.hpp>
Classes | |
| struct | TransformMatrix |
| Cached translation/rotation/scale matrices combined into the final transform matrix. More... | |
Public Member Functions | |
| TransformComponent (GameObject *object, const Vector3D &position) | |
| TransformComponent (GameObject *object, const Vector3D &position, const Quaternion &rotation) | |
| TransformComponent (GameObject *object, const Vector3D &position, const Quaternion &rotation, const Vector3D &scale) | |
| ~TransformComponent () override | |
| Vector3D | Forward () const |
| Matrix4 | GetTransformMatrix () |
| Vector3D | GetWorldPosition () const |
| Quaternion | GetWorldRotation () const |
| Vector3D | GetWorldScale () const |
| bool | Initialize () override |
| Allocates the transform's GPU constant buffer. | |
| void | LookAt (const Vector3D &target) |
| Orients the transform to face target, using world up as reference. | |
| Vector3D | Right () const |
| void | Rotate (const Quaternion &rotation) |
| Composes rotation onto the current orientation. | |
| void | RotateAround (const Vector3D &axis, float angle) |
| Rotates by angle around axis in world space. | |
| void | RotateAroundLocal (const Vector3D &axis, float angle) |
| Rotates by angle around axis expressed in the object's local space. | |
| void | Scale (const Vector3D &scale) |
| Multiplies the current scale componentwise by scale. | |
| void | Scale (float amount) |
| Uniformly scales by amount along all axes. | |
| void | SetPosition (const Vector3D &position) |
| void | SetRotation (const Quaternion &rotation) |
| void | SetScale (const Vector3D &scale) |
| void | Translate (const Vector3D &translation) |
| Adds translation to position and refreshes the cached matrix. | |
| void | Translate (float x, float y, float z) |
| Vector3D | Up () const |
| void | Update (float DeltaTime) override |
| Refreshes and rebinds the transform constant buffer for this frame. | |
| Public Member Functions inherited from Sleak::Component | |
| Component (GameObject *object) | |
| virtual | ~Component ()=default |
| virtual void | FixedUpdate (float fixedDeltaTime) |
| GameObject * | GetOwner () |
| bool | IsInitialized () const |
| True once Initialize() has run and succeeded. | |
| virtual void | LateUpdate (float deltaTime) |
| virtual void | OnDestroy () |
| Called when the component is detached or the owner is destroyed. | |
| virtual void | OnDisable () |
| virtual void | OnEnable () |
| Public Member Functions inherited from Sleak::Object | |
| Object (const std::string &name="Object") | |
| virtual | ~Object ()=default |
| std::string | GetDebugName () const |
| Name plus unique ID, for logs where names can repeat. | |
| const std::string & | GetName () const |
| uint64_t | GetUniqueID () const |
| void | SetName (const std::string &value) |
Protected Attributes | |
| Vector3D | position = Vector3D(0.0f, 0.0f, 0.0f) |
| Quaternion | rotation = Quaternion() |
| Vector3D | scale = Vector3D(1.0f, 1.0f, 1.0f) |
| TransformMatrix * | Transform = nullptr |
| Protected Attributes inherited from Sleak::Component | |
| bool | bIsInitialized |
| GameObject * | owner |
Represents the position, rotation, and scale of an entity in 3D space.
This component is essential for positioning and orienting entities within the game world. It provides functionalities for setting and retrieving the transform properties, as well as calculating transformation matrices for rendering and physics calculations.
Definition at line 26 of file TransformComponent.hpp.
| Sleak::TransformComponent::TransformComponent | ( | GameObject * | object, |
| const Vector3D & | position ) |
Definition at line 12 of file TransformComponent.cpp.
| Sleak::TransformComponent::TransformComponent | ( | GameObject * | object, |
| const Vector3D & | position, | ||
| const Quaternion & | rotation ) |
Definition at line 14 of file TransformComponent.cpp.
| Sleak::TransformComponent::TransformComponent | ( | GameObject * | object, |
| const Vector3D & | position, | ||
| const Quaternion & | rotation, | ||
| const Vector3D & | scale ) |
Definition at line 19 of file TransformComponent.cpp.
|
override |
Definition at line 29 of file TransformComponent.cpp.
| Vector3D Sleak::TransformComponent::Forward | ( | ) | const |
Definition at line 102 of file TransformComponent.cpp.
| Matrix4 Sleak::TransformComponent::GetTransformMatrix | ( | ) |
Definition at line 58 of file TransformComponent.cpp.
| Vector3D Sleak::TransformComponent::GetWorldPosition | ( | ) | const |
Definition at line 130 of file TransformComponent.cpp.
| Quaternion Sleak::TransformComponent::GetWorldRotation | ( | ) | const |
Definition at line 134 of file TransformComponent.cpp.
| Vector3D Sleak::TransformComponent::GetWorldScale | ( | ) | const |
Definition at line 138 of file TransformComponent.cpp.
|
overridevirtual |
Allocates the transform's GPU constant buffer.
Implements Sleak::Component.
Definition at line 34 of file TransformComponent.cpp.
| void Sleak::TransformComponent::LookAt | ( | const Vector3D & | target | ) |
Orients the transform to face target, using world up as reference.
Definition at line 123 of file TransformComponent.cpp.
| Vector3D Sleak::TransformComponent::Right | ( | ) | const |
Definition at line 106 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Rotate | ( | const Quaternion & | rotation | ) |
Composes rotation onto the current orientation.
Definition at line 74 of file TransformComponent.cpp.
| void Sleak::TransformComponent::RotateAround | ( | const Vector3D & | axis, |
| float | angle ) |
Rotates by angle around axis in world space.
Definition at line 115 of file TransformComponent.cpp.
| void Sleak::TransformComponent::RotateAroundLocal | ( | const Vector3D & | axis, |
| float | angle ) |
Rotates by angle around axis expressed in the object's local space.
Definition at line 119 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Scale | ( | const Vector3D & | scale | ) |
Multiplies the current scale componentwise by scale.
Definition at line 83 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Scale | ( | float | amount | ) |
Uniformly scales by amount along all axes.
Definition at line 79 of file TransformComponent.cpp.
| void Sleak::TransformComponent::SetPosition | ( | const Vector3D & | position | ) |
Definition at line 89 of file TransformComponent.cpp.
| void Sleak::TransformComponent::SetRotation | ( | const Quaternion & | rotation | ) |
Definition at line 93 of file TransformComponent.cpp.
| void Sleak::TransformComponent::SetScale | ( | const Vector3D & | scale | ) |
Definition at line 97 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Translate | ( | const Vector3D & | translation | ) |
Adds translation to position and refreshes the cached matrix.
Definition at line 63 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Translate | ( | float | x, |
| float | y, | ||
| float | z ) |
Definition at line 70 of file TransformComponent.cpp.
| Vector3D Sleak::TransformComponent::Up | ( | ) | const |
Definition at line 110 of file TransformComponent.cpp.
|
overridevirtual |
Refreshes and rebinds the transform constant buffer for this frame.
Implements Sleak::Component.
Definition at line 51 of file TransformComponent.cpp.
Definition at line 94 of file TransformComponent.hpp.
|
protected |
Definition at line 95 of file TransformComponent.hpp.
Definition at line 96 of file TransformComponent.hpp.
|
protected |
Definition at line 97 of file TransformComponent.hpp.