fix bug in <lines>

This commit is contained in:
David Rose 2007-04-13 23:05:06 +00:00
parent da6d5fc3b9
commit 259ce0f3e3

View File

@ -1228,29 +1228,22 @@ rebuild_vertex_pools(EggVertexPools &vertex_pools, unsigned int max_vertices,
vertices.push_back(*pi); vertices.push_back(*pi);
} }
typedef pvector<EggAttributes> Attributes;
Attributes attributes;
if (prim->is_of_type(EggCompositePrimitive::get_class_type())) { if (prim->is_of_type(EggCompositePrimitive::get_class_type())) {
// A compositive primitive has the additional complication of // A compositive primitive has the additional complication of
// dealing with its attributes. // dealing with its attributes.
typedef pvector<EggAttributes> Attributes;
Attributes attributes;
EggCompositePrimitive *cprim = DCAST(EggCompositePrimitive, prim); EggCompositePrimitive *cprim = DCAST(EggCompositePrimitive, prim);
int i; int i;
int num_components = cprim->get_num_components(); int num_components = cprim->get_num_components();
for (i = 0; i < num_components; i++) { for (i = 0; i < num_components; i++) {
attributes.push_back(*cprim->get_component(i)); attributes.push_back(*cprim->get_component(i));
} }
cprim->clear();
for (i = 0; i < num_components; i++) {
cprim->set_component(i, &attributes[i]);
}
} else {
prim->clear();
} }
prim->clear();
// Now look for a new home for the vertices. First, see if any // Now look for a new home for the vertices. First, see if any
// of the vertex pools we've already created already have a copy // of the vertex pools we've already created already have a copy
// of each one of the vertices. // of each one of the vertices.
@ -1326,6 +1319,17 @@ rebuild_vertex_pools(EggVertexPools &vertex_pools, unsigned int max_vertices,
nassertv(new_vertex != (EggVertex *)NULL); nassertv(new_vertex != (EggVertex *)NULL);
prim->add_vertex(new_vertex); prim->add_vertex(new_vertex);
} }
if (prim->is_of_type(EggCompositePrimitive::get_class_type())) {
// Now restore the composite attributes.
EggCompositePrimitive *cprim = DCAST(EggCompositePrimitive, prim);
int i;
int num_components = cprim->get_num_components();
nassertv(num_components == (int)attributes.size());
for (i = 0; i < num_components; i++) {
cprim->set_component(i, &attributes[i]);
}
}
} else if (child->is_of_type(EggGroupNode::get_class_type())) { } else if (child->is_of_type(EggGroupNode::get_class_type())) {
if (recurse) { if (recurse) {