1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-08 21:16:40 +00:00

Remove recastmesh group for absent tile

This commit is contained in:
elsid 2024-05-18 02:14:58 +02:00
parent 9e2f3fd0b4
commit 4f5bdbb4fb
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
2 changed files with 13 additions and 7 deletions

View file

@ -67,14 +67,22 @@ namespace MWRender
++it; ++it;
} }
for (const auto& tile : tiles) for (const auto& [position, mesh] : tiles)
{ {
if (mGroups.count(tile.first)) const auto it = mGroups.find(position);
continue;
const auto group = SceneUtil::createRecastMeshGroup(*tile.second, settings.mRecast); if (it != mGroups.end())
{
if (it->second.mVersion == mesh->getVersion())
continue;
mRootNode->removeChild(it->second.mValue);
}
const auto group = SceneUtil::createRecastMeshGroup(*mesh, settings.mRecast);
MWBase::Environment::get().getResourceSystem()->getSceneManager()->recreateShaders(group, "debug"); MWBase::Environment::get().getResourceSystem()->getSceneManager()->recreateShaders(group, "debug");
group->setNodeMask(Mask_Debug); group->setNodeMask(Mask_Debug);
mGroups.emplace(tile.first, Group{ tile.second->getVersion(), group }); mGroups.insert_or_assign(it, position, Group{ mesh->getVersion(), group });
mRootNode->addChild(group); mRootNode->addChild(group);
} }
} }

View file

@ -6,8 +6,6 @@
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <vector>
namespace osg namespace osg
{ {
class Group; class Group;