Ver código fonte

If drawable does not limit number of per-pixel lights, no need to store them per drawable (skips allocation of dynamic memory for the light list.)

Lasse Öörni 11 anos atrás
pai
commit
406b71d4c9
1 arquivos alterados com 7 adições e 3 exclusões
  1. 7 3
      Source/Urho3D/Graphics/Drawable.h

+ 7 - 3
Source/Urho3D/Graphics/Drawable.h

@@ -248,9 +248,13 @@ public:
     // Add a per-pixel light affecting the object this frame.
     // Add a per-pixel light affecting the object this frame.
     void AddLight(Light* light)
     void AddLight(Light* light)
     {
     {
-        if (lights_.Empty())
+        if (!firstLight_)
             firstLight_ = light;
             firstLight_ = light;
-        lights_.Push(light);
+
+        // Need to store into the light list only if the per-pixel lights are being limited.
+        // Otherwise recording the first light is enough
+        if (maxLights_)
+            lights_.Push(light);
     }
     }
 
 
     // Add a per-vertex light affecting the object this frame.
     // Add a per-vertex light affecting the object this frame.
@@ -321,7 +325,7 @@ protected:
     float lodBias_;
     float lodBias_;
     /// Base pass flags.
     /// Base pass flags.
     unsigned basePassFlags_;
     unsigned basePassFlags_;
-    /// Maximum lights.
+    /// Maximum per-pixel lights.
     unsigned maxLights_;
     unsigned maxLights_;
     /// Octree octant.
     /// Octree octant.
     Octant* octant_;
     Octant* octant_;