浏览代码

Replaced remaining setHSV to setHSL.

Mr.doob 12 年之前
父节点
当前提交
48cf5bb9a6

+ 5 - 5
examples/webgl_geometry_normals.html

@@ -170,7 +170,7 @@
 				if ( window.group !== undefined ) {
 
 					scene.remove( group );
-	
+
 				}
 
 
@@ -181,20 +181,20 @@
 
 				// scale geometry to a uniform size
 				geometry.computeBoundingSphere();
-				
+
 				var scaleFactor = 160 / geometry.boundingSphere.radius;
 				geometry.applyMatrix( new THREE.Matrix4().makeScale( scaleFactor, scaleFactor, scaleFactor ) );
 
 				var originalGeometry = geometry.clone();
 				originalGeometry.computeFaceNormals();
 				originalGeometry.computeVertexNormals( true );
-			
+
 				// in case of duplicated vertices
 				geometry.mergeVertices();
 				geometry.computeCentroids();
 				geometry.computeFaceNormals();
 				geometry.computeVertexNormals( true );
-			
+
 				updateInfo();
 
 				var faceABCD = "abcd";
@@ -214,7 +214,7 @@
 						p = geometry.vertices[ vertexIndex ];
 
 						color = new THREE.Color( 0xffffff );
-						color.setHSV( ( p.y ) / 400 + 0.5, 1.0, 1.0 );
+						color.setHSL( ( p.y ) / 400 + 0.5, 1.0, 0.5 );
 
 						f.vertexColors[ j ] = color;
 

+ 1 - 1
examples/webgl_geometry_subdivision.html

@@ -243,7 +243,7 @@
 						p = smooth.vertices[ vertexIndex ];
 
 						color = new THREE.Color( 0xffffff );
-						color.setHSV( ( p.y ) / 200 + 0.5, 1.0, 1.0 );
+						color.setHSL( ( p.y ) / 200 + 0.5, 1.0, 0.5 );
 
 						f.vertexColors[ j ] = color;
 

+ 9 - 9
examples/webgl_geometry_tessellation.html

@@ -179,10 +179,9 @@
 			var colors = attributes.customColor.value;
 			var displacement = attributes.displacement.value;
 
-			var h, d, x, y, z;
 			var nv, v = 0;
 
