浏览代码

Improved some examples.

Mr.doob 11 年之前
父节点
当前提交
d86527f9fa

+ 1 - 1
examples/css3d_periodictable.html

@@ -397,7 +397,7 @@
 
 				}, false );
 
-				transform( targets.table, 5000 );
+				transform( targets.table, 2000 );
 
 				//
 

+ 32 - 7
examples/webgl_shaders_ocean.html

@@ -51,6 +51,7 @@
 
 			var container, stats;
 			var camera, scene, renderer;
+			var sphere;
 
 			var parameters = {
 				width: 2000,
@@ -77,20 +78,20 @@
 				container.appendChild( renderer.domElement );
 
 				scene = new THREE.Scene();
-				camera = new THREE.PerspectiveCamera( 55, window.innerWidth / window.innerHeight, 0.5, 3000000 );
 
-				camera.position.set( 0, Math.max( parameters.width * 1.5, parameters.height ) / 8, parameters.height );
-				camera.lookAt( new THREE.Vector3( 0, 0, 0 ) );
+				camera = new THREE.PerspectiveCamera( 55, window.innerWidth / window.innerHeight, 0.5, 3000000 );
+				camera.position.set( 2000, 750, 2000 );
 
 				controls = new THREE.OrbitControls( camera, renderer.domElement );
 				controls.userPan = false;
 				controls.userPanSpeed = 0.0;
 				controls.maxDistance = 5000.0;
 				controls.maxPolarAngle = Math.PI * 0.495;
+				controls.center.set( 0, 500, 0 );
 
-				directionalLight = new THREE.DirectionalLight( 0xffff55, 1 );
-				directionalLight.position.set( - 1, 0.4, - 1 );
-				scene.add( directionalLight );
+				var light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );
+				light.position.set( - 1, 1, - 1 );
+				scene.add( light );
 
 				
 				waterNormals = new THREE.ImageUtils.loadTexture( 'textures/waternormals.jpg' );
@@ -101,7 +102,7 @@
 					textureHeight: 512,
 					waterNormals: waterNormals,
 					alpha: 	1.0,
-					sunDirection: directionalLight.position.normalize(),
+					sunDirection: light.position.clone().normalize(),
 					sunColor: 0xffffff,
 					waterColor: 0x001e0f,
 					distortionScale: 50.0,
@@ -171,6 +172,24 @@
 				
 				scene.add( skyBox );
 
+
+				var geometry = new THREE.IcosahedronGeometry( 400, 4 );
+
+				for ( var i = 0, j = geometry.faces.length; i < j; i ++ ) {
+
+					geometry.faces[ i ].color.setHex( Math.random() * 0xffffff );
+
+				}
+
+				var material = new THREE.MeshPhongMaterial( {
+					vertexColors: THREE.FaceColors,
+					shininess: 100,
+					envMap: cubeMap
+				} );
+				
+				sphere = new THREE.Mesh( geometry, material );
+				scene.add( sphere );
+
 			}
 
 			//
@@ -184,6 +203,12 @@
 
 			function render() {
 
+				var time = performance.now() * 0.001;
+
+				sphere.position.y = Math.sin( time ) * 500 + 250;
+				sphere.rotation.x = time * 0.5;
+				sphere.rotation.z = time * 0.51;
+
 				water.material.uniforms.time.value += 1.0 / 60.0;
 				controls.update();
 				water.render();

+ 1 - 0
examples/webgl_shadowmap.html

@@ -95,6 +95,7 @@
 				controls.verticalMax = 2.0;
 
 				controls.lon = 250;
+				controls.lat = 30;
 
 				// SCENE
 

+ 2 - 1
examples/webgl_shadowmap_performance.html

@@ -89,7 +89,8 @@
 				controls.verticalMin = 1.5;
 				controls.verticalMax = 2.0;
 
-				controls.lon = -110;
+				controls.lon = 250;
+				controls.lat = 30;
 
 				// SCENE