Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Object::Component::Transform Struct Reference

#include <Transform.hpp>

Public Member Functions

 Transform (glm::vec3 position=glm::vec3(0), glm::vec3 scale=glm::vec3(1), glm::quat rotation=glm::quat(1, 0, 0, 0))
 Transform (const Transform &)=default
 Transform (Transform &&)=default
Transformoperator= (const Transform &)=default
Transformoperator= (Transform &&)=default
const glm::vec3 & GetPosition () const
const glm::vec3 & GetScale () const
const glm::quat & GetRotation () const
void SetPosition (const glm::vec3 &newPosition)
void SetPosition (float x, float y, float z)
void SetScale (const glm::vec3 &newScale)
void SetScale (float x, float y, float z)
void SetRotation (const glm::quat &newRotation)
void SetRotation (float x, float y, float z, float w)
glm::vec3 GetForwardVector () const
glm::vec3 GetRightVector () const
glm::vec3 GetUpVector () const
glm::mat4 ComputeTransformationMatrix () const

Private Member Functions

glm::mat4 _BuildTransformationMatrix () const

Private Attributes

glm::vec3 _position
glm::vec3 _scale
glm::quat _rotation
bool _dirty = true
glm::mat4 _transformationMatrixCache = glm::mat4(1.0f)

Detailed Description

Component used to represent a 3D transformation for a game object. It can be used as a 2D transformation. This transformation is represented by position, scale, and rotation.

Constructor & Destructor Documentation

◆ Transform() [1/3]

Object::Component::Transform::Transform ( glm::vec3 position = glm::vec3(0),
glm::vec3 scale = glm::vec3(1),
glm::quat rotation = glm::quat(1, 0, 0, 0) )
inline
Parameters
positionposition of the entity. Default is (0, 0, 0).
scalescale of the entity. Default is (1, 1, 1).
rotationrotation of the entity. Default is identity (no rotation).

◆ Transform() [2/3]

Object::Component::Transform::Transform ( const Transform & )
default

◆ Transform() [3/3]

Object::Component::Transform::Transform ( Transform && )
default

Member Function Documentation

◆ _BuildTransformationMatrix()

glm::mat4 Object::Component::Transform::_BuildTransformationMatrix ( ) const
inlineprivate

◆ ComputeTransformationMatrix()

glm::mat4 Object::Component::Transform::ComputeTransformationMatrix ( ) const
inline

Create the transformation matrix for this transform component.

Returns
transformation matrix that combines the position, scale, and rotation of the entity.

◆ GetForwardVector()

glm::vec3 Object::Component::Transform::GetForwardVector ( ) const
inline

◆ GetPosition()

const glm::vec3 & Object::Component::Transform::GetPosition ( ) const
inline

◆ GetRightVector()

glm::vec3 Object::Component::Transform::GetRightVector ( ) const
inline

◆ GetRotation()

const glm::quat & Object::Component::Transform::GetRotation ( ) const
inline

◆ GetScale()

const glm::vec3 & Object::Component::Transform::GetScale ( ) const
inline

◆ GetUpVector()

glm::vec3 Object::Component::Transform::GetUpVector ( ) const
inline

◆ operator=() [1/2]

Transform & Object::Component::Transform::operator= ( const Transform & )
default

◆ operator=() [2/2]

Transform & Object::Component::Transform::operator= ( Transform && )
default

◆ SetPosition() [1/2]

void Object::Component::Transform::SetPosition ( const glm::vec3 & newPosition)
inline

◆ SetPosition() [2/2]

void Object::Component::Transform::SetPosition ( float x,
float y,
float z )
inline

◆ SetRotation() [1/2]

void Object::Component::Transform::SetRotation ( const glm::quat & newRotation)
inline

◆ SetRotation() [2/2]

void Object::Component::Transform::SetRotation ( float x,
float y,
float z,
float w )
inline

◆ SetScale() [1/2]

void Object::Component::Transform::SetScale ( const glm::vec3 & newScale)
inline

◆ SetScale() [2/2]

void Object::Component::Transform::SetScale ( float x,
float y,
float z )
inline

Member Data Documentation

◆ _dirty

bool Object::Component::Transform::_dirty = true
mutableprivate

◆ _position

glm::vec3 Object::Component::Transform::_position
private

Position of the entity

◆ _rotation

glm::quat Object::Component::Transform::_rotation
private

Rotation of the entity Represents a rotation around the origin, represented as a quaternion.

◆ _scale

glm::vec3 Object::Component::Transform::_scale
private

Scale of the entity

◆ _transformationMatrixCache

glm::mat4 Object::Component::Transform::_transformationMatrixCache = glm::mat4(1.0f)
mutableprivate

The documentation for this struct was generated from the following file: