Browse Source

fix clip plane to set_final() node

David Rose 18 years ago
parent
commit
2c4f49004f
2 changed files with 14 additions and 10 deletions
  1. 13 10
      panda/src/pgraph/cullTraverserData.cxx
  2. 1 0
      panda/src/pgraph/geomNode.I

+ 13 - 10
panda/src/pgraph/cullTraverserData.cxx

@@ -120,7 +120,7 @@ apply_transform_and_state(CullTraverser *trav,
 
   if (clip_plane_cull) {
     _cull_planes = _cull_planes->apply_state(trav, this, 
-                                             _state->get_clip_plane(),
+                                             node_state->get_clip_plane(),
                                              DCAST(ClipPlaneAttrib, off_clip_planes));
   }
 }
@@ -187,6 +187,18 @@ is_in_view_impl() {
         << result << dec << "\n";
       _cull_planes->write(pgraph_cat.spam(false));
     }
+
+    if (_node_reader.is_final()) {
+      // Even though the node may be partially within the clip planes,
+      // do no more culling against them below this node.
+      _cull_planes = CullPlanes::make_empty();
+      
+      if (pgraph_cat.is_spam()) {
+        pgraph_cat.spam()
+          << _node_path << " is_final, cull planes disabled, state:\n";
+        _state->write(pgraph_cat.spam(false), 2);
+      }
+    }
     
     if (result == BoundingVolume::IF_no_intersection) {
       // No intersection at all.  Cull.
@@ -197,18 +209,9 @@ is_in_view_impl() {
       // of the clip planes.  The do_cull() call should therefore have
       // removed all of the clip planes.
       nassertr(_cull_planes->is_empty(), true);
-      
-    } else {
-      // The node is partially within one or more clip planes.
-      if (_node_reader.is_final()) {
-        // Even though the node is only partially within the clip
-        // planes, stop culling against them.
-        _cull_planes = CullPlanes::make_empty();
-      }
     }
   }
 
-
   return true;
 }
 

+ 1 - 0
panda/src/pgraph/geomNode.I

@@ -78,6 +78,7 @@ modify_geom(int n) {
   CDWriter cdata(_cycler, true);
   PT(GeomList) geoms = cdata->modify_geoms();
   nassertr(n >= 0 && n < (int)geoms->size(), NULL);
+  mark_internal_bounds_stale();
   return (*geoms)[n]._geom.get_write_pointer();
 }