diff --git a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml index c1901d0d79..707a890edb 100644 --- a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml +++ b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml @@ -18,9 +18,20 @@ import controlsUit 1.0 as HifiControlsUit import "qrc:////qml//controls" as HifiControls import PerformanceEnums 1.0 -Item { +Flickable { HifiStylesUit.HifiConstants { id: hifi; } + contentHeight: graphicsSettingsColumnLayout.height; + + ScrollBar.vertical : ScrollBar { + policy: ScrollBar.AlwaysOn + visible: true + width: 20 + background: Rectangle { + color: hifi.colors.tableScrollBackgroundDark + } + } + id: root; anchors.fill: parent @@ -418,6 +429,53 @@ Item { } } } + Item { + Layout.preferredWidth: parent.width + Layout.preferredHeight: 35 + Layout.topMargin: 16 + + HifiStylesUit.RalewayRegular { + id: fieldOfViewHeader + text: "Vertical FOV (" + Number(Math.round(Render.verticalFieldOfView)) + ")" + anchors.left: parent.left + anchors.top: parent.top + width: 130 + height: parent.height + size: 16 + color: "#FFFFFF" + } + + HifiControlsUit.Slider { + id: fieldOfViewSlider + enabled: true + anchors.left: fieldOfViewHeader.right + anchors.leftMargin: 57 + anchors.top: parent.top + width: 150 + height: parent.height + colorScheme: hifi.colorSchemes.dark + minimumValue: 20 + maximumValue: 130 + stepSize: 0.05 + value: Render.verticalFieldOfView + live: true + + function updateFieldOfView(sliderValue) { + if (Render.verticalFieldOfView !== sliderValue) { + Render.verticalFieldOfView = sliderValue; + } + } + + onValueChanged: { + updateFieldOfView(value); + } + onPressedChanged: { + if (!pressed) { + updateFieldOfView(value); + } + } + } + } } ColumnLayout { diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index e67d5b6e2a..12814aa6b6 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -223,6 +223,13 @@ void RenderScriptingInterface::setViewportResolutionScale(float scale) { } } +void RenderScriptingInterface::setVerticalFieldOfView(float fieldOfView) { + if (getViewportResolutionScale() != fieldOfView) { + qApp->setFieldOfView(fieldOfView); + emit settingsChanged(); + } +} + QStringList RenderScriptingInterface::getScreens() const { QStringList screens; diff --git a/interface/src/scripting/RenderScriptingInterface.h b/interface/src/scripting/RenderScriptingInterface.h index cb7bd8fcfa..2025c71510 100644 --- a/interface/src/scripting/RenderScriptingInterface.h +++ b/interface/src/scripting/RenderScriptingInterface.h @@ -41,6 +41,7 @@ class RenderScriptingInterface : public QObject { Q_PROPERTY(bool ambientOcclusionEnabled READ getAmbientOcclusionEnabled WRITE setAmbientOcclusionEnabled NOTIFY settingsChanged) Q_PROPERTY(AntialiasingConfig::Mode antialiasingMode READ getAntialiasingMode WRITE setAntialiasingMode NOTIFY settingsChanged) Q_PROPERTY(float viewportResolutionScale READ getViewportResolutionScale WRITE setViewportResolutionScale NOTIFY settingsChanged) + Q_PROPERTY(float verticalFieldOfView READ getVerticalFieldOfView WRITE setVerticalFieldOfView NOTIFY settingsChanged) public: RenderScriptingInterface(); @@ -178,27 +179,41 @@ public slots: /*@jsdoc * Returns the list of screens * @function Render.getScreens - * @returns {string[]} The names of the available screens + * @returns {string[]} The names of the available screens. */ QStringList getScreens() const; /*@jsdoc - * Gets the screen used when switching to full screen mode + * Gets the screen used when switching to full screen mode. * @function Render.getFullScreenScreen - * @returns {string} The name of the screen used for full screen mode + * @returns {string} The name of the screen used for full screen mode. */ QString getFullScreenScreen() const; /*@jsdoc - * Sets the screen used when switching to full screen mode + * Sets the screen used when switching to full screen mode. * This function will only succeed if the name passed is one of the entries from Render.getScreens. * Otherwise, it will return False and have no effect. * * @function Render.setFullScreenScreen - * @returns {bool} True if the setting was successful + * @returns {bool} True if the setting was successful. */ bool setFullScreenScreen(QString name); + /*@jsdoc + * Gets the vertical field of view in degrees. + * @function Render.getVerticalFieldOfView + * @returns {number} The vertical field of view in degrees. + */ + float getVerticalFieldOfView() { return qApp->getFieldOfView(); } + + /*@jsdoc + * Sets the vertical field of view in degrees. + * @function Render.setVerticalFieldOfView + * @param {number} fieldOfView - The vertical field of view in degrees to set. + */ + void setVerticalFieldOfView( float fieldOfView ); + signals: /*@jsdoc