|
@@ -21240,7 +21240,7 @@ function WebVRManager( renderer ) {
|
|
|
var standingMatrix = new Matrix4();
|
|
|
var standingMatrixInverse = new Matrix4();
|
|
|
|
|
|
- var options = { frameOfReferenceType: 'stage' };
|
|
|
+ var frameOfReferenceType = 'stage';
|
|
|
|
|
|
if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
|
|
|
|
|
@@ -21416,12 +21416,17 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.setDevice = function ( _device, _options ) {
|
|
|
+ this.setDevice = function ( value ) {
|
|
|
|
|
|
- if ( _device !== undefined ) device = _device;
|
|
|
- if ( _options !== undefined ) options = _options;
|
|
|
+ if ( value !== undefined ) device = value;
|
|
|
|
|
|
- animation.setContext( _device );
|
|
|
+ animation.setContext( value );
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ this.setFrameOfReferenceType = function ( value ) {
|
|
|
+
|
|
|
+ frameOfReferenceType = value;
|
|
|
|
|
|
};
|
|
|
|
|
@@ -21433,9 +21438,11 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
this.getCamera = function ( camera ) {
|
|
|
|
|
|
+ var userHeight = frameOfReferenceType === 'stage' ? 1.6 : 0;
|
|
|
+
|
|
|
if ( device === null ) {
|
|
|
|
|
|
- camera.position.set( 0, 1.6, 0 );
|
|
|
+ camera.position.set( 0, userHeight, 0 );
|
|
|
return camera;
|
|
|
|
|
|
}
|
|
@@ -21447,7 +21454,7 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
//
|
|
|
|
|
|
- if ( options.frameOfReferenceType === 'stage' ) {
|
|
|
+ if ( frameOfReferenceType === 'stage' ) {
|
|
|
|
|
|
var stageParameters = device.stageParameters;
|
|
|
|
|
@@ -21457,7 +21464,7 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- standingMatrix.makeTranslation( 0, 1.6, 0 );
|
|
|
+ standingMatrix.makeTranslation( 0, userHeight, 0 );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -21509,7 +21516,7 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
standingMatrixInverse.getInverse( standingMatrix );
|
|
|
|
|
|
- if ( options.frameOfReferenceType === 'stage' ) {
|
|
|
+ if ( frameOfReferenceType === 'stage' ) {
|
|
|
|
|
|
cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
|
cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
|
|
@@ -21615,7 +21622,8 @@ function WebXRManager( renderer ) {
|
|
|
var device = null;
|
|
|
var session = null;
|
|
|
|
|
|
- var frameOfRef = null;
|
|
|
+ var frameOfReference = null;
|
|
|
+ var frameOfReferenceType = 'stage';
|
|
|
|
|
|
var pose = null;
|
|
|
|
|
@@ -21624,8 +21632,7 @@ function WebXRManager( renderer ) {
|
|
|
|
|
|
function isPresenting() {
|
|
|
|
|
|
- return session !== null && frameOfRef !== null;
|
|
|
-
|
|
|
+ return session !== null && frameOfReference !== null;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -21671,10 +21678,10 @@ function WebXRManager( renderer ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.setDevice = function ( _device ) {
|
|
|
+ this.setDevice = function ( value ) {
|
|
|
|
|
|
- if ( _device !== undefined ) device = _device;
|
|
|
- if ( _device instanceof XRDevice ) gl.setCompatibleXRDevice( _device );
|
|
|
+ if ( value !== undefined ) device = value;
|
|
|
+ if ( value instanceof XRDevice ) gl.setCompatibleXRDevice( value );
|
|
|
|
|
|
};
|
|
|
|
|
@@ -21694,9 +21701,15 @@ function WebXRManager( renderer ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- this.setSession = function ( _session, _options ) {
|
|
|
+ this.setFrameOfReferenceType = function ( value ) {
|
|
|
+
|
|
|
+ frameOfReferenceType = value;
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ this.setSession = function ( value ) {
|
|
|
|
|
|
- session = _session;
|
|
|
+ session = value;
|
|
|
|
|
|
if ( session !== null ) {
|
|
|
|
|
@@ -21706,9 +21719,9 @@ function WebXRManager( renderer ) {
|
|
|
session.addEventListener( 'end', onSessionEnd );
|
|
|
|
|
|
session.baseLayer = new XRWebGLLayer( session, gl );
|
|
|
- session.requestFrameOfReference( _options.frameOfReferenceType ).then( function ( _frameOfRef ) {
|
|
|
+ session.requestFrameOfReference( frameOfReferenceType ).then( function ( value ) {
|
|
|
|
|
|
- frameOfRef = _frameOfRef;
|
|
|
+ frameOfReference = value;
|
|
|
|
|
|
renderer.setFramebuffer( session.baseLayer.framebuffer );
|
|
|
|
|
@@ -21793,7 +21806,7 @@ function WebXRManager( renderer ) {
|
|
|
|
|
|
function onAnimationFrame( time, frame ) {
|
|
|
|
|
|
- pose = frame.getDevicePose( frameOfRef );
|
|
|
+ pose = frame.getDevicePose( frameOfReference );
|
|
|
|
|
|
if ( pose !== null ) {
|
|
|
|
|
@@ -21836,7 +21849,7 @@ function WebXRManager( renderer ) {
|
|
|
|
|
|
if ( inputSource ) {
|
|
|
|
|
|
- var inputPose = frame.getInputPose( inputSource, frameOfRef );
|
|
|
+ var inputPose = frame.getInputPose( inputSource, frameOfReference );
|
|
|
|
|
|
if ( inputPose !== null ) {
|
|
|
|