瀏覽代碼

Merge pull request #294 from Areloch/LocalLightShadowsPref

Adds a pref to dictate if local lights can cast shadows or not.
Brian Roberts 5 年之前
父節點
當前提交
fb7ae70676

+ 5 - 1
Engine/source/lighting/advanced/advancedLightBinManager.cpp

@@ -57,6 +57,8 @@ bool AdvancedLightBinManager::smUseLightFade = false;
 F32 AdvancedLightBinManager::smLightFadeStart = 50;
 F32 AdvancedLightBinManager::smLightFadeEnd = 75;
 
+bool AdvancedLightBinManager::smAllowLocalLightShadows = true;
+
 ImplementEnumType( ShadowFilterMode,
    "The shadow filtering modes for Advanced Lighting shadows.\n"
    "@ingroup AdvancedLighting" )
@@ -192,6 +194,8 @@ void AdvancedLightBinManager::consoleInit()
    Con::addVariable("$pref::lightFadeStart", TypeF32, &smLightFadeStart, "Distance at which light fading begins if $pref::useLightFade is on.\n");
    Con::addVariable("$pref::lightFadeEnd", TypeF32, &smLightFadeEnd, "Distance at which light fading should have fully faded if $pref::useLightFade is on.\n");
 
+   Con::addVariable("$pref::allowLocalLightShadows", TypeBool, &smAllowLocalLightShadows, "Indicates if local lights(point/spot) can cast shadows.\n");
+
 }
 
 bool AdvancedLightBinManager::setTargetSize(const Point2I &newTargetSize)
@@ -240,7 +244,7 @@ void AdvancedLightBinManager::addLight( LightInfo *light )
 
    // Get the right shadow type.
    ShadowType shadowType = ShadowType_None;
-   if (  light->getCastShadows() &&  
+   if (  light->getCastShadows() && smAllowLocalLightShadows && 
          lsm && lsm->hasShadowTex() &&
          !ShadowMapPass::smDisableShadows )
       shadowType = lsm->getShadowType();

+ 2 - 0
Engine/source/lighting/advanced/advancedLightBinManager.h

@@ -113,6 +113,8 @@ public:
    static F32 smLightFadeEnd;
    static F32 smLightFadeStart;
 
+   static bool smAllowLocalLightShadows;
+
    // Used for console init
    AdvancedLightBinManager( AdvancedLightManager *lm = NULL, 
                             ShadowMapManager *sm = NULL,