Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Ecs::Transform Struct Reference

Local transform matrix and helpers for translation, rotation, and scale. More...

#include <EcsData.h>

Public Member Functions

 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.

Public Attributes

glm::mat4 matrix = glm::mat4(1.0f)
 Column-major local transform matrix.

Detailed Description

Local transform matrix and helpers for translation, rotation, and scale.

Definition at line 476 of file EcsData.h.

Constructor & Destructor Documentation

◆ 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
matrixLocal 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
positionLocal position.

◆ Transform() [4/6]

Engine::Ecs::Transform::Transform ( glm::quat rotation)
explicit

Creates a transform with the given rotation and identity position and scale.

Parameters
rotationLocal 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
positionLocal position.
rotationLocal 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
positionLocal position.
rotationLocal Euler rotation in degrees.
scaleLocal scale.

Member Function Documentation

◆ 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
newFacingTarget 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
newPositionNew 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
newQuaternionNew 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
newRotationNew local Euler rotation in degrees.

◆ setScale()

void Engine::Ecs::Transform::setScale ( const glm::vec3 & newScale)

Sets local scale and preserves position and rotation.

Parameters
newScaleNew local scale.

Member Data Documentation

◆ matrix

glm::mat4 Engine::Ecs::Transform::matrix = glm::mat4(1.0f)

Column-major local transform matrix.

Definition at line 513 of file EcsData.h.

Referenced by Engine::Entities::Scene::spawnActorAttached(), and Transform().


The documentation for this struct was generated from the following file:
  • /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Ecs/EcsData.h