* ATOM-16747 RPISystemInterface::GetDefaultScene returns the scene created by PreviewRenderer but not the Main Scene
Deprecate GetDefaultScene() function.
Update all the places which use GetDefaultScene to use Scene::GetFeatureProcessorFromEntityId or GetMainScene.
Tested with Editor, UI Editor, Material Editor, game launcher.
Signed-off-by: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com>
(cherry picked from commit 8da6bea073)
This commit is contained in:
@@ -108,7 +108,7 @@ namespace AZ
|
||||
{
|
||||
m_dynamicDrawManager.reset();
|
||||
AZ::RPI::ViewportContextManagerNotificationsBus::Handler::BusDisconnect();
|
||||
RPI::Scene* scene = RPI::RPISystemInterface::Get()->GetDefaultScene().get();
|
||||
RPI::Scene* scene = AZ::RPI::Scene::GetSceneForEntityContextId(m_entityContextId);
|
||||
// Check if scene is emptry since scene might be released already when running AtomSampleViewer
|
||||
if (scene)
|
||||
{
|
||||
@@ -157,9 +157,9 @@ namespace AZ
|
||||
|
||||
void AtomBridgeSystemComponent::OnBootstrapSceneReady(AZ::RPI::Scene* bootstrapScene)
|
||||
{
|
||||
AZ_UNUSED(bootstrapScene);
|
||||
// Make default AtomDebugDisplayViewportInterface
|
||||
AZStd::shared_ptr<AtomDebugDisplayViewportInterface> mainEntityDebugDisplay = AZStd::make_shared<AtomDebugDisplayViewportInterface>(AzFramework::g_defaultSceneEntityDebugDisplayId);
|
||||
AZStd::shared_ptr<AtomDebugDisplayViewportInterface> mainEntityDebugDisplay =
|
||||
AZStd::make_shared<AtomDebugDisplayViewportInterface>(AzFramework::g_defaultSceneEntityDebugDisplayId, bootstrapScene);
|
||||
m_activeViewportsList[AzFramework::g_defaultSceneEntityDebugDisplayId] = mainEntityDebugDisplay;
|
||||
}
|
||||
|
||||
|
||||
@@ -256,12 +256,11 @@ namespace AZ::AtomBridge
|
||||
viewportContextPtr->ConnectSceneChangedHandler(m_sceneChangeHandler);
|
||||
}
|
||||
|
||||
AtomDebugDisplayViewportInterface::AtomDebugDisplayViewportInterface(uint32_t defaultInstanceAddress)
|
||||
AtomDebugDisplayViewportInterface::AtomDebugDisplayViewportInterface(uint32_t defaultInstanceAddress, RPI::Scene* scene)
|
||||
{
|
||||
ResetRenderState();
|
||||
m_viewportId = defaultInstanceAddress;
|
||||
m_defaultInstance = true;
|
||||
RPI::Scene* scene = RPI::RPISystemInterface::Get()->GetDefaultScene().get();
|
||||
InitInternal(scene, nullptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace AZ::AtomBridge
|
||||
AZ_RTTI(AtomDebugDisplayViewportInterface, "{09AF6A46-0100-4FBF-8F94-E6B221322D14}", AzFramework::DebugDisplayRequestBus::Handler);
|
||||
|
||||
explicit AtomDebugDisplayViewportInterface(AZ::RPI::ViewportContextPtr viewportContextPtr);
|
||||
explicit AtomDebugDisplayViewportInterface(uint32_t defaultInstanceAddress);
|
||||
explicit AtomDebugDisplayViewportInterface(uint32_t defaultInstanceAddress, RPI::Scene* scene);
|
||||
~AtomDebugDisplayViewportInterface();
|
||||
|
||||
void ResetRenderState();
|
||||
|
||||
@@ -133,18 +133,6 @@ namespace AZ
|
||||
typedef std::vector<FontEffect> FontEffects;
|
||||
typedef FontEffects::iterator FontEffectsIterator;
|
||||
|
||||
struct FontPipelineStateMapKey
|
||||
{
|
||||
AZ::RPI::SceneId m_sceneId; // which scene pipeline state is attached to (via Render Pipeline)
|
||||
AZ::RHI::DrawListTag m_drawListTag; // which render pass this pipeline draws in by default
|
||||
|
||||
bool operator<(const FontPipelineStateMapKey& other) const
|
||||
{
|
||||
return m_sceneId < other.m_sceneId
|
||||
|| (m_sceneId == other.m_sceneId && m_drawListTag < other.m_drawListTag);
|
||||
}
|
||||
};
|
||||
|
||||
struct FontShaderData
|
||||
{
|
||||
AZ::RHI::ShaderInputNameIndex m_imageInputIndex = "m_texture";
|
||||
|
||||
+1
-5
@@ -48,11 +48,7 @@ namespace AZ
|
||||
|
||||
void DiffuseGlobalIlluminationComponentController::Activate(EntityId entityId)
|
||||
{
|
||||
AZ_UNUSED(entityId);
|
||||
|
||||
const RPI::Scene* scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get();
|
||||
m_featureProcessor = scene->GetFeatureProcessor<DiffuseGlobalIlluminationFeatureProcessorInterface>();
|
||||
|
||||
m_featureProcessor = AZ::RPI::Scene::GetFeatureProcessorForEntity<DiffuseGlobalIlluminationFeatureProcessorInterface>(entityId);
|
||||
OnConfigChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace AZ
|
||||
m_entityId = entityId;
|
||||
m_dirty = true;
|
||||
|
||||
RPI::ScenePtr scene = RPI::RPISystemInterface::Get()->GetDefaultScene();
|
||||
RPI::Scene* scene = RPI::Scene::GetSceneForEntityId(m_entityId);
|
||||
if (scene)
|
||||
{
|
||||
AZ::RPI::SceneNotificationBus::Handler::BusConnect(scene->GetId());
|
||||
|
||||
+1
-2
@@ -357,8 +357,7 @@ namespace AZ
|
||||
void DisplayMapperComponentController::OnConfigChanged()
|
||||
{
|
||||
// Register the configuration with the AcesDisplayMapperFeatureProcessor for this scene.
|
||||
const AZ::RPI::Scene* scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene().get();
|
||||
DisplayMapperFeatureProcessorInterface* fp = scene->GetFeatureProcessor<DisplayMapperFeatureProcessorInterface>();
|
||||
DisplayMapperFeatureProcessorInterface* fp = AZ::RPI::Scene::GetFeatureProcessorForEntity<DisplayMapperFeatureProcessorInterface>(m_entityId);
|
||||
DisplayMapperConfigurationDescriptor desc;
|
||||
desc.m_operationType = m_configuration.m_displayMapperOperation;
|
||||
desc.m_ldrGradingLutEnabled = m_configuration.m_ldrColorGradingLutEnabled;
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ namespace AZ
|
||||
// CVar for toggling the display of the scene stats
|
||||
int r_skinnedMeshDisplaySceneStats = 0;
|
||||
// SceneId to query for the stats
|
||||
RPI::SceneId m_sceneId = RPI::SceneId::CreateNull();
|
||||
RPI::SceneId m_sceneId;
|
||||
};
|
||||
}// namespace Render
|
||||
}// namespace AZ
|
||||
|
||||
@@ -60,6 +60,7 @@ namespace EMStudio
|
||||
|
||||
// Create and register a scene with all available feature processors
|
||||
AZ::RPI::SceneDescriptor sceneDesc;
|
||||
sceneDesc.m_nameId = AZ::Name("AnimViewport");
|
||||
m_scene = AZ::RPI::Scene::CreateScene(sceneDesc);
|
||||
m_scene->EnableAllFeatureProcessors();
|
||||
|
||||
@@ -213,8 +214,7 @@ namespace EMStudio
|
||||
AZ::TransformBus::Event(m_iblEntity->GetId(), &AZ::TransformBus::Events::SetLocalTM, iblTransform);
|
||||
|
||||
const AZ::Matrix4x4 rotationMatrix = AZ::Matrix4x4::CreateIdentity();
|
||||
AZ::RPI::ScenePtr scene = AZ::RPI::RPISystemInterface::Get()->GetDefaultScene();
|
||||
auto skyBoxFeatureProcessorInterface = scene->GetFeatureProcessor<AZ::Render::SkyBoxFeatureProcessorInterface>();
|
||||
auto skyBoxFeatureProcessorInterface = m_scene->GetFeatureProcessor<AZ::Render::SkyBoxFeatureProcessorInterface>();
|
||||
skyBoxFeatureProcessorInterface->SetCubemapRotationMatrix(rotationMatrix);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user