-
Notifications
You must be signed in to change notification settings - Fork 1
/
MStackHelp.h
67 lines (50 loc) · 1.46 KB
/
MStackHelp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* RenderingHelper.h -> renamed MStack.h (Z.J.W.)
* A means of replacing openGL matrix stack uses glm
*
* Created on: Jul 28, 2011
* Author: Wyatt and Evan
*/
#ifndef RenderingHelper_H_
#define RenderingHelper_H_
#include <stack>
#include "glm/glm.hpp"
#include "glm/gtx/vector_angle.hpp"
#include "glm/gtx/component_wise.hpp"
#include "glm/gtc/matrix_access.hpp"
#include "glm/gtc/matrix_integer.hpp"
#include "glm/gtc/matrix_inverse.hpp"
#include "glm/gtc/matrix_transform.hpp"
using glm::ivec2;
using glm::vec2;
using glm::vec3;
using glm::vec4;
using glm::mat2;
using glm::mat3;
using glm::mat4;
struct RenderingHelper {
mat4 modelViewMatrix;
std::stack<mat4> modelViewMatrixStack;
mat4 projectionMatrix;
std::stack<mat4> projectionMatrixStack;
mat4 *currentMatrix;
std::stack<mat4> *currentMatrixStack;
public:
RenderingHelper();
virtual ~RenderingHelper();
void useModelViewMatrix();
void useProjectionMatrix();
void pushMatrix();
void popMatrix();
void loadIdentity();
void translate(const vec3 &offset);
void scale(float x, float y, float z);
void scale(float size);
void rotate(float angle, const vec3 &axis);
void multMatrix(const mat4 &matrix);
const mat4 &getMatrix();
void ortho(float left, float right, float bottom, float top, float zNear, float zFar);
void frustum(float left, float right, float bottom, float top, float zNear, float zFar);
void lookAt(vec3 eye, vec3 target, vec3 up);
};
#endif /* RenderingHelper_H_ */