| 344 | } |
| 345 | |
| 346 | void EveSpaceScene::UpdatePostProcessAttributes() |
| 347 | { |
| 348 | if( !m_display ) |
| 349 | { |
| 350 | return; |
| 351 | } |
| 352 | |
| 353 | // is this ok? |
| 354 | m_sceneDefaultPostProcessAttributes->FromPostProcess( m_sceneDefaultPostProcess, PostProcessEnums::SCENE_DEFAULT_PRIORITY, 1.0f ); |
| 355 | |
| 356 | std::vector<Tr2PostProcessAttributes*> postProcessAttributes; |
| 357 | |
| 358 | for( auto& owner : m_componentRegistry->GetComponents<ITr2PostProcessOwner>() ) |
| 359 | { |
| 360 | postProcessAttributes.push_back( owner->GetPostProcessAttributes() ); |
| 361 | } |
| 362 | |
| 363 | postProcessAttributes.push_back( m_sceneDefaultPostProcessAttributes ); |
| 364 | |
| 365 | if( !postProcessAttributes.empty() ) |
| 366 | { |
| 367 | if( !m_combinedPostProcess ) |
| 368 | { |
| 369 | m_combinedPostProcess.CreateInstance(); |
| 370 | } |
| 371 | |
| 372 | std::sort( |
| 373 | begin( postProcessAttributes ), |
| 374 | end( postProcessAttributes ), |
| 375 | []( Tr2PostProcessAttributes* a, Tr2PostProcessAttributes* b ) { |
| 376 | return a->priority > b->priority; |
| 377 | } ); |
| 378 | if( g_enablePostProcessDebugging ) |
| 379 | { |
| 380 | PriorityBlend::AttributesDebugObserver<Tr2PostProcessAttributes> observer; |
| 381 | Tr2PostProcessAttributes::MergeInto( *m_combinedPostProcess, postProcessAttributes, &observer ); |
| 382 | m_postProcessDebug = observer.GetDict(); |
| 383 | } |
| 384 | else |
| 385 | { |
| 386 | Tr2PostProcessAttributes::MergeInto( *m_combinedPostProcess, postProcessAttributes ); |
| 387 | m_postProcessDebug = {}; |
| 388 | } |
| 389 | if( m_sceneDefaultPostProcess ) |
| 390 | { |
| 391 | m_combinedPostProcess->SetDynamicExposure( m_sceneDefaultPostProcess->GetDynamicExposureIfAvailable() ); |
| 392 | m_combinedPostProcess->SetTaa( m_sceneDefaultPostProcess->GetTaaIfAvailable() ); |
| 393 | m_combinedPostProcess->SetTonemapping( m_sceneDefaultPostProcess->GetTonemappingIfAvailable() ); |
| 394 | m_combinedPostProcess->SetFog( m_sceneDefaultPostProcess->GetFogIfAvailable() ); |
| 395 | m_combinedPostProcess->SetGodRays( m_sceneDefaultPostProcess->GetGodRaysIfAvailable() ); |
| 396 | m_combinedPostProcess->SetGenericEffect( m_sceneDefaultPostProcess->GetGenericEffectIfAvailable() ); |
| 397 | } |
| 398 | else |
| 399 | { |
| 400 | m_combinedPostProcess->SetDynamicExposure( nullptr ); |
| 401 | m_combinedPostProcess->SetTaa( nullptr ); |
| 402 | m_combinedPostProcess->SetTonemapping( nullptr ); |
| 403 | m_combinedPostProcess->SetFog( nullptr ); |
nothing calls this directly
no test coverage detected