Merge branch 'object_paging_min_size_combo_box' into 'master'

Adding Object Paging Min Size combo box to Advanced -> Visuals

See merge request OpenMW/openmw!917

(cherry picked from commit f66196588c16a9a16211d8f400ce7812127f26c0)

9f2f5174 Adding Object Paging Min Size combo box to Advanced -> Visuals
89950e55 Preventing type conversion of double to float for objectPagingMinSize
pull/593/head
psi29a 4 years ago
parent 5a27d6eed7
commit b31750a337

@ -136,6 +136,7 @@ bool Launcher::AdvancedPage::loadSettings()
loadSettingBool(activeGridObjectPagingCheckBox, "object paging active grid", "Terrain"); loadSettingBool(activeGridObjectPagingCheckBox, "object paging active grid", "Terrain");
viewingDistanceComboBox->setValue(convertToCells(Settings::Manager::getInt("viewing distance", "Camera"))); viewingDistanceComboBox->setValue(convertToCells(Settings::Manager::getInt("viewing distance", "Camera")));
objectPagingMinSizeComboBox->setValue(Settings::Manager::getDouble("object paging min size", "Terrain"));
} }
// Audio // Audio
@ -287,6 +288,9 @@ void Launcher::AdvancedPage::saveSettings()
{ {
Settings::Manager::setInt("viewing distance", "Camera", convertToUnits(viewingDistance)); Settings::Manager::setInt("viewing distance", "Camera", convertToUnits(viewingDistance));
} }
double objectPagingMinSize = objectPagingMinSizeComboBox->value();
if (objectPagingMinSize != Settings::Manager::getDouble("object paging min size", "Terrain"))
Settings::Manager::setDouble("object paging min size", "Terrain", objectPagingMinSize);
} }
// Audio // Audio

@ -61,6 +61,15 @@ float Manager::getFloat (const std::string& setting, const std::string& category
return number; return number;
} }
double Manager::getDouble (const std::string& setting, const std::string& category)
{
const std::string& value = getString(setting, category);
std::stringstream stream(value);
double number = 0.0;
stream >> number;
return number;
}
int Manager::getInt (const std::string& setting, const std::string& category) int Manager::getInt (const std::string& setting, const std::string& category)
{ {
const std::string& value = getString(setting, category); const std::string& value = getString(setting, category);
@ -128,6 +137,13 @@ void Manager::setFloat (const std::string &setting, const std::string &category,
setString(setting, category, stream.str()); setString(setting, category, stream.str());
} }
void Manager::setDouble (const std::string &setting, const std::string &category, const double value)
{
std::ostringstream stream;
stream << value;
setString(setting, category, stream.str());
}
void Manager::setBool(const std::string &setting, const std::string &category, const bool value) void Manager::setBool(const std::string &setting, const std::string &category, const bool value)
{ {
setString(setting, category, value ? "true" : "false"); setString(setting, category, value ? "true" : "false");

@ -44,6 +44,7 @@ namespace Settings
static int getInt (const std::string& setting, const std::string& category); static int getInt (const std::string& setting, const std::string& category);
static float getFloat (const std::string& setting, const std::string& category); static float getFloat (const std::string& setting, const std::string& category);
static double getDouble (const std::string& setting, const std::string& category);
static std::string getString (const std::string& setting, const std::string& category); static std::string getString (const std::string& setting, const std::string& category);
static bool getBool (const std::string& setting, const std::string& category); static bool getBool (const std::string& setting, const std::string& category);
static osg::Vec2f getVector2 (const std::string& setting, const std::string& category); static osg::Vec2f getVector2 (const std::string& setting, const std::string& category);
@ -51,6 +52,7 @@ namespace Settings
static void setInt (const std::string& setting, const std::string& category, const int value); static void setInt (const std::string& setting, const std::string& category, const int value);
static void setFloat (const std::string& setting, const std::string& category, const float value); static void setFloat (const std::string& setting, const std::string& category, const float value);
static void setDouble (const std::string& setting, const std::string& category, const double value);
static void setString (const std::string& setting, const std::string& category, const std::string& value); static void setString (const std::string& setting, const std::string& category, const std::string& value);
static void setBool (const std::string& setting, const std::string& category, const bool value); static void setBool (const std::string& setting, const std::string& category, const bool value);
static void setVector2 (const std::string& setting, const std::string& category, const osg::Vec2f value); static void setVector2 (const std::string& setting, const std::string& category, const osg::Vec2f value);

@ -478,6 +478,36 @@
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<layout class="QHBoxLayout" name="objectPagingMinSizeLayout">
<item>
<widget class="QLabel" name="objectPagingMinSizeLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Controls how large an object must be to be visible in the scene. The objects size is divided by its distance to the camera and the result of the division is compared with this value. The smaller this value is, the more objects you will see in the scene.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Object paging min size</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="objectPagingMinSizeComboBox">
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>0.250000000000000</double>
</property>
<property name="singleStep">
<double>0.005000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="distantLandCheckBox"> <widget class="QCheckBox" name="distantLandCheckBox">
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If true, use paging and LOD algorithms to display the entire terrain. If false, only display terrain of the loaded cells.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If true, use paging and LOD algorithms to display the entire terrain. If false, only display terrain of the loaded cells.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -487,7 +517,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<layout class="QVBoxLayout" name="distantLandLayout"> <layout class="QVBoxLayout" name="distantLandLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>20</number> <number>20</number>

Loading…
Cancel
Save