-			for( var f = 0; f < geometry.faces.length; f ++ ) {
+			for ( var f = 0; f < geometry.faces.length; f ++ ) {
 
 				var face = geometry.faces[ f ];
 
@@ -196,21 +195,22 @@
 
 				}
 
-				h = 0.15 * Math.random();
-				s = 0.7 * Math.random();
+				var h = 0.15 * Math.random();
+				var s = 0.5 + 0.5 * Math.random();
+				var l = 0.5 + 0.5 * Math.random();
 
-				d = 10 * ( 0.5 - Math.random() );
+				var d = 10 * ( 0.5 - Math.random() );
 
-				x = 2 * ( 0.5 - Math.random() );
-				y = 2 * ( 0.5 - Math.random() );
-				z = 2 * ( 0.5 - Math.random() );
+				var x = 2 * ( 0.5 - Math.random() );
+				var y = 2 * ( 0.5 - Math.random() );
+				var z = 2 * ( 0.5 - Math.random() );
 
 				for ( var i = 0; i < nv; i ++ ) {
 
 					colors[ v ] = new THREE.Color();
 					displacement[ v ] = new THREE.Vector3();
 
-					colors[ v ].setHSV( h, s, 1 );
+					colors[ v ].setHSL( h, s, l );
 					colors[ v ].convertGammaToLinear();
 
 					displacement[ v ].set( x, y, z );

+ 2 - 2
examples/webgl_geometry_text.html

@@ -217,7 +217,7 @@
 
 				} else {
 
-					pointLight.color.setHSV( Math.random(), 0.95, 0.85 );
+					pointLight.color.setHSL( Math.random(), 1, 0.5 );
 					hex = decimalToHex( pointLight.color.getHex() );
 
 				}
@@ -265,7 +265,7 @@
 
 				document.getElementById( "color" ).addEventListener( 'click', function() {
 
-					pointLight.color.setHSV( Math.random(), 0.95, 0.85 );
+					pointLight.color.setHSL( Math.random(), 1, 0.5 );
 					hex = decimalToHex( pointLight.color.getHex() );
 
 					updatePermalink();

+ 1 - 2
examples/webgl_interactive_voxelpainter.html

@@ -74,8 +74,7 @@
 				// cubes
 
 				cubeGeo = new THREE.CubeGeometry( 50, 50, 50 );
-				cubeMaterial = new THREE.MeshLambertMaterial( { color: 0x00ff80, ambient: 0x00ff80, shading: THREE.FlatShading, map: THREE.ImageUtils.loadTexture( "textures/square-outline-textured.png" ) } );
-				cubeMaterial.color.setHSV( 0.1, 0.7, 1.0 );
+				cubeMaterial = new THREE.MeshLambertMaterial( { color: 0xfeb74c, ambient: 0x00ff80, shading: THREE.FlatShading, map: THREE.ImageUtils.loadTexture( "textures/square-outline-textured.png" ) } );
 				cubeMaterial.ambient = cubeMaterial.color;
 
 				// picking

+ 9 - 9
examples/webgl_lensflares.html

@@ -86,7 +86,7 @@
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0x000000, 3500, 15000 );
-				scene.fog.color.setHSV( 0.51, 0.6, 0.025 );
+				scene.fog.color.setHSL( 0.51, 0.4, 0.01 );
 
 				// world
 
@@ -119,7 +119,7 @@
 				// lights
 
 				var ambient = new THREE.AmbientLight( 0xffffff );
-				ambient.color.setHSV( 0.1, 0.5, 0.3 );
+				ambient.color.setHSL( 0.1, 0.3, 0.2 );
 				scene.add( ambient );
 
 
@@ -127,7 +127,7 @@
 				dirLight.position.set( 0, -1, 0 ).normalize();
 				scene.add( dirLight );
 
-				dirLight.color.setHSV( 0.1, 0.725, 0.9 );
+				dirLight.color.setHSL( 0.1, 0.7, 0.5 );
 
 				// lens flares
 
@@ -135,19 +135,19 @@
 				var textureFlare2 = THREE.ImageUtils.loadTexture( "textures/lensflare/lensflare2.png" );
 				var textureFlare3 = THREE.ImageUtils.loadTexture( "textures/lensflare/lensflare3.png" );
 
-				addLight( 0.55, 0.825, 0.99, 5000, 0, -1000 );
-				addLight( 0.08, 0.825, 0.99,    0, 0, -1000 );
-				addLight( 0.995, 0.025, 0.99, 5000, 5000, -1000 );
+				addLight( 0.55, 0.9, 0.5, 5000, 0, -1000 );
+				addLight( 0.08, 0.8, 0.5,    0, 0, -1000 );
+				addLight( 0.995, 0.5, 0.9, 5000, 5000, -1000 );
 
-				function addLight( h, s, v, x, y, z ) {
+				function addLight( h, s, l, x, y, z ) {
 
 					var light = new THREE.PointLight( 0xffffff, 1.5, 4500 );
-					light.color.setHSV( h, s, v );
+					light.color.setHSL( h, s, l );
 					light.position.set( x, y, z );
 					scene.add( light );
 
 					var flareColor = new THREE.Color( 0xffffff );
-					flareColor.setHSV( h, s - 0.5, v + 0.5 );
+					flareColor.setHSL( h, s, l + 0.5 );
 
 					var lensFlare = new THREE.LensFlare( textureFlare0, 700, 0.0, THREE.AdditiveBlending, flareColor );
 

+ 1 - 2
examples/webgl_lights_pointlights2.html

@@ -78,8 +78,7 @@
 				// SCENE
 
 				scene = new THREE.Scene();
-				scene.fog = new THREE.Fog( 0x030303, 10, FAR );
-				scene.fog.color.setHSV( 0.75, 0.5, 0.025 );
+				scene.fog = new THREE.Fog( 0x040306, 10, FAR );
 
 				// CONTROLS
 

+ 3 - 3
examples/webgl_lines_colors.html

@@ -104,13 +104,13 @@
 					geometry.vertices.push( points[ i ] );
 
 					colors[ i ] = new THREE.Color( 0xffffff );
-					colors[ i ].setHSV( 0.6, ( 200 + points[ i ].x ) / 400, 1.0 );
+					colors[ i ].setHSL( 0.6, 1.0, Math.max( 0, ( 200 - points[ i ].x ) / 400 ) * 0.5 + 0.5 );
 
 					colors2[ i ] = new THREE.Color( 0xffffff );
-					colors2[ i ].setHSV( 0.3, 1.0, ( 200 + points[ i ].x ) / 400 );
+					colors2[ i ].setHSL( 0.3, 1.0, Math.max( 0, ( 200 + points[ i ].x ) / 400 ) * 0.5 );
 
 					colors3[ i ] = new THREE.Color( 0xffffff );
-					colors3[ i ].setHSV( i / points.length, 1.0, 1.0 );
+					colors3[ i ].setHSL( i / points.length, 1.0, 0.5 );
 
 				}
 

+ 3 - 4
examples/webgl_lines_splines.html

@@ -100,14 +100,13 @@
 					geometry.vertices[ i ] = new THREE.Vector3( position.x, position.y, position.z );
 
 					colors[ i ] = new THREE.Color( 0xffffff );
-					colors[ i ].setHSV( 0.6, ( 200 + position.x ) / 400, 1.0 );
+					colors[ i ].setHSL( 0.6, 1.0, Math.max( 0, - position.x / 200 ) + 0.5 );
 
 					colors2[ i ] = new THREE.Color( 0xffffff );
-					//colors2[ i ].setHSV( 0.1, 1.0, ( 200 + position.x ) / 400 );
-					colors2[ i ].setHSV( 0.9, ( 200 + position.y ) / 400, 1.0 );
+					colors2[ i ].setHSL( 0.9, 1.0, Math.max( 0, - position.y / 200 ) + 0.5 );
 
 					colors3[ i ] = new THREE.Color( 0xffffff );
-					colors3[ i ].setHSV( i / ( points.length * n_sub ), 1.0, 1.0 );
+					colors3[ i ].setHSL( i / ( points.length * n_sub ), 1.0, 0.5 );
 
 
 				}

+ 1 - 3
examples/webgl_loader_stl.html

@@ -71,9 +71,7 @@
 				cameraTarget = new THREE.Vector3( 0, -0.25, 0 );
 
 				scene = new THREE.Scene();
-
-				scene.fog = new THREE.Fog( 0xffffff, 2, 15 );
-				scene.fog.color.setHSV( 0.06, 0.2, 0.45 );
+				scene.fog = new THREE.Fog( 0x72645b, 2, 15 );
 
 
 				// Ground

+ 2 - 2
examples/webgl_materials.html

@@ -238,8 +238,8 @@
 
 				}
 
-				materials[ materials.length - 3 ].emissive.setHSV( 0.54, 1, 0.7 * ( 0.5 + 0.5 * Math.sin( 35 * timer ) ) );
-				materials[ materials.length - 4 ].emissive.setHSV( 0.04, 1, 0.7 * ( 0.5 + 0.5 * Math.cos( 35 * timer ) ) );
+				materials[ materials.length - 3 ].emissive.setHSL( 0.54, 1, 0.35 * ( 0.5 + 0.5 * Math.sin( 35 * timer ) ) );
+				materials[ materials.length - 4 ].emissive.setHSL( 0.04, 1, 0.35 * ( 0.5 + 0.5 * Math.cos( 35 * timer ) ) );
 
 				particleLight.position.x = Math.sin( timer * 7 ) * 300;
 				particleLight.position.y = Math.cos( timer * 5 ) * 400;

+ 2 - 2
examples/webgl_materials_bumpmap_skin.html

@@ -142,7 +142,7 @@
 
 				directionalLight = new THREE.DirectionalLight( 0xffffff, 0.85 );
 				directionalLight.position.set( 1, -0.5, 1 );
-				directionalLight.color.setHSV( 0.6, 0.3, 1 );
+				directionalLight.color.setHSL( 0.6, 1, 0.85 );
 				scene.add( directionalLight );
 
 				directionalLight.position.multiplyScalar( 500 );
@@ -184,7 +184,7 @@
 				container.appendChild( renderer.domElement );
 
 				var color = new THREE.Color();
-				color.setHSV( 0.6, 0.15, 0.35 );
+				color.setHSL( 0.6, 0.1, 0.3 );
 				renderer.setClearColor( color, 1 );
 
 				renderer.shadowMapEnabled = true;

+ 13 - 34
examples/webgl_materials_cubemap_dynamic.html

@@ -161,7 +161,7 @@
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0xffffff, 3000, 10000 );
-				scene.fog.color.setHSV( 0.51, 0.5, 0.9 );
+				scene.fog.color.setHSL( 0.51, 0.6, 0.6 );
 
 				createScene();
 
