| 521 | } |
| 522 | |
| 523 | void Sample::SceneLoaded( ) |
| 524 | { |
| 525 | m_frameIndex = 0; |
| 526 | |
| 527 | m_progressLoading.Set(50); |
| 528 | |
| 529 | if (m_sampleGame != nullptr) m_sampleGame->SceneLoaded(m_scene, m_currentScenePath, GetLocalPath(c_AssetsFolder)); |
| 530 | |
| 531 | m_progressLoading.Set(55); |
| 532 | |
| 533 | ApplicationBase::SceneLoaded( ); |
| 534 | |
| 535 | m_progressLoading.Set(60); |
| 536 | |
| 537 | m_sceneTime = 0.f; |
| 538 | m_scene->FinishedLoading( GetFrameIndex( ) ); |
| 539 | |
| 540 | m_progressLoading.Set(65); |
| 541 | |
| 542 | // Find lights; do this before special cases to avoid duplicates |
| 543 | for (auto light : m_scene->GetSceneGraph()->GetLights()) |
| 544 | { |
| 545 | m_lights.push_back(light); |
| 546 | } |
| 547 | |
| 548 | // seem like sensible defaults |
| 549 | m_ui.ToneMappingParams.exposureCompensation = 2.0f; |
| 550 | m_ui.ToneMappingParams.exposureValue = 0.0f; |
| 551 | |
| 552 | std::shared_ptr<EnvironmentLight> envLight = FindEnvironmentLight(m_lights); |
| 553 | m_envMapLocalPath = (envLight==nullptr)?(""):(envLight->path); |
| 554 | m_ui.EnvironmentMapParams = EnvironmentMapRuntimeParameters(); |
| 555 | m_envMapOverride = c_EnvMapSceneDefault; |
| 556 | |
| 557 | if (m_ui.TogglableNodes == nullptr) |
| 558 | { |
| 559 | m_ui.TogglableNodes = std::make_shared<std::vector<TogglableNode>>(); |
| 560 | UpdateTogglableNodes(*m_ui.TogglableNodes, GetScene()->GetSceneGraph()->GetRootNode().get()); // UNSAFE - make sure not to keep m_ui.TogglableNodes longer than scenegraph! |
| 561 | } |
| 562 | |
| 563 | // clean up invisible lights / markers because they slow things down |
| 564 | for (int i = (int)m_lights.size() - 1; i >= 0; i--) |
| 565 | { |
| 566 | LightConstants lc; |
| 567 | m_lights[i]->FillLightConstants(lc); |
| 568 | if (length(lc.color * lc.intensity) <= 1e-7f) |
| 569 | m_lights.erase( m_lights.begin() + i ); |
| 570 | } |
| 571 | |
| 572 | if( m_envMapLocalPath != "" ) |
| 573 | { |
| 574 | // Make sure that there's an environment light object attached to the scene, |
| 575 | // so that RTXDI will pick it up and sample. |
| 576 | if (envLight == nullptr) |
| 577 | { |
| 578 | envLight = std::make_shared<EnvironmentLight>(); |
| 579 | m_scene->GetSceneGraph()->AttachLeafNode(m_scene->GetSceneGraph()->GetRootNode(), envLight); |
| 580 | m_lights.push_back(envLight); |
nothing calls this directly
no test coverage detected