NGL
6.5
The NCCA Graphics Library
|
Transformation describes a transformation (translate, scale, rotation) modifed by j macey and included into NGL. More...
#include <Transformation.h>
Public Member Functions | |
Transformation () noexcept | |
Constructor. More... | |
Transformation (const Transformation &_t) noexcept | |
Copy Constructor. More... | |
Transformation & | operator= (const Transformation &_t) noexcept |
assignment operator More... | |
void | setScale (const Vec3 &_scale) noexcept |
method to set the scale value in the transform More... | |
void | setScale (const Vec4 &_scale) noexcept |
void | setScale (Real _x, Real _y, Real _z) noexcept |
method to set the scale value in the transform More... | |
void | addScale (const Vec3 &_scale) noexcept |
method to add to the existing the scale value in the transform More... | |
void | addScale (Real _x, Real _y, Real _z) noexcept |
method to add to the existing the scale value in the transform More... | |
void | setPosition (const Vec4 &_position) noexcept |
method to set the position More... | |
void | setPosition (const Vec3 &_position) noexcept |
method to set the position More... | |
void | setPosition (Real _x, Real _y, Real _z) noexcept |
method to set the position value in the transform More... | |
void | addPosition (const Vec4 &_position) noexcept |
method add to the existing set the position More... | |
void | addPosition (const Vec3 &_position) noexcept |
method add to the existing set the position More... | |
void | addPosition (Real _x, Real _y, Real _z) noexcept |
method to add to the existing position value in the transform More... | |
void | setMatrix (const Mat4 &_m) noexcept |
void | setRotation (const Vec3 &_rotation) noexcept |
method to set the rotation More... | |
void | setRotation (const Vec4 &_rotation) noexcept |
void | setRotation (Real _x, Real _y, Real _z) noexcept |
method to set the rotation value in the transform More... | |
void | addRotation (const Vec3 &_rotation) noexcept |
method to add to the existing rotation More... | |
void | addRotation (Real _x, Real _y, Real _z) noexcept |
method to add to the existing rotation value in the transform More... | |
void | reset () noexcept |
a method to set all the transforms to the identity More... | |
Vec3 | getScale () const noexcept |
function to get the scale More... | |
Vec3 | getPosition () const noexcept |
function to get the position More... | |
Vec3 | getRotation () const noexcept |
function to get the rotation More... | |
Mat4 | getMatrix () noexcept |
function to get the matrix. It computes the matrix if it's dirty More... | |
Mat4 | getTransposeMatrix () noexcept |
function to get the transpose matrix. It computes the transpose matrix if it's dirty More... | |
Mat4 | getInverseMatrix () noexcept |
function to get the inverse matrix. It computes the inverse matrix if it's dirty More... | |
void | operator*= (const Transformation &_m) noexcept |
*= operator More... | |
Transformation | operator* (const Transformation &_m) noexcept |
operator for Transform multiplication will do a matrix multiplication on each of the matrices More... | |
void | loadMatrixToShader (const std::string &_param, const ActiveMatrix &_which=ActiveMatrix::NORMAL) noexcept |
load the current transform matrix to the shader More... | |
void | loadGlobalAndCurrentMatrixToShader (const std::string &_param, Transformation &_global, const ActiveMatrix &_which=ActiveMatrix::NORMAL) noexcept |
load the current * global transform matrix to the shader More... | |
Protected Member Functions | |
void | computeMatrices () noexcept |
method to compute the matrix, transpose and inverse matrix. set the m_bIsMatrixComputed variable to true. More... | |
Protected Attributes | |
Vec3 | m_position |
position More... | |
Vec3 | m_scale |
scale More... | |
Vec3 | m_rotation |
rotation More... | |
bool | m_isMatrixComputed |
boolean defines if the matrix is dirty or not More... | |
Mat4 | m_matrix |
matrix transformation More... | |
Mat4 | m_transposeMatrix |
transpose matrix transformation More... | |
Mat4 | m_inverseMatrix |
inverse matrix transformation More... | |
Friends | |
class | Vec4 |
Transformation describes a transformation (translate, scale, rotation) modifed by j macey and included into NGL.
Definition at line 43 of file Transformation.h.
|
noexcept |
Constructor.
Definition at line 27 of file Transformation.cpp.
References computeMatrices(), m_inverseMatrix, m_isMatrixComputed, m_matrix, m_position, m_rotation, m_scale, and m_transposeMatrix.
|
noexcept |
Copy Constructor.
Definition at line 40 of file Transformation.cpp.
References m_inverseMatrix, m_isMatrixComputed, m_matrix, m_position, m_rotation, m_scale, and m_transposeMatrix.
method add to the existing set the position
[in] | _position | position |
method add to the existing set the position
[in] | _position | position |
Definition at line 132 of file Transformation.cpp.
References m_isMatrixComputed, and m_position.
method to add to the existing position value in the transform
[in] | _x | x position value |
[in] | _y | y position value |
[in] | _z | z position value |
Definition at line 137 of file Transformation.cpp.
References m_isMatrixComputed, m_position, ngl::Vec3::m_x, ngl::Vec3::m_y, and ngl::Vec3::m_z.
method to add to the existing rotation
[in] | _rotation | rotation |
Definition at line 169 of file Transformation.cpp.
References m_isMatrixComputed, and m_rotation.
method to add to the existing rotation value in the transform
[in] | _x | x rotation value |
[in] | _y | y rotation value |
[in] | _z | z rotation value |
Definition at line 174 of file Transformation.cpp.
References m_isMatrixComputed, m_rotation, ngl::Vec3::m_x, ngl::Vec3::m_y, and ngl::Vec3::m_z.
method to add to the existing the scale value in the transform
[in] | _scale | the scale value to set for the transform |
Definition at line 98 of file Transformation.cpp.
References m_isMatrixComputed, and m_scale.
method to add to the existing the scale value in the transform
[in] | _x | x scale value |
[in] | _y | y scale value |
[in] | _z | z scale value |
Definition at line 105 of file Transformation.cpp.
References m_isMatrixComputed, m_scale, ngl::Vec3::m_x, ngl::Vec3::m_y, and ngl::Vec3::m_z.
|
protectednoexcept |
method to compute the matrix, transpose and inverse matrix. set the m_bIsMatrixComputed variable to true.
Definition at line 194 of file Transformation.cpp.
References m_inverseMatrix, m_isMatrixComputed, ngl::Mat4::m_m, m_matrix, m_position, m_rotation, m_scale, m_transposeMatrix, ngl::Vec3::m_x, ngl::Vec3::m_y, ngl::Vec3::m_z, ngl::Mat4::rotateX(), ngl::Mat4::rotateY(), ngl::Mat4::rotateZ(), ngl::Mat4::scale(), ngl::Mat4::translate(), and ngl::Mat4::transpose().
|
inlinenoexcept |
function to get the inverse matrix. It computes the inverse matrix if it's dirty
Definition at line 192 of file Transformation.h.
References ngl::NORMAL, and ngl::operator*().
|
inlinenoexcept |
function to get the matrix. It computes the matrix if it's dirty
Definition at line 182 of file Transformation.h.
|
inlinenoexcept |
function to get the position
Definition at line 172 of file Transformation.h.
|
inlinenoexcept |
function to get the rotation
Definition at line 177 of file Transformation.h.
|
inlinenoexcept |
function to get the scale
Definition at line 167 of file Transformation.h.
|
inlinenoexcept |
function to get the transpose matrix. It computes the transpose matrix if it's dirty
Definition at line 187 of file Transformation.h.
|
noexcept |
load the current * global transform matrix to the shader
[in] | _param | the name of the parameter to set (varying mat4) |
[in] | _which | which matrix mode to use |
Definition at line 294 of file Transformation.cpp.
References computeMatrices(), getInverseMatrix(), getMatrix(), getTransposeMatrix(), ngl::Singleton< ShaderLib >::instance(), ngl::INVERSE, ngl::NORMAL, ngl::ShaderLib::setShaderParamFromMat4(), and ngl::TRANSPOSE.
|
noexcept |
load the current transform matrix to the shader
[in] | _param | the name of the parameter to set (varying mat4) |
[in] | _which | which matrix mode to use |
Definition at line 267 of file Transformation.cpp.
References computeMatrices(), ngl::Singleton< ShaderLib >::instance(), ngl::INVERSE, m_inverseMatrix, m_matrix, m_transposeMatrix, ngl::NORMAL, ngl::ShaderLib::setShaderParamFromMat4(), and ngl::TRANSPOSE.
|
noexcept |
operator for Transform multiplication will do a matrix multiplication on each of the matrices
[in] | _m | the Transform to multiply the current one by |
Definition at line 256 of file Transformation.cpp.
References computeMatrices(), m_inverseMatrix, m_isMatrixComputed, m_matrix, and m_transposeMatrix.
|
noexcept |
*= operator
_m | the transformation to combine |
transpose matrix transformation
inverse matrix transformation
Definition at line 242 of file Transformation.cpp.
References computeMatrices(), m_inverseMatrix, m_isMatrixComputed, m_matrix, and m_transposeMatrix.
|
noexcept |
assignment operator
Definition at line 53 of file Transformation.cpp.
References m_inverseMatrix, m_isMatrixComputed, m_matrix, m_position, m_rotation, m_scale, and m_transposeMatrix.
|
noexcept |
a method to set all the transforms to the identity
Definition at line 184 of file Transformation.cpp.
References computeMatrices(), m_isMatrixComputed, m_position, m_rotation, and m_scale.
method to set the matrix directly
[in] | _m | the matrix to set the m_transform to need to also re-compute the others |
Definition at line 70 of file Transformation.cpp.
References m_isMatrixComputed, m_matrix, m_transposeMatrix, and ngl::Mat4::transpose().
method to set the position
[in] | _position | position |
Definition at line 115 of file Transformation.cpp.
References m_isMatrixComputed, and m_position.
method to set the position
[in] | _position | position |
Definition at line 120 of file Transformation.cpp.
References m_isMatrixComputed, and m_position.
method to set the position value in the transform
[in] | _x | x position value |
[in] | _y | y position value |
[in] | _z | z position value |
Definition at line 125 of file Transformation.cpp.
References m_isMatrixComputed, m_position, and ngl::Vec3::set().
method to set the rotation
[in] | _rotation | rotation |
Definition at line 148 of file Transformation.cpp.
References m_isMatrixComputed, and m_rotation.
Definition at line 153 of file Transformation.cpp.
References m_isMatrixComputed, and m_rotation.
method to set the rotation value in the transform
[in] | _x | x rotation value |
[in] | _y | y rotation value |
[in] | _z | z rotation value |
Definition at line 160 of file Transformation.cpp.
References m_isMatrixComputed, m_rotation, and ngl::Vec3::set().
method to set the scale value in the transform
[in] | _scale | the scale value to set for the transform |
Definition at line 79 of file Transformation.cpp.
References m_isMatrixComputed, and m_scale.
Definition at line 85 of file Transformation.cpp.
References m_isMatrixComputed, and m_scale.
method to set the scale value in the transform
[in] | _x | x scale value |
[in] | _y | y scale value |
[in] | _z | z scale value |
Definition at line 91 of file Transformation.cpp.
References m_isMatrixComputed, m_scale, and ngl::Vec3::set().
|
friend |
Definition at line 45 of file Transformation.h.
|
protected |
inverse matrix transformation
Definition at line 249 of file Transformation.h.
|
protected |
boolean defines if the matrix is dirty or not
Definition at line 237 of file Transformation.h.
|
protected |
matrix transformation
Definition at line 241 of file Transformation.h.
|
protected |
position
Definition at line 225 of file Transformation.h.
|
protected |
rotation
Definition at line 233 of file Transformation.h.
|
protected |
scale
Definition at line 229 of file Transformation.h.
|
protected |
transpose matrix transformation
Definition at line 245 of file Transformation.h.