[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17523] branches/nurbs/blender/intern/ nurbana/intern/NURBS_Generate.cpp: Fix for broken shading at the 'seams' of cyclic surfaces.

Emmanuel Stone emmanuel.stone at gmail.com
Thu Nov 20 23:58:27 CET 2008


Revision: 17523
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17523
Author:   eman
Date:     2008-11-20 23:58:27 +0100 (Thu, 20 Nov 2008)

Log Message:
-----------
Fix for broken shading at the 'seams' of cyclic surfaces.
Kindly provided by Laurynas Duburas, thank you.

Vertices at the seams were coincident, forming a zero area tesselation triangle. Laurynas added an extra tesselation row for cyclical surfaces preventing this.

Modified Paths:
--------------
    branches/nurbs/blender/intern/nurbana/intern/NURBS_Generate.cpp

Modified: branches/nurbs/blender/intern/nurbana/intern/NURBS_Generate.cpp
===================================================================
--- branches/nurbs/blender/intern/nurbana/intern/NURBS_Generate.cpp	2008-11-20 22:23:01 UTC (rev 17522)
+++ branches/nurbs/blender/intern/nurbana/intern/NURBS_Generate.cpp	2008-11-20 22:58:27 UTC (rev 17523)
@@ -81,7 +81,8 @@
 
 		nbReal endU = (obj -> KnotVector(0)[Unpts + extraPntsU]);
 		nbReal startU = (obj -> KnotVector(0)[(OrderU-1)]);
-		nbReal stepU = (endU - startU)/TessU;
+		int extra = CyclicU ? 1 : 0;
+		nbReal stepU = (endU - startU)/(TessU + extra);
 		nbReal t = startU;
 
 		for(i = 0; i <= TessU; i++) { 
@@ -95,7 +96,8 @@
 			else{
 			endV = (obj -> KnotVector(1)[Vnpts + extraPntsV]);
 			startV = (obj -> KnotVector(1)[(OrderV-1)]);
-			stepV= (endV - startV)/TessV;
+			extra = CyclicV ? 1 : 0;
+			stepV= (endV - startV)/(TessV + extra);
 			tv = startV;
 		}
 		for(i = 0; i <= TessV; i++) { 
@@ -105,7 +107,8 @@
 	} else {
 		nbReal endU = (obj -> KnotVector(0)[Unpts + extraPntsU]);
 		nbReal startU = (obj -> KnotVector(0)[(OrderU-1)]);
-		nbReal stepU = (endU - startU)/TessU;
+		int extra = CyclicU ? 1 : 0;
+		nbReal stepU = (endU - startU)/(TessU + extra);
 		nbReal t = startU;
 
 		for(i = 0; i <= TessU; i++) { 
@@ -115,7 +118,8 @@
 
 		nbReal endV = (obj -> KnotVector(1)[Vnpts + extraPntsV]);
 		nbReal startV = (obj -> KnotVector(1)[(OrderV-1)]);
-		nbReal stepV = (endV - startV)/TessV;
+		extra = CyclicV ? 1 : 0;
+		nbReal stepV = (endV - startV)/(TessV + extra);
 		nbReal tv = startV;
 
 		for(i = 0; i <= TessV; i++) { 





More information about the Bf-blender-cvs mailing list