Kens feedback

This commit is contained in:
Michael Riegger
2021-04-30 11:43:32 -07:00
parent 59077f068c
commit 738883a9b0
2 changed files with 14 additions and 8 deletions
@@ -231,6 +231,8 @@ namespace AZ
void PointLightFeatureProcessor::UpdateShadow(LightHandle handle)
{
constexpr float SqrtHalf = 0.707106781187f; // sqrt(0.5);
const auto& pointLight = m_pointLightData.GetData(handle.GetIndex());
for (int i = 0; i < PointLightData::NumShadowFaces; ++i)
{
@@ -246,7 +248,7 @@ namespace AZ
desc.m_transform = m_pointShadowTransforms[i];
desc.m_transform.SetTranslation(pointLight.m_position[0], pointLight.m_position[1], pointLight.m_position[2]);
desc.m_aspectRatio = 1.0f;
desc.m_nearPlaneDistance = 0.0f;
desc.m_nearPlaneDistance = SqrtHalf * pointLight.m_bulbRadius;
const float invRadiusSquared = pointLight.m_invAttenuationRadiusSquared;
if (invRadiusSquared <= 0.f)
@@ -67,12 +67,16 @@ namespace AZ
void SphereLightDelegate::SetEnableShadow(bool enabled)
{
Base::SetEnableShadow(enabled);
GetFeatureProcessor()->SetShadowsEnabled(GetLightHandle(), enabled);
if (GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetShadowsEnabled(GetLightHandle(), enabled);
}
}
void SphereLightDelegate::SetShadowmapMaxSize(ShadowmapSize size)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetShadowmapMaxResolution(GetLightHandle(), size);
}
@@ -80,7 +84,7 @@ namespace AZ
void SphereLightDelegate::SetShadowFilterMethod(ShadowFilterMethod method)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetShadowFilterMethod(GetLightHandle(), method);
}
@@ -88,7 +92,7 @@ namespace AZ
void SphereLightDelegate::SetSofteningBoundaryWidthAngle(float widthInDegrees)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetSofteningBoundaryWidthAngle(GetLightHandle(), DegToRad(widthInDegrees));
}
@@ -96,7 +100,7 @@ namespace AZ
void SphereLightDelegate::SetPredictionSampleCount(uint32_t count)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count);
}
@@ -104,7 +108,7 @@ namespace AZ
void SphereLightDelegate::SetFilteringSampleCount(uint32_t count)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count);
}
@@ -112,7 +116,7 @@ namespace AZ
void SphereLightDelegate::SetPcfMethod(PcfMethod method)
{
if (GetShadowsEnabled())
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPcfMethod(GetLightHandle(), method);
}