|
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 () |
| World matrix (S*R*T), recomputed only after a transform change. | |
| 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 |
| Submits this frame's constant buffer unless a sibling mesh does it. | |
| 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 Member Functions | |
| void | MarkWorldDirty () |
Protected Attributes | |
| Vector3D | position = Vector3D(0.0f, 0.0f, 0.0f) |
| Quaternion | rotation = Quaternion() |
| Vector3D | scale = Vector3D(1.0f, 1.0f, 1.0f) |
| Protected Attributes inherited from Sleak::Component | |
| bool | bIsInitialized |
| GameObject * | owner |
Friends | |
| class | MeshComponent |
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.
|
overridedefault |
| Vector3D Sleak::TransformComponent::Forward | ( | ) | const |
Definition at line 112 of file TransformComponent.cpp.
| Matrix4 Sleak::TransformComponent::GetTransformMatrix | ( | ) |
World matrix (S*R*T), recomputed only after a transform change.
Definition at line 59 of file TransformComponent.cpp.
| Vector3D Sleak::TransformComponent::GetWorldPosition | ( | ) | const |
Definition at line 141 of file TransformComponent.cpp.
| Quaternion Sleak::TransformComponent::GetWorldRotation | ( | ) | const |
Definition at line 145 of file TransformComponent.cpp.
| Vector3D Sleak::TransformComponent::GetWorldScale | ( | ) | const |
Definition at line 149 of file TransformComponent.cpp.
|
overridevirtual |
Allocates the transform's GPU constant buffer.
Implements Sleak::Component.
Definition at line 31 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 133 of file TransformComponent.cpp.
|
inlineprotected |
Flags the cached world matrix stale; call after writing fields directly.
Definition at line 96 of file TransformComponent.hpp.
| Vector3D Sleak::TransformComponent::Right | ( | ) | const |
Definition at line 116 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Rotate | ( | const Quaternion & | rotation | ) |
Composes rotation onto the current orientation.
Definition at line 81 of file TransformComponent.cpp.
| void Sleak::TransformComponent::RotateAround | ( | const Vector3D & | axis, |
| float | angle ) |
Rotates by angle around axis in world space.
Definition at line 125 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 129 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Scale | ( | const Vector3D & | scale | ) |
Multiplies the current scale componentwise by scale.
Definition at line 90 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Scale | ( | float | amount | ) |
Uniformly scales by amount along all axes.
Definition at line 86 of file TransformComponent.cpp.
| void Sleak::TransformComponent::SetPosition | ( | const Vector3D & | position | ) |
Definition at line 96 of file TransformComponent.cpp.
| void Sleak::TransformComponent::SetRotation | ( | const Quaternion & | rotation | ) |
Definition at line 101 of file TransformComponent.cpp.
| void Sleak::TransformComponent::SetScale | ( | const Vector3D & | scale | ) |
Definition at line 106 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Translate | ( | const Vector3D & | translation | ) |
Adds translation to position and refreshes the cached matrix.
Definition at line 71 of file TransformComponent.cpp.
| void Sleak::TransformComponent::Translate | ( | float | x, |
| float | y, | ||
| float | z ) |
Definition at line 77 of file TransformComponent.cpp.
| Vector3D Sleak::TransformComponent::Up | ( | ) | const |
Definition at line 120 of file TransformComponent.cpp.
|
overridevirtual |
Submits this frame's constant buffer unless a sibling mesh does it.
Implements Sleak::Component.
Definition at line 45 of file TransformComponent.cpp.
|
friend |
Definition at line 103 of file TransformComponent.hpp.
Definition at line 98 of file TransformComponent.hpp.
|
protected |
Definition at line 99 of file TransformComponent.hpp.
Definition at line 100 of file TransformComponent.hpp.