|
@@ -17,6 +17,9 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
var matrixWorldInverse = new THREE.Matrix4();
|
|
var matrixWorldInverse = new THREE.Matrix4();
|
|
|
|
|
|
|
|
+ var standingMatrix = new THREE.Matrix4();
|
|
|
|
+ var standingMatrixInverse = new THREE.Matrix4();
|
|
|
|
+
|
|
var cameraL = new THREE.PerspectiveCamera();
|
|
var cameraL = new THREE.PerspectiveCamera();
|
|
cameraL.bounds = new THREE.Vector4( 0.0, 0.0, 0.5, 1.0 );
|
|
cameraL.bounds = new THREE.Vector4( 0.0, 0.0, 0.5, 1.0 );
|
|
cameraL.layers.enable( 1 );
|
|
cameraL.layers.enable( 1 );
|
|
@@ -59,6 +62,7 @@ function WebVRManager( renderer ) {
|
|
//
|
|
//
|
|
|
|
|
|
this.enabled = false;
|
|
this.enabled = false;
|
|
|
|
+ this.standing = false;
|
|
|
|
|
|
this.getDevice = function () {
|
|
this.getDevice = function () {
|
|
|
|
|
|
@@ -103,6 +107,17 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
camera.updateMatrixWorld();
|
|
camera.updateMatrixWorld();
|
|
|
|
|
|
|
|
+ var stageParameters = device.stageParameters;
|
|
|
|
+
|
|
|
|
+ if ( this.standing && stageParameters ) {
|
|
|
|
+
|
|
|
|
+ standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
|
|
|
|
+ standingMatrixInverse.getInverse( standingMatrix );
|
|
|
|
+
|
|
|
|
+ camera.matrixWorld.multiply( standingMatrix );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
if ( device.isPresenting === false ) return camera;
|
|
if ( device.isPresenting === false ) return camera;
|
|
|
|
|
|
//
|
|
//
|
|
@@ -113,6 +128,13 @@ function WebVRManager( renderer ) {
|
|
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
|
|
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
|
|
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
|
|
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
|
|
|
|
|
|
|
|
+ if ( this.standing && stageParameters ) {
|
|
|
|
+
|
|
|
|
+ cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
|
|
+ cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
var parent = camera.parent;
|
|
var parent = camera.parent;
|
|
|
|
|
|
if ( parent !== null ) {
|
|
if ( parent !== null ) {
|
|
@@ -158,6 +180,12 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ this.getStandingMatrix = function () {
|
|
|
|
+
|
|
|
|
+ return standingMatrix;
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
this.submitFrame = function () {
|
|
this.submitFrame = function () {
|
|
|
|
|
|
if ( device && device.isPresenting ) device.submitFrame();
|
|
if ( device && device.isPresenting ) device.submitFrame();
|