All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Luminous::Transformer Class Reference

Geometrical 3D transformation stack. More...

#include <Luminous/Transformer.hpp>

Inheritance diagram for Luminous::Transformer:
Luminous::RenderContext MultiWidgets::GrabManager

Public Member Functions

void leftMul (const Nimble::Matrix4 &m)
 Multiply the top matrix from the left with the given matrix The end result is equivalent to: More...
 
void popTransform ()
 Pops the top matrix from the stack.
 
Nimble::Vector2 project (const Nimble::Vector2 &) const
 Apply the current transformation matrix on a 2D vector.
 
void pushTransform ()
 Push a new matrix to the stack, just copying the current top.
 
void pushTransform (const Nimble::Matrix4 &m)
 Push the given matrix to the stack pushTransform(m) has the same effect as: More...
 
void pushTransform (const Nimble::Matrix3 &m)
 
void pushTransformLeftMul (const Nimble::Matrix4 &m)
 Multiply the top matrix from the left with the given matrix and push the result into the stack.
 
void pushTransformLeftMul (const Nimble::Matrix3 &m)
 
void pushTransformRightMul (const Nimble::Matrix4 &m)
 Multiply the top matrix from the right with the given matrix and push the result into the stack.
 
void pushTransformRightMul (const Nimble::Matrix3 &m)
 
void resetTransform ()
 Clears the stack so it only contains an identity matrix.
 
void rightMul (const Nimble::Matrix4 &m)
 Multiply the top matrix from the right with the given matrix The end result is equivalent to: More...
 
void setTransform (const Nimble::Matrix4 &m)
 Replaces the top matrix with the given matrix. More...
 
size_t stackSize () const
 Get the size of the transform stack. More...
 
const Nimble::Matrix4transform () const
 Get the top matrix of the stack.
 
Nimble::Matrix3 transform3 () const
 Get the top matrix of the stack as 3x3-matrix.
 
 Transformer ()
 Creates an empty transformation stack.
 
Nimble::Vector2 unproject (const Nimble::Vector2 &) const
 Apply inverse of the current transformation matrix on a 2D vector.
 
virtual ~Transformer ()
 Deletes the transformation stack.
 

Protected Member Functions

virtual void beforeTransformChange ()
 This function gets called just before the transformation matrix is changed. More...
 

Protected Attributes

std::stack< Nimble::Matrix4,
std::vector< Nimble::Matrix4 > > 
m_stack
 The transformation stack.
 

Detailed Description

Geometrical 3D transformation stack.

This class encapsulates 3D transformation stack. The transformations are stored as 4x4 matrices.

Member Function Documentation

virtual void Luminous::Transformer::beforeTransformChange ( )
protectedvirtual

This function gets called just before the transformation matrix is changed.

Reimplemented in Luminous::RenderContext.

void Luminous::Transformer::leftMul ( const Nimble::Matrix4 m)

Multiply the top matrix from the left with the given matrix The end result is equivalent to:

renderContext.setTransform(m * renderContext.transform());
Parameters
mmatrix to multiply with
void Luminous::Transformer::pushTransform ( const Nimble::Matrix4 m)

Push the given matrix to the stack pushTransform(m) has the same effect as:

renderContext.pushTransform();
renderContext.setTransform(m);
Parameters
mmatrix to push
void Luminous::Transformer::pushTransform ( const Nimble::Matrix3 m)
Deprecated:
Transformation stack uses 4x4-matrices
void Luminous::Transformer::pushTransformLeftMul ( const Nimble::Matrix3 m)
Deprecated:
Transformation stack uses 4x4-matrices
void Luminous::Transformer::pushTransformRightMul ( const Nimble::Matrix3 m)
Deprecated:
Transformation stack uses 4x4-matrices
void Luminous::Transformer::rightMul ( const Nimble::Matrix4 m)

Multiply the top matrix from the right with the given matrix The end result is equivalent to:

renderContext.setTransform(renderContext.transform() * m);
Parameters
mmatrix to multiply with
void Luminous::Transformer::setTransform ( const Nimble::Matrix4 m)

Replaces the top matrix with the given matrix.

Parameters
mmatrix to set
size_t Luminous::Transformer::stackSize ( ) const
inline

Get the size of the transform stack.

Returns
size of the stack