diff --git a/interface/src/scripting/HMDScriptingInterface.h b/interface/src/scripting/HMDScriptingInterface.h index d41e8951a2..c6202d4105 100644 --- a/interface/src/scripting/HMDScriptingInterface.h +++ b/interface/src/scripting/HMDScriptingInterface.h @@ -1,4 +1,4 @@ - +// // HMDScriptingInterface.h // interface/src/scripting // @@ -25,7 +25,7 @@ class QScriptEngine; #include /**jsdoc - * The HMD API provides access to the HMD used in VR display mode. + * The HMD API provides access to the HMD used in VR display mode. * * @namespace HMD * @@ -87,7 +87,7 @@ class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Depen public: /**jsdoc - * Calculate the intersection of a ray with the HUD overlay. + * Calculates the intersection of a ray with the HUD overlay. * @function HMD.calculateRayUICollisionPoint * @param {Vec3} position - The origin 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; /**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. * @function HMD.overlayFromWorldPoint * @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; /**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. * @function HMD.worldPointFromOverlay * @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; /**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. * Spherical coordinates are polar coordinates in radians with { x: 0, y: 0 } being the center of the HUD * overlay. @@ -161,7 +161,7 @@ public: Q_INVOKABLE glm::vec2 sphericalToOverlay(const glm::vec2 & sphericalPos) const; /**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. * Spherical coordinates are polar coordinates in radians with { x: 0, y: 0 } being the center of the HUD * overlay. @@ -172,21 +172,21 @@ public: Q_INVOKABLE glm::vec2 overlayToSpherical(const glm::vec2 & overlayPos) const; /**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 */ Q_INVOKABLE void centerUI(); /**jsdoc - * Get the name of the HMD audio input device. + * Gets the name of the HMD audio input device. * @function HMD.preferredAudioInput * @returns {string} The name of the HMD audio input device if in HMD mode, otherwise an empty string. */ Q_INVOKABLE QString preferredAudioInput() const; /**jsdoc - * Get the name of the HMD audio output device. + * Gets the name of the HMD audio output device. * @function HMD.preferredAudioOutput * @returns {string} The name of the HMD audio output device if in HMD mode, otherwise an empty string. */ @@ -194,10 +194,10 @@ public: /**jsdoc - * Check whether there is an HMD available. + * Checks whether there is an HMD available. * @function HMD.isHMDAvailable * @param {string} [name=""] - The name of the HMD to check for, e.g., "Oculus Rift". 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} true if an HMD of the specified name is available, otherwise * false. * @example Report on HMD availability. @@ -208,10 +208,10 @@ public: Q_INVOKABLE bool isHMDAvailable(const QString& name = ""); /**jsdoc - * Check whether there is an HMD head controller available. + * Checks whether there is an HMD head controller available. * @function HMD.isHeadControllerAvailable * @param {string} [name=""] - The name of the HMD head controller to check for, e.g., "Oculus". If no name is - * specified then any HMD head controller matches. + * specified, then any HMD head controller matches. * @returns {boolean} true if an HMD head controller of the specified name is available, * otherwise false. * @example Report HMD head controller availability. @@ -222,10 +222,10 @@ public: Q_INVOKABLE bool isHeadControllerAvailable(const QString& name = ""); /**jsdoc - * Check whether there are HMD hand controllers available. + * Checks whether there are HMD hand controllers available. * @function HMD.isHandControllerAvailable * @param {string} [name=""] - The name of the HMD hand controller to check for, e.g., "Oculus". If no name is - * specified then any HMD hand controller matches. + * specified, then any HMD hand controller matches. * @returns {boolean} true if an HMD hand controller of the specified name is available, * otherwise false. * @example Report HMD hand controller availability. @@ -236,7 +236,7 @@ public: Q_INVOKABLE bool isHandControllerAvailable(const QString& name = ""); /**jsdoc - * Check whether there are specific HMD controllers available. + * Checks whether there are specific HMD controllers available. * @function HMD.isSubdeviceContainingNameAvailable * @param {string} name - The name of the HMD controller to check for, e.g., "OculusTouch". * @returns {boolean} true if an HMD controller with a name containing the specified name is @@ -248,7 +248,7 @@ public: Q_INVOKABLE bool isSubdeviceContainingNameAvailable(const QString& name); /**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. * @function HMD.requestShowHandControllers * @example Show your hand controllers for 10 seconds. @@ -260,14 +260,14 @@ public: Q_INVOKABLE void requestShowHandControllers(); /**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. * @function HMD.requestHideHandControllers */ Q_INVOKABLE void requestHideHandControllers(); /**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.requestHideHandControllers|requestHideHandControllers}. * @function HMD.shouldShowHandControllers @@ -292,8 +292,8 @@ public: /**jsdoc - * Suppress 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. + * Suppresses the activation of the HMD-provided keyboard, if any. Successful calls should be balanced with a call to + * {@link HMD.unsuppressKeyboard|unsuppressKeyboard} within a reasonable amount of time. * @function HMD.suppressKeyboard * @returns {boolean} true if the current HMD provides a keyboard and it was successfully suppressed (e.g., it * isn't being displayed), otherwise false. @@ -307,14 +307,14 @@ public: Q_INVOKABLE bool suppressKeyboard(); /**jsdoc - * Unsuppress the activation of the HMD-provided keyboard, if any. + * Unsuppresses the activation of the HMD-provided keyboard, if any. * @function HMD.unsuppressKeyboard */ /// Enable the keyboard following a suppressKeyboard call Q_INVOKABLE void unsuppressKeyboard(); /**jsdoc - * Check whether the HMD-provided keyboard, if any, is visible. + * Checks whether the HMD-provided keyboard, if any, is visible. * @function HMD.isKeyboardVisible * @returns {boolean} true if the current HMD provides a keyboard and it is visible, otherwise * false. @@ -377,7 +377,19 @@ signals: public: 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); + + /**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); bool isMounted() const override;