From 04203b1425496ac422ee6527df76e964099e3585 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 10 Sep 2019 11:56:37 +1200 Subject: [PATCH 01/41] File JSDoc --- .../src/FileScriptingInterface.h | 61 +++++++++++++++---- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/libraries/script-engine/src/FileScriptingInterface.h b/libraries/script-engine/src/FileScriptingInterface.h index 859f343ec5..0114ac6c44 100644 --- a/libraries/script-engine/src/FileScriptingInterface.h +++ b/libraries/script-engine/src/FileScriptingInterface.h @@ -17,6 +17,8 @@ #include /**jsdoc + * The File API provides some facilities for working with the file system. + * * @namespace File * * @hifi-interface @@ -35,37 +37,70 @@ public: public slots: /**jsdoc + * Extracts a filename from a URL, where the filename is specified in the query part of the URL as filename=. * @function File.convertUrlToPath - * @param {string} url - * @returns {string} + * @param {string} url - The URL to extract the filename from. + * @returns {string} The filename specified in the URL; an empty string if no filename is specified. + * @example Extract a filename from a URL. + * var url = "http://domain.tld/path/page.html?filename=file.ext"; + * print("File name: " + File.convertUrlToPath(url)); // file.ext */ QString convertUrlToPath(QUrl url); /**jsdoc + * Unzips a file in the local file system to a new, unique temporary directory. * @function File.runUnzip - * @param {string} path - * @param {string} url - * @param {boolean} autoAdd - * @param {boolean} isZip - * @param {boolean} isBlocks + * @param {string} path - The path of the zip file in the local file system. May have a leading "file:///". + * Need not have a ".zip" extension if it is in a temporary directory (as created by + * {@link File.getTempDir|getTempDir}). + * @param {string} url - Not used. + * @param {boolean} autoAdd - Not used by user scripts. The value is simply passed through to the + * {@link File.unzipResult|unzipResult} signal. + * @param {boolean} isZip - Set to true if path has a ".zip" extension, + * false if it doesn't (but should still be treated as a zip file). + * @param {boolean} isBlocks - Not used by user scripts. The value is simply passed through to the + * {@link File.unzipResult|unzipResult} signal. + * @example Select and unzip a file. + * File.unzipResult.connect(function (zipFile, unzipFiles, autoAdd, isZip, isBlocks) { + * print("File.unzipResult()"); + * print("- zipFile: " + zipFile); + * print("- unzipFiles(" + unzipFiles.length + "): " + unzipFiles); + * print("- autoAdd: " + autoAdd); + * print("- isZip: " + isZip); + * print("- isBlocks: " + isBlocks); + * }); + * + * var zipFile = Window.browse("Select a Zip File", "", "*.zip"); + * if (zipFile) { + * File.runUnzip(zipFile, "", false, true, false); + * } else { + * print("Zip file not selected."); + * } */ void runUnzip(QString path, QUrl url, bool autoAdd, bool isZip, bool isBlocks); /**jsdoc + * Creates a new, unique directory for temporary use. * @function File.getTempDir - * @returns {string} + * @returns {string} The path of the newly created temporary directory. + * @example Create a temporary directory. + * print("New temporary directory: " + File.getTempDir()); */ QString getTempDir(); signals: /**jsdoc + * Triggered when {@link File.runUnzip|runUnzip} completes. * @function File.unzipResult - * @param {string} zipFile - * @param {string} unzipFile - * @param {boolean} autoAdd - * @param {boolean} isZip - * @param {boolean} isBlocks + * @param {string} zipFile - The file that was unzipped. + * @param {string[]} unzipFiles - The paths of the unzipped files in a newly created temporary directory. Includes entries + * for any subdirectories created. An empty array if the zipFile could not be unzipped. + * @param {boolean} autoAdd - The value that {@link File.runUnzip|runUnzip} was called with. + * @param {boolean} isZip - true if {@link File.runUnzip|runUnzip} was called with isZip == true + * or path containing "vr.google.com/downloads", unless there is no FBX or OBJ file in the + * unzipped file(s) in which case the value is false. + * @param {boolean} isBlocks - The value that {@link File.runUnzip|runUnzip} was called with. * @returns {Signal} */ void unzipResult(QString zipFile, QStringList unzipFile, bool autoAdd, bool isZip, bool isBlocks); From 7bbca94d431872e6918a04085f08ab12859645f8 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 12 Sep 2019 14:41:43 +1200 Subject: [PATCH 02/41] Doc review --- libraries/script-engine/src/FileScriptingInterface.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/script-engine/src/FileScriptingInterface.h b/libraries/script-engine/src/FileScriptingInterface.h index 0114ac6c44..ce93921403 100644 --- a/libraries/script-engine/src/FileScriptingInterface.h +++ b/libraries/script-engine/src/FileScriptingInterface.h @@ -97,9 +97,8 @@ signals: * @param {string[]} unzipFiles - The paths of the unzipped files in a newly created temporary directory. Includes entries * for any subdirectories created. An empty array if the zipFile could not be unzipped. * @param {boolean} autoAdd - The value that {@link File.runUnzip|runUnzip} was called with. - * @param {boolean} isZip - true if {@link File.runUnzip|runUnzip} was called with isZip == true - * or path containing "vr.google.com/downloads", unless there is no FBX or OBJ file in the - * unzipped file(s) in which case the value is false. + * @param {boolean} isZip - true if {@link File.runUnzip|runUnzip} was called with isZip == true, + * unless there is no FBX or OBJ file in the unzipped file(s) in which case the value is false. * @param {boolean} isBlocks - The value that {@link File.runUnzip|runUnzip} was called with. * @returns {Signal} */ From 43a0ed48fd05204bf696a6fa1de7f9f234358bd6 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 17 Sep 2019 16:25:34 +1200 Subject: [PATCH 03/41] Fix JSDoc template HTML issues --- .../hifi-jsdoc-template/tmpl/container.tmpl | 17 +++--- .../hifi-jsdoc-template/tmpl/details.tmpl | 54 +++++++++---------- .../hifi-jsdoc-template/tmpl/example.tmpl | 54 +++++++++---------- .../hifi-jsdoc-template/tmpl/members.tmpl | 2 +- .../hifi-jsdoc-template/tmpl/method.tmpl | 13 ++--- .../hifi-jsdoc-template/tmpl/signal.tmpl | 8 +-- 6 files changed, 75 insertions(+), 73 deletions(-) diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl index 5c149fa434..c2aa955b80 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl @@ -63,11 +63,12 @@
+

Description

-

+
@@ -75,7 +76,7 @@

Description

-

+
@@ -84,11 +85,12 @@ -

+

Parameters

+
@@ -101,7 +103,7 @@

Description

-

