1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00
OpenMW/components/detournavigator/recastmeshmanager.hpp

45 lines
1.0 KiB
C++
Raw Normal View History

2018-03-13 22:49:08 +00:00
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHMANAGER_H
#include "recastmeshbuilder.hpp"
#include <LinearMath/btTransform.h>
#include <boost/optional.hpp>
2018-03-13 22:49:08 +00:00
#include <unordered_map>
class btCollisionShape;
namespace DetourNavigator
{
class RecastMeshManager
{
public:
struct Object
{
const btCollisionShape* mShape;
btTransform mTransform;
};
2018-03-13 22:49:08 +00:00
RecastMeshManager(const Settings& settings);
bool addObject(std::size_t id, const btHeightfieldTerrainShape& shape, const btTransform& transform);
bool addObject(std::size_t id, const btConcaveShape& shape, const btTransform& transform);
boost::optional<Object> removeObject(std::size_t id);
2018-03-13 22:49:08 +00:00
std::shared_ptr<RecastMesh> getMesh();
private:
bool mShouldRebuild;
RecastMeshBuilder mMeshBuilder;
std::unordered_map<std::size_t, Object> mObjects;
void rebuild();
};
}
#endif