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

Method UpdateScene

GTE/Samples/SceneGraphs/Terrain/TerrainWindow3.cpp:294–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294void TerrainWindow3::UpdateScene()
295{
296 // The sky dome moves with the camera so that it is always in view.
297 Vector4<float> camPosition = mCamera->GetPosition();
298 mSkyDome->localTransform.SetTranslation(camPosition[0], camPosition[1], 0.0f);
299 mSkyDome->Update();
300
301 // Update the active terrain pages, including the PVW and VW matrices.
302 mTerrain->OnCameraMotion();
303 mScene->Update();
304 mCuller.ComputeVisibleSet(mCamera, mScene);
305 mPVWMatrices.Update(mCuller.GetVisibleSet());
306 for (auto const visual : mCuller.GetVisibleSet())
307 {
308 if (visual->name.find("page") == 0)
309 {
310 auto effect = std::dynamic_pointer_cast<TerrainEffect>(visual->GetEffect());
311 auto const& vwMatrixConstant = effect->GetVWMatrixConstant();
312 Matrix4x4<float> vMatrix = mCamera->GetViewMatrix();
313 Matrix4x4<float> wMatrix = visual->worldTransform.GetHMatrix();
314 *vwMatrixConstant->Get<Matrix4x4<float>>() = DoTransform(vMatrix, wMatrix);
315 mEngine->Update(vwMatrixConstant);
316 }
317 }
318}
319
320void TerrainWindow3::TerrainCameraRig::Initialize(std::shared_ptr<Camera> const& camera,
321 float translationSpeed, float rotationSpeed, std::shared_ptr<Terrain> const& terrain,

Callers

nothing calls this directly

Calls 7

SetTranslationMethod · 0.80
OnCameraMotionMethod · 0.80
ComputeVisibleSetMethod · 0.80
DoTransformFunction · 0.50
GetPositionMethod · 0.45
UpdateMethod · 0.45
GetVisibleSetMethod · 0.45

Tested by

no test coverage detected