浏览代码

More clean up.

Mr.doob 8 年之前
父节点
当前提交
bf47cdecdf
共有 1 个文件被更改,包括 11 次插入6 次删除
  1. 11 6
      examples/webgl_clipping_intersection.html

+ 11 - 6
examples/webgl_clipping_intersection.html

@@ -92,16 +92,21 @@
 				mode = {};
 				mode.clipIntersection = true;
 				mode.clipPosition = 0;
+
 				var gui = new dat.GUI();
-				gui.add( mode, 'clipIntersection' ).onChange( function() {
-					for (var i = 0; i < balls.children.length; i++) {
-						balls.children[i].material.clipIntersection = !balls.children[i].material.clipIntersection;
-					}
-				} );
+				gui.add( mode, 'clipIntersection' ).onChange( function () {
+
+					var children = group.children;
 
-				gui.add( mode, 'clipPosition', -16, 16 ).onChange( function( value ) {
+					for ( var i = 0; i < children.length; i ++ ) {
+
+						var child = children[ i ];
+						child.material.clipIntersection = ! child.material.clipIntersection;
+
+					}
 
 				} );
+				gui.add( mode, 'clipPosition', -16, 16 );
 
 				// Controls