From 6203bbddbe32a3453363cfee0418e52977508b9e Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 28 Jul 2024 22:45:10 +0200 Subject: [PATCH] Recast: add missing straight path types Should've been part of commit 47aee3125d9371a82a090638f3f5a962fe9971ac --- .../recast/Detour/Include/DetourNavMesh.h | 3 +++ .../Detour/Include/DetourNavMeshQuery.h | 26 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/thirdparty/recast/Detour/Include/DetourNavMesh.h b/src/thirdparty/recast/Detour/Include/DetourNavMesh.h index 9b7bc2e1..b26e2ed9 100644 --- a/src/thirdparty/recast/Detour/Include/DetourNavMesh.h +++ b/src/thirdparty/recast/Detour/Include/DetourNavMesh.h @@ -136,6 +136,9 @@ static const unsigned int DT_OFFMESH_CON_BIDIR = 1; /// A value that determines the offset between the start pos and the ref pos in an off-mesh connection. static const float DT_OFFMESH_CON_REFPOS_OFFSET = 35.f; +/// A value that determines the maximum number of points describing the straight path result. +static const int DT_STRAIGHT_PATH_RESOLUTION = 5; + /// The maximum number of user defined area ids. /// @ingroup detour static const int DT_MAX_AREAS = 32; // <-- confirmed 32 see [r5apex_ds.exe + 0xf47dda] '-> test [rcx+80h], ax'. diff --git a/src/thirdparty/recast/Detour/Include/DetourNavMeshQuery.h b/src/thirdparty/recast/Detour/Include/DetourNavMeshQuery.h index 6dbe3b01..084f87a8 100644 --- a/src/thirdparty/recast/Detour/Include/DetourNavMeshQuery.h +++ b/src/thirdparty/recast/Detour/Include/DetourNavMeshQuery.h @@ -143,10 +143,34 @@ struct dtRaycastHit /// The maximum number of polygons the @p path array can hold. int maxPath; - /// The cost of the path until hit. + /// The cost of the path until hit. float pathCost; }; +/// Provides information about straight path generation +/// filled by dtNavMeshQuery::findStraightPath +/// @ingroup detour +struct dtStraightPathResult +{ + /// The number of points in the straight path. + int pathCount; + + /// The points describing the straight path. + float path[3][DT_STRAIGHT_PATH_RESOLUTION]; + + /// The array of polygon references that represent the path corridor. + dtPolyRef polys[DT_STRAIGHT_PATH_RESOLUTION]; + + /// The jumps describing each point. + unsigned char jumps[DT_STRAIGHT_PATH_RESOLUTION]; + + /// The flags describing each point. + unsigned char flags[DT_STRAIGHT_PATH_RESOLUTION]; + + /// Whether the end of the path is the goal destination. + bool pathEndIsGoal; +}; + /// Provides custom polygon query behavior. /// Used by dtNavMeshQuery::queryPolygons. /// @ingroup detour