From a2d2a372202590f736de47e533fc013cb4c1e9db Mon Sep 17 00:00:00 2001 From: Michael Riegger Date: Tue, 4 May 2021 10:38:21 -0700 Subject: [PATCH] Better commenting and readability fixes --- .../CoreLights/PointLightFeatureProcessorInterface.h | 11 +++++++---- .../Source/CoreLights/PointLightFeatureProcessor.cpp | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/PointLightFeatureProcessorInterface.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/PointLightFeatureProcessorInterface.h index aaffac6d5a..30d88cb839 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/PointLightFeatureProcessorInterface.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/PointLightFeatureProcessorInterface.h @@ -26,13 +26,16 @@ namespace AZ struct PointLightData { AZStd::array m_position = {{0.0f, 0.0f, 0.0f}}; - float m_invAttenuationRadiusSquared = - 0.0f; // Inverse of the distance at which this light no longer has an effect, squared. Also used for falloff calculations. + + // Inverse of the distance at which this light no longer has an effect, squared. Also used for falloff calculations. + float m_invAttenuationRadiusSquared = 0.0f; + AZStd::array m_rgbIntensity = {{0.0f, 0.0f, 0.0f}}; - float m_bulbRadius = 0.0f; // Radius of spherical light in meters. - static const int NumShadowFaces = 6; + // Radius of spherical light in meters. + float m_bulbRadius = 0.0f; + static const int NumShadowFaces = 6; AZStd::array m_shadowIndices = {{0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}}; uint32_t m_padding; }; diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/PointLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/PointLightFeatureProcessor.cpp index 82f41afbee..bb81c52b15 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/PointLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/PointLightFeatureProcessor.cpp @@ -201,7 +201,7 @@ namespace AZ for (int i = 0; i < PointLightData::NumShadowFaces; ++i) { ShadowId shadowId = ShadowId(light.m_shadowIndices[i]); - if (shadowId.IsValid() && enabled == false) + if (shadowId.IsValid() && !enabled) { // Disable shadows m_shadowFeatureProcessor->ReleaseShadow(shadowId); @@ -209,7 +209,7 @@ namespace AZ light.m_shadowIndices[i] = shadowId.GetIndex(); m_deviceBufferNeedsUpdate = true; } - else if (shadowId.IsNull() && enabled == true) + else if (shadowId.IsNull() && enabled) { // Enable shadows light.m_shadowIndices[i] = m_shadowFeatureProcessor->AcquireShadow().GetIndex(); @@ -244,7 +244,8 @@ namespace AZ } ProjectedShadowFeatureProcessorInterface::ProjectedShadowDescriptor desc = m_shadowFeatureProcessor->GetShadowProperties(shadowId); - desc.m_fieldOfViewYRadians = DegToRad(91.0f); // Make it slightly larger than 90 degrees to avoid artifacts on the boundary between 2 cubemap faces + // Make it slightly larger than 90 degrees to avoid artifacts on the boundary between 2 cubemap faces + desc.m_fieldOfViewYRadians = DegToRad(91.0f); 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;