提交 d86527f9 编写于 作者: M Mr.doob

Improved some examples.

上级 bc05f238
......@@ -397,7 +397,7 @@
}, false );
transform( targets.table, 5000 );
transform( targets.table, 2000 );
//
......
......@@ -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();
......
......@@ -95,6 +95,7 @@
controls.verticalMax = 2.0;
controls.lon = 250;
controls.lat = 30;
// SCENE
......
......@@ -89,7 +89,8 @@
controls.verticalMin = 1.5;
controls.verticalMax = 2.0;
controls.lon = -110;
controls.lon = 250;
controls.lat = 30;
// SCENE
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册