void Application::Render() { if (!m_deviceLost) { try { //Create Matrices D3DXMATRIX identity, world, view, proj; D3DXMatrixIdentity(&identity); D3DXMatrixLookAtLH(&view, &D3DXVECTOR3(0.0f, 1.5f, -3.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f)); D3DXMatrixPerspectiveFovLH(&proj, D3DX_PI / 4.0f, (float)WINDOW_WIDTH / (float)WINDOW_HEIGHT, 1.0f, 1000.0f); D3DXVECTOR4 lightPos(-50.0f, 75.0f, -150.0f, 0.0f); g_pDevice->SetTransform(D3DTS_WORLD, &identity); g_pDevice->SetTransform(D3DTS_VIEW, &view); g_pDevice->SetTransform(D3DTS_PROJECTION, &proj); // Clear the viewport g_pDevice->Clear(0L, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0L); // Begin the scene if (SUCCEEDED(g_pDevice->BeginScene())) { //Render Drone { g_pEffect->SetMatrix("matW", &identity); g_pEffect->SetMatrix("matVP", &(view * proj)); g_pEffect->SetVector("lightPos", &lightPos); //Update skeletal animation m_drone.SetPose(identity); //Update IK if (m_pIK) { m_pIK->UpdateHeadIK(); m_pIK->UpdateArmIK(); } m_drone.Render(NULL); } // End the scene. g_pDevice->EndScene(); g_pDevice->Present(0, 0, 0, 0); } } catch(...) { g_debug << "Error in Application::Render() \n"; } } }