source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.h @ 3359

Revision 3359, 1.4 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef __TRANSFORM3_H
2#define __TRANSFORM3_H
3
4#include "Matrix4x4.h"
5#include "common.h"
6
7
8namespace CHCDemoEngine
9{
10
11class RenderState;
12
13
14/** Wrapper class for a 3D transformation
15*/
16class Transform3
17{
18public:
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        void InitFrame();
52
53
54protected:
55
56        /// transform matrix
57        Matrix4x4 mMatrix;
58        /// the previous transformation matrix
59        Matrix4x4 mOldMatrix;
60        /// if this matrix is still the identity matrix
61        bool mIsIdentity;
62};
63
64
65void Transform3::SetMatrix(const Matrix4x4 &trafo)
66{
67        mIsIdentity = false;
68        mOldMatrix = mMatrix;
69        mMatrix = trafo;
70}
71
72
73}
74
75#endif // __TRANSFORM_H
Note: See TracBrowser for help on using the repository browser.