2018-04-07 13:11:23 +00:00
|
|
|
#ifndef OPENMW_MWRENDER_NAVMESH_H
|
|
|
|
#define OPENMW_MWRENDER_NAVMESH_H
|
|
|
|
|
2021-11-01 19:05:34 +00:00
|
|
|
#include <components/detournavigator/tileposition.hpp>
|
2021-11-01 19:21:27 +00:00
|
|
|
#include <components/detournavigator/version.hpp>
|
2022-02-20 18:34:04 +00:00
|
|
|
#include <components/misc/guarded.hpp>
|
2023-10-01 08:36:18 +00:00
|
|
|
#include <components/settings/navmeshrendermode.hpp>
|
2021-11-01 19:21:27 +00:00
|
|
|
|
2018-04-07 13:11:23 +00:00
|
|
|
#include <osg/ref_ptr>
|
|
|
|
|
2021-11-05 23:48:39 +00:00
|
|
|
#include <cstddef>
|
2021-11-01 19:05:34 +00:00
|
|
|
#include <map>
|
2022-02-20 18:34:04 +00:00
|
|
|
#include <memory>
|
2022-02-03 01:05:43 +00:00
|
|
|
#include <string_view>
|
2022-02-20 18:34:04 +00:00
|
|
|
#include <vector>
|
2021-11-05 23:48:39 +00:00
|
|
|
|
|
|
|
class dtNavMesh;
|
|
|
|
|
2018-04-07 13:11:23 +00:00
|
|
|
namespace osg
|
|
|
|
{
|
|
|
|
class Group;
|
|
|
|
class Geometry;
|
2021-11-02 01:43:09 +00:00
|
|
|
class StateSet;
|
2018-04-07 13:11:23 +00:00
|
|
|
}
|
|
|
|
|
2021-11-05 23:48:39 +00:00
|
|
|
namespace DetourNavigator
|
|
|
|
{
|
2021-11-01 19:05:34 +00:00
|
|
|
class NavMeshCacheItem;
|
2021-11-05 23:48:39 +00:00
|
|
|
struct Settings;
|
|
|
|
}
|
|
|
|
|
2022-02-20 18:34:04 +00:00
|
|
|
namespace SceneUtil
|
|
|
|
{
|
|
|
|
class WorkQueue;
|
|
|
|
}
|
|
|
|
|
2018-04-07 13:11:23 +00:00
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
class NavMesh
|
|
|
|
{
|
|
|
|
public:
|
2022-02-20 18:34:04 +00:00
|
|
|
explicit NavMesh(const osg::ref_ptr<osg::Group>& root, const osg::ref_ptr<SceneUtil::WorkQueue>& workQueue,
|
2023-10-01 08:36:18 +00:00
|
|
|
bool enabled, Settings::NavMeshRenderMode mode);
|
2018-04-07 13:11:23 +00:00
|
|
|
~NavMesh();
|
|
|
|
|
|
|
|
bool toggle();
|
|
|
|
|
2022-02-20 18:34:04 +00:00
|
|
|
void update(const std::shared_ptr<Misc::ScopeGuarded<DetourNavigator::NavMeshCacheItem>>& navMesh,
|
|
|
|
std::size_t id, const DetourNavigator::Settings& settings);
|
2018-04-07 13:11:23 +00:00
|
|
|
|
2018-08-30 22:39:44 +00:00
|
|
|
void reset();
|
|
|
|
|
2018-04-07 13:11:23 +00:00
|
|
|
void enable();
|
|
|
|
|
|
|
|
void disable();
|
|
|
|
|
2019-01-20 16:30:26 +00:00
|
|
|
bool isEnabled() const { return mEnabled; }
|
|
|
|
|
2023-10-01 08:36:18 +00:00
|
|
|
void setMode(Settings::NavMeshRenderMode value);
|
2022-02-03 01:05:43 +00:00
|
|
|
|
2018-04-07 13:11:23 +00:00
|
|
|
private:
|
2021-11-01 19:05:34 +00:00
|
|
|
struct Tile
|
|
|
|
{
|
|
|
|
DetourNavigator::Version mVersion;
|
|
|
|
osg::ref_ptr<osg::Group> mGroup;
|
|
|
|
};
|
|
|
|
|
2022-02-20 18:34:04 +00:00
|
|
|
struct LessByTilePosition;
|
|
|
|
struct CreateNavMeshTileGroups;
|
|
|
|
struct DeallocateCreateNavMeshTileGroups;
|
|
|
|
|
2018-04-07 13:11:23 +00:00
|
|
|
osg::ref_ptr<osg::Group> mRootNode;
|
2022-02-20 18:34:04 +00:00
|
|
|
osg::ref_ptr<SceneUtil::WorkQueue> mWorkQueue;
|
2021-11-02 01:43:09 +00:00
|
|
|
osg::ref_ptr<osg::StateSet> mGroupStateSet;
|
|
|
|
osg::ref_ptr<osg::StateSet> mDebugDrawStateSet;
|
2018-04-07 13:11:23 +00:00
|
|
|
bool mEnabled;
|
2023-10-01 08:36:18 +00:00
|
|
|
Settings::NavMeshRenderMode mMode;
|
2021-11-05 23:48:39 +00:00
|
|
|
std::size_t mId;
|
2021-11-01 19:21:27 +00:00
|
|
|
DetourNavigator::Version mVersion;
|
2021-11-01 19:05:34 +00:00
|
|
|
std::map<DetourNavigator::TilePosition, Tile> mTiles;
|
2022-02-20 18:34:04 +00:00
|
|
|
std::vector<osg::ref_ptr<CreateNavMeshTileGroups>> mWorkItems;
|
2018-04-07 13:11:23 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|