From 2c4f49004f8ce8036bef5b471eda8d450c060083 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 23 Aug 2007 18:24:45 +0000 Subject: [PATCH] fix clip plane to set_final() node --- panda/src/pgraph/cullTraverserData.cxx | 23 +++++++++++++---------- panda/src/pgraph/geomNode.I | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/panda/src/pgraph/cullTraverserData.cxx b/panda/src/pgraph/cullTraverserData.cxx index 3bccd321a9..151dfb37d9 100644 --- a/panda/src/pgraph/cullTraverserData.cxx +++ b/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; } diff --git a/panda/src/pgraph/geomNode.I b/panda/src/pgraph/geomNode.I index 4cd7812aac..f9d80b304c 100644 --- a/panda/src/pgraph/geomNode.I +++ b/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(); }