Adding ray tracing toggle to behavior context so it can be used with scripting.

Signed-off-by: windbagjacket <nibor@ntlworld.com>
This commit is contained in:
windbagjacket
2022-01-14 17:07:13 +00:00
parent 5c52df7211
commit 7474c5480e
10 changed files with 75 additions and 1 deletions
@@ -182,6 +182,8 @@ namespace AZ
->Event("GetMinimumScreenCoverage", &MeshComponentRequestBus::Events::GetMinimumScreenCoverage)
->Event("SetQualityDecayRate", &MeshComponentRequestBus::Events::SetQualityDecayRate)
->Event("GetQualityDecayRate", &MeshComponentRequestBus::Events::GetQualityDecayRate)
->Event("SetRayTracingEnabled", &MeshComponentRequestBus::Events::SetRayTracingEnabled)
->Event("GetRayTracingEnabled", &MeshComponentRequestBus::Events::GetRayTracingEnabled)
->VirtualProperty("ModelAssetId", "GetModelAssetId", "SetModelAssetId")
->VirtualProperty("ModelAssetPath", "GetModelAssetPath", "SetModelAssetPath")
->VirtualProperty("SortKey", "GetSortKey", "SetSortKey")
@@ -189,6 +191,7 @@ namespace AZ
->VirtualProperty("LodOverride", "GetLodOverride", "SetLodOverride")
->VirtualProperty("MinimumScreenCoverage", "GetMinimumScreenCoverage", "SetMinimumScreenCoverage")
->VirtualProperty("QualityDecayRate", "GetQualityDecayRate", "SetQualityDecayRate")
->VirtualProperty("RayTracingEnabled", "GetRayTracingEnabled", "SetRayTracingEnabled")
;
behaviorContext->EBus<MeshComponentNotificationBus>("MeshComponentNotificationBus")
@@ -561,6 +564,25 @@ namespace AZ
return m_isVisible;
}
void MeshComponentController::SetRayTracingEnabled(bool enabled)
{
if (m_meshHandle.IsValid() && m_meshFeatureProcessor)
{
m_meshFeatureProcessor->SetRayTracingEnabled(m_meshHandle, enabled);
m_configuration.m_isRayTracingEnabled = enabled;
}
}
bool MeshComponentController::GetRayTracingEnabled() const
{
if (m_meshHandle.IsValid() && m_meshFeatureProcessor)
{
return m_meshFeatureProcessor->GetRayTracingEnabled(m_meshHandle);
}
return false;
}
Aabb MeshComponentController::GetWorldBounds()
{
if (const AZ::Aabb localBounds = GetLocalBounds(); localBounds.IsValid())