CG_Labs  2021.2
Public Member Functions | Protected Attributes | Friends | List of all members
TRSTransform< T, P > Class Template Reference

#include <TRSTransform.h>

Public Member Functions

 TRSTransform ()
 
 ~TRSTransform ()
 
void ResetTransform ()
 
void Translate (glm::tvec3< T, P > v)
 
void Scale (glm::tvec3< T, P > v)
 
void Scale (T uniform)
 
void Rotate (T angle, glm::tvec3< T, P > v)
 
void RotateX (T angle)
 
void RotateY (T angle)
 
void RotateZ (T angle)
 
void PreRotate (T angle, glm::tvec3< T, P > v)
 
void PreRotateX (T angle)
 
void PreRotateY (T angle)
 
void PreRotateZ (T angle)
 
void SetTranslate (glm::tvec3< T, P > v)
 
void SetScale (glm::tvec3< T, P > v)
 
void SetScale (T uniform)
 
void SetRotate (T angle, glm::tvec3< T, P > v)
 
void SetRotateX (T angle)
 
void SetRotateY (T angle)
 
void SetRotateZ (T angle)
 
void LookTowards (glm::tvec3< T, P > front_vec, glm::tvec3< T, P > up_vec)
 
void LookTowards (glm::tvec3< T, P > front_vec)
 
void LookAt (glm::tvec3< T, P > point, glm::tvec3< T, P > up_vec)
 
void LookAt (glm::tvec3< T, P > point)
 
glm::tmat4x4< T, P > GetMatrix () const
 
glm::tmat4x4< T, P > GetMatrixInverse () const
 
glm::tmat3x3< T, P > GetRotation () const
 
glm::tvec3< T, P > GetTranslation () const
 
glm::tvec3< T, P > GetScale () const
 
glm::tmat4x4< T, P > GetTranslationMatrix () const
 
glm::tmat4x4< T, P > GetRotationMatrix () const
 
glm::tmat4x4< T, P > GetScaleMatrix () const
 
glm::tmat4x4< T, P > GetTranslationMatrixInverse () const
 
glm::tmat4x4< T, P > GetRotationMatrixInverse () const
 
glm::tmat4x4< T, P > GetScaleMatrixInverse () const
 
glm::tmat4x4< T, P > GetTranslationRotationMatrix () const
 
glm::tvec3< T, P > GetUp () const
 
glm::tvec3< T, P > GetDown () const
 
glm::tvec3< T, P > GetLeft () const
 
glm::tvec3< T, P > GetRight () const
 
glm::tvec3< T, P > GetFront () const
 
glm::tvec3< T, P > GetBack () const
 

Protected Attributes

glm::tmat3x3< T, P > mR
 
glm::tvec3< T, P > mT
 
glm::tvec3< T, P > mS
 

Friends

std::ostream & operator<< (std::ostream &os, TRSTransform< T, P > &v)
 
std::istream & operator>> (std::istream &is, TRSTransform< T, P > &v)
 

Detailed Description

template<typename T, glm::precision P>
class TRSTransform< T, P >

A TRS-transform M is composed of rotation, translation and scale. We define M as:

M = T * R * S

Transformations can be used hierarchically. This means that every transformable child node will inherit the transformations of its parent. Let's say for instance, that there are two nodes A and B. A is the parent of B and both are transformable. The local transformation of A is denoted Ma and for B its Ma. The matrix that brings nodes A and B to world space is denoted Wa and Wa. The resulting transformations for the nodes will then be:

Ma = Ta * Ra * Sa Mb = Tb * Rb * Sb

Wa = Ma = Ta * Ra * Sa Wb = Ma * Mb = (Ta * Ra * Sa) * (Ta * Rb * Sb)

The MB matrix will then, in turn, be recursively be applied to any children of node B to construct new model->world matrices, in the same manner as in the example above.

Constructor & Destructor Documentation

◆ TRSTransform()

template<typename T , glm::precision P>
TRSTransform< T, P >::TRSTransform

◆ ~TRSTransform()

template<typename T , glm::precision P>
TRSTransform< T, P >::~TRSTransform

Member Function Documentation

◆ GetBack()

template<typename T , glm::precision P>
glm::tvec3< T, P > TRSTransform< T, P >::GetBack

◆ GetDown()

template<typename T , glm::precision P>
glm::tvec3< T, P > TRSTransform< T, P >::GetDown

◆ GetFront()

template<typename T , glm::precision P>
glm::tvec3< T, P > TRSTransform< T, P >::GetFront

◆ GetLeft()

template<typename T , glm::precision P>
glm::tvec3< T, P > TRSTransform< T, P >::GetLeft

◆ GetMatrix()

template<typename T , glm::precision P>
glm::tmat4x4< T, P > TRSTransform< T, P >::GetMatrix

◆ GetMatrixInverse()

template<typename T , glm::precision P>
glm::tmat4x4< T, P > TRSTransform< T, P >::GetMatrixInverse

◆ GetRight()

template<typename T , glm::precision P>
glm::tvec3< T, P > TRSTransform< T, P >::GetRight

◆ GetRotation()

template<typename T , glm::precision P>
glm::tmat3x3< T, P > TRSTransform< T, P >::GetRotation

◆ GetRotationMatrix()

template<typename T , glm::precision P>
glm::tmat4x4< T, P > TRSTransform< T, P >::GetRotationMatrix

◆ GetRotationMatrixInverse()

