source:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.cpp
@
3115
Revision 3115, 762 bytes checked in by mattausch, 16 years ago (diff) |
---|
Rev | Line | |
---|---|---|
[2840] | 1 | #include "Transform3.h" |
2 | #include "RenderState.h" | |
[3031] | 3 | #include "ShaderProgram.h" |
[2839] | 4 | |
5 | ||
6 | namespace CHCDemoEngine | |
7 | { | |
8 | ||
9 | ||
[3070] | 10 | Transform3::Transform3() |
[2839] | 11 | { |
[3070] | 12 | Reset(); |
[2839] | 13 | } |
14 | ||
15 | ||
[3114] | 16 | Transform3::Transform3(const Matrix4x4 &trafo): |
17 | mMatrix(trafo), mOldMatrix(trafo) | |
[2839] | 18 | { |
[3070] | 19 | mIsIdentity = false; |
[2839] | 20 | } |
21 | ||
22 | ||
[2840] | 23 | void Transform3::Load(RenderState *state) |
[2839] | 24 | { |
[3089] | 25 | if (!mIsIdentity) |
26 | { | |
27 | glPushMatrix(); | |
28 | glMultMatrixf((float *)mMatrix.x); | |
29 | } | |
[2839] | 30 | } |
31 | ||
32 | ||
[2840] | 33 | void Transform3::Unload(RenderState *state) |
[2839] | 34 | { |
[3114] | 35 | if (!mIsIdentity) glPopMatrix(); |
[2839] | 36 | } |
37 | ||
[2957] | 38 | |
39 | void Transform3::MultMatrix(const Matrix4x4 &trafo) | |
40 | { | |
41 | mIsIdentity = false; | |
[3114] | 42 | mOldMatrix = mMatrix; |
[3115] | 43 | mMatrix = trafo * mMatrix; |
[2957] | 44 | } |
45 | ||
46 | ||
47 | void Transform3::Reset() | |
48 | { | |
49 | mIsIdentity = true; | |
50 | mMatrix = IdentityMatrix(); | |
[3114] | 51 | mOldMatrix = mMatrix; |
[2957] | 52 | } |
53 | ||
54 | ||
[2839] | 55 | } |
Note: See TracBrowser
for help on using the repository browser.