mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Allow opting out of water culling (#7318)
This commit is contained in:
parent
34b6a9d402
commit
4f521a94d7
7 changed files with 28 additions and 2 deletions
|
@ -238,6 +238,7 @@
|
||||||
Feature #7194: Ori to show texture paths
|
Feature #7194: Ori to show texture paths
|
||||||
Feature #7214: Searching in the in-game console
|
Feature #7214: Searching in the in-game console
|
||||||
Feature #7248: Searching in the console with regex and toggleable case-sensitivity
|
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 #7468: Factions API for Lua
|
||||||
Feature #7477: NegativeLight Magic Effect flag
|
Feature #7477: NegativeLight Magic Effect flag
|
||||||
Feature #7499: OpenMW-CS: Generate record filters by drag & dropping cell content to the filters field
|
Feature #7499: OpenMW-CS: Generate record filters by drag & dropping cell content to the filters field
|
||||||
|
|
|
@ -1495,6 +1495,7 @@ namespace MWRender
|
||||||
newChunkMgr.mTerrain->setTargetFrameRate(Settings::cells().mTargetFramerate);
|
newChunkMgr.mTerrain->setTargetFrameRate(Settings::cells().mTargetFramerate);
|
||||||
float distanceMult = std::cos(osg::DegreesToRadians(std::min(mFieldOfView, 140.f)) / 2.f);
|
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->setViewDistance(mViewDistance * (distanceMult ? 1.f / distanceMult : 1.f));
|
||||||
|
newChunkMgr.mTerrain->enableHeightCullCallback(Settings::terrain().mWaterCulling);
|
||||||
|
|
||||||
return mWorldspaceChunks.emplace(worldspace, std::move(newChunkMgr)).first->second;
|
return mWorldspaceChunks.emplace(worldspace, std::move(newChunkMgr)).first->second;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace Settings
|
||||||
makeMaxStrictSanitizerFloat(0) };
|
makeMaxStrictSanitizerFloat(0) };
|
||||||
SettingValue<float> mObjectPagingMinSizeCostMultiplier{ mIndex, "Terrain",
|
SettingValue<float> mObjectPagingMinSizeCostMultiplier{ mIndex, "Terrain",
|
||||||
"object paging min size cost multiplier", makeMaxStrictSanitizerFloat(0) };
|
"object paging min size cost multiplier", makeMaxStrictSanitizerFloat(0) };
|
||||||
|
SettingValue<bool> mWaterCulling{ mIndex, "Terrain", "water culling" };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ namespace Terrain
|
||||||
, mParent(parent)
|
, mParent(parent)
|
||||||
, mResourceSystem(resourceSystem)
|
, mResourceSystem(resourceSystem)
|
||||||
, mBorderVisible(false)
|
, mBorderVisible(false)
|
||||||
, mHeightCullCallback(new HeightCullCallback)
|
|
||||||
, mWorldspace(worldspace)
|
, mWorldspace(worldspace)
|
||||||
{
|
{
|
||||||
mTerrainRoot = new osg::Group;
|
mTerrainRoot = new osg::Group;
|
||||||
|
@ -67,7 +66,6 @@ namespace Terrain
|
||||||
, mChunkManager(nullptr)
|
, mChunkManager(nullptr)
|
||||||
, mCellBorder(nullptr)
|
, mCellBorder(nullptr)
|
||||||
, mBorderVisible(false)
|
, mBorderVisible(false)
|
||||||
, mHeightCullCallback(nullptr)
|
|
||||||
, mWorldspace(worldspace)
|
, mWorldspace(worldspace)
|
||||||
{
|
{
|
||||||
mTerrainRoot = new osg::Group;
|
mTerrainRoot = new osg::Group;
|
||||||
|
@ -143,6 +141,14 @@ namespace Terrain
|
||||||
mChunkManager->clearCache();
|
mChunkManager->clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::enableHeightCullCallback(bool enable)
|
||||||
|
{
|
||||||
|
if (enable)
|
||||||
|
mHeightCullCallback = new HeightCullCallback;
|
||||||
|
else
|
||||||
|
mHeightCullCallback = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
osg::Callback* World::getHeightCullCallback(float highz, unsigned int mask)
|
osg::Callback* World::getHeightCullCallback(float highz, unsigned int mask)
|
||||||
{
|
{
|
||||||
if (!mHeightCullCallback || mTerrainRoot->getNumChildren() == 0)
|
if (!mHeightCullCallback || mTerrainRoot->getNumChildren() == 0)
|
||||||
|
|
|
@ -106,6 +106,7 @@ namespace Terrain
|
||||||
|
|
||||||
Storage* getStorage() { return mStorage; }
|
Storage* getStorage() { return mStorage; }
|
||||||
|
|
||||||
|
void enableHeightCullCallback(bool enable);
|
||||||
osg::Callback* getHeightCullCallback(float highz, unsigned int mask);
|
osg::Callback* getHeightCullCallback(float highz, unsigned int mask);
|
||||||
|
|
||||||
void setActiveGrid(const osg::Vec4i& grid) { mActiveGrid = grid; }
|
void setActiveGrid(const osg::Vec4i& grid) { mActiveGrid = grid; }
|
||||||
|
|
|
@ -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.
|
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.
|
The larger this value is, the less expensive objects can be before they are discarded.
|
||||||
See the formula above to figure out the math.
|
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.
|
||||||
|
|
|
@ -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'.
|
# Controls how inexpensive an object needs to be to utilize 'min size merge factor'.
|
||||||
object paging min size cost multiplier = 25
|
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]
|
[Fog]
|
||||||
|
|
||||||
# If true, use extended fog parameters for distant terrain not controlled by
|
# If true, use extended fog parameters for distant terrain not controlled by
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue