diff --git a/packages/recast-navigation-wasm/CMakeLists.txt b/packages/recast-navigation-wasm/CMakeLists.txt index 0f7b4194..ff1af784 100644 --- a/packages/recast-navigation-wasm/CMakeLists.txt +++ b/packages/recast-navigation-wasm/CMakeLists.txt @@ -23,13 +23,13 @@ file(GLOB_RECURSE SRC_FILES ) file(GLOB_RECURSE RECASTDETOUR_FILES - ${CMAKE_SOURCE_DIR}/recastnavigation/Detour/* - ${CMAKE_SOURCE_DIR}/recastnavigation/DetourCrowd/* - ${CMAKE_SOURCE_DIR}/recastnavigation/DetourTileCache/* - ${CMAKE_SOURCE_DIR}/recastnavigation/Recast/* - ${CMAKE_SOURCE_DIR}/recastnavigation/DebugUtils/* - ${CMAKE_SOURCE_DIR}/recastnavigation/RecastDemo/Source/ChunkyTriMesh.cpp - ${CMAKE_SOURCE_DIR}/recastnavigation/RecastDemo/Contrib/fastlz/fastlz.c + ${CMAKE_SOURCE_DIR}/recastnavigation/Detour/* + ${CMAKE_SOURCE_DIR}/recastnavigation/DetourCrowd/* + ${CMAKE_SOURCE_DIR}/recastnavigation/DetourTileCache/* + ${CMAKE_SOURCE_DIR}/recastnavigation/Recast/* + ${CMAKE_SOURCE_DIR}/recastnavigation/DebugUtils/* + ${CMAKE_SOURCE_DIR}/recastnavigation/RecastDemo/Source/ChunkyTriMesh.cpp + ${CMAKE_SOURCE_DIR}/recastnavigation/RecastDemo/Contrib/fastlz/fastlz.c ) include_directories( diff --git a/packages/recast-navigation-wasm/recast-navigation.idl b/packages/recast-navigation-wasm/recast-navigation.idl index 0c3b6dce..ddd261f8 100644 --- a/packages/recast-navigation-wasm/recast-navigation.idl +++ b/packages/recast-navigation-wasm/recast-navigation.idl @@ -1205,7 +1205,20 @@ interface RecastDebugDraw { void debugDrawHeightfieldSolid(duDebugDraw dd, [Const, Ref] rcHeightfield hf); void debugDrawHeightfieldWalkable(duDebugDraw dd, [Const, Ref] rcHeightfield hf); + + void debugDrawCompactHeightfieldSolid(duDebugDraw dd, [Const, Ref] rcCompactHeightfield chf); + void debugDrawCompactHeightfieldRegions(duDebugDraw dd, [Const, Ref] rcCompactHeightfield chf); + void debugDrawCompactHeightfieldDistance(duDebugDraw dd, [Const, Ref] rcCompactHeightfield chf); + + void debugDrawHeightfieldLayer(duDebugDraw dd, [Const, Ref] rcHeightfieldLayer layer, long idx); + void debugDrawHeightfieldLayers(duDebugDraw dd, [Const, Ref] rcHeightfieldLayerSet lset); + + void debugDrawRegionConnections(duDebugDraw dd, [Const, Ref] rcContourSet cset, float alpha); + void debugDrawRawContours(duDebugDraw dd, [Const, Ref] rcContourSet cset, float alpha); + void debugDrawContours(duDebugDraw dd, [Const, Ref] rcContourSet cset, float alpha); + void debugDrawPolyMesh(duDebugDraw dd, [Const, Ref] rcPolyMesh mesh); + void debugDrawPolyMeshDetail(duDebugDraw dd, [Const, Ref] rcPolyMeshDetail dmesh); }; interface DetourDebugDraw { diff --git a/packages/recast-navigation-wasm/src/DebugDraw.cpp b/packages/recast-navigation-wasm/src/DebugDraw/DebugDraw.cpp similarity index 100% rename from packages/recast-navigation-wasm/src/DebugDraw.cpp rename to packages/recast-navigation-wasm/src/DebugDraw/DebugDraw.cpp diff --git a/packages/recast-navigation-wasm/src/DebugDraw.h b/packages/recast-navigation-wasm/src/DebugDraw/DebugDraw.h similarity index 56% rename from packages/recast-navigation-wasm/src/DebugDraw.h rename to packages/recast-navigation-wasm/src/DebugDraw/DebugDraw.h index 2df11d96..e0d5108f 100644 --- a/packages/recast-navigation-wasm/src/DebugDraw.h +++ b/packages/recast-navigation-wasm/src/DebugDraw/DebugDraw.h @@ -1,8 +1,8 @@ #pragma once -#include "../recastnavigation/DebugUtils/Include/DebugDraw.h" -#include "../recastnavigation/DebugUtils/Include/RecastDebugDraw.h" -#include "../recastnavigation/DebugUtils/Include/DetourDebugDraw.h" +#include "../../recastnavigation/DebugUtils/Include/DebugDraw.h" +#include "../../recastnavigation/DebugUtils/Include/RecastDebugDraw.h" +#include "../../recastnavigation/DebugUtils/Include/DetourDebugDraw.h" class DebugDraw : public duDebugDraw { @@ -23,31 +23,3 @@ class DebugDraw : public duDebugDraw virtual void handleVertexWithColorAndUV(const float x, const float y, const float z, unsigned int color, const float u, const float v) = 0; virtual void handleEnd() = 0; }; - -class RecastDebugDraw -{ -public: - void debugDrawPolyMesh(duDebugDraw* dd, const rcPolyMesh& mesh) - { - duDebugDrawPolyMesh(dd, mesh); - } - - void debugDrawHeightfieldSolid(duDebugDraw* dd, const rcHeightfield& hf) - { - duDebugDrawHeightfieldSolid(dd, hf); - } - - void debugDrawHeightfieldWalkable(duDebugDraw* dd, const rcHeightfield& hf) - { - duDebugDrawHeightfieldWalkable(dd, hf); - } -}; - -class DetourDebugDraw -{ -public: - void debugDrawNavMesh(duDebugDraw* dd, const dtNavMesh& mesh, const int flags) - { - duDebugDrawNavMesh(dd, mesh, flags); - } -}; diff --git a/packages/recast-navigation-wasm/src/DebugDraw/DetourDebugDraw.cpp b/packages/recast-navigation-wasm/src/DebugDraw/DetourDebugDraw.cpp new file mode 100644 index 00000000..e217e505 --- /dev/null +++ b/packages/recast-navigation-wasm/src/DebugDraw/DetourDebugDraw.cpp @@ -0,0 +1,47 @@ +#include "DetourDebugDraw.h" + +void DetourDebugDraw::debugDrawNavMesh(duDebugDraw* dd, const dtNavMesh& mesh, const int flags) +{ + duDebugDrawNavMesh(dd, mesh, flags); +} +void DetourDebugDraw::debugDrawNavMeshWithClosedList(struct duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMeshQuery& query, unsigned char flags) +{ + duDebugDrawNavMeshWithClosedList(dd, mesh, query, flags); +} +void DetourDebugDraw::debugDrawNavMeshNodes(struct duDebugDraw* dd, const dtNavMeshQuery& query) +{ + duDebugDrawNavMeshNodes(dd, query); +} +void DetourDebugDraw::debugDrawNavMeshBVTree(struct duDebugDraw* dd, const dtNavMesh& mesh) +{ + duDebugDrawNavMeshBVTree(dd, mesh); +} +void DetourDebugDraw::debugDrawNavMeshPortals(struct duDebugDraw* dd, const dtNavMesh& mesh) +{ + duDebugDrawNavMeshPortals(dd, mesh); +} +void DetourDebugDraw::debugDrawNavMeshPolysWithFlags(struct duDebugDraw* dd, const dtNavMesh& mesh, const unsigned short polyFlags, const unsigned int col) +{ + duDebugDrawNavMeshPolysWithFlags(dd, mesh, polyFlags, col); +} +void DetourDebugDraw::debugDrawNavMeshPoly(struct duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef ref, const unsigned int col) +{ + duDebugDrawNavMeshPoly(dd, mesh, ref, col); +} + +void DetourDebugDraw::debugDrawTileCacheLayerAreas(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch) +{ + duDebugDrawTileCacheLayerAreas(dd, layer, cs, ch); +} +void DetourDebugDraw::debugDrawTileCacheLayerRegions(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch) +{ + duDebugDrawTileCacheLayerRegions(dd, layer, cs, ch); +} +void DetourDebugDraw::debugDrawTileCacheContours(duDebugDraw* dd, const struct dtTileCacheContourSet& lcset, const float* orig, const float cs, const float ch) +{ + duDebugDrawTileCacheContours(dd, lcset, orig, cs, ch); +} +void DetourDebugDraw::debugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyMesh& lmesh, const float* orig, const float cs, const float ch) +{ + duDebugDrawTileCachePolyMesh(dd, lmesh, orig, cs, ch); +} diff --git a/packages/recast-navigation-wasm/src/DebugDraw/DetourDebugDraw.h b/packages/recast-navigation-wasm/src/DebugDraw/DetourDebugDraw.h new file mode 100644 index 00000000..424f82cb --- /dev/null +++ b/packages/recast-navigation-wasm/src/DebugDraw/DetourDebugDraw.h @@ -0,0 +1,21 @@ +#pragma once + +#include "../../recastnavigation/DebugUtils/Include/DebugDraw.h" +#include "../../recastnavigation/DebugUtils/Include/DetourDebugDraw.h" + +class DetourDebugDraw +{ +public: + void debugDrawNavMesh(duDebugDraw* dd, const dtNavMesh& mesh, const int flags); + void debugDrawNavMeshWithClosedList(struct duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMeshQuery& query, unsigned char flags); + void debugDrawNavMeshNodes(struct duDebugDraw* dd, const dtNavMeshQuery& query); + void debugDrawNavMeshBVTree(struct duDebugDraw* dd, const dtNavMesh& mesh); + void debugDrawNavMeshPortals(struct duDebugDraw* dd, const dtNavMesh& mesh); + void debugDrawNavMeshPolysWithFlags(struct duDebugDraw* dd, const dtNavMesh& mesh, const unsigned short polyFlags, const unsigned int col); + void debugDrawNavMeshPoly(struct duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef ref, const unsigned int col); + + void debugDrawTileCacheLayerAreas(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch); + void debugDrawTileCacheLayerRegions(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch); + void debugDrawTileCacheContours(duDebugDraw* dd, const struct dtTileCacheContourSet& lcset, const float* orig, const float cs, const float ch); + void debugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyMesh& lmesh, const float* orig, const float cs, const float ch); +}; diff --git a/packages/recast-navigation-wasm/src/DebugDraw/RecastDebugDraw.cpp b/packages/recast-navigation-wasm/src/DebugDraw/RecastDebugDraw.cpp new file mode 100644 index 00000000..74ea9f40 --- /dev/null +++ b/packages/recast-navigation-wasm/src/DebugDraw/RecastDebugDraw.cpp @@ -0,0 +1,61 @@ +#include "RecastDebugDraw.h" + +void RecastDebugDraw::debugDrawHeightfieldSolid(duDebugDraw* dd, const rcHeightfield& hf) +{ + duDebugDrawHeightfieldSolid(dd, hf); +} + +void RecastDebugDraw::debugDrawHeightfieldWalkable(duDebugDraw* dd, const rcHeightfield& hf) +{ + duDebugDrawHeightfieldWalkable(dd, hf); +} + +void RecastDebugDraw::debugDrawCompactHeightfieldSolid(duDebugDraw* dd, const rcCompactHeightfield& chf) +{ + duDebugDrawCompactHeightfieldSolid(dd, chf); +} + +void RecastDebugDraw::debugDrawCompactHeightfieldRegions(duDebugDraw* dd, const rcCompactHeightfield& chf) +{ + duDebugDrawCompactHeightfieldRegions(dd, chf); +} + +void RecastDebugDraw::debugDrawCompactHeightfieldDistance(duDebugDraw* dd, const rcCompactHeightfield& chf) +{ + duDebugDrawCompactHeightfieldDistance(dd, chf); +} + +void RecastDebugDraw::debugDrawHeightfieldLayer(duDebugDraw* dd, const rcHeightfieldLayer& layer, const int idx) +{ + duDebugDrawHeightfieldLayer(dd, layer, idx); +} + +void RecastDebugDraw::debugDrawHeightfieldLayers(duDebugDraw* dd, const rcHeightfieldLayerSet& lset) +{ + duDebugDrawHeightfieldLayers(dd, lset); +} + +void RecastDebugDraw::debugDrawRegionConnections(duDebugDraw* dd, const rcContourSet& cset, const float alpha = 1.0f) +{ + duDebugDrawRegionConnections(dd, cset, alpha); +} + +void RecastDebugDraw::debugDrawRawContours(duDebugDraw* dd, const rcContourSet& cset, const float alpha = 1.0f) +{ + duDebugDrawRawContours(dd, cset, alpha); +} + +void RecastDebugDraw::debugDrawContours(duDebugDraw* dd, const rcContourSet& cset, const float alpha = 1.0f) +{ + duDebugDrawContours(dd, cset, alpha); +} + +void RecastDebugDraw::debugDrawPolyMesh(duDebugDraw* dd, const rcPolyMesh& mesh) +{ + duDebugDrawPolyMesh(dd, mesh); +} + +void RecastDebugDraw::debugDrawPolyMeshDetail(duDebugDraw* dd, const rcPolyMeshDetail& dmesh) +{ + duDebugDrawPolyMeshDetail(dd, dmesh); +} \ No newline at end of file diff --git a/packages/recast-navigation-wasm/src/DebugDraw/RecastDebugDraw.h b/packages/recast-navigation-wasm/src/DebugDraw/RecastDebugDraw.h new file mode 100644 index 00000000..f5b016bf --- /dev/null +++ b/packages/recast-navigation-wasm/src/DebugDraw/RecastDebugDraw.h @@ -0,0 +1,32 @@ +#pragma once + +#include "../../recastnavigation/DebugUtils/Include/DebugDraw.h" +#include "../../recastnavigation/DebugUtils/Include/RecastDebugDraw.h" + +class RecastDebugDraw +{ +public: + void debugDrawHeightfieldSolid(duDebugDraw* dd, const rcHeightfield& hf); + + void debugDrawHeightfieldWalkable(duDebugDraw* dd, const rcHeightfield& hf); + + void debugDrawCompactHeightfieldSolid(duDebugDraw* dd, const rcCompactHeightfield& chf); + + void debugDrawCompactHeightfieldRegions(duDebugDraw* dd, const rcCompactHeightfield& chf); + + void debugDrawCompactHeightfieldDistance(duDebugDraw* dd, const rcCompactHeightfield& chf); + + void debugDrawHeightfieldLayer(duDebugDraw* dd, const rcHeightfieldLayer& layer, const int idx); + + void debugDrawHeightfieldLayers(duDebugDraw* dd, const rcHeightfieldLayerSet& lset); + + void debugDrawRegionConnections(duDebugDraw* dd, const rcContourSet& cset, const float alpha); + + void debugDrawRawContours(duDebugDraw* dd, const rcContourSet& cset, const float alpha); + + void debugDrawContours(duDebugDraw* dd, const rcContourSet& cset, const float alpha); + + void debugDrawPolyMesh(duDebugDraw* dd, const rcPolyMesh& mesh); + + void debugDrawPolyMeshDetail(duDebugDraw* dd, const rcPolyMeshDetail& dmesh); +}; \ No newline at end of file diff --git a/packages/recast-navigation-wasm/src/recast-navigation.h b/packages/recast-navigation-wasm/src/recast-navigation.h index d29a3efa..cb17a782 100644 --- a/packages/recast-navigation-wasm/src/recast-navigation.h +++ b/packages/recast-navigation-wasm/src/recast-navigation.h @@ -12,4 +12,6 @@ #include "./Recast.h" #include "./Detour.h" #include "./ChunkyTriMesh.h" -#include "./DebugDraw.h" +#include "./DebugDraw/DebugDraw.h" +#include "./DebugDraw/RecastDebugDraw.h" +#include "./DebugDraw/DetourDebugDraw.h"