don't crash when clipping collision vizzes

This commit is contained in:
David Rose 2006-03-14 01:20:44 +00:00
parent 1ef3a5c5c2
commit 71cbcb72d7
2 changed files with 14 additions and 5 deletions

View File

@ -136,14 +136,18 @@ apply_state(const CullTraverser *trav, const CullTraverserData *data,
CPT(CullPlanes) CullPlanes::
do_cull(int &result, CPT(RenderState) &state,
const GeometricBoundingVolume *node_gbv) const {
// We should have a ClipPlaneAttrib in the state if we've called
// this method.
CPT(ClipPlaneAttrib) orig_cpa = state->get_clip_plane();
nassertr(orig_cpa != (ClipPlaneAttrib *)NULL, this);
result =
BoundingVolume::IF_all | BoundingVolume::IF_possible | BoundingVolume::IF_some;
CPT(ClipPlaneAttrib) orig_cpa = state->get_clip_plane();
// If there are no clip planes in the state, the node is completely
// in front of all zero of the clip planes. (This can happen if
// someone directly changes the state during the traversal.)
if (orig_cpa == (ClipPlaneAttrib *)NULL) {
return new CullPlanes;
}
CPT(CullPlanes) new_planes = this;
CPT(ClipPlaneAttrib) new_cpa = orig_cpa;

View File

@ -208,6 +208,11 @@ traverse_below(CullTraverserData &data) {
if (node->is_geom_node()) {
_geom_nodes_pcollector.add_level(1);
GeomNode *geom_node = DCAST(GeomNode, node);
if (pgraph_cat.is_spam()) {
pgraph_cat.spam()
<< "Found " << *geom_node << " in state " << *data._state << "\n";
}
// Get all the Geoms, with no decalling.
int num_geoms = geom_node->get_num_geoms();