![]() |
Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
|
#include <Transformation.hpp>
Public Member Functions | |
Transformation () | |
void | setPosition (vec3 const &position) |
void | setRotation (vec3 const &rotation) |
void | setScale (float const &scale) |
vec3 const & | getPosition () const |
vec3 const & | getRotation () const |
float const & | getScale () const |
mat4 const & | getMatrix () |
mat4 const & | getMatrixInverse () |
void | move (vec3 const &delta) |
void | rotate (vec3 const &delta) |
vec3 const & | getLookVector () |
vec3 const & | getSideVector () |
bool const | needsRecalc () |
void | limitRotationX (float from, float to) |
void | limitRotationY (float from, float to) |
void | limitRotationZ (float from, float to) |
Private Member Functions | |
void | recalc () |
void | recalcInverse () |
void | checkLimits () |
Private Attributes | |
mat4 | m_matrix |
mat4 | m_matrixInverse |
vec3 | m_position |
vec3 | m_rotation |
float | m_scale |
bool | m_matrixInvalid |
bool | m_matrixInverseInvalid |
vector< function< void()> > | m_limits |
Stores a transformation of an object. Supports translation, rotation and uniform-scale
Definition at line 9 of file Transformation.hpp.
Transformation | ( | ) |
Constructs a Transformation with no rotation, position at 0,0,0 and scale 1.
Definition at line 4 of file Transformation.cpp.
|
private |
Checkks all limits and - if necessary - changes position, rotation or scale
Definition at line 120 of file Transformation.cpp.
vec3 const & getLookVector | ( | ) |
Returns the foreward- or look-vector.
Definition at line 81 of file Transformation.cpp.
mat4 const & getMatrix | ( | ) |
Accessor to the local matrix.
Definition at line 57 of file Transformation.cpp.
mat4 const & getMatrixInverse | ( | ) |
Accessor to the inverse of the local matrix.
Definition at line 62 of file Transformation.cpp.
|
inline |
Accessor to the local position.
Definition at line 58 of file Transformation.hpp.
|
inline |
Accessor to the local rotation.
Definition at line 63 of file Transformation.hpp.
|
inline |
Accessor to the local scale.
Definition at line 68 of file Transformation.hpp.
vec3 const & getSideVector | ( | ) |
void limitRotationX | ( | float | from, |
float | to | ||
) |
Limits the rotation around the X-axis.
from | The lower-bound of the rotation-angle |
to | The upper-bound of the rotation-angle |
Definition at line 96 of file Transformation.cpp.
void limitRotationY | ( | float | from, |
float | to | ||
) |
Limits the rotation around the Y-axis.
from | The lower-bound of the rotation-angle |
to | The upper-bound of the rotation-angle |
Definition at line 104 of file Transformation.cpp.
void limitRotationZ | ( | float | from, |
float | to | ||
) |
Limits the rotation around the Z-axis.
from | The lower-bound of the rotation-angle |
to | The upper-bound of the rotation-angle |
Definition at line 112 of file Transformation.cpp.
void move | ( | vec3 const & | delta | ) |
Moves the position by delta. May invalidate the matrices. May be affected by limits.
delta | the distance to be moved. |
Definition at line 68 of file Transformation.cpp.
bool const needsRecalc | ( | ) |
Returns wheter or not the matrices need to be recalculated (because a changed happened)
Definition at line 92 of file Transformation.cpp.
|
private |
Recalculates the local matrix, if it is invalid, based on position, roatation and scale
Definition at line 33 of file Transformation.cpp.
|
private |
Recalculates the local inverse matrix, if it is invalid, based on position, roatation and scale
Definition at line 47 of file Transformation.cpp.
void rotate | ( | vec3 const & | delta | ) |
Increases the rotation by delta. May invalidate the matrices. May be affected by limits.
delta | the distance to be rotation. |
Definition at line 74 of file Transformation.cpp.
void setPosition | ( | vec3 const & | position | ) |
Sets the position. May invalidate the matrices. May be affected by limits.
position | The new position |
Definition at line 15 of file Transformation.cpp.
void setRotation | ( | vec3 const & | rotation | ) |
Sets the rotation. May invalidate the matrices. May be affected by limits.
rotation | The new rotation |
Definition at line 21 of file Transformation.cpp.
void setScale | ( | float const & | scale | ) |
Sets the scale. May invalidate the matrices. May be affected by limits.
scale | The new scale |
Definition at line 27 of file Transformation.cpp.
|
private |
Functions that limit the valid values
Definition at line 19 of file Transformation.hpp.
|
private |
The local matrix
Definition at line 11 of file Transformation.hpp.
|
private |
Wheter or not the matrix needs to be updated
Definition at line 16 of file Transformation.hpp.
|
private |
The inverse of the local matrix
Definition at line 12 of file Transformation.hpp.
|
private |
Wheter or not the inverse-matrix needs to be updated
Definition at line 17 of file Transformation.hpp.
|
private |
The local position
Definition at line 13 of file Transformation.hpp.
|
private |
The local rotation
Definition at line 14 of file Transformation.hpp.
|
private |
The local scale
Definition at line 15 of file Transformation.hpp.