Merge pull request #15383 from ctrlaltdavid/M22196

Case 22196: HMD JSDoc update
This commit is contained in:
Shannon Romano 2019-04-29 13:05:32 -07:00 committed by GitHub
commit 9261df5c24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
//
// HMDScriptingInterface.h // HMDScriptingInterface.h
// interface/src/scripting // interface/src/scripting
// //
@ -25,7 +25,7 @@ class QScriptEngine;
#include <QReadWriteLock> #include <QReadWriteLock>
/**jsdoc /**jsdoc
* The HMD API provides access to the HMD used in VR display mode. * The <code>HMD</code> API provides access to the HMD used in VR display mode.
* *
* @namespace HMD * @namespace HMD
* *
@ -87,7 +87,7 @@ class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Depen
public: public:
/**jsdoc /**jsdoc
* Calculate the intersection of a ray with the HUD overlay. * Calculates the intersection of a ray with the HUD overlay.
* @function HMD.calculateRayUICollisionPoint * @function HMD.calculateRayUICollisionPoint
* @param {Vec3} position - The origin of the ray. * @param {Vec3} position - The origin of the ray.
* @param {Vec3} direction - The direction of the ray. * @param {Vec3} direction - The direction of the ray.
@ -115,7 +115,7 @@ public:
glm::vec3 calculateParabolaUICollisionPoint(const glm::vec3& position, const glm::vec3& velocity, const glm::vec3& acceleration, float& parabolicDistance) const; glm::vec3 calculateParabolaUICollisionPoint(const glm::vec3& position, const glm::vec3& velocity, const glm::vec3& acceleration, float& parabolicDistance) const;
/**jsdoc /**jsdoc
* Get the 2D HUD overlay coordinates of a 3D point on the HUD overlay. * Gets the 2D HUD overlay coordinates of a 3D point on the HUD overlay.
* 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay. * 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay.
* @function HMD.overlayFromWorldPoint * @function HMD.overlayFromWorldPoint
* @param {Vec3} position - The point on the HUD overlay in world coordinates. * @param {Vec3} position - The point on the HUD overlay in world coordinates.
@ -141,7 +141,7 @@ public:
Q_INVOKABLE glm::vec2 overlayFromWorldPoint(const glm::vec3& position) const; Q_INVOKABLE glm::vec2 overlayFromWorldPoint(const glm::vec3& position) const;
/**jsdoc /**jsdoc
* Get the 3D world coordinates of a 2D point on the HUD overlay. * Gets the 3D world coordinates of a 2D point on the HUD overlay.
* 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay. * 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay.
* @function HMD.worldPointFromOverlay * @function HMD.worldPointFromOverlay
* @param {Vec2} coordinates - The point on the HUD overlay in HUD coordinates. * @param {Vec2} coordinates - The point on the HUD overlay in HUD coordinates.
@ -150,7 +150,7 @@ public:
Q_INVOKABLE glm::vec3 worldPointFromOverlay(const glm::vec2& overlay) const; Q_INVOKABLE glm::vec3 worldPointFromOverlay(const glm::vec2& overlay) const;
/**jsdoc /**jsdoc
* Get the 2D point on the HUD overlay represented by given spherical coordinates. * Gets the 2D point on the HUD overlay represented by given spherical coordinates.
* 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay. * 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay.
* Spherical coordinates are polar coordinates in radians with <code>{ x: 0, y: 0 }</code> being the center of the HUD * Spherical coordinates are polar coordinates in radians with <code>{ x: 0, y: 0 }</code> being the center of the HUD
* overlay. * overlay.
@ -161,7 +161,7 @@ public:
Q_INVOKABLE glm::vec2 sphericalToOverlay(const glm::vec2 & sphericalPos) const; Q_INVOKABLE glm::vec2 sphericalToOverlay(const glm::vec2 & sphericalPos) const;
/**jsdoc /**jsdoc
* Get the spherical coordinates of a 2D point on the HUD overlay. * Gets the spherical coordinates of a 2D point on the HUD overlay.
* 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay. * 2D HUD overlay coordinates are pixels with the origin at the top left of the overlay.
* Spherical coordinates are polar coordinates in radians with <code>{ x: 0, y: 0 }</code> being the center of the HUD * Spherical coordinates are polar coordinates in radians with <code>{ x: 0, y: 0 }</code> being the center of the HUD
* overlay. * overlay.
@ -172,21 +172,21 @@ public:
Q_INVOKABLE glm::vec2 overlayToSpherical(const glm::vec2 & overlayPos) const; Q_INVOKABLE glm::vec2 overlayToSpherical(const glm::vec2 & overlayPos) const;
/**jsdoc /**jsdoc
* Recenter the HMD HUD to the current HMD position and orientation. * Recenters the HMD HUD to the current HMD position and orientation.
* @function HMD.centerUI * @function HMD.centerUI
*/ */
Q_INVOKABLE void centerUI(); Q_INVOKABLE void centerUI();
/**jsdoc /**jsdoc
* Get the name of the HMD audio input device. * Gets the name of the HMD audio input device.
* @function HMD.preferredAudioInput * @function HMD.preferredAudioInput
* @returns {string} The name of the HMD audio input device if in HMD mode, otherwise an empty string. * @returns {string} The name of the HMD audio input device if in HMD mode, otherwise an empty string.
*/ */
Q_INVOKABLE QString preferredAudioInput() const; Q_INVOKABLE QString preferredAudioInput() const;
/**jsdoc /**jsdoc
* Get the name of the HMD audio output device. * Gets the name of the HMD audio output device.
* @function HMD.preferredAudioOutput * @function HMD.preferredAudioOutput
* @returns {string} The name of the HMD audio output device if in HMD mode, otherwise an empty string. * @returns {string} The name of the HMD audio output device if in HMD mode, otherwise an empty string.
*/ */
@ -194,10 +194,10 @@ public:
/**jsdoc /**jsdoc
* Check whether there is an HMD available. * Checks whether there is an HMD available.
* @function HMD.isHMDAvailable * @function HMD.isHMDAvailable
* @param {string} [name=""] - The name of the HMD to check for, e.g., <code>"Oculus Rift"</code>. The name is the same as * @param {string} [name=""] - The name of the HMD to check for, e.g., <code>"Oculus Rift"</code>. The name is the same as
* may be displayed in Interface's "Display" menu. If no name is specified then any HMD matches. * may be displayed in Interface's "Display" menu. If no name is specified, then any HMD matches.
* @returns {boolean} <code>true</code> if an HMD of the specified <code>name</code> is available, otherwise * @returns {boolean} <code>true</code> if an HMD of the specified <code>name</code> is available, otherwise
* <code>false</code>. * <code>false</code>.
* @example <caption>Report on HMD availability.</caption> * @example <caption>Report on HMD availability.</caption>
@ -208,10 +208,10 @@ public:
Q_INVOKABLE bool isHMDAvailable(const QString& name = ""); Q_INVOKABLE bool isHMDAvailable(const QString& name = "");
/**jsdoc /**jsdoc
* Check whether there is an HMD head controller available. * Checks whether there is an HMD head controller available.
* @function HMD.isHeadControllerAvailable * @function HMD.isHeadControllerAvailable
* @param {string} [name=""] - The name of the HMD head controller to check for, e.g., <code>"Oculus"</code>. If no name is * @param {string} [name=""] - The name of the HMD head controller to check for, e.g., <code>"Oculus"</code>. If no name is
* specified then any HMD head controller matches. * specified, then any HMD head controller matches.
* @returns {boolean} <code>true</code> if an HMD head controller of the specified <code>name</code> is available, * @returns {boolean} <code>true</code> if an HMD head controller of the specified <code>name</code> is available,
* otherwise <code>false</code>. * otherwise <code>false</code>.
* @example <caption>Report HMD head controller availability.</caption> * @example <caption>Report HMD head controller availability.</caption>
@ -222,10 +222,10 @@ public:
Q_INVOKABLE bool isHeadControllerAvailable(const QString& name = ""); Q_INVOKABLE bool isHeadControllerAvailable(const QString& name = "");
/**jsdoc /**jsdoc
* Check whether there are HMD hand controllers available. * Checks whether there are HMD hand controllers available.
* @function HMD.isHandControllerAvailable * @function HMD.isHandControllerAvailable
* @param {string} [name=""] - The name of the HMD hand controller to check for, e.g., <code>"Oculus"</code>. If no name is * @param {string} [name=""] - The name of the HMD hand controller to check for, e.g., <code>"Oculus"</code>. If no name is
* specified then any HMD hand controller matches. * specified, then any HMD hand controller matches.
* @returns {boolean} <code>true</code> if an HMD hand controller of the specified <code>name</code> is available, * @returns {boolean} <code>true</code> if an HMD hand controller of the specified <code>name</code> is available,
* otherwise <code>false</code>. * otherwise <code>false</code>.
* @example <caption>Report HMD hand controller availability.</caption> * @example <caption>Report HMD hand controller availability.</caption>
@ -236,7 +236,7 @@ public:
Q_INVOKABLE bool isHandControllerAvailable(const QString& name = ""); Q_INVOKABLE bool isHandControllerAvailable(const QString& name = "");
/**jsdoc /**jsdoc
* Check whether there are specific HMD controllers available. * Checks whether there are specific HMD controllers available.
* @function HMD.isSubdeviceContainingNameAvailable * @function HMD.isSubdeviceContainingNameAvailable
* @param {string} name - The name of the HMD controller to check for, e.g., <code>"OculusTouch"</code>. * @param {string} name - The name of the HMD controller to check for, e.g., <code>"OculusTouch"</code>.
* @returns {boolean} <code>true</code> if an HMD controller with a name containing the specified <code>name</code> is * @returns {boolean} <code>true</code> if an HMD controller with a name containing the specified <code>name</code> is
@ -248,7 +248,7 @@ public:
Q_INVOKABLE bool isSubdeviceContainingNameAvailable(const QString& name); Q_INVOKABLE bool isSubdeviceContainingNameAvailable(const QString& name);
/**jsdoc /**jsdoc
* Signal that models of the HMD hand controllers being used should be displayed. The models are displayed at their actual, * Signals that models of the HMD hand controllers being used should be displayed. The models are displayed at their actual,
* real-world locations. * real-world locations.
* @function HMD.requestShowHandControllers * @function HMD.requestShowHandControllers
* @example <caption>Show your hand controllers for 10 seconds.</caption> * @example <caption>Show your hand controllers for 10 seconds.</caption>
@ -260,14 +260,14 @@ public:
Q_INVOKABLE void requestShowHandControllers(); Q_INVOKABLE void requestShowHandControllers();
/**jsdoc /**jsdoc
* Signal that it is no longer necessary to display models of the HMD hand controllers being used. If no other scripts * Signals that it is no longer necessary to display models of the HMD hand controllers being used. If no other scripts
* want the models displayed then they are no longer displayed. * want the models displayed then they are no longer displayed.
* @function HMD.requestHideHandControllers * @function HMD.requestHideHandControllers
*/ */
Q_INVOKABLE void requestHideHandControllers(); Q_INVOKABLE void requestHideHandControllers();
/**jsdoc /**jsdoc
* Check whether any script wants models of the HMD hand controllers displayed. Requests are made and canceled using * Checks whether any script wants models of the HMD hand controllers displayed. Requests are made and canceled using
* {@link HMD.requestShowHandControllers|requestShowHandControllers} and * {@link HMD.requestShowHandControllers|requestShowHandControllers} and
* {@link HMD.requestHideHandControllers|requestHideHandControllers}. * {@link HMD.requestHideHandControllers|requestHideHandControllers}.
* @function HMD.shouldShowHandControllers * @function HMD.shouldShowHandControllers
@ -292,8 +292,8 @@ public:
/**jsdoc /**jsdoc
* Suppress the activation of the HMD-provided keyboard, if any. Successful calls should be balanced with a call to * Suppresses the activation of the HMD-provided keyboard, if any. Successful calls should be balanced with a call to
* {@link HMD.unspressKeyboard|unspressKeyboard} within a reasonable amount of time. * {@link HMD.unsuppressKeyboard|unsuppressKeyboard} within a reasonable amount of time.
* @function HMD.suppressKeyboard * @function HMD.suppressKeyboard
* @returns {boolean} <code>true</code> if the current HMD provides a keyboard and it was successfully suppressed (e.g., it * @returns {boolean} <code>true</code> if the current HMD provides a keyboard and it was successfully suppressed (e.g., it
* isn't being displayed), otherwise <code>false</code>. * isn't being displayed), otherwise <code>false</code>.
@ -307,14 +307,14 @@ public:
Q_INVOKABLE bool suppressKeyboard(); Q_INVOKABLE bool suppressKeyboard();
/**jsdoc /**jsdoc
* Unsuppress the activation of the HMD-provided keyboard, if any. * Unsuppresses the activation of the HMD-provided keyboard, if any.
* @function HMD.unsuppressKeyboard * @function HMD.unsuppressKeyboard
*/ */
/// Enable the keyboard following a suppressKeyboard call /// Enable the keyboard following a suppressKeyboard call
Q_INVOKABLE void unsuppressKeyboard(); Q_INVOKABLE void unsuppressKeyboard();
/**jsdoc /**jsdoc
* Check whether the HMD-provided keyboard, if any, is visible. * Checks whether the HMD-provided keyboard, if any, is visible.
* @function HMD.isKeyboardVisible * @function HMD.isKeyboardVisible
* @returns {boolean} <code>true</code> if the current HMD provides a keyboard and it is visible, otherwise * @returns {boolean} <code>true</code> if the current HMD provides a keyboard and it is visible, otherwise
* <code>false</code>. * <code>false</code>.
@ -377,7 +377,19 @@ signals:
public: public:
HMDScriptingInterface(); HMDScriptingInterface();
/**jsdoc
* Gets the position on the HUD overlay that your HMD is looking at, in HUD coordinates.
* @function HMD.getHUDLookAtPosition2D
* @returns {Vec2} The position on the HUD overlay that your HMD is looking at, in pixels.
*/
static QScriptValue getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine); static QScriptValue getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine);
/**jsdoc
* Gets the position on the HUD overlay that your HMD is looking at, in world coordinates.
* @function HMD.getHUDLookAtPosition3D
* @returns {Vec3} The position on the HUD overlay the your HMD is looking at, in world coordinates.
*/
static QScriptValue getHUDLookAtPosition3D(QScriptContext* context, QScriptEngine* engine); static QScriptValue getHUDLookAtPosition3D(QScriptContext* context, QScriptEngine* engine);
bool isMounted() const override; bool isMounted() const override;