Browse Source

Fixed potential bug in handling the first light affecting a drawable.

Lasse Öörni 14 years ago
parent
commit
a827f8c1fb
1 changed files with 2 additions and 3 deletions
  1. 2 3
      Engine/Graphics/View.cpp

+ 2 - 3
Engine/Graphics/View.cpp

@@ -437,7 +437,7 @@ void View::GetBatches()
             {
             {
                 Drawable* drawable = litGeometries_[j];
                 Drawable* drawable = litGeometries_[j];
                 drawable->AddLight(light);
                 drawable->AddLight(light);
-
+                
                 // If drawable limits maximum lights, only record the light, and check maximum count / build batches later
                 // If drawable limits maximum lights, only record the light, and check maximum count / build batches later
                 if (!drawable->GetMaxLights())
                 if (!drawable->GetMaxLights())
                     GetLitBatches(drawable, lightQueue);
                     GetLitBatches(drawable, lightQueue);
@@ -545,7 +545,6 @@ void View::GetBatches()
 void View::GetLitBatches(Drawable* drawable, LightBatchQueue& lightQueue)
 void View::GetLitBatches(Drawable* drawable, LightBatchQueue& lightQueue)
 {
 {
     Light* light = lightQueue.light_;
     Light* light = lightQueue.light_;
-    Light* drawableFirstLight = drawable->GetLights()[0];
     
     
     // Shadows on transparencies can only be rendered if shadow maps are not reused
     // Shadows on transparencies can only be rendered if shadow maps are not reused
     bool allowTransparentShadows = !renderer_->reuseShadowMaps_;
     bool allowTransparentShadows = !renderer_->reuseShadowMaps_;
@@ -564,7 +563,7 @@ void View::GetLitBatches(Drawable* drawable, LightBatchQueue& lightQueue)
         bool priority = false;
         bool priority = false;
         
         
         // For the (first) directional light, check for lit base pass
         // For the (first) directional light, check for lit base pass
-        if (light == drawableFirstLight && light->GetLightType() == LIGHT_DIRECTIONAL)
+        if (light == lights_[0] && light->GetLightType() == LIGHT_DIRECTIONAL)
         {
         {
             if (!drawable->HasBasePass(i))
             if (!drawable->HasBasePass(i))
             {
             {