diff --git a/examples/magic-window.html b/examples/magic-window.html
index c811874..d32b7fc 100644
--- a/examples/magic-window.html
+++ b/examples/magic-window.html
@@ -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) {
diff --git a/examples/mirroring.html b/examples/mirroring.html
index ead3833..3bc7308 100644
--- a/examples/mirroring.html
+++ b/examples/mirroring.html
@@ -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);
diff --git a/examples/xr-presentation.html b/examples/xr-presentation.html
index 3f05f0c..227ea23 100644
--- a/examples/xr-presentation.html
+++ b/examples/xr-presentation.html
@@ -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.
diff --git a/src/api/XRFrameOfReference.js b/src/api/XRFrameOfReference.js
index a8a7ee4..d6d2d79 100644
--- a/src/api/XRFrameOfReference.js
+++ b/src/api/XRFrameOfReference.js
@@ -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,
@@ -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
@@ -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) {
@@ -120,8 +120,8 @@ 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);
}
@@ -129,9 +129,9 @@ export default class XRFrameOfReference extends XRCoordinateSystem {
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);
}
@@ -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;
@@ -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);
}
diff --git a/test/api/test-xr-device-pose.js b/test/api/test-xr-device-pose.js
index 58298f2..3657c13 100644
--- a/test/api/test-xr-device-pose.js
+++ b/test/api/test-xr-device-pose.js
@@ -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 () {
diff --git a/test/api/test-xr-frame-of-reference.js b/test/api/test-xr-frame-of-reference.js
index 55ca1bd..484e39f 100644
--- a/test/api/test-xr-frame-of-reference.js
+++ b/test/api/test-xr-frame-of-reference.js
@@ -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,
@@ -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>
@@ -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);
});
@@ -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,
diff --git a/test/api/test-xr-presentation-frame.js b/test/api/test-xr-presentation-frame.js
index b14cfcc..fb550bc 100644
--- a/test/api/test-xr-presentation-frame.js
+++ b/test/api/test-xr-presentation-frame.js
@@ -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 => {
diff --git a/test/api/test-xr-session.js b/test/api/test-xr-session.js
index 30f7931..35e81c3 100644
--- a/test/api/test-xr-session.js
+++ b/test/api/test-xr-session.js
@@ -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);
}
diff --git a/test/api/test-xr-view.js b/test/api/test-xr-view.js
index 07dacdf..db78499 100644
--- a/test/api/test-xr-view.js
+++ b/test/api/test-xr-view.js
@@ -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 () {