From 59a8f12e0ecea9b2597cd95f7b2868cc6fa9be19 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:53:43 +0200 Subject: [PATCH] Recast: allow setting table count in dtNavMesh::init Needed for pre-allocation on solo mesh. --- src/thirdparty/recast/Detour/Include/DetourNavMesh.h | 3 ++- src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/thirdparty/recast/Detour/Include/DetourNavMesh.h b/src/thirdparty/recast/Detour/Include/DetourNavMesh.h index c13c87a0..0f45e65d 100644 --- a/src/thirdparty/recast/Detour/Include/DetourNavMesh.h +++ b/src/thirdparty/recast/Detour/Include/DetourNavMesh.h @@ -431,10 +431,11 @@ public: /// Initializes the navigation mesh for single tile use. /// @param[in] data Data of the new tile. (See: #dtCreateNavMeshData) /// @param[in] dataSize The data size of the new tile. + /// @param[in] tableCount The number of traversal tables this navmesh will use. /// @param[in] flags The tile flags. (See: #dtTileFlags) /// @return The status flags for the operation. /// @see dtCreateNavMeshData - dtStatus init(unsigned char* data, const int dataSize, const int flags); + dtStatus init(unsigned char* data, const int dataSize, const int tableCount, const int flags); /// The navigation mesh initialization params. const dtNavMeshParams* getParams() const; diff --git a/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp b/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp index 982edd6c..cbac26dc 100644 --- a/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp +++ b/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp @@ -301,7 +301,7 @@ dtStatus dtNavMesh::init(const dtNavMeshParams* params) return DT_SUCCESS; } -dtStatus dtNavMesh::init(unsigned char* data, const int dataSize, const int flags) +dtStatus dtNavMesh::init(unsigned char* data, const int dataSize, const int tableCount, const int flags) { // Make sure the data is in right format. dtMeshHeader* header = (dtMeshHeader*)data; @@ -319,7 +319,7 @@ dtStatus dtNavMesh::init(unsigned char* data, const int dataSize, const int flag params.maxPolys = header->polyCount; params.polyGroupCount = 0; params.traversalTableSize = 0; - params.traversalTableCount = 0; + params.traversalTableCount = tableCount; params.magicDataCount = 0; dtStatus status = init(¶ms);