|
@@ -278,33 +278,30 @@
|
|
|
* Override Camera._updateRigCameras
|
|
|
*/
|
|
|
public _updateRigCameras() {
|
|
|
+ var camLeft = <TargetCamera>this._rigCameras[0];
|
|
|
+ var camRight = <TargetCamera>this._rigCameras[1];
|
|
|
+
|
|
|
switch (this.cameraRigMode) {
|
|
|
case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
|
|
|
case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
|
|
|
case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
|
|
|
case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
|
|
|
+ //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:
|
|
|
+ var leftSign = (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? 1 : -1;
|
|
|
+ var rightSign = (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? -1 : 1;
|
|
|
+ this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft.position);
|
|
|
+ this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle * rightSign, camRight.position);
|
|
|
+
|
|
|
+ camLeft.setTarget(this.getTarget());
|
|
|
+ camRight.setTarget(this.getTarget());
|
|
|
+ break;
|
|
|
+
|
|
|
case Camera.RIG_MODE_VR:
|
|
|
- var camLeft = <TargetCamera>this._rigCameras[0];
|
|
|
- var camRight = <TargetCamera>this._rigCameras[1];
|
|
|
-
|
|
|
- if (this.cameraRigMode === Camera.RIG_MODE_VR) {
|
|
|
- /*camLeft.rotation.x = camRight.rotation.x = this.rotation.x;
|
|
|
- camLeft.rotation.y = camRight.rotation.y = this.rotation.y;
|
|
|
- camLeft.rotation.z = camRight.rotation.z = this.rotation.z;*/
|
|
|
- camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);
|
|
|
- camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);
|
|
|
-
|
|
|
- camLeft.position.copyFrom(this.position);
|
|
|
- camRight.position.copyFrom(this.position);
|
|
|
-
|
|
|
- } else {
|
|
|
- //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:
|
|
|
- this._getRigCamPosition(-this._cameraRigParams.stereoHalfAngle, camLeft.position);
|
|
|
- this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle, camRight.position);
|
|
|
-
|
|
|
- camLeft.setTarget(this.getTarget());
|
|
|
- camRight.setTarget(this.getTarget());
|
|
|
- }
|
|
|
+ camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);
|
|
|
+ camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);
|
|
|
+ camLeft.position.copyFrom(this.position);
|
|
|
+ camRight.position.copyFrom(this.position);
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
super._updateRigCameras();
|