#ifndef __TRANSFORM3_H #define __TRANSFORM3_H #include "Matrix4x4.h" #include "common.h" namespace CHCDemoEngine { class RenderState; /** Wrapper class for a 3D transformation */ class Transform3 { public: /** Creates a transformation. */ Transform3(const Matrix4x4 &trafo); /** The identity transformation. */ Transform3(); /** Loads this transformation. */ void Load(RenderState *state); /** Unloads this transformation */ void Unload(RenderState *state); /** Right multiplies with the given matrix. */ void MultMatrix(const Matrix4x4 &trafo); /** Resets trafo to identiy. */ void Reset(); /** Returns the trafo matrix. */ inline Matrix4x4 GetMatrix() const { return mMatrix; } /** See Get */ inline void SetMatrix(const Matrix4x4 &trafo) ; /** Returns the old trafo matrix. */ inline Matrix4x4 GetOldMatrix() const { return mOldMatrix; } /** Returns true if this transformation is the identity. */ inline bool IsIdentity() const { return mIsIdentity; } protected: /// transform matrix Matrix4x4 mMatrix; /// the previous transformation matrix Matrix4x4 mOldMatrix; /// if this matrix is still the identity matrix bool mIsIdentity; }; void Transform3::SetMatrix(const Matrix4x4 &trafo) { mIsIdentity = false; mOldMatrix = mMatrix; mMatrix = trafo; } } #endif // __TRANSFORM_H