Skip to content

Commit

Permalink
Merge pull request #1153 from exokitxr/examples-fix
Browse files Browse the repository at this point in the history
WebXR examples api update
  • Loading branch information
Avaer Kazmer authored Jun 1, 2019
2 parents 2cba31a + d770b5a commit e060111
Show file tree
Hide file tree
Showing 27 changed files with 59 additions and 90 deletions.
3 changes: 2 additions & 1 deletion examples/avatar_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,8 @@ <h1>avatar_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/bow_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,8 @@ <h1>bow_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/controllers_xr.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ <h1>shooter_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/exobot.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ <h1>exobot</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
59 changes: 0 additions & 59 deletions examples/fakeDisplay.js

This file was deleted.

3 changes: 2 additions & 1 deletion examples/geometry_client.html
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,8 @@
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/geometry_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,8 @@
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/graffiti_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ <h1>graffiti_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/hands_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ <h1>hands_ml.html example</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/hello_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@ <h1>hello_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/hello_xr.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;
renderer.setSize(width * 2, height);
Expand Down
3 changes: 2 additions & 1 deletion examples/imagetracking_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ <h1>imagetracking_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/meshing_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ <h1>meshing_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/meshing_raw_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/microphone.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ <h1>microphone</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/minimap_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ <h1>minimap_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/paint_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,8 @@ <h1>paint_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/pathfinding_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@ <h1>pathfinding_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/planes_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ <h1>planes_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/radar_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ <h1>radar_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
7 changes: 4 additions & 3 deletions examples/realitytab.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
// const width = viewport.width;
const height = viewport.height;
const fullWidth = (() => {
let result = 0;
for (let i = 0; i < frame.views.length; i++) {
result += session.baseLayer.getViewport(frame.views[i]).width;
for (let i = 0; i < views.length; i++) {
result += session.baseLayer.getViewport(views[i]).width;
}
return result;
})();
Expand Down
11 changes: 7 additions & 4 deletions examples/realitytabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,9 @@
const moves = [null, null];

window.addEventListener('click', () => {
renderer.domElement.requestPointerLock();
if (fakeXrDisplay) {
renderer.domElement.requestPointerLock();
}
});
window.addEventListener('mousedown', e => {
if (window.document.pointerLockElement) {
Expand Down Expand Up @@ -2728,12 +2730,13 @@
frameOfReferenceType: 'stage',
});

const viewport = session.renderState.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.renderState.baseLayer.getViewport(views[0]);
const height = viewport.height;
const fullWidth = (() => {
let result = 0;
for (let i = 0; i < frame.views.length; i++) {
result += session.renderState.baseLayer.getViewport(frame.views[i]).width;
for (let i = 0; i < views.length; i++) {
result += session.renderState.baseLayer.getViewport(views[i]).width;
}
return result;
})();
Expand Down
3 changes: 2 additions & 1 deletion examples/shooter_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ <h1>shooter_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/sword_ml.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ <h1>sword_ml</h1>
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/text.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;

Expand Down
3 changes: 2 additions & 1 deletion examples/trackers.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
frameOfReferenceType: 'stage',
});

const viewport = session.baseLayer.getViewport(frame.views[0]);
const {views} = frame.getViewerPose();
const viewport = session.baseLayer.getViewport(views[0]);
const width = viewport.width;
const height = viewport.height;
renderer.setSize(width * 2, height);
Expand Down

0 comments on commit e060111

Please sign in to comment.