|
@@ -1,14 +1,14 @@
|
|
|
/**
|
|
|
* @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 );
|
|
|
|
|
|
//
|
|
|
|