1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 21:35:24 +00:00

Allow opting out of water culling (#7318)

This commit is contained in:
Alexei Kotov 2024-10-31 14:27:28 +03:00
parent 34b6a9d402
commit 4f521a94d7
7 changed files with 28 additions and 2 deletions

View File

@ -238,6 +238,7 @@
Feature #7194: Ori to show texture paths
Feature #7214: Searching in the in-game console
Feature #7248: Searching in the console with regex and toggleable case-sensitivity
Feature #7318: Ability to disable water culling
Feature #7468: Factions API for Lua
Feature #7477: NegativeLight Magic Effect flag
Feature #7499: OpenMW-CS: Generate record filters by drag & dropping cell content to the filters field

View File

@ -1495,6 +1495,7 @@ namespace MWRender
newChunkMgr.mTerrain->setTargetFrameRate(Settings::cells().mTargetFramerate);
float distanceMult = std::cos(osg::DegreesToRadians(std::min(mFieldOfView, 140.f)) / 2.f);
newChunkMgr.mTerrain->setViewDistance(mViewDistance * (distanceMult ? 1.f / distanceMult : 1.f));
newChunkMgr.mTerrain->enableHeightCullCallback(Settings::terrain().mWaterCulling);
return mWorldspaceChunks.emplace(worldspace, std::move(newChunkMgr)).first->second;
}

View File

@ -37,6 +37,7 @@ namespace Settings
makeMaxStrictSanitizerFloat(0) };
SettingValue<float> mObjectPagingMinSizeCostMultiplier{ mIndex, "Terrain",
"object paging min size cost multiplier", makeMaxStrictSanitizerFloat(0) };
SettingValue<bool> mWaterCulling{ mIndex, "Terrain", "water culling" };
};
}

View File

@ -23,7 +23,6 @@ namespace Terrain
, mParent(parent)
, mResourceSystem(resourceSystem)
, mBorderVisible(false)
, mHeightCullCallback(new HeightCullCallback)
, mWorldspace(worldspace)
{
mTerrainRoot = new osg::Group;
@ -67,7 +66,6 @@ namespace Terrain
, mChunkManager(nullptr)
, mCellBorder(nullptr)
, mBorderVisible(false)
, mHeightCullCallback(nullptr)
, mWorldspace(worldspace)
{
mTerrainRoot = new osg::Group;
@ -143,6 +141,14 @@ namespace Terrain
mChunkManager->clearCache();
}
void World::enableHeightCullCallback(bool enable)
{
if (enable)
mHeightCullCallback = new HeightCullCallback;
else
mHeightCullCallback = nullptr;
}
osg::Callback* World::getHeightCullCallback(float highz, unsigned int mask)
{
if (!mHeightCullCallback || mTerrainRoot->getNumChildren() == 0)

View File

@ -106,6 +106,7 @@ namespace Terrain
Storage* getStorage() { return mStorage; }
void enableHeightCullCallback(bool enable);
osg::Callback* getHeightCullCallback(float highz, unsigned int mask);
void setActiveGrid(const osg::Vec4i& grid) { mActiveGrid = grid; }

View File

@ -205,3 +205,16 @@ object paging min size cost multiplier
This setting adjusts the calculated cost of merging an object used in the mentioned functionality.
The larger this value is, the less expensive objects can be before they are discarded.
See the formula above to figure out the math.
water culling
-------------
:Type: boolean
:Range: True/False
:Default: True
Controls whether water culling is used.
Water culling is an optimisation that prevents the expensive rendering of water when it is
evaluated to be below any visible terrain chunk, potentially improving performance in many scenes.
You may want to opt out of it if it causes framerate instability or inappropriately invisible water on your setup.

View File

@ -119,6 +119,9 @@ object paging min size merge factor = 0.3
# Controls how inexpensive an object needs to be to utilize 'min size merge factor'.
object paging min size cost multiplier = 25
# Don't draw water if it's evaluated to be below all visible terrain
water culling = true
[Fog]
# If true, use extended fog parameters for distant terrain not controlled by