Merge pull request #412 from aws-lumberyard-dev/pruiksma/ATOM-15380

[ATOM-15380] Cherry picking changes from 1.0 - cfdb70978868aa5d0040d3b79994a26e9f82ca39
This commit is contained in:
Ken Pruiksma
2021-04-29 12:58:47 -05:00
committed by GitHub
3 changed files with 33 additions and 14 deletions
@@ -103,12 +103,15 @@ namespace AZ::Render
void DiskLightDelegate::SetEnableShutters(bool enabled)
{
Base::SetEnableShutters(enabled);
GetFeatureProcessor()->SetConstrainToConeLight(GetLightHandle(), true);
if (GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetConstrainToConeLight(GetLightHandle(), true);
}
}
void DiskLightDelegate::SetShutterAngles(float innerAngleDegrees, float outerAngleDegrees)
{
if (GetShuttersEnabled())
if (GetShuttersEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetConeAngles(GetLightHandle(), DegToRad(innerAngleDegrees), DegToRad(outerAngleDegrees));
}
@@ -117,12 +120,16 @@ namespace AZ::Render
void DiskLightDelegate::SetEnableShadow(bool enabled)
{
Base::SetEnableShadow(enabled);
GetFeatureProcessor()->SetShadowsEnabled(GetLightHandle(), enabled);
if (GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetShadowsEnabled(GetLightHandle(), enabled);
}
}
void DiskLightDelegate::SetShadowmapMaxSize(ShadowmapSize size)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetShadowmapMaxResolution(GetLightHandle(), size);
}
@@ -130,7 +137,7 @@ namespace AZ::Render
void DiskLightDelegate::SetShadowFilterMethod(ShadowFilterMethod method)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetShadowFilterMethod(GetLightHandle(), method);
}
@@ -138,7 +145,7 @@ namespace AZ::Render
void DiskLightDelegate::SetSofteningBoundaryWidthAngle(float widthInDegrees)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetSofteningBoundaryWidthAngle(GetLightHandle(), DegToRad(widthInDegrees));
}
@@ -146,7 +153,7 @@ namespace AZ::Render
void DiskLightDelegate::SetPredictionSampleCount(uint32_t count)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count);
}
@@ -154,7 +161,7 @@ namespace AZ::Render
void DiskLightDelegate::SetFilteringSampleCount(uint32_t count)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count);
}
@@ -162,7 +169,7 @@ namespace AZ::Render
void DiskLightDelegate::SetPcfMethod(PcfMethod method)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPcfMethod(GetLightHandle(), method);
}
@@ -23,7 +23,10 @@ namespace AZ
: LightDelegateBase<SimplePointLightFeatureProcessorInterface>(entityId, isVisible)
{
InitBase(entityId);
GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation());
if (GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation());
}
}
float SimplePointLightDelegate::CalculateAttenuationRadius(float lightThreshold) const
{
@@ -39,7 +42,10 @@ namespace AZ
void SimplePointLightDelegate::HandleShapeChanged()
{
GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation());
if (GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation());
}
}
void SimplePointLightDelegate::DrawDebugDisplay(const Transform& transform, const Color& color, AzFramework::DebugDisplayRequests& debugDisplay, bool isSelected) const
@@ -24,8 +24,11 @@ namespace AZ::Render
void SimpleSpotLightDelegate::HandleShapeChanged()
{
GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation());
GetFeatureProcessor()->SetDirection(GetLightHandle(), GetTransform().GetBasisZ());
if (GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPosition(GetLightHandle(), GetTransform().GetTranslation());
GetFeatureProcessor()->SetDirection(GetLightHandle(), GetTransform().GetBasisZ());
}
}
float SimpleSpotLightDelegate::CalculateAttenuationRadius(float lightThreshold) const
@@ -42,7 +45,10 @@ namespace AZ::Render
void SimpleSpotLightDelegate::SetShutterAngles(float innerAngleDegrees, float outerAngleDegrees)
{
GetFeatureProcessor()->SetConeAngles(GetLightHandle(), DegToRad(innerAngleDegrees), DegToRad(outerAngleDegrees));
if (GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetConeAngles(GetLightHandle(), DegToRad(innerAngleDegrees), DegToRad(outerAngleDegrees));
}
}
void SimpleSpotLightDelegate::DrawDebugDisplay(const Transform& transform, const Color& /*color*/, AzFramework::DebugDisplayRequests& debugDisplay, bool isSelected) const