From 70303dfefe4ccd28434eb2804985b2b78652b65b Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 12 May 2014 15:50:59 +0200 Subject: Fix T40014: Broken shading with mirror modifier and auto smooth normals while hiding verts. Stupid mistake that showed only when there was some hidden faces (lnors should always be increased... even when the face is not drawned!). --- source/blender/blenkernel/intern/cdderivedmesh.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 205282c1de7..ba8fe83155e 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -597,7 +597,6 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm, glNormal3sv((const GLshort *)lnors[0][3]); glVertex3fv(mvert[mface->v4].co); } - lnors++; } else if (shademodel == GL_FLAT) { if (nors) { @@ -635,7 +634,10 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm, } } - if (nors) nors += 3; + if (nors) + nors += 3; + if (lnors) + lnors++; } glEnd(); } @@ -799,11 +801,13 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, else if (mf->flag & ME_SMOOTH) glNormal3sv(mvert->no); glVertex3fv(mvert->co); } - if (lnors) lnors++; glEnd(); } - if (nors) nors += 3; + if (nors) + nors += 3; + if (lnors) + lnors++; } } else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */ @@ -973,7 +977,6 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, glNormal3sv((const GLshort *)lnors[0][3]); glVertex3fv(mv[mf->v4].co); } - lnors++; } else if (!drawSmooth) { if (nors) { @@ -1024,7 +1027,10 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, glDisable(GL_POLYGON_STIPPLE); } - if (nors) nors += 3; + if (nors) + nors += 3; + if (lnors) + lnors++; } } else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */ -- cgit v1.2.3