浏览代码

simplify update

sunag 7 年之前
父节点
当前提交
c595e57e91
共有 1 个文件被更改,包括 3 次插入7 次删除
  1. 3 7
      examples/webgl_materials_nodes.html

+ 3 - 7
examples/webgl_materials_nodes.html

@@ -484,11 +484,9 @@
 
 
 					// MATERIAL
 					// MATERIAL
 					
 					
-					var useNodeMaterial = true;
-					
 					var sataturation = new THREE.FloatNode( 1 );
 					var sataturation = new THREE.FloatNode( 1 );
 					
 					
-					function updateMaterial() {
+					function updateMaterial( useNodeMaterial ) {
 					
 					
 						var oldMaterial = mtl;
 						var oldMaterial = mtl;
 					
 					
@@ -528,15 +526,13 @@
 
 
 					}
 					}
 
 
-					updateMaterial();
+					updateMaterial( true );
 					
 					
 					// GUI
 					// GUI
 					
 					
 					addGui( 'use node material', true, function ( val ) {
 					addGui( 'use node material', true, function ( val ) {
 
 
-						useNodeMaterial = !useNodeMaterial;
-					
-						updateMaterial();
+						updateMaterial( val );
 
 
 					} );
 					} );