@@ -934,17 +934,17 @@ export class DeviceServiceProvider {
934934 return this . deviceService . isPresentingHMD ? this . defaultUserHeight : this . defaultUserHeight / 2 ;
935935 }
936936
937- private _vrFrameData ?:any ;
937+ // private _vrFrameData?:any;
938938
939939 protected onUpdateDeviceState ( deviceState :DeviceState ) {
940940
941- const vrDisplay = currentVRDisplay ;
942- if ( ! vrDisplay ) {
941+ // const vrDisplay = currentVRDisplay;
942+ // if (!vrDisplay) {
943943 deviceState . viewport = undefined ;
944944 deviceState . subviews = undefined ;
945945 deviceState . strict = false ;
946- return ;
947- }
946+ // return;
947+ // }
948948
949949 // Since the WebVR polyfill only manages state within one browser window,
950950 // we will just pass down the viewport/subview configuration in the device state.
@@ -953,52 +953,61 @@ export class DeviceServiceProvider {
953953 // a way to composite content from different iframes, however once WebVR is decoupled from the DOM and can run
954954 // in a worker, the DeviceService should be able to leverage the WebVR API as needed within each frame)
955955
956- const vrFrameData : VRFrameData = this . _vrFrameData =
957- this . _vrFrameData || new VRFrameData ( ) ;
958- if ( ! vrDisplay [ 'getFrameData' ] ( vrFrameData ) ) {
959- setTimeout ( ( ) => this . publishDeviceState ( ) , 500 ) ;
960- return ;
961- }
962-
963- const element = this . viewService . element ;
964- const viewport = deviceState . viewport = deviceState . viewport || < Viewport > { } ;
965- viewport . x = 0 ;
966- viewport . y = 0 ;
967- viewport . width = element && element . clientWidth || 0 ;
968- viewport . height = element && element . clientHeight || 0 ;
956+ // const vrFrameData : VRFrameData = this._vrFrameData =
957+ // this._vrFrameData || new VRFrameData();
958+ // if (!vrDisplay['getFrameData'](vrFrameData)) {
959+ // setTimeout(()=>this.publishDeviceState(), 500);
960+ // return;
961+ // }
969962
970- const layers = vrDisplay . getLayers ( ) ;
971- const leftBounds = layers [ 0 ] . leftBounds ! ;
972- const rightBounds = layers [ 0 ] . rightBounds ! ;
963+ // const element = this.viewService.element;
964+ // const viewport = deviceState.viewport = deviceState.viewport || <Viewport>{};
965+ // viewport.x = 0;
966+ // viewport.y = 0;
967+ // viewport.width = element && element.clientWidth || 0;
968+ // viewport.height = element && element.clientHeight || 0;
969+
970+ // const layers = vrDisplay.getLayers();
971+ // let leftBounds = layers[0].leftBounds!;
972+ // let rightBounds = layers[0].rightBounds!;
973+
974+ // if ( layers.length ) {
975+ // var layer = layers[ 0 ]!;
976+ // leftBounds = layer.leftBounds && layer.leftBounds.length === 4 ? layer.leftBounds : this._defaultLeftBounds;
977+ // rightBounds = layer.rightBounds && layer.rightBounds.length === 4 ? layer.rightBounds : this._defaultRightBounds;
978+ // } else {
979+ // leftBounds = this._defaultLeftBounds;
980+ // rightBounds = this._defaultRightBounds;
981+ // }
973982
974- const subviews = deviceState . subviews = deviceState . subviews || [ ] ;
975- subviews . length = 2 ;
976-
977- const leftSubview = subviews [ 0 ] = subviews [ 0 ] || { } ;
978- const rightSubview = subviews [ 1 ] = subviews [ 1 ] || { } ;
979- leftSubview . type = SubviewType . LEFTEYE ;
980- rightSubview . type = SubviewType . RIGHTEYE ;
981-
982- const leftViewport = leftSubview . viewport = leftSubview . viewport || < Viewport > { } ;
983- leftViewport . x = leftBounds [ 0 ] * viewport . width ;
984- leftViewport . y = leftBounds [ 1 ] * viewport . height ;
985- leftViewport . width = leftBounds [ 2 ] * viewport . width ;
986- leftViewport . height = leftBounds [ 3 ] * viewport . height ;
987-
988- const rightViewport = rightSubview . viewport = rightSubview . viewport || < Viewport > { } ;
989- rightViewport . x = rightBounds [ 0 ] * viewport . width ;
990- rightViewport . y = rightBounds [ 1 ] * viewport . height ;
991- rightViewport . width = rightBounds [ 2 ] * viewport . width ;
992- rightViewport . height = rightBounds [ 3 ] * viewport . height ;
993-
994- leftSubview . projectionMatrix = Matrix4 . clone (
995- < any > vrFrameData . leftProjectionMatrix ,
996- leftSubview . projectionMatrix
997- ) ;
998- rightSubview . projectionMatrix = Matrix4 . clone (
999- < any > vrFrameData . rightProjectionMatrix ,
1000- rightSubview . projectionMatrix
1001- ) ;
983+ // const subviews = deviceState.subviews = deviceState.subviews || [];
984+ // subviews.length = 2;
985+
986+ // const leftSubview = subviews[0] = subviews[0] || {};
987+ // const rightSubview = subviews[1] = subviews[1] || {};
988+ // leftSubview.type = SubviewType.LEFTEYE;
989+ // rightSubview.type = SubviewType.RIGHTEYE;
990+
991+ // const leftViewport = leftSubview.viewport = leftSubview.viewport || <Viewport>{};
992+ // leftViewport.x = leftBounds[0] * viewport.width;
993+ // leftViewport.y = leftBounds[1] * viewport.height;
994+ // leftViewport.width = leftBounds[2] * viewport.width;
995+ // leftViewport.height = leftBounds[3] * viewport.height;
996+
997+ // const rightViewport = rightSubview.viewport = rightSubview.viewport || <Viewport>{};
998+ // rightViewport.x = rightBounds[0] * viewport.width;
999+ // rightViewport.y = rightBounds[1] * viewport.height;
1000+ // rightViewport.width = rightBounds[2] * viewport.width;
1001+ // rightViewport.height = rightBounds[3] * viewport.height;
1002+
1003+ // leftSubview.projectionMatrix = Matrix4.clone(
1004+ // <any>vrFrameData.leftProjectionMatrix,
1005+ // leftSubview.projectionMatrix
1006+ // );
1007+ // rightSubview.projectionMatrix = Matrix4.clone(
1008+ // <any>vrFrameData.rightProjectionMatrix,
1009+ // rightSubview.projectionMatrix
1010+ // );
10021011 }
10031012
10041013 private _currentGeolocationOptions ?:GeolocationOptions ;
0 commit comments