Skip to content

Commit

Permalink
Metal max range code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
colincornaby committed Dec 3, 2024
1 parent 7f68425 commit 94016a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/Plasma/FeatureLib/pfMetalPipeline/plMetalPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2375,8 +2375,8 @@ void plMetalPipeline::IEnableLight(size_t i, plLightInfo* light)
plOmniLightInfo* omniLight = nullptr;
plSpotLightInfo* spotLight = nullptr;

const float maxRange = 32767.f;
fLights.lampSources[i].range = maxRange;
constexpr float kMaxRange = 32767.f;
fLights.lampSources[i].range = kMaxRange;

if ((dirLight = plDirectionalLightInfo::ConvertNoRef(light)) != nullptr) {
hsVector3 lightDir = dirLight->GetWorldDirection();
Expand All @@ -2386,15 +2386,15 @@ void plMetalPipeline::IEnableLight(size_t i, plLightInfo* light)
fLights.lampSources[i].constAtten = 1.0f;
fLights.lampSources[i].linAtten = 0.0f;
fLights.lampSources[i].quadAtten = 0.0f;

} else if ((omniLight = plOmniLightInfo::ConvertNoRef(light)) != nullptr) {
hsPoint3 pos = omniLight->GetWorldPosition();
fLights.lampSources[i].position = {pos.fX, pos.fY, pos.fZ, 1.0};

fLights.lampSources[i].constAtten = omniLight->GetConstantAttenuation();
fLights.lampSources[i].linAtten = omniLight->GetLinearAttenuation();
fLights.lampSources[i].quadAtten = omniLight->GetQuadraticAttenuation();

if (omniLight->GetRadius() != 0.f) {
fLights.lampSources[i].range = omniLight->GetRadius();
}
Expand Down

0 comments on commit 94016a8

Please sign in to comment.