+
@@ -264,6 +266,7 @@ +
+ - -
- - +
diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/details.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/details.tmpl index 0661ee3e50..afb0e9464c 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/details.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/details.tmpl @@ -31,113 +31,113 @@ if (data.defaultvalue && (data.defaultvaluetype === 'object' || data.defaultvalu

Version:

-

+

Since:

-

+

Inherited From:

-

  • +
    • -

    +

Overrides:

-

  • +
    • -

    +

Implementations:

-

    +
    • -

    +

Implements:

-

    +
    • -

    +

Mixes In:

-

    +
    • -

    +

Author:

-

+

-

+

Copyright:

-

+

License:

-

+

Default Value:

-

    - > -

+
    +
  • >
  • +

Source:

-

  • +
    • , -

    +

Tutorials:

-

+

-

+

See:

-

+

-

+

To Do:

-

+

-

+
diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/example.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/example.tmpl index e1b06d0a46..ea70a150c5 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/example.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/example.tmpl @@ -29,113 +29,113 @@ if (data.defaultvalue && (data.defaultvaluetype === 'object' || data.defaultvalu

Version:

-

+

Since:

-

+

Inherited From:

-

  • +
    • -

    +

Overrides:

-

  • +
    • -

    +

Implementations:

-

    +
    • -

    +

Implements:

-

    +
    • -

    +

Mixes In:

-

    +
    • -

    +

Author:

-

+

-

+

Copyright:

-

+

License:

-

+

Default Value:

-

    - > -

+
    +
  • >
  • +

Source:

-

  • +
    • , -

    +

Tutorials:

-

+

-

+

See:

-

+

-

+

To Do:

-

+

-

+
diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/members.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/members.tmpl index eef64c1f3f..c97a3f6979 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/members.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/members.tmpl @@ -16,7 +16,7 @@ var self = this; -

+

 

diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/method.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/method.tmpl index 8db1df8a77..db52d8f0b5 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/method.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/method.tmpl @@ -12,8 +12,9 @@ var self = this; Returns: - + + +
Type: @@ -24,23 +25,23 @@ var self = this; -

+

-

+

 

-

Throws:

+

Throws

1) { ?>
-

+ diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/signal.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/signal.tmpl index 00bf7122e1..ece03b9e36 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/signal.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/signal.tmpl @@ -25,23 +25,23 @@ var self = this; -

+

-

+

 

-

Throws:

+

Throws

1) { ?>
-

+ From dff37a71eb2ebd2b85a5d3364205cf12713afd3f Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 17 Sep 2019 16:26:09 +1200 Subject: [PATCH 04/41] Fix JSDoc markup HTML issues --- interface/src/FancyCamera.h | 2 +- interface/src/avatar/MyAvatar.h | 2 +- .../src/raypick/PickScriptingInterface.h | 2 +- .../scripting/ControllerScriptingInterface.h | 1 - .../scripting/DesktopScriptingInterface.cpp | 4 +- .../src/scripting/MenuScriptingInterface.h | 3 +- .../src/scripting/WindowScriptingInterface.h | 6 +- interface/src/ui/overlays/Overlays.cpp | 70 +++++++++---------- .../animation/src/AnimInverseKinematics.h | 2 +- libraries/animation/src/AnimOverlay.h | 2 +- libraries/animation/src/IKTarget.h | 2 +- libraries/animation/src/Rig.cpp | 2 +- .../controllers/src/controllers/Actions.cpp | 2 +- .../src/controllers/StandardController.cpp | 5 +- .../controllers/impl/MappingBuilderProxy.h | 2 +- .../entities/src/EntityDynamicInterface.cpp | 4 +- .../entities/src/EntityItemProperties.cpp | 4 +- .../entities/src/EntityScriptingInterface.h | 2 +- .../src/input-plugins/KeyboardMouseDevice.cpp | 2 +- libraries/midi/src/Midi.h | 2 +- libraries/networking/src/AddressManager.h | 10 +-- libraries/script-engine/src/Quat.h | 8 +-- 22 files changed, 69 insertions(+), 70 deletions(-) diff --git a/interface/src/FancyCamera.h b/interface/src/FancyCamera.h index 0cfe147138..f7be71e053 100644 --- a/interface/src/FancyCamera.h +++ b/interface/src/FancyCamera.h @@ -20,7 +20,7 @@ class FancyCamera : public Camera { /**jsdoc * The Camera API provides access to the "camera" that defines your view in desktop and HMD display modes. - * The High Fidelity camera has axes x = right, y = up, -z = forward. + * The High Fidelity camera has axes x = right, y = up, -z = forward. * * @namespace Camera * diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 0108fb5eda..a7ddb7a837 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -779,7 +779,7 @@ public: * additional properties specified when adding the different handlers.

*

A handler may change a value from animStateDictionaryIn or add different values in the * animStateDictionaryOut returned. Any property values set in animStateDictionaryOut will - * override those of the internal animation machinery. * @function MyAvatar.addAnimationStateHandler * @param {function} handler - The animation state handler function to add. * @param {Array|null} propertiesList - The list of {@link MyAvatar.AnimStateDictionary|AnimStateDictionary} diff --git a/interface/src/raypick/PickScriptingInterface.h b/interface/src/raypick/PickScriptingInterface.h index 72b28bbc47..e26b91b9a2 100644 --- a/interface/src/raypick/PickScriptingInterface.h +++ b/interface/src/raypick/PickScriptingInterface.h @@ -287,7 +287,7 @@ public slots: /**jsdoc * @function Picks.PICK_ENTITIES * @deprecated This function is deprecated and will be removed. Use the Picks.PICK_DOMAIN_ENTITIES | - * Picks.PICK_AVATAR_ENTITIES properties expression instead. + * Picks.PICK_AVATAR_ENTITIES properties expression instead. * @returns {number} */ static constexpr unsigned int PICK_ENTITIES() { return PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES) | PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES); } diff --git a/interface/src/scripting/ControllerScriptingInterface.h b/interface/src/scripting/ControllerScriptingInterface.h index 4fb631463e..dbd172abe7 100644 --- a/interface/src/scripting/ControllerScriptingInterface.h +++ b/interface/src/scripting/ControllerScriptingInterface.h @@ -168,7 +168,6 @@ class ScriptEngine; * startFarTrigger
continueFarTrigger
stopFarTrigger * These methods are called when a user is more than 0.3m away from the entity, the entity is triggerable, and the * user starts, continues, or stops squeezing the trigger. - * * A light switch that can be toggled on and off from a distance. * * diff --git a/interface/src/scripting/DesktopScriptingInterface.cpp b/interface/src/scripting/DesktopScriptingInterface.cpp index 874b3fa42d..bb4ab89f2c 100644 --- a/interface/src/scripting/DesktopScriptingInterface.cpp +++ b/interface/src/scripting/DesktopScriptingInterface.cpp @@ -34,7 +34,7 @@ * A docking location of an InteractiveWindow. * * - * + * * * * @@ -76,7 +76,7 @@ int DesktopScriptingInterface::getHeight() { * A display mode for an InteractiveWindow. *
ValueName

Description
ValueNameDescription
0TOPDock to the top edge of the Interface window.
* - * + * * * * * * - * + * * * * @@ -1674,11 +1674,11 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @property {number} pulsePeriod=1 - The duration of the color and alpha pulse, in seconds. A pulse multiplier value goes from * pulseMin to pulseMax, then pulseMax to pulseMin in one period. * @property {number} alphaPulse=0 - If non-zero, the alpha of the overlay is pulsed: the alpha value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {number} colorPulse=0 - If non-zero, the color of the overlay is pulsed: the color value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @@ -1692,7 +1692,7 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * parentID set, otherwise the same value as rotation. Synonym: localOrientation. * @property {boolean} isSolid=false - true if the overlay is rendered as a solid, false if it is * rendered as a wire frame. - * Synonyms: solid, isFilled, and filled. + * Synonyms: solid, isFilled, and filled. * Antonyms: isWire and wire. * @property {boolean} ignorePickIntersection=false - true if {@link Picks} ignore the overlay, false * if they don't. @@ -1761,17 +1761,17 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @property {Color} color=255,255,255 - The color of the overlay text. Synonym: textColor. * @property {number} alpha=0.7 - The opacity of the overlay text, 0.01.0. *

Currently not used; use textAlpha instead.

- * + * @comment CURRENTLY BROKEN * @property {number} pulseMax=0 - The maximum value of the pulse multiplier. * @property {number} pulseMin=0 - The minimum value of the pulse multiplier. * @property {number} pulsePeriod=1 - The duration of the color and alpha pulse, in seconds. A pulse multiplier value goes from * pulseMin to pulseMax, then pulseMax to pulseMin in one period. * @property {number} alphaPulse=0 - If non-zero, the alpha of the overlay is pulsed: the alpha value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {number} colorPulse=0 - If non-zero, the color of the overlay is pulsed: the color value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @@ -1811,11 +1811,11 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @property {number} pulsePeriod=1 - The duration of the color and alpha pulse, in seconds. A pulse multiplier value goes from * pulseMin to pulseMax, then pulseMax to pulseMin in one period. * @property {number} alphaPulse=0 - If non-zero, the alpha of the overlay is pulsed: the alpha value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {number} colorPulse=0 - If non-zero, the color of the overlay is pulsed: the color value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @@ -1857,11 +1857,11 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @property {number} pulsePeriod=1 - The duration of the color and alpha pulse, in seconds. A pulse multiplier value goes from * pulseMin to pulseMax, then pulseMax to pulseMin in one period. * @property {number} alphaPulse=0 - If non-zero, the alpha of the overlay is pulsed: the alpha value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {number} colorPulse=0 - If non-zero, the color of the overlay is pulsed: the color value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @@ -1922,35 +1922,35 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * * @property {Uuid} endParentID=null - The avatar, entity, or overlay that the end point of the line is parented to. *

Currently doesn't work.

- * + * @comment CURRENTLY BROKEN * @property {number} endParentJointIndex=65535 - Integer value specifying the skeleton joint that the end point of the line is * attached to if parentID is an avatar skeleton. A value of 65535 means "no joint". *

Currently doesn't work.

- * + * @comment CURRENTLY BROKEN * @property {Vec3} start - The start point of the line. Synonyms: startPoint and p1. - *

If parentID is set, use localStart to set the local position of the start point.

- * + *

If parentID is set, use localStart to set the local position of the start point.

+ * @comment CURRENTLY BROKEN * @property {Vec3} end - The end point of the line. Synonyms: endPoint and p2. - *

If parentID is set, use localEnd to set the local position of the end point.

- * + *

If parentID is set, use localEnd to set the local position of the end point.

+ * @comment CURRENTLY BROKEN * @property {Vec3} localStart - The local position of the overlay relative to its parent if the overlay has a * parentID set, otherwise the same value as start. - * + * @comment CURRENTLY BROKEN * @property {Vec3} localEnd - The local position of the overlay relative to its parent if the overlay has a * endParentID set, otherwise the same value as end. - * + * @comment CURRENTLY BROKEN * @property {number} length - The length of the line, in meters. This can be set after creating a line with start and end * points. *

Currently doesn't work.

- * + * @comment CURRENTLY BROKEN * @property {number} glow=0 - If glow > 0, the line is rendered with a glow. * @property {number} lineWidth=0.02 - Width of the line, in meters. *

You can set this property's value but currently cannot retrieve its value. Use the strokeWidths - * property to retrieve its value instead.

+ * property to retrieve its value instead.

*/ /**jsdoc @@ -1967,11 +1967,11 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @property {number} pulsePeriod=1 - The duration of the color and alpha pulse, in seconds. A pulse multiplier value goes from * pulseMin to pulseMax, then pulseMax to pulseMin in one period. * @property {number} alphaPulse=0 - If non-zero, the alpha of the overlay is pulsed: the alpha value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {number} colorPulse=0 - If non-zero, the color of the overlay is pulsed: the color value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @@ -2010,11 +2010,11 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @property {number} pulsePeriod=1 - The duration of the color and alpha pulse, in seconds. A pulse multiplier value goes from * pulseMin to pulseMax, then pulseMax to pulseMin in one period. * @property {number} alphaPulse=0 - If non-zero, the alpha of the overlay is pulsed: the alpha value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {number} colorPulse=0 - If non-zero, the color of the overlay is pulsed: the color value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @@ -2029,7 +2029,7 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * parentID set, otherwise the same value as rotation. Synonym: localOrientation. * @property {boolean} isSolid=false - true if the overlay is rendered as a solid, false if it is * rendered as a wire frame. - * Synonyms: solid
, isFilled, and filled. + * Synonyms: solid, isFilled, and filled. * Antonyms: isWire and wire. * @property {boolean} ignorePickIntersection=false - true if {@link Picks} ignore the overlay, false * if they don't. diff --git a/libraries/animation/src/AnimInverseKinematics.h b/libraries/animation/src/AnimInverseKinematics.h index 8d3f898e67..d184038815 100644 --- a/libraries/animation/src/AnimInverseKinematics.h +++ b/libraries/animation/src/AnimInverseKinematics.h @@ -63,7 +63,7 @@ public: *

Specifies the initial conditions of the IK solver.

*
ValueName

Description
ValueNameDescription
0VIRTUALThe window is displayed inside Interface: in the desktop window in diff --git a/interface/src/scripting/MenuScriptingInterface.h b/interface/src/scripting/MenuScriptingInterface.h index 6c2634b1de..110df8dd06 100644 --- a/interface/src/scripting/MenuScriptingInterface.h +++ b/interface/src/scripting/MenuScriptingInterface.h @@ -24,7 +24,8 @@ class MenuItemProperties; *

Groupings

* *

A "grouping" provides a way to group a set of menus or menu items together so that they can all be set visible or invisible - * as a group.

There is currently only one available group: "Developer". This grouping can be toggled in the + * as a group.

+ *

There is currently only one available group: "Developer". This grouping can be toggled in the * "Settings" menu.

*

If a menu item doesn't belong to a group, it is always displayed.

* diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 6207b22cb8..83d7de56a5 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -326,7 +326,7 @@ public slots: * full resolution is used (window dimensions in desktop mode; HMD display dimensions in HMD mode), otherwise one of the * dimensions is adjusted in order to match the aspect ratio. * @param {string} [filename=""] - If a filename is not provided, the image is saved as "hifi-snap-by-<user - * name>-on-YYYY-MM-DD_HH-MM-SS".
+ * name>-on-YYYY-MM-DD_HH-MM-SS".
* Still images are saved in JPEG or PNG format according to the extension provided — ".jpg", * ".jpeg", or ".png" — or if not provided then in JPEG format with an extension of * ".jpg". Animated images are saved in GIF format. @@ -365,7 +365,7 @@ public slots: * @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken} * signal. * @param {string} [filename=""] - If a filename is not provided, the image is saved as "hifi-snap-by-<user - * name>-on-YYYY-MM-DD_HH-MM-SS".
+ * name>-on-YYYY-MM-DD_HH-MM-SS".
* Images are saved in JPEG or PNG format according to the extension provided — ".jpg", * ".jpeg", or ".png" — or if not provided then in JPEG format with an extension of * ".jpg". @@ -384,7 +384,7 @@ public slots: * @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken} * signal. * @param {string} [filename=""] - If a filename is not provided, the image is saved as "hifi-snap-by-<user - * name>-on-YYYY-MM-DD_HH-MM-SS".
+ * name>-on-YYYY-MM-DD_HH-MM-SS".
* Images are saved in JPEG or PNG format according to the extension provided — ".jpg", * ".jpeg", or ".png" — or if not provided then in JPEG format with an extension of * ".jpg". diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 100711d69b..1f5bba86b2 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -1502,11 +1502,11 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @property {number} pulsePeriod=1 - The duration of the color and alpha pulse, in seconds. A pulse multiplier value goes from * pulseMin to pulseMax, then pulseMax to pulseMin in one period. * @property {number} alphaPulse=0 - If non-zero, the alpha of the overlay is pulsed: the alpha value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {number} colorPulse=0 - If non-zero, the color of the overlay is pulsed: the color value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @@ -1520,7 +1520,7 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * parentID set, otherwise the same value as rotation. Synonym: localOrientation. * @property {boolean} isSolid=false - true if the overlay is rendered as a solid, false if it is * rendered as a wire frame. - * Synonyms: solid, isFilled, and filled. + * Synonyms: solid, isFilled, and filled. * Antonyms: isWire and wire. * @property {boolean} ignorePickIntersection=false - true if {@link Picks} ignore the overlay, false * if they don't. @@ -1550,11 +1550,11 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @property {number} pulsePeriod=1 - The duration of the color and alpha pulse, in seconds. A pulse multiplier value goes from * pulseMin to pulseMax, then pulseMax to pulseMin in one period. * @property {number} alphaPulse=0 - If non-zero, the alpha of the overlay is pulsed: the alpha value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {number} colorPulse=0 - If non-zero, the color of the overlay is pulsed: the color value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @@ -1568,7 +1568,7 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * parentID set, otherwise the same value as rotation. Synonym: localOrientation. * @property {boolean} isSolid=false - true if the overlay is rendered as a solid, false if it is * rendered as a wire frame. - * Synonyms: solid, isFilled, and filled. + * Synonyms: solid, isFilled, and filled. * Antonyms: isWire and wire. * @property {boolean} ignorePickIntersection=false - true if {@link Picks} ignore the overlay, false * if they don't. @@ -1599,11 +1599,11 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @property {number} pulsePeriod=1 - The duration of the color and alpha pulse, in seconds. A pulse multiplier value goes from * pulseMin to pulseMax, then pulseMax to pulseMin in one period. * @property {number} alphaPulse=0 - If non-zero, the alpha of the overlay is pulsed: the alpha value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @property {number} colorPulse=0 - If non-zero, the color of the overlay is pulsed: the color value is multiplied by the - * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 + * current pulse multiplier value each frame. If > 0 the pulse multiplier is applied in phase with the pulse period; if < 0 * the pulse multiplier is applied out of phase with the pulse period. (The magnitude of the property isn't otherwise * used.) * @@ -1617,7 +1617,7 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * parentID set, otherwise the same value as rotation. Synonym: localOrientation. * @property {boolean} isSolid=false - true if the overlay is rendered as a solid, false if it is * rendered as a wire frame. - * Synonyms: solid, isFilled, and filled. + * Synonyms: solid, isFilled, and filled. * Antonyms: isWire and wire. * @property {boolean} ignorePickIntersection=false - true if {@link Picks} ignore the overlay, false * if they don't. @@ -1641,7 +1641,7 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { *
ValueDimensionsDescription
"Circle"2DA circle oriented in 3D.
"Circle"2DA circle oriented in 3D.
"Cone"3D
"Cube"3D
"Cylinder"3D
* - * + * * * * - * + * * * - * * diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 7f363dd36f..dacd479aef 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -517,7 +517,7 @@ void Avatar::relayJointDataToChildren() { } /**jsdoc - * An avatar has different types of data simulated at different rates, in Hz. + *

An avatar has different types of data simulated at different rates, in Hz.

* *
ValueName

Description
ValueNameDescription
0RelaxToUnderPosesThis is a blend: it is 15/16 PreviousSolution diff --git a/libraries/animation/src/AnimOverlay.h b/libraries/animation/src/AnimOverlay.h index 1ad4e100db..d5e114a2d2 100644 --- a/libraries/animation/src/AnimOverlay.h +++ b/libraries/animation/src/AnimOverlay.h @@ -28,7 +28,7 @@ public: *

Specifies sets of joints.

* * - * + * * * * diff --git a/libraries/animation/src/IKTarget.h b/libraries/animation/src/IKTarget.h index 331acedd4e..d0c060e44c 100644 --- a/libraries/animation/src/IKTarget.h +++ b/libraries/animation/src/IKTarget.h @@ -20,7 +20,7 @@ public: *

An IK target type.

*
ValueName

Description
ValueNameDescription
0FullBodyBoneSetAll joints.
* - * + * * * * * var entityID = Entities.addEntity({ * type: "Sphere", @@ -1309,7 +1309,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * @property {number} bottomMargin=0.0 - The bottom margin, in meters. * @property {boolean} unlit=false - true if the entity is unaffected by lighting, false if it is lit * by the key light and local lights. - * @property {string} font="" - The font to render the text with. It can be one of the following: "Courier""Courier", * "Inconsolata", "Roboto", "Timeless", or a path to a .sdff file. * @property {Entities.TextEffect} textEffect="none" - The effect that is applied to the text. * @property {Color} textEffectColor=255,255,255 - The color of the effect. diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 52470e56c4..5b6f74e5bc 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -1870,7 +1870,7 @@ public slots: /**jsdoc * Called when a {@link Entities.getMeshes} call is complete. * @callback Entities~getMeshesCallback - * @param {MeshProxy[]} meshes - If success< is true, a {@link MeshProxy} per mesh in the + * @param {MeshProxy[]} meshes - If success is true, a {@link MeshProxy} per mesh in the * Model or PolyVox entity; otherwise undefined. * @param {boolean} success - true if the {@link Entities.getMeshes} call was successful, false * otherwise. The call may be unsuccessful if the requested entity could not be found. diff --git a/libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp b/libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp index 0a6c76e456..ac8e6b8053 100755 --- a/libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp @@ -225,7 +225,7 @@ controller::Input KeyboardMouseDevice::InputDevice::makeInput(KeyboardMouseDevic * *
ValueName

Description
ValueNameDescription
0RotationAndPositionAttempt to reach the rotation and position end diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 561995cce4..d2e6dead58 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -95,7 +95,7 @@ static const QString MAIN_STATE_MACHINE_RIGHT_HAND_POSITION("mainStateMachineRig *

Warning: These properties are subject to change. * * - * + * * * * * - * + * * * * - * + * * * * * - * + * * *
NameType

Description
NameTypeDescription
userAnimNonebooleantrue when no user overrideAnimation is diff --git a/libraries/controllers/src/controllers/Actions.cpp b/libraries/controllers/src/controllers/Actions.cpp index 9f9d92fed7..9a1f540098 100644 --- a/libraries/controllers/src/controllers/Actions.cpp +++ b/libraries/controllers/src/controllers/Actions.cpp @@ -171,7 +171,7 @@ namespace controller { *
RightFootnumber{@link Pose}Set the right foot pose of the user's * avatar.
Application
Application
BoomInnumbernumberZoom camera in from third person toward first * person view.
BoomOutnumbernumberZoom camera out from first person to third diff --git a/libraries/controllers/src/controllers/StandardController.cpp b/libraries/controllers/src/controllers/StandardController.cpp index ece10ecca3..04d7c0bef8 100644 --- a/libraries/controllers/src/controllers/StandardController.cpp +++ b/libraries/controllers/src/controllers/StandardController.cpp @@ -33,7 +33,7 @@ void StandardController::focusOutEvent() { * identifying each output. Read-only.

*

These outputs can be mapped to actions or functions in a {@link RouteObject} mapping. The data value provided by each * control is either a number or a {@link Pose}. Numbers are typically normalized to 0.0 or 1.0 for - * button states, the range 0.0 – 1.0 for unidirectional scales, and the range + * button states, the range 0.01.0 for unidirectional scales, and the range * -1.01.0 for bidirectional scales.

*

Each hardware device has a mapping from its outputs to a subset of Controller.Standard items, specified in a * JSON file. For example, @@ -118,8 +118,7 @@ void StandardController::focusOutEvent() { * button.

RightThumbUpnumbernumberRight thumb not touching primary or secondary * thumb buttons.
LeftPrimaryIndexnumbernumberLeft primary index control - * pressed.
LeftPrimaryIndexnumbernumberLeft primary index control pressed.
LeftSecondaryIndexnumbernumberLeft secondary index control pressed. *
RightPrimaryIndexnumbernumberRight primary index control pressed. diff --git a/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h b/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h index f0a823a3de..5f3b9dc3fc 100644 --- a/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h +++ b/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h @@ -86,7 +86,7 @@ class UserInputMapper; * @typedef {object} Controller.MappingJSONRoute * @property {string|Controller.MappingJSONAxis} from - The name of a {@link Controller.Hardware} property or an axis made from * them. If a property name, the leading "Controller.Hardware." can be omitted. - * @property {boolean} [peek=false] - If true, then peeking is enabled per {@link RouteObject#peek}. + * @property {boolean} [peek=false] - If true, then peeking is enabled per {@link RouteObject#peek}. * @property {boolean} [debug=false] - If true, then debug is enabled per {@link RouteObject#debug}. * @property {string|string[]} [when=[]] - One or more numeric {@link Controller.Hardware} property names which are evaluated * as booleans and ANDed together. Prepend a property name with a ! to do a logical NOT. The leading diff --git a/libraries/entities/src/EntityDynamicInterface.cpp b/libraries/entities/src/EntityDynamicInterface.cpp index 69d771db22..9c73217bef 100644 --- a/libraries/entities/src/EntityDynamicInterface.cpp +++ b/libraries/entities/src/EntityDynamicInterface.cpp @@ -130,8 +130,8 @@ variables. These argument variables are used by the code which is run when bull *
"ball-socket"Object constraintConnects two entities with a ball and socket joint.{@link Entities.ActionArguments-BallSocket}
"spring"Synonym for "tractor". - * Deprecated.
"spring" Synonym for "tractor". + *

Deprecated.

 
* @typedef {string} Entities.ActionType diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 5437ceaab8..e45d05a1b5 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -944,7 +944,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * @property {number} materialMappingRot=0 - How much to rotate the material within the parent's UV-space, in degrees. * @property {boolean} materialRepeat=true - true if the material repeats, false if it doesn't. If * false, fragments outside of texCoord 0 – 1 will be discarded. Works in both "uv" and - * "projected" modes. + * "projected" modes. * @example

Color a sphere using a Material entity.
* - * + * * * * diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/params.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/params.tmpl index e994e42bfa..dd9f5f7ee7 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/params.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/params.tmpl @@ -120,10 +120,15 @@ - + diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/properties.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/properties.tmpl index 5c83a7d587..31717ed63b 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/properties.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/properties.tmpl @@ -87,7 +87,9 @@ From d5e08d19e39048988b9fc1ff1ee9db7f603f13e2 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 08:17:24 +1200 Subject: [PATCH 06/41] Fix JSDoc for miscellaneous white space issues --- interface/src/avatar/MyAvatar.cpp | 2 +- interface/src/avatar/MyAvatar.h | 13 ++-- .../src/raypick/PickScriptingInterface.cpp | 22 +++--- .../scripting/ControllerScriptingInterface.h | 18 ++--- .../scripting/DesktopScriptingInterface.cpp | 4 +- .../scripting/SelectionScriptingInterface.cpp | 2 +- .../src/scripting/WalletScriptingInterface.h | 6 +- .../src/scripting/WindowScriptingInterface.h | 24 +++---- interface/src/ui/InteractiveWindow.h | 4 +- interface/src/ui/overlays/Overlays.cpp | 67 +++++++++---------- .../animation/src/AnimInverseKinematics.h | 14 ++-- libraries/animation/src/IKTarget.h | 4 +- .../src/avatars-renderer/Avatar.cpp | 2 +- libraries/avatars/src/AvatarData.cpp | 4 +- libraries/avatars/src/AvatarData.h | 6 +- .../controllers/impl/MappingBuilderProxy.h | 16 ++--- .../src/controllers/impl/RouteBuilderProxy.h | 8 +-- .../entities/src/EntityItemProperties.cpp | 6 +- libraries/entities/src/EntityTypes.h | 12 ++-- .../src/input-plugins/KeyboardMouseDevice.cpp | 14 ++-- libraries/networking/src/MessagesClient.h | 12 ++-- libraries/script-engine/src/ScriptEngine.cpp | 4 +- .../ui/src/ui/TabletScriptingInterface.h | 2 +- 23 files changed, 135 insertions(+), 131 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 4d1c20010c..af6836a8a3 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2479,7 +2479,7 @@ void MyAvatar::clearWornAvatarEntities() { } /**jsdoc - * Information about an avatar entity. + *

Information about an avatar entity.

*
PropertyTypeDataDescription
PropertyTypeDataDescription
09numbernumberA "0" – "1" key on the diff --git a/libraries/midi/src/Midi.h b/libraries/midi/src/Midi.h index dd2b5fd678..d103d05218 100644 --- a/libraries/midi/src/Midi.h +++ b/libraries/midi/src/Midi.h @@ -23,7 +23,7 @@ /**jsdoc * The Midi API provides the ability to connect Interface with musical instruments and other external or virtual * devices via the MIDI protocol. For further information and examples, see the tutorial: - * Use MIDI to Control Your Environment.

+ * Use MIDI to Control Your Environment. * *

Note: Only works on Windows.

* diff --git a/libraries/networking/src/AddressManager.h b/libraries/networking/src/AddressManager.h index 8187c23f71..31bda960ec 100644 --- a/libraries/networking/src/AddressManager.h +++ b/libraries/networking/src/AddressManager.h @@ -188,11 +188,11 @@ public slots: /**jsdoc * Takes you to a specified metaverse address. * @function location.handleLookupString - * @param {string} address - The address to go to: a "hifi://" address, an IP address (e.g., - * "127.0.0.1" or "localhost"), a domain name, a named path on a domain (starts with - * "/"), a position or position and orientation, or a user (starts with "@"). + * @param {string} address - The address to go to: a "hifi://" address, an IP address (e.g., + * "127.0.0.1" or "localhost"), a domain name, a named path on a domain (starts with + * "/"), a position or position and orientation, or a user (starts with "@"). * @param {boolean} [fromSuggestions=false] - Set to true if the address is obtained from the "Goto" dialog. - * Helps ensure that user's location history is correctly maintained. + * Helps ensure that user's location history is correctly maintained. */ void handleLookupString(const QString& lookupString, bool fromSuggestions = false); @@ -259,7 +259,7 @@ public slots: /**jsdoc * Checks if going back to the previous location is possible. * @function location.canGoBack - * @returns true if going back is possible, false if it isn't. + * @returns {boolean} true if going back is possible, false if it isn't. */ bool canGoBack() const; diff --git a/libraries/script-engine/src/Quat.h b/libraries/script-engine/src/Quat.h index 0a5e58ac26..1cd4802e48 100644 --- a/libraries/script-engine/src/Quat.h +++ b/libraries/script-engine/src/Quat.h @@ -223,7 +223,7 @@ public slots: /**jsdoc * Gets the "front" direction that the camera would face if its orientation was set to the quaternion value. * This is a synonym for {@link Quat(0).getForward|Quat.getForward}. - * The High Fidelity camera has axes x = right, y = up, -z = forward. + * The High Fidelity camera has axes x = right, y = up, -z = forward. * @function Quat(0).getFront * @param {Quat} orientation - A quaternion representing an orientation. * @returns {Vec3} The negative z-axis rotated by orientation. @@ -233,7 +233,7 @@ public slots: /**jsdoc * Gets the "forward" direction that the camera would face if its orientation was set to the quaternion value. * This is a synonym for {@link Quat(0).getFront|Quat.getFront}. - * The High Fidelity camera has axes x = right, y = up, -z = forward. + * The High Fidelity camera has axes x = right, y = up, -z = forward. * @function Quat(0).getForward * @param {Quat} orientation - A quaternion representing an orientation. * @returns {Vec3} The negative z-axis rotated by orientation. @@ -245,7 +245,7 @@ public slots: /**jsdoc * Gets the "right" direction that the camera would have if its orientation was set to the quaternion value. - * The High Fidelity camera has axes x = right, y = up, -z = forward. + * The High Fidelity camera has axes x = right, y = up, -z = forward. * @function Quat(0).getRight * @param {Quat} orientation - A quaternion representing an orientation. * @returns {Vec3} The x-axis rotated by orientation. @@ -254,7 +254,7 @@ public slots: /**jsdoc * Gets the "up" direction that the camera would have if its orientation was set to the quaternion value. - * The High Fidelity camera has axes x = right, y = up, -z = forward. + * The High Fidelity camera has axes x = right, y = up, -z = forward. * @function Quat(0).getUp * @param {Quat} orientation - A quaternion representing an orientation. * @returns {Vec3} The y-axis rotated by orientation. From 78b7c04457354b9f5398e8ce90ef597771dbf212 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 08:09:51 +1200 Subject: [PATCH 05/41] Fix white space in generated API docs --- .../hifi-jsdoc-template/static/styles/jsdoc.css | 13 ++++++++----- .../hifi-jsdoc-template/tmpl/description.tmpl | 15 +++++++++++++++ tools/jsdoc/hifi-jsdoc-template/tmpl/members.tmpl | 2 +- tools/jsdoc/hifi-jsdoc-template/tmpl/method.tmpl | 8 ++++---- .../hifi-jsdoc-template/tmpl/methodList.tmpl | 6 ++---- tools/jsdoc/hifi-jsdoc-template/tmpl/params.tmpl | 13 +++++++++---- .../hifi-jsdoc-template/tmpl/properties.tmpl | 4 +++- tools/jsdoc/hifi-jsdoc-template/tmpl/signal.tmpl | 8 ++++---- .../hifi-jsdoc-template/tmpl/signalList.tmpl | 8 +++----- 9 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 tools/jsdoc/hifi-jsdoc-template/tmpl/description.tmpl diff --git a/tools/jsdoc/hifi-jsdoc-template/static/styles/jsdoc.css b/tools/jsdoc/hifi-jsdoc-template/static/styles/jsdoc.css index 2386f88586..7b666de37b 100644 --- a/tools/jsdoc/hifi-jsdoc-template/static/styles/jsdoc.css +++ b/tools/jsdoc/hifi-jsdoc-template/static/styles/jsdoc.css @@ -143,6 +143,14 @@ td { border: solid #c7cccb 1px; } +td > p:first-child, td > ul:first-child { + margin-top: 0; +} + +td > p:last-child, td > ul:last-child { + margin-bottom: 0; +} + article table thead tr th, article table tbody tr td, article table tbody tr td p { font-size: .89rem; line-height: 20px; @@ -596,11 +604,6 @@ header { font-size: 100%; } -.params td.description > p:first-child, .props td.description > p:first-child { - margin-top: 0; - padding-top: 0; -} - span.param-type, .params td .param-type, .param-type dd { color: #606; font-family: Consolas, Monaco, 'Andale Mono', monospace diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/description.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/description.tmpl new file mode 100644 index 0000000000..0e0ad27b37 --- /dev/null +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/description.tmpl @@ -0,0 +1,15 @@ +]*>', 'i'); + var descriptionIndex = description.search(descriptionRegExp); +?> + + +

+ +

+ + + + diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/members.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/members.tmpl index c97a3f6979..6a870b4cda 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/members.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/members.tmpl @@ -16,7 +16,7 @@ var self = this;
-
+

 

diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/method.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/method.tmpl index db52d8f0b5..1542ca1806 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/method.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/method.tmpl @@ -25,10 +25,10 @@ var self = this;
-
- - -
+ + + +

 

diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/methodList.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/methodList.tmpl index 7d88cd5e51..982c231fd9 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/methodList.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/methodList.tmpl @@ -29,11 +29,9 @@ var self = this;
- - - - + +
-
Properties
- -
+ + + + +
Properties
+ + +
- + + +

Default Value:

diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/signal.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/signal.tmpl index ece03b9e36..76d6f78948 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/signal.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/signal.tmpl @@ -25,10 +25,10 @@ var self = this;
-
- - -
+ + + +

 

diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/signalList.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/signalList.tmpl index c5fdefc7d8..98b0892122 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/signalList.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/signalList.tmpl @@ -13,12 +13,10 @@ var self = this;
- - - - + + + -
* * diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index a7ddb7a837..6cb9de9e96 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -180,8 +180,8 @@ class MyAvatar : public Avatar { * property value is audioListenerModeCustom. * @property {Quat} customListenOrientation=Quat.IDENTITY - The listening orientation used when the * audioListenerMode property value is audioListenerModeCustom. - * @property {boolean} hasScriptedBlendshapes=false - true to transmit blendshapes over the network.
- * Note: Currently doesn't work. Use {@link MyAvatar.setForceFaceTrackerConnected} instead. + * @property {boolean} hasScriptedBlendshapes=false - true to transmit blendshapes over the network. + *

Note: Currently doesn't work. Use {@link MyAvatar.setForceFaceTrackerConnected} instead.

* @property {boolean} hasProceduralBlinkFaceMovement=true - true if procedural blinking is turned on. * @property {boolean} hasProceduralEyeFaceMovement=true - true if procedural eye movement is turned on. * @property {boolean} hasAudioEnabledFaceMovement=true - true to move the mouth blendshapes with voice audio @@ -239,8 +239,8 @@ class MyAvatar : public Avatar { * @property {boolean} useAdvancedMovementControls - Returns and sets the value of the Interface setting, Settings > * Controls > Walking. Note: Setting the value has no effect unless Interface is restarted. * @property {boolean} showPlayArea - Returns and sets the value of the Interface setting, Settings > Controls > Show room - * boundaries while teleporting.
- * Note: Setting the value has no effect unless Interface is restarted. + * boundaries while teleporting. + *

Note: Setting the value has no effect unless Interface is restarted.

* * @property {number} yawSpeed=75 - The mouse X sensitivity value in Settings > General. Read-only. * @property {number} pitchSpeed=50 - The mouse Y sensitivity value in Settings > General. Read-only. @@ -488,9 +488,10 @@ public: * - * + * the avatar to sit on the floor when the user sits on the floor.

+ *

Note: Experimental.

* *
PropertyTypeDescription
2AutoInterface detects when the user is standing or seated in the real world. * Avatar leaning is disabled when the user is sitting (i.e., avatar always recenters), and avatar leaning is enabled * when the user is standing (i.e., avatar leans, then if leans too far it recenters).
3DisableHMDLeanBoth avatar leaning and recentering are disabled regardless of + *
3DisableHMDLean

Both avatar leaning and recentering are disabled regardless of * what the user is doing in the real world and no matter what their avatar is doing in the virtual world. Enables - * the avatar to sit on the floor when the user sits on the floor.
Note: Experimental.

* @typedef {number} MyAvatar.SitStandModelType diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index ddc1fe376c..54c9cbe277 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -83,12 +83,12 @@ PickFilter getPickFilter(unsigned int filter) { * means no maximum. * @property {Uuid} [parentID] - The ID of the parent: an avatar, an entity, or another pick. * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, an avatar joint. - * A value of 0 means no joint.
- * Used only if parentID is specified. + * A value of 0 means no joint. + *

Used only if parentID is specified.

* @property {string} [joint] - "Mouse" parents the pick to the mouse; "Avatar" parents the pick to * the user's avatar head; a joint name parents to the joint in the user's avatar; otherwise, the pick is "static", not - * parented to anything.
- * Used only if parentID is not specified. + * parented to anything. + *

Used only if parentID is not specified.

* @property {Vec3} [position=Vec3.ZERO] - The offset of the ray origin from its parent if parented, otherwise the ray origin * in world coordinates. * @property {Vec3} [posOffset] - Synonym for position. @@ -217,12 +217,12 @@ std::shared_ptr PickScriptingInterface::buildStylusPick(const QVarian * means no maximum. * @property {Uuid} [parentID] - The ID of the parent: an avatar, an entity, or another pick. * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, an avatar joint. - * A value of 0 means no joint.
- * Used only if parentID is specified. + * A value of 0 means no joint. + *

Used only if parentID is specified.

* @property {string} [joint] - "Mouse" parents the pick to the mouse; "Avatar" parents the pick to * the user's avatar head; a joint name parents to the joint in the user's avatar; otherwise, the pick is "static", not * parented to anything. - * Used only if parentID is not specified. + *

Used only if parentID is not specified.

* @property {Vec3} [position=Vec3.ZERO] - The offset of the parabola origin from its parent if parented, otherwise the * parabola origin in world coordinates. * @property {Vec3} [posOffset] - Synonym for position. @@ -327,12 +327,12 @@ std::shared_ptr PickScriptingInterface::buildParabolaPick(const QVari * means no maximum. * @property {Uuid} [parentID] - The ID of the parent: an avatar, an entity, or another pick. * @property {number} [parentJointIndex=0] - The joint of the parent to parent to, for example, an avatar joint. - * A value of 0 means no joint.
- * Used only if parentID is specified. + * A value of 0 means no joint. + *

Used only if parentID is specified.

* @property {string} [joint] - "Mouse" parents the pick to the mouse; "Avatar" parents the pick to * the user's avatar head; a joint name parents to the joint in the user's avatar; otherwise, the pick is "static", not - * parented to anything.
- * Used only if parentID is not specified. + * parented to anything. + *

Used only if parentID is not specified.

* @property {boolean} [scaleWithParent=true] - true to scale the pick's dimensions and threshold according to the * scale of the parent. * diff --git a/interface/src/scripting/ControllerScriptingInterface.h b/interface/src/scripting/ControllerScriptingInterface.h index dbd172abe7..f65791335d 100644 --- a/interface/src/scripting/ControllerScriptingInterface.h +++ b/interface/src/scripting/ControllerScriptingInterface.h @@ -216,25 +216,25 @@ class ScriptEngine; * * @property {Controller.Actions} Actions - Predefined actions on Interface and the user's avatar. These can be used as end * points in a {@link RouteObject} mapping. A synonym for Controller.Hardware.Actions. - * Read-only.

- * Default mappings are provided from the Controller.Hardware.Keyboard and Controller.Standard to - * actions in + * Read-only. + *

Default mappings are provided from the Controller.Hardware.Keyboard and Controller.Standard + * to actions in * * keyboardMouse.json and * - * standard.json, respectively. + * standard.json, respectively.

* * @property {Controller.Hardware} Hardware - Standard and hardware-specific controller and computer outputs, plus predefined * actions on Interface and the user's avatar. The outputs can be mapped to Actions or functions in a - * {@link RouteObject} mapping. Additionally, hardware-specific controller outputs can be mapped to Standard - * controller outputs. Read-only. + * {@link RouteObject} mapping. Additionally, hardware-specific controller outputs can be mapped to + * Controller.Standard controller outputs. Read-only. * * @property {Controller.Standard} Standard - Standard controller outputs that can be mapped to Actions or - * functions in a {@link RouteObject} mapping. Read-only.

- * Each hardware device has a mapping from its outputs to Controller.Standard items, specified in a JSON file. + * functions in a {@link RouteObject} mapping. Read-only. + *

Each hardware device has a mapping from its outputs to Controller.Standard items, specified in a JSON file. * For example, * leapmotion.json and - * vive.json. + * vive.json.

*/ /// handles scripting of input controller commands from JS diff --git a/interface/src/scripting/DesktopScriptingInterface.cpp b/interface/src/scripting/DesktopScriptingInterface.cpp index bb4ab89f2c..95d3bae332 100644 --- a/interface/src/scripting/DesktopScriptingInterface.cpp +++ b/interface/src/scripting/DesktopScriptingInterface.cpp @@ -31,7 +31,7 @@ * @property {InteractiveWindow.DockArea} RIGHT - Dock to the right edge of the Interface window. */ /**jsdoc - * A docking location of an InteractiveWindow. + *

A docking location of an InteractiveWindow.

* * * @@ -73,7 +73,7 @@ int DesktopScriptingInterface::getHeight() { * own separate window. */ /**jsdoc - * A display mode for an InteractiveWindow. + *

A display mode for an InteractiveWindow.

*
ValueNameDescription
* * diff --git a/interface/src/scripting/SelectionScriptingInterface.cpp b/interface/src/scripting/SelectionScriptingInterface.cpp index 5856188868..d2147ac5cc 100644 --- a/interface/src/scripting/SelectionScriptingInterface.cpp +++ b/interface/src/scripting/SelectionScriptingInterface.cpp @@ -44,7 +44,7 @@ SelectionScriptingInterface::SelectionScriptingInterface() { } /**jsdoc - * The type of a specific item in a selection list. + *

The type of a specific item in a selection list.

*
ValueNameDescription
* * diff --git a/interface/src/scripting/WalletScriptingInterface.h b/interface/src/scripting/WalletScriptingInterface.h index 3ef9c7953a..0decbbad11 100644 --- a/interface/src/scripting/WalletScriptingInterface.h +++ b/interface/src/scripting/WalletScriptingInterface.h @@ -73,9 +73,9 @@ public: /**jsdoc * Check that a certified avatar entity is owned by the avatar whose entity it is. The result of the check is provided via * the {@link WalletScriptingInterface.ownershipVerificationSuccess|ownershipVerificationSuccess} and - * {@link WalletScriptingInterface.ownershipVerificationFailed|ownershipVerificationFailed} signals.
- * Warning: Neither of these signals are triggered if the entity is not an avatar entity or is not - * certified. + * {@link WalletScriptingInterface.ownershipVerificationFailed|ownershipVerificationFailed} signals. + *

Warning: Neither of these signals are triggered if the entity is not an avatar entity or is not + * certified.

* @function WalletScriptingInterface.proveAvatarEntityOwnershipVerification * @param {Uuid} entityID - The avatar entity's ID. * @example diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 83d7de56a5..45585e940a 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -326,10 +326,10 @@ public slots: * full resolution is used (window dimensions in desktop mode; HMD display dimensions in HMD mode), otherwise one of the * dimensions is adjusted in order to match the aspect ratio. * @param {string} [filename=""] - If a filename is not provided, the image is saved as "hifi-snap-by-<user - * name>-on-YYYY-MM-DD_HH-MM-SS".
- * Still images are saved in JPEG or PNG format according to the extension provided — ".jpg", + * name>-on-YYYY-MM-DD_HH-MM-SS". + *

Still images are saved in JPEG or PNG format according to the extension provided — ".jpg", * ".jpeg", or ".png" — or if not provided then in JPEG format with an extension of - * ".jpg". Animated images are saved in GIF format. + * ".jpg". Animated images are saved in GIF format.

* * @example * function onStillSnapshotTaken(path, notify) { @@ -365,10 +365,10 @@ public slots: * @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken} * signal. * @param {string} [filename=""] - If a filename is not provided, the image is saved as "hifi-snap-by-<user - * name>-on-YYYY-MM-DD_HH-MM-SS".
- * Images are saved in JPEG or PNG format according to the extension provided — ".jpg", + * name>-on-YYYY-MM-DD_HH-MM-SS". + *

Images are saved in JPEG or PNG format according to the extension provided — ".jpg", * ".jpeg", or ".png" — or if not provided then in JPEG format with an extension of - * ".jpg". + * ".jpg".

*/ void takeSecondaryCameraSnapshot(const bool& notify = true, const QString& filename = QString()); @@ -384,10 +384,10 @@ public slots: * @param {boolean} [notify=true] - This value is passed on through the {@link Window.stillSnapshotTaken|stillSnapshotTaken} * signal. * @param {string} [filename=""] - If a filename is not provided, the image is saved as "hifi-snap-by-<user - * name>-on-YYYY-MM-DD_HH-MM-SS".
- * Images are saved in JPEG or PNG format according to the extension provided — ".jpg", + * name>-on-YYYY-MM-DD_HH-MM-SS". + *

Images are saved in JPEG or PNG format according to the extension provided — ".jpg", * ".jpeg", or ".png" — or if not provided then in JPEG format with an extension of - * ".jpg". + * ".jpg".

*/ void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat = false, const bool& notify = true, const QString& filename = QString()); @@ -515,13 +515,13 @@ public slots: /**jsdoc * Opens a URL in the Interface window or other application, depending on the URL's scheme. The following schemes are - * supported:
+ * supported: *
    *
  • hifi: Navigate to the URL in Interface.
  • *
  • hifiapp: Open a system app in Interface.
  • *
- * Other schemes will either be handled by the OS (e.g. http, https, or mailto) or - * will display a dialog asking the user to confirm that they want to try to open the URL. + *

Other schemes will either be handled by the OS (e.g. http, https, or mailto) or + * will display a dialog asking the user to confirm that they want to try to open the URL.

* @function Window.openUrl * @param {string} url - The URL to open. */ diff --git a/interface/src/ui/InteractiveWindow.h b/interface/src/ui/InteractiveWindow.h index 70077a27b0..ba53684173 100644 --- a/interface/src/ui/InteractiveWindow.h +++ b/interface/src/ui/InteractiveWindow.h @@ -56,8 +56,8 @@ namespace InteractiveWindowEnums { Q_NAMESPACE /**jsdoc - * A set of flags controlling InteractiveWindow behavior. The value is constructed by using the - * | (bitwise OR) operator on the individual flag values.
+ *

A set of flags controlling InteractiveWindow behavior. The value is constructed by using the + * | (bitwise OR) operator on the individual flag values.

*
ValueDescription
Check the ownership of all nearby certified avatar entities.Using the snapshot function and signals.
* * diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 1f5bba86b2..730554366f 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -1346,49 +1346,48 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * * * - * + * * * - * + * * * - * + * * * - * + * * * - * + * * * - * + * * * - * + * * * - * + * * * - * + * * * - * + * * * - * + * * * *
Flag NameValueDescription
Some text.{@link Overlays.OverlayProperties-Text|OverlayProperties-Text}
"cube"3DA cube. A "shape" overlay can also be used to create a cube.
- * Deprecated. - *

A cube. A "shape" overlay can also be used to create a cube.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Cube|OverlayProperties-Cube}
"sphere"3DA sphere. A "shape" overlay can also be used to create a sphere.
- * Deprecated.

A sphere. A "shape" overlay can also be used to create a sphere.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Sphere|OverlayProperties-Sphere}
"shape"3DA geometric shape, such as a cube, sphere, or cylinder.
- * Deprecated.

A geometric shape, such as a cube, sphere, or cylinder.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Shape|OverlayProperties-Shape}
"model"3DA model.
- * Deprecated.

A model.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Model|OverlayProperties-Model}
"image3d"3DAn image. Synonym: "billboard".
- * Deprecated.

An image. Synonym: "billboard".

+ *

Deprecated.

{@link Overlays.OverlayProperties-Image3D|OverlayProperties-Image3D}
"rectangle3d"3DA rectangle.
- * Deprecated.

A rectangle.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Rectangle3D|OverlayProperties-Rectangle3D}
"text3d"3DSome text.
- * Deprecated.

Some text.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Text3D|OverlayProperties-Text3D}
"web3d"3DWeb content.
- * Deprecated.

Web content.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Web3D|OverlayProperties-Web3D}
"line3d"3DA line.
- * Deprecated.

A line.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Line3D|OverlayProperties-Line3D}
"grid"3DA grid of lines in a plane.
- * Deprecated.

A grid of lines in a plane.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Grid|OverlayProperties-Grid}
"circle3d"3DA circle.
- * Deprecated.

A circle.

+ *

Deprecated.

{@link Overlays.OverlayProperties-Circle3D|OverlayProperties-Circle3D}
@@ -1410,17 +1409,17 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @see {@link Overlays.OverlayProperties-Rectangle|OverlayProperties-Rectangle} * @see {@link Overlays.OverlayProperties-Image|OverlayProperties-Image} * @see {@link Overlays.OverlayProperties-Text|OverlayProperties-Text} - * @see {@link Overlays.OverlayProperties-Cube|OverlayProperties-Cube} Deprecated. - * @see {@link Overlays.OverlayProperties-Sphere|OverlayProperties-Sphere} Deprecated. - * @see {@link Overlays.OverlayProperties-Shape|OverlayProperties-Shape} Deprecated. - * @see {@link Overlays.OverlayProperties-Model|OverlayProperties-Model} Deprecated. - * @see {@link Overlays.OverlayProperties-Rectangle3D|OverlayProperties-Rectangle3D} Deprecated. - * @see {@link Overlays.OverlayProperties-Image3D|OverlayProperties-Image3D} Deprecated. - * @see {@link Overlays.OverlayProperties-Text3D|OverlayProperties-Text3D} Deprecated. - * @see {@link Overlays.OverlayProperties-Web3D|OverlayProperties-Web3D} Deprecated. - * @see {@link Overlays.OverlayProperties-Line3D|OverlayProperties-Line3D} Deprecated. - * @see {@link Overlays.OverlayProperties-Grid|OverlayProperties-Grid} Deprecated. - * @see {@link Overlays.OverlayProperties-Circle3D|OverlayProperties-Circle3D} Deprecated. + * @see {@link Overlays.OverlayProperties-Cube|OverlayProperties-Cube} — Deprecated. + * @see {@link Overlays.OverlayProperties-Sphere|OverlayProperties-Sphere} — Deprecated. + * @see {@link Overlays.OverlayProperties-Shape|OverlayProperties-Shape} — Deprecated. + * @see {@link Overlays.OverlayProperties-Model|OverlayProperties-Model} — Deprecated. + * @see {@link Overlays.OverlayProperties-Rectangle3D|OverlayProperties-Rectangle3D} — Deprecated. + * @see {@link Overlays.OverlayProperties-Image3D|OverlayProperties-Image3D} — Deprecated. + * @see {@link Overlays.OverlayProperties-Text3D|OverlayProperties-Text3D} — Deprecated. + * @see {@link Overlays.OverlayProperties-Web3D|OverlayProperties-Web3D} — Deprecated. + * @see {@link Overlays.OverlayProperties-Line3D|OverlayProperties-Line3D} — Deprecated. + * @see {@link Overlays.OverlayProperties-Grid|OverlayProperties-Grid} — Deprecated. + * @see {@link Overlays.OverlayProperties-Circle3D|OverlayProperties-Circle3D} — Deprecated. */ /**jsdoc diff --git a/libraries/animation/src/AnimInverseKinematics.h b/libraries/animation/src/AnimInverseKinematics.h index d184038815..959a504e79 100644 --- a/libraries/animation/src/AnimInverseKinematics.h +++ b/libraries/animation/src/AnimInverseKinematics.h @@ -73,12 +73,14 @@ public: *
1RelaxToLimitCenterPosesThis is a blend: it is 15/16 * PreviousSolution and 1/16 LimitCenterPoses. This should converge quickly because it is * close to the previous solution, but still provides the benefits of avoiding limb locking.
2PreviousSolutionThe IK system will begin to solve from the same position and - * orientations for each joint that was the result from the previous frame.
- * Pros: As the end effectors typically do not move much from frame to frame, this is likely to converge quickly - * to a valid solution.
- * Cons: If the previous solution resulted in an awkward or uncomfortable posture, the next frame will also be - * awkward and uncomfortable. It can also result in locked elbows and knees.
2PreviousSolution + *

The IK system will begin to solve from the same position and orientations for each joint that was the result + * from the previous frame.

+ *

Pros: As the end effectors typically do not move much from frame to frame, this is likely to converge quickly + * to a valid solution.

+ *

Cons: If the previous solution resulted in an awkward or uncomfortable posture, the next frame will also be + * awkward and uncomfortable. It can also result in locked elbows and knees.

+ *
3UnderPosesThe IK occurs at one of the top-most layers. It has access to the * full posture that was computed via canned animations and blends. We call this animated set of poses the "under * pose". The under poses are what would be visible if IK was completely disabled. Using the under poses as the diff --git a/libraries/animation/src/IKTarget.h b/libraries/animation/src/IKTarget.h index d0c060e44c..a56f5578b3 100644 --- a/libraries/animation/src/IKTarget.h +++ b/libraries/animation/src/IKTarget.h @@ -26,8 +26,8 @@ public: *
0RotationAndPositionAttempt to reach the rotation and position end * effector.
1RotationOnlyAttempt to reach the end effector rotation only.
2HmdHeadA special mode of IK that would attempt to prevent unnecessary - * bending of the spine.
+ *
2HmdHead + *

A special mode of IK that would attempt to prevent unnecessary bending of the spine.

*

Deprecated: This target type is deprecated and will be removed.

3HipsRelativeRotationAndPositionAttempt to reach a rotation and position end * effector that is not in absolute rig coordinates but is offset by the avatar hips translation.
* diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index c03f9430be..0389dc9149 100755 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -1444,7 +1444,7 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) { } /**jsdoc - * The avatar mixer data comprises different types of data, with the data rates of each being tracked in kbps. + *

The avatar mixer data comprises different types of data, with the data rates of each being tracked in kbps.

* *
* @@ -1549,7 +1549,7 @@ float AvatarData::getDataRate(const QString& rateName) const { } /**jsdoc - * The avatar mixer data comprises different types of data updated at different rates, in Hz. + *

The avatar mixer data comprises different types of data updated at different rates, in Hz.

* *
* diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 59a2e2a53e..df0783ef4b 100755 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -1277,9 +1277,9 @@ public: * @param {number} [scale=1.0] - The scale to apply to the model. * @param {boolean} [isSoft=false] - If the model has a skeleton, set this to true so that the bones of the * attached model's skeleton are rotated to fit the avatar's current pose. isSoft is used, for example, - * to have clothing that moves with the avatar.
- * If true, the translation, rotation, and scale parameters are - * ignored. + * to have clothing that moves with the avatar. + *

If true, the translation, rotation, and scale parameters are + * ignored.

* @param {boolean} [allowDuplicates=false] - If true then more than one copy of any particular model may be * attached to the same joint; if false then the same model cannot be attached to the same joint. * @param {boolean} [useSaved=true] - Not used. diff --git a/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h b/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h index 5f3b9dc3fc..5a8fd3083d 100644 --- a/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h +++ b/libraries/controllers/src/controllers/impl/MappingBuilderProxy.h @@ -135,8 +135,8 @@ public: /**jsdoc * Creates a new {@link RouteObject} from a controller output, ready to be mapped to a standard control, action, or - * function.
- * This is a QML-specific version of {@link MappingObject#from|from}: use this version in QML files. + * function. + *

This is a QML-specific version of {@link MappingObject#from|from}: use this version in QML files.

* @function MappingObject#fromQml * @param {Controller.Standard|Controller.Hardware|function} source - The controller output or function that is the source * of the route data. If a function, it must return a number or a {@link Pose} value as the route data. @@ -146,8 +146,8 @@ public: /**jsdoc * Creates a new {@link RouteObject} from two numeric {@link Controller.Hardware} outputs, one applied in the negative - * direction and the other in the positive direction, ready to be mapped to a standard control, action, or function.
- * This is a QML-specific version of {@link MappingObject#makeAxis|makeAxis}: use this version in QML files. + * direction and the other in the positive direction, ready to be mapped to a standard control, action, or function. + *

This is a QML-specific version of {@link MappingObject#makeAxis|makeAxis}: use this version in QML files.

* @function MappingObject#makeAxisQml * @param {Controller.Hardware} source1 - The first, negative-direction controller output. * @param {Controller.Hardware} source2 - The second, positive-direction controller output. @@ -189,8 +189,8 @@ public: Q_INVOKABLE QObject* makeAxis(const QScriptValue& source1, const QScriptValue& source2); /**jsdoc - * Enables or disables the mapping. When enabled, the routes in the mapping take effect.
- * Synonymous with {@link Controller.enableMapping}. + * Enables or disables the mapping. When enabled, the routes in the mapping take effect. + *

Synonymous with {@link Controller.enableMapping}.

* @function MappingObject#enable * @param {boolean} enable=true - If true then the mapping is enabled, otherwise it is disabled. * @returns {MappingObject} The mapping object, so that further routes can be added. @@ -198,8 +198,8 @@ public: Q_INVOKABLE QObject* enable(bool enable = true); /**jsdoc - * Disables the mapping. When disabled, the routes in the mapping have no effect.
- * Synonymous with {@link Controller.disableMapping}. + * Disables the mapping. When disabled, the routes in the mapping have no effect. + *

Synonymous with {@link Controller.disableMapping}.

* @function MappingObject#disable * @returns {MappingObject} The mapping object, so that further routes can be added. */ diff --git a/libraries/controllers/src/controllers/impl/RouteBuilderProxy.h b/libraries/controllers/src/controllers/impl/RouteBuilderProxy.h index e7ff04d72c..f1b36cfec5 100644 --- a/libraries/controllers/src/controllers/impl/RouteBuilderProxy.h +++ b/libraries/controllers/src/controllers/impl/RouteBuilderProxy.h @@ -52,8 +52,8 @@ class RouteBuilderProxy : public QObject { /**jsdoc * Terminates the route with a standard control, an action, or a script function. The output value from the route is - * sent to the specified destination.
- * This is a QML-specific version of {@link MappingObject#to|to}: use this version in QML files. + * sent to the specified destination. + *

This is a QML-specific version of {@link MappingObject#to|to}: use this version in QML files.

* @function RouteObject#toQml * @param {Controller.Standard|Controller.Actions|function} destination - The standard control, action, or JavaScript * function that the route output is mapped to. For a function, the parameter can be either the name of the function or @@ -64,8 +64,8 @@ class RouteBuilderProxy : public QObject { /**jsdoc * Processes the route only if a condition is satisfied. The condition is evaluated before the route input is read, and * the input is read only if the condition is true. Thus, if the condition is not met then subsequent - * routes using the same input are processed.
- * This is a QML-specific version of {@link MappingObject#to|to}: use this version in QML files. + * routes using the same input are processed. + *

This is a QML-specific version of {@link MappingObject#when|when}: use this version in QML files.

* @function RouteObject#whenQml * @param {condition|condition[]} expression -

A condition may be a:

*
    diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index e45d05a1b5..b835cab40b 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -1217,10 +1217,10 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * dimensions / voxelVolumesize. * @property {string} voxelData="ABAAEAAQAAAAHgAAEAB42u3BAQ0AAADCoPdPbQ8HFAAAAPBuEAAAAQ==" - Base-64 encoded compressed dump of * the PolyVox data. This property is typically not used in scripts directly; rather, functions that manipulate a PolyVox - * entity update it.
    - * The size of this property increases with the size and complexity of the PolyVox entity, with the size depending on how + * entity update it. + *

    The size of this property increases with the size and complexity of the PolyVox entity, with the size depending on how * the particular entity's voxels compress. Because this property value has to fit within a High Fidelity datagram packet, - * there is a limit to the size and complexity of a PolyVox entity; edits which would result in an overflow are rejected. + * there is a limit to the size and complexity of a PolyVox entity; edits which would result in an overflow are rejected.

    * @property {Entities.PolyVoxSurfaceStyle} voxelSurfaceStyle=2 - The style of rendering the voxels' surface and how * neighboring PolyVox entities are joined. * @property {string} xTextureURL="" - The URL of the texture to map to surfaces perpendicular to the entity's local x-axis. diff --git a/libraries/entities/src/EntityTypes.h b/libraries/entities/src/EntityTypes.h index 4106eb8054..7f72c3f761 100644 --- a/libraries/entities/src/EntityTypes.h +++ b/libraries/entities/src/EntityTypes.h @@ -46,18 +46,18 @@ public: * See also, the "Box" and "Sphere" entity types. *
* * * * * * diff --git a/libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp b/libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp index ac8e6b8053..b1746951bb 100755 --- a/libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp @@ -275,13 +275,15 @@ controller::Input KeyboardMouseDevice::InputDevice::makeInput(KeyboardMouseDevic * * + * is the number of units rotated (typically 1.0). + *

Warning: The mouse wheel in an ordinary mouse generates left/right wheel events instead of + * up/down.

+ * *
+ * is the number of units rotated (typically 1.0). + *

Warning: The mouse wheel in an ordinary mouse generates left/right wheel events instead of + * up/down.

+ * *
* * // Receiving script. * var channelName = "com.highfidelity.example.messages-example"; @@ -105,10 +105,10 @@ public: * @param {object} data - The data to send. The data is handled as a byte stream, for example, as may be provided via a * JavaScript Int8Array object. * @param {boolean} [localOnly=false] - If false then the message is sent to all Interface, client entity, - * server entity, and assignment client scripts in the domain.
- * If true then: if sent from an Interface or client entity script it is received by all Interface and + * server entity, and assignment client scripts in the domain. + *

If true then: if sent from an Interface or client entity script it is received by all Interface and * client entity scripts; if sent from a server entity script it is received by all entity server scripts; and if sent - * from an assignment client script it is received only by that same assignment client script. + * from an assignment client script it is received only by that same assignment client script.

* @example
* // Receiving script. * var channelName = "com.highfidelity.example.messages-example"; diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 8337d1911a..4cf4a9fc42 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -1027,8 +1027,8 @@ void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& }; /**jsdoc - * The name of an entity event. When the entity event occurs, any function that has been registered for that event via - * {@link Script.addEventHandler} is called with parameters per the entity event. + *

The name of an entity event. When the entity event occurs, any function that has been registered for that event via + * {@link Script.addEventHandler} is called with parameters per the entity event.

*
{@link Entities.EntityProperties-Shape|EntityProperties-Shape}
"Box"A rectangular prism. This is a synonym of "Shape" for the case - * where the entity's shape property value is "Cube".
- * If an entity is created with its type + * where the entity's shape property value is "Cube". + *

If an entity is created with its type * set to "Box" it will always be created with a shape property value of * "Cube". If an entity of type Shape or Sphere has its shape set - * to "Cube" then its type will be reported as "Box". + * to "Cube" then its type will be reported as "Box".

{@link Entities.EntityProperties-Box|EntityProperties-Box}
"Sphere"A sphere. This is a synonym of "Shape" for the case - * where the entity's shape property value is "Sphere".
- * If an entity is created with its type + * where the entity's shape property value is "Sphere". + *

If an entity is created with its type * set to "Sphere" it will always be created with a shape property value of * "Sphere". If an entity of type Box or Shape has its shape set - * to "Sphere" then its type will be reported as "Sphere". + * to "Sphere" then its type will be reported as "Sphere".

{@link Entities.EntityProperties-Sphere|EntityProperties-Sphere}
"Model"A mesh model from a glTF, FBX, or OBJ file.{@link Entities.EntityProperties-Model|EntityProperties-Model}
MouseWheelLeftnumbernumberThe mouse wheel rotated left. The data value * is the number of units rotated (typically 1.0).
MouseWheelUpnumbernumberThe mouse wheel rotated up. The data value - * is the number of units rotated (typically 1.0).
- * Warning: The mouse wheel in an ordinary mouse generates left/right wheel events instead of - * up/down.
MouseWheelDownnumbernumberThe mouse wheel rotated down. The data value - * is the number of units rotated (typically 1.0).
- * Warning: The mouse wheel in an ordinary mouse generates left/right wheel events instead of - * up/down.
TouchpadRightnumbernumberThe average touch on a touch-enabled device * moved right. The data value is how far the average position of all touch points moved.
TouchpadLeftnumbernumberThe average touch on a touch-enabled device diff --git a/libraries/networking/src/MessagesClient.h b/libraries/networking/src/MessagesClient.h index b97c6d8360..7f2714e5ea 100644 --- a/libraries/networking/src/MessagesClient.h +++ b/libraries/networking/src/MessagesClient.h @@ -57,10 +57,10 @@ public: * @param {string} channel - The channel to send the message on. * @param {string} message - The message to send. * @param {boolean} [localOnly=false] - If false then the message is sent to all Interface, client entity, - * server entity, and assignment client scripts in the domain.
- * If true then: if sent from an Interface or client entity script it is received by all Interface and + * server entity, and assignment client scripts in the domain. + *

If true then: if sent from an Interface or client entity script it is received by all Interface and * client entity scripts; if sent from a server entity script it is received by all entity server scripts; and if sent - * from an assignment client script it is received only by that same assignment client script. + * from an assignment client script it is received only by that same assignment client script.

* @example
Send and receive a message.Send and receive data.
* * diff --git a/libraries/ui/src/ui/TabletScriptingInterface.h b/libraries/ui/src/ui/TabletScriptingInterface.h index ba02ba25b0..8cb28c2f20 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.h +++ b/libraries/ui/src/ui/TabletScriptingInterface.h @@ -69,7 +69,7 @@ class TabletScriptingInterface : public QObject, public Dependency { public: /**jsdoc - * Standard tablet sounds. + *

Standard tablet sounds.

*
Event NameEntity Event
* * From 19888fad036e1b6d3dabb6f72072faa16ba5e62a Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 08:35:23 +1200 Subject: [PATCH 07/41] Format findableBy and audioListenerMode property values as lists --- interface/src/avatar/MyAvatar.h | 10 ++++--- .../AccountServicesScriptingInterface.h | 26 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 6cb9de9e96..fb9b605434 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -168,10 +168,12 @@ class MyAvatar : public Avatar { * collision. It can be a mono or stereo 16-bit WAV file running at either 24kHz or 48kHz. The latter is down-sampled * by the audio mixer, so all audio effectively plays back at a 24khz. 48kHz RAW files are also supported. * @property {number} audioListenerMode=0 - Specifies the listening position when hearing spatialized audio. Must be one - * of the following property values:
- * Myavatar.audioListenerModeHead
- * Myavatar.audioListenerModeCamera
- * Myavatar.audioListenerModeCustom + * of the following property values: + *
    + *
  • MyAvatar.audioListenerModeHead
  • + *
  • MyAvatar.audioListenerModeCamera
  • + *
  • MyAvatar.audioListenerModeCustom
  • + *
* @property {number} audioListenerModeHead=0 - The audio listening position is at the avatar's head. Read-only. * @property {number} audioListenerModeCamera=1 - The audio listening position is at the camera. Read-only. * @property {number} audioListenerModeCustom=2 - The audio listening position is at a the position specified by set by the diff --git a/interface/src/scripting/AccountServicesScriptingInterface.h b/interface/src/scripting/AccountServicesScriptingInterface.h index b188b4e63b..3ad637d0e6 100644 --- a/interface/src/scripting/AccountServicesScriptingInterface.h +++ b/interface/src/scripting/AccountServicesScriptingInterface.h @@ -50,12 +50,14 @@ class AccountServicesScriptingInterface : public QObject { * "Unknown user". Read-only. * @property {boolean} loggedIn - true if the user is logged in, otherwise false. * Read-only. - * @property {string} findableBy - The user's visibility to other users:
- * "none" - user appears offline.
- * "friends" - user is visible only to friends.
- * "connections" - user is visible to friends and connections.
- * "all" - user is visible to everyone. - * @property {string} metaverseServerURL - The metaverse server that the user is authenticated against when logged in + * @property {string} findableBy - The user's visibility to other users: + *
    + *
  • "none" — user appears offline.
  • + *
  • "friends" — user is visible only to friends.
  • + *
  • "connections" — user is visible to friends and connections.
  • + *
  • "all" — user is visible to everyone.
  • + *
+ * @property {string} metaverseServerURL - The metaverse server that the user is authenticated against when logged in * — typically "https://metaverse.highfidelity.com". Read-only. */ @@ -160,11 +162,13 @@ signals: /**jsdoc * Triggered when the user's visibility to others changes. * @function AccountServices.findableByChanged - * @param {string} findableBy - The user's visibility to other people:
- * "none" - user appears offline.
- * "friends" - user is visible only to friends.
- * "connections" - user is visible to friends and connections.
- * "all" - user is visible to everyone. + * @param {string} findableBy - The user's visibility to other people: + *
    + *
  • "none" — user appears offline.
  • + *
  • "friends" — user is visible only to friends.
  • + *
  • "connections" — user is visible to friends and connections.
  • + *
  • "all" — user is visible to everyone.
  • + *
* @returns {Signal} * @example
* AccountServices.findableByChanged.connect(function (findableBy) { From 77fcda90c83b263e3942b748681c7937ebb3e7ff Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 08:50:06 +1200 Subject: [PATCH 08/41] Remove Description section from Global page --- tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl index c2aa955b80..a09b9276fc 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl @@ -65,7 +65,8 @@
- + +

Description

From d02a111e691ee08659b761adbf7b8d4f0be8212d Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 09:18:44 +1200 Subject: [PATCH 09/41] Increase font sizes of Parameters and Example headings and example code --- .../jsdoc/hifi-jsdoc-template/static/styles/jsdoc.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/jsdoc/hifi-jsdoc-template/static/styles/jsdoc.css b/tools/jsdoc/hifi-jsdoc-template/static/styles/jsdoc.css index 7b666de37b..dd67a4da20 100644 --- a/tools/jsdoc/hifi-jsdoc-template/static/styles/jsdoc.css +++ b/tools/jsdoc/hifi-jsdoc-template/static/styles/jsdoc.css @@ -96,7 +96,7 @@ h6 .paramHeading, .typeDef h3.propsHeading, h3.subHeading { - font-size: .9rem; + font-size: 1rem; font-family: "Proxima Nova"; font-weight: bold; border-bottom: solid 1px #ddd; @@ -108,9 +108,9 @@ h4.name padding-bottom: 0px; } -h5, .container-overview .subsection-title -{ - font-size: 13px; +h5, .container-overview .subsection-title { + font-size: 1rem; + font-family: "Proxima Nova"; font-weight: bold; margin-bottom: 5px; } @@ -546,7 +546,7 @@ header { .prettyprint code { - font-size: 0.9em; + font-size: .95em; line-height: 18px; display: block; padding: 4px 12px; From 42bc9356ca38aa6591da45279ea9fa1921547db3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 09:23:09 +1200 Subject: [PATCH 10/41] Add Steam to list of limited commerce versions --- interface/src/scripting/WalletScriptingInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/scripting/WalletScriptingInterface.h b/interface/src/scripting/WalletScriptingInterface.h index 0decbbad11..e9535ceb4e 100644 --- a/interface/src/scripting/WalletScriptingInterface.h +++ b/interface/src/scripting/WalletScriptingInterface.h @@ -42,7 +42,7 @@ public: * @property {WalletScriptingInterface.WalletStatus} walletStatus - The status of the user's wallet. Read-only. * @property {boolean} limitedCommerce - true if Interface is running in limited commerce mode. In limited commerce * mode, certain Interface functionalities are disabled, e.g., users can't buy items that are not free from the Marketplace. - * The Oculus Store version of Interface runs in limited commerce mode. Read-only. + * The Oculus Store and Steam versions of Interface run in limited commerce mode. Read-only. */ class WalletScriptingInterface : public QObject, public Dependency { Q_OBJECT From c2e5748452be37169bf21220d5e7443ab8ddcb9f Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 10:16:43 +1200 Subject: [PATCH 11/41] Move classes' details above constructor --- tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl b/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl index a09b9276fc..fccf5f7d31 100644 --- a/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl +++ b/tools/jsdoc/hifi-jsdoc-template/tmpl/container.tmpl @@ -78,6 +78,7 @@

Description

+
ValueDescription
Report when your visiblity changes.
@@ -95,7 +96,6 @@
-

Example 1? 's':'' ?>

From 34883990b4e1c3e5a589fc8f5b94e9b64f8b057b Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 10:19:02 +1200 Subject: [PATCH 12/41] Clarify which line3d overlay properties aren't working --- interface/src/ui/overlays/Overlays.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 730554366f..3289cb1594 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -1915,6 +1915,8 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * HUD surface. * @property {boolean} grabbable=false - true if the overlay can be grabbed, false if it can't be. * @property {Uuid} parentID=null - The avatar, entity, or overlay that the overlay is parented to. + *

Currently doesn't work.

+ * @comment CURRENTLY BROKEN * @property {number} parentJointIndex=65535 - Integer value specifying the joint of the entity or avatar that the entity is * parented to if parentID is set. Use 65535 or -1 to parent to the parent's position and orientation rather * than a joint. @@ -1928,17 +1930,19 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * @comment CURRENTLY BROKEN * @property {Vec3} start - The start point of the line. Synonyms: startPoint and p1. - *

If parentID is set, use localStart to set the local position of the start point.

- * @comment CURRENTLY BROKEN + *

Note: If parentID is set, use localStart to set the local position of the + * start point.

* @property {Vec3} end - The end point of the line. Synonyms: endPoint and p2. - *

If parentID is set, use localEnd to set the local position of the end point.

- * @comment CURRENTLY BROKEN + *

Note: If parentID is set, use localEnd to set the local position of the + * end point.

* @property {Vec3} localStart - The local position of the overlay relative to its parent if the overlay has a * parentID set, otherwise the same value as start. + *

Currently doesn't work.

* @comment CURRENTLY BROKEN * @property {Vec3} localEnd - The local position of the overlay relative to its parent if the overlay has a * endParentID set, otherwise the same value as end. + *

Currently doesn't work.

* @comment CURRENTLY BROKEN * @property {number} length - The length of the line, in meters. This can be set after creating a line with start and end From 9d9317c50db1bc48df8cc488d36eba99971696e1 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 10:19:45 +1200 Subject: [PATCH 13/41] Miscellaneous fixes and typos --- interface/src/raypick/PickScriptingInterface.cpp | 16 +++++++++------- .../src/scripting/WindowScriptingInterface.h | 4 ++-- .../src/avatars-renderer/Avatar.h | 2 +- libraries/script-engine/src/Quat.h | 5 +++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index 54c9cbe277..3a7b67a8e9 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -78,7 +78,7 @@ PickFilter getPickFilter(unsigned int filter) { * @property {boolean} [enabled=false] - true if this pick should start enabled, false if it should * start disabled. Disabled picks do not update their pick results. * @property {FilterFlags} [filter=0] - The filter for this pick to use. Construct using {@link Picks} FilterFlags property - * values (e.g., Picks.PICK_DOMAIN_ENTTITIES) combined with | (bitwise OR) operators. + * values (e.g., Picks.PICK_DOMAIN_ENTITIES) combined with | (bitwise OR) operators. * @property {number} [maxDistance=0.0] - The maximum distance at which this pick will intersect. A value of 0.0 * means no maximum. * @property {Uuid} [parentID] - The ID of the parent: an avatar, an entity, or another pick. @@ -164,7 +164,7 @@ std::shared_ptr PickScriptingInterface::buildRayPick(const QVariantMa * @property {boolean} [enabled=false] - true if this pick should start enabled, false if it should * start disabled. Disabled picks do not update their pick results. * @property {number} [filter=0] - The filter for this pick to use. Construct using {@link Picks} FilterFlags property - * values (e.g., Picks.PICK_DOMAIN_ENTTITIES) combined with | (bitwise OR) operators. + * values (e.g., Picks.PICK_DOMAIN_ENTITIES) combined with | (bitwise OR) operators. *

Note: Stylus picks do not intersect avatars or the HUD.

* @property {number} [maxDistance=0.0] - The maximum distance at which this pick will intersect. A value of 0.0 * means no maximum. @@ -212,7 +212,7 @@ std::shared_ptr PickScriptingInterface::buildStylusPick(const QVarian * @property {boolean} [enabled=false] - true if this pick should start enabled, false if it should * start disabled. Disabled picks do not update their pick results. * @property {number} [filter=0] - The filter for this pick to use. Construct using {@link Picks} FilterFlags property - * values (e.g., Picks.PICK_DOMAIN_ENTTITIES) combined with | (bitwise OR) operators. + * values (e.g., Picks.PICK_DOMAIN_ENTITIES) combined with | (bitwise OR) operators. * @property {number} [maxDistance=0.0] - The maximum distance at which this pick will intersect. A value of 0.0 * means no maximum. * @property {Uuid} [parentID] - The ID of the parent: an avatar, an entity, or another pick. @@ -321,7 +321,7 @@ std::shared_ptr PickScriptingInterface::buildParabolaPick(const QVari * @property {boolean} [enabled=false] - true if this pick should start enabled, false if it should * start disabled. Disabled picks do not update their pick results. * @property {FilterFlags} [filter=0] - The filter for this pick to use. Construct using {@link Picks} FilterFlags property - * values (e.g., Picks.PICK_DOMAIN_ENTTITIES) combined with | (bitwise OR) operators. + * values (e.g., Picks.PICK_DOMAIN_ENTITIES) combined with | (bitwise OR) operators. *

Note: Collision picks do not intersect the HUD.

* @property {number} [maxDistance=0.0] - The maximum distance at which this pick will intersect. A value of 0.0 * means no maximum. @@ -344,9 +344,11 @@ std::shared_ptr PickScriptingInterface::buildParabolaPick(const QVari * the collision region. The depth is in world coordinates but scales with the parent if defined. * @property {CollisionMask} [collisionGroup=8] - The type of objects the collision region collides as. Objects whose collision * masks overlap with the region's collision group are considered to be colliding with the region. - * @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties} or {@link Picks.getPickScriptParameters}. A collision pick's type is {@link PickType.Collision}. - * @property {Vec3} baseScale - Returned from {@link Picks.getPickProperties} when the pick has a parent with varying scale (usually an avatar or an entity). - * Its value is the original scale of the parent at the moment the pick was created, and is used to rescale the pick, and/or the pointer which owns this pick, if any. + * @property {PickType} pickType - The type of pick when getting these properties from {@link Picks.getPickProperties} or + * {@link Picks.getPickScriptParameters}. A collision pick's type is {@link PickType.Collision}. + * @property {Vec3} baseScale - Returned from {@link Picks.getPickProperties} when the pick has a parent with varying scale + * (usually an avatar or an entity). Its value is the original scale of the parent at the moment the pick was created, and + * is used to rescale the pick, and/or the pointer which owns this pick, if any. */ std::shared_ptr PickScriptingInterface::buildCollisionPick(const QVariantMap& propMap) { bool enabled = false; diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 45585e940a..341b012c2d 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -623,8 +623,8 @@ private slots: signals: /**jsdoc - * Triggered when you change the domain you're visiting. Warning: Is not emitted if you go to a domain - * that isn't running. + * Triggered when you change the domain you're visiting. + *

Warning: Is not emitted if you go to a domain that isn't running.

* @function Window.domainChanged * @param {string} domainURL - The domain's URL. * @returns {Signal} diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h index 7bb15ecbf7..a1827334d8 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.h +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.h @@ -468,7 +468,7 @@ public: /**jsdoc * Sets the joint of the entity or avatar that the avatar is parented to. * @function MyAvatar.setParentJointIndex - * @param {number} parentJointIndex - he joint of the entity or avatar that the avatar should be parented to. Use + * @param {number} parentJointIndex - The joint of the entity or avatar that the avatar should be parented to. Use * 65535 or -1 to parent to the entity or avatar's position and orientation rather than a * joint. */ diff --git a/libraries/script-engine/src/Quat.h b/libraries/script-engine/src/Quat.h index 1cd4802e48..44abe62b24 100644 --- a/libraries/script-engine/src/Quat.h +++ b/libraries/script-engine/src/Quat.h @@ -405,8 +405,9 @@ public slots: void print(const QString& label, const glm::quat& q, bool asDegrees = false); /**jsdoc - * Tests whether two quaternions are equal. Note: The quaternions must be exactly equal in order for - * true to be returned; it is often better to use {@link Quat(0).dot|Quat.dot} and test for closeness to +/-1. + * Tests whether two quaternions are equal. + *

Note: The quaternions must be exactly equal in order for true to be returned; it is + * often better to use {@link Quat(0).dot|Quat.dot} and test for closeness to +/-1.

* @function Quat(0).equal * @param {Quat} q1 - The first quaternion. * @param {Quat} q2 - The second quaternion. From 5a4ab1d43f5e258aee2376b583e090e20a1c3d91 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 20 Sep 2019 10:27:21 +1200 Subject: [PATCH 14/41] Missed typo --- interface/src/raypick/PointerScriptingInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/raypick/PointerScriptingInterface.h b/interface/src/raypick/PointerScriptingInterface.h index 0eed8b4741..2d2f3f6dae 100644 --- a/interface/src/raypick/PointerScriptingInterface.h +++ b/interface/src/raypick/PointerScriptingInterface.h @@ -41,7 +41,7 @@ public: * @property {Controller.Standard|Controller.Actions|function} action - The controller output or function that triggers the * events on the entity or overlay. If a function, it must return a number >= 1.0 to start the action * and < 1.0 to terminate the action. - * @property {string} button - Which button to trigger. + * @property {string} button - Which button to trigger: *
    *
  • "Primary", "Secondary", and "Tertiary" cause {@link Entities} and * {@link Overlays} mouse pointer events. Other button names also cause mouse events but the button From 0cafae2422aab37074d25a3566f45d254ee0a770 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 26 Sep 2019 10:48:08 +1200 Subject: [PATCH 15/41] EntityViewer JSDoc --- .../src/entities/EntityTreeHeadlessViewer.h | 3 ++ .../src/octree/OctreeHeadlessViewer.h | 40 +++++++++++++------ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/assignment-client/src/entities/EntityTreeHeadlessViewer.h b/assignment-client/src/entities/EntityTreeHeadlessViewer.h index f4d5911821..a8503510e0 100644 --- a/assignment-client/src/entities/EntityTreeHeadlessViewer.h +++ b/assignment-client/src/entities/EntityTreeHeadlessViewer.h @@ -24,6 +24,9 @@ class EntitySimulation; /**jsdoc + * The EntityViewer API provides a headless viewer for assignment client scripts, so that they can "see" entities + * in order for them to be available in the {@link Entities} API. + * * @namespace EntityViewer * * @hifi-assignment-client diff --git a/assignment-client/src/octree/OctreeHeadlessViewer.h b/assignment-client/src/octree/OctreeHeadlessViewer.h index 67a81b1d2a..2debf2cb84 100644 --- a/assignment-client/src/octree/OctreeHeadlessViewer.h +++ b/assignment-client/src/octree/OctreeHeadlessViewer.h @@ -28,6 +28,7 @@ public: public slots: /**jsdoc + * Updates the entities currently in view. * @function EntityViewer.queryOctree */ void queryOctree(); @@ -36,26 +37,30 @@ public slots: // setters for camera attributes /**jsdoc + * Sets the position of the view frustum. * @function EntityViewer.setPosition - * @param {Vec3} position + * @param {Vec3} position - The position of the view frustum. */ void setPosition(const glm::vec3& position) { _hasViewFrustum = true; _viewFrustum.setPosition(position); } /**jsdoc + * Sets the orientation of the view frustum. * @function EntityViewer.setOrientation - * @param {Quat} orientation + * @param {Quat} orientation - The orientation of the view frustum. */ void setOrientation(const glm::quat& orientation) { _hasViewFrustum = true; _viewFrustum.setOrientation(orientation); } /**jsdoc + * Sets the radius of the center "keyhole" in the view frustum. * @function EntityViewer.setCenterRadius - * @param {number} radius + * @param {number} radius - The radius of the center "keyhole" in the view frustum. */ void setCenterRadius(float radius) { _hasViewFrustum = true; _viewFrustum.setCenterRadius(radius); } /**jsdoc + * Sets the radius of the center "keyhole" in the view frustum. * @function EntityViewer.setKeyholeRadius - * @param {number} radius + * @param {number} radius - The radius of the center "keyhole" in the view frustum. * @deprecated This function is deprecated and will be removed. Use {@link EntityViewer.setCenterRadius|setCenterRadius} * instead. */ @@ -66,33 +71,38 @@ public slots: /**jsdoc * @function EntityViewer.setVoxelSizeScale - * @param {number} sizeScale + * @param {number} sizeScale - The voxel size scale. + * @deprecated This function is deprecated and will be removed. */ void setVoxelSizeScale(float sizeScale) { _octreeQuery.setOctreeSizeScale(sizeScale) ; } /**jsdoc * @function EntityViewer.setBoundaryLevelAdjust - * @param {number} boundaryLevelAdjust + * @param {number} boundaryLevelAdjust - The boundary level adjust factor. + * @deprecated This function is deprecated and will be removed. */ void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _octreeQuery.setBoundaryLevelAdjust(boundaryLevelAdjust); } /**jsdoc + * Sets the maximum number of entity packets to receive from the domain server per second. * @function EntityViewer.setMaxPacketsPerSecond - * @param {number} maxPacketsPerSecond + * @param {number} maxPacketsPerSecond - The maximum number of entity packets to receive per second. */ void setMaxPacketsPerSecond(int maxPacketsPerSecond) { _octreeQuery.setMaxQueryPacketsPerSecond(maxPacketsPerSecond); } // getters for camera attributes /**jsdoc + * Gets the position of the view frustum. * @function EntityViewer.getPosition - * @returns {Vec3} + * @returns {Vec3} The position of the view frustum. */ const glm::vec3& getPosition() const { return _viewFrustum.getPosition(); } /**jsdoc + * Gets the orientation of the view frustum. * @function EntityViewer.getOrientation - * @returns {Quat} + * @returns {Quat} The orientation of the view frustum. */ const glm::quat& getOrientation() const { return _viewFrustum.getOrientation(); } @@ -101,26 +111,30 @@ public slots: /**jsdoc * @function EntityViewer.getVoxelSizeScale - * @returns {number} + * @returns {number} The voxel size scale. + * @deprecated This function is deprecated and will be removed. */ float getVoxelSizeScale() const { return _octreeQuery.getOctreeSizeScale(); } /**jsdoc * @function EntityViewer.getBoundaryLevelAdjust - * @returns {number} + * @returns {number} The boundary level adjust factor. + * @deprecated This function is deprecated and will be removed. */ int getBoundaryLevelAdjust() const { return _octreeQuery.getBoundaryLevelAdjust(); } /**jsdoc + * Gets the maximum number of entity packets to receive from the domain server per second. * @function EntityViewer.getMaxPacketsPerSecond - * @returns {number} + * @returns {number} The maximum number of entity packets to receive per second. */ int getMaxPacketsPerSecond() const { return _octreeQuery.getMaxQueryPacketsPerSecond(); } /**jsdoc + * Gets the number of nodes in the octree. * @function EntityViewer.getOctreeElementsCount - * @returns {number} + * @returns {number} The number of nodes in the octree. */ unsigned getOctreeElementsCount() const { return _tree->getOctreeElementsCount(); } From 8b2d9427bbe1f0a21ce2d8eb523c24c14920ca37 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 26 Sep 2019 10:48:47 +1200 Subject: [PATCH 16/41] Update description of the entities available to the Entities API --- libraries/entities/src/EntityScriptingInterface.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 52470e56c4..98e31b84ec 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -106,8 +106,9 @@ public: * "domain" entities, travel to different domains with a user as "avatar" entities, or be visible only to an individual user as * "local" entities (a.k.a. "overlays"). * - *

    Note: For Interface scripts, the entities available to scripts are those that Interface has displayed and so knows - * about.

    + *

    Note: For Interface, avatar, and client entity scripts, the entities available to scripts are those that Interface has + * displayed and so knows about. For assignment client scripts, the entities available are those that are "seen" by the + * {@link EntityViewer}. For entity server scripts, all entities are available.

    * *

    Entity Methods

    * From 57649811d7813c2a407479baa818b1305f116be3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 27 Sep 2019 09:17:48 +1200 Subject: [PATCH 17/41] Update JSDoc of TabletProxy internal functions --- .../ui/src/ui/TabletScriptingInterface.h | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/libraries/ui/src/ui/TabletScriptingInterface.h b/libraries/ui/src/ui/TabletScriptingInterface.h index bae5eda29e..f09be33d2b 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.h +++ b/libraries/ui/src/ui/TabletScriptingInterface.h @@ -293,29 +293,38 @@ public: Q_INVOKABLE void loadQMLSource(const QVariant& path, bool resizable = false); /**jsdoc - * Internal function, do not call from scripts * @function TabletProxy#loadQMLSourceImpl + * @deprecated This function is deprecated and will be removed. */ + // Internal function, do not call from scripts. Q_INVOKABLE void loadQMLSourceImpl(const QVariant& path, bool resizable, bool localSafeContext); - /**jsdoc - * Internal function, do not call from scripts + /**jsdoc * @function TabletProxy#loadHTMLSourceImpl + * @deprecated This function is deprecated and will be removed. */ + // Internal function, do not call from scripts. Q_INVOKABLE void loadHTMLSourceImpl(const QVariant& url, const QString& injectJavaScriptUrl, bool localSafeContext); - /**jsdoc - * Internal function, do not call from scripts + /**jsdoc * @function TabletProxy#loadHTMLSourceImpl + * @deprecated This function is deprecated and will be removed. */ + // Internal function, do not call from scripts. Q_INVOKABLE void loadHTMLSourceImpl(const QString& url, const QString& injectedJavaScriptUrl, bool loadOtherBase, bool localSafeContext); - /**jsdoc - * Internal function, do not call from scripts + /**jsdoc * @function TabletProxy#returnToPreviousAppImpl + * @deprecated This function is deprecated and will be removed. */ + // Internal function, do not call from scripts. Q_INVOKABLE void returnToPreviousAppImpl(bool localSafeContext); + /**jsdoc + *@function TabletProxy#loadQMLOnTopImpl + * @deprecated This function is deprecated and will be removed. + */ + // Internal function, do not call from scripts. Q_INVOKABLE void loadQMLOnTopImpl(const QVariant& path, bool localSafeContext); // FIXME: This currently relies on a script initializing the tablet (hence the bool denoting success); From e9d138a96159c60e59544fb2fdd0c9539c31dd30 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 28 Sep 2019 09:29:27 +1200 Subject: [PATCH 18/41] Rename internal function to distinguish signatures and reflect function --- libraries/ui/src/ui/TabletScriptingInterface.cpp | 9 +++------ libraries/ui/src/ui/TabletScriptingInterface.h | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libraries/ui/src/ui/TabletScriptingInterface.cpp b/libraries/ui/src/ui/TabletScriptingInterface.cpp index 75b08ba44f..ff2bc5c894 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.cpp +++ b/libraries/ui/src/ui/TabletScriptingInterface.cpp @@ -869,16 +869,14 @@ void TabletProxy::loadHTMLSourceImpl(const QVariant& url, const QString& injectJ void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaScriptUrl, bool loadOtherBase) { bool localSafeContext = hifi::scripting::isLocalAccessSafeThread(); if (QThread::currentThread() != thread()) { - QMetaObject::invokeMethod(this, "loadHTMLSourceImpl", Q_ARG(QString, url), Q_ARG(QString, injectedJavaScriptUrl), Q_ARG(bool, loadOtherBase), Q_ARG(bool, localSafeContext)); + QMetaObject::invokeMethod(this, "loadHTMLSourceOnTopImpl", Q_ARG(QString, url), Q_ARG(QString, injectedJavaScriptUrl), Q_ARG(bool, loadOtherBase), Q_ARG(bool, localSafeContext)); return; } - - loadHTMLSourceImpl(url, injectedJavaScriptUrl, loadOtherBase, localSafeContext); + loadHTMLSourceOnTopImpl(url, injectedJavaScriptUrl, loadOtherBase, localSafeContext); } -void TabletProxy::loadHTMLSourceImpl(const QString& url, const QString& injectedJavaScriptUrl, bool loadOtherBase, bool localSafeContext) { - +void TabletProxy::loadHTMLSourceOnTopImpl(const QString& url, const QString& injectedJavaScriptUrl, bool loadOtherBase, bool localSafeContext) { QObject* root = nullptr; if (!_toolbarMode && _qmlTabletRoot) { root = _qmlTabletRoot; @@ -911,7 +909,6 @@ void TabletProxy::loadHTMLSourceImpl(const QString& url, const QString& injected _initialWebPathParams.first = injectedJavaScriptUrl; _initialWebPathParams.second = loadOtherBase; _initialScreen = true; - } } diff --git a/libraries/ui/src/ui/TabletScriptingInterface.h b/libraries/ui/src/ui/TabletScriptingInterface.h index f09be33d2b..96804a00e8 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.h +++ b/libraries/ui/src/ui/TabletScriptingInterface.h @@ -307,11 +307,11 @@ public: Q_INVOKABLE void loadHTMLSourceImpl(const QVariant& url, const QString& injectJavaScriptUrl, bool localSafeContext); /**jsdoc - * @function TabletProxy#loadHTMLSourceImpl + * @function TabletProxy#loadHTMLSourceOnTopImpl * @deprecated This function is deprecated and will be removed. */ // Internal function, do not call from scripts. - Q_INVOKABLE void loadHTMLSourceImpl(const QString& url, const QString& injectedJavaScriptUrl, bool loadOtherBase, bool localSafeContext); + Q_INVOKABLE void loadHTMLSourceOnTopImpl(const QString& url, const QString& injectedJavaScriptUrl, bool loadOtherBase, bool localSafeContext); /**jsdoc * @function TabletProxy#returnToPreviousAppImpl From 2e2d3df26fe14bdec41130fc970395875046aa51 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 28 Sep 2019 09:38:19 +1200 Subject: [PATCH 19/41] Fix loadWebScreenOnTop() --- libraries/ui/src/ui/TabletScriptingInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/ui/src/ui/TabletScriptingInterface.cpp b/libraries/ui/src/ui/TabletScriptingInterface.cpp index ff2bc5c894..7528d766b9 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.cpp +++ b/libraries/ui/src/ui/TabletScriptingInterface.cpp @@ -827,11 +827,11 @@ void TabletProxy::loadWebScreenOnTop(const QVariant& url) { void TabletProxy::loadWebScreenOnTop(const QVariant& url, const QString& injectJavaScriptUrl) { bool localSafeContext = hifi::scripting::isLocalAccessSafeThread(); if (QThread::currentThread() != thread()) { - QMetaObject::invokeMethod(this, "loadHTMLSourceImpl", Q_ARG(QVariant, url), Q_ARG(QString, injectJavaScriptUrl), Q_ARG(bool, localSafeContext)); + QMetaObject::invokeMethod(this, "loadHTMLSourceOnTopImpl", Q_ARG(QString, url.toString()), Q_ARG(QString, injectJavaScriptUrl), Q_ARG(bool, false), Q_ARG(bool, localSafeContext)); return; } - loadHTMLSourceImpl(url, injectJavaScriptUrl, localSafeContext); + loadHTMLSourceOnTopImpl(url.toString(), injectJavaScriptUrl, false, localSafeContext); } From bbf6d3f59571c26bbd89c5d6cde2afc793870d5b Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 28 Sep 2019 10:19:00 +1200 Subject: [PATCH 20/41] Remove unused code --- .../ui/src/ui/TabletScriptingInterface.cpp | 32 ------------------- .../ui/src/ui/TabletScriptingInterface.h | 7 ---- 2 files changed, 39 deletions(-) diff --git a/libraries/ui/src/ui/TabletScriptingInterface.cpp b/libraries/ui/src/ui/TabletScriptingInterface.cpp index 7528d766b9..ac4b9edd51 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.cpp +++ b/libraries/ui/src/ui/TabletScriptingInterface.cpp @@ -834,38 +834,6 @@ void TabletProxy::loadWebScreenOnTop(const QVariant& url, const QString& injectJ loadHTMLSourceOnTopImpl(url.toString(), injectJavaScriptUrl, false, localSafeContext); } - - -void TabletProxy::loadHTMLSourceImpl(const QVariant& url, const QString& injectJavaScriptUrl, bool localSafeContext) { - if (QThread::currentThread() != thread()) { - qCWarning(uiLogging) << __FUNCTION__ << "may not be called directly by scripts"; - return; - - } - - - QObject* root = nullptr; - if (!_toolbarMode && _qmlTabletRoot) { - root = _qmlTabletRoot; - } else if (_toolbarMode && _desktopWindow) { - root = _desktopWindow->asQuickItem(); - } - - if (root) { - if (localSafeContext) { - hifi::scripting::setLocalAccessSafeThread(true); - } - QMetaObject::invokeMethod(root, "loadQMLOnTop", Q_ARG(const QVariant&, QVariant(WEB_VIEW_SOURCE_URL))); - QMetaObject::invokeMethod(root, "setShown", Q_ARG(const QVariant&, QVariant(true))); - if (_toolbarMode && _desktopWindow) { - QMetaObject::invokeMethod(root, "setResizable", Q_ARG(const QVariant&, QVariant(false))); - } - QMetaObject::invokeMethod(root, "loadWebOnTop", Q_ARG(const QVariant&, QVariant(url)), Q_ARG(const QVariant&, QVariant(injectJavaScriptUrl))); - hifi::scripting::setLocalAccessSafeThread(false); - } - _state = State::Web; -} - void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaScriptUrl, bool loadOtherBase) { bool localSafeContext = hifi::scripting::isLocalAccessSafeThread(); if (QThread::currentThread() != thread()) { diff --git a/libraries/ui/src/ui/TabletScriptingInterface.h b/libraries/ui/src/ui/TabletScriptingInterface.h index 96804a00e8..8c66a3ee1d 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.h +++ b/libraries/ui/src/ui/TabletScriptingInterface.h @@ -299,13 +299,6 @@ public: // Internal function, do not call from scripts. Q_INVOKABLE void loadQMLSourceImpl(const QVariant& path, bool resizable, bool localSafeContext); - /**jsdoc - * @function TabletProxy#loadHTMLSourceImpl - * @deprecated This function is deprecated and will be removed. - */ - // Internal function, do not call from scripts. - Q_INVOKABLE void loadHTMLSourceImpl(const QVariant& url, const QString& injectJavaScriptUrl, bool localSafeContext); - /**jsdoc * @function TabletProxy#loadHTMLSourceOnTopImpl * @deprecated This function is deprecated and will be removed. From c79581e93fd880e13722ea38535383674d4c60fa Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 28 Sep 2019 10:19:29 +1200 Subject: [PATCH 21/41] Update JSDoc --- libraries/ui/src/ui/TabletScriptingInterface.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/ui/src/ui/TabletScriptingInterface.h b/libraries/ui/src/ui/TabletScriptingInterface.h index 8c66a3ee1d..dbd64cec4a 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.h +++ b/libraries/ui/src/ui/TabletScriptingInterface.h @@ -273,7 +273,9 @@ public: Q_INVOKABLE void gotoHomeScreen(); /**jsdoc - * Opens a web page or app on the tablet. + * Opens a web app or page in addition to any current app. In tablet mode, the app or page is displayed over the top of the + * current app; in toolbar mode, the app is opened in a new window that replaces any current window open. If in tablet + * mode, the app or page can be closed using {@link TabletProxy#returnToPreviousApp}. * @function TabletProxy#gotoWebScreen * @param {string} url - The URL of the web page or app. * @param {string} [injectedJavaScriptUrl=""] - The URL of JavaScript to inject into the web page. @@ -356,8 +358,8 @@ public: /**jsdoc * Opens a web app or page in addition to any current app. In tablet mode, the app or page is displayed over the top of the - * current app; in toolbar mode, the app is opened in a new window. If in tablet mode, the app or page can be closed using - * {@link TabletProxy#returnToPreviousApp}. + * current app; in toolbar mode, the app is opened in a new window that replaces any current window open. If in tablet + * mode, the app or page can be closed using {@link TabletProxy#returnToPreviousApp}. * @function TabletProxy#loadWebScreenOnTop * @param {string} path - The URL of the web page or HTML app. * @param {string} [injectedJavaScriptURL=""] - The URL of JavaScript to inject into the web page. From 3b9884c76f82fd5510c626d9714e36d00604a211 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 28 Sep 2019 11:42:25 +1200 Subject: [PATCH 22/41] Fix build warning --- libraries/ui/src/ui/TabletScriptingInterface.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/ui/src/ui/TabletScriptingInterface.cpp b/libraries/ui/src/ui/TabletScriptingInterface.cpp index ac4b9edd51..040bb750d0 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.cpp +++ b/libraries/ui/src/ui/TabletScriptingInterface.cpp @@ -330,7 +330,6 @@ QObject* TabletScriptingInterface::getFlags() { // static const char* TABLET_HOME_SOURCE_URL = "hifi/tablet/TabletHome.qml"; -static const char* WEB_VIEW_SOURCE_URL = "hifi/tablet/TabletWebView.qml"; static const char* VRMENU_SOURCE_URL = "hifi/tablet/TabletMenu.qml"; class TabletRootWindow : public QmlWindowClass { From 3c6e98f16b8c73e2f42b9ab5bb7992e2480a7513 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 4 Oct 2019 08:34:06 -0700 Subject: [PATCH 23/41] New format for captured GPU frames --- interface/src/Application.cpp | 2 +- .../display-plugins/OpenGLDisplayPlugin.cpp | 9 +- libraries/gpu/src/gpu/FrameIO.cpp | 129 ++++++++++ libraries/gpu/src/gpu/FrameIO.h | 52 +++- libraries/gpu/src/gpu/FrameIOKeys.h | 238 +++++++++--------- libraries/gpu/src/gpu/FrameReader.cpp | 213 ++++++---------- libraries/gpu/src/gpu/FrameWriter.cpp | 70 ++---- tools/CMakeLists.txt | 40 ++- tools/gpu-frame-converter/CMakeLists.txt | 9 + tools/gpu-frame-converter/src/main.cpp | 104 ++++++++ tools/gpu-frame-player/src/PlayerWindow.cpp | 10 +- tools/gpu-frame-player/src/PlayerWindow.h | 2 +- 12 files changed, 538 insertions(+), 340 deletions(-) create mode 100644 libraries/gpu/src/gpu/FrameIO.cpp create mode 100644 tools/gpu-frame-converter/CMakeLists.txt create mode 100644 tools/gpu-frame-converter/src/main.cpp diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index b4a37519a6..c9b976cc14 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4441,7 +4441,7 @@ void Application::keyPressEvent(QKeyEvent* event) { static const QString GPU_FRAME_FOLDER = QProcessEnvironment::systemEnvironment().contains(HIFI_FRAMES_FOLDER_VAR) ? QProcessEnvironment::systemEnvironment().value(HIFI_FRAMES_FOLDER_VAR) : "hifiFrames"; - static QString GPU_FRAME_TEMPLATE = GPU_FRAME_FOLDER + "/{DATE}_{TIME}"; + static QString GPU_FRAME_TEMPLATE = GPU_FRAME_FOLDER + "/{DATE}_{TIME}.hfb"; QString fullPath = FileUtils::computeDocumentPath(FileUtils::replaceDateTimeTokens(GPU_FRAME_TEMPLATE)); if (FileUtils::canCreateFile(fullPath)) { getActiveDisplayPlugin()->captureFrame(fullPath.toStdString()); diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index 74d36101db..e69791e73d 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -480,7 +481,7 @@ void OpenGLDisplayPlugin::captureFrame(const std::string& filename) const { using namespace gpu; auto glBackend = const_cast(*this).getGLBackend(); FramebufferPointer framebuffer{ Framebuffer::create("captureFramebuffer") }; - TextureCapturer captureLambda = [&](const std::string& filename, const gpu::TexturePointer& texture, uint16 layer) { + TextureCapturer captureLambda = [&](std::vector& outputBuffer, const gpu::TexturePointer& texture, uint16 layer) { QImage image; if (texture->getUsageType() == TextureUsageType::STRICT_RESOURCE) { image = QImage{ 1, 1, QImage::Format_ARGB32 }; @@ -498,7 +499,11 @@ void OpenGLDisplayPlugin::captureFrame(const std::string& filename) const { image = QImage{ rect.z, rect.w, QImage::Format_ARGB32 }; glBackend->downloadFramebuffer(framebuffer, rect, image); } - QImageWriter(filename.c_str()).write(image); + QBuffer buffer; + QImageWriter(&buffer, "png").write(image); + const auto& data = buffer.data(); + outputBuffer.resize(data.size()); + memcpy(outputBuffer.data(), data.constData(), data.size()); }; if (_currentFrame) { diff --git a/libraries/gpu/src/gpu/FrameIO.cpp b/libraries/gpu/src/gpu/FrameIO.cpp new file mode 100644 index 0000000000..568ef335ba --- /dev/null +++ b/libraries/gpu/src/gpu/FrameIO.cpp @@ -0,0 +1,129 @@ +// +// Created by Bradley Austin Davis on 2019/10/03 +// Copyright 2013-2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "FrameIO.h" +#include + +using namespace gpu::hfb; + +static bool skip(const uint8_t*& ptr, size_t& remaining, uint32_t size) { + if (remaining < size) { + return false; + } + ptr += size; + remaining -= size; + return true; +} + +template +static bool read(const uint8_t*& ptr, size_t& remaining, T& output) { + uint32_t readSize = (uint32_t)sizeof(T); + if (remaining < readSize) { + return false; + } + memcpy(&output, ptr, readSize); + return skip(ptr, remaining, readSize); +} + +Descriptor Descriptor::parse(const uint8_t* const data, size_t size) { + const auto* ptr = data; + auto remaining = size; + Descriptor result; + if (!read(ptr, remaining, result.header)) { + return {}; + } + if (!result.header.length == size) { + return {}; + } + + while (remaining != 0) { + result.chunks.emplace_back(); + auto& chunk = result.chunks.back(); + ChunkHeader& chunkHeader = chunk; + if (!read(ptr, remaining, chunkHeader)) { + return {}; + } + chunk.offset = ptr - data; + if (!skip(ptr, remaining, chunk.length)) { + return {}; + } + } + return result; +} + +size_t Chunk::end() const { + size_t result = offset; + result += length; + return result; +} + + +bool Descriptor::getChunkString(std::string& output, size_t chunkIndex, const uint8_t* const data, size_t size) { + if (chunkIndex >= chunks.size()) { + return false; + } + const auto& chunk = chunks[chunkIndex]; + if (chunk.end() > size) { + return false; + } + output = std::string{ (const char*)(data + chunk.offset), chunk.length }; + return true; +} + +bool Descriptor::getChunkBuffer(Buffer& output, size_t chunkIndex, const uint8_t* const data, size_t size) { + if (chunkIndex >= chunks.size()) { + return false; + } + const auto& chunk = chunks[chunkIndex]; + if (chunk.end() > size) { + return false; + } + output.resize(chunk.length); + memcpy(output.data(), data + chunk.offset, chunk.length); + return true; +} + +static void writeUint(uint8_t*& dest, uint32_t value) { + memcpy(dest, &value, sizeof(uint32_t)); + dest += sizeof(uint32_t); +} + +template +static void writeChunk(uint8_t*& dest, uint32_t chunkType, const T& chunkData) { + uint32_t chunkSize = static_cast(chunkData.size()); + writeUint(dest, chunkSize); + writeUint(dest, chunkType); + memcpy(dest, chunkData.data(), chunkSize); + dest += chunkSize; +} + +void gpu::hfb::writeFrame(const std::string& filename, + const std::string& json, + const Buffer& binaryBuffer, + const Buffers& pngBuffers) { + uint32_t strLen = (uint32_t)json.size(); + uint32_t size = gpu::hfb::HEADER_SIZE + gpu::hfb::CHUNK_HEADER_SIZE + strLen; + size += gpu::hfb::CHUNK_HEADER_SIZE + (uint32_t)binaryBuffer.size(); + for (const auto& pngBuffer : pngBuffers) { + size += gpu::hfb::CHUNK_HEADER_SIZE + (uint32_t)pngBuffer.size(); + } + + auto outputConst = storage::FileStorage::create(filename.c_str(), size, nullptr); + auto output = std::const_pointer_cast(outputConst); + auto ptr = output->mutableData(); + writeUint(ptr, gpu::hfb::MAGIC); + writeUint(ptr, gpu::hfb::VERSION); + writeUint(ptr, size); + writeChunk(ptr, gpu::hfb::CHUNK_TYPE_JSON, json); + writeChunk(ptr, gpu::hfb::CHUNK_TYPE_BIN, binaryBuffer); + for (const auto& png : pngBuffers) { + writeChunk(ptr, gpu::hfb::CHUNK_TYPE_PNG, png); + } + auto writeSize = ptr - output->data(); + assert(writeSize == size); +} diff --git a/libraries/gpu/src/gpu/FrameIO.h b/libraries/gpu/src/gpu/FrameIO.h index 4de4cf5fe7..e53d64f22f 100644 --- a/libraries/gpu/src/gpu/FrameIO.h +++ b/libraries/gpu/src/gpu/FrameIO.h @@ -16,13 +16,57 @@ namespace gpu { -using TextureCapturer = std::function; -using TextureLoader = std::function; +using TextureCapturer = std::function&, const TexturePointer&, uint16 layer)>; +using TextureLoader = std::function&, const TexturePointer&, uint16 layer)>; void writeFrame(const std::string& filename, const FramePointer& frame, const TextureCapturer& capturer = nullptr); FramePointer readFrame(const std::string& filename, uint32_t externalTexture, const TextureLoader& loader = nullptr); -using IndexOptimizer = std::function; -void optimizeFrame(const std::string& filename, const IndexOptimizer& optimizer); +namespace hfb { + +constexpr char* EXTENSION{ ".hfb" }; +constexpr uint32_t HEADER_SIZE{ sizeof(uint32_t) * 3 }; +constexpr uint32_t CHUNK_HEADER_SIZE = sizeof(uint32_t) * 2; +constexpr uint32_t MAGIC{ 0x49464948 }; +constexpr uint32_t VERSION{ 0x01 }; +constexpr uint32_t CHUNK_TYPE_JSON{ 0x4E4F534A }; +constexpr uint32_t CHUNK_TYPE_BIN{ 0x004E4942 }; +constexpr uint32_t CHUNK_TYPE_PNG{ 0x00474E50 }; + +using Buffer = std::vector; +using Buffers = std::vector; + +struct Header { + uint32_t magic{ 0 }; + uint32_t version{ 0 }; + uint32_t length{ 0 }; +}; + +struct ChunkHeader { + uint32_t length{ 0 }; + uint32_t type{ 0 }; +}; + +struct Chunk : public ChunkHeader { + uint32_t offset{ 0 }; + + size_t end() const; +}; + +using Chunks = std::vector; + +struct Descriptor { + Header header; + Chunks chunks; + + operator bool() const { return header.magic == MAGIC; } + bool getChunkString(std::string& output, size_t chunk, const uint8_t* const data, size_t size); + bool getChunkBuffer(Buffer& output, size_t chunk, const uint8_t* const data, size_t size); + static Descriptor parse(const uint8_t* const data, size_t size); +}; + +void writeFrame(const std::string& filename, const std::string& json, const Buffer& binaryBuffer, const Buffers& pngBuffers); + +} // namespace hfb } // namespace gpu diff --git a/libraries/gpu/src/gpu/FrameIOKeys.h b/libraries/gpu/src/gpu/FrameIOKeys.h index 5d5f8a5bd9..14f7646d4f 100644 --- a/libraries/gpu/src/gpu/FrameIOKeys.h +++ b/libraries/gpu/src/gpu/FrameIOKeys.h @@ -11,128 +11,130 @@ namespace gpu { namespace keys { -static const char* binary = "binary"; -static const char* L00 = "L00"; -static const char* L1m1 = "L1m1"; -static const char* L10 = "L10"; -static const char* L11 = "L11"; -static const char* L2m2 = "L2m2"; -static const char* L2m1 = "L2m1"; -static const char* L20 = "L20"; -static const char* L21 = "L21"; -static const char* L22 = "L22"; -static const char* eyeProjections = "eyeProjections"; -static const char* eyeViews = "eyeViews"; -static const char* alphaToCoverageEnable = "alphaToCoverageEnable"; -static const char* antialisedLineEnable = "antialisedLineEnable"; -static const char* attributes = "attributes"; -static const char* batches = "batches"; -static const char* blendFunction = "blendFunction"; -static const char* borderColor = "borderColor"; -static const char* bufferMask = "bufferMask"; -static const char* buffers = "buffers"; -static const char* capturedTextures = "capturedTextures"; -static const char* channel = "channel"; -static const char* colorAttachments = "colorAttachments"; -static const char* colorWriteMask = "colorWriteMask"; -static const char* commands = "commands"; -static const char* comparisonFunction = "comparisonFunction"; -static const char* cullMode = "cullMode"; -static const char* data = "data"; -static const char* depth = "depth"; -static const char* depthBias = "depthBias"; -static const char* depthBiasSlopeScale = "depthBiasSlopeScale"; -static const char* depthClampEnable = "depthClampEnable"; -static const char* depthStencilAttachment = "depthStencilAttachment"; -static const char* depthTest = "depthTest"; -static const char* drawCallInfos = "drawCallInfos"; -static const char* drawcallUniform = "drawcallUniform"; -static const char* drawcallUniformReset = "drawcallUniformReset"; -static const char* element = "element"; -static const char* fillMode = "fillMode"; -static const char* filter = "filter"; -static const char* formats = "formats"; -static const char* frameIndex = "frameIndex"; -static const char* framebuffer = "framebuffer"; -static const char* framebuffers = "framebuffers"; -static const char* frequency = "frequency"; -static const char* frontFaceClockwise = "frontFaceClockwise"; -static const char* height = "height"; -static const char* id = "id"; -static const char* ktxFile = "ktxFile"; -static const char* layers = "layers"; -static const char* maxAnisotropy = "maxAnisotropy"; -static const char* maxMip = "maxMip"; -static const char* minMip = "minMip"; -static const char* mipOffset = "mipOffset"; -static const char* mips = "mips"; -static const char* multisampleEnable = "multisampleEnable"; -static const char* name = "name"; -static const char* namedData = "namedData"; -static const char* names = "names"; -static const char* objects = "objects"; -static const char* offset = "offset"; -static const char* pipelines = "pipelines"; -static const char* pose = "pose"; -static const char* profileRanges = "profileRanges"; -static const char* program = "program"; -static const char* programs = "programs"; -static const char* projectionJitter = "projectionJitter"; -static const char* queries = "queries"; -static const char* sampleCount = "sampleCount"; -static const char* sampleMask = "sampleMask"; -static const char* sampler = "sampler"; -static const char* samples = "samples"; -static const char* scissorEnable = "scissorEnable"; -static const char* shaders = "shaders"; -static const char* size = "size"; -static const char* skybox = "skybox"; -static const char* slot = "slot"; -static const char* source = "source"; -static const char* state = "state"; -static const char* stencilActivation = "stencilActivation"; -static const char* stencilTestBack = "stencilTestBack"; -static const char* stencilTestFront = "stencilTestFront"; -static const char* stereo = "stereo"; -static const char* subresource = "subresource"; -static const char* swapchains = "swapchains"; -static const char* texelFormat = "texelFormat"; -static const char* texture = "texture"; -static const char* textureTables = "textureTables"; -static const char* textures = "textures"; -static const char* transforms = "transforms"; -static const char* type = "type"; -static const char* usageType = "usageType"; -static const char* view = "view"; -static const char* width = "width"; -static const char* wrapModeU = "wrapModeU"; -static const char* wrapModeV = "wrapModeV"; -static const char* wrapModeW = "wrapModeW"; +constexpr char* binary = "binary"; +constexpr char* L00 = "L00"; +constexpr char* L1m1 = "L1m1"; +constexpr char* L10 = "L10"; +constexpr char* L11 = "L11"; +constexpr char* L2m2 = "L2m2"; +constexpr char* L2m1 = "L2m1"; +constexpr char* L20 = "L20"; +constexpr char* L21 = "L21"; +constexpr char* L22 = "L22"; + +constexpr char* eyeProjections = "eyeProjections"; +constexpr char* eyeViews = "eyeViews"; +constexpr char* alphaToCoverageEnable = "alphaToCoverageEnable"; +constexpr char* antialisedLineEnable = "antialisedLineEnable"; +constexpr char* attributes = "attributes"; +constexpr char* batches = "batches"; +constexpr char* blendFunction = "blendFunction"; +constexpr char* borderColor = "borderColor"; +constexpr char* bufferMask = "bufferMask"; +constexpr char* buffers = "buffers"; +constexpr char* capturedTextures = "capturedTextures"; +constexpr char* channel = "channel"; +constexpr char* chunk = "chunk"; +constexpr char* colorAttachments = "colorAttachments"; +constexpr char* colorWriteMask = "colorWriteMask"; +constexpr char* commands = "commands"; +constexpr char* comparisonFunction = "comparisonFunction"; +constexpr char* cullMode = "cullMode"; +constexpr char* data = "data"; +constexpr char* depth = "depth"; +constexpr char* depthBias = "depthBias"; +constexpr char* depthBiasSlopeScale = "depthBiasSlopeScale"; +constexpr char* depthClampEnable = "depthClampEnable"; +constexpr char* depthStencilAttachment = "depthStencilAttachment"; +constexpr char* depthTest = "depthTest"; +constexpr char* drawCallInfos = "drawCallInfos"; +constexpr char* drawcallUniform = "drawcallUniform"; +constexpr char* drawcallUniformReset = "drawcallUniformReset"; +constexpr char* element = "element"; +constexpr char* fillMode = "fillMode"; +constexpr char* filter = "filter"; +constexpr char* formats = "formats"; +constexpr char* frameIndex = "frameIndex"; +constexpr char* framebuffer = "framebuffer"; +constexpr char* framebuffers = "framebuffers"; +constexpr char* frequency = "frequency"; +constexpr char* frontFaceClockwise = "frontFaceClockwise"; +constexpr char* height = "height"; +constexpr char* id = "id"; +constexpr char* ktxFile = "ktxFile"; +constexpr char* layers = "layers"; +constexpr char* maxAnisotropy = "maxAnisotropy"; +constexpr char* maxMip = "maxMip"; +constexpr char* minMip = "minMip"; +constexpr char* mipOffset = "mipOffset"; +constexpr char* mips = "mips"; +constexpr char* multisampleEnable = "multisampleEnable"; +constexpr char* name = "name"; +constexpr char* namedData = "namedData"; +constexpr char* names = "names"; +constexpr char* objects = "objects"; +constexpr char* offset = "offset"; +constexpr char* pipelines = "pipelines"; +constexpr char* pose = "pose"; +constexpr char* profileRanges = "profileRanges"; +constexpr char* program = "program"; +constexpr char* programs = "programs"; +constexpr char* projectionJitter = "projectionJitter"; +constexpr char* queries = "queries"; +constexpr char* sampleCount = "sampleCount"; +constexpr char* sampleMask = "sampleMask"; +constexpr char* sampler = "sampler"; +constexpr char* samples = "samples"; +constexpr char* scissorEnable = "scissorEnable"; +constexpr char* shaders = "shaders"; +constexpr char* size = "size"; +constexpr char* skybox = "skybox"; +constexpr char* slot = "slot"; +constexpr char* source = "source"; +constexpr char* state = "state"; +constexpr char* stencilActivation = "stencilActivation"; +constexpr char* stencilTestBack = "stencilTestBack"; +constexpr char* stencilTestFront = "stencilTestFront"; +constexpr char* stereo = "stereo"; +constexpr char* subresource = "subresource"; +constexpr char* swapchains = "swapchains"; +constexpr char* texelFormat = "texelFormat"; +constexpr char* texture = "texture"; +constexpr char* textureTables = "textureTables"; +constexpr char* textures = "textures"; +constexpr char* transforms = "transforms"; +constexpr char* type = "type"; +constexpr char* usageType = "usageType"; +constexpr char* view = "view"; +constexpr char* width = "width"; +constexpr char* wrapModeU = "wrapModeU"; +constexpr char* wrapModeV = "wrapModeV"; +constexpr char* wrapModeW = "wrapModeW"; -static const char* backWriteMask = "backWriteMask"; -static const char* frontWriteMask = "frontWriteMask"; -static const char* reference = "reference"; -static const char* readMask = "readMask"; -static const char* failOp = "failOp"; -static const char* depthFailOp = "depthFailOp"; -static const char* passOp = "passOp"; -static const char* enabled = "enabled"; -static const char* blend = "blend"; -static const char* flags = "flags"; -static const char* writeMask = "writeMask"; -static const char* function = "function"; -static const char* sourceColor = "sourceColor"; -static const char* sourceAlpha = "sourceAlpha"; -static const char* destColor = "destColor"; -static const char* destAlpha = "destAlpha"; -static const char* opColor = "opColor"; -static const char* opAlpha = "opAlpha"; -static const char* enable = "enable"; -static const char* contextDisable = "contextDisable"; +constexpr char* backWriteMask = "backWriteMask"; +constexpr char* frontWriteMask = "frontWriteMask"; +constexpr char* reference = "reference"; +constexpr char* readMask = "readMask"; +constexpr char* failOp = "failOp"; +constexpr char* depthFailOp = "depthFailOp"; +constexpr char* passOp = "passOp"; +constexpr char* enabled = "enabled"; +constexpr char* blend = "blend"; +constexpr char* flags = "flags"; +constexpr char* writeMask = "writeMask"; +constexpr char* function = "function"; +constexpr char* sourceColor = "sourceColor"; +constexpr char* sourceAlpha = "sourceAlpha"; +constexpr char* destColor = "destColor"; +constexpr char* destAlpha = "destAlpha"; +constexpr char* opColor = "opColor"; +constexpr char* opAlpha = "opAlpha"; +constexpr char* enable = "enable"; +constexpr char* contextDisable = "contextDisable"; -static const char* COMMAND_NAMES[] = { +constexpr char* COMMAND_NAMES[] = { "draw", "drawIndexed", "drawInstanced", diff --git a/libraries/gpu/src/gpu/FrameReader.cpp b/libraries/gpu/src/gpu/FrameReader.cpp index 740ec2b26f..1f94828119 100644 --- a/libraries/gpu/src/gpu/FrameReader.cpp +++ b/libraries/gpu/src/gpu/FrameReader.cpp @@ -22,17 +22,11 @@ namespace gpu { using json = nlohmann::json; +using StoragePointer = storage::StoragePointer; +using FileStorage = storage::FileStorage; class Deserializer { public: - static std::string getBaseName(const std::string& filename) { - static const std::string ext{ ".json" }; - if (std::string::npos != filename.rfind(ext)) { - return filename.substr(0, filename.size() - ext.size()); - } - return filename; - } - static std::string getBaseDir(const std::string& filename) { std::string result; if (0 == filename.find("assets:")) { @@ -47,14 +41,17 @@ public: return result; } - Deserializer(const std::string& filename, uint32_t externalTexture, const TextureLoader& loader) : - basename(getBaseName(filename)), basedir(getBaseDir(filename)), externalTexture(externalTexture), textureLoader(loader) { + Deserializer(const std::string& filename_, uint32_t externalTexture = 0, const TextureLoader& loader = {}) : + filename(filename_), basedir(getBaseDir(filename_)), mappedFile(std::make_shared(filename.c_str())), + externalTexture(externalTexture), textureLoader(loader) { + descriptor = hfb::Descriptor::parse(mappedFile->data(), (uint32_t)mappedFile->size()); } - const std::string basename; + const std::string filename; const std::string basedir; - std::string binaryFile; + const StoragePointer mappedFile; const uint32_t externalTexture; + hfb::Descriptor descriptor; TextureLoader textureLoader; std::vector shaders; std::vector programs; @@ -69,10 +66,24 @@ public: std::vector queries; json frameNode; FramePointer readFrame(); - void optimizeFrame(const IndexOptimizer& optimizer); FramePointer deserializeFrame(); + std::string getStringChunk(size_t chunkIndex) { + std::string result; + if (!descriptor.getChunkString(result, chunkIndex, mappedFile->data(), mappedFile->size())) { + return {}; + } + return result; + } + + hfb::Buffer getBufferChunk(size_t chunkIndex) { + hfb::Buffer result; + if (!descriptor.getChunkBuffer(result, chunkIndex, mappedFile->data(), mappedFile->size())) { + return {}; + } + return result; + } void readBuffers(const json& node); @@ -148,12 +159,11 @@ public: } template - static bool readBatchCacheTransformed(typename Batch::Cache::Vector& dest, - const json& node, - const std::string& name, - std::function f = [](const json& node) -> TT { - return node.get(); - }) { + static bool readBatchCacheTransformed( + typename Batch::Cache::Vector& dest, + const json& node, + const std::string& name, + std::function f = [](const json& node) -> TT { return node.get(); }) { if (node.count(name)) { const auto& arrayNode = node[name]; for (const auto& entry : arrayNode) { @@ -234,18 +244,14 @@ FramePointer readFrame(const std::string& filename, uint32_t externalTexture, co return Deserializer(filename, externalTexture, loader).readFrame(); } -void optimizeFrame(const std::string& filename, const IndexOptimizer& optimizer) { - return Deserializer(filename, 0, {}).optimizeFrame(optimizer); -} - } // namespace gpu using namespace gpu; void Deserializer::readBuffers(const json& buffersNode) { - storage::FileStorage mappedFile(binaryFile.c_str()); - const auto mappedSize = mappedFile.size(); - const auto* mapped = mappedFile.data(); + const auto& binaryChunk = descriptor.chunks[1]; + const auto* mapped = mappedFile->data() + binaryChunk.offset; + const auto mappedSize = binaryChunk.length; size_t bufferCount = buffersNode.size(); buffers.reserve(buffersNode.size()); size_t offset = 0; @@ -311,6 +317,8 @@ Sampler Deserializer::readSampler(const json& node) { return result; } +constexpr uint32_t INVALID_CHUNK_INDEX{ (uint32_t)-1 }; + TexturePointer Deserializer::readTexture(const json& node, uint32_t external) { if (node.is_null()) { return nullptr; @@ -319,8 +327,17 @@ TexturePointer Deserializer::readTexture(const json& node, uint32_t external) { std::string source; readOptional(source, node, keys::source); + uint32_t chunkIndex = INVALID_CHUNK_INDEX; + readOptional(chunkIndex, node, keys::chunk); + std::string ktxFile; readOptional(ktxFile, node, keys::ktxFile); + if (!ktxFile.empty()) { + if (!QFileInfo(ktxFile.c_str()).exists()) { + qDebug() << "Warning" << ktxFile.c_str() << " not found, ignoring"; + ktxFile = {}; + } + } Element ktxTexelFormat, ktxMipFormat; if (!ktxFile.empty()) { // If we get a texture that starts with ":" we need to re-route it to the resources directory @@ -368,8 +385,15 @@ TexturePointer Deserializer::readTexture(const json& node, uint32_t external) { if (QFileInfo(ktxFile.c_str()).isRelative()) { ktxFile = basedir + "/" + ktxFile; } + texture.setSource(ktxFile); texture.setKtxBacking(ktxFile); + } else if (chunkIndex != INVALID_CHUNK_INDEX) { + if (textureLoader) { + texture.setSource("Chunk " + std::to_string(chunkIndex)); + textureLoader(getBufferChunk(chunkIndex), result, 0); + } } + return result; } @@ -405,11 +429,11 @@ ShaderPointer Deserializer::readShader(const json& node) { // FIXME support procedural shaders Shader::Type type = node[keys::type]; std::string name = node[keys::name]; - // Using the serialized ID is bad, because it's generated at - // cmake time, and can change across platforms or when + // Using the serialized ID is bad, because it's generated at + // cmake time, and can change across platforms or when // shaders are added or removed // uint32_t id = node[keys::id]; - + uint32_t id = shadersIdsByName[name]; ShaderPointer result; switch (type) { @@ -555,11 +579,15 @@ StatePointer readState(const json& node) { State::Data data; Deserializer::readOptionalTransformed(data.flags, node, keys::flags, &readStateFlags); - Deserializer::readOptionalTransformed(data.blendFunction, node, keys::blendFunction, &readBlendFunction); + Deserializer::readOptionalTransformed(data.blendFunction, node, keys::blendFunction, + &readBlendFunction); Deserializer::readOptionalTransformed(data.depthTest, node, keys::depthTest, &readDepthTest); - Deserializer::readOptionalTransformed(data.stencilActivation, node, keys::stencilActivation, &readStencilActivation); - Deserializer::readOptionalTransformed(data.stencilTestFront, node, keys::stencilTestFront, &readStencilTest); - Deserializer::readOptionalTransformed(data.stencilTestBack, node, keys::stencilTestBack, &readStencilTest); + Deserializer::readOptionalTransformed(data.stencilActivation, node, keys::stencilActivation, + &readStencilActivation); + Deserializer::readOptionalTransformed(data.stencilTestFront, node, keys::stencilTestFront, + &readStencilTest); + Deserializer::readOptionalTransformed(data.stencilTestBack, node, keys::stencilTestBack, + &readStencilTest); Deserializer::readOptional(data.colorWriteMask, node, keys::colorWriteMask); Deserializer::readOptional(data.cullMode, node, keys::cullMode); Deserializer::readOptional(data.depthBias, node, keys::depthBias); @@ -799,25 +827,15 @@ StereoState readStereoState(const json& node) { FramePointer Deserializer::deserializeFrame() { - { - std::string filename{ basename + ".json" }; - storage::FileStorage mappedFile(filename.c_str()); - frameNode = json::parse(std::string((const char*)mappedFile.data(), mappedFile.size())); + if (!descriptor.operator bool()) { + return {}; } + frameNode = json::parse(getStringChunk(0)); + FramePointer result = std::make_shared(); auto& frame = *result; - if (frameNode[keys::binary].is_string()) { - binaryFile = frameNode[keys::binary]; - if (QFileInfo(binaryFile.c_str()).isRelative()) { - binaryFile = basedir + "/" + binaryFile; - } - } else { - binaryFile = basename + ".bin"; - } - - if (frameNode.count(keys::buffers)) { readBuffers(frameNode[keys::buffers]); } @@ -830,19 +848,7 @@ FramePointer Deserializer::deserializeFrame() { formats = readArray(frameNode, keys::formats, [](const json& node) { return readFormat(node); }); - auto textureReader = [this](const json& node) { return readTexture(node, externalTexture); }; - textures = readArray(frameNode, keys::textures, textureReader); - if (textureLoader) { - std::vector capturedTextures = readNumericVector(frameNode[keys::capturedTextures]); - for (const auto& index : capturedTextures) { - const auto& texturePointer = textures[index]; - uint16 layers = std::max(texturePointer->getNumSlices(), 1); - for (uint16 layer = 0; layer < layers; ++layer) { - std::string filename = basename + "." + std::to_string(index) + "." + std::to_string(layer) + ".png"; - textureLoader(filename, texturePointer, layer); - } - } - } + textures = readArray(frameNode, keys::textures, [this](const json& node) { return readTexture(node, externalTexture); }); // Must come after textures auto textureTableReader = [this](const json& node) { return readTextureTable(node); }; @@ -868,87 +874,22 @@ FramePointer Deserializer::deserializeFrame() { } } + for (uint32_t i = 0; i < textures.size(); ++i) { + const auto& texturePtr = textures[i]; + if (!texturePtr) { + continue; + } + const auto& texture = *texturePtr; + if (texture.getUsageType() == gpu::TextureUsageType::RESOURCE && texture.source().empty()) { + qDebug() << "Empty source "; + } + } + return result; } - - FramePointer Deserializer::readFrame() { auto result = deserializeFrame(); result->finish(); return result; } - -void Deserializer::optimizeFrame(const IndexOptimizer& optimizer) { - auto result = deserializeFrame(); - auto& frame = *result; - - - // optimize the index buffers? - struct CurrentIndexBuffer { - Offset offset{ 0 }; - BufferPointer buffer; - Type type{ gpu::Type::INT32 }; - Primitive primitve{ Primitive::TRIANGLES }; - uint32_t numIndices{ 0 }; - uint32_t startIndex{ 0 }; - }; - - std::vector captured; - for (auto& batch : frame.batches) { - - CurrentIndexBuffer currentIndexBuffer; - batch->forEachCommand([&](Batch::Command cmd, const Batch::Param* params){ - switch(cmd) { - case Batch::Command::COMMAND_setIndexBuffer: - currentIndexBuffer.offset = params[0]._size; - currentIndexBuffer.buffer = batch->_buffers.get(params[1]._int); - currentIndexBuffer.type = (Type)params[2]._int; - break; - - case Batch::Command::COMMAND_drawIndexed: - currentIndexBuffer.startIndex = params[0]._int; - currentIndexBuffer.numIndices = params[1]._int; - currentIndexBuffer.primitve = (Primitive)params[2]._int; - captured.emplace_back(currentIndexBuffer); - break; - - case Batch::Command::COMMAND_drawIndexedInstanced: - currentIndexBuffer.startIndex = params[1]._int; - currentIndexBuffer.numIndices = params[2]._int; - currentIndexBuffer.primitve = (Primitive)params[3]._int; - captured.emplace_back(currentIndexBuffer); - break; - - default: - break; - } - }); - } - - - std::string optimizedBinaryFile = basename + "_optimized.bin"; - QFile(binaryFile.c_str()).copy(optimizedBinaryFile.c_str()); - { - storage::FileStorage mappedFile(optimizedBinaryFile.c_str()); - std::set uniqueBuffers; - for (const auto& capturedIndexData : captured) { - if (uniqueBuffers.count(capturedIndexData.buffer)) { - continue; - } - uniqueBuffers.insert(capturedIndexData.buffer); - auto bufferOffset = bufferOffsets[capturedIndexData.buffer]; - auto& buffer = *capturedIndexData.buffer; - const auto& count = capturedIndexData.numIndices; - auto indices = (uint32_t*)buffer.editData(); - optimizer(capturedIndexData.primitve, count / 3, count, indices); - memcpy(mappedFile.mutableData() + bufferOffset, indices, sizeof(uint32_t) * count); - } - } - frameNode[keys::binary] = optimizedBinaryFile; - { - std::string frameJson = frameNode.dump(); - std::string filename = basename + "_optimized.json"; - storage::FileStorage::create(filename.c_str(), frameJson.size(), (const uint8_t*)frameJson.data()); - } -} diff --git a/libraries/gpu/src/gpu/FrameWriter.cpp b/libraries/gpu/src/gpu/FrameWriter.cpp index f348827385..85397f149a 100644 --- a/libraries/gpu/src/gpu/FrameWriter.cpp +++ b/libraries/gpu/src/gpu/FrameWriter.cpp @@ -20,7 +20,7 @@ using json = nlohmann::json; class Serializer { public: - const std::string basename; + const std::string filename; const TextureCapturer textureCapturer; std::unordered_map shaderMap; std::unordered_map programMap; @@ -32,8 +32,11 @@ public: std::unordered_map framebufferMap; std::unordered_map swapchainMap; std::unordered_map queryMap; + std::unordered_set captureTextures; + hfb::Buffer binaryBuffer; + hfb::Buffers pngBuffers; - Serializer(const std::string& basename, const TextureCapturer& capturer) : basename(basename), textureCapturer(capturer) {} + Serializer(const std::string& basename, const TextureCapturer& capturer) : filename(basename + hfb::EXTENSION), textureCapturer(capturer) {} template static uint32_t getGlobalIndex(const T& value, std::unordered_map& map) { @@ -129,7 +132,7 @@ public: json writeProgram(const ShaderPointer& program); json writeNamedBatchData(const Batch::NamedBatchData& namedData); - json writeCapturableTextures(const Frame& frame); + void findCapturableTextures(const Frame& frame); void writeBinaryBlob(); static std::string toBase64(const std::vector& v); static json writeIrradiance(const SHPointer& irradiance); @@ -146,7 +149,7 @@ public: static json writeTransform(const Transform& t) { return writeMat4(t.getMatrix()); } static json writeCommand(size_t index, const Batch& batch); static json writeSampler(const Sampler& sampler); - static json writeTexture(const TexturePointer& texture); + json writeTexture(const TexturePointer& texture); static json writeFormat(const Stream::FormatPointer& format); static json writeQuery(const QueryPointer& query); static json writeShader(const ShaderPointer& shader); @@ -390,8 +393,12 @@ json Serializer::writeTexture(const TexturePointer& texturePointer) { const auto* ktxStorage = dynamic_cast(storage); if (ktxStorage) { result[keys::ktxFile] = ktxStorage->_filename; - } else { - // TODO serialize the backing storage + } else if (textureCapturer && captureTextures.count(texturePointer) != 0) { + auto layers = std::max(texture.getNumSlices(), 1); + result[keys::chunk] = 2 + pngBuffers.size(); + pngBuffers.push_back({}); + hfb::Buffer& pngBuffer = pngBuffers.back(); + textureCapturer(pngBuffer, texturePointer, 0); } } return result; @@ -673,14 +680,8 @@ json Serializer::writeQuery(const QueryPointer& queryPointer) { return result; } -json Serializer::writeCapturableTextures(const Frame& frame) { - if (!textureCapturer) { - return json::array(); - } - +void Serializer::findCapturableTextures(const Frame& frame) { std::unordered_set writtenRenderbuffers; - std::unordered_set captureTextures; - auto maybeCaptureTexture = [&](const TexturePointer& texture) { // Not a valid texture if (!texture) { @@ -755,20 +756,6 @@ json Serializer::writeCapturableTextures(const Frame& frame) { } } } - - json result = json::array(); - for (const auto& texture : captureTextures) { - if (textureCapturer) { - auto index = textureMap[texture]; - auto layers = std::max(texture->getNumSlices(), 1); - for (uint16 layer = 0; layer < layers; ++layer) { - std::string textureFilename = basename + "." + std::to_string(index) + "." + std::to_string(layer) + ".png"; - textureCapturer(textureFilename, texture, layer); - } - result.push_back(index); - } - } - return result; } void Serializer::writeFrame(const Frame& frame) { @@ -780,7 +767,7 @@ void Serializer::writeFrame(const Frame& frame) { } frameNode[keys::stereo] = writeStereoState(frame.stereoState); - frameNode[keys::capturedTextures] = writeCapturableTextures(frame); + findCapturableTextures(frame); frameNode[keys::frameIndex] = frame.frameIndex; frameNode[keys::view] = writeMat4(frame.view); frameNode[keys::pose] = writeMat4(frame.pose); @@ -797,35 +784,21 @@ void Serializer::writeFrame(const Frame& frame) { // Serialize textures and buffers last, since the maps they use can be populated by some of the above code // Serialize textures - serializeMap(frameNode, keys::textures, textureMap, writeTexture); + serializeMap(frameNode, keys::textures, textureMap, std::bind(&Serializer::writeTexture, this, _1)); // Serialize buffers serializeMap(frameNode, keys::buffers, bufferMap, writeBuffer); - { - std::string frameJson = frameNode.dump(); - std::string filename = basename + ".json"; - storage::FileStorage::create(filename.c_str(), frameJson.size(), (const uint8_t*)frameJson.data()); - } - writeBinaryBlob(); - frameNode[keys::binary] = basename + ".bin"; + + hfb::writeFrame(filename, frameNode.dump(), binaryBuffer, pngBuffers); } void Serializer::writeBinaryBlob() { const auto buffers = mapToVector(bufferMap); auto accumulator = [](size_t total, const BufferPointer& buffer) { return total + (buffer ? buffer->getSize() : 0); }; size_t totalSize = std::accumulate(buffers.begin(), buffers.end(), (size_t)0, accumulator); - - const auto blobFilename = basename + ".bin"; - QFile file(blobFilename.c_str()); - if (!file.open(QFile::ReadWrite | QIODevice::Truncate)) { - throw std::runtime_error("Unable to open file for writing"); - } - if (!file.resize(totalSize)) { - throw std::runtime_error("Unable to resize file"); - } - - auto mapped = file.map(0, totalSize); + binaryBuffer.resize(totalSize); + auto mapped = binaryBuffer.data(); size_t offset = 0; for (const auto& bufferPointer : buffers) { @@ -838,7 +811,4 @@ void Serializer::writeBinaryBlob() { memcpy(mapped + offset, bufferData, bufferSize); offset += bufferSize; } - if (!file.unmap(mapped)) { - throw std::runtime_error("Unable to unmap file"); - } } diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index fd74786a5e..f961a19503 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -19,34 +19,24 @@ function(check_test name) endfunction() if (BUILD_TOOLS) + set(ALL_TOOLS + udt-test + vhacd-util + frame-optimizer + gpu-frame-player + gpu-frame-converter + ice-client + ktx-tool + ac-client + skeleton-dump + atp-client + oven + ) + # Allow different tools for stable builds if (STABLE_BUILD) - set(ALL_TOOLS - udt-test - vhacd-util - frame-optimizer - gpu-frame-player - ice-client - ktx-tool - ac-client - skeleton-dump - atp-client - oven - ) else() - set(ALL_TOOLS - udt-test - vhacd-util - frame-optimizer - gpu-frame-player - ice-client - ktx-tool - ac-client - skeleton-dump - atp-client - oven - nitpick - ) + list(APPEND ALL_TOOLS nitpick) endif() foreach(TOOL ${ALL_TOOLS}) diff --git a/tools/gpu-frame-converter/CMakeLists.txt b/tools/gpu-frame-converter/CMakeLists.txt new file mode 100644 index 0000000000..d28a41c278 --- /dev/null +++ b/tools/gpu-frame-converter/CMakeLists.txt @@ -0,0 +1,9 @@ + +set(TARGET_NAME gpu-frame-converter) +setup_memory_debugger() +setup_hifi_project() +set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 17) +# link in the shared libraries +link_hifi_libraries( shared gpu shaders ) + +package_libraries_for_deployment() diff --git a/tools/gpu-frame-converter/src/main.cpp b/tools/gpu-frame-converter/src/main.cpp new file mode 100644 index 0000000000..15aeafffb5 --- /dev/null +++ b/tools/gpu-frame-converter/src/main.cpp @@ -0,0 +1,104 @@ +// +// Created by Bradley Austin Davis on 2019/10/03 +// Copyright 2013-2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace fs = std::filesystem; +using Json = nlohmann::json; +using Paths = std::vector; + +const char* DEFAULT_SOURCE_PATH{ "D:/Frames" }; +static const std::string OLD_FRAME_EXTENSION{ ".json" }; +static const std::string OLD_BINARY_EXTENSION{ ".bin" }; +static const std::string NEW_EXTENSION{ gpu::hfb::EXTENSION }; + +inline std::string readFileToString(const fs::path& path) { + std::ifstream file(path); + return std::string((std::istreambuf_iterator(file)), std::istreambuf_iterator()); +} + +inline gpu::hfb::Buffer readFile(const fs::path& path) { + std::ifstream file(path, std::ios::binary | std::ios::ate); + size_t size = file.tellg(); + if (!size) { + return {}; + } + file.seekg(0, std::ios::beg); + + gpu::hfb::Buffer result; + result.resize(size); + if (!file.read((char*)result.data(), size)) { + throw std::runtime_error("Failed to read file"); + } + return result; +} + +Paths getFrames(const std::string& sourcePath) { + Paths result; + for (auto& p : fs::directory_iterator(sourcePath)) { + if (!p.is_regular_file()) { + continue; + } + const auto& path = p.path(); + if (path.string().find(".hfb.json") != std::string::npos) { + continue; + } + if (path.extension().string() == OLD_FRAME_EXTENSION) { + result.push_back(path); + } + } + return result; +} + +void convertFrame(const fs::path& path) { + auto name = path.filename().string(); + name = name.substr(0, name.length() - OLD_FRAME_EXTENSION.length()); + + auto frameNode = Json::parse(readFileToString(path)); + auto capturedTexturesNode = frameNode[gpu::keys::capturedTextures]; + + gpu::hfb::Buffer binary = readFile(path.parent_path() / (name + OLD_BINARY_EXTENSION)); + gpu::hfb::Buffers pngs; + for (const auto& capturedTextureIndexNode : capturedTexturesNode) { + int index = capturedTextureIndexNode; + auto imageFile = path.parent_path() / (name + "." + std::to_string(index) + ".0.png"); + frameNode[gpu::keys::textures][index][gpu::keys::chunk] = 2 + pngs.size(); + pngs.push_back(readFile(imageFile)); + } + frameNode.erase(gpu::keys::capturedTextures); + auto outputPath = path.parent_path() / (name + NEW_EXTENSION); + { + auto jsonOutputPath = path.parent_path() / (name + ".hfb.json"); + std::ofstream of(jsonOutputPath); + auto str = frameNode.dump(2); + of.write(str.data(), str.size()); + } + gpu::hfb::writeFrame(outputPath.string(), frameNode.dump(), binary, pngs); + { + auto frameBuffer = readFile(outputPath.string()); + auto descriptor = gpu::hfb::Descriptor::parse(frameBuffer.data(), frameBuffer.size()); + std::cout << descriptor.header.magic << std::endl; + } +} + +int main(int argc, char** argv) { + for (const auto& framePath : getFrames(DEFAULT_SOURCE_PATH)) { + std::cout << framePath << std::endl; + convertFrame(framePath); + } + return 0; +} diff --git a/tools/gpu-frame-player/src/PlayerWindow.cpp b/tools/gpu-frame-player/src/PlayerWindow.cpp index e74caddd5e..db8d8e0f4d 100644 --- a/tools/gpu-frame-player/src/PlayerWindow.cpp +++ b/tools/gpu-frame-player/src/PlayerWindow.cpp @@ -8,6 +8,8 @@ #include "PlayerWindow.h" +#include +#include #include #include #include @@ -55,7 +57,7 @@ void PlayerWindow::loadFrame() { } } - QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Open File"), openDir, tr("GPU Frames (*.json)")); + QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Open File"), openDir, tr("GPU Frames (*.hfb)")); if (fileName.isNull()) { return; } @@ -104,9 +106,11 @@ void PlayerWindow::resizeEvent(QResizeEvent* ev) { _renderThread.resize(ev->size()); } -void PlayerWindow::textureLoader(const std::string& filename, const gpu::TexturePointer& texture, uint16_t layer) { +void PlayerWindow::textureLoader(const std::vector& imageBytes, const gpu::TexturePointer& texture, uint16_t layer) { QImage image; - QImageReader(filename.c_str()).read(&image); + QByteArray bytes{ (const char*)imageBytes.data(), (int)imageBytes.size() }; + QBuffer bytesBuffer(&bytes); + QImageReader(&bytesBuffer).read(&image); if (layer > 0) { return; } diff --git a/tools/gpu-frame-player/src/PlayerWindow.h b/tools/gpu-frame-player/src/PlayerWindow.h index 4dfbca0855..a519fd9339 100644 --- a/tools/gpu-frame-player/src/PlayerWindow.h +++ b/tools/gpu-frame-player/src/PlayerWindow.h @@ -28,7 +28,7 @@ protected: void loadFrame(const QString& path); private: - static void textureLoader(const std::string& filename, const gpu::TexturePointer& texture, uint16_t layer); + static void textureLoader(const std::vector& filename, const gpu::TexturePointer& texture, uint16_t layer); QSettings _settings; RenderThread _renderThread; }; From cc1be648509b3709d1d19dcec13578dd63ea1360 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 4 Oct 2019 09:20:02 -0700 Subject: [PATCH 24/41] Fixing build issues --- libraries/gpu/src/gpu/FrameIO.cpp | 5 +- libraries/gpu/src/gpu/FrameIO.h | 2 +- libraries/gpu/src/gpu/FrameIOKeys.h | 238 +++++++++++------------ tools/CMakeLists.txt | 1 - tools/frame-optimizer/CMakeLists.txt | 6 - tools/frame-optimizer/src/main.cpp | 39 ---- tools/gpu-frame-converter/CMakeLists.txt | 16 +- 7 files changed, 130 insertions(+), 177 deletions(-) delete mode 100644 tools/frame-optimizer/CMakeLists.txt delete mode 100644 tools/frame-optimizer/src/main.cpp diff --git a/libraries/gpu/src/gpu/FrameIO.cpp b/libraries/gpu/src/gpu/FrameIO.cpp index 568ef335ba..12e07b6e2a 100644 --- a/libraries/gpu/src/gpu/FrameIO.cpp +++ b/libraries/gpu/src/gpu/FrameIO.cpp @@ -37,7 +37,7 @@ Descriptor Descriptor::parse(const uint8_t* const data, size_t size) { if (!read(ptr, remaining, result.header)) { return {}; } - if (!result.header.length == size) { + if (result.header.length != size) { return {}; } @@ -124,6 +124,5 @@ void gpu::hfb::writeFrame(const std::string& filename, for (const auto& png : pngBuffers) { writeChunk(ptr, gpu::hfb::CHUNK_TYPE_PNG, png); } - auto writeSize = ptr - output->data(); - assert(writeSize == size); + assert((ptr - output->data()) == size); } diff --git a/libraries/gpu/src/gpu/FrameIO.h b/libraries/gpu/src/gpu/FrameIO.h index e53d64f22f..bb1dfa0f8c 100644 --- a/libraries/gpu/src/gpu/FrameIO.h +++ b/libraries/gpu/src/gpu/FrameIO.h @@ -23,7 +23,7 @@ FramePointer readFrame(const std::string& filename, uint32_t externalTexture, co namespace hfb { -constexpr char* EXTENSION{ ".hfb" }; +constexpr char* const EXTENSION{ ".hfb" }; constexpr uint32_t HEADER_SIZE{ sizeof(uint32_t) * 3 }; constexpr uint32_t CHUNK_HEADER_SIZE = sizeof(uint32_t) * 2; constexpr uint32_t MAGIC{ 0x49464948 }; diff --git a/libraries/gpu/src/gpu/FrameIOKeys.h b/libraries/gpu/src/gpu/FrameIOKeys.h index 14f7646d4f..ba523386e0 100644 --- a/libraries/gpu/src/gpu/FrameIOKeys.h +++ b/libraries/gpu/src/gpu/FrameIOKeys.h @@ -12,129 +12,129 @@ namespace gpu { namespace keys { -constexpr char* binary = "binary"; -constexpr char* L00 = "L00"; -constexpr char* L1m1 = "L1m1"; -constexpr char* L10 = "L10"; -constexpr char* L11 = "L11"; -constexpr char* L2m2 = "L2m2"; -constexpr char* L2m1 = "L2m1"; -constexpr char* L20 = "L20"; -constexpr char* L21 = "L21"; -constexpr char* L22 = "L22"; +constexpr char* const binary = "binary"; +constexpr char* const L00 = "L00"; +constexpr char* const L1m1 = "L1m1"; +constexpr char* const L10 = "L10"; +constexpr char* const L11 = "L11"; +constexpr char* const L2m2 = "L2m2"; +constexpr char* const L2m1 = "L2m1"; +constexpr char* const L20 = "L20"; +constexpr char* const L21 = "L21"; +constexpr char* const L22 = "L22"; -constexpr char* eyeProjections = "eyeProjections"; -constexpr char* eyeViews = "eyeViews"; -constexpr char* alphaToCoverageEnable = "alphaToCoverageEnable"; -constexpr char* antialisedLineEnable = "antialisedLineEnable"; -constexpr char* attributes = "attributes"; -constexpr char* batches = "batches"; -constexpr char* blendFunction = "blendFunction"; -constexpr char* borderColor = "borderColor"; -constexpr char* bufferMask = "bufferMask"; -constexpr char* buffers = "buffers"; -constexpr char* capturedTextures = "capturedTextures"; -constexpr char* channel = "channel"; -constexpr char* chunk = "chunk"; -constexpr char* colorAttachments = "colorAttachments"; -constexpr char* colorWriteMask = "colorWriteMask"; -constexpr char* commands = "commands"; -constexpr char* comparisonFunction = "comparisonFunction"; -constexpr char* cullMode = "cullMode"; -constexpr char* data = "data"; -constexpr char* depth = "depth"; -constexpr char* depthBias = "depthBias"; -constexpr char* depthBiasSlopeScale = "depthBiasSlopeScale"; -constexpr char* depthClampEnable = "depthClampEnable"; -constexpr char* depthStencilAttachment = "depthStencilAttachment"; -constexpr char* depthTest = "depthTest"; -constexpr char* drawCallInfos = "drawCallInfos"; -constexpr char* drawcallUniform = "drawcallUniform"; -constexpr char* drawcallUniformReset = "drawcallUniformReset"; -constexpr char* element = "element"; -constexpr char* fillMode = "fillMode"; -constexpr char* filter = "filter"; -constexpr char* formats = "formats"; -constexpr char* frameIndex = "frameIndex"; -constexpr char* framebuffer = "framebuffer"; -constexpr char* framebuffers = "framebuffers"; -constexpr char* frequency = "frequency"; -constexpr char* frontFaceClockwise = "frontFaceClockwise"; -constexpr char* height = "height"; -constexpr char* id = "id"; -constexpr char* ktxFile = "ktxFile"; -constexpr char* layers = "layers"; -constexpr char* maxAnisotropy = "maxAnisotropy"; -constexpr char* maxMip = "maxMip"; -constexpr char* minMip = "minMip"; -constexpr char* mipOffset = "mipOffset"; -constexpr char* mips = "mips"; -constexpr char* multisampleEnable = "multisampleEnable"; -constexpr char* name = "name"; -constexpr char* namedData = "namedData"; -constexpr char* names = "names"; -constexpr char* objects = "objects"; -constexpr char* offset = "offset"; -constexpr char* pipelines = "pipelines"; -constexpr char* pose = "pose"; -constexpr char* profileRanges = "profileRanges"; -constexpr char* program = "program"; -constexpr char* programs = "programs"; -constexpr char* projectionJitter = "projectionJitter"; -constexpr char* queries = "queries"; -constexpr char* sampleCount = "sampleCount"; -constexpr char* sampleMask = "sampleMask"; -constexpr char* sampler = "sampler"; -constexpr char* samples = "samples"; -constexpr char* scissorEnable = "scissorEnable"; -constexpr char* shaders = "shaders"; -constexpr char* size = "size"; -constexpr char* skybox = "skybox"; -constexpr char* slot = "slot"; -constexpr char* source = "source"; -constexpr char* state = "state"; -constexpr char* stencilActivation = "stencilActivation"; -constexpr char* stencilTestBack = "stencilTestBack"; -constexpr char* stencilTestFront = "stencilTestFront"; -constexpr char* stereo = "stereo"; -constexpr char* subresource = "subresource"; -constexpr char* swapchains = "swapchains"; -constexpr char* texelFormat = "texelFormat"; -constexpr char* texture = "texture"; -constexpr char* textureTables = "textureTables"; -constexpr char* textures = "textures"; -constexpr char* transforms = "transforms"; -constexpr char* type = "type"; -constexpr char* usageType = "usageType"; -constexpr char* view = "view"; -constexpr char* width = "width"; -constexpr char* wrapModeU = "wrapModeU"; -constexpr char* wrapModeV = "wrapModeV"; -constexpr char* wrapModeW = "wrapModeW"; +constexpr char* const eyeProjections = "eyeProjections"; +constexpr char* const eyeViews = "eyeViews"; +constexpr char* const alphaToCoverageEnable = "alphaToCoverageEnable"; +constexpr char* const antialisedLineEnable = "antialisedLineEnable"; +constexpr char* const attributes = "attributes"; +constexpr char* const batches = "batches"; +constexpr char* const blendFunction = "blendFunction"; +constexpr char* const borderColor = "borderColor"; +constexpr char* const bufferMask = "bufferMask"; +constexpr char* const buffers = "buffers"; +constexpr char* const capturedTextures = "capturedTextures"; +constexpr char* const channel = "channel"; +constexpr char* const chunk = "chunk"; +constexpr char* const colorAttachments = "colorAttachments"; +constexpr char* const colorWriteMask = "colorWriteMask"; +constexpr char* const commands = "commands"; +constexpr char* const comparisonFunction = "comparisonFunction"; +constexpr char* const cullMode = "cullMode"; +constexpr char* const data = "data"; +constexpr char* const depth = "depth"; +constexpr char* const depthBias = "depthBias"; +constexpr char* const depthBiasSlopeScale = "depthBiasSlopeScale"; +constexpr char* const depthClampEnable = "depthClampEnable"; +constexpr char* const depthStencilAttachment = "depthStencilAttachment"; +constexpr char* const depthTest = "depthTest"; +constexpr char* const drawCallInfos = "drawCallInfos"; +constexpr char* const drawcallUniform = "drawcallUniform"; +constexpr char* const drawcallUniformReset = "drawcallUniformReset"; +constexpr char* const element = "element"; +constexpr char* const fillMode = "fillMode"; +constexpr char* const filter = "filter"; +constexpr char* const formats = "formats"; +constexpr char* const frameIndex = "frameIndex"; +constexpr char* const framebuffer = "framebuffer"; +constexpr char* const framebuffers = "framebuffers"; +constexpr char* const frequency = "frequency"; +constexpr char* const frontFaceClockwise = "frontFaceClockwise"; +constexpr char* const height = "height"; +constexpr char* const id = "id"; +constexpr char* const ktxFile = "ktxFile"; +constexpr char* const layers = "layers"; +constexpr char* const maxAnisotropy = "maxAnisotropy"; +constexpr char* const maxMip = "maxMip"; +constexpr char* const minMip = "minMip"; +constexpr char* const mipOffset = "mipOffset"; +constexpr char* const mips = "mips"; +constexpr char* const multisampleEnable = "multisampleEnable"; +constexpr char* const name = "name"; +constexpr char* const namedData = "namedData"; +constexpr char* const names = "names"; +constexpr char* const objects = "objects"; +constexpr char* const offset = "offset"; +constexpr char* const pipelines = "pipelines"; +constexpr char* const pose = "pose"; +constexpr char* const profileRanges = "profileRanges"; +constexpr char* const program = "program"; +constexpr char* const programs = "programs"; +constexpr char* const projectionJitter = "projectionJitter"; +constexpr char* const queries = "queries"; +constexpr char* const sampleCount = "sampleCount"; +constexpr char* const sampleMask = "sampleMask"; +constexpr char* const sampler = "sampler"; +constexpr char* const samples = "samples"; +constexpr char* const scissorEnable = "scissorEnable"; +constexpr char* const shaders = "shaders"; +constexpr char* const size = "size"; +constexpr char* const skybox = "skybox"; +constexpr char* const slot = "slot"; +constexpr char* const source = "source"; +constexpr char* const state = "state"; +constexpr char* const stencilActivation = "stencilActivation"; +constexpr char* const stencilTestBack = "stencilTestBack"; +constexpr char* const stencilTestFront = "stencilTestFront"; +constexpr char* const stereo = "stereo"; +constexpr char* const subresource = "subresource"; +constexpr char* const swapchains = "swapchains"; +constexpr char* const texelFormat = "texelFormat"; +constexpr char* const texture = "texture"; +constexpr char* const textureTables = "textureTables"; +constexpr char* const textures = "textures"; +constexpr char* const transforms = "transforms"; +constexpr char* const type = "type"; +constexpr char* const usageType = "usageType"; +constexpr char* const view = "view"; +constexpr char* const width = "width"; +constexpr char* const wrapModeU = "wrapModeU"; +constexpr char* const wrapModeV = "wrapModeV"; +constexpr char* const wrapModeW = "wrapModeW"; -constexpr char* backWriteMask = "backWriteMask"; -constexpr char* frontWriteMask = "frontWriteMask"; -constexpr char* reference = "reference"; -constexpr char* readMask = "readMask"; -constexpr char* failOp = "failOp"; -constexpr char* depthFailOp = "depthFailOp"; -constexpr char* passOp = "passOp"; -constexpr char* enabled = "enabled"; -constexpr char* blend = "blend"; -constexpr char* flags = "flags"; -constexpr char* writeMask = "writeMask"; -constexpr char* function = "function"; -constexpr char* sourceColor = "sourceColor"; -constexpr char* sourceAlpha = "sourceAlpha"; -constexpr char* destColor = "destColor"; -constexpr char* destAlpha = "destAlpha"; -constexpr char* opColor = "opColor"; -constexpr char* opAlpha = "opAlpha"; -constexpr char* enable = "enable"; -constexpr char* contextDisable = "contextDisable"; +constexpr char* const backWriteMask = "backWriteMask"; +constexpr char* const frontWriteMask = "frontWriteMask"; +constexpr char* const reference = "reference"; +constexpr char* const readMask = "readMask"; +constexpr char* const failOp = "failOp"; +constexpr char* const depthFailOp = "depthFailOp"; +constexpr char* const passOp = "passOp"; +constexpr char* const enabled = "enabled"; +constexpr char* const blend = "blend"; +constexpr char* const flags = "flags"; +constexpr char* const writeMask = "writeMask"; +constexpr char* const function = "function"; +constexpr char* const sourceColor = "sourceColor"; +constexpr char* const sourceAlpha = "sourceAlpha"; +constexpr char* const destColor = "destColor"; +constexpr char* const destAlpha = "destAlpha"; +constexpr char* const opColor = "opColor"; +constexpr char* const opAlpha = "opAlpha"; +constexpr char* const enable = "enable"; +constexpr char* const contextDisable = "contextDisable"; -constexpr char* COMMAND_NAMES[] = { +constexpr char* const COMMAND_NAMES[] = { "draw", "drawIndexed", "drawInstanced", diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index f961a19503..72b1ebe7ba 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -22,7 +22,6 @@ if (BUILD_TOOLS) set(ALL_TOOLS udt-test vhacd-util - frame-optimizer gpu-frame-player gpu-frame-converter ice-client diff --git a/tools/frame-optimizer/CMakeLists.txt b/tools/frame-optimizer/CMakeLists.txt deleted file mode 100644 index cc268c5baf..0000000000 --- a/tools/frame-optimizer/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(TARGET_NAME frame-optimizer) - -setup_memory_debugger() -setup_hifi_project(Gui Widgets) -link_hifi_libraries(shared ktx shaders gpu ) -package_libraries_for_deployment() diff --git a/tools/frame-optimizer/src/main.cpp b/tools/frame-optimizer/src/main.cpp deleted file mode 100644 index a4200c3d97..0000000000 --- a/tools/frame-optimizer/src/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -// Created by Bradley Austin Davis on 2018/10/14 -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include - -#ifdef Q_OS_WIN -#include -#endif - -#include -#include -#include - - -gpu::IndexOptimizer optimizer= [](gpu::Primitive primitive, uint32_t faceCount, uint32_t indexCount, uint32_t* indices ) { - // FIXME add a triangle index optimizer here -}; - - -void messageHandler(QtMsgType type, const QMessageLogContext &, const QString & message) { - auto messageStr = message.toStdString(); -#ifdef Q_OS_WIN - OutputDebugStringA(messageStr.c_str()); - OutputDebugStringA("\n"); -#endif - std::cerr << messageStr << std::endl; -} - -int main(int argc, char** argv) { - QCoreApplication app(argc, argv); - qInstallMessageHandler(messageHandler); - gpu::optimizeFrame("D:/Frames/20190112_1647.json", optimizer); - return 0; -} diff --git a/tools/gpu-frame-converter/CMakeLists.txt b/tools/gpu-frame-converter/CMakeLists.txt index d28a41c278..4c2a2f5546 100644 --- a/tools/gpu-frame-converter/CMakeLists.txt +++ b/tools/gpu-frame-converter/CMakeLists.txt @@ -1,9 +1,9 @@ -set(TARGET_NAME gpu-frame-converter) -setup_memory_debugger() -setup_hifi_project() -set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 17) -# link in the shared libraries -link_hifi_libraries( shared gpu shaders ) - -package_libraries_for_deployment() +if (WIN32) + set(TARGET_NAME gpu-frame-converter) + setup_memory_debugger() + setup_hifi_project() + set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 17) + link_hifi_libraries( shared gpu shaders ) + package_libraries_for_deployment() +endif() \ No newline at end of file From 88514540d10a2467b3d9c50cfd224c988d30f653 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 4 Oct 2019 09:26:33 -0700 Subject: [PATCH 25/41] Fixing tools build --- tools/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 72b1ebe7ba..6f9145ff7d 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -42,7 +42,9 @@ if (BUILD_TOOLS) check_test(${TOOL}) if (${BUILD_TOOL_RESULT}) add_subdirectory(${TOOL}) - set_target_properties(${TOOL} PROPERTIES FOLDER "Tools") + if (TARGET ${TOOL}) + set_target_properties(${TOOL} PROPERTIES FOLDER "Tools") + endif() endif() endforeach() endif() From fc0874a1822fdc83b1682ec57c5af96cbb49c97b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 3 Oct 2019 17:11:53 -0700 Subject: [PATCH 26/41] new version of webrtc library for osx --- cmake/ports/webrtc/portfile.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/ports/webrtc/portfile.cmake b/cmake/ports/webrtc/portfile.cmake index 3f2fb7a6ab..b5b46723bd 100644 --- a/cmake/ports/webrtc/portfile.cmake +++ b/cmake/ports/webrtc/portfile.cmake @@ -14,9 +14,9 @@ elseif (WIN32) elseif (APPLE) vcpkg_download_distfile( WEBRTC_SOURCE_ARCHIVE - URLS https://hifi-public.s3.amazonaws.com/seth/webrtc-20190626-osx.tar.gz - SHA512 fc70cec1b5ee87395137b7090f424e2fc2300fc17d744d5ffa1cf7aa0e0f1a069a9d72ba1ad2fb4a640ebeb6c218bda24351ba0083e1ff96c4a4b5032648a9d2 - FILENAME webrtc-20190626-osx.tar.gz + URLS https://hifi-public.s3.amazonaws.com/seth/webrtc-m78-osx.tar.gz + SHA512 8b547da921cc96f5c22b4253a1c9e707971bb627898fbdb6b238ef1318c7d2512e878344885c936d4bd6a66005cc5b63dfc3fa5ddd14f17f378dcaa17b5e25df + FILENAME webrtc-m78-osx.tar.gz ) else () # else Linux desktop From 243120b95c99d9c3d555bbb45022d4c33a998ea5 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 4 Oct 2019 14:57:39 -0700 Subject: [PATCH 27/41] Even better frame capture --- interface/src/Application.cpp | 2 +- .../display-plugins/OpenGLDisplayPlugin.cpp | 63 +++++++----- libraries/gpu/src/gpu/FrameIO.cpp | 98 ++++++++++--------- libraries/gpu/src/gpu/FrameIO.h | 27 +++-- libraries/gpu/src/gpu/FrameReader.cpp | 59 ++++------- libraries/gpu/src/gpu/FrameWriter.cpp | 20 ++-- libraries/gpu/src/gpu/Texture.h | 3 + libraries/gpu/src/gpu/Texture_ktx.cpp | 85 +++++++++++----- libraries/ktx/src/ktx/KTX.h | 2 +- libraries/shared/src/shared/FileUtils.cpp | 13 +++ libraries/shared/src/shared/FileUtils.h | 7 +- libraries/shared/src/shared/Storage.h | 15 ++- tools/gpu-frame-player/src/PlayerWindow.cpp | 13 +-- 13 files changed, 242 insertions(+), 165 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index c9b976cc14..b4a37519a6 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4441,7 +4441,7 @@ void Application::keyPressEvent(QKeyEvent* event) { static const QString GPU_FRAME_FOLDER = QProcessEnvironment::systemEnvironment().contains(HIFI_FRAMES_FOLDER_VAR) ? QProcessEnvironment::systemEnvironment().value(HIFI_FRAMES_FOLDER_VAR) : "hifiFrames"; - static QString GPU_FRAME_TEMPLATE = GPU_FRAME_FOLDER + "/{DATE}_{TIME}.hfb"; + static QString GPU_FRAME_TEMPLATE = GPU_FRAME_FOLDER + "/{DATE}_{TIME}"; QString fullPath = FileUtils::computeDocumentPath(FileUtils::replaceDateTimeTokens(GPU_FRAME_TEMPLATE)); if (FileUtils::canCreateFile(fullPath)) { getActiveDisplayPlugin()->captureFrame(fullPath.toStdString()); diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index e69791e73d..6ca11688a2 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -476,34 +477,50 @@ void OpenGLDisplayPlugin::submitFrame(const gpu::FramePointer& newFrame) { }); } +ktx::StoragePointer textureToKtx(const gpu::Texture& texture) { + ktx::Header header; + { + auto gpuDims = texture.getDimensions(); + header.pixelWidth = gpuDims.x; + header.pixelHeight = gpuDims.y; + header.pixelDepth = 0; + } + + { + auto gltexelformat = gpu::gl::GLTexelFormat::evalGLTexelFormat(texture.getStoredMipFormat()); + header.glInternalFormat = gltexelformat.internalFormat; + header.glFormat = gltexelformat.format; + header.glBaseInternalFormat = gltexelformat.format; + header.glType = gltexelformat.type; + header.glTypeSize = 1; + header.numberOfMipmapLevels = 1 + texture.getMaxMip(); + } + + auto memKtx = ktx::KTX::createBare(header); + auto storage = memKtx->_storage; + uint32_t faceCount = std::max(header.numberOfFaces, 1u); + uint32_t mipCount = std::max(header.numberOfMipmapLevels, 1u); + for (uint32_t mip = 0; mip < mipCount; ++mip) { + for (uint32_t face = 0; face < faceCount; ++face) { + const auto& image = memKtx->_images[mip]; + auto& faceBytes = const_cast(image._faceBytes[face]); + if (texture.isStoredMipFaceAvailable(mip, face)) { + auto storedImage = texture.accessStoredMipFace(mip, face); + auto storedSize = storedImage->size(); + memcpy(faceBytes, storedImage->data(), storedSize); + } + } + } + return storage; +} + void OpenGLDisplayPlugin::captureFrame(const std::string& filename) const { withOtherThreadContext([&] { using namespace gpu; auto glBackend = const_cast(*this).getGLBackend(); FramebufferPointer framebuffer{ Framebuffer::create("captureFramebuffer") }; - TextureCapturer captureLambda = [&](std::vector& outputBuffer, const gpu::TexturePointer& texture, uint16 layer) { - QImage image; - if (texture->getUsageType() == TextureUsageType::STRICT_RESOURCE) { - image = QImage{ 1, 1, QImage::Format_ARGB32 }; - auto storedImage = texture->accessStoredMipFace(0, 0); - memcpy(image.bits(), storedImage->data(), image.sizeInBytes()); - //if (texture == textureCache->getWhiteTexture()) { - //} else if (texture == textureCache->getBlackTexture()) { - //} else if (texture == textureCache->getBlueTexture()) { - //} else if (texture == textureCache->getGrayTexture()) { - } else { - ivec4 rect = { 0, 0, texture->getWidth(), texture->getHeight() }; - framebuffer->setRenderBuffer(0, texture, layer); - glBackend->syncGPUObject(*framebuffer); - - image = QImage{ rect.z, rect.w, QImage::Format_ARGB32 }; - glBackend->downloadFramebuffer(framebuffer, rect, image); - } - QBuffer buffer; - QImageWriter(&buffer, "png").write(image); - const auto& data = buffer.data(); - outputBuffer.resize(data.size()); - memcpy(outputBuffer.data(), data.constData(), data.size()); + TextureCapturer captureLambda = [&](const gpu::TexturePointer& texture)->storage::StoragePointer { + return textureToKtx(*texture); }; if (_currentFrame) { diff --git a/libraries/gpu/src/gpu/FrameIO.cpp b/libraries/gpu/src/gpu/FrameIO.cpp index 12e07b6e2a..a0f21df881 100644 --- a/libraries/gpu/src/gpu/FrameIO.cpp +++ b/libraries/gpu/src/gpu/FrameIO.cpp @@ -8,6 +8,7 @@ #include "FrameIO.h" #include +#include using namespace gpu::hfb; @@ -30,30 +31,44 @@ static bool read(const uint8_t*& ptr, size_t& remaining, T& output) { return skip(ptr, remaining, readSize); } -Descriptor Descriptor::parse(const uint8_t* const data, size_t size) { - const auto* ptr = data; - auto remaining = size; - Descriptor result; - if (!read(ptr, remaining, result.header)) { - return {}; - } - if (result.header.length != size) { - return {}; - } +Descriptor::Descriptor(const StoragePointer& storage) : storage(storage) { + const auto* const start = storage->data(); + const auto* ptr = storage->data(); + auto remaining = storage->size(); - while (remaining != 0) { - result.chunks.emplace_back(); - auto& chunk = result.chunks.back(); - ChunkHeader& chunkHeader = chunk; - if (!read(ptr, remaining, chunkHeader)) { - return {}; + try { + // Can't parse files more than 4GB + if (remaining > UINT32_MAX) { + throw std::runtime_error("File too large"); } - chunk.offset = ptr - data; - if (!skip(ptr, remaining, chunk.length)) { - return {}; + + if (!read(ptr, remaining, header)) { + throw std::runtime_error("Couldn't read binary header"); } + + if (header.length != storage->size()) { + throw std::runtime_error("Header/Actual size mismatch"); + } + + while (remaining != 0) { + chunks.emplace_back(); + auto& chunk = chunks.back(); + ChunkHeader& chunkHeader = chunk; + if (!read(ptr, remaining, chunkHeader)) { + throw std::runtime_error("Coulnd't read chunk header"); + } + chunk.offset = (uint32_t)(ptr - start); + if (chunk.end() > storage->size()) { + throw std::runtime_error("Chunk too large for file"); + } + if (!skip(ptr, remaining, chunk.length)) { + throw std::runtime_error("Skip chunk data failed"); + } + } + } catch (const std::runtime_error&) { + // LOG somnething + header.magic = 0; } - return result; } size_t Chunk::end() const { @@ -62,30 +77,15 @@ size_t Chunk::end() const { return result; } - -bool Descriptor::getChunkString(std::string& output, size_t chunkIndex, const uint8_t* const data, size_t size) { +StoragePointer Descriptor::getChunk(uint32_t chunkIndex) const { if (chunkIndex >= chunks.size()) { - return false; + return {}; } const auto& chunk = chunks[chunkIndex]; - if (chunk.end() > size) { - return false; + if (chunk.end() > storage->size()) { + return {}; } - output = std::string{ (const char*)(data + chunk.offset), chunk.length }; - return true; -} - -bool Descriptor::getChunkBuffer(Buffer& output, size_t chunkIndex, const uint8_t* const data, size_t size) { - if (chunkIndex >= chunks.size()) { - return false; - } - const auto& chunk = chunks[chunkIndex]; - if (chunk.end() > size) { - return false; - } - output.resize(chunk.length); - memcpy(output.data(), data + chunk.offset, chunk.length); - return true; + return storage->createView(chunk.length, chunk.offset); } static void writeUint(uint8_t*& dest, uint32_t value) { @@ -105,12 +105,15 @@ static void writeChunk(uint8_t*& dest, uint32_t chunkType, const T& chunkData) { void gpu::hfb::writeFrame(const std::string& filename, const std::string& json, const Buffer& binaryBuffer, - const Buffers& pngBuffers) { + const StorageBuilders& ktxBuilders) { uint32_t strLen = (uint32_t)json.size(); uint32_t size = gpu::hfb::HEADER_SIZE + gpu::hfb::CHUNK_HEADER_SIZE + strLen; size += gpu::hfb::CHUNK_HEADER_SIZE + (uint32_t)binaryBuffer.size(); - for (const auto& pngBuffer : pngBuffers) { - size += gpu::hfb::CHUNK_HEADER_SIZE + (uint32_t)pngBuffer.size(); + for (const auto& builder : ktxBuilders) { + auto storage = builder(); + if (storage) { + size += gpu::hfb::CHUNK_HEADER_SIZE + (uint32_t)storage->size(); + } } auto outputConst = storage::FileStorage::create(filename.c_str(), size, nullptr); @@ -121,8 +124,13 @@ void gpu::hfb::writeFrame(const std::string& filename, writeUint(ptr, size); writeChunk(ptr, gpu::hfb::CHUNK_TYPE_JSON, json); writeChunk(ptr, gpu::hfb::CHUNK_TYPE_BIN, binaryBuffer); - for (const auto& png : pngBuffers) { - writeChunk(ptr, gpu::hfb::CHUNK_TYPE_PNG, png); + for (const auto& builder : ktxBuilders) { + static StoragePointer EMPTY_STORAGE{ std::make_shared(0, nullptr) }; + auto storage = builder(); + if (!storage) { + storage = EMPTY_STORAGE; + } + writeChunk(ptr, gpu::hfb::CHUNK_TYPE_KTX, *storage); } assert((ptr - output->data()) == size); } diff --git a/libraries/gpu/src/gpu/FrameIO.h b/libraries/gpu/src/gpu/FrameIO.h index bb1dfa0f8c..77602ef4e8 100644 --- a/libraries/gpu/src/gpu/FrameIO.h +++ b/libraries/gpu/src/gpu/FrameIO.h @@ -12,28 +12,34 @@ #include "Forward.h" #include "Format.h" +#include + #include namespace gpu { -using TextureCapturer = std::function&, const TexturePointer&, uint16 layer)>; -using TextureLoader = std::function&, const TexturePointer&, uint16 layer)>; +using TextureCapturer = std::function; +//using TextureLoader = std::function; void writeFrame(const std::string& filename, const FramePointer& frame, const TextureCapturer& capturer = nullptr); -FramePointer readFrame(const std::string& filename, uint32_t externalTexture, const TextureLoader& loader = nullptr); +FramePointer readFrame(const std::string& filename, uint32_t externalTexture); namespace hfb { +using Storage = storage::Storage; +using StoragePointer = storage::Pointer; +using StorageBuilders = storage::Builders; + constexpr char* const EXTENSION{ ".hfb" }; constexpr uint32_t HEADER_SIZE{ sizeof(uint32_t) * 3 }; constexpr uint32_t CHUNK_HEADER_SIZE = sizeof(uint32_t) * 2; constexpr uint32_t MAGIC{ 0x49464948 }; constexpr uint32_t VERSION{ 0x01 }; constexpr uint32_t CHUNK_TYPE_JSON{ 0x4E4F534A }; +constexpr uint32_t CHUNK_TYPE_KTX{ 0x0058544b }; constexpr uint32_t CHUNK_TYPE_BIN{ 0x004E4942 }; constexpr uint32_t CHUNK_TYPE_PNG{ 0x00474E50 }; using Buffer = std::vector; -using Buffers = std::vector; struct Header { uint32_t magic{ 0 }; @@ -55,16 +61,21 @@ struct Chunk : public ChunkHeader { using Chunks = std::vector; struct Descriptor { + using Pointer = std::shared_ptr; + Header header; Chunks chunks; + StoragePointer storage; + Descriptor(const StoragePointer& storage); operator bool() const { return header.magic == MAGIC; } - bool getChunkString(std::string& output, size_t chunk, const uint8_t* const data, size_t size); - bool getChunkBuffer(Buffer& output, size_t chunk, const uint8_t* const data, size_t size); - static Descriptor parse(const uint8_t* const data, size_t size); + StoragePointer getChunk(uint32_t chunk) const; }; -void writeFrame(const std::string& filename, const std::string& json, const Buffer& binaryBuffer, const Buffers& pngBuffers); +void writeFrame(const std::string& filename, + const std::string& json, + const Buffer& binaryBuffer, + const StorageBuilders& pngBuffers); } // namespace hfb diff --git a/libraries/gpu/src/gpu/FrameReader.cpp b/libraries/gpu/src/gpu/FrameReader.cpp index 1f94828119..d636c6aaca 100644 --- a/libraries/gpu/src/gpu/FrameReader.cpp +++ b/libraries/gpu/src/gpu/FrameReader.cpp @@ -10,9 +10,7 @@ #include #include -#include -#include - +#include #include #include "Frame.h" #include "Batch.h" @@ -33,7 +31,7 @@ public: auto lastSlash = filename.rfind('/'); result = filename.substr(0, lastSlash + 1); } else { - result = QFileInfo(filename.c_str()).absoluteDir().canonicalPath().toStdString(); + result = FileUtils::getParentPath(filename.c_str()).toStdString(); if (*result.rbegin() != '/') { result += '/'; } @@ -41,18 +39,17 @@ public: return result; } - Deserializer(const std::string& filename_, uint32_t externalTexture = 0, const TextureLoader& loader = {}) : + Deserializer(const std::string& filename_, uint32_t externalTexture = 0) : filename(filename_), basedir(getBaseDir(filename_)), mappedFile(std::make_shared(filename.c_str())), - externalTexture(externalTexture), textureLoader(loader) { - descriptor = hfb::Descriptor::parse(mappedFile->data(), (uint32_t)mappedFile->size()); + externalTexture(externalTexture) { + descriptor = std::make_shared(mappedFile); } const std::string filename; const std::string basedir; const StoragePointer mappedFile; const uint32_t externalTexture; - hfb::Descriptor descriptor; - TextureLoader textureLoader; + hfb::Descriptor::Pointer descriptor; std::vector shaders; std::vector programs; std::vector textures; @@ -70,19 +67,8 @@ public: FramePointer deserializeFrame(); std::string getStringChunk(size_t chunkIndex) { - std::string result; - if (!descriptor.getChunkString(result, chunkIndex, mappedFile->data(), mappedFile->size())) { - return {}; - } - return result; - } - - hfb::Buffer getBufferChunk(size_t chunkIndex) { - hfb::Buffer result; - if (!descriptor.getChunkBuffer(result, chunkIndex, mappedFile->data(), mappedFile->size())) { - return {}; - } - return result; + auto storage = descriptor->getChunk((uint32_t)chunkIndex); + return std::string{ (const char*)storage->data(), storage->size() }; } void readBuffers(const json& node); @@ -240,8 +226,8 @@ public: static void readCommand(const json& node, Batch& batch); }; -FramePointer readFrame(const std::string& filename, uint32_t externalTexture, const TextureLoader& loader) { - return Deserializer(filename, externalTexture, loader).readFrame(); +FramePointer readFrame(const std::string& filename, uint32_t externalTexture) { + return Deserializer(filename, externalTexture).readFrame(); } } // namespace gpu @@ -249,7 +235,7 @@ FramePointer readFrame(const std::string& filename, uint32_t externalTexture, co using namespace gpu; void Deserializer::readBuffers(const json& buffersNode) { - const auto& binaryChunk = descriptor.chunks[1]; + const auto& binaryChunk = descriptor->chunks[1]; const auto* mapped = mappedFile->data() + binaryChunk.offset; const auto mappedSize = binaryChunk.length; size_t bufferCount = buffersNode.size(); @@ -333,7 +319,7 @@ TexturePointer Deserializer::readTexture(const json& node, uint32_t external) { std::string ktxFile; readOptional(ktxFile, node, keys::ktxFile); if (!ktxFile.empty()) { - if (!QFileInfo(ktxFile.c_str()).exists()) { + if (!FileUtils::exists(ktxFile.c_str())) { qDebug() << "Warning" << ktxFile.c_str() << " not found, ignoring"; ktxFile = {}; } @@ -347,8 +333,8 @@ TexturePointer Deserializer::readTexture(const json& node, uint32_t external) { frameReaderPath.replace("libraries/gpu/src/gpu/framereader.cpp", "interface/resources", Qt::CaseInsensitive); ktxFile.replace(0, 1, frameReaderPath.toStdString()); } - if (QFileInfo(ktxFile.c_str()).isRelative()) { - ktxFile = basedir + ktxFile; + if (FileUtils::isRelative(ktxFile.c_str())) { + ktxFile = basedir + "/" + ktxFile; } ktx::StoragePointer ktxStorage{ new storage::FileStorage(ktxFile.c_str()) }; auto ktxObject = ktx::KTX::create(ktxStorage); @@ -381,19 +367,14 @@ TexturePointer Deserializer::readTexture(const json& node, uint32_t external) { auto& texture = *result; readOptional(texture._source, node, keys::source); - if (!ktxFile.empty()) { - if (QFileInfo(ktxFile.c_str()).isRelative()) { - ktxFile = basedir + "/" + ktxFile; - } + + if (chunkIndex != INVALID_CHUNK_INDEX) { + auto ktxChunk = descriptor->getChunk(chunkIndex); + texture.setKtxBacking(ktxChunk); + } else if (!ktxFile.empty()) { texture.setSource(ktxFile); texture.setKtxBacking(ktxFile); - } else if (chunkIndex != INVALID_CHUNK_INDEX) { - if (textureLoader) { - texture.setSource("Chunk " + std::to_string(chunkIndex)); - textureLoader(getBufferChunk(chunkIndex), result, 0); - } - } - + } return result; } diff --git a/libraries/gpu/src/gpu/FrameWriter.cpp b/libraries/gpu/src/gpu/FrameWriter.cpp index 85397f149a..761f37a620 100644 --- a/libraries/gpu/src/gpu/FrameWriter.cpp +++ b/libraries/gpu/src/gpu/FrameWriter.cpp @@ -34,7 +34,7 @@ public: std::unordered_map queryMap; std::unordered_set captureTextures; hfb::Buffer binaryBuffer; - hfb::Buffers pngBuffers; + hfb::StorageBuilders ktxBuilders; Serializer(const std::string& basename, const TextureCapturer& capturer) : filename(basename + hfb::EXTENSION), textureCapturer(capturer) {} @@ -392,13 +392,17 @@ json Serializer::writeTexture(const TexturePointer& texturePointer) { const auto* storage = texture._storage.get(); const auto* ktxStorage = dynamic_cast(storage); if (ktxStorage) { - result[keys::ktxFile] = ktxStorage->_filename; + result[keys::chunk] = 2 + ktxBuilders.size(); + auto filename = ktxStorage->_filename; + ktxBuilders.push_back([=] { + return std::make_shared(filename.c_str()); + }); } else if (textureCapturer && captureTextures.count(texturePointer) != 0) { - auto layers = std::max(texture.getNumSlices(), 1); - result[keys::chunk] = 2 + pngBuffers.size(); - pngBuffers.push_back({}); - hfb::Buffer& pngBuffer = pngBuffers.back(); - textureCapturer(pngBuffer, texturePointer, 0); + result[keys::chunk] = 2 + ktxBuilders.size(); + auto storage = textureCapturer(texturePointer); + ktxBuilders.push_back([=] { + return storage; + }); } } return result; @@ -790,7 +794,7 @@ void Serializer::writeFrame(const Frame& frame) { writeBinaryBlob(); - hfb::writeFrame(filename, frameNode.dump(), binaryBuffer, pngBuffers); + hfb::writeFrame(filename, frameNode.dump(), binaryBuffer, ktxBuilders); } void Serializer::writeBinaryBlob() { diff --git a/libraries/gpu/src/gpu/Texture.h b/libraries/gpu/src/gpu/Texture.h index 5e2485941d..debedf02a5 100755 --- a/libraries/gpu/src/gpu/Texture.h +++ b/libraries/gpu/src/gpu/Texture.h @@ -343,6 +343,7 @@ public: class KtxStorage : public Storage { public: + KtxStorage(const storage::StoragePointer& storage); KtxStorage(const std::string& filename); KtxStorage(const cache::FilePointer& file); PixelsPointer getMipFace(uint16 level, uint8 face = 0) const override; @@ -366,6 +367,7 @@ public: static std::vector, std::shared_ptr>> _cachedKtxFiles; static std::mutex _cachedKtxFilesMutex; + storage::StoragePointer _storage; std::string _filename; cache::FilePointer _cacheEntry; std::atomic _minMipLevelAvailable; @@ -543,6 +545,7 @@ public: Size getStoredSize() const; void setStorage(std::unique_ptr& newStorage); + void setKtxBacking(const storage::StoragePointer& storage); void setKtxBacking(const std::string& filename); void setKtxBacking(const cache::FilePointer& cacheEntry); diff --git a/libraries/gpu/src/gpu/Texture_ktx.cpp b/libraries/gpu/src/gpu/Texture_ktx.cpp index f471baf2c7..a5cea3e60e 100644 --- a/libraries/gpu/src/gpu/Texture_ktx.cpp +++ b/libraries/gpu/src/gpu/Texture_ktx.cpp @@ -159,7 +159,31 @@ struct IrradianceKTXPayload { }; const std::string IrradianceKTXPayload::KEY{ "hifi.irradianceSH" }; -KtxStorage::KtxStorage(const cache::FilePointer& cacheEntry) : KtxStorage(cacheEntry->getFilepath()) { +KtxStorage::KtxStorage(const storage::StoragePointer& storage) : _storage(storage) { + auto ktxPointer = ktx::KTX::create(storage); + _ktxDescriptor.reset(new ktx::KTXDescriptor(ktxPointer->toDescriptor())); + if (_ktxDescriptor->images.size() < _ktxDescriptor->header.numberOfMipmapLevels) { + qWarning() << "Bad images found in ktx"; + } + + _offsetToMinMipKV = _ktxDescriptor->getValueOffsetForKey(ktx::HIFI_MIN_POPULATED_MIP_KEY); + if (_offsetToMinMipKV) { + auto data = storage->data() + ktx::KTX_HEADER_SIZE + _offsetToMinMipKV; + _minMipLevelAvailable = *data; + } else { + // Assume all mip levels are available + _minMipLevelAvailable = 0; + } + + // now that we know the ktx, let's get the header info to configure this Texture::Storage: + Format mipFormat = Format::COLOR_BGRA_32; + Format texelFormat = Format::COLOR_SRGBA_32; + if (Texture::evalTextureFormat(_ktxDescriptor->header, mipFormat, texelFormat)) { + _format = mipFormat; + } +} + +KtxStorage::KtxStorage(const cache::FilePointer& cacheEntry) : KtxStorage(cacheEntry->getFilepath()) { _cacheEntry = cacheEntry; } @@ -228,28 +252,31 @@ void KtxStorage::releaseOpenKtxFiles() { PixelsPointer KtxStorage::getMipFace(uint16 level, uint8 face) const { auto faceOffset = _ktxDescriptor->getMipFaceTexelsOffset(level, face); auto faceSize = _ktxDescriptor->getMipFaceTexelsSize(level, face); + storage::StoragePointer storageView; if (faceSize != 0 && faceOffset != 0) { - std::lock_guard lock(*_cacheFileMutex); - auto file = maybeOpenFile(); - if (file) { - auto storageView = file->createView(faceSize, faceOffset); - if (storageView) { - return storageView->toMemoryStorage(); - } else { - qWarning() << "Failed to get a valid storageView for faceSize=" << faceSize << " faceOffset=" << faceOffset << "out of valid file " << QString::fromStdString(_filename); - } + if (_storage) { + storageView = _storage->createView(faceSize, faceOffset); } else { - qWarning() << "Failed to get a valid file out of maybeOpenFile " << QString::fromStdString(_filename); + std::lock_guard lock(*_cacheFileMutex); + auto file = maybeOpenFile(); + if (file) { + storageView = file->createView(faceSize, faceOffset); + } else { + qWarning() << "Failed to get a valid file out of maybeOpenFile " << QString::fromStdString(_filename); + } } } - return nullptr; + if (!storageView) { + qWarning() << "Failed to get a valid storageView for faceSize=" << faceSize << " faceOffset=" << faceOffset + << "out of valid file " << QString::fromStdString(_filename); + } + return storageView->toMemoryStorage(); } Size KtxStorage::getMipFaceSize(uint16 level, uint8 face) const { return _ktxDescriptor->getMipFaceTexelsSize(level, face); } - bool KtxStorage::isMipAvailable(uint16 level, uint8 face) const { return level >= _minMipLevelAvailable; } @@ -271,7 +298,7 @@ void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& stor auto& imageDesc = _ktxDescriptor->images[level]; if (storage->size() != imageDesc._imageSize) { qWarning() << "Invalid image size: " << storage->size() << ", expected: " << imageDesc._imageSize - << ", level: " << level << ", filename: " << QString::fromStdString(_filename); + << ", level: " << level << ", filename: " << QString::fromStdString(_filename); return; } @@ -311,8 +338,7 @@ void KtxStorage::assignMipFaceData(uint16 level, uint8 face, const storage::Stor throw std::runtime_error("Invalid call"); } -bool validKtx(const std::string& filename) { - ktx::StoragePointer storage { new storage::FileStorage(filename.c_str()) }; +bool validKtx(const storage::StoragePointer& storage) { auto ktxPointer = ktx::KTX::create(storage); if (!ktxPointer) { return false; @@ -320,6 +346,21 @@ bool validKtx(const std::string& filename) { return true; } +bool validKtx(const std::string& filename) { + ktx::StoragePointer storage{ new storage::FileStorage(filename.c_str()) }; + return validKtx(storage); +} + +void Texture::setKtxBacking(const storage::StoragePointer& storage) { + // Check the KTX file for validity before using it as backing storage + if (!validKtx(storage)) { + return; + } + + auto newBacking = std::unique_ptr(new KtxStorage(storage)); + setStorage(newBacking); +} + void Texture::setKtxBacking(const std::string& filename) { // Check the KTX file for validity before using it as backing storage if (!validKtx(filename)) { @@ -355,7 +396,7 @@ ktx::KTXUniquePointer Texture::serialize(const Texture& texture) { // Set Dimensions uint32_t numFaces = 1; switch (texture.getType()) { - case TEX_1D: { + case TEX_1D: { if (texture.isArray()) { header.set1DArray(texture.getWidth(), texture.getNumSlices()); } else { @@ -363,7 +404,7 @@ ktx::KTXUniquePointer Texture::serialize(const Texture& texture) { } break; } - case TEX_2D: { + case TEX_2D: { if (texture.isArray()) { header.set2DArray(texture.getWidth(), texture.getHeight(), texture.getNumSlices()); } else { @@ -371,7 +412,7 @@ ktx::KTXUniquePointer Texture::serialize(const Texture& texture) { } break; } - case TEX_3D: { + case TEX_3D: { if (texture.isArray()) { header.set3DArray(texture.getWidth(), texture.getHeight(), texture.getDepth(), texture.getNumSlices()); } else { @@ -379,7 +420,7 @@ ktx::KTXUniquePointer Texture::serialize(const Texture& texture) { } break; } - case TEX_CUBE: { + case TEX_CUBE: { if (texture.isArray()) { header.setCubeArray(texture.getWidth(), texture.getHeight(), texture.getNumSlices()); } else { @@ -388,8 +429,8 @@ ktx::KTXUniquePointer Texture::serialize(const Texture& texture) { numFaces = Texture::CUBE_FACE_COUNT; break; } - default: - return nullptr; + default: + return nullptr; } // Number level of mips coming diff --git a/libraries/ktx/src/ktx/KTX.h b/libraries/ktx/src/ktx/KTX.h index d755a482e3..0165113ec5 100644 --- a/libraries/ktx/src/ktx/KTX.h +++ b/libraries/ktx/src/ktx/KTX.h @@ -96,7 +96,7 @@ namespace ktx { using GLBaseInternalFormat = khronos::gl::texture::BaseInternalFormat; using Storage = storage::Storage; - using StoragePointer = std::shared_ptr; + using StoragePointer = std::shared_ptr; struct ImageDescriptor; using ImageDescriptors = std::vector; diff --git a/libraries/shared/src/shared/FileUtils.cpp b/libraries/shared/src/shared/FileUtils.cpp index f2a4925351..164af091de 100644 --- a/libraries/shared/src/shared/FileUtils.cpp +++ b/libraries/shared/src/shared/FileUtils.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -176,3 +177,15 @@ bool FileUtils::canCreateFile(const QString& fullPath) { } return true; } + +QString FileUtils::getParentPath(const QString& fullPath) { + return QFileInfo(fullPath).absoluteDir().canonicalPath(); +} + +bool FileUtils::exists(const QString& fileName) { + return QFileInfo(fileName).exists(); +} + +bool FileUtils::isRelative(const QString& fileName) { + return QFileInfo(fileName).isRelative(); +} diff --git a/libraries/shared/src/shared/FileUtils.h b/libraries/shared/src/shared/FileUtils.h index 2f5e11f005..d4ff819e75 100644 --- a/libraries/shared/src/shared/FileUtils.h +++ b/libraries/shared/src/shared/FileUtils.h @@ -12,20 +12,23 @@ #ifndef hifi_FileUtils_h #define hifi_FileUtils_h -#include -#include +#include + class FileUtils { public: static const QStringList& getFileSelectors(); static QString selectFile(const QString& fileName); static void locateFile(const QString& fileName); + static bool exists(const QString& fileName); + static bool isRelative(const QString& fileName); static QString standardPath(QString subfolder); static QString readFile(const QString& filename); static QStringList readLines(const QString& filename, QString::SplitBehavior splitBehavior = QString::KeepEmptyParts); static QString replaceDateTimeTokens(const QString& path); static QString computeDocumentPath(const QString& path); static bool canCreateFile(const QString& fullPath); + static QString getParentPath(const QString& fullPath); }; #endif // hifi_FileUtils_h diff --git a/libraries/shared/src/shared/Storage.h b/libraries/shared/src/shared/Storage.h index 0e5032bb62..6a2cecf8b9 100644 --- a/libraries/shared/src/shared/Storage.h +++ b/libraries/shared/src/shared/Storage.h @@ -10,15 +10,22 @@ #ifndef hifi_Storage_h #define hifi_Storage_h -#include +#include #include #include -#include -#include +#include + +#include +#include namespace storage { class Storage; - using StoragePointer = std::shared_ptr; + using Pointer = std::shared_ptr; + using StoragePointer = Pointer; + // A function that can construct storage, useful for creating a list of + // things that can become storage without requiring that they all be instantiated at once + using Builder = std::function; + using Builders = std::vector; // Abstract class to represent memory that stored _somewhere_ (in system memory or in a file, for example) class Storage : public std::enable_shared_from_this { diff --git a/tools/gpu-frame-player/src/PlayerWindow.cpp b/tools/gpu-frame-player/src/PlayerWindow.cpp index db8d8e0f4d..8e7f730181 100644 --- a/tools/gpu-frame-player/src/PlayerWindow.cpp +++ b/tools/gpu-frame-player/src/PlayerWindow.cpp @@ -106,19 +106,8 @@ void PlayerWindow::resizeEvent(QResizeEvent* ev) { _renderThread.resize(ev->size()); } -void PlayerWindow::textureLoader(const std::vector& imageBytes, const gpu::TexturePointer& texture, uint16_t layer) { - QImage image; - QByteArray bytes{ (const char*)imageBytes.data(), (int)imageBytes.size() }; - QBuffer bytesBuffer(&bytes); - QImageReader(&bytesBuffer).read(&image); - if (layer > 0) { - return; - } - texture->assignStoredMip(0, image.byteCount(), image.constBits()); -} - void PlayerWindow::loadFrame(const QString& path) { - auto frame = gpu::readFrame(path.toStdString(), _renderThread._externalTexture, &PlayerWindow::textureLoader); + auto frame = gpu::readFrame(path.toStdString(), _renderThread._externalTexture); if (frame) { _renderThread.submitFrame(frame); if (!_renderThread.isThreaded()) { From d69a83a2f2985da22fb9aeda0c4619f2d608525f Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 4 Oct 2019 18:20:10 -0700 Subject: [PATCH 28/41] fix warnings --- .../display-plugins/OpenGLDisplayPlugin.cpp | 2 - libraries/gpu/src/gpu/FrameIO.h | 2 +- libraries/gpu/src/gpu/FrameIOKeys.h | 238 +++++++++--------- 3 files changed, 120 insertions(+), 122 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index 6ca11688a2..55a15dadf0 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -517,8 +517,6 @@ ktx::StoragePointer textureToKtx(const gpu::Texture& texture) { void OpenGLDisplayPlugin::captureFrame(const std::string& filename) const { withOtherThreadContext([&] { using namespace gpu; - auto glBackend = const_cast(*this).getGLBackend(); - FramebufferPointer framebuffer{ Framebuffer::create("captureFramebuffer") }; TextureCapturer captureLambda = [&](const gpu::TexturePointer& texture)->storage::StoragePointer { return textureToKtx(*texture); }; diff --git a/libraries/gpu/src/gpu/FrameIO.h b/libraries/gpu/src/gpu/FrameIO.h index 77602ef4e8..cf653cc4ae 100644 --- a/libraries/gpu/src/gpu/FrameIO.h +++ b/libraries/gpu/src/gpu/FrameIO.h @@ -29,7 +29,7 @@ using Storage = storage::Storage; using StoragePointer = storage::Pointer; using StorageBuilders = storage::Builders; -constexpr char* const EXTENSION{ ".hfb" }; +constexpr const char* const EXTENSION{ ".hfb" }; constexpr uint32_t HEADER_SIZE{ sizeof(uint32_t) * 3 }; constexpr uint32_t CHUNK_HEADER_SIZE = sizeof(uint32_t) * 2; constexpr uint32_t MAGIC{ 0x49464948 }; diff --git a/libraries/gpu/src/gpu/FrameIOKeys.h b/libraries/gpu/src/gpu/FrameIOKeys.h index ba523386e0..1a98d0decd 100644 --- a/libraries/gpu/src/gpu/FrameIOKeys.h +++ b/libraries/gpu/src/gpu/FrameIOKeys.h @@ -12,129 +12,129 @@ namespace gpu { namespace keys { -constexpr char* const binary = "binary"; -constexpr char* const L00 = "L00"; -constexpr char* const L1m1 = "L1m1"; -constexpr char* const L10 = "L10"; -constexpr char* const L11 = "L11"; -constexpr char* const L2m2 = "L2m2"; -constexpr char* const L2m1 = "L2m1"; -constexpr char* const L20 = "L20"; -constexpr char* const L21 = "L21"; -constexpr char* const L22 = "L22"; +constexpr const char* binary = "binary"; +constexpr const char* L00 = "L00"; +constexpr const char* L1m1 = "L1m1"; +constexpr const char* L10 = "L10"; +constexpr const char* L11 = "L11"; +constexpr const char* L2m2 = "L2m2"; +constexpr const char* L2m1 = "L2m1"; +constexpr const char* L20 = "L20"; +constexpr const char* L21 = "L21"; +constexpr const char* L22 = "L22"; -constexpr char* const eyeProjections = "eyeProjections"; -constexpr char* const eyeViews = "eyeViews"; -constexpr char* const alphaToCoverageEnable = "alphaToCoverageEnable"; -constexpr char* const antialisedLineEnable = "antialisedLineEnable"; -constexpr char* const attributes = "attributes"; -constexpr char* const batches = "batches"; -constexpr char* const blendFunction = "blendFunction"; -constexpr char* const borderColor = "borderColor"; -constexpr char* const bufferMask = "bufferMask"; -constexpr char* const buffers = "buffers"; -constexpr char* const capturedTextures = "capturedTextures"; -constexpr char* const channel = "channel"; -constexpr char* const chunk = "chunk"; -constexpr char* const colorAttachments = "colorAttachments"; -constexpr char* const colorWriteMask = "colorWriteMask"; -constexpr char* const commands = "commands"; -constexpr char* const comparisonFunction = "comparisonFunction"; -constexpr char* const cullMode = "cullMode"; -constexpr char* const data = "data"; -constexpr char* const depth = "depth"; -constexpr char* const depthBias = "depthBias"; -constexpr char* const depthBiasSlopeScale = "depthBiasSlopeScale"; -constexpr char* const depthClampEnable = "depthClampEnable"; -constexpr char* const depthStencilAttachment = "depthStencilAttachment"; -constexpr char* const depthTest = "depthTest"; -constexpr char* const drawCallInfos = "drawCallInfos"; -constexpr char* const drawcallUniform = "drawcallUniform"; -constexpr char* const drawcallUniformReset = "drawcallUniformReset"; -constexpr char* const element = "element"; -constexpr char* const fillMode = "fillMode"; -constexpr char* const filter = "filter"; -constexpr char* const formats = "formats"; -constexpr char* const frameIndex = "frameIndex"; -constexpr char* const framebuffer = "framebuffer"; -constexpr char* const framebuffers = "framebuffers"; -constexpr char* const frequency = "frequency"; -constexpr char* const frontFaceClockwise = "frontFaceClockwise"; -constexpr char* const height = "height"; -constexpr char* const id = "id"; -constexpr char* const ktxFile = "ktxFile"; -constexpr char* const layers = "layers"; -constexpr char* const maxAnisotropy = "maxAnisotropy"; -constexpr char* const maxMip = "maxMip"; -constexpr char* const minMip = "minMip"; -constexpr char* const mipOffset = "mipOffset"; -constexpr char* const mips = "mips"; -constexpr char* const multisampleEnable = "multisampleEnable"; -constexpr char* const name = "name"; -constexpr char* const namedData = "namedData"; -constexpr char* const names = "names"; -constexpr char* const objects = "objects"; -constexpr char* const offset = "offset"; -constexpr char* const pipelines = "pipelines"; -constexpr char* const pose = "pose"; -constexpr char* const profileRanges = "profileRanges"; -constexpr char* const program = "program"; -constexpr char* const programs = "programs"; -constexpr char* const projectionJitter = "projectionJitter"; -constexpr char* const queries = "queries"; -constexpr char* const sampleCount = "sampleCount"; -constexpr char* const sampleMask = "sampleMask"; -constexpr char* const sampler = "sampler"; -constexpr char* const samples = "samples"; -constexpr char* const scissorEnable = "scissorEnable"; -constexpr char* const shaders = "shaders"; -constexpr char* const size = "size"; -constexpr char* const skybox = "skybox"; -constexpr char* const slot = "slot"; -constexpr char* const source = "source"; -constexpr char* const state = "state"; -constexpr char* const stencilActivation = "stencilActivation"; -constexpr char* const stencilTestBack = "stencilTestBack"; -constexpr char* const stencilTestFront = "stencilTestFront"; -constexpr char* const stereo = "stereo"; -constexpr char* const subresource = "subresource"; -constexpr char* const swapchains = "swapchains"; -constexpr char* const texelFormat = "texelFormat"; -constexpr char* const texture = "texture"; -constexpr char* const textureTables = "textureTables"; -constexpr char* const textures = "textures"; -constexpr char* const transforms = "transforms"; -constexpr char* const type = "type"; -constexpr char* const usageType = "usageType"; -constexpr char* const view = "view"; -constexpr char* const width = "width"; -constexpr char* const wrapModeU = "wrapModeU"; -constexpr char* const wrapModeV = "wrapModeV"; -constexpr char* const wrapModeW = "wrapModeW"; +constexpr const char* eyeProjections = "eyeProjections"; +constexpr const char* eyeViews = "eyeViews"; +constexpr const char* alphaToCoverageEnable = "alphaToCoverageEnable"; +constexpr const char* antialisedLineEnable = "antialisedLineEnable"; +constexpr const char* attributes = "attributes"; +constexpr const char* batches = "batches"; +constexpr const char* blendFunction = "blendFunction"; +constexpr const char* borderColor = "borderColor"; +constexpr const char* bufferMask = "bufferMask"; +constexpr const char* buffers = "buffers"; +constexpr const char* capturedTextures = "capturedTextures"; +constexpr const char* channel = "channel"; +constexpr const char* chunk = "chunk"; +constexpr const char* colorAttachments = "colorAttachments"; +constexpr const char* colorWriteMask = "colorWriteMask"; +constexpr const char* commands = "commands"; +constexpr const char* comparisonFunction = "comparisonFunction"; +constexpr const char* cullMode = "cullMode"; +constexpr const char* data = "data"; +constexpr const char* depth = "depth"; +constexpr const char* depthBias = "depthBias"; +constexpr const char* depthBiasSlopeScale = "depthBiasSlopeScale"; +constexpr const char* depthClampEnable = "depthClampEnable"; +constexpr const char* depthStencilAttachment = "depthStencilAttachment"; +constexpr const char* depthTest = "depthTest"; +constexpr const char* drawCallInfos = "drawCallInfos"; +constexpr const char* drawcallUniform = "drawcallUniform"; +constexpr const char* drawcallUniformReset = "drawcallUniformReset"; +constexpr const char* element = "element"; +constexpr const char* fillMode = "fillMode"; +constexpr const char* filter = "filter"; +constexpr const char* formats = "formats"; +constexpr const char* frameIndex = "frameIndex"; +constexpr const char* framebuffer = "framebuffer"; +constexpr const char* framebuffers = "framebuffers"; +constexpr const char* frequency = "frequency"; +constexpr const char* frontFaceClockwise = "frontFaceClockwise"; +constexpr const char* height = "height"; +constexpr const char* id = "id"; +constexpr const char* ktxFile = "ktxFile"; +constexpr const char* layers = "layers"; +constexpr const char* maxAnisotropy = "maxAnisotropy"; +constexpr const char* maxMip = "maxMip"; +constexpr const char* minMip = "minMip"; +constexpr const char* mipOffset = "mipOffset"; +constexpr const char* mips = "mips"; +constexpr const char* multisampleEnable = "multisampleEnable"; +constexpr const char* name = "name"; +constexpr const char* namedData = "namedData"; +constexpr const char* names = "names"; +constexpr const char* objects = "objects"; +constexpr const char* offset = "offset"; +constexpr const char* pipelines = "pipelines"; +constexpr const char* pose = "pose"; +constexpr const char* profileRanges = "profileRanges"; +constexpr const char* program = "program"; +constexpr const char* programs = "programs"; +constexpr const char* projectionJitter = "projectionJitter"; +constexpr const char* queries = "queries"; +constexpr const char* sampleCount = "sampleCount"; +constexpr const char* sampleMask = "sampleMask"; +constexpr const char* sampler = "sampler"; +constexpr const char* samples = "samples"; +constexpr const char* scissorEnable = "scissorEnable"; +constexpr const char* shaders = "shaders"; +constexpr const char* size = "size"; +constexpr const char* skybox = "skybox"; +constexpr const char* slot = "slot"; +constexpr const char* source = "source"; +constexpr const char* state = "state"; +constexpr const char* stencilActivation = "stencilActivation"; +constexpr const char* stencilTestBack = "stencilTestBack"; +constexpr const char* stencilTestFront = "stencilTestFront"; +constexpr const char* stereo = "stereo"; +constexpr const char* subresource = "subresource"; +constexpr const char* swapchains = "swapchains"; +constexpr const char* texelFormat = "texelFormat"; +constexpr const char* texture = "texture"; +constexpr const char* textureTables = "textureTables"; +constexpr const char* textures = "textures"; +constexpr const char* transforms = "transforms"; +constexpr const char* type = "type"; +constexpr const char* usageType = "usageType"; +constexpr const char* view = "view"; +constexpr const char* width = "width"; +constexpr const char* wrapModeU = "wrapModeU"; +constexpr const char* wrapModeV = "wrapModeV"; +constexpr const char* wrapModeW = "wrapModeW"; -constexpr char* const backWriteMask = "backWriteMask"; -constexpr char* const frontWriteMask = "frontWriteMask"; -constexpr char* const reference = "reference"; -constexpr char* const readMask = "readMask"; -constexpr char* const failOp = "failOp"; -constexpr char* const depthFailOp = "depthFailOp"; -constexpr char* const passOp = "passOp"; -constexpr char* const enabled = "enabled"; -constexpr char* const blend = "blend"; -constexpr char* const flags = "flags"; -constexpr char* const writeMask = "writeMask"; -constexpr char* const function = "function"; -constexpr char* const sourceColor = "sourceColor"; -constexpr char* const sourceAlpha = "sourceAlpha"; -constexpr char* const destColor = "destColor"; -constexpr char* const destAlpha = "destAlpha"; -constexpr char* const opColor = "opColor"; -constexpr char* const opAlpha = "opAlpha"; -constexpr char* const enable = "enable"; -constexpr char* const contextDisable = "contextDisable"; +constexpr const char* backWriteMask = "backWriteMask"; +constexpr const char* frontWriteMask = "frontWriteMask"; +constexpr const char* reference = "reference"; +constexpr const char* readMask = "readMask"; +constexpr const char* failOp = "failOp"; +constexpr const char* depthFailOp = "depthFailOp"; +constexpr const char* passOp = "passOp"; +constexpr const char* enabled = "enabled"; +constexpr const char* blend = "blend"; +constexpr const char* flags = "flags"; +constexpr const char* writeMask = "writeMask"; +constexpr const char* function = "function"; +constexpr const char* sourceColor = "sourceColor"; +constexpr const char* sourceAlpha = "sourceAlpha"; +constexpr const char* destColor = "destColor"; +constexpr const char* destAlpha = "destAlpha"; +constexpr const char* opColor = "opColor"; +constexpr const char* opAlpha = "opAlpha"; +constexpr const char* enable = "enable"; +constexpr const char* contextDisable = "contextDisable"; -constexpr char* const COMMAND_NAMES[] = { +constexpr const char* COMMAND_NAMES[] = { "draw", "drawIndexed", "drawInstanced", From b2bcf54b5b0cbcc9f025cfb224df4e9324299b20 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 4 Oct 2019 19:52:55 -0700 Subject: [PATCH 29/41] Removing frame converter --- tools/CMakeLists.txt | 1 - tools/gpu-frame-converter/CMakeLists.txt | 9 -- tools/gpu-frame-converter/src/main.cpp | 104 ----------------------- 3 files changed, 114 deletions(-) delete mode 100644 tools/gpu-frame-converter/CMakeLists.txt delete mode 100644 tools/gpu-frame-converter/src/main.cpp diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 6f9145ff7d..4942ecbd63 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -23,7 +23,6 @@ if (BUILD_TOOLS) udt-test vhacd-util gpu-frame-player - gpu-frame-converter ice-client ktx-tool ac-client diff --git a/tools/gpu-frame-converter/CMakeLists.txt b/tools/gpu-frame-converter/CMakeLists.txt deleted file mode 100644 index 4c2a2f5546..0000000000 --- a/tools/gpu-frame-converter/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ - -if (WIN32) - set(TARGET_NAME gpu-frame-converter) - setup_memory_debugger() - setup_hifi_project() - set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 17) - link_hifi_libraries( shared gpu shaders ) - package_libraries_for_deployment() -endif() \ No newline at end of file diff --git a/tools/gpu-frame-converter/src/main.cpp b/tools/gpu-frame-converter/src/main.cpp deleted file mode 100644 index 15aeafffb5..0000000000 --- a/tools/gpu-frame-converter/src/main.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// -// Created by Bradley Austin Davis on 2019/10/03 -// Copyright 2013-2019 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace fs = std::filesystem; -using Json = nlohmann::json; -using Paths = std::vector; - -const char* DEFAULT_SOURCE_PATH{ "D:/Frames" }; -static const std::string OLD_FRAME_EXTENSION{ ".json" }; -static const std::string OLD_BINARY_EXTENSION{ ".bin" }; -static const std::string NEW_EXTENSION{ gpu::hfb::EXTENSION }; - -inline std::string readFileToString(const fs::path& path) { - std::ifstream file(path); - return std::string((std::istreambuf_iterator(file)), std::istreambuf_iterator()); -} - -inline gpu::hfb::Buffer readFile(const fs::path& path) { - std::ifstream file(path, std::ios::binary | std::ios::ate); - size_t size = file.tellg(); - if (!size) { - return {}; - } - file.seekg(0, std::ios::beg); - - gpu::hfb::Buffer result; - result.resize(size); - if (!file.read((char*)result.data(), size)) { - throw std::runtime_error("Failed to read file"); - } - return result; -} - -Paths getFrames(const std::string& sourcePath) { - Paths result; - for (auto& p : fs::directory_iterator(sourcePath)) { - if (!p.is_regular_file()) { - continue; - } - const auto& path = p.path(); - if (path.string().find(".hfb.json") != std::string::npos) { - continue; - } - if (path.extension().string() == OLD_FRAME_EXTENSION) { - result.push_back(path); - } - } - return result; -} - -void convertFrame(const fs::path& path) { - auto name = path.filename().string(); - name = name.substr(0, name.length() - OLD_FRAME_EXTENSION.length()); - - auto frameNode = Json::parse(readFileToString(path)); - auto capturedTexturesNode = frameNode[gpu::keys::capturedTextures]; - - gpu::hfb::Buffer binary = readFile(path.parent_path() / (name + OLD_BINARY_EXTENSION)); - gpu::hfb::Buffers pngs; - for (const auto& capturedTextureIndexNode : capturedTexturesNode) { - int index = capturedTextureIndexNode; - auto imageFile = path.parent_path() / (name + "." + std::to_string(index) + ".0.png"); - frameNode[gpu::keys::textures][index][gpu::keys::chunk] = 2 + pngs.size(); - pngs.push_back(readFile(imageFile)); - } - frameNode.erase(gpu::keys::capturedTextures); - auto outputPath = path.parent_path() / (name + NEW_EXTENSION); - { - auto jsonOutputPath = path.parent_path() / (name + ".hfb.json"); - std::ofstream of(jsonOutputPath); - auto str = frameNode.dump(2); - of.write(str.data(), str.size()); - } - gpu::hfb::writeFrame(outputPath.string(), frameNode.dump(), binary, pngs); - { - auto frameBuffer = readFile(outputPath.string()); - auto descriptor = gpu::hfb::Descriptor::parse(frameBuffer.data(), frameBuffer.size()); - std::cout << descriptor.header.magic << std::endl; - } -} - -int main(int argc, char** argv) { - for (const auto& framePath : getFrames(DEFAULT_SOURCE_PATH)) { - std::cout << framePath << std::endl; - convertFrame(framePath); - } - return 0; -} From ffb73d5dbf432913dffe3ae152feed17963c9f66 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Oct 2019 11:22:19 +1300 Subject: [PATCH 30/41] Steam JSDoc --- .../plugins/src/plugins/SteamClientPlugin.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libraries/plugins/src/plugins/SteamClientPlugin.h b/libraries/plugins/src/plugins/SteamClientPlugin.h index 2124d16b5e..07e320f8eb 100644 --- a/libraries/plugins/src/plugins/SteamClientPlugin.h +++ b/libraries/plugins/src/plugins/SteamClientPlugin.h @@ -41,13 +41,16 @@ public: }; /**jsdoc + * The Steam API provides facilities for working with the Steam version of Interface. + * * @namespace Steam * * @hifi-interface * @hifi-client-entity * @hifi-avatar * - * @property {boolean} running - Read-only. + * @property {boolean} running - true if Interface is running under Steam, false if it isn't. + * Read-only. */ class SteamScriptingInterface : public QObject { @@ -61,13 +64,22 @@ public: public slots: /**jsdoc + * Gets whether Interface is running under Steam. * @function Steam.isRunning - * @returns {boolean} + * @returns {boolean} true if Interface is running under Steam, false if it isn't. */ bool isRunning() const { return _plugin && _plugin->isRunning(); } /**jsdoc + * Opens Steam's "Choose Friends to invite" dialog if Interface is running under Steam. * @function Steam.openInviteOverlay + * @example Invite Steam friends to join you in High Fidelity. + * if (Steam.running) { + * print("Invite Steam friends to joint you..."); + * Steam.openInviteOverlay(); + * } else { + * print("Interface isn't running under Steam."); + * } */ void openInviteOverlay() const { if (_plugin) { _plugin->openInviteOverlay(); } } From 570abba3ce67d17b6694efd759615bf07df06e52 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Oct 2019 13:04:52 +1300 Subject: [PATCH 31/41] SpeechRecognizer JSDoc --- interface/src/SpeechRecognizer.h | 64 +++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/interface/src/SpeechRecognizer.h b/interface/src/SpeechRecognizer.h index 7e2acdb8ac..ae35f63a35 100644 --- a/interface/src/SpeechRecognizer.h +++ b/interface/src/SpeechRecognizer.h @@ -23,6 +23,10 @@ #include /**jsdoc + * The SpeechRecognizer API provides facilities to recognize voice commands. + *

    Speech recognition is enabled or disabled via the Developer > Scripting > Enable Speech Control API menu item or + * the {@link SpeechRecognizer.setEnabled} method.

    + * * @namespace SpeechRecognizer * * @hifi-interface @@ -40,36 +44,86 @@ public: public slots: /**jsdoc + * Enables or disables speech recognition. * @function SpeechRecognizer.setEnabled - * @param {boolean} enabled + * @param {boolean} enabled - true to enable speech recognition, false to disable. */ void setEnabled(bool enabled); /**jsdoc + * Adds a voice command to the speech recognizer. * @function SpeechRecognizer.addCommand - * @param {string} command + * @param {string} command - The voice command to recognize. */ void addCommand(const QString& command); /**jsdoc + * Removes a voice command from the speech recognizer. * @function SpeechRecognizer.removeCommand - * @param {string} command + * @param {string} command - The voice command to stop recognizing. */ void removeCommand(const QString& command); signals: /**jsdoc + * Triggered when a voice command has been recognized. * @function SpeechRecognizer.commandRecognized - * @param {string} command + * @param {string} command - The voice command recognized. * @returns {Signal} + * @example Turn your avatar upon voice command. + * var TURN_LEFT = "turn left"; + * var TURN_RIGHT = "turn right"; + * var TURN_RATE = 0.5; + * var TURN_DURATION = 1000; // ms + * var turnRate = 0; + * + * function getTurnRate() { + * return turnRate; + * } + * + * var MAPPING_NAME = "com.highfidelity.controllers.example.speechRecognizer"; + * var mapping = Controller.newMapping(MAPPING_NAME); + * + * mapping.from(getTurnRate).to(Controller.Actions.Yaw); + * Controller.enableMapping(MAPPING_NAME); + * + * function onCommandRecognized(command) { + * print("Speech command: " + command); + * switch (command) { + * case TURN_LEFT: + * turnRate = -TURN_RATE; + * break; + * case TURN_RIGHT: + * turnRate = TURN_RATE; + * break; + * } + * Script.setTimeout(function () { + * turnRate = 0; + * }, TURN_DURATION); + * } + * + * SpeechRecognizer.addCommand(TURN_LEFT); + * SpeechRecognizer.addCommand(TURN_RIGHT); + * SpeechRecognizer.commandRecognized.connect(onCommandRecognized); + * + * Script.scriptEnding.connect(function () { + * Controller.disableMapping(MAPPING_NAME); + * SpeechRecognizer.removeCommand(TURN_LEFT); + * SpeechRecognizer.removeCommand(TURN_RIGHT); + * }); */ void commandRecognized(const QString& command); /**jsdoc + * Triggered when speech recognition is enabled or disabled. * @function SpeechRecognizer.enabledUpdated - * @param {boolean} enabled + * @param {boolean} enabled - true if speech recognition is enabled, false if it is disabled. * @returns {Signal} + * @example Report when speech recognition is enabled or disabled. + * SpeechRecognizer.enabledUpdated.connect(function (enabled) { + * print("Speech recognition: " + (enabled ? "enabled" : "disabled")); + * }); */ void enabledUpdated(bool enabled); From f73a7c088380796f761171a8bb670564c558dff4 Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Mon, 7 Oct 2019 17:35:14 -0700 Subject: [PATCH 32/41] Modified AC logging for paging requirements --- assignment-client/src/AssignmentClient.cpp | 24 +++++++++++++------- assignment-client/src/AssignmentFactory.cpp | 4 +++- libraries/networking/src/LimitedNodeList.cpp | 6 +++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index a1a2b7c1b5..ce724d7368 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -82,6 +82,9 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri } _assignmentServerSocket = HifiSockAddr(_assignmentServerHostname, assignmentServerPort, true); + if (_assignmentServerSocket.isNull()) { + qCCritical(assignment_client) << "PAGE: Couldn't resolve domain server address" << _assignmentServerHostname; + } _assignmentServerSocket.setObjectName("AssignmentServer"); nodeList->setAssignmentServerSocket(_assignmentServerSocket); @@ -183,16 +186,21 @@ void AssignmentClient::sendAssignmentRequest() { // we want to check again for the local domain-server port in case the DS has restarted quint16 localAssignmentServerPort; if (nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, localAssignmentServerPort)) { - if (localAssignmentServerPort != _assignmentServerSocket.getPort()) { - qCDebug(assignment_client) << "Port for local assignment server read from shared memory is" - << localAssignmentServerPort; + if (localAssignmentServerPort == 0) { + qCWarning(assignment_client) << "ALERT: Server port from shared memory is 0"; + } else { + if (localAssignmentServerPort != _assignmentServerSocket.getPort()) { + qCDebug(assignment_client) << "Port for local assignment server read from shared memory is" + << localAssignmentServerPort; - _assignmentServerSocket.setPort(localAssignmentServerPort); - nodeList->setAssignmentServerSocket(_assignmentServerSocket); + _assignmentServerSocket.setPort(localAssignmentServerPort); + nodeList->setAssignmentServerSocket(_assignmentServerSocket); + } } } else { - qCWarning(assignment_client) << "Failed to read local assignment server port from shared memory" - << "- will send assignment request to previous assignment server socket."; + qCWarning(assignment_client) << "ALERT: Failed to read local assignment server port from shared memory (" + << DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY + << ")- will send assignment request to previous assignment server socket."; } } @@ -250,7 +258,7 @@ void AssignmentClient::handleCreateAssignmentPacket(QSharedPointerstarted() workerThread->start(); } else { - qCWarning(assignment_client) << "Received an assignment that could not be unpacked. Re-requesting."; + qCWarning(assignment_client) << "ALERT: Received an assignment that could not be unpacked. Re-requesting."; } } diff --git a/assignment-client/src/AssignmentFactory.cpp b/assignment-client/src/AssignmentFactory.cpp index 405039d833..ef7da35030 100644 --- a/assignment-client/src/AssignmentFactory.cpp +++ b/assignment-client/src/AssignmentFactory.cpp @@ -24,7 +24,9 @@ ThreadedAssignment* AssignmentFactory::unpackAssignment(ReceivedMessage& message) { quint8 packedType; - message.peekPrimitive(&packedType); + if (message.readPrimitive(&packedType) != sizeof(packedType)) { + return nullptr; + } Assignment::Type unpackedType = (Assignment::Type) packedType; diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index ecf2218e2f..e1b373db89 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -1329,7 +1329,8 @@ void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* p qCDebug(networking) << "Wrote local listening port" << localPort << "to shared memory at key" << key; } else { - qWarning() << "ALERT: Failed to create and attach to shared memory to share local port with assignment-client children."; + qWarning() << "ALERT: Failed to create and attach to shared memory to share local port with assignment-client children:" + << sharedPortMem->errorString(); } } @@ -1337,7 +1338,8 @@ void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* p bool LimitedNodeList::getLocalServerPortFromSharedMemory(const QString key, quint16& localPort) { QSharedMemory sharedMem(key); if (!sharedMem.attach(QSharedMemory::ReadOnly)) { - qCWarning(networking) << "Could not attach to shared memory at key" << key; + qCWarning(networking) << "Could not attach to shared memory at key" << key + << ":" << sharedMem.errorString(); return false; } else { sharedMem.lock(); From 1106d8fdfa3ec9b8cfab6790273b2e37361a5df3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Oct 2019 21:15:16 +1300 Subject: [PATCH 33/41] Doc review --- interface/src/ui/overlays/Overlays.cpp | 2 +- libraries/animation/src/AnimInverseKinematics.h | 2 +- libraries/controllers/src/controllers/Actions.cpp | 12 ++++++------ libraries/midi/src/Midi.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 3289cb1594..5e43c5df8d 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -1934,7 +1934,7 @@ QVector Overlays::findOverlays(const glm::vec3& center, float radius) { * start point.

    * @property {Vec3} end - The end point of the line. Synonyms: endPoint and p2. *

    Note: If parentID is set, use localEnd to set the local position of the - * end point.

    + * end point.

    * @property {Vec3} localStart - The local position of the overlay relative to its parent if the overlay has a * parentID set, otherwise the same value as start. diff --git a/libraries/animation/src/AnimInverseKinematics.h b/libraries/animation/src/AnimInverseKinematics.h index 959a504e79..bcad7867cc 100644 --- a/libraries/animation/src/AnimInverseKinematics.h +++ b/libraries/animation/src/AnimInverseKinematics.h @@ -75,7 +75,7 @@ public: * close to the previous solution, but still provides the benefits of avoiding limb locking. * 2PreviousSolution *

    The IK system will begin to solve from the same position and orientations for each joint that was the result - * from the previous frame.

    + * from the previous frame.

    *

    Pros: As the end effectors typically do not move much from frame to frame, this is likely to converge quickly * to a valid solution.

    *

    Cons: If the previous solution resulted in an awkward or uncomfortable posture, the next frame will also be diff --git a/libraries/controllers/src/controllers/Actions.cpp b/libraries/controllers/src/controllers/Actions.cpp index 23f7509d9d..6be0a5a800 100644 --- a/libraries/controllers/src/controllers/Actions.cpp +++ b/libraries/controllers/src/controllers/Actions.cpp @@ -44,7 +44,7 @@ namespace controller { * PropertyTypeDataDescription * * - * Avatar Movement + * Avatar Movement * TranslateXnumbernumberMove the user's avatar in the direction of its * x-axis, if the camera isn't in independent or mirror modes. * TranslateYnumbernumberMove the user's avatar in the direction of its @@ -71,7 +71,7 @@ namespace controller { * step increment, if the camera isn't in independent or mirror modes. * StepRollnumbernumberNo action. * - * Avatar Skeleton + * Avatar Skeleton * Hipsnumber{@link Pose}Set the hips pose of the user's avatar. * * Spine2number{@link Pose}Set the spine2 pose of the user's avatar. @@ -171,7 +171,7 @@ namespace controller { * RightFootnumber{@link Pose}Set the right foot pose of the user's * avatar. * - * Application + * Application * BoomInnumbernumberZoom camera in from third person toward first * person view. * BoomOutnumbernumberZoom camera out from first person to third @@ -212,7 +212,7 @@ namespace controller { * SecondaryActionnumbernumberDeprecated: This * action is deprecated and will be removed. It takes no action. * - * Aliases + * Aliases * BackwardnumbernumberAlias for TranslateZ in the * positive direction. * ForwardnumbernumberAlias for TranslateZ in the negative @@ -234,7 +234,7 @@ namespace controller { * YawRightnumbernumberAlias for Yaw in the negative * direction. * - * Deprecated Aliases + * Deprecated Aliases * LEFT_HANDnumber{@link Pose}Deprecated: This * action is deprecated and will be removed. Use LeftHand instead. * RIGHT_HANDnumber{@link Pose}Deprecated: This @@ -282,7 +282,7 @@ namespace controller { * ACTION2numbernumberDeprecated: This * action is deprecated and will be removed. Use SecondaryAction instead. * - * Deprecated Trackers + * Deprecated Trackers * TrackedObject00number{@link Pose}Deprecated: * This action is deprecated and will be removed. It takes no action. * TrackedObject01number{@link Pose}Deprecated: diff --git a/libraries/midi/src/Midi.h b/libraries/midi/src/Midi.h index d103d05218..5b7c82d6da 100644 --- a/libraries/midi/src/Midi.h +++ b/libraries/midi/src/Midi.h @@ -23,7 +23,7 @@ /**jsdoc * The Midi API provides the ability to connect Interface with musical instruments and other external or virtual * devices via the MIDI protocol. For further information and examples, see the tutorial: - * Use MIDI to Control Your Environment. + * Use MIDI to Control Your Environment. * *

    Note: Only works on Windows.

    * From 5576132df7a8f28df113022b8e6e0de601f47ed5 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Tue, 8 Oct 2019 10:13:58 -0700 Subject: [PATCH 34/41] Fix strafe while flying, and ramp up diagonal movement --- interface/src/avatar/MyAvatar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index de6ae526b4..7c8f675b3e 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -3560,7 +3560,7 @@ void MyAvatar::updateOrientation(float deltaTime) { if (faceForward || _shouldTurnToFaceCamera) { const float REORIENT_FORWARD_BLEND = 0.25f; const float REORIENT_TURN_BLEND = 0.03f; - const float DIAGONAL_TURN_BLEND = 0.02f; + const float DIAGONAL_TURN_BLEND = 0.1f; float blend = (_shouldTurnToFaceCamera ? REORIENT_TURN_BLEND : REORIENT_FORWARD_BLEND) * timeScale; if (blend > 1.0f) { blend = 1.0f; @@ -3772,7 +3772,8 @@ glm::vec3 MyAvatar::scaleMotorSpeed(const glm::vec3 forward, const glm::vec3 rig // Desktop mode. direction = (zSpeed * forward) + (xSpeed * right); CameraMode mode = qApp->getCamera().getMode(); - if ((mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_FIRST_PERSON || mode == CAMERA_MODE_SELFIE) && zSpeed != 0.0f && xSpeed != 0.0f){ + if ((mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_FIRST_PERSON || mode == CAMERA_MODE_SELFIE) && + zSpeed != 0.0f && xSpeed != 0.0f && !isFlying()){ direction = (zSpeed * forward); } From f63360a87a361448b75680155a4662da42168b77 Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Tue, 8 Oct 2019 11:01:42 -0700 Subject: [PATCH 35/41] Change read back to peek - guess it was that way for a reason --- assignment-client/src/AssignmentFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment-client/src/AssignmentFactory.cpp b/assignment-client/src/AssignmentFactory.cpp index ef7da35030..ceab285763 100644 --- a/assignment-client/src/AssignmentFactory.cpp +++ b/assignment-client/src/AssignmentFactory.cpp @@ -24,7 +24,7 @@ ThreadedAssignment* AssignmentFactory::unpackAssignment(ReceivedMessage& message) { quint8 packedType; - if (message.readPrimitive(&packedType) != sizeof(packedType)) { + if (message.peekPrimitive(&packedType) != sizeof(packedType)) { return nullptr; } From 960440e802f0f07165e93dd5c3bf28a23ca60093 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 8 Oct 2019 14:28:01 -0400 Subject: [PATCH 36/41] DEV-2352: Modify Release Notes URL --- interface/src/Menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 89fec3c812..b66bc9c1c4 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -829,7 +829,7 @@ Menu::Menu() { // Help > Release Notes action = addActionToQMenuAndActionHash(helpMenu, "Release Notes"); connect(action, &QAction::triggered, qApp, [] { - QDesktopServices::openUrl(QUrl("http://steamcommunity.com/games/390540/announcements/")); + QDesktopServices::openUrl(QUrl("https://docs.highfidelity.com/release-notes.html")); }); // Help > Report a Bug! From 9feab869ad56b892426110c48d966d84f1a16d7f Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 8 Oct 2019 14:48:19 -0400 Subject: [PATCH 37/41] DEV-2350: Prevent duplicate default scripts from running --- scripts/defaultScripts.js | 53 ++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 6f0dd40493..7f78d2477f 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -71,23 +71,63 @@ if (Menu.menuExists(MENU_CATEGORY) && !Menu.menuItemExists(MENU_CATEGORY, MENU_I } function loadSeparateDefaults() { + var currentlyRunningScripts = ScriptDiscoveryService.getRunning(); + for (var i in DEFAULT_SCRIPTS_SEPARATE) { - Script.load(DEFAULT_SCRIPTS_SEPARATE[i]); + var shouldLoadCurrentDefaultScript = true; + + for (var j = 0; j < currentlyRunningScripts.length; j++) { + var currentRunningScriptObject = currentlyRunningScripts[j]; + var currentDefaultScriptName = DEFAULT_SCRIPTS_SEPARATE[i].substr((DEFAULT_SCRIPTS_SEPARATE[i].lastIndexOf("/") + 1), DEFAULT_SCRIPTS_SEPARATE[i].length); + if (currentDefaultScriptName === currentRunningScriptObject.name) { + shouldLoadCurrentDefaultScript = false; + } + } + + if (shouldLoadCurrentDefaultScript) { + Script.load(DEFAULT_SCRIPTS_SEPARATE[i]); + } } } function runDefaultsTogether() { - for (var i in DEFAULT_SCRIPTS_COMBINED) { - Script.include(DEFAULT_SCRIPTS_COMBINED[i]); + var currentlyRunningScripts = ScriptDiscoveryService.getRunning(); + + for (var i = 0; i < DEFAULT_SCRIPTS_COMBINED.length; i++) { + var shouldIncludeCurrentDefaultScript = true; + + for (var j = 0; j < currentlyRunningScripts.length; j++) { + var currentRunningScriptObject = currentlyRunningScripts[j]; + var currentDefaultScriptName = DEFAULT_SCRIPTS_COMBINED[i].substr((DEFAULT_SCRIPTS_COMBINED[i].lastIndexOf("/") + 1), DEFAULT_SCRIPTS_COMBINED[i].length); + if (currentDefaultScriptName === currentRunningScriptObject.name) { + shouldIncludeCurrentDefaultScript = false; + } + } + + if (shouldIncludeCurrentDefaultScript) { + Script.include(DEFAULT_SCRIPTS_COMBINED[i]); + } } - loadSeparateDefaults(); } function runDefaultsSeparately() { + var currentlyRunningScripts = ScriptDiscoveryService.getRunning(); + for (var i in DEFAULT_SCRIPTS_COMBINED) { - Script.load(DEFAULT_SCRIPTS_COMBINED[i]); + var shouldLoadCurrentDefaultScript = true; + + for (var j = 0; j < currentlyRunningScripts.length; j++) { + var currentRunningScriptObject = currentlyRunningScripts[j]; + var currentDefaultScriptName = DEFAULT_SCRIPTS_COMBINED[i].substr((DEFAULT_SCRIPTS_COMBINED[i].lastIndexOf("/") + 1), DEFAULT_SCRIPTS_COMBINED[i].length); + if (currentDefaultScriptName === currentRunningScriptObject.name) { + shouldLoadCurrentDefaultScript = false; + } + } + + if (shouldLoadCurrentDefaultScript) { + Script.load(DEFAULT_SCRIPTS_COMBINED[i]); + } } - loadSeparateDefaults(); } // start all scripts @@ -99,6 +139,7 @@ if (Menu.isOptionChecked(MENU_ITEM)) { // include all default scripts into this ScriptEngine runDefaultsTogether(); } +loadSeparateDefaults(); function menuItemEvent(menuItem) { if (menuItem === MENU_ITEM) { From 092424569d04c72f0092b8398e67ac1801934cf3 Mon Sep 17 00:00:00 2001 From: RebeccaStankus Date: Tue, 8 Oct 2019 11:55:14 -0700 Subject: [PATCH 38/41] Added flag to ensure mouse event signals are not connected twice --- .../src/EntityTreeRenderer.cpp | 82 ++++++++++--------- .../controllers/controllerDispatcher.js | 4 + 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 52738bb6cd..94a5ca76f7 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -157,6 +157,7 @@ render::ItemID EntityTreeRenderer::renderableIdForEntityId(const EntityItemID& i } int EntityTreeRenderer::_entitiesScriptEngineCount = 0; +bool _signalsConnected = false; void EntityTreeRenderer::resetEntitiesScriptEngine() { _entitiesScriptEngine = scriptEngineFactory(ScriptEngine::ENTITY_CLIENT_SCRIPT, NO_SCRIPT, @@ -168,47 +169,52 @@ void EntityTreeRenderer::resetEntitiesScriptEngine() { entityScriptingInterface->setEntitiesScriptEngine(entitiesScriptEngineProvider); // Connect mouse events to entity script callbacks - connect(entityScriptingInterface.data(), &EntityScriptingInterface::mousePressOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "mousePressOnEntity", event); - }); - connect(entityScriptingInterface.data(), &EntityScriptingInterface::mouseDoublePressOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "mouseDoublePressOnEntity", event); - }); - connect(entityScriptingInterface.data(), &EntityScriptingInterface::mouseMoveOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "mouseMoveOnEntity", event); - // FIXME: this is a duplicate of mouseMoveOnEntity, but it seems like some scripts might use this naming - _entitiesScriptEngine->callEntityScriptMethod(entityID, "mouseMoveEvent", event); - }); - connect(entityScriptingInterface.data(), &EntityScriptingInterface::mouseReleaseOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "mouseReleaseOnEntity", event); - }); + if (!_signalsConnected) { + + connect(entityScriptingInterface.data(), &EntityScriptingInterface::mousePressOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "mousePressOnEntity", event); + }); + connect(entityScriptingInterface.data(), &EntityScriptingInterface::mouseDoublePressOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "mouseDoublePressOnEntity", event); + }); + connect(entityScriptingInterface.data(), &EntityScriptingInterface::mouseMoveOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "mouseMoveOnEntity", event); + // FIXME: this is a duplicate of mouseMoveOnEntity, but it seems like some scripts might use this naming + _entitiesScriptEngine->callEntityScriptMethod(entityID, "mouseMoveEvent", event); + }); + connect(entityScriptingInterface.data(), &EntityScriptingInterface::mouseReleaseOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "mouseReleaseOnEntity", event); + }); - connect(entityScriptingInterface.data(), &EntityScriptingInterface::clickDownOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "clickDownOnEntity", event); - }); - connect(entityScriptingInterface.data(), &EntityScriptingInterface::holdingClickOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "holdingClickOnEntity", event); - }); - connect(entityScriptingInterface.data(), &EntityScriptingInterface::clickReleaseOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "clickReleaseOnEntity", event); - }); + connect(entityScriptingInterface.data(), &EntityScriptingInterface::clickDownOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "clickDownOnEntity", event); + }); + connect(entityScriptingInterface.data(), &EntityScriptingInterface::holdingClickOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "holdingClickOnEntity", event); + }); + connect(entityScriptingInterface.data(), &EntityScriptingInterface::clickReleaseOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "clickReleaseOnEntity", event); + }); - connect(entityScriptingInterface.data(), &EntityScriptingInterface::hoverEnterEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "hoverEnterEntity", event); - }); - connect(entityScriptingInterface.data(), &EntityScriptingInterface::hoverOverEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "hoverOverEntity", event); - }); - connect(entityScriptingInterface.data(), &EntityScriptingInterface::hoverLeaveEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { - _entitiesScriptEngine->callEntityScriptMethod(entityID, "hoverLeaveEntity", event); - }); + connect(entityScriptingInterface.data(), &EntityScriptingInterface::hoverEnterEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "hoverEnterEntity", event); + }); + connect(entityScriptingInterface.data(), &EntityScriptingInterface::hoverOverEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "hoverOverEntity", event); + }); + connect(entityScriptingInterface.data(), &EntityScriptingInterface::hoverLeaveEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { + _entitiesScriptEngine->callEntityScriptMethod(entityID, "hoverLeaveEntity", event); + }); - connect(_entitiesScriptEngine.data(), &ScriptEngine::entityScriptPreloadFinished, [&](const EntityItemID& entityID) { - EntityItemPointer entity = getTree()->findEntityByID(entityID); - if (entity) { - entity->setScriptHasFinishedPreload(true); - } - }); + connect(_entitiesScriptEngine.data(), &ScriptEngine::entityScriptPreloadFinished, [&](const EntityItemID& entityID) { + EntityItemPointer entity = getTree()->findEntityByID(entityID); + if (entity) { + entity->setScriptHasFinishedPreload(true); + } + }); + + _signalsConnected = true; + } } void EntityTreeRenderer::stopDomainAndNonOwnedEntities() { diff --git a/scripts/system/controllers/controllerDispatcher.js b/scripts/system/controllers/controllerDispatcher.js index cf365a4119..f0d3ec0c03 100644 --- a/scripts/system/controllers/controllerDispatcher.js +++ b/scripts/system/controllers/controllerDispatcher.js @@ -595,6 +595,10 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Controller.disableMapping(MAPPING_NAME); _this.pointerManager.removePointers(); Pointers.removePointer(this.mouseRayPointer); + Overlays.mouseReleaseOnOverlay.disconnect(mouseReleaseOnOverlay); + Overlays.mousePressOnOverlay.disconnect(mousePress); + Entities.mousePressOnEntity.disconnect(mousePress); + Messages.messageReceived.disconnect(controllerDispatcher.handleMessage); }; } From 37aee77c323a0013cf28fbb8126725b5ea558fe5 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 8 Oct 2019 12:26:29 -0700 Subject: [PATCH 39/41] Fix oculus calibration screen crash if touch not on --- plugins/oculus/src/OculusControllerManager.cpp | 6 +++--- plugins/oculus/src/OculusControllerManager.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/oculus/src/OculusControllerManager.cpp b/plugins/oculus/src/OculusControllerManager.cpp index 14830f3f04..c1431fa4b2 100644 --- a/plugins/oculus/src/OculusControllerManager.cpp +++ b/plugins/oculus/src/OculusControllerManager.cpp @@ -50,13 +50,13 @@ QString OculusControllerManager::configurationLayout() { void OculusControllerManager::setConfigurationSettings(const QJsonObject configurationSettings) { if (configurationSettings.contains("trackControllersInOculusHome")) { - _touch->_trackControllersInOculusHome.set(configurationSettings["trackControllersInOculusHome"].toBool()); + _trackControllersInOculusHome.set(configurationSettings["trackControllersInOculusHome"].toBool()); } } QJsonObject OculusControllerManager::configurationSettings() { QJsonObject configurationSettings; - configurationSettings["trackControllersInOculusHome"] = _touch->_trackControllersInOculusHome.get(); + configurationSettings["trackControllersInOculusHome"] = _trackControllersInOculusHome.get(); return configurationSettings; } @@ -232,7 +232,7 @@ void OculusControllerManager::TouchDevice::update(float deltaTime, quint64 currentTime = usecTimestampNow(); static const auto REQUIRED_HAND_STATUS = ovrStatus_OrientationTracked | ovrStatus_PositionTracked; bool hasInputFocus = ovr::hasInputFocus(); - bool trackControllersInOculusHome = _trackControllersInOculusHome.get(); + bool trackControllersInOculusHome = _parent._trackControllersInOculusHome.get(); auto tracking = ovr::getTrackingState(); // ovr_GetTrackingState(_parent._session, 0, false); ovr::for_each_hand([&](ovrHandType hand) { ++numTrackedControllers; diff --git a/plugins/oculus/src/OculusControllerManager.h b/plugins/oculus/src/OculusControllerManager.h index ea32eace61..7d1d176a56 100644 --- a/plugins/oculus/src/OculusControllerManager.h +++ b/plugins/oculus/src/OculusControllerManager.h @@ -98,7 +98,6 @@ private: float _leftHapticStrength { 0.0f }; float _rightHapticDuration { 0.0f }; float _rightHapticStrength { 0.0f }; - Setting::Handle _trackControllersInOculusHome { "trackControllersInOculusHome", false }; mutable std::recursive_mutex _lock; std::map _lostTracking; std::map _regainTrackingDeadline; @@ -109,6 +108,7 @@ private: void checkForConnectedDevices(); + Setting::Handle _trackControllersInOculusHome { "trackControllersInOculusHome", false }; ovrInputState _remoteInputState {}; ovrInputState _touchInputState {}; RemoteDevice::Pointer _remote; From 458d3bfb4864f8c7657173f51b78e8288fb02237 Mon Sep 17 00:00:00 2001 From: RebeccaStankus Date: Tue, 8 Oct 2019 13:15:27 -0700 Subject: [PATCH 40/41] Renamed variable and made it private --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 5 ++--- libraries/entities-renderer/src/EntityTreeRenderer.h | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 94a5ca76f7..ab3f4c5243 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -157,7 +157,6 @@ render::ItemID EntityTreeRenderer::renderableIdForEntityId(const EntityItemID& i } int EntityTreeRenderer::_entitiesScriptEngineCount = 0; -bool _signalsConnected = false; void EntityTreeRenderer::resetEntitiesScriptEngine() { _entitiesScriptEngine = scriptEngineFactory(ScriptEngine::ENTITY_CLIENT_SCRIPT, NO_SCRIPT, @@ -169,7 +168,7 @@ void EntityTreeRenderer::resetEntitiesScriptEngine() { entityScriptingInterface->setEntitiesScriptEngine(entitiesScriptEngineProvider); // Connect mouse events to entity script callbacks - if (!_signalsConnected) { + if (!_mouseAndPreloadSignalHandlersConnected) { connect(entityScriptingInterface.data(), &EntityScriptingInterface::mousePressOnEntity, _entitiesScriptEngine.data(), [&](const EntityItemID& entityID, const PointerEvent& event) { _entitiesScriptEngine->callEntityScriptMethod(entityID, "mousePressOnEntity", event); @@ -213,7 +212,7 @@ void EntityTreeRenderer::resetEntitiesScriptEngine() { } }); - _signalsConnected = true; + _mouseAndPreloadSignalHandlersConnected = true; } } diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.h b/libraries/entities-renderer/src/EntityTreeRenderer.h index b9fda690dd..6dbaedc123 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.h +++ b/libraries/entities-renderer/src/EntityTreeRenderer.h @@ -210,6 +210,8 @@ private: std::function _getPrevRayPickResultOperator; std::function _setPrecisionPickingOperator; + bool _mouseAndPreloadSignalHandlersConnected { false }; + class LayeredZone { public: LayeredZone(std::shared_ptr zone) : zone(zone), id(zone->getID()), volume(zone->getVolumeEstimate()) {} From 68e287628c2582ce49088e56a96fff7eb66a47a1 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Tue, 8 Oct 2019 14:39:27 -0700 Subject: [PATCH 41/41] Fix eye look at forward vector --- interface/src/avatar/MyAvatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index de6ae526b4..ea0efe29cb 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2175,7 +2175,7 @@ static float lookAtCostFunction(const glm::vec3& myForward, const glm::vec3& myP } void MyAvatar::computeMyLookAtTarget(const AvatarHash& hash) { - glm::vec3 myForward = getHead()->getFinalOrientationInWorldFrame() * IDENTITY_FORWARD; + glm::vec3 myForward = _lookAtYaw * IDENTITY_FORWARD; glm::vec3 myPosition = getHead()->getEyePosition(); CameraMode mode = qApp->getCamera().getMode(); if (mode == CAMERA_MODE_FIRST_PERSON) {