mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
optimize verify-lods better
This commit is contained in:
parent
169a946914
commit
928770b37b
@ -491,4 +491,5 @@ clear_ring_viz() {
|
||||
_ring_viz.clear();
|
||||
_spindle_viz.clear();
|
||||
_viz_model_state.clear();
|
||||
_bounds_seq = UpdateSeq::old();
|
||||
}
|
||||
|
@ -561,13 +561,32 @@ do_verify_child_bounds(const LODNode::CData *cdata, int index,
|
||||
suggested_radius = 0.0f;
|
||||
|
||||
if (index < get_num_children()) {
|
||||
const Switch &sw = cdata->_switch_vector[index];
|
||||
PandaNode *child = get_child(index);
|
||||
if (child != (PandaNode *)NULL) {
|
||||
CPT(BoundingVolume) bv = child->get_bounds();
|
||||
UpdateSeq seq;
|
||||
CPT(BoundingVolume) bv = child->get_bounds(seq);
|
||||
|
||||
if (seq == sw._bounds_seq) {
|
||||
// We previously verified this child, and it hasn't changed
|
||||
// since then.
|
||||
return sw._verify_ok;
|
||||
}
|
||||
|
||||
((Switch &)sw)._bounds_seq = seq;
|
||||
((Switch &)sw)._verify_ok = true;
|
||||
|
||||
if (bv->is_empty()) {
|
||||
// This child has no geometry, so no one cares anyway.
|
||||
return true;
|
||||
}
|
||||
if (bv->is_infinite()) {
|
||||
// To be strict, we ought to look closer if the child has an
|
||||
// infinite bounding volume, but in practice this is probably
|
||||
// just a special case (e.g. the child contains the camera)
|
||||
// that we don't really want to check.
|
||||
return true;
|
||||
}
|
||||
|
||||
const Switch &sw = cdata->_switch_vector[index];
|
||||
|
||||
@ -589,6 +608,7 @@ do_verify_child_bounds(const LODNode::CData *cdata, int index,
|
||||
nassertr(!gbv->is_infinite(), false);
|
||||
sphere.extend_by(gbv);
|
||||
suggested_radius = sphere.get_radius();
|
||||
((Switch &)sw)._verify_ok = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -630,6 +650,7 @@ do_verify_child_bounds(const LODNode::CData *cdata, int index,
|
||||
sphere.extend_by(gbv);
|
||||
}
|
||||
suggested_radius = sphere.get_radius();
|
||||
((Switch &)sw)._verify_ok = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -140,6 +140,10 @@ protected:
|
||||
PT(PandaNode) _ring_viz;
|
||||
PT(PandaNode) _spindle_viz;
|
||||
CPT(RenderState) _viz_model_state;
|
||||
|
||||
public:
|
||||
UpdateSeq _bounds_seq;
|
||||
bool _verify_ok;
|
||||
};
|
||||
typedef pvector<Switch> SwitchVector;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user