Oxygen Engine
Modern C++ 3D Engine using OpenGL
|
Manage local Translation / Rotation / Scale of an entity in the world. More...
#include <OxygenEngine/scene/transform.h>
Public Member Functions | |
Transform (const glm::vec3 &translation=glm::vec3(0.f), const glm::quat &rotation=glm::quat(1.f, 0.f, 0.f, 0.f), const glm::vec3 &scale=glm::vec3(1.f), const glm::vec3 &skew=glm::vec3(0.f), const glm::vec4 &perspective=glm::vec4(glm::vec3(0.f), 1.f)) | |
Generate Transform from its translation, rotation, scale values. | |
Transform (const glm::mat4 &model) | |
Generate Transform from a model matrix. | |
const glm::vec3 & | getTranslation () const |
Get Translation component value of the transform. | |
const glm::vec3 & | getPosition () const |
Get Translation component value of the transform. | |
const glm::quat & | getRotation () const |
Get Rotation component value of the transform. | |
const glm::vec3 & | getScale () const |
Get Scaling component value of the transform. | |
const glm::vec3 & | getSkew () const |
Get Skew component value of the transform. | |
const glm::vec4 & | getPerspective () const |
get Perspective component value of the transform | |
void | setTranslation (const float x, const float y, const float z) |
Translate to the specified position, filled component wise. | |
void | setPosition (const glm::vec3 &position) |
Translate to the specified position. | |
void | setPosition (const float x, const float y, const float z) |
Translate to the specified position. | |
void | setRotation (const float x, const float y, const float z) |
Set rotation from Euler angles. | |
void | setRotation (const lit::Angle &x, const lit::Angle &y, const lit::Angle &z) |
Relatively rotate the transform using a lit::Angle triad. | |
void | setScale (const float x, const float y, const float z) |
Set scaling. | |
void | relativeTranslate (const glm::vec3 &translation) |
Translate the transform from current position. | |
void | relativeTranslate (const float x, const float y, const float z) |
Translate the transform from current position, component wise. | |
void | loadFromModel (const glm::mat4 &model) |
Fill the transform from a model matrix. | |
void | relativeMove (const glm::vec3 &translation) |
Move the transform relative to current translation. | |
void | relativeRotate (const glm::quat &quaternion) |
Rotate the transform relative to current rotation. | |
void | relativeRotate (const float x, const float y, const float z) |
Rotate the transform from Euler angles (component wise) | |
void | relativeRotate (const lit::Angle &x, const lit::Angle &y, const lit::Angle &z) |
Relatively rotate the transform using a lit::Angle triad. | |
void | relativeScale (const glm::vec3 &scale) |
Multiply current scale by the new one. | |
void | setSkew (const glm::vec3 &skew) |
Set skew of the transform. | |
void | setPerspective (const glm::vec4 &perspective) |
Set perspective effect of the transform. | |
void | interpolateWith (const float ratio, const Transform &target) |
Interpolate this transform with another one. | |
void | fillFrom (const Transform &transform) |
Fill current values from another transform. | |
template<TranslationType T> | |
void | setTranslation (const T &translation) |
Translate to the specified position. | |
template<RotationType R> | |
void | setRotation (const R &rotation) |
Get rotation quaternion from a generic type. | |
template<ScaleType S> | |
void | setScale (const S &scale) |
Set scale vector from a generic type. | |
template<TranslationType T> | |
void | getTranslationAs (T &result) const |
Get translation vector and fill in generic type. | |
template<RotationType R> | |
void | getRotationAs (R &result) const |
Get rotation quaternion and fill in generic type. | |
template<ScaleType S> | |
void | getScaleAs (S &result) const |
Get scale vector and fill in generic type. | |
glm::mat4 | getModelMatrix () const |
Generate a Model matrix from the transform. | |
bool | isDirty () const |
Check if something modified this transform. | |
Protected Member Functions | |
void | forceDirty (const bool is_dirty) const |
Set custom dirty status. | |
Manage local Translation / Rotation / Scale of an entity in the world.
oe::scene::Transform::Transform | ( | const glm::vec3 & | translation = glm::vec3(0.f) , |
const glm::quat & | rotation = glm::quat(1.f, 0.f, 0.f, 0.f) , |
||
const glm::vec3 & | scale = glm::vec3(1.f) , |
||
const glm::vec3 & | skew = glm::vec3(0.f) , |
||
const glm::vec4 & | perspective = glm::vec4(glm::vec3(0.f), 1.f) |
||
) |
Generate Transform from its translation, rotation, scale values.
translation | |
rotation | |
scale | |
skew | |
perspective |
oe::scene::Transform::Transform | ( | const glm::mat4 & | model | ) |
Generate Transform from a model matrix.
model |
void oe::scene::Transform::fillFrom | ( | const Transform & | transform | ) |
Fill current values from another transform.
transform | Containing source data to copy |
|
inlineprotected |
Set custom dirty status.
is_dirty | does the transform should react as dirty |
glm::mat4 oe::scene::Transform::getModelMatrix | ( | ) | const |
Generate a Model matrix from the transform.
|
inline |
get Perspective component value of the transform
|
inline |
Get Translation component value of the transform.
|
inline |
Get Rotation component value of the transform.
|
inline |
Get rotation quaternion and fill in generic type.
result | object to fill rotation data |
|
inline |
Get Scaling component value of the transform.
|
inline |
Get scale vector and fill in generic type.
result | object to fill rotation data |
|
inline |
Get Skew component value of the transform.
|
inline |
Get Translation component value of the transform.
|
inline |
Get translation vector and fill in generic type.
result | object to fill translation data |
void oe::scene::Transform::interpolateWith | ( | const float | ratio, |
const Transform & | target | ||
) |
Interpolate this transform with another one.
ratio | Ratio of interpolation between 0.0 (No target contribution) and 1.0 (only target contribution) |
target | Second operand of the interpolation |
|
inline |
Check if something modified this transform.
void oe::scene::Transform::loadFromModel | ( | const glm::mat4 & | model | ) |
Fill the transform from a model matrix.
model | Components of the Transform will be extracted from this matrix |
void oe::scene::Transform::relativeMove | ( | const glm::vec3 & | translation | ) |
Move the transform relative to current translation.
translation | Translation vector |
void oe::scene::Transform::relativeRotate | ( | const float | x, |
const float | y, | ||
const float | z | ||
) |
Rotate the transform from Euler angles (component wise)
x | Pitch (degrees) |
y | Yaw (degrees) |
z | Roll (degrees) |
void oe::scene::Transform::relativeRotate | ( | const glm::quat & | quaternion | ) |
Rotate the transform relative to current rotation.
quaternion | Rotation quaternion |
void oe::scene::Transform::relativeRotate | ( | const lit::Angle & | x, |
const lit::Angle & | y, | ||
const lit::Angle & | z | ||
) |
Relatively rotate the transform using a lit::Angle triad.
x | Pitch |
y | Yaw |
z | Roll |
void oe::scene::Transform::relativeScale | ( | const glm::vec3 & | scale | ) |
Multiply current scale by the new one.
scale | Scale factor along each axis |
void oe::scene::Transform::relativeTranslate | ( | const float | x, |
const float | y, | ||
const float | z | ||
) |
Translate the transform from current position, component wise.
x | |
y | |
z |
void oe::scene::Transform::relativeTranslate | ( | const glm::vec3 & | translation | ) |
Translate the transform from current position.
translation | Translation vector |
void oe::scene::Transform::setPerspective | ( | const glm::vec4 & | perspective | ) |
Set perspective effect of the transform.
perspective |
|
inline |
Translate to the specified position.
x | |
y | |
z |
|
inline |
Translate to the specified position.
position |
void oe::scene::Transform::setRotation | ( | const float | x, |
const float | y, | ||
const float | z | ||
) |
Set rotation from Euler angles.
x | Pitch (degrees) |
y | Yaw (degrees) |
z | Roll (degrees) |
void oe::scene::Transform::setRotation | ( | const lit::Angle & | x, |
const lit::Angle & | y, | ||
const lit::Angle & | z | ||
) |
Relatively rotate the transform using a lit::Angle triad.
x | Pitch |
y | Yaw |
z | Roll |
|
inline |
Get rotation quaternion from a generic type.
rotation | Object containing rotation data |
void oe::scene::Transform::setScale | ( | const float | x, |
const float | y, | ||
const float | z | ||
) |
Set scaling.
x | Scaling along the X axis |
y | Scaling along the Y axis |
z | Scaling along the Z axis |
|
inline |
Set scale vector from a generic type.
scale | Object containing scale data |
void oe::scene::Transform::setSkew | ( | const glm::vec3 & | skew | ) |
Set skew of the transform.
skew | Skew factor along each axis |
void oe::scene::Transform::setTranslation | ( | const float | x, |
const float | y, | ||
const float | z | ||
) |
Translate to the specified position, filled component wise.
x | |
y | |
z |
|
inline |
Translate to the specified position.
translation | Object containing translation data |