Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Transform Class Reference

Class for transform. More...

#include <transform.h>

Inheritance diagram for Transform:

Public Member Functions

 Transform ()
 Transform Constructor. More...
 
 ~Transform ()
 Destroys the object. More...
 
bool operator== (const Transform &other)
 operator == More...
 
bool operator!= (const Transform &other)
 operator != More...
 
Transform operator* (const Transform &other) const
 Essentially a matrix multiplication, combines translations, rotations, and scales. More...
 
void addChild (std::shared_ptr< Transform > transform)
 Adds a child. More...
 
void removeChild (std::shared_ptr< Transform > transform)
 Removes a child. More...
 
std::list< std::shared_ptr
< Transform > > 
getChildren () const
 Gets the children. More...
 
std::shared_ptr< TransformgetParent () const
 Gets the parent. More...
 
unsigned int getTreeSize () const
 Gets the tree size. More...
 
void translate (const float x, const float y) noexcept
 Adds 2d translation to Transform. More...
 
void translate (const float x, const float y, const float z) noexcept
 Adds 3d translation to Transform. More...
 
void translate (const glm::vec3 &vec) noexcept
 Adds 3d translation. More...
 
void translate (const glm::vec2 &vec) noexcept
 Adds 2d translation. More...
 
glm::vec3 getAbsoluteTranslation () const noexcept
 Gets the absolute translation. More...
 
glm::vec3 getLocalTranslation () const noexcept
 Gets the local translation. More...
 
void rotate (const float angle_x, const float angle_y, const float angle_z) noexcept
 Rotates this transform using yaw roll pitch/euler angles. More...
 
void rotate (const glm::vec3 &euler_angles) noexcept
 Rotates using euler angles. More...
 
void rotate (const glm::quat &quat) noexcept
 Rotates using a quaternion. More...
 
void rotate (const float angle, const glm::vec3 &axis) noexcept
 Rotates using angle axis. More...
 
glm::quat getAbsoluteRotation () const noexcept
 Gets the absolute rotation. More...
 
float getAbsoluteRotationAngle () const noexcept
 Gets the absolute rotation angle. More...
 
glm::vec3 getAbsoluteRotationAxis () const noexcept
 Gets the absolute rotation axis. More...
 
glm::vec3 getAbsoluteEulerAngles () const noexcept
 Gets the absolute euler angles. More...
 
glm::quat getLocalRotation () const noexcept
 Gets the local rotation. More...
 
float getLocalRotationAngle () const noexcept
 Gets the local rotation angle. More...
 
glm::vec3 getLocalRotationAxis () const noexcept
 Gets the local rotation axis. More...
 
glm::vec3 getLocalEulerAngles () const noexcept
 Gets the local euler angles. More...
 
void scale (const float x) noexcept
 Scales transform in all 3 directions by x. More...
 
void scale (const float x, const float y) noexcept
 Scales transform in 2d. More...
 
void scale (const float x, const float y, const float z) noexcept
 Scales transform in 3d. More...
 
void scale (const glm::vec2 &vec) noexcept
 Scales transform in 2d. More...
 
void scale (const glm::vec3 &vec) noexcept
 Scales transform in 3d. More...
 
glm::vec3 getAbsoluteScale () const noexcept
 Gets the absolute scale. More...
 
glm::vec3 getLocalScale () const noexcept
 Gets the local scale. More...
 
glm::mat4 getAbsoluteTransformationMatrix () const noexcept
 Gets the absolute transformation matrix. More...
 
glm::mat4 getLocalTransformationMatrix () const noexcept
 Gets the local transformation matrix. More...
 
std::string to_string () const noexcept
 Returns a string representation of the object. More...
 

Detailed Description

Class for transform.

Constructor & Destructor Documentation

Transform::Transform ( )

Transform Constructor.

Referenced by ~Transform().

Transform::~Transform ( )

Destroys the object.

References Transform().

Member Function Documentation

void Transform::addChild ( std::shared_ptr< Transform transform)

Adds a child.

Parameters
[in]transformThe transform

Referenced by generated::getTransformModule().

glm::vec3 Transform::getAbsoluteEulerAngles ( ) const
noexcept

Gets the absolute euler angles.

Returns
The absolute euler angles.

References getAbsoluteRotation().

Referenced by generated::getTransformModule().

glm::quat Transform::getAbsoluteRotation ( ) const
noexcept

Gets the absolute rotation.

Returns
The absolute rotation.

Referenced by getAbsoluteEulerAngles(), getAbsoluteRotationAngle(), getAbsoluteRotationAxis(), and generated::getTransformModule().

float Transform::getAbsoluteRotationAngle ( ) const
noexcept

Gets the absolute rotation angle.

Returns
The absolute rotation angle.

References getAbsoluteRotation().

Referenced by generated::getTransformModule(), and to_string().

glm::vec3 Transform::getAbsoluteRotationAxis ( ) const
noexcept

Gets the absolute rotation axis.

Returns
The absolute rotation axis.

References getAbsoluteRotation().

Referenced by generated::getTransformModule(), and to_string().

glm::vec3 Transform::getAbsoluteScale ( ) const
noexcept

Gets the absolute scale.

Returns
The absolute scale.

Referenced by generated::getTransformModule(), and to_string().

glm::mat4 Transform::getAbsoluteTransformationMatrix ( ) const
noexcept

Gets the absolute transformation matrix.

