From 7f6842588ce135ebc063a6983f0285dda3e8d53a Mon Sep 17 00:00:00 2001 From: Colin Cornaby Date: Sun, 1 Dec 2024 21:57:30 -0800 Subject: [PATCH] Ignore max light range if radius is 0 --- .../FeatureLib/pfMetalPipeline/plMetalPipeline.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfMetalPipeline/plMetalPipeline.cpp b/Sources/Plasma/FeatureLib/pfMetalPipeline/plMetalPipeline.cpp index ba8989b160..42196da563 100644 --- a/Sources/Plasma/FeatureLib/pfMetalPipeline/plMetalPipeline.cpp +++ b/Sources/Plasma/FeatureLib/pfMetalPipeline/plMetalPipeline.cpp @@ -2376,6 +2376,7 @@ void plMetalPipeline::IEnableLight(size_t i, plLightInfo* light) plSpotLightInfo* spotLight = nullptr; const float maxRange = 32767.f; + fLights.lampSources[i].range = maxRange; if ((dirLight = plDirectionalLightInfo::ConvertNoRef(light)) != nullptr) { hsVector3 lightDir = dirLight->GetWorldDirection(); @@ -2386,19 +2387,17 @@ void plMetalPipeline::IEnableLight(size_t i, plLightInfo* light) fLights.lampSources[i].linAtten = 0.0f; fLights.lampSources[i].quadAtten = 0.0f; - fLights.lampSources[i].range = maxRange; - } else if ((omniLight = plOmniLightInfo::ConvertNoRef(light)) != nullptr) { hsPoint3 pos = omniLight->GetWorldPosition(); fLights.lampSources[i].position = {pos.fX, pos.fY, pos.fZ, 1.0}; - // TODO: Maximum Range - fLights.lampSources[i].constAtten = omniLight->GetConstantAttenuation(); fLights.lampSources[i].linAtten = omniLight->GetLinearAttenuation(); fLights.lampSources[i].quadAtten = omniLight->GetQuadraticAttenuation(); - fLights.lampSources[i].range = omniLight->GetRadius(); + if (omniLight->GetRadius() != 0.f) { + fLights.lampSources[i].range = omniLight->GetRadius(); + } if (!omniLight->GetProjection() && (spotLight = plSpotLightInfo::ConvertNoRef(omniLight)) != nullptr) { hsVector3 lightDir = spotLight->GetWorldDirection();