@@ -228,7 +228,7 @@
 					body: [],
 
 					"Chrome": new THREE.MeshLambertMaterial( { color: 0xffffff, ambient: 0xffffff, envMap: cubeTarget  } ),
-					"ChromeN": new THREE.MeshLambertMaterial( { color: 0xffffff, ambient: 0xffffff, envMap: cubeTarget, combine: THREE.MixOperation, reflectivity: 0.75  } ),
+
 					"Dark chrome": new THREE.MeshLambertMaterial( { color: 0x444444, ambient: 0x444444, envMap: cubeTarget } ),
 
 					"Black rough": new THREE.MeshLambertMaterial( { color: 0x050505, ambient: 0x050505 } ),
@@ -522,7 +522,7 @@
 				texture.repeat.set( 50, 50 );
 
 				groundBasic = new THREE.MeshBasicMaterial( { color: 0xffffff, map: texture } );
-				groundBasic.color.setHSV( 0.1, 0.45, 0.995 );
+				groundBasic.color.setHSL( 0.1, 0.9, 0.7 );
 
 				ground = new THREE.Mesh( new THREE.PlaneGeometry( 50000, 50000 ), groundBasic );
 				ground.position.y = - 215;
@@ -907,7 +907,7 @@
 				// day / night
 
 				v = THREE.Math.clamp( v + 0.5 * delta * vdir, 0.1, 0.9 );
