mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 22:11:34 +00:00
+ meshsizecache for reduce i&o stalling
Signed-off-by: Bret Curtis <psi29a@gmail.com>
This commit is contained in:
parent
69514dfd46
commit
38c21163ea
2 changed files with 23 additions and 2 deletions
|
@ -374,6 +374,17 @@ namespace MWRender
|
||||||
continue;
|
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);
|
std::string id = Misc::StringUtils::lowerCase(ref.mRefID);
|
||||||
if (id == "prisonmarker" || id == "divinemarker" || id == "templemarker" || id == "northmarker")
|
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
|
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);
|
osg::ref_ptr<const osg::Node> cnode = mSceneManager->getTemplate(model, compile);
|
||||||
|
|
||||||
float d = (viewPoint - pos).length();
|
float radius = cnode->getBound().radius() * ref.mScale;
|
||||||
if (cnode->getBound().radius() * ref.mScale < d*mMinSize)
|
if (radius < d*mMinSize)
|
||||||
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mSizeCacheMutex);
|
||||||
|
{
|
||||||
|
mSizeCache[pair.first] = radius;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto emplaced = nodes.emplace(cnode, InstanceList());
|
auto emplaced = nodes.emplace(cnode, InstanceList());
|
||||||
if (emplaced.second)
|
if (emplaced.second)
|
||||||
|
|
|
@ -45,6 +45,10 @@ namespace MWRender
|
||||||
|
|
||||||
OpenThreads::Mutex mDisabledMutex;
|
OpenThreads::Mutex mDisabledMutex;
|
||||||
std::set<ESM::RefNum> mDisabled;
|
std::set<ESM::RefNum> mDisabled;
|
||||||
|
|
||||||
|
OpenThreads::Mutex mSizeCacheMutex;
|
||||||
|
typedef std::map<ESM::RefNum, float> SizeCache;
|
||||||
|
SizeCache mSizeCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue