From b31750a33720069888c086df950fd628405f0a84 Mon Sep 17 00:00:00 2001 From: psi29a Date: Sat, 19 Jun 2021 00:20:29 +0000 Subject: [PATCH] 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 --- apps/launcher/advancedpage.cpp | 4 ++++ components/settings/settings.cpp | 16 ++++++++++++++++ components/settings/settings.hpp | 2 ++ files/ui/advancedpage.ui | 32 +++++++++++++++++++++++++++++++- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index ed36634b6..bddb70aa0 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -136,6 +136,7 @@ bool Launcher::AdvancedPage::loadSettings() loadSettingBool(activeGridObjectPagingCheckBox, "object paging active grid", "Terrain"); viewingDistanceComboBox->setValue(convertToCells(Settings::Manager::getInt("viewing distance", "Camera"))); + objectPagingMinSizeComboBox->setValue(Settings::Manager::getDouble("object paging min size", "Terrain")); } // Audio @@ -287,6 +288,9 @@ void Launcher::AdvancedPage::saveSettings() { 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 diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index 13501ac8c..09a3d1f51 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -61,6 +61,15 @@ float Manager::getFloat (const std::string& setting, const std::string& category 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) { 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()); } +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) { setString(setting, category, value ? "true" : "false"); diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp index ecc5aa5fd..e3a29d4c3 100644 --- a/components/settings/settings.hpp +++ b/components/settings/settings.hpp @@ -44,6 +44,7 @@ namespace Settings static int getInt (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 bool getBool (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 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 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); diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui index b9d5c7ef5..8abe8f59a 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -478,6 +478,36 @@ + + + + + <html><head/><body><p>Controls how large an object must be to be visible in the scene. The object’s 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.</p></body></html> + + + Object paging min size + + + + + + + 3 + + + 0.000000000000000 + + + 0.250000000000000 + + + 0.005000000000000 + + + + + + <html><head/><body><p>If true, use paging and LOD algorithms to display the entire terrain. If false, only display terrain of the loaded cells.</p></body></html> @@ -487,7 +517,7 @@ - + 20