-				scene.fog.color.setHSV( 0.51, 0.5, v );
+				scene.fog.color.setHSL( 0.51, 0.5, v * 0.75 );
 
 				renderer.setClearColor( scene.fog.color, 1 );
 
@@ -923,46 +923,25 @@
 
 				}
 
-				if ( vnorm < 0.4 ) {
-
-					if ( veyron.loaded ) {
-
-						veyron.bodyMaterials[ 1 ] = mlib[ "ChromeN" ];
-						veyron.bodyMaterials[ 2 ] = mlib[ "ChromeN" ];
+				if ( veyron.loaded ) {
 
-						veyron.wheelMaterials[ 0 ] = mlib[ "ChromeN" ];
-
-					}
+					veyron.bodyMaterials[ 1 ] = mlib[ "Chrome" ];
+					veyron.bodyMaterials[ 2 ] = mlib[ "Chrome" ];
 
-					if ( gallardo.loaded ) {
+					veyron.wheelMaterials[ 0 ] = mlib[ "Chrome" ];
 
-						gallardo.wheelMaterials[ 0 ] = mlib[ "ChromeN" ];
-
-					}
-
-				} else {
-
-					if ( veyron.loaded ) {
-
-						veyron.bodyMaterials[ 1 ] = mlib[ "Chrome" ];
-						veyron.bodyMaterials[ 2 ] = mlib[ "Chrome" ];
-
-						veyron.wheelMaterials[ 0 ] = mlib[ "Chrome" ];
-
-					}
-
-					if ( gallardo.loaded ) {
+				}
 
-						gallardo.wheelMaterials[ 0 ] = mlib[ "Chrome" ];
+				if ( gallardo.loaded ) {
 
-					}
+					gallardo.wheelMaterials[ 0 ] = mlib[ "Chrome" ];
 
 				}
 
 				effectBloom.copyUniforms[ "opacity" ].value = THREE.Math.mapLinear( vnorm, 0, 1, 1, 0.75 );
 
-				ambientLight.color.setHSV( 0, 0, THREE.Math.mapLinear( vnorm, 0, 1, 0.07, 0.33 ) );
-				groundBasic.color.setHSV( 0.1, 0.45, THREE.Math.mapLinear( vnorm, 0, 1, 0.725, 0.995 ) );
+				ambientLight.color.setHSL( 0, 0, THREE.Math.mapLinear( vnorm, 0, 1, 0.1, 0.3 ) );
+				groundBasic.color.setHSL( 0.1, 0.5, THREE.Math.mapLinear( vnorm, 0, 1, 0.4, 0.65 ) );
 
 				// blur
 

+ 3 - 4
examples/webgl_materials_lightmap.html

@@ -92,8 +92,7 @@
 				// SCENE
 
 				scene = new THREE.Scene();
-				scene.fog = new THREE.Fog( 0xfafafa, 1000, 10000 );
-				scene.fog.color.setHSV( 0.6, 0.125, 1 );
+				scene.fog = new THREE.Fog( 0xffffff, 1000, 10000 );
 
 				// CONTROLS
 
@@ -108,8 +107,8 @@
 
 
 				var hemiLight = new THREE.HemisphereLight( 0xffffff, 0xffffff, 1.25 );
-				hemiLight.color.setHSV( 0.6, 0.45, 1 );
-				hemiLight.groundColor.setHSV( 0.1, 0.45, 0.95 );
+				hemiLight.color.setHSL( 0.6, 1, 0.75 );
+				hemiLight.groundColor.setHSL( 0.1, 0.8, 0.7 );
 				hemiLight.position.y = 500;
 				scene.add( hemiLight );
 

+ 1 - 2
examples/webgl_materials_texture_anisotropy.html

@@ -93,8 +93,7 @@
 				scene1 = new THREE.Scene();
 				scene2 = new THREE.Scene();
 
-				scene1.fog = new THREE.Fog( 0xffffff, 1, 25000 );
-				scene1.fog.color.setHSV( 0.6, 0.05, 1 );
+				scene1.fog = new THREE.Fog( 0xf2f7ff, 1, 25000 );
 				scene2.fog = scene1.fog;
 
 				scene1.add( new THREE.AmbientLight( 0xeef0ff ) );

+ 2 - 2
examples/webgl_materials_video.html

@@ -146,7 +146,7 @@
 					material.hue = i/xgrid;
 					material.saturation = 1 - j/ygrid;
 
-					material.color.setHSV( material.hue, material.saturation, 1 );
+					material.color.setHSL( material.hue, material.saturation, 0.5 );
 
 					mesh = new THREE.Mesh( geometry, material );
 
@@ -263,7 +263,7 @@
 					material = materials[ i ];
 
 					h = ( 360 * ( material.hue + time ) % 360 ) / 360;
-					material.color.setHSV( h, material.saturation, 1 );
+					material.color.setHSL( h, material.saturation, 0.5 );
 
 				}
 

