Fix track view bug where postfxs do not render correctly. (#5465)

* Fix track view bug where postfxs do not render correctly.

Signed-off-by: hershey5045 <43485729+hershey5045@users.noreply.github.com>

* Reduce scope and add comments.

Signed-off-by: hershey5045 <43485729+hershey5045@users.noreply.github.com>
This commit is contained in:
hershey5045
2021-11-10 16:03:50 -08:00
committed by GitHub
parent 27f0aa7f13
commit 9c57c9e64f
6 changed files with 61 additions and 6 deletions
@@ -37,6 +37,11 @@ namespace AZ
m_currentTime = AZStd::chrono::system_clock::now();
}
void PostProcessFeatureProcessor::Deactivate()
{
m_viewAliasMap.clear();
}
void PostProcessFeatureProcessor::UpdateTime()
{
AZStd::chrono::system_clock::time_point now = AZStd::chrono::system_clock::now();
@@ -45,6 +50,16 @@ namespace AZ
m_deltaTime = deltaTime.count();
}
void PostProcessFeatureProcessor::SetViewAlias(const AZ::RPI::ViewPtr sourceView, const AZ::RPI::ViewPtr targetView)
{
m_viewAliasMap[sourceView.get()] = targetView.get();
}
void PostProcessFeatureProcessor::RemoveViewAlias(const AZ::RPI::ViewPtr sourceView)
{
m_viewAliasMap.erase(sourceView.get());
}
void PostProcessFeatureProcessor::Simulate(const FeatureProcessor::SimulatePacket& packet)
{
AZ_PROFILE_SCOPE(RPI, "PostProcessFeatureProcessor: Simulate");
@@ -200,8 +215,12 @@ namespace AZ
AZ::Render::PostProcessSettings* PostProcessFeatureProcessor::GetLevelSettingsFromView(AZ::RPI::ViewPtr view)
{
// check for view aliases first
auto viewAliasiterator = m_viewAliasMap.find(view.get());
// Use the view alias if it exists
auto settingsIterator = m_blendedPerViewSettings.find(viewAliasiterator != m_viewAliasMap.end() ? viewAliasiterator->second : view.get());
// If no settings for the view is found, the global settings is returned.
auto settingsIterator = m_blendedPerViewSettings.find(view.get());
return settingsIterator != m_blendedPerViewSettings.end()
? &settingsIterator->second
: m_globalAggregateLevelSettings.get();