Skip to content

Commit

Permalink
Update: New Box-branding for Oculus Touch models (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiiBond authored and tonyjin committed Apr 6, 2017
1 parent 897b858 commit 59880de
Show file tree
Hide file tree
Showing 31 changed files with 11,103 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const webpackConfig = require('./webpack.karma.config');

const DOC_STATIC_ASSETS_VERSION = '0.114.0';
const MEDIA_STATIC_ASSETS_VERSION = '0.112.0';
const MODEL3D_STATIC_ASSETS_VERSION = '0.114.0';
const MODEL3D_STATIC_ASSETS_VERSION = '0.115.0';
const SWF_STATIC_ASSETS_VERSION = '0.112.0';
const TEXT_STATIC_ASSETS_VERSION = '0.114.0';

Expand Down
2 changes: 1 addition & 1 deletion src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const X_REP_HINT_VIDEO_MP4 = '[mp4]';
// whenever a file in that third party directory is updated
export const DOC_STATIC_ASSETS_VERSION = '0.114.0';
export const MEDIA_STATIC_ASSETS_VERSION = '0.112.0';
export const MODEL3D_STATIC_ASSETS_VERSION = '0.114.0';
export const MODEL3D_STATIC_ASSETS_VERSION = '0.115.0';
export const SWF_STATIC_ASSETS_VERSION = '0.112.0';
export const TEXT_STATIC_ASSETS_VERSION = '0.114.0';

Expand Down
28 changes: 21 additions & 7 deletions src/lib/viewers/box3d/Box3DRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class Box3DRenderer extends EventEmitter {
this.on(EVENT_TRIGGER_RENDER, this.handleOnRender);
this.defaultCameraPosition = PREVIEW_CAMERA_POSITION;
this.defaultCameraQuaternion = PREVIEW_CAMERA_QUATERNION;
this.vrGamepadLoadPromises = {};
this.vrCommonLoadPromise = null;
}

/**
Expand Down Expand Up @@ -405,7 +407,9 @@ class Box3DRenderer extends EventEmitter {

const onGamepadFound = (gamepad) => {
let controllerName = null;
let commonEntities = null;
if (gamepad.id.indexOf('Oculus') > -1) {
commonEntities = 'oculusTouchCommon';
switch (gamepad.hand) {
case 'left':
controllerName = OCULUS_TOUCH_LEFT;
Expand All @@ -416,15 +420,25 @@ class Box3DRenderer extends EventEmitter {
}
} else if (gamepad.id.indexOf('OpenVR') > -1) {
controllerName = HTC_VIVE;
// Both left and right Vive controllers use the same model so, if the promise
// already exists, use it.
if (this.vrGamepadLoadPromise) {
this.vrGamepadLoadPromise.then(onGamepadModelLoad);
return;
}
// If there are common entities for left-right controllers, load them first.
if (!this.vrCommonLoadPromise) {
if (commonEntities) {
this.vrCommonLoadPromise = this.box3d.addRemoteEntities(
`${this.staticBaseURI}third-party/model3d/${MODEL3D_STATIC_ASSETS_VERSION}/WebVR/${commonEntities}/entities.json`, { isExternal: true });
} else {
this.vrCommonLoadPromise = Promise.resolve();
}
}
this.vrGamepadLoadPromise = this.box3d.addRemoteEntities(`${this.staticBaseURI}third-party/model3d/${MODEL3D_STATIC_ASSETS_VERSION}/WebVR/${controllerName}/entities.json`, { isExternal: true });
this.vrGamepadLoadPromise.then(onGamepadModelLoad);
if (!this.vrGamepadLoadPromises[controllerName]) {
this.vrCommonLoadPromise.then(() => {
this.vrGamepadLoadPromises[controllerName] = this.box3d.addRemoteEntities(
`${this.staticBaseURI}third-party/model3d/${MODEL3D_STATIC_ASSETS_VERSION}/WebVR/${controllerName}/entities.json`, { isExternal: true });
this.vrGamepadLoadPromises[controllerName].then(onGamepadModelLoad);
});
} else {
this.vrGamepadLoadPromises[controllerName].then(onGamepadModelLoad);
}
};

const handController = controller.addComponent('motion_gamepad_device', { handPreference: handedness });
Expand Down
Binary file added src/third-party/model3d/0.115.0/HDR_Env0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/third-party/model3d/0.115.0/HDR_Env1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/third-party/model3d/0.115.0/HDR_Env2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions src/third-party/model3d/0.115.0/WebVR/VRConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
window.WebVRConfig = {
// Forces availability of VR mode, even for non-mobile devices.
FORCE_ENABLE_VR: false,

// Complementary filter coefficient. 0 for accelerometer, 1 for gyro.
K_FILTER: 0.98,

// How far into the future to predict during fast motion (in seconds).
PREDICTION_TIME_S: 0.040,

// Flag to disable touch panner. In case you have your own touch controls.
TOUCH_PANNER_DISABLED: false,

// Flag to disabled the UI in VR Mode.
CARDBOARD_UI_DISABLED: false, // Default: false

// Flag to disable the instructions to rotate your device.
ROTATE_INSTRUCTIONS_DISABLED: false, // Default: false.

// Enable yaw panning only, disabling roll and pitch. This can be useful
// for panoramas with nothing interesting above or below.
YAW_ONLY: false,

// To disable keyboard and mouse controls, if you want to use your own
// implementation.
MOUSE_KEYBOARD_CONTROLS_DISABLED: true,

// Prevent the polyfill from initializing immediately. Requires the app
// to call InitializeWebVRPolyfill() before it can be used.
DEFER_INITIALIZATION: false,

// Enable the deprecated version of the API (navigator.getVRDevices).
ENABLE_DEPRECATED_API: false,

// Scales the recommended buffer size reported by WebVR, which can improve
// performance.
// UPDATE(2016-05-03): Setting this to 0.5 by default since 1.0 does not
// perform well on many mobile devices.
BUFFER_SCALE: 0.5,

// Allow VRDisplay.submitFrame to change gl bindings, which is more
// efficient if the application code will re-bind its resources on the
// next frame anyway. This has been seen to cause rendering glitches with
// THREE.js.
// Dirty bindings include: gl.FRAMEBUFFER_BINDING, gl.CURRENT_PROGRAM,
// gl.ARRAY_BUFFER_BINDING, gl.ELEMENT_ARRAY_BUFFER_BINDING,
// and gl.TEXTURE_BINDING_2D for texture unit 0.
DIRTY_SUBMIT_FRAME_BINDINGS: false
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 59880de

Please sign in to comment.