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

Simpler StereoEffect.

上级 a2fc7a62
/**
* @author alteredq / http://alteredqualia.com/
* @authod mrdoob / http://mrdoob.com/
* @authod arodic / http://aleksandarrodic.com/
*/
THREE.StereoEffect = function ( renderer ) {
// API
this.separation = 6;
this.targetDistance = 500;
this.separation = 3;
// internals
......@@ -20,7 +20,6 @@ THREE.StereoEffect = function ( renderer ) {
var _cameraL = new THREE.PerspectiveCamera();
var _cameraR = new THREE.PerspectiveCamera();
var _target = new THREE.Vector3();
// initialization
......@@ -43,33 +42,27 @@ THREE.StereoEffect = function ( renderer ) {
camera.matrixWorld.decompose( _position, _quaternion, _scale );
_target.set( 0, 0, - this.targetDistance );
_target.applyQuaternion( _quaternion );
_target.add( _position );
// left
_cameraL.fov = camera.fov;
_cameraL.aspect = 0.5 * camera.aspect;
_cameraL.updateProjectionMatrix();
_cameraL.near = camera.near;
_cameraL.far = camera.far;
_cameraL.updateProjectionMatrix();
_cameraL.position.copy( _position );
_cameraL.quaternion.copy( _quaternion );
_cameraL.translateX( - this.separation );
_cameraL.lookAt( _target );
// right
_cameraR.projectionMatrix = _cameraL.projectionMatrix;
_cameraR.near = camera.near;
_cameraR.far = camera.far;
_cameraR.projectionMatrix = _cameraL.projectionMatrix;
_cameraR.position.copy( _position );
_cameraR.quaternion.copy( _quaternion );
_cameraR.translateX( this.separation );
_cameraR.lookAt( _target );
//
......
......@@ -126,7 +126,6 @@
effect = new THREE.StereoEffect( renderer );
effect.separation = 10;
effect.targetDistance = 200;
effect.setSize( window.innerWidth, window.innerHeight );
//
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册