Procházet zdrojové kódy

Made shadow transparent (albeit doesn't go well with canvas_geometry_earth :/). Updated webgl_multiple_views example for the new IcosahedronGeometry.

Mr.doob před 13 roky
rodič
revize
69fb4b31c0
2 změnil soubory, kde provedl 7 přidání a 8 odebrání
  1. binární
      examples/textures/shadow.png
  2. 7 8
      examples/webgl_multiple_views.html

binární
examples/textures/shadow.png


+ 7 - 8
examples/webgl_multiple_views.html

@@ -152,9 +152,11 @@
 
 				var color, f, f2, f3, p, n, vertexIndex,
 
-					geometry  = new THREE.IcosahedronGeometry( 1 ),
-					geometry2 = new THREE.IcosahedronGeometry( 1 ),
-					geometry3 = new THREE.IcosahedronGeometry( 1 );
+					radius = 200,
+
+					geometry  = new THREE.IcosahedronGeometry( radius, 1 ),
+					geometry2 = new THREE.IcosahedronGeometry( radius, 1 ),
+					geometry3 = new THREE.IcosahedronGeometry( radius, 1 );
 
 				for ( var i = 0; i < geometry.faces.length; i ++ ) {
 
@@ -171,12 +173,12 @@
 						p = geometry.vertices[ vertexIndex ].position;
 
 						color = new THREE.Color( 0xffffff );
-						color.setHSV( ( p.y + 1 ) / 2, 1.0, 1.0 );
+						color.setHSV( ( p.y / radius + 1 ) / 2, 1.0, 1.0 );
 
 						f.vertexColors[ j ] = color;
 
 						color = new THREE.Color( 0xffffff );
-						color.setHSV( 0.0, ( p.y + 1 ) / 2, 1.0 );
+						color.setHSV( 0.0, ( p.y / radius + 1 ) / 2, 1.0 );
 
 						f2.vertexColors[ j ] = color;
 
@@ -200,19 +202,16 @@
 				group1 = THREE.SceneUtils.createMultiMaterialObject( geometry, materials );
 				group1.position.x = -400;
 				group1.rotation.x = -1.87;
-				group1.scale.set( 200, 200, 200 );
 				scene.add( group1 );
 
 				group2 = THREE.SceneUtils.createMultiMaterialObject( geometry2, materials );
 				group2.position.x = 400;
 				group2.rotation.x = 0;
-				group2.scale = group1.scale;
 				scene.add( group2 );
 
 				group3 = THREE.SceneUtils.createMultiMaterialObject( geometry3, materials );
 				group3.position.x = 0;
 				group3.rotation.x = 0;
-				group3.scale = group1.scale;
 				scene.add( group3 );
 
 				renderer = new THREE.WebGLRenderer( { antialias: true } );