diff --git a/interface/src/LODManager.h b/interface/src/LODManager.h index 4708deb61b..16b0529b05 100644 --- a/interface/src/LODManager.h +++ b/interface/src/LODManager.h @@ -66,16 +66,62 @@ class AABox; /**jsdoc - * The LOD class manages your Level of Detail functions within Interface. + * The LODManager API manages the Level of Detail displayed in Interface. If the LOD is being automatically + * adjusted, the LOD is decreased if the measured frame rate is lower than the target FPS, and increased if the measured frame + * rate is greater than the target FPS. + * * @namespace LODManager * * @hifi-interface * @hifi-client-entity * @hifi-avatar * - * @property {number} presentTime Read-only. - * @property {number} engineRunTime Read-only. - * @property {number} gpuTime Read-only. + * @property {LODManager.WorldDetailQuality} worldDetailQuality - The quality of the rendered world detail. + *

Setting this value updates the current desktop or HMD target LOD FPS.

+ * @property {number} lodQualityLevel - Not used. + *

Deprecated: This property is deprecated and will be removed.

+ * @property {boolean} automaticLODAdjust - true to automatically adjust the LOD, false to manually + * adjust it. + * + * @property {number} engineRunTime - The time spent in the "render" thread to produce the most recent frame, in ms. + * Read-only. + * @property {number} batchTime - The time spent in the "present" thread processing the batches of the most recent frame, in ms. + * Read-only. + * @property {number} presentTime - The time spent in the "present" thread between the last buffer swap, i.e., the total time + * to submit the most recent frame, in ms. + * Read-only. + * @property {number} gpuTime - The time spent in the GPU executing the most recent frame, in ms. + * Read-only. + * + * @property {number} nowRenderTime - The current, instantaneous time spend to produce frames, in ms. This is the worst of + * engineRunTime, batchTime, presentTime, and gpuTime. + * Read-only. + * @property {number} nowRenderFPS - The current, instantaneous frame rate, in Hz. + * Read-only. + * + * @property {number} smoothScale - The amount of smoothing applied to calculate smoothRenderTime and + * smoothRenderFPS. + * @property {number} smoothRenderTime - The average time spend to produce frames, in ms. + * Read-only. + * @property {number} smoothRenderFPS - The average frame rate, in Hz. + * Read-only. + * + * @property {number} lodTargetFPS - The target LOD FPS per the current desktop or HMD display mode, capped by the target + * refresh rate set by the {@link Performance} API. + * Read-only. + + * @property {number} lodAngleDeg - The minimum angular dimension (relative to the camera position) of an entity in order for + * it to be rendered, in degrees. The angular dimension is calculated as a sphere of radius half the diagonal of the + * entity's AA box. + * + * @property {number} pidKp - Not used. + * @property {number} pidKi - Not used. + * @property {number} pidKd - Not used. + * @property {number} pidKv - Not used. + * @property {number} pidOp - Not used. Read-only. + * @property {number} pidOi - Not used. Read-only. + * @property {number} pidOd - Not used. Read-only. + * @property {number} pidO - Not used. Read-only. */ class LODManager : public QObject, public Dependency { Q_OBJECT @@ -117,83 +163,96 @@ class LODManager : public QObject, public Dependency { public: /**jsdoc + * Sets whether the LOD should be automatically adjusted. * @function LODManager.setAutomaticLODAdjust - * @param {boolean} value + * @param {boolean} value - true to automatically adjust the LOD, false to manually adjust it. */ Q_INVOKABLE void setAutomaticLODAdjust(bool value); /**jsdoc + * Gets whether the LOD is being automatically adjusted. * @function LODManager.getAutomaticLODAdjust - * @returns {boolean} + * @returns {boolean} true if the LOD is being automatically adjusted, false if it is being + * manually adjusted. */ Q_INVOKABLE bool getAutomaticLODAdjust() const { return _automaticLODAdjust; } /**jsdoc + * Sets the target desktop LOD FPS. * @function LODManager.setDesktopLODTargetFPS - * @param {number} value + * @param {number} value - The target desktop LOD FPS, in Hz. */ Q_INVOKABLE void setDesktopLODTargetFPS(float value); /**jsdoc + * Gets the target desktop LOD FPS. * @function LODManager.getDesktopLODTargetFPS - * @returns {number} + * @returns {number} The target desktop LOD FPS, in Hz. */ Q_INVOKABLE float getDesktopLODTargetFPS() const; /**jsdoc + * Sets the target HMD LOD FPS. * @function LODManager.setHMDLODTargetFPS - * @param {number} value + * @param {number} value - The target HMD LOD FPS, in Hz. */ Q_INVOKABLE void setHMDLODTargetFPS(float value); /**jsdoc + * Gets the target HMD LOD FPS. + * The target FPS in HMD mode. The LOD is adjusted to ... * @function LODManager.getHMDLODTargetFPS - * @returns {number} + * @returns {number} The target HMD LOD FPS, in Hz. */ Q_INVOKABLE float getHMDLODTargetFPS() const; // User Tweakable LOD Items + /**jsdoc + * Gets a text description of the current level of detail rendered. * @function LODManager.getLODFeedbackText - * @returns {string} + * @returns {string} A text description of the current level of detail rendered. + * @example Report the current level of detail rendered. + * print("You can currently see: " + LODManager.getLODFeedbackText()); */ Q_INVOKABLE QString getLODFeedbackText(); /**jsdoc * @function LODManager.setOctreeSizeScale - * @param {number} sizeScale - * @deprecated This function is deprecated and will be removed. Use the {@link LODManager.lodAngleDeg} property instead. + * @param {number} sizeScale - The octree size scale. + * @deprecated This function is deprecated and will be removed. Use the lodAngleDeg property instead. */ Q_INVOKABLE void setOctreeSizeScale(float sizeScale); /**jsdoc * @function LODManager.getOctreeSizeScale - * @returns {number} - * @deprecated This function is deprecated and will be removed. Use the {@link LODManager.lodAngleDeg} property instead. + * @returns {number} The octree size scale. + * @deprecated This function is deprecated and will be removed. Use the lodAngleDeg property instead. */ Q_INVOKABLE float getOctreeSizeScale() const; /**jsdoc * @function LODManager.setBoundaryLevelAdjust - * @param {number} boundaryLevelAdjust + * @param {number} boundaryLevelAdjust - The boundary level adjust factor. * @deprecated This function is deprecated and will be removed. */ Q_INVOKABLE void setBoundaryLevelAdjust(int boundaryLevelAdjust); /**jsdoc * @function LODManager.getBoundaryLevelAdjust - * @returns {number} + * @returns {number} The boundary level adjust factor. * @deprecated This function is deprecated and will be removed. */ Q_INVOKABLE int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; } /**jsdoc - * @function LODManager.getLODTargetFPS - * @returns {number} - */ + * The target LOD FPS per the current desktop or HMD display mode, capped by the target refresh rate. + * @function LODManager.getLODTargetFPS + * @returns {number} The target LOD FPS, in Hz. + */ Q_INVOKABLE float getLODTargetFPS() const; @@ -249,19 +308,41 @@ public: signals: /**jsdoc + * Not triggered. * @function LODManager.LODIncreased * @returns {Signal} + * @deprecated This signal is deprecated and will be removed. */ void LODIncreased(); /**jsdoc + * Not triggered. * @function LODManager.LODDecreased * @returns {Signal} + * @deprecated This signal is deprecated and will be removed. */ void LODDecreased(); + /**jsdoc + * Triggered when whether or not the LOD is being automatically adjusted changes. + * @function LODManager.autoLODChanged + * @returns {Signal} + */ void autoLODChanged(); + + /**jsdoc + * Triggered when the lodQualityLevel property value changes. + * @function LODManager.lodQualityLevelChanged + * @returns {Signal} + * @deprecated This signal is deprecated and will be removed. + */ void lodQualityLevelChanged(); + + /**jsdoc + * Triggered when the world detail quality changes. + * @function LODManager.worldDetailQualityChanged + * @returns {Signal} + */ void worldDetailQualityChanged(); private: diff --git a/interface/src/RefreshRateManager.cpp b/interface/src/RefreshRateManager.cpp index beb1363aac..bb4ec42e41 100644 --- a/interface/src/RefreshRateManager.cpp +++ b/interface/src/RefreshRateManager.cpp @@ -19,10 +19,9 @@ static const int VR_TARGET_RATE = 90; /**jsdoc *

Refresh rate profile.

- * * * - * + * * * * *
Refresh Rate ProfileDescription
ValueDescription
"Eco"Low refresh rate, which is reduced when Interface doesn't have focus or is @@ -32,18 +31,16 @@ static const int VR_TARGET_RATE = 90; *
"Realtime"High refresh rate, even when Interface doesn't have focus or is minimized. *
- * - * @typedef {string} RefreshRateProfile + * @typedef {string} RefreshRateProfileName */ static const std::array REFRESH_RATE_PROFILE_TO_STRING = { { "Eco", "Interactive", "Realtime" } }; /**jsdoc *

Interface states that affect the refresh rate.

- * * * - * + * * * * @@ -54,26 +51,23 @@ static const std::array * *
Refresh Rate RegimeDescription
ValueDescription
"FocusActive"Interface has focus and the user is active or is in VR.
"ShutDown"Interface is shutting down.
- * - * @typedef {string} RefreshRateRegime + * @typedef {string} RefreshRateRegimeName */ static const std::array REFRESH_RATE_REGIME_TO_STRING = { { "FocusActive", "FocusInactive", "Unfocus", "Minimized", "StartUp", "ShutDown" } }; /**jsdoc - *

Interface operates in different modes to provide different user experiences (UX).

- * + *

User experience (UX) modes.

* * - * + * * * - * - * + * + * * *
UX ModeDescription
ValueDescription
"Desktop"Desktop user experience mode.
"VR"VR user experience mode.
"Desktop"Desktop user experience.
"VR"VR user experience.
- * - * @typedef {string} UXMode + * @typedef {string} UXModeName */ static const std::array UX_MODE_TO_STRING = { { "Desktop", "VR" } }; diff --git a/interface/src/RefreshRateManager.h b/interface/src/RefreshRateManager.h index 567a515898..18fad392c9 100644 --- a/interface/src/RefreshRateManager.h +++ b/interface/src/RefreshRateManager.h @@ -31,6 +31,23 @@ public: }; static bool isValidRefreshRateProfile(RefreshRateProfile value) { return (value >= RefreshRateProfile::ECO && value <= RefreshRateProfile::REALTIME); } + /**jsdoc + *

Interface states that affect the refresh rate.

+ * + * + * + * + * + * + * + * + * + * + * + * + *
ValueNameDescription
0FOCUS_ACTIVEInterface has focus and the user is active or is in VR.
1FOCUS_INACTIVEInterface has focus and the user is inactive.
2UNFOCUSInterface doesn't have focus.
3MINIMIZEDInterface is minimized.
4STARTUPInterface is starting up.
5SHUTDOWNInterface is shutting down.
+ * @typedef {number} RefreshRateRegime + */ enum RefreshRateRegime { FOCUS_ACTIVE = 0, FOCUS_INACTIVE, @@ -42,6 +59,19 @@ public: }; static bool isValidRefreshRateRegime(RefreshRateRegime value) { return (value >= RefreshRateRegime::FOCUS_ACTIVE && value <= RefreshRateRegime::SHUTDOWN); } + /**jsdoc + *

User experience (UX) modes.

+ * + * + * + * + * + * + * + * + *
ValueNameDescription
0DESKTOPDesktop user experience.
1VRVR use experience.
+ * @typedef {number} UXMode + */ enum UXMode { DESKTOP = 0, VR, diff --git a/interface/src/scripting/PerformanceScriptingInterface.h b/interface/src/scripting/PerformanceScriptingInterface.h index 92d4273dfb..8a7e403e5d 100644 --- a/interface/src/scripting/PerformanceScriptingInterface.h +++ b/interface/src/scripting/PerformanceScriptingInterface.h @@ -18,6 +18,18 @@ #include "../RefreshRateManager.h" +/**jsdoc + * The Performance API provides control and information on graphics performance settings. + * + * @namespace Performance + * + * @hifi-interface + * @hifi-client-entity + * @hifi-avatar + * + * @property {Performance.PerformancePreset} performancePreset - The current graphics performance preset. + * @property {Performance.RefreshRateProfile} refreshRateProfile - The current refresh rate profile. + */ class PerformanceScriptingInterface : public QObject { Q_OBJECT Q_PROPERTY(PerformancePreset performancePreset READ getPerformancePreset WRITE setPerformancePreset NOTIFY settingsChanged) @@ -25,6 +37,23 @@ class PerformanceScriptingInterface : public QObject { public: + /**jsdoc + *

Graphics performance presets.

+ * + * + * + * + * + * + * + * + * + * + *
ValueNameDescription
0UNKNOWNCustom settings of world detail, rendering effects, and refresh + * rate.
1LOWLow world detail, no rendering effects, lo refresh rate.
2MIDMedium world detail, some rendering effects, medium refresh + * rate.
3HIGHMaximum world detail, all rendering effects, high refresh rate.
+ * @typedef {number} Performance.PerformancePreset + */ // PerformanceManager PerformancePreset tri state level enums enum PerformancePreset { UNKNOWN = PerformanceManager::PerformancePreset::UNKNOWN, @@ -34,6 +63,23 @@ public: }; Q_ENUM(PerformancePreset) + /**jsdoc + *

Refresh rate profile.

+ * + * + * + * + * + * + * + * + * + *
ValueNameDescription
0ECOLow refresh rate, which is reduced when Interface doesn't have focus or + * is minimized.
1INTERACTIVEMedium refresh rate, which is reduced when Interface doesn't have + * focus or is minimized.
2REALTIMEHigh refresh rate, even when Interface doesn't have focus or is + * minimized.
+ * @typedef {number} Performance.RefreshRateProfile + */ // Must match RefreshRateManager enums enum RefreshRateProfile { ECO = RefreshRateManager::RefreshRateProfile::ECO, @@ -47,19 +93,81 @@ public: public slots: + /**jsdoc + * Sets graphics performance to a preset. + * @function Performance.setPerformancePreset + * @param {Performance.PerformancePreset} performancePreset - The graphics performance preset to to use. + */ void setPerformancePreset(PerformancePreset performancePreset); + + /**jsdoc + * Gets the current graphics performance preset in use. + * @function Performance.getPerformancePreset + * @returns {Performance.PerformancePreset} The current graphics performance preset in use. + */ PerformancePreset getPerformancePreset() const; + + /**jsdoc + * Gets the names of the graphics performance presets. + * @function Performance.getPerformancePresetNames + * @returns {string[]} The names of the graphics performance presets. The array index values correspond to + * {@link Performance.PerformancePreset} values. + */ QStringList getPerformancePresetNames() const; + + /**jsdoc + * Sets the curfrent refresh rate profile. + * @function Performance.setRefreshRateProfile + * @param {Performance.RefreshRateProfile} refreshRateProfile - The refresh rate profile. + */ void setRefreshRateProfile(RefreshRateProfile refreshRateProfile); + + /**jsdoc + * Gets the current refresh rate profile in use. + * @function Performance.getRefreshRateProfile + * @returns {Performance.RefreshRateProfile} The refresh rate profile. + */ RefreshRateProfile getRefreshRateProfile() const; + + /**jsdoc + * Gets the names of the refresh rate profiles. + * @function Performance.getRefreshRateProfileNames + * @returns {string[]} The names of the refresh rate profiles. The array index values correspond to + * {@link Performance.RefreshRateProfile} values. + */ QStringList getRefreshRateProfileNames() const; + + /**jsdoc + * Gets the current target refresh rate, in Hz, per the current refresh rate profile and refresh rate regime if in desktop + * mode; a higher rate if in VR mode. + * @function Performance.getActiveRefreshRate + * @returns {number} The current target refresh rate, in Hz. + */ int getActiveRefreshRate() const; + + /**jsdoc + * Gets the current user experience mode. + * @function Performance.getUXMode + * @returns {UXMode} The current user experience mode. + */ RefreshRateManager::UXMode getUXMode() const; + + /**jsdoc + * Gets the current refresh rate regime that's in effect. + * @function Performance.getRefreshRateRegime + * @returns {RefreshRateRegime} The current refresh rate regime. + */ RefreshRateManager::RefreshRateRegime getRefreshRateRegime() const; signals: + + /**jsdoc + * Triggered when the performance preset or refresh rate profile is changed. + * @function Performance.settingsChanged + * @returns {Signal} + */ void settingsChanged(); private: diff --git a/interface/src/ui/Stats.h b/interface/src/ui/Stats.h index a7e82daa06..62ec42ca1d 100644 --- a/interface/src/ui/Stats.h +++ b/interface/src/ui/Stats.h @@ -72,14 +72,14 @@ private: \ * @property {number} gameLoopRate - The rate at which the game loop is running, in Hz. * Read-only. - * @property {number} refreshRateTarget - The current refresh rate target per the current refreshRateMode and - * refreshRateRegime if in desktop mode; a higher rate if in VR mode. + * @property {number} refreshRateTarget - The current target refresh rate, in Hz, per the current refreshRateMode + * and refreshRateRegime if in desktop mode; a higher rate if in VR mode. * Read-only. - * @property {RefreshRateProfile} refreshRateMode - The current refresh rate profile. + * @property {RefreshRateProfileName} refreshRateMode - The current refresh rate profile. * Read-only. - * @property {RefreshRateRegime} refreshRateRegime - The current refresh rate regime. + * @property {RefreshRateRegimeName} refreshRateRegime - The current refresh rate regime. * Read-only. - * @property {UXMode} uxMode - The user experience (UX) mode that Interface is running in. + * @property {UXModeName} uxMode - The user experience (UX) mode that Interface is running in. * Read-only. * @property {number} avatarCount - The number of avatars in the domain other than the client's. * Read-only.