Line | |
---|
1 | #include "Transform3.h"
|
---|
2 | #include "Matrix4x4.h"
|
---|
3 | #include "RenderState.h"
|
---|
4 |
|
---|
5 |
|
---|
6 | namespace CHCDemoEngine
|
---|
7 | {
|
---|
8 |
|
---|
9 | CGparameter Transform3::sModelMatrixParam;
|
---|
10 |
|
---|
11 | Transform3::Transform3(Matrix4x4 *trafo): mMatrix(trafo)
|
---|
12 | {
|
---|
13 | }
|
---|
14 |
|
---|
15 |
|
---|
16 | Transform3::~Transform3()
|
---|
17 | {
|
---|
18 | DEL_PTR(mMatrix);
|
---|
19 | }
|
---|
20 |
|
---|
21 |
|
---|
22 | void Transform3::Load(RenderState *state)
|
---|
23 | {
|
---|
24 | if (!mMatrix) return;
|
---|
25 |
|
---|
26 | if (state->GetRenderType() == RenderState::DEFERRED)
|
---|
27 | {
|
---|
28 | cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)mMatrix->x);
|
---|
29 | }
|
---|
30 | else
|
---|
31 | {
|
---|
32 | glPushMatrix();
|
---|
33 | glMultMatrixf((float *)mMatrix->x);
|
---|
34 | }
|
---|
35 | }
|
---|
36 |
|
---|
37 |
|
---|
38 | void Transform3::Unload(RenderState *state)
|
---|
39 | {
|
---|
40 | if (!mMatrix) return;
|
---|
41 |
|
---|
42 | if (state->GetRenderType() == RenderState::DEFERRED)
|
---|
43 | {
|
---|
44 | static Matrix4x4 identity = IdentityMatrix();
|
---|
45 | cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)identity.x);
|
---|
46 | }
|
---|
47 | else
|
---|
48 | {
|
---|
49 | glPopMatrix();
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.