void RotatingWorldModel::Update() { // Handle the first update if (m_bFirstUpdate) FirstUpdate(); LTFLOAT fUpdateDelta = RWM_UPDATE_DELTA; switch (m_eState) { case RWM_SPINUP: UpdateSpinUp(); break; case RWM_SPINDOWN: UpdateSpinDown(); break; case RWM_OFF: fUpdateDelta = 0.0f; break; case RWM_NORMAL: default: UpdateNormalRotation(); break; } SetNextUpdate(fUpdateDelta); }
void Rotating::Update() { CServerDE* pServerDE = BaseClass::GetServerDE(); if (!pServerDE) return; DFLOAT fUpdateDelta = RWM_UPDATE_DELTA; switch (m_eState) { case RWM_SPINUP: UpdateSpinUp(); break; case RWM_SPINDOWN: UpdateSpinDown(); break; case RWM_OFF: fUpdateDelta = 0.0f; break; case RWM_NORMAL: default: UpdateNormalRotation(); break; } if (fUpdateDelta) pServerDE->SetNextUpdate(m_hObject, fUpdateDelta); }
void Rotating::UpdateSpinDown() { CServerDE* pServerDE = BaseClass::GetServerDE(); if (!pServerDE) return; DBOOL bXDone = DFALSE, bYDone = DFALSE, bZDone = DFALSE; DFLOAT fDeltaTime = pServerDE->GetFrameTime(); // Calculate current velocity... m_vSpinTimeLeft.x -= fDeltaTime; if (m_vSaveVelocity.x > 0.0f && m_vSpinTimeLeft.x >= 0.0f) { m_vVelocity.x = m_vSaveVelocity.x - (m_vSaveVelocity.x * (m_vSpinDownTime.x - m_vSpinTimeLeft.x) / m_vSpinDownTime.x); } else { m_vVelocity.x = 0.0f; bXDone = DTRUE; } m_vSpinTimeLeft.y -= fDeltaTime; if (m_vSaveVelocity.y > 0.0f && m_vSpinTimeLeft.y >= 0.0f) { m_vVelocity.y = m_vSaveVelocity.y - (m_vSaveVelocity.y * (m_vSpinDownTime.y - m_vSpinTimeLeft.y) / m_vSpinDownTime.y); } else { m_vVelocity.y = 0.0f; bYDone = DTRUE; } m_vSpinTimeLeft.z -= fDeltaTime; if (m_vSaveVelocity.z > 0.0f && m_vSpinTimeLeft.z >= 0.0f) { m_vVelocity.z = m_vSaveVelocity.z - (m_vSaveVelocity.z * (m_vSpinDownTime.z - m_vSpinTimeLeft.z) / m_vSpinDownTime.z); } else { m_vVelocity.z = 0.0f; bZDone = DTRUE; } // Call normal update to do the work... UpdateNormalRotation(); if (bXDone && bYDone && bZDone) { SetOff(); } }
void RotatingWorldModel::UpdateSpinDown() { LTBOOL bXDone = LTFALSE, bYDone = LTFALSE, bZDone = LTFALSE; LTFLOAT fDeltaTime = g_pLTServer->GetFrameTime(); // Calculate current velocity... m_vSpinTimeLeft.x -= fDeltaTime; if (m_vSaveVelocity.x > 0.0f && m_vSpinTimeLeft.x >= 0.0f) { m_vVelocity.x = m_vSaveVelocity.x - (m_vSaveVelocity.x * (m_vSpinDownTime.x - m_vSpinTimeLeft.x) / m_vSpinDownTime.x); } else { m_vVelocity.x = 0.0f; bXDone = LTTRUE; } m_vSpinTimeLeft.y -= fDeltaTime; if (m_vSaveVelocity.y > 0.0f && m_vSpinTimeLeft.y >= 0.0f) { m_vVelocity.y = m_vSaveVelocity.y - (m_vSaveVelocity.y * (m_vSpinDownTime.y - m_vSpinTimeLeft.y) / m_vSpinDownTime.y); } else { m_vVelocity.y = 0.0f; bYDone = LTTRUE; } m_vSpinTimeLeft.z -= fDeltaTime; if (m_vSaveVelocity.z > 0.0f && m_vSpinTimeLeft.z >= 0.0f) { m_vVelocity.z = m_vSaveVelocity.z - (m_vSaveVelocity.z * (m_vSpinDownTime.z - m_vSpinTimeLeft.z) / m_vSpinDownTime.z); } else { m_vVelocity.z = 0.0f; bZDone = LTTRUE; } // Call normal update to do the work... UpdateNormalRotation(); if (bXDone && bYDone && bZDone) { SetOff(); } }