Browse Source

Disable debug visualization of terrain patch bounding boxes, as it slows down the editor and does not have much visual usability.

Lasse Öörni 11 years ago
parent
commit
9102936b70

+ 3 - 2
Bin/Data/Scripts/Editor/EditorView.as

@@ -1397,8 +1397,9 @@ void DrawNodeDebug(Node@ node, DebugRenderer@ debug, bool drawNode = true)
         debug.AddNode(node, 1.0, false);
 
     // Exception for the scene to avoid bringing the editor to its knees: drawing either the whole hierarchy or the subsystem-
-    // components can have a large performance hit
-    if (node !is editorScene)
+    // components can have a large performance hit. Also do not draw terrain child nodes due to their large amount
+    // (TerrainPatch component itself draws nothing as debug geometry)
+    if (node !is editorScene && node.GetComponent("Terrain") is null)
     {
         for (uint j = 0; j < node.numComponents; ++j)
             node.components[j].DrawDebugGeometry(debug, false);

+ 6 - 0
Source/Engine/Graphics/TerrainPatch.cpp

@@ -206,6 +206,12 @@ bool TerrainPatch::DrawOcclusion(OcclusionBuffer* buffer)
         minLodGeometry_->GetIndexCount());
 }
 
+void TerrainPatch::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
+{
+    // Intentionally no action
+}
+
+
 void TerrainPatch::SetOwner(Terrain* terrain)
 {
     owner_ = terrain;

+ 2 - 0
Source/Engine/Graphics/TerrainPatch.h

@@ -58,6 +58,8 @@ public:
     virtual unsigned GetNumOccluderTriangles();
     /// Draw to occlusion buffer. Return true if did not run out of triangles.
     virtual bool DrawOcclusion(OcclusionBuffer* buffer);
+    /// Visualize the component as debug geometry.
+    virtual void DrawDebugGeometry(DebugRenderer* debug, bool depthTest);
     
     /// Set owner terrain.
     void SetOwner(Terrain* terrain);