|
@@ -4,6 +4,7 @@ import { PerspectiveCamera } from './PerspectiveCamera.js';
|
|
|
|
|
|
const _eyeRight = /*@__PURE__*/ new Matrix4();
|
|
|
const _eyeLeft = /*@__PURE__*/ new Matrix4();
|
|
|
+const _projectionMatrix = /*@__PURE__*/ new Matrix4();
|
|
|
|
|
|
class StereoCamera {
|
|
|
|
|
@@ -56,7 +57,7 @@ class StereoCamera {
|
|
|
// Off-axis stereoscopic effect based on
|
|
|
// http://paulbourke.net/stereographics/stereorender/
|
|
|
|
|
|
- const projectionMatrix = camera.projectionMatrix.clone();
|
|
|
+ _projectionMatrix.copy( camera.projectionMatrix );
|
|
|
const eyeSepHalf = cache.eyeSep / 2;
|
|
|
const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;
|
|
|
const ymax = ( cache.near * Math.tan( MathUtils.DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;
|
|
@@ -72,20 +73,20 @@ class StereoCamera {
|
|
|
xmin = - ymax * cache.aspect + eyeSepOnProjection;
|
|
|
xmax = ymax * cache.aspect + eyeSepOnProjection;
|
|
|
|
|
|
- projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
|
|
|
- projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
|
|
|
+ _projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
|
|
|
+ _projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
|
|
|
|
|
|
- this.cameraL.projectionMatrix.copy( projectionMatrix );
|
|
|
+ this.cameraL.projectionMatrix.copy( _projectionMatrix );
|
|
|
|
|
|
// for right eye
|
|
|
|
|
|
xmin = - ymax * cache.aspect - eyeSepOnProjection;
|
|
|
xmax = ymax * cache.aspect - eyeSepOnProjection;
|
|
|
|
|
|
- projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
|
|
|
- projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
|
|
|
+ _projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
|
|
|
+ _projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
|
|
|
|
|
|
- this.cameraR.projectionMatrix.copy( projectionMatrix );
|
|
|
+ this.cameraR.projectionMatrix.copy( _projectionMatrix );
|
|
|
|
|
|
}
|
|
|
|