未验证 提交 b4f4549f 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #14805 from mrdoob/webvr

WebVRManager: Removed userHeight.
...@@ -9,6 +9,9 @@ var WEBVR = { ...@@ -9,6 +9,9 @@ var WEBVR = {
createButton: function ( renderer, options ) { createButton: function ( renderer, options ) {
if ( options === undefined ) options = {};
if ( options.frameOfReferenceType === undefined ) options.frameOfReferenceType = 'stage';
function showEnterVR( device ) { function showEnterVR( device ) {
button.style.display = ''; button.style.display = '';
...@@ -28,7 +31,7 @@ var WEBVR = { ...@@ -28,7 +31,7 @@ var WEBVR = {
}; };
renderer.vr.setDevice( device ); renderer.vr.setDevice( device, options );
} }
...@@ -38,9 +41,6 @@ var WEBVR = { ...@@ -38,9 +41,6 @@ var WEBVR = {
function onSessionStarted( session ) { function onSessionStarted( session ) {
if ( options === undefined ) options = {};
if ( options.frameOfReferenceType === undefined ) options.frameOfReferenceType = 'stage';
session.addEventListener( 'end', onSessionEnded ); session.addEventListener( 'end', onSessionEnded );
renderer.vr.setSession( session, options ); renderer.vr.setSession( session, options );
......
...@@ -1683,6 +1683,27 @@ Object.defineProperties( WebGLRenderTarget.prototype, { ...@@ -1683,6 +1683,27 @@ Object.defineProperties( WebGLRenderTarget.prototype, {
// //
Object.defineProperties( WebVRManager.prototype, {
standing: {
set: function ( /* value */ ) {
console.warn( 'THREE.WebVRManager: .standing has been removed.' );
}
},
userHeight: {
set: function ( /* value */ ) {
console.warn( 'THREE.WebVRManager: .userHeight has been removed.' );
}
}
} );
//
Audio.prototype.load = function ( file ) { Audio.prototype.load = function ( file ) {
console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' ); console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' );
......
...@@ -24,6 +24,8 @@ function WebVRManager( renderer ) { ...@@ -24,6 +24,8 @@ function WebVRManager( renderer ) {
var standingMatrix = new Matrix4(); var standingMatrix = new Matrix4();
var standingMatrixInverse = new Matrix4(); var standingMatrixInverse = new Matrix4();
var options = { frameOfReferenceType: 'stage' };
if ( typeof window !== 'undefined' && 'VRFrameData' in window ) { if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
frameData = new window.VRFrameData(); frameData = new window.VRFrameData();
...@@ -173,8 +175,6 @@ function WebVRManager( renderer ) { ...@@ -173,8 +175,6 @@ function WebVRManager( renderer ) {
// //
this.enabled = false; this.enabled = false;
this.userHeight = 1.6;
this.standing = false;
this.getController = function ( id ) { this.getController = function ( id ) {
...@@ -200,11 +200,12 @@ function WebVRManager( renderer ) { ...@@ -200,11 +200,12 @@ function WebVRManager( renderer ) {
}; };
this.setDevice = function ( value ) { this.setDevice = function ( _device, _options ) {
if ( value !== undefined ) device = value; if ( _device !== undefined ) device = _device;
if ( _options !== undefined ) options = _options;
animation.setContext( value ); animation.setContext( _device );
}; };
...@@ -218,7 +219,7 @@ function WebVRManager( renderer ) { ...@@ -218,7 +219,7 @@ function WebVRManager( renderer ) {
if ( device === null ) { if ( device === null ) {
camera.position.set( 0, scope.userHeight, 0 ); camera.position.set( 0, 1.6, 0 );
return camera; return camera;
} }
...@@ -230,7 +231,7 @@ function WebVRManager( renderer ) { ...@@ -230,7 +231,7 @@ function WebVRManager( renderer ) {
// //
if ( this.standing ) { if ( options.frameOfReferenceType === 'stage' ) {
var stageParameters = device.stageParameters; var stageParameters = device.stageParameters;
...@@ -240,7 +241,7 @@ function WebVRManager( renderer ) { ...@@ -240,7 +241,7 @@ function WebVRManager( renderer ) {
} else { } else {
standingMatrix.makeTranslation( 0, scope.userHeight, 0 ); standingMatrix.makeTranslation( 0, 1.6, 0 );
} }
...@@ -292,7 +293,7 @@ function WebVRManager( renderer ) { ...@@ -292,7 +293,7 @@ function WebVRManager( renderer ) {
standingMatrixInverse.getInverse( standingMatrix ); standingMatrixInverse.getInverse( standingMatrix );
if ( this.standing ) { if ( options.frameOfReferenceType === 'stage' ) {
cameraL.matrixWorldInverse.multiply( standingMatrixInverse ); cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
cameraR.matrixWorldInverse.multiply( standingMatrixInverse ); cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
......
...@@ -71,10 +71,10 @@ function WebXRManager( renderer ) { ...@@ -71,10 +71,10 @@ function WebXRManager( renderer ) {
}; };
this.setDevice = function ( value ) { this.setDevice = function ( _device ) {
if ( value !== undefined ) device = value; if ( _device !== undefined ) device = _device;
if ( value instanceof XRDevice ) gl.setCompatibleXRDevice( value ); if ( _device instanceof XRDevice ) gl.setCompatibleXRDevice( _device );
}; };
...@@ -94,9 +94,9 @@ function WebXRManager( renderer ) { ...@@ -94,9 +94,9 @@ function WebXRManager( renderer ) {
} }
this.setSession = function ( value, options ) { this.setSession = function ( _session, _options ) {
session = value; session = _session;
if ( session !== null ) { if ( session !== null ) {
...@@ -106,9 +106,9 @@ function WebXRManager( renderer ) { ...@@ -106,9 +106,9 @@ function WebXRManager( renderer ) {
session.addEventListener( 'end', onSessionEnd ); session.addEventListener( 'end', onSessionEnd );
session.baseLayer = new XRWebGLLayer( session, gl ); session.baseLayer = new XRWebGLLayer( session, gl );
session.requestFrameOfReference( options.frameOfReferenceType ).then( function ( value ) { session.requestFrameOfReference( _options.frameOfReferenceType ).then( function ( _frameOfRef ) {
frameOfRef = value; frameOfRef = _frameOfRef;
renderer.setFramebuffer( session.baseLayer.framebuffer ); renderer.setFramebuffer( session.baseLayer.framebuffer );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册