Skip to content

Commit

Permalink
Leverage WebXR types in public API (playcanvas#6713)
Browse files Browse the repository at this point in the history
  • Loading branch information
willeastcott authored and slimbuck committed Jun 27, 2024
1 parent d7cf812 commit f9dba82
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 27 deletions.
11 changes: 7 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"README*.md"
],
"dependencies": {
"@types/webxr": "^0.5.15",
"@types/webxr": "^0.5.16",
"@webgpu/types": "^0.1.40"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/framework/app-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class AppBase extends EventHandler {
*
* @callback MakeTickCallback
* @param {number} [timestamp] - The timestamp supplied by requestAnimationFrame.
* @param {*} [frame] - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} [frame] - XRFrame from requestAnimationFrame callback.
* @returns {void}
*/

Expand Down Expand Up @@ -2110,7 +2110,7 @@ const makeTick = function (_app) {
const application = _app;
/**
* @param {number} [timestamp] - The timestamp supplied by requestAnimationFrame.
* @param {*} [frame] - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} [frame] - XRFrame from requestAnimationFrame callback.
*/
return function (timestamp, frame) {
if (!application.graphicsDevice)
Expand Down
2 changes: 1 addition & 1 deletion src/framework/input/element-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class ElementSelectEvent extends ElementInputEvent {
/**
* Create an instance of a ElementSelectEvent.
*
* @param {object} event - The XRInputSourceEvent that was originally raised.
* @param {XRInputSourceEvent} event - The XRInputSourceEvent that was originally raised.
* @param {import('../components/element/component.js').ElementComponent} element - The
* ElementComponent that this event was originally raised on.
* @param {import('../components/camera/component.js').CameraComponent} camera - The
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class XrAnchor extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class XrAnchors extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-hand.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class XrHand extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
4 changes: 2 additions & 2 deletions src/framework/xr/xr-hit-test-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class XrHitTestSource extends EventHandler {
* Create a new XrHitTestSource instance.
*
* @param {import('./xr-manager.js').XrManager} manager - WebXR Manager.
* @param {*} xrHitTestSource - XRHitTestSource object that is created by WebXR API.
* @param {XRHitTestSource} xrHitTestSource - XRHitTestSource object that is created by WebXR API.
* @param {boolean} transient - True if XRHitTestSource created for input source profile.
* @param {null|import('./xr-input-source.js').XrInputSource} inputSource - Input Source for which hit test is created for, or null.
* @ignore
Expand Down Expand Up @@ -127,7 +127,7 @@ class XrHitTestSource extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-hit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class XrHitTest extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-image-tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class XrImageTracking extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
7 changes: 3 additions & 4 deletions src/framework/xr/xr-input-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ class XrInputSource extends EventHandler {
* Create a new XrInputSource instance.
*
* @param {import('./xr-manager.js').XrManager} manager - WebXR Manager.
* @param {*} xrInputSource - [XRInputSource](https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource)
* object that is created by WebXR API.
* @param {XRInputSource} xrInputSource - A WebXR input source.
* @ignore
*/
constructor(manager, xrInputSource) {
Expand Down Expand Up @@ -328,7 +327,7 @@ class XrInputSource extends EventHandler {
/**
* XRInputSource object that is associated with this input source.
*
* @type {object}
* @type {XRInputSource}
*/
get inputSource() {
return this._xrInputSource;
Expand Down Expand Up @@ -469,7 +468,7 @@ class XrInputSource extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class XrInput extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-joint.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class XrJoint {
}

/**
* @param {*} pose - XRJointPose of this joint.
* @param {XRJointPose} pose - XRJointPose of this joint.
* @ignore
*/
update(pose) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-light-estimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class XrLightEstimation extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ class XrManager extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
*
* @returns {boolean} True if update was successful, false otherwise.
* @ignore
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-plane-detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class XrPlaneDetection extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-plane.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class XrPlane extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @ignore
*/
update(frame) {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-tracked-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class XrTrackedImage extends EventHandler {
_emulated = false;

/**
* @type {*}
* @type {XRPose|null}
* @ignore
*/
_pose = null;
Expand Down
2 changes: 1 addition & 1 deletion src/framework/xr/xr-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class XrViews extends EventHandler {
}

/**
* @param {*} frame - XRFrame from requestAnimationFrame callback.
* @param {XRFrame} frame - XRFrame from requestAnimationFrame callback.
* @param {XRView} xrView - XRView from WebXR API.
* @ignore
*/
Expand Down

0 comments on commit f9dba82

Please sign in to comment.