more assertions for recompute_bound()

This commit is contained in:
David Rose 2005-04-15 00:18:40 +00:00
parent 17c9ee24ab
commit 541bbe4403

View File

@ -1108,11 +1108,33 @@ recompute_bound() {
// of our vertices. // of our vertices.
pvector<LPoint3f> vertices; pvector<LPoint3f> vertices;
VertexIterator vi = make_vertex_iterator(); VertexIterator vi = make_vertex_iterator();
int num_vertices = _coords.size();
for (int p = 0; p < get_num_prims(); p++) {
for (int v = 0; v < get_length(p); v++) { if (_vindex.is_null()) {
vertices.push_back(get_next_vertex(vi)); // Nonindexed case.
int vcount = 0;
for (int p = 0; p < get_num_prims(); p++) {
for (int v = 0; v < get_length(p); v++) {
nassertr(vcount < num_vertices, bound);
vertices.push_back(get_next_vertex(vi));
++vcount;
}
} }
nassertr(vcount == num_vertices, bound);
} else {
// Indexed case.
int num_indices = _vindex.size();
int vindex = 0;
for (int p = 0; p < get_num_prims(); p++) {
for (int v = 0; v < get_length(p); v++) {
nassertr(vindex < num_indices, bound);
nassertr(_vindex[vindex] < num_vertices, bound);
vertices.push_back(get_next_vertex(vi));
++vindex;
}
}
nassertr(vindex == num_indices, bound);
} }
const LPoint3f *vertices_begin = &vertices[0]; const LPoint3f *vertices_begin = &vertices[0];