|
|
|
|
@ -96,16 +96,29 @@ namespace AZ
|
|
|
|
|
|
|
|
|
|
void ReflectionProbe::Simulate(uint32_t probeIndex)
|
|
|
|
|
{
|
|
|
|
|
if (m_buildingCubeMap && m_environmentCubeMapPass->IsFinished())
|
|
|
|
|
if (m_buildingCubeMap)
|
|
|
|
|
{
|
|
|
|
|
// all faces of the cubemap have been rendered, invoke the callback
|
|
|
|
|
m_callback(m_environmentCubeMapPass->GetTextureData(), m_environmentCubeMapPass->GetTextureFormat());
|
|
|
|
|
|
|
|
|
|
// remove the pipeline
|
|
|
|
|
m_scene->RemoveRenderPipeline(m_environmentCubeMapPipelineId);
|
|
|
|
|
m_environmentCubeMapPass = nullptr;
|
|
|
|
|
|
|
|
|
|
m_buildingCubeMap = false;
|
|
|
|
|
Data::Instance<RPI::ShaderResourceGroup> sceneSrg = m_scene->GetShaderResourceGroup();
|
|
|
|
|
|
|
|
|
|
if (m_environmentCubeMapPass->IsFinished())
|
|
|
|
|
{
|
|
|
|
|
// all faces of the cubemap have been rendered, invoke the callback
|
|
|
|
|
m_callback(m_environmentCubeMapPass->GetTextureData(), m_environmentCubeMapPass->GetTextureFormat());
|
|
|
|
|
|
|
|
|
|
// remove the pipeline
|
|
|
|
|
m_scene->RemoveRenderPipeline(m_environmentCubeMapPipelineId);
|
|
|
|
|
m_environmentCubeMapPass = nullptr;
|
|
|
|
|
|
|
|
|
|
// restore exposure
|
|
|
|
|
sceneSrg->SetConstant(m_iblExposureConstantIndex, m_previousExposure);
|
|
|
|
|
|
|
|
|
|
m_buildingCubeMap = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// set exposure to 0.0 while baking the cubemap
|
|
|
|
|
sceneSrg->SetConstant(m_iblExposureConstantIndex, 0.0f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// track if we need to update culling based on changes to the draw packets or Srg
|
|
|
|
|
@ -283,6 +296,10 @@ namespace AZ
|
|
|
|
|
const RPI::Ptr<RPI::ParentPass>& rootPass = environmentCubeMapPipeline->GetRootPass();
|
|
|
|
|
rootPass->AddChild(m_environmentCubeMapPass);
|
|
|
|
|
|
|
|
|
|
// store the current IBL exposure value
|
|
|
|
|
Data::Instance<RPI::ShaderResourceGroup> sceneSrg = m_scene->GetShaderResourceGroup();
|
|
|
|
|
m_previousExposure = sceneSrg->GetConstant<float>(m_iblExposureConstantIndex);
|
|
|
|
|
|
|
|
|
|
m_scene->AddRenderPipeline(environmentCubeMapPipeline);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|