#include "Transform3.h" #include "RenderState.h" #include "ShaderProgram.h" namespace CHCDemoEngine { Transform3::Transform3() { Reset(); } Transform3::Transform3(const Matrix4x4 &trafo): mMatrix(trafo), mOldMatrix(trafo) { mIsIdentity = false; } void Transform3::Load(RenderState *state) { if (!mIsIdentity) { glPushMatrix(); glMultMatrixf((float *)mMatrix.x); } } void Transform3::Unload(RenderState *state) { if (!mIsIdentity) glPopMatrix(); } void Transform3::MultMatrix(const Matrix4x4 &trafo) { mIsIdentity = false; mOldMatrix = mMatrix; mMatrix = trafo * mMatrix; } void Transform3::Reset() { mIsIdentity = true; mMatrix = IdentityMatrix(); mOldMatrix = mMatrix; } }