[Bf-blender-cvs] [70303df] master: Fix T40014: Broken shading with mirror modifier and auto smooth normals while hiding verts.

Bastien Montagne noreply at git.blender.org
Mon May 12 15:54:09 CEST 2014


Commit: 70303dfefe4ccd28434eb2804985b2b78652b65b
Author: Bastien Montagne
Date:   Mon May 12 15:50:59 2014 +0200
https://developer.blender.org/rB70303dfefe4ccd28434eb2804985b2b78652b65b

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!).

===================================================================

M	source/blender/blenkernel/intern/cdderivedmesh.c

===================================================================

diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 205282c..ba8fe83 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 */




More information about the Bf-blender-cvs mailing list