MCPcopy Create free account
hub / github.com/carbonengine/trinity / Update

Method Update

trinity/Eve/EveSpaceScene.cpp:434–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434void EveSpaceScene::Update( Be::Time realTime, Be::Time simTime )
435{
436 CCP_STATS_ZONE( __FUNCTION__ );
437
438 {
439 USE_MAIN_THREAD_RENDER_CONTEXT();
440 auto frame = renderContext.GetRecordingFrameNumber();
441 Tr2RingBuffer::GetInstance<Float4x3>().SetFrameNumbers( frame, renderContext.GetRenderedFrameNumber() );
442 Tr2RingBuffer::GetInstance<Tr2MorphTargetAnimationData>().SetFrameNumbers( frame, renderContext.GetRenderedFrameNumber() );
443
444 if( frame == m_lastUpdateFrame )
445 {
446 // already updated this frame
447
448 TriFrustum frustum;
449 frustum.DeriveFrustum( &Tr2Renderer::GetViewTransform(), &Tr2Renderer::GetViewPosition(), &Tr2Renderer::GetProjectionTransform(), Tr2Renderer::GetViewport() );
450
451 m_updateContext.SetFrustum( frustum );
452 m_updateContext.SetHighDetailThreshold( g_eveSpaceSceneHighDetailThreshold / m_upscalingAmount );
453 m_updateContext.SetMediumDetailThreshold( g_eveSpaceSceneMediumDetailThreshold / m_upscalingAmount );
454 m_updateContext.SetLowDetailThreshold( g_eveSpaceSceneLowDetailThreshold / m_upscalingAmount );
455 m_updateContext.SetVisibilityThreshold( g_eveSpaceSceneVisibilityThreshold / m_upscalingAmount );
456 m_updateContext.SetLodFactor( g_eveSpaceSceneLODFactor / m_upscalingAmount );
457 m_updateContext.m_raytracingEnabled = m_shadowQuality == ShadowQuality::SHADOW_RAYTRACED && m_enableShadows;
458
459 // update the combined postprocess attributes
460 UpdatePostProcessAttributes();
461 return;
462 }
463 m_lastUpdateFrame = frame;
464 }
465
466 if( !m_update )
467 {
468 return;
469 }
470
471 m_updateContext.SetTime( simTime );
472 m_updateContext.UpdateOrigin( m_ballpark );
473 m_updateContext.SetDataTextureManager( m_dataTextureMgr );
474
475 TriFrustum frustum;
476 frustum.DeriveFrustum( &Tr2Renderer::GetViewTransform(), &Tr2Renderer::GetViewPosition(), &Tr2Renderer::GetProjectionTransform(), Tr2Renderer::GetViewport() );
477
478 m_updateContext.SetFrustum( frustum );
479 m_updateContext.SetHighDetailThreshold( g_eveSpaceSceneHighDetailThreshold / m_upscalingAmount );
480 m_updateContext.SetMediumDetailThreshold( g_eveSpaceSceneMediumDetailThreshold / m_upscalingAmount );
481 m_updateContext.SetLowDetailThreshold( g_eveSpaceSceneLowDetailThreshold / m_upscalingAmount );
482 m_updateContext.SetVisibilityThreshold( g_eveSpaceSceneVisibilityThreshold / m_upscalingAmount );
483 m_updateContext.SetLodFactor( g_eveSpaceSceneLODFactor / m_upscalingAmount );
484 m_updateContext.m_raytracingEnabled = m_shadowQuality == ShadowQuality::SHADOW_RAYTRACED && m_enableShadows;
485
486 {
487 CCP_STATS_ZONE( "UpdateBackgroundObjects" );
488
489 for( auto it = m_backgroundObjects.begin(); it != m_backgroundObjects.end(); ++it )
490 {
491 ( *it )->UpdateSyncronous( m_updateContext );

Callers

nothing calls this directly

Calls 15

GetViewTransformFunction · 0.85
GetViewPositionFunction · 0.85
GetProjectionTransformFunction · 0.85
ExecuteMainThreadActionsFunction · 0.85
SetLowDetailThresholdMethod · 0.80
SetLodFactorMethod · 0.80
UpdateOriginMethod · 0.80
SetDataTextureManagerMethod · 0.80
SetTaskGroupMethod · 0.80

Tested by

no test coverage detected