Files
old-allhands-vr/node_modules/webvr-polyfill/build/webvr-polyfill.min.js

6 lines
164 KiB
JavaScript
Raw Normal View History

2017-11-19 15:16:07 +01:00
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.WebVRPolyfill=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){"use strict";function Events(){}function EE(fn,context,once){this.fn=fn,this.context=context,this.once=once||!1}function EventEmitter(){this._events=new Events,this._eventsCount=0}var has=Object.prototype.hasOwnProperty,prefix="~";Object.create&&(Events.prototype=Object.create(null),(new Events).__proto__||(prefix=!1)),EventEmitter.prototype.eventNames=function(){var events,name,names=[];if(0===this._eventsCount)return names;for(name in events=this._events)has.call(events,name)&&names.push(prefix?name.slice(1):name);return Object.getOwnPropertySymbols?names.concat(Object.getOwnPropertySymbols(events)):names},EventEmitter.prototype.listeners=function(event,exists){var evt=prefix?prefix+event:event,available=this._events[evt];if(exists)return!!available;if(!available)return[];if(available.fn)return[available.fn];for(var i=0,l=available.length,ee=new Array(l);i<l;i++)ee[i]=available[i].fn;return ee},EventEmitter.prototype.emit=function(event,a1,a2,a3,a4,a5){var evt=prefix?prefix+event:event;if(!this._events[evt])return!1;var args,i,listeners=this._events[evt],len=arguments.length;if(listeners.fn){switch(listeners.once&&this.removeListener(event,listeners.fn,void 0,!0),len){case 1:return listeners.fn.call(listeners.context),!0;case 2:return listeners.fn.call(listeners.context,a1),!0;case 3:return listeners.fn.call(listeners.context,a1,a2),!0;case 4:return listeners.fn.call(listeners.context,a1,a2,a3),!0;case 5:return listeners.fn.call(listeners.context,a1,a2,a3,a4),!0;case 6:return listeners.fn.call(listeners.context,a1,a2,a3,a4,a5),!0}for(i=1,args=new Array(len-1);i<len;i++)args[i-1]=arguments[i];listeners.fn.apply(listeners.context,args)}else{var j,length=listeners.length;for(i=0;i<length;i++)switch(listeners[i].once&&this.removeListener(event,listeners[i].fn,void 0,!0),len){case 1:listeners[i].fn.call(listeners[i].context);break;case 2:listeners[i].fn.call(listeners[i].context,a1);break;case 3:listeners[i].fn.call(listeners[i].context,a1,a2);break;case 4:listeners[i].fn.call(listeners[i].context,a1,a2,a3);break;default:if(!args)for(j=1,args=new Array(len-1);j<len;j++)args[j-1]=arguments[j];listeners[i].fn.apply(listeners[i].context,args)}}return!0},EventEmitter.prototype.on=function(event,fn,context){var listener=new EE(fn,context||this),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.once=function(event,fn,context){var listener=new EE(fn,context||this,(!0)),evt=prefix?prefix+event:event;return this._events[evt]?this._events[evt].fn?this._events[evt]=[this._events[evt],listener]:this._events[evt].push(listener):(this._events[evt]=listener,this._eventsCount++),this},EventEmitter.prototype.removeListener=function(event,fn,context,once){var evt=prefix?prefix+event:event;if(!this._events[evt])return this;if(!fn)return 0===--this._eventsCount?this._events=new Events:delete this._events[evt],this;var listeners=this._events[evt];if(listeners.fn)listeners.fn!==fn||once&&!listeners.once||context&&listeners.context!==context||(0===--this._eventsCount?this._events=new Events:delete this._events[evt]);else{for(var i=0,events=[],length=listeners.length;i<length;i++)(listeners[i].fn!==fn||o
Util.isIOS()||(dps*=window.devicePixelRatio);var lineWidth=kCenterLineThicknessDp*dps/2,buttonSize=kButtonWidthDp*kTouchSlopFactor*dps,buttonScale=kButtonWidthDp*dps/2,buttonBorder=(kButtonWidthDp*kTouchSlopFactor-kButtonWidthDp)*dps;vertices.push(midline-lineWidth,buttonSize),vertices.push(midline-lineWidth,gl.drawingBufferHeight),vertices.push(midline+lineWidth,buttonSize),vertices.push(midline+lineWidth,gl.drawingBufferHeight),self.gearOffset=vertices.length/2;for(var i=0;i<=6;i++){var segmentTheta=i*kAnglePerGearSection;addGearSegment(segmentTheta,kOuterRadius),addGearSegment(segmentTheta+kOuterRimEndAngle,kOuterRadius),addGearSegment(segmentTheta+kInnerRimBeginAngle,kMiddleRadius),addGearSegment(segmentTheta+(kAnglePerGearSection-kInnerRimBeginAngle),kMiddleRadius),addGearSegment(segmentTheta+(kAnglePerGearSection-kOuterRimEndAngle),kOuterRadius)}self.gearVertexCount=vertices.length/2-self.gearOffset,self.arrowOffset=vertices.length/2;var angledLineWidth=lineWidth/Math.sin(45*DEG2RAD);addArrowVertex(0,buttonScale),addArrowVertex(buttonScale,0),addArrowVertex(buttonScale+angledLineWidth,angledLineWidth),addArrowVertex(angledLineWidth,buttonScale+angledLineWidth),addArrowVertex(angledLineWidth,buttonScale-angledLineWidth),addArrowVertex(0,buttonScale),addArrowVertex(buttonScale,2*buttonScale),addArrowVertex(buttonScale+angledLineWidth,2*buttonScale-angledLineWidth),addArrowVertex(angledLineWidth,buttonScale-angledLineWidth),addArrowVertex(0,buttonScale),addArrowVertex(angledLineWidth,buttonScale-lineWidth),addArrowVertex(kButtonWidthDp*dps,buttonScale-lineWidth),addArrowVertex(angledLineWidth,buttonScale+lineWidth),addArrowVertex(kButtonWidthDp*dps,buttonScale+lineWidth),self.arrowVertexCount=vertices.length/2-self.arrowOffset,gl.bindBuffer(gl.ARRAY_BUFFER,self.vertexBuffer),gl.bufferData(gl.ARRAY_BUFFER,new Float32Array(vertices),gl.STATIC_DRAW)})},CardboardUI.prototype.render=function(){var gl=this.gl,self=this,glState=[gl.CULL_FACE,gl.DEPTH_TEST,gl.BLEND,gl.SCISSOR_TEST,gl.STENCIL_TEST,gl.COLOR_WRITEMASK,gl.VIEWPORT,gl.CURRENT_PROGRAM,gl.ARRAY_BUFFER_BINDING];WGLUPreserveGLState(gl,glState,function(gl){gl.disable(gl.CULL_FACE),gl.disable(gl.DEPTH_TEST),gl.disable(gl.BLEND),gl.disable(gl.SCISSOR_TEST),gl.disable(gl.STENCIL_TEST),gl.colorMask(!0,!0,!0,!0),gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight),self.renderNoState()})},CardboardUI.prototype.renderNoState=function(){var gl=this.gl;gl.useProgram(this.program),gl.bindBuffer(gl.ARRAY_BUFFER,this.vertexBuffer),gl.enableVertexAttribArray(this.attribs.position),gl.vertexAttribPointer(this.attribs.position,2,gl.FLOAT,!1,8,0),gl.uniform4f(this.uniforms.color,1,1,1,1),Util.orthoMatrix(this.projMat,0,gl.drawingBufferWidth,0,gl.drawingBufferHeight,.1,1024),gl.uniformMatrix4fv(this.uniforms.projectionMat,!1,this.projMat),gl.drawArrays(gl.TRIANGLE_STRIP,0,4),gl.drawArrays(gl.TRIANGLE_STRIP,this.gearOffset,this.gearVertexCount),gl.drawArrays(gl.TRIANGLE_STRIP,this.arrowOffset,this.arrowVertexCount)},module.exports=CardboardUI},{"./deps/wglu-preserve-state.js":7,"./util.js":22}],6:[function(_dereq_,module,exports){function CardboardVRDisplay(){this.displayName="Cardboard VRDisplay (webvr-polyfill)",this.capabilities.hasOrientation=!0,this.capabilities.canPresent=!0,this.bufferScale_=WebVRConfig.BUFFER_SCALE,this.poseSensor_=new FusionPoseSensor,this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new Dpdb((!0),this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new DeviceInfo(this.dpdb_.getDeviceParams()),this.viewerSelector_=new ViewerSelector,this.viewerSelector_.on("change",this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),WebVRConfig.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new RotateInstructions),Util.isIOS()&&window.addEventListener("resize",this.onResize_.bind(this))}var CardboardDistorter=_dereq_("./cardboard-distorter.js"),CardboardUI=_dereq_("./cardboard-ui.js"),DeviceInfo=_dereq_("./device-info.js"),Dpdb=_dereq_("./dpdb/dpdb.js"),FusionPoseSensor=_dereq_("./sensor-fusion/fusion
}],dpi:[317.1,320.2],bw:3,ac:1e3},{type:"ios",rules:[{res:[640,1136]}],dpi:[317.1,320.2],bw:3,ac:1e3},{type:"ios",rules:[{res:[750,1334]}],dpi:326.4,bw:4,ac:1e3},{type:"ios",rules:[{res:[750,1334]}],dpi:326.4,bw:4,ac:1e3},{type:"ios",rules:[{res:[1242,2208]}],dpi:[453.6,458.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1242,2208]}],dpi:[453.6,458.4],bw:4,ac:1e3}]};module.exports=DPDB_CACHE},{}],12:[function(_dereq_,module,exports){function Dpdb(fetchOnline,onDeviceParamsUpdated){if(this.dpdb=DPDB_CACHE,this.recalculateDeviceParams_(),fetchOnline){this.onDeviceParamsUpdated=onDeviceParamsUpdated;var xhr=new XMLHttpRequest,obj=this;xhr.open("GET",ONLINE_DPDB_URL,!0),xhr.addEventListener("load",function(){obj.loading=!1,xhr.status>=200&&xhr.status<=299?(obj.dpdb=JSON.parse(xhr.response),obj.recalculateDeviceParams_()):console.error("Error loading online DPDB!")}),xhr.send()}}function DeviceParams(params){this.xdpi=params.xdpi,this.ydpi=params.ydpi,this.bevelMm=params.bevelMm}var DPDB_CACHE=_dereq_("./dpdb-cache.js"),Util=_dereq_("../util.js"),ONLINE_DPDB_URL="https://storage.googleapis.com/cardboard-dpdb/dpdb.json";Dpdb.prototype.getDeviceParams=function(){return this.deviceParams},Dpdb.prototype.recalculateDeviceParams_=function(){var newDeviceParams=this.calcDeviceParams_();newDeviceParams?(this.deviceParams=newDeviceParams,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},Dpdb.prototype.calcDeviceParams_=function(){var db=this.dpdb;if(!db)return console.error("DPDB not available."),null;if(1!=db.format)return console.error("DPDB has unexpected format version."),null;if(!db.devices||!db.devices.length)return console.error("DPDB does not have a devices section."),null;var userAgent=navigator.userAgent||navigator.vendor||window.opera,width=Util.getScreenWidth(),height=Util.getScreenHeight();if(!db.devices)return console.error("DPDB has no devices section."),null;for(var i=0;i<db.devices.length;i++){var device=db.devices[i];if(device.rules)if("ios"==device.type||"android"==device.type){if(Util.isIOS()==("ios"==device.type)){for(var matched=!1,j=0;j<device.rules.length;j++){var rule=device.rules[j];if(this.matchRule_(rule,userAgent,width,height)){matched=!0;break}}if(matched){var xdpi=device.dpi[0]||device.dpi,ydpi=device.dpi[1]||device.dpi;return new DeviceParams({xdpi:xdpi,ydpi:ydpi,bevelMm:device.bw})}}}else console.warn("Device["+i+"] has invalid type.");else console.warn("Device["+i+"] has no rules section.")}return console.warn("No DPDB device match."),null},Dpdb.prototype.matchRule_=function(rule,ua,screenWidth,screenHeight){if(!rule.ua&&!rule.res)return!1;if(rule.ua&&ua.indexOf(rule.ua)<0)return!1;if(rule.res){if(!rule.res[0]||!rule.res[1])return!1;var resX=rule.res[0],resY=rule.res[1];if(Math.min(screenWidth,screenHeight)!=Math.min(resX,resY)||Math.max(screenWidth,screenHeight)!=Math.max(resX,resY))return!1}return!0},module.exports=Dpdb},{"../util.js":22,"./dpdb-cache.js":11}],13:[function(_dereq_,module,exports){var Util=_dereq_("./util.js"),WebVRPolyfill=_dereq_("./webvr-polyfill.js").WebVRPolyfill;window.WebVRConfig=Util.extend({FORCE_ENABLE_VR:!1,K_FILTER:.98,PREDICTION_TIME_S:.04,TOUCH_PANNER_DISABLED:!0,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,MOUSE_KEYBOARD_CONTROLS_DISABLED:!1,DEFER_INITIALIZATION:!1,ENABLE_DEPRECATED_API:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1,ALWAYS_APPEND_POLYFILL_DISPLAY:!1},window.WebVRConfig),window.WebVRConfig.DEFER_INITIALIZATION?window.InitializeWebVRPolyfill=function(){new WebVRPolyfill}:new WebVRPolyfill},{"./util.js":22,"./webvr-polyfill.js":25}],14:[function(_dereq_,module,exports){var MathUtil=window.MathUtil||{};MathUtil.degToRad=Math.PI/180,MathUtil.radToDeg=180/Math.PI,MathUtil.Vector2=function(x,y){this.x=x||0,this.y=y||0},MathUtil.Vector2.prototype={constructor:MathUtil.Vector2,set:function(x,y){return this.x=x,this.y=y,this},copy:function(v){return this.x=v.x,this.y=v.y,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this}},MathUtil.Vect
},module.exports=RotateInstructions},{"./util.js":22}],17:[function(_dereq_,module,exports){function ComplementaryFilter(kFilter){this.kFilter=kFilter,this.currentAccelMeasurement=new SensorSample,this.currentGyroMeasurement=new SensorSample,this.previousGyroMeasurement=new SensorSample,Util.isIOS()?this.filterQ=new MathUtil.Quaternion((-1),0,0,1):this.filterQ=new MathUtil.Quaternion(1,0,0,1),this.previousFilterQ=new MathUtil.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new MathUtil.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new MathUtil.Vector3,this.measuredGravity=new MathUtil.Vector3,this.gyroIntegralQ=new MathUtil.Quaternion}var SensorSample=_dereq_("./sensor-sample.js"),MathUtil=_dereq_("../math-util.js"),Util=_dereq_("../util.js");ComplementaryFilter.prototype.addAccelMeasurement=function(vector,timestampS){this.currentAccelMeasurement.set(vector,timestampS)},ComplementaryFilter.prototype.addGyroMeasurement=function(vector,timestampS){this.currentGyroMeasurement.set(vector,timestampS);var deltaT=timestampS-this.previousGyroMeasurement.timestampS;Util.isTimestampDeltaValid(deltaT)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},ComplementaryFilter.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var deltaT=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,gyroDeltaQ=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,deltaT);this.gyroIntegralQ.multiply(gyroDeltaQ),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(gyroDeltaQ);var invFilterQ=new MathUtil.Quaternion;invFilterQ.copy(this.filterQ),invFilterQ.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(invFilterQ),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var deltaQ=new MathUtil.Quaternion;deltaQ.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),deltaQ.inverse(),Util.isDebug()&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",MathUtil.radToDeg*Util.getQuaternionAngle(deltaQ),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var targetQ=new MathUtil.Quaternion;targetQ.copy(this.filterQ),targetQ.multiply(deltaQ),this.filterQ.slerp(targetQ,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},ComplementaryFilter.prototype.getOrientation=function(){return this.filterQ},ComplementaryFilter.prototype.accelToQuaternion_=function(accel){var normAccel=new MathUtil.Vector3;normAccel.copy(accel),normAccel.normalize();var quat=new MathUtil.Quaternion;return quat.setFromUnitVectors(new MathUtil.Vector3(0,0,(-1)),normAccel),quat.inverse(),quat},ComplementaryFilter.prototype.gyroToQuaternionDelta_=function(gyro,dt){var quat=new MathUtil.Quaternion,axis=new MathUtil.Vector3;return axis.copy(gyro),axis.normalize(),quat.setFromAxisAngle(axis,gyro.length()*dt),quat},module.exports=ComplementaryFilter},{"../math-util.js":14,"../util.js":22,"./sensor-sample.js":20}],18:[function(_dereq_,module,exports){function FusionPoseSensor(){this.deviceId="webvr-polyfill:fused",this.deviceName="VR Position Device (webvr-polyfill:fused)",this.accelerometer=new MathUtil.Vector3,this.gyroscope=new MathUtil.Vector3,this.start(),this.filter=new ComplementaryFilter(WebVRConfig.K_FILTER),this.posePredictor=new PosePredictor(WebVRConfig.PREDICTION_TIME_S),this.touchPanner=new TouchPanner,this.filterToWorldQ=new MathUtil.Quaternion,Util.isIOS()?this.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new MathUtil.Quaternion,this.worldToScreenQ=new MathUtil.Quaternion,this.originalPoseAdjust
"depthNear"in window.VRDisplay.prototype||(window.VRDisplay.prototype.depthNear=.01),"depthFar"in window.VRDisplay.prototype||(window.VRDisplay.prototype.depthFar=1e4),window.VRDisplay.prototype.getFrameData=function(frameData){return Util.frameDataFromPose(frameData,this.getPose(),this)})}var Util=_dereq_("./util.js"),CardboardVRDisplay=_dereq_("./cardboard-vr-display.js"),MouseKeyboardVRDisplay=_dereq_("./mouse-keyboard-vr-display.js"),VRDisplay=_dereq_("./base.js").VRDisplay,VRFrameData=_dereq_("./base.js").VRFrameData,HMDVRDevice=_dereq_("./base.js").HMDVRDevice,PositionSensorVRDevice=_dereq_("./base.js").PositionSensorVRDevice,VRDisplayHMDDevice=_dereq_("./display-wrappers.js").VRDisplayHMDDevice,VRDisplayPositionSensorDevice=_dereq_("./display-wrappers.js").VRDisplayPositionSensorDevice;WebVRPolyfill.prototype.isWebVRAvailable=function(){return"getVRDisplays"in navigator},WebVRPolyfill.prototype.isDeprecatedWebVRAvailable=function(){return"getVRDevices"in navigator||"mozGetVRDevices"in navigator},WebVRPolyfill.prototype.populateDevices=function(){if(!this.devicesPopulated){var vrDisplay=null;this.isCardboardCompatible()&&(vrDisplay=new CardboardVRDisplay,this.displays.push(vrDisplay),WebVRConfig.ENABLE_DEPRECATED_API&&(this.devices.push(new VRDisplayHMDDevice(vrDisplay)),this.devices.push(new VRDisplayPositionSensorDevice(vrDisplay)))),this.isMobile()||WebVRConfig.MOUSE_KEYBOARD_CONTROLS_DISABLED||(vrDisplay=new MouseKeyboardVRDisplay,this.displays.push(vrDisplay),WebVRConfig.ENABLE_DEPRECATED_API&&(this.devices.push(new VRDisplayHMDDevice(vrDisplay)),this.devices.push(new VRDisplayPositionSensorDevice(vrDisplay)))),this.devicesPopulated=!0}},WebVRPolyfill.prototype.enablePolyfill=function(){navigator.getVRDisplays=this.getVRDisplays.bind(this),window.VRDisplay=VRDisplay;var self=this;Object.defineProperty(navigator,"vrEnabled",{get:function(){return self.isCardboardCompatible()&&(self.isFullScreenAvailable()||Util.isIOS())}}),!1 in window&&(window.VRFrameData=VRFrameData)},WebVRPolyfill.prototype.enableDeprecatedPolyfill=function(){navigator.getVRDevices=this.getVRDevices.bind(this),window.HMDVRDevice=HMDVRDevice,window.PositionSensorVRDevice=PositionSensorVRDevice},WebVRPolyfill.prototype.getVRDisplays=function(){this.populateDevices();var polyfillDisplays=this.displays;return this.nativeWebVRAvailable?this.nativeGetVRDisplaysFunc.call(navigator).then(function(nativeDisplays){return WebVRConfig.ALWAYS_APPEND_POLYFILL_DISPLAY?nativeDisplays.concat(polyfillDisplays):nativeDisplays.length>0?nativeDisplays:polyfillDisplays}):new Promise(function(resolve,reject){try{resolve(polyfillDisplays)}catch(e){reject(e)}})},WebVRPolyfill.prototype.getVRDevices=function(){console.warn("getVRDevices is deprecated. Please update your code to use getVRDisplays instead.");var self=this;return new Promise(function(resolve,reject){try{if(!self.devicesPopulated){if(self.nativeWebVRAvailable)return navigator.getVRDisplays(function(displays){for(var i=0;i<displays.length;++i)self.devices.push(new VRDisplayHMDDevice(displays[i])),self.devices.push(new VRDisplayPositionSensorDevice(displays[i]));self.devicesPopulated=!0,resolve(self.devices)},reject);if(self.nativeLegacyWebVRAvailable)return(navigator.getVRDDevices||navigator.mozGetVRDevices)(function(devices){for(var i=0;i<devices.length;++i)devices[i]instanceof HMDVRDevice&&self.devices.push(devices[i]),devices[i]instanceof PositionSensorVRDevice&&self.devices.push(devices[i]);self.devicesPopulated=!0,resolve(self.devices)},reject)}self.populateDevices(),resolve(self.devices)}catch(e){reject(e)}})},WebVRPolyfill.prototype.isMobile=function(){return/Android/i.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)},WebVRPolyfill.prototype.isCardboardCompatible=function(){return this.isMobile()||WebVRConfig.FORCE_ENABLE_VR},WebVRPolyfill.prototype.isFullScreenAvailable=function(){return document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||!1},module.exports.WebVRPolyfill=WebVRPolyfill},{"./base.js":3,"./cardboard-vr-display.js":6,".