Component to store mesh position, rotation, scale data.
More...
#include <Component.hpp>
|
bool | isModelMatrixEnable () const |
| Retrieves if the model matrix is enable.
|
void | enableModelMatrix (const bool &flag) |
| Enable/disable the model matrix.
|
const bool & | isDirty () const |
| This method is used to avoid regenerating model matrix if data aren't changed.
|
void | setDirty (const bool &dirty) |
| Sets the model matrix dirty flag.
|
const glm::vec3 & | getPosition () const |
| Retrieves the mesh position.
|
void | setPosition (const glm::vec3 &pos) |
| Sets the mesh position.
|
void | addPosition (const glm::vec3 &offset) |
| Adds an offset to the current position.
|
glm::vec3 | getScale () const |
| Retrieves the mesh position.
|
void | setScale (const glm::vec3 &scale) |
| Sets the mesh scale.
|
void | addScale (const glm::vec3 &offset) |
| Adds to the current scale the offset given.
|
glm::vec3 | getRotation () const |
| Retrieves the mesh position.
|
void | setRotation (glm::vec3 rot) |
| Sets the mesh rotation, it works using MAX_DEGREE_ANGLE to avoid angle value more then 360 or less than 0.
|
void | addRotation (const glm::vec3 &offset) |
| Adds to the current rotation value the given offset. It works with the same behaviour of Transform::setRotation(glm::vec3 rot).
|
| Transform () |
| Default constructor.
|
void | updateModelMatrix () |
| This method updates the model matrix only if the dirty flag is activated.
|
|
glm::vec3 | position {} |
| mesh position vector
|
glm::vec3 | scale {1, 1, 1} |
| mesh scale
|
glm::vec3 | rotation {} |
| mesh rotation
|
glm::quat | quaternion {} |
| mesh quaternion
|
glm::mat4 | model {1} |
| mesh model matrix
|
bool | dirty = true |
| model matrix dirty flag
|
bool | enableModel = true |
| model matrix enable flag
|
float | MAX_DEGREE_ANGLE = 180 |
Component to store mesh position, rotation, scale data.
◆ addPosition()
void Transform::addPosition |
( |
const glm::vec3 & | offset | ) |
|
|
inline |
Adds an offset to the current position.
- Parameters
-
offset | offset to be added. |
- Note
- It activate the dirty flag.
◆ addRotation()
void Transform::addRotation |
( |
const glm::vec3 & | offset | ) |
|
|
inline |
◆ addScale()
void Transform::addScale |
( |
const glm::vec3 & | offset | ) |
|
|
inline |
Adds to the current scale the offset given.
- Parameters
-
- Note
- It activate the dirty flag.
◆ enableModelMatrix()
void Transform::enableModelMatrix |
( |
const bool & | flag | ) |
|
|
inline |
Enable/disable the model matrix.
- Parameters
-
flag | bool flag to enable or disable model matrix. |
◆ getPosition()
const glm::vec3 & Transform::getPosition |
( |
| ) |
const |
|
inline |
Retrieves the mesh position.
- Returns
- mesh position
◆ getRotation()
glm::vec3 Transform::getRotation |
( |
| ) |
const |
|
inline |
Retrieves the mesh position.
- Returns
- mesh position
◆ getScale()
glm::vec3 Transform::getScale |
( |
| ) |
const |
|
inline |
Retrieves the mesh position.
- Returns
- mesh position
◆ isDirty()
const bool & Transform::isDirty |
( |
| ) |
const |
|
inline |
This method is used to avoid regenerating model matrix if data aren't changed.
- Returns
- true if data changed and the model matrix is invalid
- Note
- The model matrix is invalid when position, scale or rotation are modified.
◆ isModelMatrixEnable()
bool Transform::isModelMatrixEnable |
( |
| ) |
const |
|
inline |
Retrieves if the model matrix is enable.
- Returns
- true if model matrix is enabled
◆ setDirty()
void Transform::setDirty |
( |
const bool & | dirty | ) |
|
|
inline |
Sets the model matrix dirty flag.
- Parameters
-
dirty | model matrix dirty flag |
- Note
- Everytime the dirty flag is activated, model matrix should be updated.
◆ setPosition()
void Transform::setPosition |
( |
const glm::vec3 & | pos | ) |
|
|
inline |
Sets the mesh position.
- Parameters
-
- Note
- It activate the dirty flag.
◆ setRotation()
void Transform::setRotation |
( |
glm::vec3 | rot | ) |
|
|
inline |
Sets the mesh rotation, it works using MAX_DEGREE_ANGLE to avoid angle value more then 360 or less than 0.
- Note
- It activate the dirty flag.
◆ setScale()
void Transform::setScale |
( |
const glm::vec3 & | scale | ) |
|
|
inline |
Sets the mesh scale.
- Parameters
-
- Note
- It activate the dirty flag.
◆ MAX_DEGREE_ANGLE
float Transform::MAX_DEGREE_ANGLE = 180 |
The documentation for this class was generated from the following file: