SuzanneIsland: An island of Real-time rendering effects!
Public Types | Public Member Functions
SceneObject Class Reference

A base class for all scene objects. More...

#include <sceneobject.hpp>

Inheritance diagram for SceneObject:
Camera Geometry ParticleSystem Eagle Light

Public Types

enum  Order { LEFT, RIGHT }
 enum specifying matrix multiplication order. More...
 

Public Member Functions

 SceneObject (const glm::mat4 &modelMatrix_)
 
void applyTransformation (const glm::mat4 &trans_mat, const glm::mat4 &invtrans_mat, Order mult_order)
 Apply a transformation matrix to the current matrix. More...
 
const glm::mat4 & getMatrix () const
 
void setTransform (const glm::mat4 &new_trans_mat)
 Replaces current matrix and sets its inverse. More...
 
const glm::mat4 & getInverseMatrix () const
 
glm::vec3 getLocation () const
 Returns the location of the SceneObject. More...
 
void setLocation (const glm::vec3 &location)
 Set SceneObject's location: rightmost column of the model matrix. More...
 
void rotateX (float radians, Order mult_order)
 Applies an X axis rotation operation to the current transformation. More...
 
void rotateY (float radians, Order mult_order)
 Applies a Y axis rotation operation to the current transformation. More...
 
void rotateZ (float radians, Order mult_order)
 Applies a Z axis rotation operation to the current transformation. More...
 
void rotate (float radians, Order mult_order, const glm::vec3 &rot_axis)
 Applies a rotation around a given vector (= axis) More...
 
void translate (const glm::vec3 &trans_vec, Order mult_order)
 Applies a translation operation to the current transformation. More...
 
void scale (const glm::vec3 &scaling_vec, Order mult_order)
 Applies a scale operation to the current transformation. More...
 
std::string matrixToString (const glm::mat4 &matrix)
 Get a string to visualize the given matrix. More...
 

Detailed Description

A base class for all scene objects.

A SceneObject holds the transformation matrix and its inverse and provides functions to manipulate them.

Member Enumeration Documentation

§ Order

enum specifying matrix multiplication order.

Incoming matrix is positioned left or right of current matrix in multiplication

Enumerator
LEFT 

M_result = M_inc * M.

RIGHT 

M_result = M * M_inc.

Member Function Documentation

§ applyTransformation()

void SceneObject::applyTransformation ( const glm::mat4 &  trans_mat,
const glm::mat4 &  invtrans_mat,
Order  mult_order 
)
inline

Apply a transformation matrix to the current matrix.

Parameters
[in]trans_mata transformation matrix
[in]invtrans_mata transform's inverse matrix
[in]mult_ordermultiplication's order

§ getInverseMatrix()

const glm::mat4 & SceneObject::getInverseMatrix ( ) const
inline
Returns
the inverse matrix of the current model matrix

§ getLocation()

glm::vec3 SceneObject::getLocation ( ) const
inline

Returns the location of the SceneObject.

By convention the location of the SceneObject is the rightmost column of the model matrix, defined to always be multiplied with a factor of 1, such that in the linear combination of the matrix multiplication it acts like a translation independent of the xyz values of the given point, thus specifying the origin of the model matrix.

Returns
the location of the SceneObject as a 3D vector

§ getMatrix()

const glm::mat4 & SceneObject::getMatrix ( ) const
inline
Returns
the const reference to the current model matrix

§ matrixToString()

std::string SceneObject::matrixToString ( const glm::mat4 &  matrix)
inline

Get a string to visualize the given matrix.

Returns
a string representing the given matrix
Parameters
[in]matrixmatrix to get a string representation

§ rotate()

void SceneObject::rotate ( float  radians,
Order  mult_order,
const glm::vec3 &  rot_axis 
)
inline

Applies a rotation around a given vector (= axis)

Parameters
[in]radiansrotation angle in radians
[in]mult_ordermultiplication order
[in]rot_axisaxis around which to rotate

§ rotateX()

void SceneObject::rotateX ( float  radians,
Order  mult_order 
)
inline

Applies an X axis rotation operation to the current transformation.

Parameters
[in]radiansrotation angle in radians
[in]mult_ordermultiplication order

§ rotateY()

void SceneObject::rotateY ( float  radians,
Order  mult_order 
)
inline

Applies a Y axis rotation operation to the current transformation.

Parameters
[in]radiansrotation angle in radians
[in]mult_ordermultiplication order

§ rotateZ()

void SceneObject::rotateZ ( float  radians,
Order  mult_order 
)
inline

Applies a Z axis rotation operation to the current transformation.

Parameters
[in]radiansrotation angle in radians
[in]mult_ordermultiplication order

§ scale()

void SceneObject::scale ( const glm::vec3 &  scaling_vec,
Order  mult_order 
)
inline

Applies a scale operation to the current transformation.

Parameters
[in]scaling_vecscaling vector
[in]mult_ordermultiplication order

§ setLocation()

void SceneObject::setLocation ( const glm::vec3 &  location)
inline

Set SceneObject's location: rightmost column of the model matrix.

Returns
the location of the SceneObject

§ setTransform()

void SceneObject::setTransform ( const glm::mat4 &  new_trans_mat)
inline

Replaces current matrix and sets its inverse.

Parameters
[in]new_trans_matnew transformation matrix

§ translate()

void SceneObject::translate ( const glm::vec3 &  trans_vec,
Order  mult_order 
)
inline

Applies a translation operation to the current transformation.

Parameters
[in]trans_vectranslation vector
[in]mult_ordermultiplication order

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