Skip to content

Commit

Permalink
Allow to do not reflect terrain
Browse files Browse the repository at this point in the history
  • Loading branch information
akortunov committed Mar 2, 2019
1 parent 00ab552 commit 9398117
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions apps/openmw/mwgui/settingswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ namespace MWGui
mWaterTextureSize->setIndexSelected(2);

int waterReflectionDetail = Settings::Manager::getInt("reflection detail", "Water");
waterReflectionDetail = std::min(3, std::max(0, waterReflectionDetail));
waterReflectionDetail = std::min(4, std::max(0, waterReflectionDetail));
mWaterReflectionDetail->setIndexSelected(waterReflectionDetail);

mWindowBorderButton->setEnabled(!Settings::Manager::getBool("fullscreen", "Video"));
Expand Down Expand Up @@ -344,7 +344,7 @@ namespace MWGui

void SettingsWindow::onWaterReflectionDetailChanged(MyGUI::ComboBox* _sender, size_t pos)
{
unsigned int level = std::min((unsigned int)3, (unsigned int)pos);
unsigned int level = std::min((unsigned int)4, (unsigned int)pos);
Settings::Manager::setInt("reflection detail", "Water", level);
apply();
}
Expand Down
13 changes: 7 additions & 6 deletions apps/openmw/mwrender/water.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,14 @@ class Reflection : public osg::Camera
setSmallFeatureCullingPixelSize(Settings::Manager::getInt("small feature culling pixel size", "Water"));
setName("ReflectionCamera");

unsigned int reflectionDetail = Settings::Manager::getInt("reflection detail", "Water");
reflectionDetail = std::max((unsigned int)isInterior, reflectionDetail);
int reflectionDetail = Settings::Manager::getInt("reflection detail", "Water");
reflectionDetail = std::min(4, std::max(isInterior ? 2 : 0, reflectionDetail));
unsigned int extraMask = 0;
if(reflectionDetail >= 1) extraMask |= Mask_Static;
if(reflectionDetail >= 2) extraMask |= Mask_Effect|Mask_ParticleSystem|Mask_Object;
if(reflectionDetail >= 3) extraMask |= Mask_Actor;
setCullMask(Mask_Scene|Mask_Terrain|Mask_Sky|Mask_Player|Mask_Lighting|extraMask);
if(reflectionDetail >= 1) extraMask |= Mask_Terrain;
if(reflectionDetail >= 2) extraMask |= Mask_Static;
if(reflectionDetail >= 3) extraMask |= Mask_Effect|Mask_ParticleSystem|Mask_Object;
if(reflectionDetail >= 4) extraMask |= Mask_Player|Mask_Actor;
setCullMask(Mask_Scene|Mask_Sky|Mask_Lighting|extraMask);
setNodeMask(Mask_RenderToTexture);

unsigned int rttSize = Settings::Manager::getInt("rtt size", "Water");
Expand Down
15 changes: 8 additions & 7 deletions docs/source/reference/modding/settings/water.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,18 @@ reflection detail
--------------

:Type: integer
:Range: 0, 1, 2, 3
:Default: 1
:Range: 0, 1, 2, 3, 4
:Default: 2

Controls what kinds of things are rendered in water reflections.

0: only terrain and the sky are reflected (acts like level 1 in interiors)
1: statics, activators, and doors are also reflected
2: items, containers, and particles are also reflected
3: actors are also reflected
0: only sky is reflected
1: terrain is also reflected
2: statics, activators, and doors are also reflected
3: items, containers, and particles are also reflected
4: actors are also reflected

The player is always reflected in third-person mode.
In interiors the lowest level is 2.
This setting can be changed ingame with the "Reflection shader detail" dropdown under the Water tab of the Video panel in the Options menu.

small feature culling pixel size
Expand Down
3 changes: 2 additions & 1 deletion files/mygui/openmw_settings_window.layout
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,11 @@
</Widget>
<Widget type="HBox" skin="" position="4 56 350 24">
<Widget type="ComboBox" skin="MW_ComboBox" position="0 0 115 24" align="Left Top" name="WaterReflectionDetail">
<Property key="AddItem" value="Off"/>
<Property key="AddItem" value="Terrain"/>
<Property key="AddItem" value="World"/>
<Property key="AddItem" value="Objects"/>
<Property key="AddItem" value="Everything"/>
<Property key="AddItem" value="Actors"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" position="64 4 90 16" align="Left Top">
<Property key="Caption" value="Reflection shader detail"/>
Expand Down
2 changes: 1 addition & 1 deletion files/settings-default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ rtt size = 512
refraction = false

# Draw objects on water reflections.
reflection detail = 1
reflection detail = 2

# Overrides the value in '[Camera] small feature culling pixel size' specifically for water reflection/refraction textures.
small feature culling pixel size = 20.0
Expand Down

0 comments on commit 9398117

Please sign in to comment.