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

Set camera to 0,0,0 in webvr_shadow.

上级 277b28f0
......@@ -43,18 +43,14 @@
scene = new THREE.Scene();
var dummy = new THREE.Camera();
dummy.position.set( 0, 0.5, 3 );
dummy.lookAt( new THREE.Vector3( 0, 0.5, 0 ) );
scene.add( dummy );
camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 0.1, 10 );
dummy.add( camera );
scene.add( camera );
var geometry = new THREE.TorusKnotGeometry( 0.4, 0.15, 150, 20 );
var material = new THREE.MeshStandardMaterial( { roughness: 0.01, metalness: 0.2 } );
var mesh = new THREE.Mesh( geometry, material );
mesh.position.y = 0.75;
mesh.position.z = - 2;
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add( mesh );
......@@ -63,28 +59,39 @@
var material = new THREE.MeshStandardMaterial( { roughness: 1.0, metalness: 0.0 } );
var mesh = new THREE.Mesh( geometry, material );
mesh.position.y = - 0.2;
mesh.position.z = - 2;
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add( mesh );
var light = new THREE.DirectionalLight( 0x8800ff );
light.position.set( - 1, 1.5, 0.5 );
light.position.set( - 1, 1.5, - 1.5 );
light.castShadow = true;
light.shadow.camera.zoom = 4;
scene.add( light );
light.target.position.set( 0, 0, - 2 );
scene.add( light.target );
var helper = new THREE.CameraHelper( light.shadow.camera );
// scene.add( helper );
var light = new THREE.DirectionalLight( 0xff0000 );
light.position.set( 1, 1.5, - 0.5 );
light.position.set( 1, 1.5, - 2.5 );
light.castShadow = true;
light.shadow.camera.zoom = 4;
scene.add( light );
light.target.position.set( 0, 0, - 2 );
scene.add( light.target );
var helper = new THREE.CameraHelper( light.shadow.camera );
// scene.add( helper );
//
mirror = new THREE.Mirror( 1.4, 1.4, { textureWidth: window.innerWidth, textureHeight: window.innerHeight } );
mirror.position.x = 1;
mirror.position.y = 0.5;
mirror.position.z = -1;
mirror.position.z = -3;
mirror.rotation.y = - Math.PI / 4;
scene.add( mirror );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册