void ForwardRenderer::Update( float dt ) { // m_fLightRotationAngle += 0.1f*dt; XMMATRIX R = XMMatrixRotationY( m_fLightRotationAngle ); for ( int i = 0; i < 3; ++i ) { XMVECTOR lightDir = XMLoadFloat3( &m_OriginalLightDir[i] ); lightDir = XMVector3TransformNormal( lightDir, R ); XMStoreFloat3( &m_DirLights[i].Direction, lightDir ); } BuildShadowTransform(); }
void DuckHuntMain::UpdateScene(float dt) { // // Control the camera. // if (GetAsyncKeyState('W') & 0x8000) mCam.Walk(10.0f*dt); if (GetAsyncKeyState('S') & 0x8000) mCam.Walk(-10.0f*dt); if (GetAsyncKeyState('A') & 0x8000) mCam.Strafe(-10.0f*dt); if (GetAsyncKeyState('D') & 0x8000) mCam.Strafe(10.0f*dt); // // Animate the lights (and hence shadows). // //// //// Walk/fly mode //// //if (GetAsyncKeyState('2') & 0x8000) // mWalkCamMode = true; //if (GetAsyncKeyState('3') & 0x8000) // mWalkCamMode = false; //// //// Clamp camera to terrain surface in walk mode. //// XMFLOAT3 camPos = mCam.GetPosition(); float y = mTerrain.GetHeight(camPos.x, camPos.z); mCam.SetPosition(camPos.x, y + 2.0f, camPos.z); BuildShadowTransform(); mCam.UpdateViewMatrix(); mSystem->update(); }