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
68
69
70
71
72
73
74
75
76
77
|
#include "matrix_stack.h"
namespace AsuraEngine
{
namespace Graphics
{
MatrixStack::MatrixStack()
: top(0)
{
// ջʼջô˱֤ջԶǿգȡֵ
mStack[top].SetIdentity();
}
MatrixStack::~MatrixStack()
{
}
void MatrixStack::LoadIdentity()
{
mStack[top].SetIdentity();
}
bool MatrixStack::Push()
{
if (top == ASURA_MAX_MATRIX_STACK_DEPTH - 1)
return false;
++top;
mStack[top] = mStack[top - 1];
return true;
}
bool MatrixStack::Pop()
{
if (top == 0)
return false;
--top;
return true;
}
AEMath::Matrix44& MatrixStack::GetTop()
{
return mStack[top];
}
uint MatrixStack::GetTopIndex()
{
return top;
}
uint MatrixStack::GetCapacity()
{
return ASURA_MAX_MATRIX_STACK_DEPTH;
}
void MatrixStack::Ortho(float left, float right, float bottom, float top, float near, float far)
{
mStack[this->top].Ortho(left, right, bottom, top, near, far);
}
void MatrixStack::Rotate(float angle)
{
mStack[top].Rotate(angle);
}
void MatrixStack::Translate(float x, float y)
{
mStack[top].Translate(x, y);
}
void MatrixStack::Scale(float x, float y)
{
mStack[top].Scale(x, y);
}
}
}
|