diff --git a/src/rendering/hwrenderer/dynlights/hw_shadowmap.cpp b/src/rendering/hwrenderer/dynlights/hw_shadowmap.cpp index 3bc9750f9..5f8cf0676 100644 --- a/src/rendering/hwrenderer/dynlights/hw_shadowmap.cpp +++ b/src/rendering/hwrenderer/dynlights/hw_shadowmap.cpp @@ -98,10 +98,10 @@ CUSTOM_CVAR (Bool, gl_light_shadowmap, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) } } -bool IShadowMap::ShadowTest(FDynamicLight *light, const DVector3 &pos) +bool IShadowMap::ShadowTest(const DVector3 &lpos, const DVector3 &pos) { - if (light->shadowmapped && light->GetRadius() > 0.0 && IsEnabled() && mAABBTree) - return mAABBTree->RayTest(light->Pos, pos) >= 1.0f; + if (mAABBTree) + return mAABBTree->RayTest(lpos, pos) >= 1.0f; else return true; } diff --git a/src/rendering/hwrenderer/dynlights/hw_shadowmap.h b/src/rendering/hwrenderer/dynlights/hw_shadowmap.h index bc11f99ba..a3b837e1c 100644 --- a/src/rendering/hwrenderer/dynlights/hw_shadowmap.h +++ b/src/rendering/hwrenderer/dynlights/hw_shadowmap.h @@ -19,7 +19,7 @@ public: void Reset(); // Test if a world position is in shadow relative to the specified light and returns false if it is - bool ShadowTest(FDynamicLight *light, const DVector3 &pos); + bool ShadowTest(const DVector3 &lpos, const DVector3 &pos); // Returns true if gl_light_shadowmap is enabled and supported by the hardware bool IsEnabled() const; diff --git a/src/rendering/hwrenderer/scene/hw_spritelight.cpp b/src/rendering/hwrenderer/scene/hw_spritelight.cpp index 292a970a6..abbc1a64d 100644 --- a/src/rendering/hwrenderer/scene/hw_spritelight.cpp +++ b/src/rendering/hwrenderer/scene/hw_spritelight.cpp @@ -106,7 +106,7 @@ void HWDrawInfo::GetDynSpriteLight(AActor *self, float x, float y, float z, FLig frac *= (float)smoothstep(light->pSpotOuterAngle->Cos(), light->pSpotInnerAngle->Cos(), cosDir); } - if (frac > 0 && (!light->shadowmapped || screen->mShadowMap.ShadowTest(light, { x, y, z }))) + if (frac > 0 && (!light->shadowmapped || (light->GetRadius() > 0 && screen->mShadowMap.ShadowTest(light->Pos, { x, y, z })))) { lr = light->GetRed() / 255.0f; lg = light->GetGreen() / 255.0f;