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
|
Rev | Line | |
---|
[2840] | 1 | #ifndef __TRANSFORM3_H
|
---|
| 2 | #define __TRANSFORM3_H
|
---|
[2839] | 3 |
|
---|
[2957] | 4 | #include "Matrix4x4.h"
|
---|
[2952] | 5 | #include "common.h"
|
---|
[2839] | 6 |
|
---|
[2952] | 7 |
|
---|
[2839] | 8 | namespace CHCDemoEngine
|
---|
| 9 | {
|
---|
| 10 |
|
---|
| 11 | class RenderState;
|
---|
| 12 |
|
---|
| 13 |
|
---|
[3061] | 14 | /** Wrapper class for a 3D transformation
|
---|
[2839] | 15 | */
|
---|
[2840] | 16 | class Transform3
|
---|
[2839] | 17 | {
|
---|
| 18 | public:
|
---|
| 19 |
|
---|
[2957] | 20 | /** Creates a transformation.
|
---|
[2839] | 21 | */
|
---|
[2957] | 22 | Transform3(const Matrix4x4 &trafo);
|
---|
| 23 | /** The identity transformation.
|
---|
| 24 | */
|
---|
| 25 | Transform3();
|
---|
[2839] | 26 | /** Loads this transformation.
|
---|
| 27 | */
|
---|
| 28 | void Load(RenderState *state);
|
---|
| 29 | /** Unloads this transformation
|
---|
| 30 | */
|
---|
| 31 | void Unload(RenderState *state);
|
---|
[2957] | 32 | /** Right multiplies with the given matrix.
|
---|
| 33 | */
|
---|
[2961] | 34 | void MultMatrix(const Matrix4x4 &trafo);
|
---|
[2957] | 35 | /** Resets trafo to identiy.
|
---|
| 36 | */
|
---|
| 37 | void Reset();
|
---|
[3114] | 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; }
|
---|
[2957] | 47 | /** Returns true if this transformation is the identity.
|
---|
| 48 | */
|
---|
| 49 | inline bool IsIdentity() const { return mIsIdentity; }
|
---|
[2839] | 50 |
|
---|
[2840] | 51 |
|
---|
[2839] | 52 | protected:
|
---|
| 53 |
|
---|
| 54 | /// transform matrix
|
---|
[2957] | 55 | Matrix4x4 mMatrix;
|
---|
[3114] | 56 | /// the previous transformation matrix
|
---|
| 57 | Matrix4x4 mOldMatrix;
|
---|
[2957] | 58 | /// if this matrix is still the identity matrix
|
---|
| 59 | bool mIsIdentity;
|
---|
[2839] | 60 | };
|
---|
| 61 |
|
---|
| 62 |
|
---|
[3114] | 63 | void Transform3::SetMatrix(const Matrix4x4 &trafo)
|
---|
| 64 | {
|
---|
| 65 | mIsIdentity = false;
|
---|
| 66 | mOldMatrix = mMatrix;
|
---|
| 67 | mMatrix = trafo;
|
---|
[2839] | 68 | }
|
---|
| 69 |
|
---|
[3114] | 70 |
|
---|
| 71 | }
|
---|
| 72 |
|
---|
[2840] | 73 | #endif // __TRANSFORM_H |
---|
Note: See
TracBrowser
for help on using the repository browser.