Revision 3114,
1.4 KB
checked in by mattausch, 16 years ago
(diff) |
worked on dynamic objects: now ook, but have to work on render queue
|
Line | |
---|
1 | #ifndef __TRANSFORM3_H
|
---|
2 | #define __TRANSFORM3_H
|
---|
3 |
|
---|
4 | #include "Matrix4x4.h"
|
---|
5 | #include "common.h"
|
---|
6 |
|
---|
7 |
|
---|
8 | namespace CHCDemoEngine
|
---|
9 | {
|
---|
10 |
|
---|
11 | class RenderState;
|
---|
12 |
|
---|
13 |
|
---|
14 | /** Wrapper class for a 3D transformation
|
---|
15 | */
|
---|
16 | class Transform3
|
---|
17 | {
|
---|
18 | public:
|
---|
19 |
|
---|
20 | /** Creates a transformation.
|
---|
21 | */
|
---|
22 | Transform3(const Matrix4x4 &trafo);
|
---|
23 | /** The identity transformation.
|
---|
24 | */
|
---|
25 | Transform3();
|
---|
26 | /** Loads this transformation.
|
---|
27 | */
|
---|
28 | void Load(RenderState *state);
|
---|
29 | /** Unloads this transformation
|
---|
30 | */
|
---|
31 | void Unload(RenderState *state);
|
---|
32 | /** Right multiplies with the given matrix.
|
---|
33 | */
|
---|
34 | void MultMatrix(const Matrix4x4 &trafo);
|
---|
35 | /** Resets trafo to identiy.
|
---|
36 | */
|
---|
37 | void Reset();
|
---|
38 | /** Returns the trafo matrix.
|
---|
39 | */
|
---|
40 | inline Matrix4x4 GetMatrix() const { return mMatrix; }
|
---|
41 | /** See Get
|
---|
42 | */
|
---|
43 | inline void SetMatrix(const Matrix4x4 &trafo) ;
|
---|
44 | /** Returns the old trafo matrix.
|
---|
45 | */
|
---|
46 | inline Matrix4x4 GetOldMatrix() const { return mOldMatrix; }
|
---|
47 | /** Returns true if this transformation is the identity.
|
---|
48 | */
|
---|
49 | inline bool IsIdentity() const { return mIsIdentity; }
|
---|
50 |
|
---|
51 |
|
---|
52 | protected:
|
---|
53 |
|
---|
54 | /// transform matrix
|
---|
55 | Matrix4x4 mMatrix;
|
---|
56 | /// the previous transformation matrix
|
---|
57 | Matrix4x4 mOldMatrix;
|
---|
58 | /// if this matrix is still the identity matrix
|
---|
59 | bool mIsIdentity;
|
---|
60 | };
|
---|
61 |
|
---|
62 |
|
---|
63 | void Transform3::SetMatrix(const Matrix4x4 &trafo)
|
---|
64 | {
|
---|
65 | mIsIdentity = false;
|
---|
66 | mOldMatrix = mMatrix;
|
---|
67 | mMatrix = trafo;
|
---|
68 | }
|
---|
69 |
|
---|
70 |
|
---|
71 | }
|
---|
72 |
|
---|
73 | #endif // __TRANSFORM_H |
---|
Note: See
TracBrowser
for help on using the repository browser.