Bladeren bron

fix share maps

sunag 7 jaren geleden
bovenliggende
commit
4227b80ca2
1 gewijzigde bestanden met toevoegingen van 13 en 7 verwijderingen
  1. 13 7
      examples/webgl_materials_nodes.html

+ 13 - 7
examples/webgl_materials_nodes.html

@@ -409,7 +409,9 @@
 
 
 						// MATERIAL
 						// MATERIAL
 
 
-						var sataturation = new THREE.FloatNode( 1 );
+						var sataturation = new THREE.FloatNode( 1 ),
+							useMap = true,
+							useNormals = true;
 
 
 						function updateMaterial( useNodeMaterial ) {
 						function updateMaterial( useNodeMaterial ) {
 
 
@@ -421,9 +423,9 @@
 
 
 							// default syntax ( backward-compatible )
 							// default syntax ( backward-compatible )
 
 
-							mtl.map = oldMaterial ? oldMaterial.map : getTexture( "brick" );
+							mtl.map = useMap ? getTexture( "brick" ) : undefined;
 
 
-							mtl.normalMap = oldMaterial ? oldMaterial.normalMap : getTexture( "decalNormal" );
+							mtl.normalMap = useNormals ? getTexture( "decalNormal" ) : undefined;
 							mtl.normalScale = new THREE.Vector2( .5, .5 );
 							mtl.normalScale = new THREE.Vector2( .5, .5 );
 
 
 							mtl.envMap = cubemap;
 							mtl.envMap = cubemap;
@@ -491,17 +493,21 @@
 
 
 						}, false, 0, 2 );
 						}, false, 0, 2 );
 
 
-						addGui( 'colors', true, function ( val ) {
+						addGui( 'colors', useMap, function ( val ) {
+
+							useMap = val;
 
 
-							mtl.map = val ? getTexture( "brick" ) : undefined;
+							mtl.map = useMap ? getTexture( "brick" ) : undefined;
 
 
 							mtl.needsUpdate = true;
 							mtl.needsUpdate = true;
 
 
 						}, false );
 						}, false );
 
 
-						addGui( 'normals', true, function ( val ) {
+						addGui( 'normals', useNormals, function ( val ) {
+
+							useNormals = val;
 
 
-							mtl.normalMap = val ? getTexture( "decalNormal" ) : undefined;
+							mtl.normalMap = useNormals ? getTexture( "decalNormal" ) : undefined;
 
 
 							mtl.needsUpdate = true;
 							mtl.needsUpdate = true;