提交 6c622248 编写于 作者: M Mr.doob

VREffects/VRControls: Reverted internal vrdisplays removal so it doesn't break...

VREffects/VRControls: Reverted internal vrdisplays removal so it doesn't break backward compatibility.
上级 32f62a36
......@@ -7,7 +7,7 @@ THREE.VRControls = function ( object, onError ) {
var scope = this;
var vrDisplay;
var vrDisplay, vrDisplays;
var standingMatrix = new THREE.Matrix4();
......@@ -16,6 +16,28 @@ THREE.VRControls = function ( object, onError ) {
frameData = new VRFrameData();
}
function gotVRDisplays( displays ) {
vrDisplays = displays;
if ( displays.length > 0 ) {
vrDisplay = displays[ 0 ];
} else {
if ( onError ) onError( 'VR input not available.' );
}
}
if ( navigator.getVRDisplays ) {
navigator.getVRDisplays().then( gotVRDisplays );
}
// the Rift SDK returns the position in meters
// this scale factor allows the user to define how meters
// are converted to scene units.
......
......@@ -9,10 +9,9 @@
*
*/
THREE.VREffect = function ( renderer ) {
var vrDisplay;
THREE.VREffect = function ( renderer, onError ) {
var vrDisplay, vrDisplays;
var eyeTranslationL = new THREE.Vector3();
var eyeTranslationR = new THREE.Vector3();
var renderRectL, renderRectR;
......@@ -24,6 +23,28 @@ THREE.VREffect = function ( renderer ) {
}
function gotVRDisplays( displays ) {
vrDisplays = displays;
if ( displays.length > 0 ) {
vrDisplay = displays[ 0 ];
} else {
if ( onError ) onError( 'HMD not available' );
}
}
if ( navigator.getVRDisplays ) {
navigator.getVRDisplays().then( gotVRDisplays );
}
//
this.isPresenting = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册