Returns
The absolute transformation matrix.

References getLocalTransformationMatrix().

Referenced by generated::getTransformModule(), Graphics::Camera::onStart(), Graphics::Camera::onUpdate(), and Graphics::UI::Text::renderCharacter().

glm::vec3 Transform::getAbsoluteTranslation ( ) const
noexcept

Gets the absolute translation.

Returns
The absolute translation.

Referenced by generated::getTransformModule(), Graphics::UI::WrappableText::setText(), and to_string().

std::list< std::shared_ptr< Transform > > Transform::getChildren ( ) const

Gets the children.

Returns
list of Transform pointers

Referenced by generated::getTransformModule().

glm::vec3 Transform::getLocalEulerAngles ( ) const
noexcept

Gets the local euler angles.

Returns
The local euler angles.

Referenced by generated::getTransformModule().

glm::quat Transform::getLocalRotation ( ) const
noexcept

Gets the local rotation.

Returns
The local rotation.

Referenced by generated::getTransformModule().

float Transform::getLocalRotationAngle ( ) const
noexcept

Gets the local rotation angle.

Returns
The local rotation angle.

Referenced by generated::getTransformModule().

glm::vec3 Transform::getLocalRotationAxis ( ) const
noexcept

Gets the local rotation axis.

Returns
The local rotation axis.

Referenced by generated::getTransformModule().

glm::vec3 Transform::getLocalScale ( ) const
noexcept

Gets the local scale.

Returns
The local scale.

Referenced by generated::getTransformModule().

glm::mat4 Transform::getLocalTransformationMatrix ( ) const
noexcept

Gets the local transformation matrix.

Returns
The local transformation matrix.

Referenced by getAbsoluteTransformationMatrix(), and generated::getTransformModule().

glm::vec3 Transform::getLocalTranslation ( ) const
noexcept

Gets the local translation.

Returns
The local translation.

Referenced by generated::getTransformModule().

std::shared_ptr< Transform > Transform::getParent ( ) const

Gets the parent.

Returns
The parent.

Referenced by generated::getTransformModule().

unsigned int Transform::getTreeSize ( ) const

Gets the tree size.

Returns
The tree size.

Referenced by generated::getTransformModule().

bool Transform::operator!= ( const Transform other)

operator !=

Parameters
[in]otherThe other

Does not take tree properties into account

Returns
True if not same
Transform Transform::operator* ( const Transform other) const

Essentially a matrix multiplication, combines translations, rotations, and scales.

Parameters
[in]otherThe other
Returns
New transform with the result
bool Transform::operator== ( const Transform other)

operator ==

Parameters
[in]otherThe other

Does not take tree properties into account

Returns
True if same
void Transform::removeChild ( std::shared_ptr< Transform transform)

Removes a child.

Parameters
[in]transformThe transform

Referenced by generated::getTransformModule().

void Transform::rotate ( const float  angle_x,
const float  angle_y,
const float  angle_z 
)
noexcept

Rotates this transform using yaw roll pitch/euler angles.

Parameters
[in]angle_xThe angle x
[in]angle_yThe angle y
[in]angle_zThe angle z

Referenced by generated::getTransformModule().

void Transform::rotate ( const glm::vec3 &  euler_angles)
noexcept

Rotates using euler angles.

Parameters
[in]euler_anglesThe euler angles
void Transform::rotate ( const glm::quat &  quat)
noexcept

Rotates using a quaternion.

Parameters
[in]quatThe quaternion
void Transform::rotate ( const float  angle,
const glm::vec3 &  axis 
)
noexcept

Rotates using angle axis.

Parameters
[in]angleThe angle
[in]axisThe axis
void Transform::scale ( const float  x)
noexcept

Scales transform in all 3 directions by x.

Parameters
[in]x

Referenced by generated::getTransformModule().

void Transform::scale ( const float  x,
const float  y 
)
noexcept

Scales transform in 2d.

Parameters
[in]x
[in]y
void Transform::scale ( const float  x,
const float  y,
const float  z 
)
noexcept

Scales transform in 3d.

Parameters
[in]x
[in]y
[in]z
void Transform::scale ( const glm::vec2 &  vec)
noexcept

Scales transform in 2d.

Parameters
[in]vecThe vector
void Transform::scale ( const glm::vec3 &  vec)
noexcept

Scales transform in 3d.

Parameters
[in]vecThe vector
std::string Transform::to_string ( ) const
noexcept

Returns a string representation of the object.

Returns
String representation of the object.

References getAbsoluteRotationAngle(), getAbsoluteRotationAxis(), getAbsoluteScale(), and getAbsoluteTranslation().

Referenced by generated::getTransformModule().

void Transform::translate ( const float  x,
const float  y 
)
noexcept

Adds 2d translation to Transform.

Parameters
[in]x
[in]y

Referenced by generated::getTransformModule(), and Graphics::UI::WrappableText::setText().

void Transform::translate ( const float  x,
const float  y,
const float  z 
)
noexcept

Adds 3d translation to Transform.

Parameters
[in]x
[in]y
[in]z
void Transform::translate ( const glm::vec3 &  vec)
noexcept

Adds 3d translation.

Parameters
[in]vecThe vector
void Transform::translate ( const glm::vec2 &  vec)
noexcept

Adds 2d translation.

Parameters
[in]vecThe vector

The documentation for this class was generated from the following files: