Răsfoiți Sursa

Removed ColorKeywords usage from example.

Mr.doob 8 ani în urmă
părinte
comite
f886524dfc
1 a modificat fișierele cu 3 adăugiri și 8 ștergeri
  1. 3 8
      examples/webgl_camera_logarithmicdepthbuffer.html

+ 3 - 8
examples/webgl_camera_logarithmicdepthbuffer.html

@@ -180,6 +180,8 @@
 
 				var scene = new THREE.Scene();
 
+				scene.add( new THREE.AmbientLight( 0x222222 ) );
+
 				var light = new THREE.DirectionalLight(0xffffff, 1);
 				light.position.set(100,100,100);
 				scene.add(light);
@@ -193,9 +195,6 @@
 				};
 
 				var meshes = [];
-				var coloroffset = 0;
-				var colorskip = ['black', 'antiquewhite', 'bisque', 'beige', 'blanchedalmond', 'darkblue', 'darkcyan'];
-				var colorkeys = Object.keys( THREE.ColorKeywords );
 
 				var geometry = new THREE.SphereBufferGeometry(0.5, 24, 12);
 
@@ -214,11 +213,7 @@
 					// center text
 					labelgeo.translate( - labelgeo.boundingSphere.radius, 0, 0 );
 
-					// Pick a color at "random".  Exclude black, because it looks bad.
-					while ( colorskip.indexOf( colorkeys[ i + coloroffset ] ) != -1 ) {
-						coloroffset++;
-					}
-					materialargs.color = THREE.ColorKeywords[ colorkeys[ i + coloroffset ] ];
+					materialargs.color = new THREE.Color().setHSL( Math.random(), 0.5, 0.5 );
 
 					var material = new THREE.MeshPhongMaterial( materialargs );