From b69c16e682c618371fc60cb5ced92e51650997a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Wed, 6 Dec 2017 20:39:09 +0100 Subject: [PATCH] Add setting option to scale water refractions --- apps/openmw/mwrender/water.cpp | 6 ++++++ files/settings-default.cfg | 3 +++ 2 files changed, 9 insertions(+) diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index c4dffb7a4d..dbfee05dff 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -272,6 +272,12 @@ public: void setWaterLevel(float waterLevel) { + const float refractionScale = std::min(1.0f,std::max(0.0f, + Settings::Manager::getFloat("refraction scale", "Water"))); + + setViewMatrix(osg::Matrix::scale(1,1,refractionScale) * + osg::Matrix::translate(0,0,(1.0 - refractionScale) * waterLevel)); + mClipCullNode->setPlane(osg::Plane(osg::Vec3d(0,0,-1), osg::Vec3d(0,0, waterLevel))); } diff --git a/files/settings-default.cfg b/files/settings-default.cfg index aec667a9c4..35748d5166 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -376,6 +376,9 @@ reflect actors = false # Overrides the value in '[Camera] small feature culling pixel size' specifically for water reflection/refraction textures. small feature culling pixel size = 20.0 +# By what factor water downscales objects. Only works with water shader and refractions on. +refraction scale = 1.0 + [Windows] # Location and sizes of windows as a fraction of the OpenMW window or