Local transform matrix and helpers for translation, rotation, and scale.
More...
#include <EcsData.h>
|
| | Transform ()=default |
| | Creates an identity transform.
|
| | Transform (glm::mat4 matrix) |
| | Creates a transform from a full matrix.
|
| | Transform (glm::vec3 position) |
| | Creates a transform with the given position and identity rotation and scale.
|
| | Transform (glm::quat rotation) |
| | Creates a transform with the given rotation and identity position and scale.
|
| | Transform (glm::vec3 position, glm::quat rotation) |
| | Creates a transform with the given position and rotation.
|
| | Transform (glm::vec3 position, glm::eulr rotation, glm::vec3 scale) |
| | Creates a transform with position, Euler rotation, and scale.
|
| glm::vec3 | getPosition () const |
| | Returns the local position stored in the translation column.
|
| glm::quat | getRotation () const |
| | Returns the local rotation extracted from the matrix axes.
|
| glm::vec3 | getRotationEuler () const |
| | Returns the local Euler rotation in degrees.
|
| glm::vec3 | getScale () const |
| | Returns local scale from the lengths of the basis vectors.
|
| void | setPosition (const glm::vec3 &newPosition) |
| | Sets local position and preserves rotation and scale.
|
| void | setRotation (const glm::vec3 &newRotation) |
| | Sets local rotation from Euler angles in degrees and preserves position and scale.
|
| void | setRotation (const glm::quat &newQuaternion) |
| | Sets local rotation from a quaternion and preserves position and scale.
|
| void | setScale (const glm::vec3 &newScale) |
| | Sets local scale and preserves position and rotation.
|
| void | setFacing (const glm::vec3 &newFacing) |
| | Rotates the transform so local -Z faces the given direction.
|
|
| glm::mat4 | matrix = glm::mat4(1.0f) |
| | Column-major local transform matrix.
|
Local transform matrix and helpers for translation, rotation, and scale.
Definition at line 476 of file EcsData.h.
◆ Transform() [1/6]
| Engine::Ecs::Transform::Transform |
( |
| ) |
|
|
default |
Creates an identity transform.
◆ Transform() [2/6]
| Engine::Ecs::Transform::Transform |
( |
glm::mat4 | matrix | ) |
|
|
explicit |
Creates a transform from a full matrix.
- Parameters
-
| matrix | Local transform matrix. |
References matrix.
◆ Transform() [3/6]
| Engine::Ecs::Transform::Transform |
( |
glm::vec3 | position | ) |
|
|
explicit |
Creates a transform with the given position and identity rotation and scale.
- Parameters
-
◆ Transform() [4/6]
| Engine::Ecs::Transform::Transform |
( |
glm::quat | rotation | ) |
|
|
explicit |
Creates a transform with the given rotation and identity position and scale.
- Parameters
-
| rotation | Local rotation quaternion. |
◆ Transform() [5/6]
| Engine::Ecs::Transform::Transform |
( |
glm::vec3 | position, |
|
|
glm::quat | rotation ) |
|
explicit |
Creates a transform with the given position and rotation.
- Parameters
-
| position | Local position. |
| rotation | Local rotation quaternion. |
◆ Transform() [6/6]
| Engine::Ecs::Transform::Transform |
( |
glm::vec3 | position, |
|
|
glm::eulr | rotation, |
|
|
glm::vec3 | scale ) |
|
explicit |
Creates a transform with position, Euler rotation, and scale.
- Parameters
-
| position | Local position. |
| rotation | Local Euler rotation in degrees. |
| scale | Local scale. |
◆ getPosition()
| glm::vec3 Engine::Ecs::Transform::getPosition |
( |
| ) |
const |
|
nodiscard |
Returns the local position stored in the translation column.
◆ getRotation()
| glm::quat Engine::Ecs::Transform::getRotation |
( |
| ) |
const |
|
nodiscard |
Returns the local rotation extracted from the matrix axes.
◆ getRotationEuler()
| glm::vec3 Engine::Ecs::Transform::getRotationEuler |
( |
| ) |
const |
|
nodiscard |
Returns the local Euler rotation in degrees.
◆ getScale()
| glm::vec3 Engine::Ecs::Transform::getScale |
( |
| ) |
const |
|
nodiscard |
Returns local scale from the lengths of the basis vectors.
◆ setFacing()
| void Engine::Ecs::Transform::setFacing |
( |
const glm::vec3 & | newFacing | ) |
|
Rotates the transform so local -Z faces the given direction.
- Parameters
-
| newFacing | Target facing direction. A zero vector leaves the transform unchanged. |
◆ setPosition()
| void Engine::Ecs::Transform::setPosition |
( |
const glm::vec3 & | newPosition | ) |
|
Sets local position and preserves rotation and scale.
- Parameters
-
| newPosition | New local position. |
◆ setRotation() [1/2]
| void Engine::Ecs::Transform::setRotation |
( |
const glm::quat & | newQuaternion | ) |
|
Sets local rotation from a quaternion and preserves position and scale.
- Parameters
-
| newQuaternion | New local rotation. |
◆ setRotation() [2/2]
| void Engine::Ecs::Transform::setRotation |
( |
const glm::vec3 & | newRotation | ) |
|
Sets local rotation from Euler angles in degrees and preserves position and scale.
- Parameters
-
| newRotation | New local Euler rotation in degrees. |
◆ setScale()
| void Engine::Ecs::Transform::setScale |
( |
const glm::vec3 & | newScale | ) |
|
Sets local scale and preserves position and rotation.
- Parameters
-
◆ matrix
| glm::mat4 Engine::Ecs::Transform::matrix = glm::mat4(1.0f) |
The documentation for this struct was generated from the following file:
- /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Ecs/EcsData.h