Skip to content

Commit

Permalink
renames headModel/eyeLevel to kebab-case
Browse files Browse the repository at this point in the history
  • Loading branch information
mprafson authored and jsantell committed Jul 16, 2018
1 parent 2c56556 commit ae61c1f
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/magic-window.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@

session.baseLayer = new XRWebGLLayer(session, gl);

session.requestFrameOfReference('eyeLevel').then((frameOfRef) => {
session.requestFrameOfReference('eye-level').then((frameOfRef) => {
// Since we're dealing with multple sessions now we need to track
// which XRFrameOfReference is associated with which XRSession.
if (session.exclusive) {
Expand Down
2 changes: 1 addition & 1 deletion examples/mirroring.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
outputCanvas.width = session.baseLayer.framebufferWidth / 2;
outputCanvas.height = session.baseLayer.framebufferHeight;

session.requestFrameOfReference('eyeLevel').then((frameOfRef) => {
session.requestFrameOfReference('eye-level').then((frameOfRef) => {
xrFrameOfRef = frameOfRef;

session.requestAnimationFrame(onXRFrame);
Expand Down
4 changes: 2 additions & 2 deletions examples/xr-presentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@
session.baseLayer = new XRWebGLLayer(session, gl);

// Get a frame of reference, which is required for querying poses. In
// this case an 'eyeLevel' frame of reference means that all poses will
// this case an 'eye-level' frame of reference means that all poses will
// be relative to the location where the XRDevice was first detected.
session.requestFrameOfReference('eyeLevel').then((frameOfRef) => {
session.requestFrameOfReference('eye-level').then((frameOfRef) => {
xrFrameOfRef = frameOfRef;

// Inform the session that we're ready to begin drawing.
Expand Down
18 changes: 9 additions & 9 deletions src/api/XRFrameOfReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as mat4 from 'gl-matrix/src/gl-matrix/mat4';
const PRIVATE = Symbol('@@webxr-polyfill/XRFrameOfReference');
const DEFAULT_EMULATION_HEIGHT = 1.6;

export const XRFrameOfReferenceTypes = ['headModel', 'eyeLevel', 'stage'];
export const XRFrameOfReferenceTypes = ['head-model', 'eye-level', 'stage'];

export const XRFrameOfReferenceOptions = Object.freeze({
disableStageEmulation: false,
Expand All @@ -30,7 +30,7 @@ export default class XRFrameOfReference extends XRCoordinateSystem {
/**
* Optionally takes a `transform` from a polyfill's requestFrameOfReferenceMatrix
* so polyfill's can provide their own transforms for stage (or if they
* wanted to override eyeLevel/headModel).
* wanted to override eye-level/head-model).
*
* @param {PolyfilledXRDevice} polyfill
* @param {XRFrameOfReferenceType} type
Expand Down Expand Up @@ -111,7 +111,7 @@ export default class XRFrameOfReference extends XRCoordinateSystem {
*/
transformBasePoseMatrix(out, pose) {
// If we have a transform, it was provided by the polyfill
// (probably "stage" type, but a polyfill could provide its own headModel)
// (probably "stage" type, but a polyfill could provide its own head-model)
// or we could be emulating a stage, in which case a transform
// was created in the constructor. Either way, if we have a transform, use it.
if (this[PRIVATE].transform) {
Expand All @@ -120,18 +120,18 @@ export default class XRFrameOfReference extends XRCoordinateSystem {
}

switch (this.type) {
// For 'headModel' just strip out the translation
case 'headModel':
// For 'head-model' just strip out the translation
case 'head-model':
if (out !== pose) {
mat4.copy(out, pose);
}

out[12] = out[13] = out[14] = 0;
return;

// For 'eyeLevel', assume the pose given as eye level,
// For 'eye-level', assume the pose given as eye level,
// so no transformation
case 'eyeLevel':
case 'eye-level':
if (out !== pose) {
mat4.copy(out, pose);
}
Expand Down Expand Up @@ -160,7 +160,7 @@ export default class XRFrameOfReference extends XRCoordinateSystem {
// If we have a head model, invert the view matrix
// to strip the translation and invert it back to a
// view matrix
else if (this.type === 'headModel') {
else if (this.type === 'head-model') {
mat4.invert(out, view);
out[12] = 0;
out[13] = 0;
Expand All @@ -169,7 +169,7 @@ export default class XRFrameOfReference extends XRCoordinateSystem {
return out;
}
// Otherwise don't transform the view matrix at all
// (like for `eyeLevel` frame of references.
// (like for `eye-level` frame of references.
else {
mat4.copy(out, view);
}
Expand Down
2 changes: 1 addition & 1 deletion test/api/test-xr-device-pose.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('API - XRDevicePose', () => {
beforeEach(async function () {
device = createXRDevice({ hasPosition: true });
session = await device.requestSession({ immersive: true });
ref = await session.requestFrameOfReference('eyeLevel');
ref = await session.requestFrameOfReference('eye-level');
});

it('gets an updated poseModelMatrix every frame', async function () {
Expand Down
16 changes: 8 additions & 8 deletions test/api/test-xr-frame-of-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('API - XRFrameOfReference', () => {
const session = await device.requestSession({ immersive: true });

polyfill.requestFrameOfReferenceTransform = async function (type, options) {
assert.equal(type, 'headModel');
assert.equal(type, 'head-model');
return new Float32Array([
1, 0, 0, 0,
0, 1, 0, 0,
Expand All @@ -45,7 +45,7 @@ describe('API - XRFrameOfReference', () => {
]);
};

const frameOfRef = await session.requestFrameOfReference('headModel');
const frameOfRef = await session.requestFrameOfReference('head-model');

const pose = mat4.identity(new Float32Array(16));
// Set position to <1, 1, 1>
Expand Down Expand Up @@ -83,14 +83,14 @@ describe('API - XRFrameOfReference', () => {
};

return new Promise((resolve, reject) => {
session.requestFrameOfReference('headModel').then(reject, resolve);
session.requestFrameOfReference('head-model').then(reject, resolve);
});
});

it('`emulatedHeight` is 0 when using non-stage reference', async function () {
const device = createXRDevice();
const session = await device.requestSession({ immersive: true });
const ref = await session.requestFrameOfReference('headModel');
const ref = await session.requestFrameOfReference('head-model');
assert.equal(ref.emulatedHeight, 0);
});

Expand Down Expand Up @@ -161,15 +161,15 @@ describe('API - XRFrameOfReference', () => {
]);

const data = [
// headModel should strip out only translation
['headModel', [
// head-model should strip out only translation
['head-model', [
1, 0, 0, 0,
0, -1, 0, 0,
0, 0, -1, 0,
0, 0, 0, 1
]],
// eyeLevel shouldn't modify the pose at all
['eyeLevel', [
// eye-level shouldn't modify the pose at all
['eye-level', [
1, 0, 0, 0,
0, -1, 0, 0,
0, 0, -1, 0,
Expand Down
2 changes: 1 addition & 1 deletion test/api/test-xr-presentation-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('API - XRPresentationFrame', () => {
beforeEach(async function () {
device = createXRDevice();
session = await device.requestSession({ immersive: true });
ref = await session.requestFrameOfReference('eyeLevel');
ref = await session.requestFrameOfReference('eye-level');
});

it('has two views', done => {
Expand Down
2 changes: 1 addition & 1 deletion test/api/test-xr-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('API - XRSession', () => {
const device = new XRDevice(polyfill);
const session = await device.requestSession({ immersive: true });

for (const type of ['headModel', 'eyeLevel', 'stage']) {
for (const type of ['head-model', 'eye-level', 'stage']) {
const frameOfRef = await session.requestFrameOfReference(type);
assert.instanceOf(frameOfRef, XRFrameOfReference);
}
Expand Down
2 changes: 1 addition & 1 deletion test/api/test-xr-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('API - XRView', () => {
polyfill = new WebVRDevice(global, new MockVRDisplay(global));
device = new XRDevice(polyfill);
session = await device.requestSession({ immersive: true });
ref = await session.requestFrameOfReference('eyeLevel');
ref = await session.requestFrameOfReference('eye-level');
});

it('has `eye` property of left and right', async function () {
Expand Down

0 comments on commit ae61c1f

Please sign in to comment.