Added AZ_TRAIT_MASKED_OCCLUSION_CULLING_SUPPORTED

This commit is contained in:
Doug McDiarmid
2021-06-01 12:17:48 -07:00
parent 59ab6edaef
commit a9a42a5405
23 changed files with 291 additions and 20 deletions
+11 -2
View File
@@ -23,6 +23,11 @@
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Math/MatrixUtils.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <Atom_RPI_Traits_Platform.h>
#if AZ_TRAIT_MASKED_OCCLUSION_CULLING_SUPPORTED
#include <MaskedOcclusionCulling/MaskedOcclusionCulling.h>
#endif
namespace AZ
{
@@ -56,18 +61,21 @@ namespace AZ
{
m_shaderResourceGroup = ShaderResourceGroup::Create(viewSrgAsset);
}
#if AZ_TRAIT_MASKED_OCCLUSION_CULLING_SUPPORTED
m_maskedOcclusionCulling = MaskedOcclusionCulling::Create();
m_maskedOcclusionCulling->SetResolution(MaskedSoftwareOcclusionCullingWidth, MaskedSoftwareOcclusionCullingHeight);
#endif
}
View::~View()
{
#if AZ_TRAIT_MASKED_OCCLUSION_CULLING_SUPPORTED
if (m_maskedOcclusionCulling)
{
MaskedOcclusionCulling::Destroy(m_maskedOcclusionCulling);
m_maskedOcclusionCulling = nullptr;
}
#endif
}
void View::SetDrawListMask(const RHI::DrawListMask& drawListMask)
@@ -394,13 +402,14 @@ namespace AZ
void View::BeginCulling()
{
#if AZ_TRAIT_MASKED_OCCLUSION_CULLING_SUPPORTED
m_maskedOcclusionCulling->ClearBuffer();
#endif
}
MaskedOcclusionCulling* View::GetMaskedOcclusionCulling()
{
return m_maskedOcclusionCulling;
}
} // namespace RPI
} // namespace AZ