| 33 | } |
| 34 | |
| 35 | void CubeMapsWindow3::OnIdle() |
| 36 | { |
| 37 | mTimer.Measure(); |
| 38 | |
| 39 | if (mCameraRig.Move()) |
| 40 | { |
| 41 | if (mCubeMapEffect->DynamicUpdates()) |
| 42 | { |
| 43 | // Cull the sphere object because it is the object that |
| 44 | // reflects the environment. |
| 45 | mSphere->culling = CullingMode::ALWAYS; |
| 46 | |
| 47 | // You can take a snapshot of the environment from any camera |
| 48 | // position and camera orientation. In this application, the |
| 49 | // environment is always rendered from the center of the cube |
| 50 | // object and using the axes of that cube for the orientation. |
| 51 | mCubeMapEffect->UpdateFaces(mEngine, mScene, mCuller, |
| 52 | { 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 1.0f, 0.0f }, |
| 53 | { 0.0f, 1.0f, 0.0f, 0.0f }, { -1.0f, 0.0f, 0.0f, 0.0f }); |
| 54 | |
| 55 | // Restore the sphere object's culling state. |
| 56 | mSphere->culling = CullingMode::DYNAMIC; |
| 57 | } |
| 58 | |
| 59 | mPVWMatrices.Update(); |
| 60 | mCuller.ComputeVisibleSet(mCamera, mScene); |
| 61 | } |
| 62 | |
| 63 | mCubeMapEffect->SetWMatrix(mSphere->worldTransform); |
| 64 | mEngine->Update(mCubeMapEffect->GetWMatrixConstant()); |
| 65 | mCubeMapEffect->SetCameraWorldPosition(mCamera->GetPosition()); |
| 66 | mEngine->Update(mCubeMapEffect->GetCameraWorldPositionConstant()); |
| 67 | |
| 68 | mEngine->ClearBuffers(); |
| 69 | for (auto const& visual : mCuller.GetVisibleSet()) |
| 70 | { |
| 71 | mEngine->Draw(visual); |
| 72 | } |
| 73 | mEngine->Draw(8, mYSize - 8, { 0.0f, 0.0f, 0.0f, 1.0f }, mTimer.GetFPS()); |
| 74 | mEngine->DisplayColorBuffer(0); |
| 75 | |
| 76 | mTimer.UpdateFrameCount(); |
| 77 | } |
| 78 | |
| 79 | bool CubeMapsWindow3::OnCharPress(uint8_t key, int32_t x, int32_t y) |
| 80 | { |
nothing calls this directly
no test coverage detected