Skip to content

Commit

Permalink
Ignore max light range if radius is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
colincornaby committed Dec 2, 2024
1 parent 6ae48c1 commit 7f68425
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Sources/Plasma/FeatureLib/pfMetalPipeline/plMetalPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 7f68425

Please sign in to comment.