Browse Source

When a Zone moves or is removed from octree, clear zone from all drawables within the bounding box, not just from those that belong to the zone. This allows zone search in View to perform more optimally.

Lasse Öörni 11 years ago
parent
commit
0eb0a5d7a5
2 changed files with 3 additions and 6 deletions
  1. 2 2
      Source/Engine/Graphics/View.cpp
  2. 1 4
      Source/Engine/Graphics/Zone.cpp

+ 2 - 2
Source/Engine/Graphics/View.cpp

@@ -201,8 +201,8 @@ void CheckVisibilityWork(const WorkItem* item, unsigned threadIndex)
             if (drawable->GetDrawableFlags() & DRAWABLE_GEOMETRY)
             if (drawable->GetDrawableFlags() & DRAWABLE_GEOMETRY)
             {
             {
                 Zone* drawableZone = drawable->GetZone();
                 Zone* drawableZone = drawable->GetZone();
-                if (!cameraZoneOverride && (drawable->IsZoneDirty() || !drawableZone || drawableZone->GetPriority() <
-                    view->highestZonePriority_ || (drawableZone->GetViewMask() & cameraViewMask) == 0))
+                if (!cameraZoneOverride && (drawable->IsZoneDirty() || !drawableZone || (drawableZone->GetViewMask() &
+                    cameraViewMask) == 0))
                     view->FindZone(drawable);
                     view->FindZone(drawable);
                 
                 
                 const BoundingBox& geomBox = drawable->GetWorldBoundingBox();
                 const BoundingBox& geomBox = drawable->GetWorldBoundingBox();

+ 1 - 4
Source/Engine/Graphics/Zone.cpp

@@ -325,10 +325,7 @@ void Zone::ClearDrawablesZone()
             Drawable* drawable = *i;
             Drawable* drawable = *i;
             unsigned drawableFlags = drawable->GetDrawableFlags();
             unsigned drawableFlags = drawable->GetDrawableFlags();
             if (drawableFlags & DRAWABLE_GEOMETRY)
             if (drawableFlags & DRAWABLE_GEOMETRY)
-            {
-                if (drawable->GetZone() == this)
-                    drawable->SetZone(0);
-            }
+                drawable->SetZone(0);
             else if (drawableFlags & DRAWABLE_ZONE)
             else if (drawableFlags & DRAWABLE_ZONE)
             {
             {
                 Zone* zone = static_cast<Zone*>(drawable);
                 Zone* zone = static_cast<Zone*>(drawable);