Mesh drawing optimization and fixes:

- Pass MFace, MTface and OrigIndex arrays via userData to compareDrawParams callback
  rather than looking up for this layers for each face
- This allowed to avoid massing DM to compare callback which seems like a bad-level pass
- Fixed crashes on some video cards when assigning different materials to different
  faces in edit mode. Both of intel and nvidia cards in my laptop were affected by
  this error
This commit is contained in:
2011-12-09 11:46:48 +00:00
parent 2827f57f62
commit 9d807eb6dd
3 changed files with 33 additions and 25 deletions

View File

@@ -273,7 +273,7 @@ static void emDM_drawMappedFaces(
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditFace *efa;
int i, draw;
int i, draw, flush;
const int skip_normals= !glIsEnabled(GL_LIGHTING); /* could be passed as an arg */
/* GL_ZERO is used to detect if drawing has started or not */
@@ -352,7 +352,11 @@ static void emDM_drawMappedFaces(
}
}
if (draw==2) {
flush= (draw==2);
if (!skip_normals && !flush && efa->next)
flush|= efa->mat_nr != efa->next->mat_nr;
if (flush) {
glEnd();
poly_prev= GL_ZERO; /* force glBegin */
@@ -419,8 +423,11 @@ static void emDM_drawMappedFaces(
}
}
flush= (draw==2);
if (!skip_normals && !flush && efa->next)
flush|= efa->mat_nr != efa->next->mat_nr;
if (draw==2) {
if (flush) {
glEnd();
poly_prev= GL_ZERO; /* force glBegin */