source:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.cpp
@
3034
Revision 3034, 748 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 | ||
[2840] | 9 | CGparameter Transform3::sModelMatrixParam; |
[2839] | 10 | |
[2952] | 11 | |
[2957] | 12 | Transform3::Transform3(const Matrix4x4 &trafo): mMatrix(trafo) |
[2839] | 13 | { |
[2957] | 14 | mIsIdentity = false; |
[2839] | 15 | } |
16 | ||
17 | ||
[2957] | 18 | Transform3::Transform3() |
[2839] | 19 | { |
[2957] | 20 | Reset(); |
[2839] | 21 | } |
22 | ||
23 | ||
[2840] | 24 | void Transform3::Load(RenderState *state) |
[2839] | 25 | { |
[2957] | 26 | if (mIsIdentity) return; |
[2960] | 27 | |
[2952] | 28 | glPushMatrix(); |
[2957] | 29 | glMultMatrixf((float *)mMatrix.x); |
[2839] | 30 | } |
31 | ||
32 | ||
[2840] | 33 | void Transform3::Unload(RenderState *state) |
[2839] | 34 | { |
[2957] | 35 | if (mIsIdentity) return; |
[2839] | 36 | |
[2952] | 37 | glPopMatrix(); |
[2839] | 38 | } |
39 | ||
[2957] | 40 | |
41 | void Transform3::MultMatrix(const Matrix4x4 &trafo) | |
42 | { | |
43 | mIsIdentity = false; | |
44 | mMatrix = mMatrix * trafo; | |
45 | } | |
46 | ||
47 | ||
48 | void Transform3::Reset() | |
49 | { | |
50 | mIsIdentity = true; | |
51 | mMatrix = IdentityMatrix(); | |
52 | } | |
53 | ||
54 | ||
[2839] | 55 | } |
Note: See TracBrowser
for help on using the repository browser.