#include #include "C_Hand.h" #define FADE_DURATION 500 //duration of animations in ms unsigned int g_HandAnimDurations[3] = {0, 100, 100}; C_Hand::C_Hand(const char* f_strFileName, GLuint f_uiTex, MatProps_t f_Mat) : C_3DObject(f_strFileName, f_uiTex, f_Mat), m_CurrState(HS_IDLE), m_uiAnimStart(0) { } void C_Hand::Render(unsigned int f_iElapsedTime) { unsigned int l_uiDeltaTime = f_iElapsedTime - m_uiAnimStart; if (l_uiDeltaTime > g_HandAnimDurations[(int)m_CurrState]) { m_CurrState = HS_IDLE; } MatProps_t l_m = m_Mat; //backup //scale translate and rotate glPushMatrix(); TransRotateScale(); switch (m_CurrState) { case HS_COLLIDE: m_Mat.setEmi(1.0, 0.0, 0.0, 1.0); C_3DObject::Render(); break; case HS_GRAB: C_3DObject::Render(); break; case HS_RELEASE: C_3DObject::Render(); break; case HS_IDLE: default: C_3DObject::Render(); break; } //restore original matprops m_Mat = l_m; glPopMatrix(); }