+ 2 - 2
examples/webgl_particles_billboards.html

@@ -82,7 +82,7 @@
 				}
 
 				material = new THREE.ParticleBasicMaterial( { size: 35, sizeAttenuation: false, map: sprite, transparent: true } );
-				material.color.setHSV( 1.0, 0.2, 0.8 );
+				material.color.setHSL( 1.0, 0.3, 0.7 );
 
 				particles = new THREE.ParticleSystem( geometry, material );
 				particles.sortParticles = true;
@@ -178,7 +178,7 @@
 				camera.lookAt( scene.position );
 
 				h = ( 360 * ( 1.0 + time ) % 360 ) / 360;
-				material.color.setHSV( h, 0.75, 0.8 );
+				material.color.setHSL( h, 0.5, 0.5 );
 
 				renderer.render( scene, camera );
 

+ 3 - 3
examples/webgl_particles_billboards_colors.html

@@ -80,14 +80,14 @@
 					geometry.vertices.push( vertex );
 
 					colors[ i ] = new THREE.Color( 0xffffff );
-					colors[ i ].setHSV( ( vertex.x + 1000 ) / 2000, 1, 1 );
+					colors[ i ].setHSL( ( vertex.x + 1000 ) / 2000, 1, 0.5 );
 
 				}
 
 				geometry.colors = colors;
 
 				material = new THREE.ParticleBasicMaterial( { size: 85, map: sprite, vertexColors: true, transparent: true } );
