aboutsummaryrefslogtreecommitdiff
path: root/dep/recastnavigation/recastnavigation.diff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2016-08-17 12:50:43 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-12 15:41:19 +0100
commite5ba8f1e4d771a0921b1be0dc1e66a2263b26a44 (patch)
tree296d92398e9f0f2bf4d9ba87dd84e20b7a7a2b07 /dep/recastnavigation/recastnavigation.diff
parenta2acd445fe738ba4b4c8283d13ec8b6029ec9037 (diff)
Core/MMAPs: Update recast
Update recast to https://github.com/recastnavigation/recastnavigation/commit/64385e9ed0822427bca5814d03a3f4c4d7a6db9f (cherry picked from commit 1d7013e0e2758b1468a488dd17e3f5c5ce5f265d) # Conflicts: # dep/PackageList.txt
Diffstat (limited to 'dep/recastnavigation/recastnavigation.diff')
-rw-r--r--dep/recastnavigation/recastnavigation.diff337
1 files changed, 47 insertions, 290 deletions
diff --git a/dep/recastnavigation/recastnavigation.diff b/dep/recastnavigation/recastnavigation.diff
index 0be25bc11d1..fe0c44a420e 100644
--- a/dep/recastnavigation/recastnavigation.diff
+++ b/dep/recastnavigation/recastnavigation.diff
@@ -1,37 +1,29 @@
-From 37b4c6d3d78ea676d8b300a282013a27a51912c1 Mon Sep 17 00:00:00 2001
+From 3790dbcc9cd4bdebbd3257ac8f3f9f28a0cf0485 Mon Sep 17 00:00:00 2001
From: jackpoz <giacomopoz@gmail.com>
Date: Fri, 20 Jun 2014 23:15:04 +0200
Subject: [PATCH] Add custom trinitycore changes
---
- Detour/Include/DetourNavMesh.h | 76 ++++++++++++------------------------
- Detour/Source/DetourNavMesh.cpp | 30 +++++---------
- Detour/Source/DetourNavMeshQuery.cpp | 5 ++-
- Detour/Source/DetourNode.cpp | 29 ++++----------
- Recast/Include/Recast.h | 8 ++--
- Recast/Source/RecastMeshDetail.cpp | 2 +-
- Recast/Source/RecastRegion.cpp | 2 +-
- 7 files changed, 50 insertions(+), 102 deletions(-)
+ Detour/Include/DetourNavMesh.h | 24 ++++++++++++++++++------
+ Detour/Source/DetourNavMeshQuery.cpp | 4 ++--
+ Recast/Include/Recast.h | 4 ++--
+ 3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/Detour/Include/DetourNavMesh.h b/Detour/Include/DetourNavMesh.h
-index 1060845..782ddbc 100644
+index 8ecd57e..f50f705 100644
--- a/Detour/Include/DetourNavMesh.h
+++ b/Detour/Include/DetourNavMesh.h
-@@ -22,39 +22,35 @@
- #include "DetourAlloc.h"
- #include "DetourStatus.h"
-
--// Undefine (or define in a build cofnig) the following line to use 64bit polyref.
--// Generally not needed, useful for very large worlds.
--// Note: tiles build using 32bit refs are not compatible with 64bit refs!
+@@ -25,13 +25,25 @@
+ // Undefine (or define in a build cofnig) the following line to use 64bit polyref.
+ // Generally not needed, useful for very large worlds.
+ // Note: tiles build using 32bit refs are not compatible with 64bit refs!
-//#define DT_POLYREF64 1
--
--#ifdef DT_POLYREF64
--// TODO: figure out a multiplatform version of uint64_t
--// - maybe: https://code.google.com/p/msinttypes/
--// - or: http://www.azillionmonkeys.com/qed/pstdint.h
-+
-+// Edited by TC
++#define DT_POLYREF64 1
+
+ #ifdef DT_POLYREF64
+ // TODO: figure out a multiplatform version of uint64_t
+ // - maybe: https://code.google.com/p/msinttypes/
+ // - or: http://www.azillionmonkeys.com/qed/pstdint.h
+#if defined(WIN32) && !defined(__MINGW32__)
+/// Do not rename back to uint64. Otherwise mac complains about typedef redefinition
+typedef unsigned __int64 uint64_d;
@@ -41,213 +33,51 @@ index 1060845..782ddbc 100644
+#ifdef __linux__
+#include <linux/types.h>
+#endif
- #endif
++#endif
+/// Do not rename back to uint64. Otherwise mac complains about typedef redefinition
+typedef uint64_t uint64_d;
+#endif
+ #endif
// Note: If you want to use 64-bit refs, change the types of both dtPolyRef & dtTileRef.
- // It is also recommended that you change dtHashRef() to a proper 64-bit hash.
-
-+// Edited by TC
-+// We cannot have over 31 bits for either tile nor poly
-+// without changing polyCount to use 64bits too.
+@@ -40,10 +52,10 @@
/// A handle to a polygon within a navigation mesh tile.
/// @ingroup detour
--#ifdef DT_POLYREF64
+ #ifdef DT_POLYREF64
-static const unsigned int DT_SALT_BITS = 16;
-static const unsigned int DT_TILE_BITS = 28;
-static const unsigned int DT_POLY_BITS = 20;
-typedef uint64_t dtPolyRef;
--#else
--typedef unsigned int dtPolyRef;
--#endif
-+typedef uint64_d dtPolyRef; // Edited by TC
-
++static const unsigned int DT_SALT_BITS = 12;
++static const unsigned int DT_TILE_BITS = 21;
++static const unsigned int DT_POLY_BITS = 31;
++typedef uint64_d dtPolyRef;
+ #else
+ typedef unsigned int dtPolyRef;
+ #endif
+@@ -51,7 +63,7 @@ typedef unsigned int dtPolyRef;
/// A handle to a tile within a navigation mesh.
/// @ingroup detour
--#ifdef DT_POLYREF64
+ #ifdef DT_POLYREF64
-typedef uint64_t dtTileRef;
--#else
--typedef unsigned int dtTileRef;
--#endif
-+typedef uint64_d dtTileRef; // Edited by TC
-
- /// The maximum number of vertices per navigation polygon.
- /// @ingroup detour
-@@ -94,6 +90,12 @@ static const unsigned int DT_OFFMESH_CON_BIDIR = 1;
- /// @ingroup detour
- static const int DT_MAX_AREAS = 64;
-
-+static const int STATIC_SALT_BITS = 12;
-+static const int STATIC_TILE_BITS = 21;
-+static const int STATIC_POLY_BITS = 31;
-+// we cannot have over 31 bits for either tile nor poly
-+// without changing polyCount to use 64bits too.
-+
- /// Tile flags used for various functions and fields.
- /// For an example, see dtNavMesh::addTile().
- enum dtTileFlags
-@@ -511,11 +513,7 @@ public:
- /// @param[in] ip The index of the polygon within the tile.
- inline dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
- {
--#ifdef DT_POLYREF64
-- return ((dtPolyRef)salt << (DT_POLY_BITS+DT_TILE_BITS)) | ((dtPolyRef)it << DT_POLY_BITS) | (dtPolyRef)ip;
--#else
- return ((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
--#endif
- }
-
- /// Decodes a standard polygon reference.
-@@ -527,21 +525,12 @@ public:
- /// @see #encodePolyId
- inline void decodePolyId(dtPolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip) const
- {
--#ifdef DT_POLYREF64
-- const dtPolyRef saltMask = ((dtPolyRef)1<<DT_SALT_BITS)-1;
-- const dtPolyRef tileMask = ((dtPolyRef)1<<DT_TILE_BITS)-1;
-- const dtPolyRef polyMask = ((dtPolyRef)1<<DT_POLY_BITS)-1;
-- salt = (unsigned int)((ref >> (DT_POLY_BITS+DT_TILE_BITS)) & saltMask);
-- it = (unsigned int)((ref >> DT_POLY_BITS) & tileMask);
-- ip = (unsigned int)(ref & polyMask);
--#else
- const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
- const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
- const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
- salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
- it = (unsigned int)((ref >> m_polyBits) & tileMask);
- ip = (unsigned int)(ref & polyMask);
--#endif
- }
-
- /// Extracts a tile's salt value from the specified polygon reference.
-@@ -550,13 +539,8 @@ public:
- /// @see #encodePolyId
- inline unsigned int decodePolyIdSalt(dtPolyRef ref) const
- {
--#ifdef DT_POLYREF64
-- const dtPolyRef saltMask = ((dtPolyRef)1<<DT_SALT_BITS)-1;
-- return (unsigned int)((ref >> (DT_POLY_BITS+DT_TILE_BITS)) & saltMask);
--#else
- const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
- return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
--#endif
- }
-
- /// Extracts the tile's index from the specified polygon reference.
-@@ -565,13 +549,8 @@ public:
- /// @see #encodePolyId
- inline unsigned int decodePolyIdTile(dtPolyRef ref) const
- {
--#ifdef DT_POLYREF64
-- const dtPolyRef tileMask = ((dtPolyRef)1<<DT_TILE_BITS)-1;
-- return (unsigned int)((ref >> DT_POLY_BITS) & tileMask);
--#else
- const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
- return (unsigned int)((ref >> m_polyBits) & tileMask);
--#endif
- }
-
- /// Extracts the polygon's index (within its tile) from the specified polygon reference.
-@@ -580,13 +559,8 @@ public:
- /// @see #encodePolyId
- inline unsigned int decodePolyIdPoly(dtPolyRef ref) const
- {
--#ifdef DT_POLYREF64
-- const dtPolyRef polyMask = ((dtPolyRef)1<<DT_POLY_BITS)-1;
-- return (unsigned int)(ref & polyMask);
--#else
- const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
- return (unsigned int)(ref & polyMask);
--#endif
- }
-
- /// @}
-@@ -645,11 +619,9 @@ private:
- dtMeshTile* m_nextFree; ///< Freelist of tiles.
- dtMeshTile* m_tiles; ///< List of tiles.
-
--#ifndef DT_POLYREF64
- unsigned int m_saltBits; ///< Number of salt bits in the tile ID.
- unsigned int m_tileBits; ///< Number of tile bits in the tile ID.
- unsigned int m_polyBits; ///< Number of poly bits in the tile ID.
--#endif
- };
-
- /// Allocates a navigation mesh object using the Detour allocator.
-diff --git a/Detour/Source/DetourNavMesh.cpp b/Detour/Source/DetourNavMesh.cpp
-index d353d08..e8a679b 100644
---- a/Detour/Source/DetourNavMesh.cpp
-+++ b/Detour/Source/DetourNavMesh.cpp
-@@ -193,13 +193,11 @@ dtNavMesh::dtNavMesh() :
- m_tileLutMask(0),
- m_posLookup(0),
- m_nextFree(0),
-- m_tiles(0)
-+ m_tiles(0),
-+ m_saltBits(0),
-+ m_tileBits(0),
-+ m_polyBits(0)
- {
--#ifndef DT_POLYREF64
-- m_saltBits = 0;
-- m_tileBits = 0;
-- m_polyBits = 0;
--#endif
- memset(&m_params, 0, sizeof(dtNavMeshParams));
- m_orig[0] = 0;
- m_orig[1] = 0;
-@@ -250,17 +248,11 @@ dtStatus dtNavMesh::init(const dtNavMeshParams* params)
- m_nextFree = &m_tiles[i];
- }
-
-- // Init ID generator values.
--#ifndef DT_POLYREF64
-- m_tileBits = dtIlog2(dtNextPow2((unsigned int)params->maxTiles));
-- m_polyBits = dtIlog2(dtNextPow2((unsigned int)params->maxPolys));
-- // Only allow 31 salt bits, since the salt mask is calculated using 32bit uint and it will overflow.
-- m_saltBits = dtMin((unsigned int)31, 32 - m_tileBits - m_polyBits);
--
-- if (m_saltBits < 10)
-- return DT_FAILURE | DT_INVALID_PARAM;
--#endif
--
-+ // Edited by TC
-+ m_tileBits = STATIC_TILE_BITS;
-+ m_polyBits = STATIC_POLY_BITS;
-+ m_saltBits = STATIC_SALT_BITS;
-+
- return DT_SUCCESS;
- }
-
-@@ -1242,11 +1234,7 @@ dtStatus dtNavMesh::removeTile(dtTileRef ref, unsigned char** data, int* dataSiz
- tile->offMeshCons = 0;
-
- // Update salt, salt should never be zero.
--#ifdef DT_POLYREF64
-- tile->salt = (tile->salt+1) & ((1<<DT_SALT_BITS)-1);
--#else
- tile->salt = (tile->salt+1) & ((1<<m_saltBits)-1);
--#endif
- if (tile->salt == 0)
- tile->salt++;
-
++typedef uint64_d dtTileRef;
+ #else
+ typedef unsigned int dtTileRef;
+ #endif
diff --git a/Detour/Source/DetourNavMeshQuery.cpp b/Detour/Source/DetourNavMeshQuery.cpp
-index 5fbc83e..fbf3724 100644
+index 75af102..a263106 100644
--- a/Detour/Source/DetourNavMeshQuery.cpp
+++ b/Detour/Source/DetourNavMeshQuery.cpp
-@@ -100,7 +100,8 @@ inline float dtQueryFilter::getCost(const float* pa, const float* pb,
+@@ -100,7 +100,7 @@ inline float dtQueryFilter::getCost(const float* pa, const float* pb,
}
#endif
-static const float H_SCALE = 0.999f; // Search heuristic scale.
-+// Edited by TC
+static const float H_SCALE = 2.0f; // Search heuristic scale.
dtNavMeshQuery* dtAllocNavMeshQuery()
-@@ -3501,7 +3502,7 @@ dtStatus dtNavMeshQuery::findDistanceToWall(dtPolyRef startRef, const float* cen
+@@ -3623,7 +3623,7 @@ dtStatus dtNavMeshQuery::findDistanceToWall(dtPolyRef startRef, const float* cen
dtVsub(hitNormal, centerPos, hitPos);
dtVnormalize(hitNormal);
@@ -256,101 +86,28 @@ index 5fbc83e..fbf3724 100644
return status;
}
-diff --git a/Detour/Source/DetourNode.cpp b/Detour/Source/DetourNode.cpp
-index 5cf6548..1d18977 100644
---- a/Detour/Source/DetourNode.cpp
-+++ b/Detour/Source/DetourNode.cpp
-@@ -22,30 +22,17 @@
- #include "DetourCommon.h"
- #include <string.h>
-
--#ifdef DT_POLYREF64
--// From Thomas Wang, https://gist.github.com/badboy/6267743
- inline unsigned int dtHashRef(dtPolyRef a)
- {
-- a = (~a) + (a << 18); // a = (a << 18) - a - 1;
-- a = a ^ (a >> 31);
-- a = a * 21; // a = (a + (a << 2)) + (a << 4);
-- a = a ^ (a >> 11);
-- a = a + (a << 6);
-- a = a ^ (a >> 22);
-- return (unsigned int)a;
-+ // Edited by TC
-+ a = (~a) + (a << 18);
-+ a = a ^ (a >> 31);
-+ a = a * 21;
-+ a = a ^ (a >> 11);
-+ a = a + (a << 6);
-+ a = a ^ (a >> 22);
-+ return (unsigned int)a;
- }
--#else
--inline unsigned int dtHashRef(dtPolyRef a)
--{
-- a += ~(a<<15);
-- a ^= (a>>10);
-- a += (a<<3);
-- a ^= (a>>6);
-- a += ~(a<<11);
-- a ^= (a>>16);
-- return (unsigned int)a;
--}
--#endif
-
- //////////////////////////////////////////////////////////////////////////////////////////
- dtNodePool::dtNodePool(int maxNodes, int hashSize) :
diff --git a/Recast/Include/Recast.h b/Recast/Include/Recast.h
-index d8bdde2..d3e9219 100644
+index e85c0d2..79d77e4 100644
--- a/Recast/Include/Recast.h
+++ b/Recast/Include/Recast.h
-@@ -243,7 +243,7 @@ struct rcConfig
+@@ -263,7 +263,7 @@ struct rcConfig
};
/// Defines the number of bits allocated to rcSpan::smin and rcSpan::smax.
-static const int RC_SPAN_HEIGHT_BITS = 13;
-+static const int RC_SPAN_HEIGHT_BITS = 16; // EDITED BY TC
++static const int RC_SPAN_HEIGHT_BITS = 16;
/// Defines the maximum value for rcSpan::smin and rcSpan::smax.
- static const int RC_SPAN_MAX_HEIGHT = (1<<RC_SPAN_HEIGHT_BITS)-1;
+ static const int RC_SPAN_MAX_HEIGHT = (1 << RC_SPAN_HEIGHT_BITS) - 1;
-@@ -255,9 +255,9 @@ static const int RC_SPANS_PER_POOL = 2048;
- /// @see rcHeightfield
- struct rcSpan
+@@ -277,7 +277,7 @@ struct rcSpan
{
-- unsigned int smin : 13; ///< The lower limit of the span. [Limit: < #smax]
-- unsigned int smax : 13; ///< The upper limit of the span. [Limit: <= #RC_SPAN_MAX_HEIGHT]
-- unsigned int area : 6; ///< The area id assigned to the span.
-+ unsigned int smin : 16; ///< The lower limit of the span. [Limit: < #smax]
-+ unsigned int smax : 16; ///< The upper limit of the span. [Limit: <= #RC_SPAN_MAX_HEIGHT]
-+ unsigned char area; ///< The area id assigned to the span.
- rcSpan* next; ///< The next span higher up in column.
+ unsigned int smin : RC_SPAN_HEIGHT_BITS; ///< The lower limit of the span. [Limit: < #smax]
+ unsigned int smax : RC_SPAN_HEIGHT_BITS; ///< The upper limit of the span. [Limit: <= #RC_SPAN_MAX_HEIGHT]
+- unsigned int area : 6; ///< The area id assigned to the span.
++ unsigned char area; ///< The area id assigned to the span.
+ rcSpan* next; ///< The next span higher up in column.
};
-diff --git a/Recast/Source/RecastMeshDetail.cpp b/Recast/Source/RecastMeshDetail.cpp
-index c0bba6f..56b059d 100644
---- a/Recast/Source/RecastMeshDetail.cpp
-+++ b/Recast/Source/RecastMeshDetail.cpp
-@@ -511,7 +511,7 @@ static float polyMinExtent(const float* verts, const int nverts)
- inline int prev(int i, int n) { return i-1 >= 0 ? i-1 : n-1; }
- inline int next(int i, int n) { return i+1 < n ? i+1 : 0; }
-
--static void triangulateHull(const int nverts, const float* verts, const int nhull, const int* hull, rcIntArray& tris)
-+static void triangulateHull(const int /*nverts*/, const float* verts, const int nhull, const int* hull, rcIntArray& tris)
- {
- int start = 0, left = 1, right = nhull-1;
-
-diff --git a/Recast/Source/RecastRegion.cpp b/Recast/Source/RecastRegion.cpp
-index 38bc4ff..352ba57 100644
---- a/Recast/Source/RecastRegion.cpp
-+++ b/Recast/Source/RecastRegion.cpp
-@@ -1041,7 +1041,7 @@ static void addUniqueConnection(rcRegion& reg, int n)
- static bool mergeAndFilterLayerRegions(rcContext* ctx, int minRegionArea,
- unsigned short& maxRegionId,
- rcCompactHeightfield& chf,
-- unsigned short* srcReg, rcIntArray& overlaps)
-+ unsigned short* srcReg, rcIntArray& /*overlaps*/)
- {
- const int w = chf.width;
- const int h = chf.height;
--
-1.9.5.msysgit.0
+2.9.0.windows.1