diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-10 09:38:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-10 09:38:00 +0400 |
commit | 65f3b93f144699fa4aafa46c7e226aa1390b7239 (patch) | |
tree | 1a9599589c98d9e17631844fd011463031fe59cd /source/blender/blenkernel/intern/editderivedmesh.c | |
parent | 99d893bb89a96dd0d6cb9410b12928e7ade4b565 (diff) | |
parent | a88b29c062f32514e4414bfd4006f7b348077a42 (diff) |
svn merge ^/trunk/blender -r42521:42550
Diffstat (limited to 'source/blender/blenkernel/intern/editderivedmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/editderivedmesh.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 3297417eb8c..89bf06be07e 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -619,7 +619,10 @@ static void emDM_drawMappedFaces( { EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm; BMFace *efa; - int i, draw; + struct BMLoop *(*looptris)[3]= bmdm->tc->looptris; + const int tottri= bmdm->tc->tottri; + const int lasttri= tottri - 1; /* compare agasint this a lot */ + 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 */ @@ -639,8 +642,8 @@ static void emDM_drawMappedFaces( BM_ElemIndex_Ensure(bmdm->tc->bm, BM_VERT | BM_FACE); - for (i=0; i<bmdm->tc->tottri; i++) { - BMLoop **l = bmdm->tc->looptris[i]; + for (i=0; i < tottri; i++) { + BMLoop **l = looptris[i]; int drawSmooth; efa = l[0]->f; @@ -695,7 +698,11 @@ static void emDM_drawMappedFaces( } } - if (draw==2) { + flush= (draw==2); + if (!skip_normals && !flush && (i != lasttri)) + flush|= efa->mat_nr != looptris[i + 1][0]->f->mat_nr; /* TODO, make this neater */ + + if (flush) { glEnd(); poly_prev= GL_ZERO; /* force glBegin */ @@ -707,8 +714,8 @@ static void emDM_drawMappedFaces( else { BM_ElemIndex_Ensure(bmdm->tc->bm, BM_FACE); - for (i=0; i<bmdm->tc->tottri; i++) { - BMLoop **l = bmdm->tc->looptris[i]; + for (i=0; i < tottri; i++) { + BMLoop **l = looptris[i]; int drawSmooth; efa = l[0]->f; @@ -763,8 +770,12 @@ static void emDM_drawMappedFaces( } } + flush= (draw==2); + if (!skip_normals && !flush && (i != lasttri)) { + flush|= efa->mat_nr != looptris[i + 1][0]->f->mat_nr; /* TODO, make this neater */ + } - if (draw==2) { + if (flush) { glEnd(); poly_prev= GL_ZERO; /* force glBegin */ |