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 |
|
---|
| 26 | if (state->GetRenderType() == RenderState::DEFERRED)
|
---|
| 27 | {
|
---|
[2840] | 28 | cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)mMatrix->x);
|
---|
[2839] | 29 | }
|
---|
| 30 | else
|
---|
| 31 | {
|
---|
| 32 | glPushMatrix();
|
---|
[2840] | 33 | glMultMatrixf((float *)mMatrix->x);
|
---|
[2839] | 34 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 |
|
---|
[2840] | 38 | void Transform3::Unload(RenderState *state)
|
---|
[2839] | 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.