-				material.color.setHSV( 1.0, 0.2, 0.8 );
+				material.color.setHSL( 1.0, 0.2, 0.7 );
 
 				particles = new THREE.ParticleSystem( geometry, material );
 				particles.sortParticles = true;
@@ -184,7 +184,7 @@
 				camera.lookAt( scene.position );
 
 				h = ( 360 * ( 1.0 + time ) % 360 ) / 360;
-				material.color.setHSV( h, 0.8, 1.0 );
+				material.color.setHSL( h, 1.0, 0.6 );
 
 				renderer.render( scene, camera );
 

+ 9 - 8
examples/webgl_particles_random.html

@@ -79,19 +79,20 @@
 
 				}
 
-				parameters = [ [ [1.0, 1.0, 1.0], 5 ], [ [0.95, 1, 1], 4 ], [ [0.90, 1, 1], 3 ], [ [0.85, 1, 1], 2 ], [ [0.80, 1, 1], 1 ] ];
-				//parameters = [ [ 0xff0000, 5 ], [ 0xff3300, 4 ], [ 0xff6600, 3 ], [ 0xff9900, 2 ], [ 0xffaa00, 1 ] ];
-				//parameters = [ [ 0xffffff, 5 ], [ 0xdddddd, 4 ], [ 0xaaaaaa, 3 ], [ 0x999999, 2 ], [ 0x777777, 1 ] ];
+				parameters = [
+					[ [1, 1, 0.5], 5 ],
+					[ [0.95, 1, 0.5], 4 ],
+					[ [0.90, 1, 0.5], 3 ],
+					[ [0.85, 1, 0.5], 2 ],
+					[ [0.80, 1, 0.5], 1 ]
+				];
 
 				for ( i = 0; i < parameters.length; i ++ ) {
 
-					size  = parameters[i][1];
 					color = parameters[i][0];
-
-					//materials[i] = new THREE.ParticleBasicMaterial( { color: color, size: size } );
+					size  = parameters[i][1];
 
 					materials[i] = new THREE.ParticleBasicMaterial( { size: size } );
-					materials[i].color.setHSV( color[0], color[1], color[2] );
 
 					particles = new THREE.ParticleSystem( geometry, materials[i] );
 
@@ -204,7 +205,7 @@
 					color = parameters[i][0];
 
 					h = ( 360 * ( color[0] + time ) % 360 ) / 360;
-					materials[i].color.setHSV( h, color[1], color[2] );
+					materials[i].color.setHSL( h, color[1], color[2] );
 
 				}
 

+ 2 - 4
examples/webgl_terrain_dynamic.html

@@ -316,7 +316,6 @@
 
 				scene = new THREE.Scene();
 				scene.fog = new THREE.Fog( 0x050505, 2000, 4000 );
-				scene.fog.color.setHSV( 0.102, 0.9, 0.825 );
 
 				// LIGHTS
 
@@ -696,14 +695,13 @@
 
 					var time = Date.now() * 0.001;
 
-					var fLow = 0.4, fHigh = 0.825;
+					var fLow = 0.1, fHigh = 0.8;
 
 					lightVal = THREE.Math.clamp( lightVal + 0.5 * delta * lightDir, fLow, fHigh );
 
 					var valNorm = ( lightVal - fLow ) / ( fHigh - fLow );
 
-					var sat = THREE.Math.mapLinear( valNorm, 0, 1, 0.95, 0.25 );
-					scene.fog.color.setHSV( 0.1, sat, lightVal );
+					scene.fog.color.setHSL( 0.1, 0.5, lightVal );
 
 					renderer.setClearColor( scene.fog.color, 1 );