mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Add the most basic shadow settings into the launcher
This commit is contained in:
parent
b6ed2f1718
commit
0e2380d471
@ -45,6 +45,7 @@ Launcher::GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, Settings:
|
||||
connect(standardRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotStandardToggled(bool)));
|
||||
connect(screenComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(screenChanged(int)));
|
||||
connect(framerateLimitCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotFramerateLimitToggled(bool)));
|
||||
connect(shadowDistanceCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotShadowDistLimitToggled(bool)));
|
||||
|
||||
}
|
||||
|
||||
@ -129,6 +130,33 @@ bool Launcher::GraphicsPage::loadSettings()
|
||||
framerateLimitSpinBox->setValue(fpsLimit);
|
||||
}
|
||||
|
||||
if (mEngineSettings.getBool("actor shadows", "Shadows"))
|
||||
actorShadowsCheckBox->setCheckState(Qt::Checked);
|
||||
if (mEngineSettings.getBool("player shadows", "Shadows"))
|
||||
playerShadowsCheckBox->setCheckState(Qt::Checked);
|
||||
if (mEngineSettings.getBool("terrain shadows", "Shadows"))
|
||||
objectShadowsCheckBox->setCheckState(Qt::Checked);
|
||||
if (mEngineSettings.getBool("object shadows", "Shadows"))
|
||||
objectShadowsCheckBox->setCheckState(Qt::Checked);
|
||||
if (mEngineSettings.getBool("enable indoor shadows", "Shadows"))
|
||||
indoorShadowsCheckBox->setCheckState(Qt::Checked);
|
||||
|
||||
int shadowDistLimit = mEngineSettings.getInt("maximum shadow map distance", "Shadows");
|
||||
if (shadowDistLimit > 0)
|
||||
{
|
||||
shadowDistanceCheckBox->setCheckState(Qt::Checked);
|
||||
shadowDistanceSpinBox->setValue(shadowDistLimit);
|
||||
}
|
||||
|
||||
float shadowFadeStart = mEngineSettings.getFloat("shadow fade start", "Shadows");
|
||||
if (shadowFadeStart != 0)
|
||||
fadeStartSpinBox->setValue(shadowFadeStart);
|
||||
|
||||
int shadowRes = mEngineSettings.getInt("shadow map resolution", "Shadows");
|
||||
int shadowResIndex = shadowResolutionComboBox->findText(QString::number(shadowRes));
|
||||
if (shadowResIndex != -1)
|
||||
shadowResolutionComboBox->setCurrentIndex(shadowResIndex);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -185,6 +213,52 @@ void Launcher::GraphicsPage::saveSettings()
|
||||
{
|
||||
mEngineSettings.setFloat("framerate limit", "Video", 0);
|
||||
}
|
||||
|
||||
int cShadowDist = shadowDistanceCheckBox->checkState() ? shadowDistanceSpinBox->value() : 0;
|
||||
if (mEngineSettings.getInt("maximum shadow map distance", "Shadows") != cShadowDist)
|
||||
mEngineSettings.setInt("maximum shadow map distance", "Shadows", cShadowDist);
|
||||
float cFadeStart = fadeStartSpinBox->value();
|
||||
if (cShadowDist > 0 && mEngineSettings.getFloat("shadow fade start", "Shadows") != cFadeStart)
|
||||
mEngineSettings.setFloat("shadow fade start", "Shadows", cFadeStart);
|
||||
|
||||
bool cActorShadows = actorShadowsCheckBox->checkState();
|
||||
bool cObjectShadows = objectShadowsCheckBox->checkState();
|
||||
bool cTerrainShadows = terrainShadowsCheckBox->checkState();
|
||||
bool cPlayerShadows = playerShadowsCheckBox->checkState();
|
||||
if (cActorShadows || cObjectShadows || cTerrainShadows || cPlayerShadows)
|
||||
{
|
||||
if (mEngineSettings.getBool("enable shadows", "Shadows") != true)
|
||||
mEngineSettings.setBool("enable shadows", "Shadows", true);
|
||||
if (mEngineSettings.getBool("actor shadows", "Shadows") != cActorShadows)
|
||||
mEngineSettings.setBool("actor shadows", "Shadows", cActorShadows);
|
||||
if (mEngineSettings.getBool("player shadows", "Shadows") != cPlayerShadows)
|
||||
mEngineSettings.setBool("player shadows", "Shadows", cPlayerShadows);
|
||||
if (mEngineSettings.getBool("object shadows", "Shadows") != cObjectShadows)
|
||||
mEngineSettings.setBool("object shadows", "Shadows", cObjectShadows);
|
||||
if (mEngineSettings.getBool("terrain shadows", "Shadows") != cTerrainShadows)
|
||||
mEngineSettings.setBool("terrain shadows", "Shadows", cTerrainShadows);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mEngineSettings.getBool("enable shadows", "Shadows"))
|
||||
mEngineSettings.setBool("enable shadows", "Shadows", false);
|
||||
if (mEngineSettings.getBool("actor shadows", "Shadows"))
|
||||
mEngineSettings.setBool("actor shadows", "Shadows", false);
|
||||
if (mEngineSettings.getBool("player shadows", "Shadows"))
|
||||
mEngineSettings.setBool("player shadows", "Shadows", false);
|
||||
if (mEngineSettings.getBool("object shadows", "Shadows"))
|
||||
mEngineSettings.setBool("object shadows", "Shadows", false);
|
||||
if (mEngineSettings.getBool("terrain shadows", "Shadows"))
|
||||
mEngineSettings.setBool("terrain shadows", "Shadows", false);
|
||||
}
|
||||
|
||||
bool cIndoorShadows = indoorShadowsCheckBox->checkState();
|
||||
if (mEngineSettings.getBool("enable indoor shadows", "Shadows") != cIndoorShadows)
|
||||
mEngineSettings.setBool("enable indoor shadows", "Shadows", cIndoorShadows);
|
||||
|
||||
int cShadowRes = shadowResolutionComboBox->currentText().toInt();
|
||||
if (cShadowRes != mEngineSettings.getInt("shadow map resolution", "Shadows"))
|
||||
mEngineSettings.setInt("shadow map resolution", "Shadows", cShadowRes);
|
||||
}
|
||||
|
||||
QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen)
|
||||
@ -290,3 +364,10 @@ void Launcher::GraphicsPage::slotFramerateLimitToggled(bool checked)
|
||||
{
|
||||
framerateLimitSpinBox->setEnabled(checked);
|
||||
}
|
||||
|
||||
|
||||
void Launcher::GraphicsPage::slotShadowDistLimitToggled(bool checked)
|
||||
{
|
||||
shadowDistanceSpinBox->setEnabled(checked);
|
||||
fadeStartSpinBox->setEnabled(checked);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ namespace Launcher
|
||||
void slotFullScreenChanged(int state);
|
||||
void slotStandardToggled(bool checked);
|
||||
void slotFramerateLimitToggled(bool checked);
|
||||
void slotShadowDistLimitToggled(bool checked);
|
||||
|
||||
private:
|
||||
Files::ConfigurationManager &mCfgMgr;
|
||||
|
@ -2,14 +2,6 @@
|
||||
<ui version="4.0">
|
||||
<class>GraphicsPage</class>
|
||||
<widget class="QWidget" name="GraphicsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>437</width>
|
||||
<height>343</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="displayGroup">
|
||||
@ -178,6 +170,145 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="shadowGroup">
|
||||
<property name="title">
|
||||
<string>Shadows</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="shadowsLayout" columnstretch="0,0,0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="actorShadowsCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable Actor Shadows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="terrainShadowsCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable Terrain Shadows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="objectShadowsCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable Object Shadows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="shadowDistanceCheckBox">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The distance from the camera at which shadows completely disappear</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Shadow Distance Limit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" alignment="Qt::AlignLeft">
|
||||
<widget class="QLabel" name="shadowResolutionLabel">
|
||||
<property name="text">
|
||||
<string>Shadow Map Resolution:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="shadowResolutionComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>512</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1024</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2048</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4096</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="playerShadowsCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable Player Shadows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="shadowDistanceSpinBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>64 game units is 1 real life yard or about 0.9 m</p></body></html></string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> unit(s)</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>512</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>81920</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8192</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="fadeStartLabel">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The fraction of the limit above at which shadows begin to gradually fade away</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fade Start Multiplier:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QDoubleSpinBox" name="fadeStartSpinBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.05</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.90</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="indoorShadowsCheckBox">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Due to limitations with Morrowind's data, only actors can cast shadows indoors, which some might feel is distracting.</p><p>Has no effect if at least one of the options above is not enabled.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Indoor Shadows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
Loading…
Reference in New Issue
Block a user