2 #ifndef MATRIX_STACK_UTIL_H
3 #define MATRIX_STACK_UTIL_H
12 #include <glm/glm.hpp>
13 #include <glm/gtc/type_ptr.hpp>
53 : m_currMatrix(initialMatrix)
66 m_stack.push(m_currMatrix);
72 m_currMatrix = m_stack.top();
81 void Reset() { m_currMatrix = m_stack.top(); }
84 const glm::mat4 &
Top()
const
101 void Rotate(
const glm::vec3 axis,
float angDegCCW);
122 void Scale(
const glm::vec3 &scaleVec);
124 void Scale(
float scaleX,
float scaleY,
float scaleZ) {
Scale(glm::vec3(scaleX, scaleY, scaleZ));}
126 void Scale(
float uniformScale) {
Scale(glm::vec3(uniformScale));}
137 void Translate(
const glm::vec3 &offsetVec);
139 void Translate(
float transX,
float transY,
float transZ) {
Translate(glm::vec3(transX, transY, transZ));}
159 void LookAt(
const glm::vec3 &cameraPos,
const glm::vec3 &lookatPos,
const glm::vec3 &upDir);
186 void Perspective(
float degFOV,
float aspectRatio,
float zNear,
float zFar);
198 void Orthographic(
float left,
float right,
float bottom,
float top,
float zNear = -1.0f,
float zFar = 1.0f);
216 void PixelPerfectOrtho(glm::ivec2 size, glm::vec2 depthRange,
bool isTopLeft =
true);
242 void SetMatrix(
const glm::mat4 &theMatrix);
248 std::stack<glm::mat4, std::vector<glm::mat4> > m_stack;
249 glm::mat4 m_currMatrix;
301 #endif //MATRIX_STACK_UTIL_H