MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / OnIdle

Method OnIdle

GTE/Samples/Graphics/CubeMaps/CubeMapsWindow3.cpp:35–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void 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
79bool CubeMapsWindow3::OnCharPress(uint8_t key, int32_t x, int32_t y)
80{

Callers

nothing calls this directly

Calls 15

MeasureMethod · 0.80
MoveMethod · 0.80
DynamicUpdatesMethod · 0.80
ComputeVisibleSetMethod · 0.80
SetWMatrixMethod · 0.80
GetFPSMethod · 0.80
UpdateFrameCountMethod · 0.80
UpdateFacesMethod · 0.45
UpdateMethod · 0.45
GetPositionMethod · 0.45
ClearBuffersMethod · 0.45

Tested by

no test coverage detected