Skip to content

Commit f6d4703

Browse files
authored
Examples: Use real-world scale in stereo demo. (#32403)
1 parent f57f644 commit f6d4703

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed
-675 Bytes
Loading

examples/webgl_effects_stereo.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@
4545
container = document.createElement( 'div' );
4646
document.body.appendChild( container );
4747

48-
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
49-
camera.position.z = 3200;
48+
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 100 );
49+
camera.position.z = 3;
5050

5151
scene = new THREE.Scene();
5252
scene.background = new THREE.CubeTextureLoader()
5353
.setPath( 'textures/cube/Park3Med/' )
5454
.load( [ 'px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg' ] );
5555

56-
const geometry = new THREE.SphereGeometry( 100, 32, 16 );
56+
const geometry = new THREE.SphereGeometry( 0.1, 32, 16 );
5757

5858
const textureCube = new THREE.CubeTextureLoader()
5959
.setPath( 'textures/cube/Park3Med/' )
@@ -65,9 +65,9 @@
6565
for ( let i = 0; i < 500; i ++ ) {
6666

6767
const mesh = new THREE.Mesh( geometry, material );
68-
mesh.position.x = Math.random() * 10000 - 5000;
69-
mesh.position.y = Math.random() * 10000 - 5000;
70-
mesh.position.z = Math.random() * 10000 - 5000;
68+
mesh.position.x = Math.random() * 10 - 5;
69+
mesh.position.y = Math.random() * 10 - 5;
70+
mesh.position.z = Math.random() * 10 - 5;
7171
mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1;
7272
scene.add( mesh );
7373

@@ -105,8 +105,8 @@
105105

106106
function onDocumentMouseMove( event ) {
107107

108-
mouseX = ( event.clientX - windowHalfX ) * 10;
109-
mouseY = ( event.clientY - windowHalfY ) * 10;
108+
mouseX = ( event.clientX - windowHalfX ) * 0.01;
109+
mouseY = ( event.clientY - windowHalfY ) * 0.01;
110110

111111
}
112112

@@ -124,8 +124,8 @@
124124

125125
const sphere = spheres[ i ];
126126

127-
sphere.position.x = 5000 * Math.cos( timer + i );
128-
sphere.position.y = 5000 * Math.sin( timer + i * 1.1 );
127+
sphere.position.x = 5 * Math.cos( timer + i );
128+
sphere.position.y = 5 * Math.sin( timer + i * 1.1 );
129129

130130
}
131131

0 commit comments

Comments
 (0)