// identity matrix glm::mat4(1.0f); // rotation matrix (will apply the following transformation: M*R glm::rotate(glm::mat4 M,float angleInDegree, glm::vec3 rotationAxis); // which is equivalent to: M*glm::rotate(glm::mat4(1.0f),float angleInDegree, glm::vec3 rotationAxis); // scaling matrix: M*S glm::scale(glm::mat4 M,glm::vec3 scalingFactors); // translation matrix: M*T glm::translate(glm::mat4 M,glm::vec3 translateValues); // view matrix V glm::lookAt(glm::vec3 pos,glm::vec3 center,glm::vec3 up); // orthogographic projection matrix P glm::ortho(float left,float right,float bottom,float top,float near,float far); // perspective projection matrix P glm::perspective(float fovy,float aspect,float near,float far) |
// Lets consider an initial model
matrix, at the top of the stack: _modelMatrices.top() =
glm::mat4(1.0f); // the following code... glm::mat4 s = glm::scale(glm::mat4(1.0f),scalingFactors); glm::mat4 r = glm::rotate(glm::mat4(1.0f),spin,axis); glm::mat4 t = glm::translate(glm::mat4(1.0f),translateValues); _modelMatrices.top() = _modelMatrices.top()*r*t*s; // ...is equivalent to _modelMatrices.top() = glm::rotate(_modelMatrices.top(),spin, axis); _modelMatrices.top() = glm::translate(_modelMatrices.top(),translateValues); _modelMatrices.top() = glm::scale(_modelMatrices.top(),scalingFactors); |
PREVIOUS:
02
- TRANSFORMATIONS |
NEXT:
03 - PIPELINE |