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