mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-08 09:37:53 +00:00
3e67f5ffa5
To avoid triggering NavMesh update when RecastMesh change should not change NavMesh. Based on the following assumption: Given a set of transformations and a bounding shape for all these tranformations, a new object transformation that does not change this bounding shape also should not change navmesh if for all of this object transformations resulting navmesh tiles are equivalent The idea is to report back to RecastMeshManager all changes of NavMesh if there are any assiciated with RecastMesh version. So we know the last time when RecastMesh change resulted into the NavMesh change. When later report shows that there was no NavMesh change for a new RecastMesh version we can assume that any object transformation within the same bounding box should not change NavMesh.
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_CACHEDRECASTMESHMANAGER_H
|
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_CACHEDRECASTMESHMANAGER_H
|
|
|
|
#include "recastmeshmanager.hpp"
|
|
#include "version.hpp"
|
|
|
|
namespace DetourNavigator
|
|
{
|
|
class CachedRecastMeshManager
|
|
{
|
|
public:
|
|
CachedRecastMeshManager(const Settings& settings, const TileBounds& bounds, std::size_t generation);
|
|
|
|
bool addObject(const ObjectId id, const btCollisionShape& shape, const btTransform& transform,
|
|
const AreaType areaType);
|
|
|
|
bool updateObject(const ObjectId id, const btTransform& transform, const AreaType areaType);
|
|
|
|
bool addWater(const osg::Vec2i& cellPosition, const int cellSize, const btTransform& transform);
|
|
|
|
std::optional<RecastMeshManager::Water> removeWater(const osg::Vec2i& cellPosition);
|
|
|
|
std::optional<RemovedRecastMeshObject> removeObject(const ObjectId id);
|
|
|
|
std::shared_ptr<RecastMesh> getMesh();
|
|
|
|
bool isEmpty() const;
|
|
|
|
void reportNavMeshChange(Version recastMeshVersion, Version navMeshVersion);
|
|
|
|
private:
|
|
RecastMeshManager mImpl;
|
|
std::shared_ptr<RecastMesh> mCached;
|
|
};
|
|
}
|
|
|
|
#endif
|