The Transform Component class.
More...
#include <TransformComponent.h>
The Transform Component class.
Contains the necessary transformation info to be attached to a particular entity. This consists of one each of a translation, rotation, and scale. A cached transform matrix is also stored to prevent excessively computing the overall transformation matrix from the stored translation, rotation, and scale data.
- See also
- JETransformComponentManager, JEVulkanRenderer
◆ TransformComponent()
JoeEngine::TransformComponent::TransformComponent |
( |
| ) |
|
|
inline |
Default constructor.
Initializes all members to an appropriate transformation. Translation - 0, 0, 0 Rotation - 0 Scale - 1, 1, 1 Cached transform - identity matrix
◆ ~TransformComponent()
JoeEngine::TransformComponent::~TransformComponent |
( |
| ) |
|
|
default |
◆ GetRotation()
const glm::quat& JoeEngine::TransformComponent::GetRotation |
( |
| ) |
const |
|
inline |
Get rotation.
Returns the rotation data of this component.
- Returns
- the rotation data
◆ GetScale()
const glm::vec3& JoeEngine::TransformComponent::GetScale |
( |
| ) |
const |
|
inline |
Get scale.
Returns the scale data of this component.
- Returns
- the scale data
◆ GetTransform()
const glm::mat4& JoeEngine::TransformComponent::GetTransform |
( |
| ) |
const |
|
inline |
Get cached transform.
Returns the overall (cached) transform of this component.
- Returns
- the cached transform
◆ GetTranslation()
const glm::vec3& JoeEngine::TransformComponent::GetTranslation |
( |
| ) |
const |
|
inline |
Get translation.
Returns the translation data of this component.
- Returns
- the translation data
◆ RecomputeTransform()
void JoeEngine::TransformComponent::RecomputeTransform |
( |
| ) |
|
|
inline |
Recompute cached transform.
Updates the cached transform to reflect the stored translation, rotation, and scale data. If the cached transform has any changes (e.g. via SetTransform()) that are not reflected in the stored translation, rotation, and scale data, they will be lost. This function is automatically called from SetTranslation(), SetRotation(), and SetScale().
- See also
- SetTranslation(), SetRotation, SetScale(), SetTransform()
◆ SetRotation() [1/2]
void JoeEngine::TransformComponent::SetRotation |
( |
const float |
angle, |
|
|
const glm::vec3 & |
axis |
|
) |
| |
|
inline |
Set rotation.
Sets the rotation data of this component to the specified rotation angle and axis. Automatically calls RecomputeTransform().
- Parameters
-
angle | the new rotation angle |
axis | the new rotation axis |
- See also
- RecomputeTransform()
◆ SetRotation() [2/2]
void JoeEngine::TransformComponent::SetRotation |
( |
const glm::quat & |
newRotation | ) |
|
|
inline |
Set rotation.
Sets the rotation data of this component to the specified rotation quaternion. Automatically calls RecomputeTransform().
- Parameters
-
newRotation | the new rotation quaternion data |
- See also
- RecomputeTransform()
◆ SetScale()
void JoeEngine::TransformComponent::SetScale |
( |
const glm::vec3 & |
newScale | ) |
|
|
inline |
◆ SetTransform()
void JoeEngine::TransformComponent::SetTransform |
( |
const glm::mat4 & |
newTransform | ) |
|
|
inline |
Set cached transform.
Sets the overall (cached) transform data of this component to the specified transformation matrix. Does NOT automatically call RecomputeTransform(). Changes made to the overall transformation via this function will stick until RecomputeTransform() is called.
- Parameters
-
newTransform | the new transformation data |
- See also
- RecomputeTransform()
◆ SetTranslation()
void JoeEngine::TransformComponent::SetTranslation |
( |
const glm::vec3 & |
newTranslation | ) |
|
|
inline |
Set translation.
Sets the translation data of this component to the specified translation vector. Automatically calls RecomputeTransform().
- Parameters
-
newTranslation | the new translation data |
- See also
- RecomputeTransform()
The documentation for this class was generated from the following file: