提交 ff0ccd30 编写于 作者: W WestLangley

Corrected OrthographicCamera constructor args

上级 4b394cb4
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
var container, stats; var container, stats;
var camera, scene, renderer; var camera, scene, renderer;
var frustumSize = 1000;
init(); init();
animate(); animate();
...@@ -43,10 +44,9 @@ ...@@ -43,10 +44,9 @@
info.innerHTML = '<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - orthographic view'; info.innerHTML = '<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - orthographic view';
container.appendChild( info ); container.appendChild( info );
camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, - 500, 1000 ); var aspect = window.innerWidth / window.innerHeight;
camera.position.x = 200; camera = new THREE.OrthographicCamera( frustumSize * aspect / - 2, frustumSize * aspect / 2, frustumSize / 2, frustumSize / - 2, 1, 2000 );
camera.position.y = 100; camera.position.y = 400;
camera.position.z = 200;
scene = new THREE.Scene(); scene = new THREE.Scene();
...@@ -110,10 +110,12 @@ ...@@ -110,10 +110,12 @@
function onWindowResize() { function onWindowResize() {
camera.left = window.innerWidth / - 2; var aspect = window.innerWidth / window.innerHeight;
camera.right = window.innerWidth / 2;
camera.top = window.innerHeight / 2; camera.left = - frustumSize * aspect / 2;
camera.bottom = window.innerHeight / - 2; camera.right = frustumSize * aspect / 2;
camera.top = frustumSize / 2;
camera.bottom = - frustumSize / 2;
camera.updateProjectionMatrix(); camera.updateProjectionMatrix();
...@@ -137,8 +139,8 @@ ...@@ -137,8 +139,8 @@
var timer = Date.now() * 0.0001; var timer = Date.now() * 0.0001;
camera.position.x = Math.cos( timer ) * 200; camera.position.x = Math.cos( timer ) * 800;
camera.position.z = Math.sin( timer ) * 200; camera.position.z = Math.sin( timer ) * 800;
camera.lookAt( scene.position ); camera.lookAt( scene.position );
renderer.render( scene, camera ); renderer.render( scene, camera );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册