Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/editderivedmesh.c')
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c25
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 */