2
0
WestLangley 7 жил өмнө
parent
commit
e19e4744ff

+ 2 - 1
examples/webgl_geometry_colors.html

@@ -121,6 +121,7 @@
 				var color = new THREE.Color();
 				var positions1 = geometry1.attributes.position;
 				var positions2 = geometry2.attributes.position;
+				var positions3 = geometry3.attributes.position;
 				var colors1 = geometry1.attributes.color;
 				var colors2 = geometry2.attributes.color;
 				var colors3 = geometry3.attributes.color;
@@ -133,7 +134,7 @@
 					color.setHSL( 0, ( positions2.getY( i ) / radius + 1 ) / 2, 0.5 );
 					colors2.setXYZ( i, color.r, color.g, color.b );
 
-					color.setHSL( 0.125 * i / count, 1.0, 0.5 );
+					color.setRGB( 1, 1, ( positions3.getY( i ) / radius + 1 ) / 2 );
 					colors3.setXYZ( i, color.r, color.g, color.b );
 
 				}

+ 2 - 1
examples/webgl_multiple_canvases_complex.html

@@ -183,6 +183,7 @@
 				var color = new THREE.Color();
 				var positions1 = geometry1.attributes.position;
 				var positions2 = geometry2.attributes.position;
+				var positions3 = geometry3.attributes.position;
 				var colors1 = geometry1.attributes.color;
 				var colors2 = geometry2.attributes.color;
 				var colors3 = geometry3.attributes.color;
@@ -195,7 +196,7 @@
 					color.setHSL( 0, ( positions2.getY( i ) / radius + 1 ) / 2, 0.5 );
 					colors2.setXYZ( i, color.r, color.g, color.b );
 
-					color.setHSL( 0.125 * i / count, 1.0, 0.5 );
+					color.setRGB( 1, 1, ( positions3.getY( i ) / radius + 1 ) / 2 );
 					colors3.setXYZ( i, color.r, color.g, color.b );
 
 				}

+ 2 - 1
examples/webgl_multiple_canvases_grid.html

@@ -201,6 +201,7 @@
 				var color = new THREE.Color();
 				var positions1 = geometry1.attributes.position;
 				var positions2 = geometry2.attributes.position;
+				var positions3 = geometry3.attributes.position;
 				var colors1 = geometry1.attributes.color;
 				var colors2 = geometry2.attributes.color;
 				var colors3 = geometry3.attributes.color;
@@ -213,7 +214,7 @@
 					color.setHSL( 0, ( positions2.getY( i ) / radius + 1 ) / 2, 0.5 );
 					colors2.setXYZ( i, color.r, color.g, color.b );
 
-					color.setHSL( 0.125 * i / count, 1.0, 0.5 );
+					color.setRGB( 1, 1, ( positions3.getY( i ) / radius + 1 ) / 2 );
 					colors3.setXYZ( i, color.r, color.g, color.b );
 
 				}

+ 2 - 16
examples/webgl_multiple_renderers.html

@@ -115,6 +115,7 @@
 
 				var positions1 = geometry1.attributes.position;
 				var positions2 = geometry2.attributes.position;
+				var positions3 = geometry3.attributes.position;
 				var colors1 = geometry1.attributes.color;
 				var colors2 = geometry2.attributes.color;
 				var colors3 = geometry3.attributes.color;
@@ -127,7 +128,7 @@
 					color.setHSL( 0, ( positions2.getY( i ) / radius + 1 ) / 2, 0.5 );
 					colors2.setXYZ( i, color.r, color.g, color.b );
 
-					color.setHSL( 0.125 * i / count, 1.0, 0.5 );
+					color.setRGB( 1, 1, ( positions3.getY( i ) / radius + 1 ) / 2 );
 					colors3.setXYZ( i, color.r, color.g, color.b );
 
 				}
@@ -183,21 +184,6 @@
 				mesh2.rotation.z += Math.PI / 500;
 				mesh3.rotation.z += Math.PI / 500;
 
-				var geometry = mesh3.geometry;
-				var colors3 = geometry.attributes.color;
-				var count = colors3.count;
-
-				for ( var i = 0; i < colors3.count; i ++ ) {
-
-					vec.fromBufferAttribute( colors3, i );
-					color.setRGB( vec.x, vec.y, vec.z );
-					color.setHex( ( color.getHex() + 0xfdfdfd ) % 0xffffff );
-					colors3.setXYZ( i, color.r, color.g, color.b );
-
-				}
-
-				geometry.attributes.color.needsUpdate = true;
-
 				//
 
 				var time = performance.now() / 2000;

+ 2 - 1
examples/webgl_multiple_views.html

@@ -172,6 +172,7 @@
 				var color = new THREE.Color();
 				var positions1 = geometry1.attributes.position;
 				var positions2 = geometry2.attributes.position;
+				var positions3 = geometry3.attributes.position;
 				var colors1 = geometry1.attributes.color;
 				var colors2 = geometry2.attributes.color;
 				var colors3 = geometry3.attributes.color;
@@ -184,7 +185,7 @@
 					color.setHSL( 0, ( positions2.getY( i ) / radius + 1 ) / 2, 0.5 );
 					colors2.setXYZ( i, color.r, color.g, color.b );
 
-					color.setHSL( 0.125 * i / count, 1.0, 0.5 );
+					color.setRGB( 1, 1, ( positions3.getY( i ) / radius + 1 ) / 2 );
 					colors3.setXYZ( i, color.r, color.g, color.b );
 
 				}