Browse Source

Add color option to gui

WestLangley 6 năm trước cách đây
mục cha
commit
8fce3031cf
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      examples/webgl_materials_matcap.html

+ 9 - 0
examples/webgl_materials_matcap.html

@@ -54,6 +54,7 @@
 			var image;
 
 			var API = {
+				color : 0xffffff,
 				exposure : 1.0
 			}
 
@@ -106,6 +107,7 @@
 
 					mesh.material = new THREE.MeshMatcapMaterial( {
 
+						color: API.color,
 						matcap: matcap
 
 					} );
@@ -117,6 +119,10 @@
 				// gui
 				var gui = new dat.GUI();
 
+				gui.addColor( API, 'color' )
+					.listen()
+					.onChange( function() { mesh.material.color.set( API.color ); render(); } );
+
 				gui.add( API, 'exposure', 0, 2 )
 					.onChange( function() { renderer.toneMappingExposure = API.exposure; render(); } )
 
@@ -173,6 +179,9 @@
 
 				matcap.needsUpdate = true;
 
+				API.color = 0xffffff;
+				mesh.material.color.set( API.color );
+
 				render();
 
 				image.src = matcap.image.src; // corner div