template<typename T , glm::precision P>
glm::tmat4x4< T, P > TRSTransform< T, P >::GetRotationMatrixInverse

◆ GetScale()

template<typename T , glm::precision P>
glm::tvec3< T, P > TRSTransform< T, P >::GetScale

◆ GetScaleMatrix()

template<typename T , glm::precision P>
glm::tmat4x4< T, P > TRSTransform< T, P >::GetScaleMatrix

◆ GetScaleMatrixInverse()

template<typename T , glm::precision P>
glm::tmat4x4< T, P > TRSTransform< T, P >::GetScaleMatrixInverse

◆ GetTranslation()

template<typename T , glm::precision P>
glm::tvec3< T, P > TRSTransform< T, P >::GetTranslation

◆ GetTranslationMatrix()

template<typename T , glm::precision P>
glm::tmat4x4< T, P > TRSTransform< T, P >::GetTranslationMatrix

◆ GetTranslationMatrixInverse()

template<typename T , glm::precision P>
glm::tmat4x4< T, P > TRSTransform< T, P >::GetTranslationMatrixInverse

◆ GetTranslationRotationMatrix()

template<typename T , glm::precision P>
glm::tmat4x4< T, P > TRSTransform< T, P >::GetTranslationRotationMatrix

◆ GetUp()

template<typename T , glm::precision P>
glm::tvec3< T, P > TRSTransform< T, P >::GetUp

◆ LookAt() [1/2]

template<typename T , glm::precision P>
void TRSTransform< T, P >::LookAt ( glm::tvec3< T, P >  point)

◆ LookAt() [2/2]

template<typename T , glm::precision P>
void TRSTransform< T, P >::LookAt ( glm::tvec3< T, P >  point,
glm::tvec3< T, P >  up_vec 
)

◆ LookTowards() [1/2]

template<typename T , glm::precision P>
void TRSTransform< T, P >::LookTowards ( glm::tvec3< T, P >  front_vec)

◆ LookTowards() [2/2]

template<typename T , glm::precision P>
void TRSTransform< T, P >::LookTowards ( glm::tvec3< T, P >  front_vec,
glm::tvec3< T, P >  up_vec 
)

◆ PreRotate()

template<typename T , glm::precision P>
void TRSTransform< T, P >::PreRotate ( angle,
glm::tvec3< T, P >  v 
)

◆ PreRotateX()

template<typename T , glm::precision P>
void TRSTransform< T, P >::PreRotateX ( angle)

◆ PreRotateY()

template<typename T , glm::precision P>
void TRSTransform< T, P >::PreRotateY ( angle)

◆ PreRotateZ()

template<typename T , glm::precision P>
void TRSTransform< T, P >::PreRotateZ ( angle)

◆ ResetTransform()

template<typename T , glm::precision P>
void TRSTransform< T, P >::ResetTransform

◆ Rotate()

template<typename T , glm::precision P>
void TRSTransform< T, P >::Rotate ( angle,
glm::tvec3< T, P >  v 
)

◆ RotateX()

template<typename T , glm::precision P>
void TRSTransform< T, P >::RotateX ( angle)

◆ RotateY()

template<typename T , glm::precision P>
void TRSTransform< T, P >::RotateY ( angle)

◆ RotateZ()

template<typename T , glm::precision P>
void TRSTransform< T, P >::RotateZ ( angle)

◆ Scale() [1/2]

template<typename T , glm::precision P>
void TRSTransform< T, P >::Scale ( glm::tvec3< T, P >  v)

◆ Scale() [2/2]

template<typename T , glm::precision P>
void TRSTransform< T, P >::Scale ( uniform)

◆ SetRotate()

template<typename T , glm::precision P>
void TRSTransform< T, P >::SetRotate ( angle,
glm::tvec3< T, P >  v 
)

◆ SetRotateX()

template<typename T , glm::precision P>
void TRSTransform< T, P >::SetRotateX ( angle)

◆ SetRotateY()

template<typename T , glm::precision P>
void TRSTransform< T, P >::SetRotateY ( angle)

◆ SetRotateZ()

template<typename T , glm::precision P>
void TRSTransform< T, P >::SetRotateZ ( angle)

◆ SetScale() [1/2]

template<typename T , glm::precision P>
void TRSTransform< T, P >::SetScale ( glm::tvec3< T, P >  v)

◆ SetScale() [2/2]

template<typename T , glm::precision P>
void TRSTransform< T, P >::SetScale ( uniform)

◆ SetTranslate()

template<typename T , glm::precision P>
void TRSTransform< T, P >::SetTranslate ( glm::tvec3< T, P >  v)

◆ Translate()

template<typename T , glm::precision P>
void TRSTransform< T, P >::Translate ( glm::tvec3< T, P >  v)

Friends And Related Function Documentation

◆ operator<<

template<typename T , glm::precision P>
std::ostream& operator<< ( std::ostream &  os,
TRSTransform< T, P > &  v 
)
friend

◆ operator>>

template<typename T , glm::precision P>
std::istream& operator>> ( std::istream &  is,
TRSTransform< T, P > &  v 
)
friend

Member Data Documentation

◆ mR

template<typename T , glm::precision P>
glm::tmat3x3<T, P> TRSTransform< T, P >::mR
protected

◆ mS

template<typename T , glm::precision P>
glm::tvec3<T, P> TRSTransform< T, P >::mS
protected

◆ mT

template<typename T , glm::precision P>
glm::tvec3<T, P> TRSTransform< T, P >::mT
protected

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