Skip to content

Commit

Permalink
Hack
Browse files Browse the repository at this point in the history
  • Loading branch information
Avaer Kazmer committed Sep 30, 2019
1 parent 24e2724 commit 88c9e38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ew.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const {_makeNullPromise} = utils;

GlobalContext.args = {};
GlobalContext.version = '';
window.GlobalContext = GlobalContext;

const args = {};
core.setArgs(args);
Expand Down Expand Up @@ -111,7 +112,6 @@ const xrState = (() => {
return result;
})(),
axes: _makeTypedArray(Float32Array, 10),
bones: _makeTypedArray(Float32Array, 31*16),
});
result.gamepads = (() => {
const result = Array(2);
Expand Down Expand Up @@ -464,8 +464,11 @@ const _tickAnimationFrames = () => {
}
}
};
window.gamepads = Array(2).fill(null);
window.session = null;
core.animate = (timestamp, frame, referenceSpace) => {
const session = core.getSession();
window.session = session;
if (session) {
// console.log('animate session', session, frame, referenceSpace);
// debugger;
Expand All @@ -490,6 +493,7 @@ core.animate = (timestamp, frame, referenceSpace) => {

let pose, gamepad;
if (inputSource && (pose = frame.getPose(inputSource.targetRaySpace, referenceSpace)) && (gamepad = inputSource.gamepad || gamepads[i])) {
window.gamepads[i] = gamepad;
const {transform} = pose;
const {position, orientation, matrix} = transform;
if (position) { // new WebXR api
Expand Down

0 comments on commit 88c9e38

Please sign in to comment.