瀏覽代碼

Merge pull request #1 from andreasplesch/earcu

helper functions in scope
Andreas Plesch 8 年之前
父節點
當前提交
a3028f5fc6
共有 1 個文件被更改,包括 15 次插入15 次删除
  1. 15 15
      examples/webgl_geometry_text_earcut.html

+ 15 - 15
examples/webgl_geometry_text_earcut.html

@@ -47,24 +47,24 @@
 		<!-- replace built-in triangulation with Earcut -->
 		<script src="js/libs/earcut.js"></script>
 		<script>
-			
-			function removeDupEndPts(points) {
-				
-				var l = points.length;
-				if ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {
-					points.pop();
-				}
-			}
-			
-			function addContour( vertices, contour ) {
+
+			THREE.ShapeUtils.triangulateShape = function ( contour, holes ) {
 				
-				for ( var i = 0; i < contour.length; i++ ) {
-					vertices.push( contour[i].x );
-					vertices.push( contour[i].y );
+				function removeDupEndPts(points) {
+
+					var l = points.length;
+					if ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {
+						points.pop();
+					}
 				}
-			}
 
-			THREE.ShapeUtils.triangulateShape = function ( contour, holes ) {
+				function addContour( vertices, contour ) {
+
+					for ( var i = 0; i < contour.length; i++ ) {
+						vertices.push( contour[i].x );
+						vertices.push( contour[i].y );
+					}
+				}
 				
 				removeDupEndPts( contour );
 				holes.forEach( removeDupEndPts );