fix untextured triangle problem

This commit is contained in:
David Rose 2004-07-31 23:27:27 +00:00
parent bccfb40463
commit 0fbb4b671a
1 changed files with 16 additions and 12 deletions

View File

@ -356,18 +356,6 @@ make_indexed_primitive(EggPrimitive *egg_prim, PandaNode *parent,
return;
}
bucket.set_coords(_comp_verts_maker._coords);
bucket.set_normals(_comp_verts_maker._norms);
bucket.set_colors(_comp_verts_maker._colors);
ComputedVerticesMaker::TexCoords::const_iterator tci;
for (tci = _comp_verts_maker._texcoords.begin();
tci != _comp_verts_maker._texcoords.end();
++tci) {
const TexCoordName *name = (*tci).first;
bucket.set_texcoords(name, (*tci).second);
}
LMatrix4d mat;
if (transform != NULL) {
@ -487,6 +475,22 @@ make_indexed_primitive(EggPrimitive *egg_prim, PandaNode *parent,
bprim.set_color(cindex);
}
// We have to set up the arrays after we have iterated through the
// vertices, because iterating through the vertices might discover
// additional texture coordinate sets that we didn't know about
// before.
bucket.set_coords(_comp_verts_maker._coords);
bucket.set_normals(_comp_verts_maker._norms);
bucket.set_colors(_comp_verts_maker._colors);
ComputedVerticesMaker::TexCoords::const_iterator tci;
for (tci = _comp_verts_maker._texcoords.begin();
tci != _comp_verts_maker._texcoords.end();
++tci) {
const TexCoordName *name = (*tci).first;
bucket.set_texcoords(name, (*tci).second);
}
_builder.add_prim(bucket, bprim);
}