Browse Source

Cleaned up cloth example.

Mr.doob 10 years ago
parent
commit
ac4cbd8760
1 changed files with 16 additions and 13 deletions
  1. 16 13
      examples/webgl_animation_cloth.html

+ 16 - 13
examples/webgl_animation_cloth.html

@@ -128,7 +128,7 @@
 
 			var clothGeometry;
 			var sphere;
-			var object, arrow;
+			var object;
 
 			var rotate = true;
 
@@ -143,7 +143,6 @@
 				// scene
 
 				scene = new THREE.Scene();
-
 				scene.fog = new THREE.Fog( 0xcce0ff, 500, 10000 );
 
 				// camera
@@ -164,7 +163,7 @@
 				light.position.multiplyScalar( 1.3 );
 
 				light.castShadow = true;
-				//light.shadowCameraVisible = true;
+				// light.shadowCameraVisible = true;
 
 				light.shadowMapWidth = 1024;
 				light.shadowMapHeight = 1024;
@@ -187,7 +186,14 @@
 				clothTexture.wrapS = clothTexture.wrapT = THREE.RepeatWrapping;
 				clothTexture.anisotropy = 16;
 
-				var clothMaterial = new THREE.MeshPhongMaterial( { alphaTest: 0.5, color: 0xffffff, specular: 0x030303, emissive: 0x111111, shiness: 10, map: clothTexture, side: THREE.DoubleSide } );
+				var clothMaterial = new THREE.MeshPhongMaterial( {
+					specular: 0x030303,
+					emissive: 0x111111,
+					shiness: 10,
+					map: clothTexture,
+					side: THREE.DoubleSide,
+					alphaTest: 0.5
+				} );
 
 				// cloth geometry
 				clothGeometry = new THREE.ParametricGeometry( clothFunction, cloth.w, cloth.h );
@@ -205,7 +211,12 @@
 				object.receiveShadow = true;
 				scene.add( object );
 
-				object.customDepthMaterial = new THREE.ShaderMaterial( { uniforms: uniforms, vertexShader: vertexShader, fragmentShader: fragmentShader, side: THREE.DoubleSide } );
+				object.customDepthMaterial = new THREE.ShaderMaterial( {
+					uniforms: uniforms,
+					vertexShader: vertexShader,
+					fragmentShader: fragmentShader,
+					side: THREE.DoubleSide
+				} );
 
 				// sphere
 
@@ -217,12 +228,6 @@
 				sphere.receiveShadow = true;
 				scene.add( sphere );
 
-				// arrow
-
-				arrow = new THREE.ArrowHelper( new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, 0, 0 ), 50, 0xff0000 );
-				arrow.position.set( -200, 0, -200 );
-				// scene.add( arrow );
-
 				// ground
 
 				var groundTexture = THREE.ImageUtils.loadTexture( "textures/terrain/grasslight-big.jpg" );
@@ -327,8 +332,6 @@
 
 				windStrength = Math.cos( time / 7000 ) * 20 + 40;
 				windForce.set( Math.sin( time / 2000 ), Math.cos( time / 3000 ), Math.sin( time / 1000 ) ).normalize().multiplyScalar( windStrength );
-				arrow.setLength( windStrength );
-				arrow.setDirection( windForce );
 
 				simulate(time);
 				render();