mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 17:49:27 +02:00
Added FOV setting to graphics menu
This commit is contained in:
parent
758d98a397
commit
d0fe5b7994
3 changed files with 86 additions and 6 deletions
|
@ -18,9 +18,20 @@ import controlsUit 1.0 as HifiControlsUit
|
||||||
import "qrc:////qml//controls" as HifiControls
|
import "qrc:////qml//controls" as HifiControls
|
||||||
import PerformanceEnums 1.0
|
import PerformanceEnums 1.0
|
||||||
|
|
||||||
Item {
|
Flickable {
|
||||||
HifiStylesUit.HifiConstants { id: hifi; }
|
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;
|
id: root;
|
||||||
anchors.fill: parent
|
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 {
|
ColumnLayout {
|
||||||
|
|
|
@ -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 RenderScriptingInterface::getScreens() const {
|
||||||
QStringList screens;
|
QStringList screens;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ class RenderScriptingInterface : public QObject {
|
||||||
Q_PROPERTY(bool ambientOcclusionEnabled READ getAmbientOcclusionEnabled WRITE setAmbientOcclusionEnabled NOTIFY settingsChanged)
|
Q_PROPERTY(bool ambientOcclusionEnabled READ getAmbientOcclusionEnabled WRITE setAmbientOcclusionEnabled NOTIFY settingsChanged)
|
||||||
Q_PROPERTY(AntialiasingConfig::Mode antialiasingMode READ getAntialiasingMode WRITE setAntialiasingMode 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 viewportResolutionScale READ getViewportResolutionScale WRITE setViewportResolutionScale NOTIFY settingsChanged)
|
||||||
|
Q_PROPERTY(float verticalFieldOfView READ getVerticalFieldOfView WRITE setVerticalFieldOfView NOTIFY settingsChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RenderScriptingInterface();
|
RenderScriptingInterface();
|
||||||
|
@ -178,27 +179,41 @@ public slots:
|
||||||
/*@jsdoc
|
/*@jsdoc
|
||||||
* Returns the list of screens
|
* Returns the list of screens
|
||||||
* @function Render.getScreens
|
* @function Render.getScreens
|
||||||
* @returns {string[]} The names of the available screens
|
* @returns {string[]} The names of the available screens.
|
||||||
*/
|
*/
|
||||||
QStringList getScreens() const;
|
QStringList getScreens() const;
|
||||||
|
|
||||||
/*@jsdoc
|
/*@jsdoc
|
||||||
* Gets the screen used when switching to full screen mode
|
* Gets the screen used when switching to full screen mode.
|
||||||
* @function Render.getFullScreenScreen
|
* @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;
|
QString getFullScreenScreen() const;
|
||||||
|
|
||||||
/*@jsdoc
|
/*@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.
|
* 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.
|
* Otherwise, it will return False and have no effect.
|
||||||
*
|
*
|
||||||
* @function Render.setFullScreenScreen
|
* @function Render.setFullScreenScreen
|
||||||
* @returns {bool} True if the setting was successful
|
* @returns {bool} True if the setting was successful.
|
||||||
*/
|
*/
|
||||||
bool setFullScreenScreen(QString name);
|
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:
|
signals:
|
||||||
|
|
||||||
/*@jsdoc
|
/*@jsdoc
|
||||||
|
|
Loading…
Reference in a new issue