|
@@ -88,7 +88,6 @@ namespace AtomSampleViewer
|
|
|
|
|
|
void MeshExampleComponent::CreateLowEndPipeline()
|
|
|
{
|
|
|
- // Create low end pipeline
|
|
|
AZ::RPI::RenderPipelineDescriptor pipelineDesc;
|
|
|
pipelineDesc.m_mainViewTagName = "MainCamera";
|
|
|
pipelineDesc.m_name = "LowEndPipeline";
|
|
@@ -96,20 +95,31 @@ namespace AtomSampleViewer
|
|
|
pipelineDesc.m_renderSettings.m_multisampleState.m_samples = 4;
|
|
|
|
|
|
m_lowEndPipeline = AZ::RPI::RenderPipeline::CreateRenderPipelineForWindow(pipelineDesc, *m_windowContext);
|
|
|
+ }
|
|
|
|
|
|
- // Add it to the scene
|
|
|
+ void MeshExampleComponent::DestroyLowEndPipeline()
|
|
|
+ {
|
|
|
+ m_lowEndPipeline = nullptr;
|
|
|
+ }
|
|
|
+
|
|
|
+ void MeshExampleComponent::ActivateLowEndPipeline()
|
|
|
+ {
|
|
|
AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
|
|
|
m_originalPipeline = defaultScene->GetDefaultRenderPipeline();
|
|
|
defaultScene->AddRenderPipeline(m_lowEndPipeline);
|
|
|
m_lowEndPipeline->SetDefaultView(m_originalPipeline->GetDefaultView());
|
|
|
- m_lowEndPipeline->RemoveFromRenderTick();
|
|
|
+ defaultScene->RemoveRenderPipeline(m_originalPipeline->GetId());
|
|
|
+
|
|
|
+ m_imguiScope = AZ::Render::ImGuiActiveContextScope::FromPass(AZ::RPI::PassHierarchyFilter({ m_lowEndPipeline->GetId().GetCStr(), "ImGuiPass" }));
|
|
|
}
|
|
|
|
|
|
- void MeshExampleComponent::DestroyLowEndPipeline()
|
|
|
+ void MeshExampleComponent::DeactivateLowEndPipeline()
|
|
|
{
|
|
|
+ m_imguiScope = {}; // restores previous ImGui context.
|
|
|
+
|
|
|
AZ::RPI::ScenePtr defaultScene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
|
|
|
+ defaultScene->AddRenderPipeline(m_originalPipeline);
|
|
|
defaultScene->RemoveRenderPipeline(m_lowEndPipeline->GetId());
|
|
|
- m_lowEndPipeline = nullptr;
|
|
|
}
|
|
|
|
|
|
void MeshExampleComponent::Activate()
|
|
@@ -181,20 +191,6 @@ namespace AtomSampleViewer
|
|
|
ShutdownLightingPresets();
|
|
|
}
|
|
|
|
|
|
- void MeshExampleComponent::ActivateLowEndPipeline()
|
|
|
- {
|
|
|
- m_lowEndPipeline->AddToRenderTick();
|
|
|
- m_originalPipeline->RemoveFromRenderTick();
|
|
|
- m_imguiScope = AZ::Render::ImGuiActiveContextScope::FromPass(AZ::RPI::PassHierarchyFilter({ m_lowEndPipeline->GetId().GetCStr(), "ImGuiPass" }));
|
|
|
- }
|
|
|
-
|
|
|
- void MeshExampleComponent::DeactivateLowEndPipeline()
|
|
|
- {
|
|
|
- m_originalPipeline->AddToRenderTick();
|
|
|
- m_lowEndPipeline->RemoveFromRenderTick();
|
|
|
- m_imguiScope = {}; // restores previous ImGui context.
|
|
|
- }
|
|
|
-
|
|
|
void MeshExampleComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
|
|
|
{
|
|
|
bool modelNeedsUpdate = false;
|