62#ifndef DVD_NAVIGATION_MESH_H_
63#define DVD_NAVIGATION_MESH_H_
85 'M' << 24 |
'S' << 16 |
'E' << 8 |
'T';
161 U8 maxIters = 15)
const;
243 return navMesh._navMesh;
246 return navMesh._configParams;
static const NavigationMeshConfig & getConfigParams(const NavigationMesh &navMesh) noexcept
static dtNavMesh * getNavigationMesh(NavigationMesh &navMesh) noexcept
NavigationMeshConfig _configParams
rcContourSet * _countourSet
bool debugDraw() const noexcept
DivideRecast & _recastInterface
bool save(const SceneGraphNode *sgn)
Save the NavigationMesh to a file.
void draw(bool force, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
Render the debug mesh if debug drawing is enabled.
Mutex _navigationMeshLock
A mutex for accessing our actual NavigationMesh.
bool unload()
Unload the navmesh reverting the instance to an empty container.
DELEGATE< void, NavigationMesh * > CreationCallback
bool loadConfigFromFile()
Load nav mesh configuration from file.
static Str< 256 > GenerateMeshName(const SceneGraphNode *sgn)
Create a unique mesh name using the given root node.
bool build(SceneGraphNode *sgn, CreationCallback creationCompleteCallback, bool threaded=true)
I64 _buildJobGUID
A thread for us to update in.
std::atomic_bool _building
A simple flag to say we are building.
CreationCallback _loadCompleteClbk
A callback function to call after building is complete.
void buildInternal()
Used for multithreaded loading.
bool getClosestPosition(const vec3< F32 > &destination, const vec3< F32 > &extents, F32 delta, vec3< F32 > &result) const
void debugDraw(const bool state) noexcept
bool getRandomPosition(vec3< F32 > &result) const
bool createPolyMesh(const rcConfig &cfg, const NavModelData &data, rcContextDivide *ctx)
Performs the Recast part of the build process.
SceneGraphNode * _sgn
SceneGraphNode from which to build.
const vec3< F32 > & getExtents() const noexcept
std::unique_ptr< NavMeshDebugDraw > _debugDrawInterface
DebugDraw interface.
rcCompactHeightfield * _compactHeightField
dtNavMeshQuery * _navQuery
Query object used for this mesh.
void setRenderMode(const RenderMode &mode) noexcept
vec3< F32 > _extents
NavMesh extents.
void setFileName(const Str< 256 > &fileName)
string _configFile
Configuration file.
rcHeightfield * _heightField
bool createNavigationMesh(dtNavMeshCreateParams ¶ms)
Performs the Detour part of the build process.
void stopThreadedBuild()
Stop the threaded build process;.
void freeIntermediates(bool freeAll)
const dtNavMeshQuery & getNavQuery() const noexcept
void setRenderConnections(const bool state) noexcept
bool createNavigationQuery(U32 maxNodes=2048)
Create a navigation mesh query to help in pathfinding.
Str< 256 > _fileName
Data file to store this nav mesh in.
std::atomic_bool _debugDraw
~NavigationMesh() override
bool buildThreaded()
Initiates the build process in a separate thread.
bool getRandomPositionInCircle(const vec3< F32 > ¢er, F32 radius, const vec3< F32 > &extents, vec3< F32 > &result, U8 maxIters=15) const
rcPolyMeshDetail * _polyMeshDetail
Utility class that adds basic GUID management to objects.
PlatformContext & context() noexcept
constexpr I32 NAVMESHSET_MAGIC
constexpr I32 NAVMESHSET_VERSION
Handle console commands that start with a forward slash.
DELEGATE_STD< Ret, Args... > DELEGATE