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