aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/recastnavigation
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/recastnavigation
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/recastnavigation')
-rw-r--r--vcpkg/ports/recastnavigation/fix-detail-mesh-edge-detection.patch103
-rw-r--r--vcpkg/ports/recastnavigation/portfile.cmake30
-rw-r--r--vcpkg/ports/recastnavigation/vcpkg.json18
3 files changed, 151 insertions, 0 deletions
diff --git a/vcpkg/ports/recastnavigation/fix-detail-mesh-edge-detection.patch b/vcpkg/ports/recastnavigation/fix-detail-mesh-edge-detection.patch
new file mode 100644
index 0000000..a4a8257
--- /dev/null
+++ b/vcpkg/ports/recastnavigation/fix-detail-mesh-edge-detection.patch
@@ -0,0 +1,103 @@
+diff --git a/Recast/Source/RecastMeshDetail.cpp b/Recast/Source/RecastMeshDetail.cpp
+index 40f5b8c..d83bf1c 100644
+--- a/Recast/Source/RecastMeshDetail.cpp
++++ b/Recast/Source/RecastMeshDetail.cpp
+@@ -634,6 +634,40 @@ inline float getJitterY(const int i)
+ return (((i * 0xd8163841) & 0xffff) / 65535.0f * 2.0f) - 1.0f;
+ }
+
++static bool onHull(int a, int b, int nhull, int* hull)
++{
++ // All internal sampled points come after the hull so we can early out for those.
++ if (a >= nhull || b >= nhull)
++ return false;
++
++ for (int j = nhull - 1, i = 0; i < nhull; j = i++)
++ {
++ if (a == hull[j] && b == hull[i])
++ return true;
++ }
++
++ return false;
++}
++
++// Find edges that lie on hull and mark them as such.
++static void setTriFlags(rcIntArray& tris, int nhull, int* hull)
++{
++ // Matches DT_DETAIL_EDGE_BOUNDARY
++ const int DETAIL_EDGE_BOUNDARY = 0x1;
++
++ for (int i = 0; i < tris.size(); i += 4)
++ {
++ int a = tris[i + 0];
++ int b = tris[i + 1];
++ int c = tris[i + 2];
++ unsigned short flags = 0;
++ flags |= (onHull(a, b, nhull, hull) ? DETAIL_EDGE_BOUNDARY : 0) << 0;
++ flags |= (onHull(b, c, nhull, hull) ? DETAIL_EDGE_BOUNDARY : 0) << 2;
++ flags |= (onHull(c, a, nhull, hull) ? DETAIL_EDGE_BOUNDARY : 0) << 4;
++ tris[i + 3] = (int)flags;
++ }
++}
++
+ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
+ const float sampleDist, const float sampleMaxError,
+ const int heightSearchRadius, const rcCompactHeightfield& chf,
+@@ -771,6 +805,7 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
+ if (minExtent < sampleDist*2)
+ {
+ triangulateHull(nverts, verts, nhull, hull, nin, tris);
++ setTriFlags(tris, nhull, hull);
+ return true;
+ }
+
+@@ -875,7 +910,8 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
+ tris.resize(MAX_TRIS*4);
+ ctx->log(RC_LOG_ERROR, "rcBuildPolyMeshDetail: Shrinking triangle count from %d to max %d.", ntris, MAX_TRIS);
+ }
+-
++
++ setTriFlags(tris, nhull, hull);
+ return true;
+ }
+
+@@ -1137,30 +1173,6 @@ static void getHeightData(rcContext* ctx, const rcCompactHeightfield& chf,
+ }
+ }
+
+-static unsigned char getEdgeFlags(const float* va, const float* vb,
+- const float* vpoly, const int npoly)
+-{
+- // The flag returned by this function matches dtDetailTriEdgeFlags in Detour.
+- // Figure out if edge (va,vb) is part of the polygon boundary.
+- static const float thrSqr = rcSqr(0.001f);
+- for (int i = 0, j = npoly-1; i < npoly; j=i++)
+- {
+- if (distancePtSeg2d(va, &vpoly[j*3], &vpoly[i*3]) < thrSqr &&
+- distancePtSeg2d(vb, &vpoly[j*3], &vpoly[i*3]) < thrSqr)
+- return 1;
+- }
+- return 0;
+-}
+-
+-static unsigned char getTriFlags(const float* va, const float* vb, const float* vc,
+- const float* vpoly, const int npoly)
+-{
+- unsigned char flags = 0;
+- flags |= getEdgeFlags(va,vb,vpoly,npoly) << 0;
+- flags |= getEdgeFlags(vb,vc,vpoly,npoly) << 2;
+- flags |= getEdgeFlags(vc,va,vpoly,npoly) << 4;
+- return flags;
+-}
+
+ /// @par
+ ///
+@@ -1377,7 +1389,7 @@ bool rcBuildPolyMeshDetail(rcContext* ctx, const rcPolyMesh& mesh, const rcCompa
+ dmesh.tris[dmesh.ntris*4+0] = (unsigned char)t[0];
+ dmesh.tris[dmesh.ntris*4+1] = (unsigned char)t[1];
+ dmesh.tris[dmesh.ntris*4+2] = (unsigned char)t[2];
+- dmesh.tris[dmesh.ntris*4+3] = getTriFlags(&verts[t[0]*3], &verts[t[1]*3], &verts[t[2]*3], poly, npoly);
++ dmesh.tris[dmesh.ntris*4+3] = (unsigned char)t[3];
+ dmesh.ntris++;
+ }
+ }
diff --git a/vcpkg/ports/recastnavigation/portfile.cmake b/vcpkg/ports/recastnavigation/portfile.cmake
new file mode 100644
index 0000000..e6f4a0d
--- /dev/null
+++ b/vcpkg/ports/recastnavigation/portfile.cmake
@@ -0,0 +1,30 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO recastnavigation/recastnavigation
+ REF v${VERSION}
+ SHA512 7567aaa78219cc490a6f76210fba1f130f0c17aeaa06432ab1207e0fd03404abe31042e8b03971aa0d04ad65d39469f13575fe0072fb920c38581d39568b70fb
+ HEAD_REF master
+ PATCHES
+ fix-detail-mesh-edge-detection.patch #Upstream fix https://github.com/recastnavigation/recastnavigation/pull/657
+)
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DRECASTNAVIGATION_DEMO=OFF
+ -DRECASTNAVIGATION_TESTS=OFF
+ -DRECASTNAVIGATION_EXAMPLES=OFF
+
+)
+
+vcpkg_cmake_install()
+
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/recastnavigation)
+
+vcpkg_fixup_pkgconfig()
+
+vcpkg_copy_pdbs()
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/License.txt")
diff --git a/vcpkg/ports/recastnavigation/vcpkg.json b/vcpkg/ports/recastnavigation/vcpkg.json
new file mode 100644
index 0000000..8396706
--- /dev/null
+++ b/vcpkg/ports/recastnavigation/vcpkg.json
@@ -0,0 +1,18 @@
+{
+ "name": "recastnavigation",
+ "version": "1.6.0",
+ "port-version": 1,
+ "description": "Navigation-mesh Toolset for Games",
+ "homepage": "https://github.com/recastnavigation/recastnavigation",
+ "license": "Zlib",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}