Increase the viewing distance cap in the slider when the Distant Terrain is enabled

pull/541/head
Andrei Kortunov 6 years ago
parent 8d489793a9
commit 4513c5516c

@ -11,9 +11,12 @@
#include <SDL_video.h> #include <SDL_video.h>
#include <iomanip>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <components/misc/gcd.hpp> #include <components/misc/gcd.hpp>
#include <components/misc/constants.hpp>
#include <components/widgets/sharedstatebutton.hpp> #include <components/widgets/sharedstatebutton.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
@ -127,13 +130,22 @@ namespace MWGui
MyGUI::ScrollBar* scroll = current->castType<MyGUI::ScrollBar>(); MyGUI::ScrollBar* scroll = current->castType<MyGUI::ScrollBar>();
std::string valueStr; std::string valueStr;
std::string valueType = getSettingValueType(current); std::string valueType = getSettingValueType(current);
if (valueType == "Float" || valueType == "Integer") if (valueType == "Float" || valueType == "Integer" || valueType == "Cell")
{ {
// TODO: ScrollBar isn't meant for this. should probably use a dedicated FloatSlider widget // TODO: ScrollBar isn't meant for this. should probably use a dedicated FloatSlider widget
float min,max; float min,max;
getSettingMinMax(scroll, min, max); getSettingMinMax(scroll, min, max);
float value = Settings::Manager::getFloat(getSettingName(current), getSettingCategory(current)); float value = Settings::Manager::getFloat(getSettingName(current), getSettingCategory(current));
valueStr = MyGUI::utility::toString((int)value);
if (valueType == "Cell")
{
std::stringstream ss;
ss << std::fixed << std::setprecision(2) << value/Constants::CellSizeInUnits;
valueStr = ss.str();
}
else
valueStr = MyGUI::utility::toString(int(value));
value = std::max(min, std::min(value, max)); value = std::max(min, std::min(value, max));
value = (value-min)/(max-min); value = (value-min)/(max-min);
@ -146,7 +158,8 @@ namespace MWGui
scroll->setScrollPosition(value); scroll->setScrollPosition(value);
} }
scroll->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition); scroll->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
updateSliderLabel(scroll, valueStr); if (scroll->getVisible())
updateSliderLabel(scroll, valueStr);
} }
configureWidgets(current); configureWidgets(current);
@ -170,6 +183,12 @@ namespace MWGui
WindowBase("openmw_settings_window.layout"), WindowBase("openmw_settings_window.layout"),
mKeyboardMode(true) mKeyboardMode(true)
{ {
bool terrain = Settings::Manager::getBool("distant terrain", "Terrain");
const std::string widgetName = terrain ? "RenderingDistanceSlider" : "LargeRenderingDistanceSlider";
MyGUI::Widget* unusedSlider;
getWidget(unusedSlider, widgetName);
unusedSlider->setVisible(false);
configureWidgets(mMainWidget); configureWidgets(mMainWidget);
setTitle("#{sOptions}"); setTitle("#{sOptions}");
@ -425,7 +444,7 @@ namespace MWGui
{ {
std::string valueStr; std::string valueStr;
std::string valueType = getSettingValueType(scroller); std::string valueType = getSettingValueType(scroller);
if (valueType == "Float" || valueType == "Integer") if (valueType == "Float" || valueType == "Integer" || valueType == "Cell")
{ {
float value = pos / float(scroller->getScrollRange()-1); float value = pos / float(scroller->getScrollRange()-1);
@ -436,7 +455,15 @@ namespace MWGui
Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), value); Settings::Manager::setFloat(getSettingName(scroller), getSettingCategory(scroller), value);
else else
Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), (int)value); Settings::Manager::setInt(getSettingName(scroller), getSettingCategory(scroller), (int)value);
valueStr = MyGUI::utility::toString(int(value));
if (valueType == "Cell")
{
std::stringstream ss;
ss << std::fixed << std::setprecision(2) << value/Constants::CellSizeInUnits;
valueStr = ss.str();
}
else
valueStr = MyGUI::utility::toString(int(value));
} }
else else
{ {

@ -46,7 +46,7 @@ viewing distance
:Type: floating point :Type: floating point
:Range: > 0 :Range: > 0
:Default: 6666.0 :Default: 6656.0
This value controls the maximum visible distance (also called the far clipping plane). This value controls the maximum visible distance (also called the far clipping plane).
Larger values significantly improve rendering in exterior spaces, Larger values significantly improve rendering in exterior spaces,
@ -87,7 +87,7 @@ Enabling the distant terrain setting is an alternative to increasing exterior ce
Note that the distant land setting does not include rendering of distant static objects, Note that the distant land setting does not include rendering of distant static objects,
so the resulting visual effect is not the same. so the resulting visual effect is not the same.
This setting can be adjusted in game from the ridiculously low value of 2000.0 to a maximum of 6666.0 This setting can be adjusted in game from the ridiculously low value of 2048.0 to a maximum of 81920.0
using the View Distance slider in the Detail tab of the Video panel of the Options menu. using the View Distance slider in the Detail tab of the Video panel of the Options menu.
field of view field of view

@ -376,18 +376,30 @@
<Widget type="TextBox" skin="NormalText" position="4 130 322 18" align="Left Top" name="RenderDistanceLabel"> <Widget type="TextBox" skin="NormalText" position="4 130 322 18" align="Left Top" name="RenderDistanceLabel">
<Property key="Caption" value="#{sRender_Distance}"/> <Property key="Caption" value="#{sRender_Distance}"/>
</Widget> </Widget>
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 154 322 18" align="Left Top"> <Widget type="MWScrollBar" skin="MW_HScroll" position="4 154 322 18" align="Left Top" name="RenderingDistanceSlider">
<Property key="Range" value="4667"/> <Property key="Range" value="4609"/>
<Property key="Page" value="300"/> <Property key="Page" value="128"/>
<UserString key="SettingType" value="Slider"/> <UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Camera"/> <UserString key="SettingCategory" value="Camera"/>
<UserString key="SettingName" value="viewing distance"/> <UserString key="SettingName" value="viewing distance"/>
<UserString key="SettingValueType" value="Integer"/> <UserString key="SettingValueType" value="Integer"/>
<UserString key="SettingMin" value="2000"/> <UserString key="SettingMin" value="2048"/>
<UserString key="SettingMax" value="6666"/> <UserString key="SettingMax" value="6656"/>
<UserString key="SettingLabelWidget" value="RenderDistanceLabel"/> <UserString key="SettingLabelWidget" value="RenderDistanceLabel"/>
<UserString key="SettingLabelCaption" value="#{sRender_Distance} (%s)"/> <UserString key="SettingLabelCaption" value="#{sRender_Distance} (%s)"/>
</Widget> </Widget>
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 154 322 18" align="Left Top" name="LargeRenderingDistanceSlider">
<Property key="Range" value="79873"/>
<Property key="Page" value="2048"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Camera"/>
<UserString key="SettingName" value="viewing distance"/>
<UserString key="SettingValueType" value="Cell"/>
<UserString key="SettingMin" value="2048"/>
<UserString key="SettingMax" value="81920"/>
<UserString key="SettingLabelWidget" value="RenderDistanceLabel"/>
<UserString key="SettingLabelCaption" value="#{sRender_Distance} (x%s)"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="4 178 332 18" align="Left Top"> <Widget type="TextBox" skin="SandText" position="4 178 332 18" align="Left Top">
<Property key="Caption" value="#{sNear}"/> <Property key="Caption" value="#{sNear}"/>
<Property key="TextAlign" value="Left"/> <Property key="TextAlign" value="Left"/>

@ -21,9 +21,9 @@ small feature culling = true
small feature culling pixel size = 2.0 small feature culling pixel size = 2.0
# Maximum visible distance (e.g. 2000.0 to 6666.0). Caution: this setting # Maximum visible distance. Caution: this setting
# can dramatically affect performance, see documentation for details. # can dramatically affect performance, see documentation for details.
viewing distance = 6666.0 viewing distance = 6656.0
# Camera field of view in degrees (e.g. 30.0 to 110.0). # Camera field of view in degrees (e.g. 30.0 to 110.0).
# Does not affect the player's hands in the first person camera. # Does not affect the player's hands in the first person camera.

Loading…
Cancel
Save