tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

VRSimulationDriver.js (1590B)


      1 var VRServiceTest;
      2 var vrMockDisplay;
      3 
      4 var VRSimulationDriver = (function() {
      5 "use strict";
      6 
      7 var AttachWebVRDisplay = function() {
      8  if (vrMockDisplay) {
      9    // Avoid creating multiple displays
     10    return Promise.resolve(vrMockDisplay);
     11  }
     12  var promise = VRServiceTest.attachVRDisplay("VRDisplayTest");
     13  promise.then(function (display) {
     14    vrMockDisplay = display;
     15  });
     16 
     17  return promise;
     18 };
     19 
     20 var SetVRDisplayPose = function(position,
     21                                linearVelocity, linearAcceleration,
     22                                orientation, angularVelocity,
     23                                angularAcceleration) {
     24  vrMockDisplay.setPose(position, linearVelocity, linearAcceleration,
     25                        orientation, angularVelocity, angularAcceleration);
     26 };
     27 
     28 var SetEyeResolution = function(width, height) {
     29  vrMockDisplay.setEyeResolution(width, height);
     30 }
     31 
     32 var SetEyeParameter = function(eye, offsetX, offsetY, offsetZ,
     33                               upDegree, rightDegree, downDegree, leftDegree) {
     34  vrMockDisplay.setEyeParameter(eye, offsetX, offsetY, offsetZ, upDegree, rightDegree,
     35                                downDegree, leftDegree);
     36 }
     37 
     38 var SetMountState = function(isMounted) {
     39  vrMockDisplay.setMountState(isMounted);
     40 }
     41 
     42 var UpdateVRDisplay = function() {
     43  vrMockDisplay.update();
     44 }
     45 
     46 var API = {
     47  AttachWebVRDisplay: AttachWebVRDisplay,
     48  SetVRDisplayPose: SetVRDisplayPose,
     49  SetEyeResolution: SetEyeResolution,
     50  SetEyeParameter: SetEyeParameter,
     51  SetMountState: SetMountState,
     52  UpdateVRDisplay: UpdateVRDisplay,
     53 
     54  none: false
     55 };
     56 
     57 return API;
     58 
     59 }());