A base class for all scene objects.
More...
#include <sceneobject.hpp>
|
| 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...
|
|
A base class for all scene objects.
A SceneObject holds the transformation matrix and its inverse and provides functions to manipulate them.
§ 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.
|
§ 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_mat | a transformation matrix |
[in] | invtrans_mat | a transform's inverse matrix |
[in] | mult_order | multiplication'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] | matrix | matrix 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] | radians | rotation angle in radians |
[in] | mult_order | multiplication order |
[in] | rot_axis | axis 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] | radians | rotation angle in radians |
[in] | mult_order | multiplication order |
§ rotateY()
void SceneObject::rotateY |
( |
float |
radians, |
|
|
Order |
mult_order |
|
) |
| |
|
inline |
Applies a Y axis rotation operation to the current transformation.
- Parameters
-
[in] | radians | rotation angle in radians |
[in] | mult_order | multiplication order |
§ rotateZ()
void SceneObject::rotateZ |
( |
float |
radians, |
|
|
Order |
mult_order |
|
) |
| |
|
inline |
Applies a Z axis rotation operation to the current transformation.
- Parameters
-
[in] | radians | rotation angle in radians |
[in] | mult_order | multiplication 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_vec | scaling vector |
[in] | mult_order | multiplication order |
§ setLocation()
void SceneObject::setLocation |
( |
const glm::vec3 & |
location | ) |
|
|
inline |
§ setTransform()
void SceneObject::setTransform |
( |
const glm::mat4 & |
new_trans_mat | ) |
|
|
inline |
Replaces current matrix and sets its inverse.
- Parameters
-
[in] | new_trans_mat | new 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_vec | translation vector |
[in] | mult_order | multiplication order |
The documentation for this class was generated from the following file: