1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +00:00

+ meshsizecache for reduce i&o stalling

Signed-off-by: Bret Curtis <psi29a@gmail.com>
This commit is contained in:
bzzt lost a hitlab login 2020-05-04 13:37:00 +00:00 committed by Bret Curtis
parent 69514dfd46
commit 38c21163ea
2 changed files with 23 additions and 2 deletions

View file

@ -374,6 +374,17 @@ namespace MWRender
continue;
}
float d = (viewPoint - pos).length();
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mSizeCacheMutex);
SizeCache::iterator found = mSizeCache.find(pair.first);
if (found != mSizeCache.end())
{
if (found->second < d*mMinSize)
continue;
}
}
std::string id = Misc::StringUtils::lowerCase(ref.mRefID);
if (id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker")
continue; // marker objects that have a hardcoded function in the game logic, should be hidden from the player
@ -389,9 +400,15 @@ namespace MWRender
*/
osg::ref_ptr<const osg::Node> cnode = mSceneManager->getTemplate(model, compile);
float d = (viewPoint - pos).length();
if (cnode->getBound().radius() * ref.mScale < d*mMinSize)
float radius = cnode->getBound().radius() * ref.mScale;
if (radius < d*mMinSize)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mSizeCacheMutex);
{
mSizeCache[pair.first] = radius;
}
continue;
}
auto emplaced = nodes.emplace(cnode, InstanceList());
if (emplaced.second)

View file

@ -45,6 +45,10 @@ namespace MWRender
OpenThreads::Mutex mDisabledMutex;
std::set<ESM::RefNum> mDisabled;
OpenThreads::Mutex mSizeCacheMutex;
typedef std::map<ESM::RefNum, float> SizeCache;
SizeCache mSizeCache;
};
}