mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-22 18:09:41 +00:00
Merge pull request #3086 from akortunov/master
Make groundcover to use rendering distance in units instead of cells
This commit is contained in:
commit
a70f93a3cf
3 changed files with 14 additions and 13 deletions
|
@ -262,7 +262,7 @@ namespace MWRender
|
||||||
globalDefines[itr->first] = itr->second;
|
globalDefines[itr->first] = itr->second;
|
||||||
|
|
||||||
// Refactor this at some point - most shaders don't care about these defines
|
// Refactor this at some point - most shaders don't care about these defines
|
||||||
float groundcoverDistance = (Constants::CellSizeInUnits * std::max(1, Settings::Manager::getInt("distance", "Groundcover")) - 1024) * 0.93;
|
float groundcoverDistance = std::max(0.f, Settings::Manager::getFloat("rendering distance", "Groundcover"));
|
||||||
globalDefines["groundcoverFadeStart"] = std::to_string(groundcoverDistance * 0.9f);
|
globalDefines["groundcoverFadeStart"] = std::to_string(groundcoverDistance * 0.9f);
|
||||||
globalDefines["groundcoverFadeEnd"] = std::to_string(groundcoverDistance);
|
globalDefines["groundcoverFadeEnd"] = std::to_string(groundcoverDistance);
|
||||||
globalDefines["groundcoverStompMode"] = std::to_string(std::clamp(Settings::Manager::getInt("stomp mode", "Groundcover"), 0, 2));
|
globalDefines["groundcoverStompMode"] = std::to_string(std::clamp(Settings::Manager::getInt("stomp mode", "Groundcover"), 0, 2));
|
||||||
|
@ -349,6 +349,10 @@ namespace MWRender
|
||||||
mGroundcover.reset(new Groundcover(mResourceSystem->getSceneManager(), density));
|
mGroundcover.reset(new Groundcover(mResourceSystem->getSceneManager(), density));
|
||||||
static_cast<Terrain::QuadTreeWorld*>(mGroundcoverWorld.get())->addChunkManager(mGroundcover.get());
|
static_cast<Terrain::QuadTreeWorld*>(mGroundcoverWorld.get())->addChunkManager(mGroundcover.get());
|
||||||
mResourceSystem->addResourceManager(mGroundcover.get());
|
mResourceSystem->addResourceManager(mGroundcover.get());
|
||||||
|
|
||||||
|
// Groundcover it is handled in the same way indifferently from if it is from active grid or from distant cell.
|
||||||
|
// Use a stub grid to avoid splitting between chunks for active grid and chunks for distant cells.
|
||||||
|
mGroundcoverWorld->setActiveGrid(osg::Vec4i(0, 0, 0, 0));
|
||||||
}
|
}
|
||||||
// water goes after terrain for correct waterculling order
|
// water goes after terrain for correct waterculling order
|
||||||
mWater.reset(new Water(sceneRoot->getParent(0), sceneRoot, mResourceSystem, mViewer->getIncrementalCompileOperation(), resourcePath));
|
mWater.reset(new Water(sceneRoot->getParent(0), sceneRoot, mResourceSystem, mViewer->getIncrementalCompileOperation(), resourcePath));
|
||||||
|
@ -1076,7 +1080,7 @@ namespace MWRender
|
||||||
|
|
||||||
if (mGroundcoverWorld)
|
if (mGroundcoverWorld)
|
||||||
{
|
{
|
||||||
int groundcoverDistance = Constants::CellSizeInUnits * std::max(1, Settings::Manager::getInt("distance", "Groundcover"));
|
float groundcoverDistance = std::max(0.f, Settings::Manager::getFloat("rendering distance", "Groundcover"));
|
||||||
mGroundcoverWorld->setViewDistance(groundcoverDistance * (distanceMult ? 1.f/distanceMult : 1.f));
|
mGroundcoverWorld->setViewDistance(groundcoverDistance * (distanceMult ? 1.f/distanceMult : 1.f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1311,8 +1315,6 @@ namespace MWRender
|
||||||
void RenderingManager::setActiveGrid(const osg::Vec4i &grid)
|
void RenderingManager::setActiveGrid(const osg::Vec4i &grid)
|
||||||
{
|
{
|
||||||
mTerrain->setActiveGrid(grid);
|
mTerrain->setActiveGrid(grid);
|
||||||
if (mGroundcoverWorld)
|
|
||||||
mGroundcoverWorld->setActiveGrid(grid);
|
|
||||||
}
|
}
|
||||||
bool RenderingManager::pagingEnableObject(int type, const MWWorld::ConstPtr& ptr, bool enabled)
|
bool RenderingManager::pagingEnableObject(int type, const MWWorld::ConstPtr& ptr, bool enabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,15 +28,14 @@ are used in the game. Can affect performance a lot.
|
||||||
|
|
||||||
This setting can only be configured by editing the settings configuration file.
|
This setting can only be configured by editing the settings configuration file.
|
||||||
|
|
||||||
distance
|
rendering distance
|
||||||
--------
|
------------------
|
||||||
|
|
||||||
:Type: integer
|
:Type: floating point
|
||||||
:Range: > 0
|
:Range: >= 0.0
|
||||||
:Default: 1
|
:Default: 6144.0
|
||||||
|
|
||||||
Determines on which distance in cells grass pages are rendered.
|
Determines on which distance in game units grass pages are rendered.
|
||||||
Default 1 value means 3x3 cells area (active grid).
|
|
||||||
May affect performance a lot.
|
May affect performance a lot.
|
||||||
|
|
||||||
This setting can only be configured by editing the settings configuration file.
|
This setting can only be configured by editing the settings configuration file.
|
||||||
|
|
|
@ -1071,8 +1071,8 @@ enabled = false
|
||||||
# 1.0 means 100% density
|
# 1.0 means 100% density
|
||||||
density = 1.0
|
density = 1.0
|
||||||
|
|
||||||
# A maximum distance in cells on which groundcover is rendered.
|
# A maximum distance in game units on which groundcover is rendered.
|
||||||
distance = 1
|
rendering distance = 6144.0
|
||||||
|
|
||||||
# A minimum size of groundcover chunk in cells (0.125, 0.25, 0.5, 1.0)
|
# A minimum size of groundcover chunk in cells (0.125, 0.25, 0.5, 1.0)
|
||||||
min chunk size = 0.5
|
min chunk size = 0.5
|
||||||
|
|
Loading…
Reference in a new issue