mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Dependencies: Update recast
Update recast to 1dd5cf1883
Fix 2 warnings.
These changes have no effect on MMAPs and it's not needed to re-extact them.
This commit is contained in:
@@ -46,4 +46,4 @@ gSOAP (a portable development toolkit for C and C++ XML Web services and XML dat
|
||||
|
||||
recastnavigation (Recast is state of the art navigation mesh construction toolset for games)
|
||||
https://github.com/memononen/recastnavigation
|
||||
Version: 42b96b7306d39bb7680ddb0f89d480a8296c83ff
|
||||
Version: 1dd5cf1883d61e723fef3d4957cf758c50e7a52b
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef DETOURCOMMON_H
|
||||
#define DETOURCOMMON_H
|
||||
|
||||
#include "DetourMath.h"
|
||||
|
||||
/**
|
||||
@defgroup detour Detour
|
||||
|
||||
@@ -71,11 +73,6 @@ template<class T> inline T dtSqr(T a) { return a*a; }
|
||||
/// @return The value, clamped to the specified range.
|
||||
template<class T> inline T dtClamp(T v, T mn, T mx) { return v < mn ? mn : (v > mx ? mx : v); }
|
||||
|
||||
/// Returns the square root of the value.
|
||||
/// @param[in] x The value.
|
||||
/// @return The square root of the vlaue.
|
||||
float dtSqrt(float x);
|
||||
|
||||
/// @}
|
||||
/// @name Vector helper functions.
|
||||
/// @{
|
||||
@@ -202,7 +199,7 @@ inline void dtVcopy(float* dest, const float* a)
|
||||
/// @return The scalar length of the vector.
|
||||
inline float dtVlen(const float* v)
|
||||
{
|
||||
return dtSqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
||||
return dtMathSqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
|
||||
}
|
||||
|
||||
/// Derives the square of the scalar length of the vector. (len * len)
|
||||
@@ -222,7 +219,7 @@ inline float dtVdist(const float* v1, const float* v2)
|
||||
const float dx = v2[0] - v1[0];
|
||||
const float dy = v2[1] - v1[1];
|
||||
const float dz = v2[2] - v1[2];
|
||||
return dtSqrt(dx*dx + dy*dy + dz*dz);
|
||||
return dtMathSqrtf(dx*dx + dy*dy + dz*dz);
|
||||
}
|
||||
|
||||
/// Returns the square of the distance between two points.
|
||||
@@ -247,7 +244,7 @@ inline float dtVdist2D(const float* v1, const float* v2)
|
||||
{
|
||||
const float dx = v2[0] - v1[0];
|
||||
const float dz = v2[2] - v1[2];
|
||||
return dtSqrt(dx*dx + dz*dz);
|
||||
return dtMathSqrtf(dx*dx + dz*dz);
|
||||
}
|
||||
|
||||
/// Derives the square of the distance between the specified points on the xz-plane.
|
||||
@@ -265,7 +262,7 @@ inline float dtVdist2DSqr(const float* v1, const float* v2)
|
||||
/// @param[in,out] v The vector to normalize. [(x, y, z)]
|
||||
inline void dtVnormalize(float* v)
|
||||
{
|
||||
float d = 1.0f / dtSqrt(dtSqr(v[0]) + dtSqr(v[1]) + dtSqr(v[2]));
|
||||
float d = 1.0f / dtMathSqrtf(dtSqr(v[0]) + dtSqr(v[1]) + dtSqr(v[2]));
|
||||
v[0] *= d;
|
||||
v[1] *= d;
|
||||
v[2] *= d;
|
||||
|
||||
20
dep/recastnavigation/Detour/Include/DetourMath.h
Normal file
20
dep/recastnavigation/Detour/Include/DetourMath.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
@defgroup detour Detour
|
||||
|
||||
Members in this module are wrappers around the standard math library
|
||||
*/
|
||||
|
||||
#ifndef DETOURMATH_H
|
||||
#define DETOURMATH_H
|
||||
|
||||
#include <math.h>
|
||||
|
||||
inline float dtMathFabsf(float x) { return fabsf(x); }
|
||||
inline float dtMathSqrtf(float x) { return sqrtf(x); }
|
||||
inline float dtMathFloorf(float x) { return floorf(x); }
|
||||
inline float dtMathCeilf(float x) { return ceilf(x); }
|
||||
inline float dtMathCosf(float x) { return cosf(x); }
|
||||
inline float dtMathSinf(float x) { return sinf(x); }
|
||||
inline float dtMathAtan2f(float y, float x) { return atan2f(y, x); }
|
||||
|
||||
#endif
|
||||
@@ -16,16 +16,11 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include "DetourCommon.h"
|
||||
#include "DetourMath.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float dtSqrt(float x)
|
||||
{
|
||||
return sqrtf(x);
|
||||
}
|
||||
|
||||
void dtClosestPtPointTriangle(float* closest, const float* p,
|
||||
const float* a, const float* b, const float* c)
|
||||
{
|
||||
@@ -360,7 +355,7 @@ void dtRandomPointInConvexPoly(const float* pts, const int npts, float* areas,
|
||||
acc += dacc;
|
||||
}
|
||||
|
||||
float v = dtSqrt(t);
|
||||
float v = dtMathSqrtf(t);
|
||||
|
||||
const float a = 1 - v;
|
||||
const float b = (1 - u) * v;
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourNode.h"
|
||||
#include "DetourCommon.h"
|
||||
#include "DetourMath.h"
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourAssert.h"
|
||||
#include <new>
|
||||
@@ -709,7 +709,7 @@ dtPolyRef dtNavMesh::findNearestPolyInTile(const dtMeshTile* tile,
|
||||
float closestPtPoly[3];
|
||||
float diff[3];
|
||||
bool posOverPoly = false;
|
||||
float d = 0;
|
||||
float d;
|
||||
closestPointOnPoly(ref, center, closestPtPoly, &posOverPoly);
|
||||
|
||||
// If a point is directly over a polygon and closer than
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourCommon.h"
|
||||
#include "DetourMath.h"
|
||||
#include "DetourNavMeshBuilder.h"
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourAssert.h"
|
||||
@@ -202,8 +202,8 @@ static int createBVTree(const unsigned short* verts, const int /*nverts*/,
|
||||
if (z > it.bmax[2]) it.bmax[2] = z;
|
||||
}
|
||||
// Remap y
|
||||
it.bmin[1] = (unsigned short)floorf((float)it.bmin[1]*ch/cs);
|
||||
it.bmax[1] = (unsigned short)ceilf((float)it.bmax[1]*ch/cs);
|
||||
it.bmin[1] = (unsigned short)dtMathFloorf((float)it.bmin[1]*ch/cs);
|
||||
it.bmax[1] = (unsigned short)dtMathCeilf((float)it.bmax[1]*ch/cs);
|
||||
}
|
||||
|
||||
int curNode = 0;
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <string.h>
|
||||
#include "DetourNavMeshQuery.h"
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourNode.h"
|
||||
#include "DetourCommon.h"
|
||||
#include "DetourMath.h"
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourAssert.h"
|
||||
#include <new>
|
||||
@@ -99,9 +99,9 @@ inline float dtQueryFilter::getCost(const float* pa, const float* pb,
|
||||
return dtVdist(pa, pb) * m_areaCost[curPoly->getArea()];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Edited by TC
|
||||
static const float H_SCALE = 2.0f; // Search heuristic scale.
|
||||
static const float H_SCALE = 2.0f; // Search heuristic scale.
|
||||
|
||||
|
||||
dtNavMeshQuery* dtAllocNavMeshQuery()
|
||||
@@ -309,7 +309,7 @@ dtStatus dtNavMeshQuery::findRandomPoint(const dtQueryFilter* filter, float (*fr
|
||||
return DT_SUCCESS;
|
||||
}
|
||||
|
||||
dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const float* centerPos, const float radius,
|
||||
dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const float* centerPos, const float maxRadius,
|
||||
const dtQueryFilter* filter, float (*frand)(),
|
||||
dtPolyRef* randomRef, float* randomPt) const
|
||||
{
|
||||
@@ -341,7 +341,7 @@ dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const f
|
||||
|
||||
dtStatus status = DT_SUCCESS;
|
||||
|
||||
const float radiusSqr = dtSqr(radius);
|
||||
const float radiusSqr = dtSqr(maxRadius);
|
||||
float areaSum = 0.0f;
|
||||
|
||||
const dtMeshTile* randomTile = 0;
|
||||
@@ -705,7 +705,7 @@ dtStatus dtNavMeshQuery::getPolyHeight(dtPolyRef ref, const float* pos, float* h
|
||||
/// @p nearestRef before using @p nearestPt.
|
||||
///
|
||||
/// @warning This function is not suitable for large area searches. If the search
|
||||
/// extents overlaps more than 128 polygons it may return an invalid result.
|
||||
/// extents overlaps more than MAX_SEARCH (128) polygons it may return an invalid result.
|
||||
///
|
||||
dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* extents,
|
||||
const dtQueryFilter* filter,
|
||||
@@ -716,9 +716,10 @@ dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* exten
|
||||
*nearestRef = 0;
|
||||
|
||||
// Get nearby polygons from proximity grid.
|
||||
dtPolyRef polys[128];
|
||||
const int MAX_SEARCH = 128;
|
||||
dtPolyRef polys[MAX_SEARCH];
|
||||
int polyCount = 0;
|
||||
if (dtStatusFailed(queryPolygons(center, extents, filter, polys, &polyCount, 128)))
|
||||
if (dtStatusFailed(queryPolygons(center, extents, filter, polys, &polyCount, MAX_SEARCH)))
|
||||
return DT_FAILURE | DT_INVALID_PARAM;
|
||||
|
||||
// Find nearest polygon amongst the nearby polygons.
|
||||
@@ -1304,12 +1305,8 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters)
|
||||
if (!m_query.filter->passFilter(neighbourRef, neighbourTile, neighbourPoly))
|
||||
continue;
|
||||
|
||||
// deal explicitly with crossing tile boundaries
|
||||
unsigned char crossSide = 0;
|
||||
if (bestTile->links[i].side != 0xff)
|
||||
crossSide = bestTile->links[i].side >> 1;
|
||||
|
||||
dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, crossSide);
|
||||
// get the neighbor node
|
||||
dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, 0);
|
||||
if (!neighbourNode)
|
||||
{
|
||||
m_query.status |= DT_OUT_OF_NODES;
|
||||
|
||||
@@ -1083,7 +1083,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
/// @returns True if the operation completed successfully.
|
||||
bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
const float maxError, const int maxEdgeLen,
|
||||
rcContourSet& cset, const int flags = RC_CONTOUR_TESS_WALL_EDGES);
|
||||
rcContourSet& cset, const int buildFlags = RC_CONTOUR_TESS_WALL_EDGES);
|
||||
|
||||
/// Builds a polygon mesh from the provided contours.
|
||||
/// @ingroup recast
|
||||
|
||||
@@ -238,7 +238,7 @@ static void calcTriNormal(const float* v0, const float* v1, const float* v2, flo
|
||||
|
||||
/// @par
|
||||
///
|
||||
/// Only sets the aread id's for the walkable triangles. Does not alter the
|
||||
/// Only sets the area id's for the walkable triangles. Does not alter the
|
||||
/// area id's for unwalkable triangles.
|
||||
///
|
||||
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||
@@ -267,7 +267,7 @@ void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
||||
|
||||
/// @par
|
||||
///
|
||||
/// Only sets the aread id's for the unwalkable triangles. Does not alter the
|
||||
/// Only sets the area id's for the unwalkable triangles. Does not alter the
|
||||
/// area id's for walkable triangles.
|
||||
///
|
||||
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||
@@ -318,7 +318,7 @@ int rcGetHeightFieldSpanCount(rcContext* ctx, rcHeightfield& hf)
|
||||
/// @par
|
||||
///
|
||||
/// This is just the beginning of the process of fully building a compact heightfield.
|
||||
/// Various filters may be applied applied, then the distance field and regions built.
|
||||
/// Various filters may be applied, then the distance field and regions built.
|
||||
/// E.g: #rcBuildDistanceField and #rcBuildRegions
|
||||
///
|
||||
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||
@@ -486,4 +486,4 @@ static int getCompactHeightFieldMemoryusage(const rcCompactHeightfield& chf)
|
||||
size += sizeof(rcCompactCell) * chf.width * chf.height;
|
||||
return size;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -464,7 +464,7 @@ static int calcAreaOfPolygon2D(const int* verts, const int nverts)
|
||||
}
|
||||
|
||||
// TODO: these are the same as in RecastMesh.cpp, consider using the same.
|
||||
|
||||
// Last time I checked the if version got compiled using cmov, which was a lot faster than module (with idiv).
|
||||
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; }
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ struct rcLayerRegion
|
||||
unsigned char layerId; // Layer ID
|
||||
unsigned char nlayers; // Layer count
|
||||
unsigned char nneis; // Neighbour count
|
||||
unsigned char base; // Flag indicating if the region is the base of merged regions.
|
||||
unsigned char base; // Flag indicating if the region is the base of merged regions.
|
||||
};
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
for (int i = 0; i < nregs; ++i)
|
||||
{
|
||||
rcLayerRegion& root = regs[i];
|
||||
// Skip alreadu visited.
|
||||
// Skip already visited.
|
||||
if (root.layerId != 0xff)
|
||||
continue;
|
||||
|
||||
@@ -368,7 +368,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
rcLayerRegion& rj = regs[j];
|
||||
if (!rj.base) continue;
|
||||
|
||||
// Skip if teh regions are not close to each other.
|
||||
// Skip if the regions are not close to each other.
|
||||
if (!overlapRange(ri.ymin,ri.ymax+mergeHeight, rj.ymin,rj.ymax+mergeHeight))
|
||||
continue;
|
||||
// Skip if the height range would become too large.
|
||||
@@ -377,7 +377,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
if ((ymax - ymin) >= 255)
|
||||
continue;
|
||||
|
||||
// Make sure that there is no overlap when mergin 'ri' and 'rj'.
|
||||
// Make sure that there is no overlap when merging 'ri' and 'rj'.
|
||||
bool overlap = false;
|
||||
// Iterate over all regions which have the same layerId as 'rj'
|
||||
for (int k = 0; k < nregs; ++k)
|
||||
@@ -417,7 +417,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
// Add overlaid layers from 'rj' to 'ri'.
|
||||
for (int k = 0; k < rj.nlayers; ++k)
|
||||
addUnique(ri.layers, ri.nlayers, rj.layers[k]);
|
||||
// Update heigh bounds.
|
||||
// Update height bounds.
|
||||
ri.ymin = rcMin(ri.ymin, rj.ymin);
|
||||
ri.ymax = rcMax(ri.ymax, rj.ymax);
|
||||
}
|
||||
@@ -481,10 +481,8 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
for (int i = 0; i < lset.nlayers; ++i)
|
||||
{
|
||||
unsigned char curId = (unsigned char)i;
|
||||
|
||||
// Allocate memory for the current layer.
|
||||
|
||||
rcHeightfieldLayer* layer = &lset.layers[i];
|
||||
memset(layer, 0, sizeof(rcHeightfieldLayer));
|
||||
|
||||
const int gridSize = sizeof(unsigned char)*lw*lh;
|
||||
|
||||
@@ -528,7 +526,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
layer->cs = chf.cs;
|
||||
layer->ch = chf.ch;
|
||||
|
||||
// Adjust the bbox to fit the heighfield.
|
||||
// Adjust the bbox to fit the heightfield.
|
||||
rcVcopy(layer->bmin, bmin);
|
||||
rcVcopy(layer->bmax, bmax);
|
||||
layer->bmin[1] = bmin[1] + hmin*chf.ch;
|
||||
@@ -542,7 +540,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
layer->miny = layer->height;
|
||||
layer->maxy = 0;
|
||||
|
||||
// Copy height and area from compact heighfield.
|
||||
// Copy height and area from compact heightfield.
|
||||
for (int y = 0; y < lh; ++y)
|
||||
{
|
||||
for (int x = 0; x < lw; ++x)
|
||||
|
||||
@@ -160,6 +160,7 @@ static unsigned short addVertex(unsigned short x, unsigned short y, unsigned sho
|
||||
return (unsigned short)i;
|
||||
}
|
||||
|
||||
// Last time I checked the if version got compiled using cmov, which was a lot faster than module (with idiv).
|
||||
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; }
|
||||
|
||||
@@ -746,7 +747,7 @@ static bool removeVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned short
|
||||
}
|
||||
|
||||
// Remove vertex.
|
||||
for (int i = (int)rem; i < mesh.nverts; ++i)
|
||||
for (int i = (int)rem; i < mesh.nverts - 1; ++i)
|
||||
{
|
||||
mesh.verts[i*3+0] = mesh.verts[(i+1)*3+0];
|
||||
mesh.verts[i*3+1] = mesh.verts[(i+1)*3+1];
|
||||
@@ -836,7 +837,7 @@ static bool removeVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned short
|
||||
}
|
||||
|
||||
rcScopedDelete<int> thole = (int*)rcAlloc(sizeof(int)*nhole, RC_ALLOC_TEMP);
|
||||
if (!tverts)
|
||||
if (!thole)
|
||||
{
|
||||
ctx->log(RC_LOG_WARNING, "removeVertex: Out of memory 'thole' (%d).", nhole);
|
||||
return false;
|
||||
@@ -875,7 +876,7 @@ static bool removeVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned short
|
||||
return false;
|
||||
}
|
||||
rcScopedDelete<unsigned char> pareas = (unsigned char*)rcAlloc(sizeof(unsigned char)*ntris, RC_ALLOC_TEMP);
|
||||
if (!pregs)
|
||||
if (!pareas)
|
||||
{
|
||||
ctx->log(RC_LOG_ERROR, "removeVertex: Out of memory 'pareas' (%d).", ntris);
|
||||
return false;
|
||||
|
||||
@@ -237,8 +237,8 @@ static unsigned short getHeight(const float fx, const float fy, const float fz,
|
||||
|
||||
enum EdgeValues
|
||||
{
|
||||
UNDEF = -1,
|
||||
HULL = -2,
|
||||
EV_UNDEF = -1,
|
||||
EV_HULL = -2,
|
||||
};
|
||||
|
||||
static int findEdge(const int* edges, int nedges, int s, int t)
|
||||
@@ -249,7 +249,7 @@ static int findEdge(const int* edges, int nedges, int s, int t)
|
||||
if ((e[0] == s && e[1] == t) || (e[0] == t && e[1] == s))
|
||||
return i;
|
||||
}
|
||||
return UNDEF;
|
||||
return EV_UNDEF;
|
||||
}
|
||||
|
||||
static int addEdge(rcContext* ctx, int* edges, int& nedges, const int maxEdges, int s, int t, int l, int r)
|
||||
@@ -257,12 +257,12 @@ static int addEdge(rcContext* ctx, int* edges, int& nedges, const int maxEdges,
|
||||
if (nedges >= maxEdges)
|
||||
{
|
||||
ctx->log(RC_LOG_ERROR, "addEdge: Too many edges (%d/%d).", nedges, maxEdges);
|
||||
return UNDEF;
|
||||
return EV_UNDEF;
|
||||
}
|
||||
|
||||
// Add edge if not already in the triangulation.
|
||||
int e = findEdge(edges, nedges, s, t);
|
||||
if (e == UNDEF)
|
||||
if (e == EV_UNDEF)
|
||||
{
|
||||
int* edge = &edges[nedges*4];
|
||||
edge[0] = s;
|
||||
@@ -273,15 +273,15 @@ static int addEdge(rcContext* ctx, int* edges, int& nedges, const int maxEdges,
|
||||
}
|
||||
else
|
||||
{
|
||||
return UNDEF;
|
||||
return EV_UNDEF;
|
||||
}
|
||||
}
|
||||
|
||||
static void updateLeftFace(int* e, int s, int t, int f)
|
||||
{
|
||||
if (e[0] == s && e[1] == t && e[2] == UNDEF)
|
||||
if (e[0] == s && e[1] == t && e[2] == EV_UNDEF)
|
||||
e[2] = f;
|
||||
else if (e[1] == s && e[0] == t && e[3] == UNDEF)
|
||||
else if (e[1] == s && e[0] == t && e[3] == EV_UNDEF)
|
||||
e[3] = f;
|
||||
}
|
||||
|
||||
@@ -322,12 +322,12 @@ static void completeFacet(rcContext* ctx, const float* pts, int npts, int* edges
|
||||
|
||||
// Cache s and t.
|
||||
int s,t;
|
||||
if (edge[2] == UNDEF)
|
||||
if (edge[2] == EV_UNDEF)
|
||||
{
|
||||
s = edge[0];
|
||||
t = edge[1];
|
||||
}
|
||||
else if (edge[3] == UNDEF)
|
||||
else if (edge[3] == EV_UNDEF)
|
||||
{
|
||||
s = edge[1];
|
||||
t = edge[0];
|
||||
@@ -390,15 +390,15 @@ static void completeFacet(rcContext* ctx, const float* pts, int npts, int* edges
|
||||
|
||||
// Add new edge or update face info of old edge.
|
||||
e = findEdge(edges, nedges, pt, s);
|
||||
if (e == UNDEF)
|
||||
addEdge(ctx, edges, nedges, maxEdges, pt, s, nfaces, UNDEF);
|
||||
if (e == EV_UNDEF)
|
||||
addEdge(ctx, edges, nedges, maxEdges, pt, s, nfaces, EV_UNDEF);
|
||||
else
|
||||
updateLeftFace(&edges[e*4], pt, s, nfaces);
|
||||
|
||||
// Add new edge or update face info of old edge.
|
||||
e = findEdge(edges, nedges, t, pt);
|
||||
if (e == UNDEF)
|
||||
addEdge(ctx, edges, nedges, maxEdges, t, pt, nfaces, UNDEF);
|
||||
if (e == EV_UNDEF)
|
||||
addEdge(ctx, edges, nedges, maxEdges, t, pt, nfaces, EV_UNDEF);
|
||||
else
|
||||
updateLeftFace(&edges[e*4], t, pt, nfaces);
|
||||
|
||||
@@ -406,7 +406,7 @@ static void completeFacet(rcContext* ctx, const float* pts, int npts, int* edges
|
||||
}
|
||||
else
|
||||
{
|
||||
updateLeftFace(&edges[e*4], s, t, HULL);
|
||||
updateLeftFace(&edges[e*4], s, t, EV_HULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,14 +420,14 @@ static void delaunayHull(rcContext* ctx, const int npts, const float* pts,
|
||||
edges.resize(maxEdges*4);
|
||||
|
||||
for (int i = 0, j = nhull-1; i < nhull; j=i++)
|
||||
addEdge(ctx, &edges[0], nedges, maxEdges, hull[j],hull[i], HULL, UNDEF);
|
||||
addEdge(ctx, &edges[0], nedges, maxEdges, hull[j],hull[i], EV_HULL, EV_UNDEF);
|
||||
|
||||
int currentEdge = 0;
|
||||
while (currentEdge < nedges)
|
||||
{
|
||||
if (edges[currentEdge*4+2] == UNDEF)
|
||||
if (edges[currentEdge*4+2] == EV_UNDEF)
|
||||
completeFacet(ctx, pts, npts, &edges[0], nedges, maxEdges, nfaces, currentEdge);
|
||||
if (edges[currentEdge*4+3] == UNDEF)
|
||||
if (edges[currentEdge*4+3] == EV_UNDEF)
|
||||
completeFacet(ctx, pts, npts, &edges[0], nedges, maxEdges, nfaces, currentEdge);
|
||||
currentEdge++;
|
||||
}
|
||||
@@ -507,17 +507,11 @@ static float polyMinExtent(const float* verts, const int nverts)
|
||||
return rcSqrt(minDist);
|
||||
}
|
||||
|
||||
inline int next(int i, int n)
|
||||
{
|
||||
return (i+1) % n;
|
||||
}
|
||||
// Last time I checked the if version got compiled using cmov, which was a lot faster than module (with idiv).
|
||||
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; }
|
||||
|
||||
inline int prev(int i, int n)
|
||||
{
|
||||
return (i + n-1) % n;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ static rcSpan* allocSpan(rcHeightfield& hf)
|
||||
// Allocate memory for the new pool.
|
||||
rcSpanPool* pool = (rcSpanPool*)rcAlloc(sizeof(rcSpanPool), RC_ALLOC_PERM);
|
||||
if (!pool) return 0;
|
||||
pool->next = 0;
|
||||
|
||||
// Add the pool into the list of pools.
|
||||
pool->next = hf.pools;
|
||||
hf.pools = pool;
|
||||
|
||||
@@ -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,18 +1,17 @@
|
||||
From b84e9ffbd1d1e1fb2f5d78cc53d2bb7b56c3fce3 Mon Sep 17 00:00:00 2001
|
||||
From 37b4c6d3d78ea676d8b300a282013a27a51912c1 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/DetourCommon.cpp | 4 +-
|
||||
Detour/Source/DetourNavMesh.cpp | 32 ++++-------
|
||||
Detour/Source/DetourNavMeshBuilder.cpp | 6 +-
|
||||
Detour/Source/DetourNavMeshQuery.cpp | 9 +--
|
||||
Detour/Source/DetourNode.cpp | 29 +++-------
|
||||
DetourCrowd/Source/DetourObstacleAvoidance.cpp | 6 +-
|
||||
Recast/Include/Recast.h | 8 +--
|
||||
8 files changed, 59 insertions(+), 111 deletions(-)
|
||||
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(-)
|
||||
|
||||
diff --git a/Detour/Include/DetourNavMesh.h b/Detour/Include/DetourNavMesh.h
|
||||
index 1060845..782ddbc 100644
|
||||
@@ -177,46 +176,10 @@ index 1060845..782ddbc 100644
|
||||
};
|
||||
|
||||
/// Allocates a navigation mesh object using the Detour allocator.
|
||||
diff --git a/Detour/Source/DetourCommon.cpp b/Detour/Source/DetourCommon.cpp
|
||||
index a98d8c8..b5700f5 100644
|
||||
--- a/Detour/Source/DetourCommon.cpp
|
||||
+++ b/Detour/Source/DetourCommon.cpp
|
||||
@@ -16,14 +16,14 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
+#include <math.h>
|
||||
#include "DetourCommon.h"
|
||||
-#include "DetourMath.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float dtSqrt(float x)
|
||||
{
|
||||
- return dtMathSqrtf(x);
|
||||
+ return sqrtf(x);
|
||||
}
|
||||
|
||||
void dtClosestPtPointTriangle(float* closest, const float* p,
|
||||
diff --git a/Detour/Source/DetourNavMesh.cpp b/Detour/Source/DetourNavMesh.cpp
|
||||
index 9d627be..5174050 100644
|
||||
index d353d08..e8a679b 100644
|
||||
--- a/Detour/Source/DetourNavMesh.cpp
|
||||
+++ b/Detour/Source/DetourNavMesh.cpp
|
||||
@@ -16,13 +16,13 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
+#include <math.h>
|
||||
#include <float.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourNode.h"
|
||||
#include "DetourCommon.h"
|
||||
-#include "DetourMath.h"
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourAssert.h"
|
||||
#include <new>
|
||||
@@ -193,13 +193,11 @@ dtNavMesh::dtNavMesh() :
|
||||
m_tileLutMask(0),
|
||||
m_posLookup(0),
|
||||
@@ -270,68 +233,21 @@ index 9d627be..5174050 100644
|
||||
if (tile->salt == 0)
|
||||
tile->salt++;
|
||||
|
||||
diff --git a/Detour/Source/DetourNavMeshBuilder.cpp b/Detour/Source/DetourNavMeshBuilder.cpp
|
||||
index 1bf271b..9d8471b 100644
|
||||
--- a/Detour/Source/DetourNavMeshBuilder.cpp
|
||||
+++ b/Detour/Source/DetourNavMeshBuilder.cpp
|
||||
@@ -16,13 +16,13 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
+#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourCommon.h"
|
||||
-#include "DetourMath.h"
|
||||
#include "DetourNavMeshBuilder.h"
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourAssert.h"
|
||||
@@ -202,8 +202,8 @@ static int createBVTree(const unsigned short* verts, const int /*nverts*/,
|
||||
if (z > it.bmax[2]) it.bmax[2] = z;
|
||||
}
|
||||
// Remap y
|
||||
- it.bmin[1] = (unsigned short)dtMathFloorf((float)it.bmin[1]*ch/cs);
|
||||
- it.bmax[1] = (unsigned short)dtMathCeilf((float)it.bmax[1]*ch/cs);
|
||||
+ it.bmin[1] = (unsigned short)floorf((float)it.bmin[1]*ch/cs);
|
||||
+ it.bmax[1] = (unsigned short)ceilf((float)it.bmax[1]*ch/cs);
|
||||
}
|
||||
|
||||
int curNode = 0;
|
||||
diff --git a/Detour/Source/DetourNavMeshQuery.cpp b/Detour/Source/DetourNavMeshQuery.cpp
|
||||
index 9debb4d..ec3a294 100644
|
||||
index 5fbc83e..fbf3724 100644
|
||||
--- a/Detour/Source/DetourNavMeshQuery.cpp
|
||||
+++ b/Detour/Source/DetourNavMeshQuery.cpp
|
||||
@@ -16,13 +16,13 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
+#include <math.h>
|
||||
#include <float.h>
|
||||
#include <string.h>
|
||||
#include "DetourNavMeshQuery.h"
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourNode.h"
|
||||
#include "DetourCommon.h"
|
||||
-#include "DetourMath.h"
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourAssert.h"
|
||||
#include <new>
|
||||
@@ -99,8 +99,9 @@ inline float dtQueryFilter::getCost(const float* pa, const float* pb,
|
||||
return dtVdist(pa, pb) * m_areaCost[curPoly->getArea()];
|
||||
@@ -100,7 +100,8 @@ 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.
|
||||
+static const float H_SCALE = 2.0f; // Search heuristic scale.
|
||||
|
||||
|
||||
dtNavMeshQuery* dtAllocNavMeshQuery()
|
||||
@@ -3504,7 +3505,7 @@ dtStatus dtNavMeshQuery::findDistanceToWall(dtPolyRef startRef, const float* cen
|
||||
@@ -3501,7 +3502,7 @@ dtStatus dtNavMeshQuery::findDistanceToWall(dtPolyRef startRef, const float* cen
|
||||
dtVsub(hitNormal, centerPos, hitPos);
|
||||
dtVnormalize(hitNormal);
|
||||
|
||||
@@ -383,42 +299,8 @@ index 5cf6548..1d18977 100644
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
dtNodePool::dtNodePool(int maxNodes, int hashSize) :
|
||||
diff --git a/DetourCrowd/Source/DetourObstacleAvoidance.cpp b/DetourCrowd/Source/DetourObstacleAvoidance.cpp
|
||||
index 0fad9ef..d3f90b7 100644
|
||||
--- a/DetourCrowd/Source/DetourObstacleAvoidance.cpp
|
||||
+++ b/DetourCrowd/Source/DetourObstacleAvoidance.cpp
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
#include "DetourObstacleAvoidance.h"
|
||||
#include "DetourCommon.h"
|
||||
-#include "DetourMath.h"
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourAssert.h"
|
||||
#include <string.h>
|
||||
+#include <math.h>
|
||||
#include <float.h>
|
||||
#include <new>
|
||||
|
||||
@@ -58,7 +58,7 @@ static int isectRaySeg(const float* ap, const float* u,
|
||||
dtVsub(v,bq,bp);
|
||||
dtVsub(w,ap,bp);
|
||||
float d = dtVperp2D(u,v);
|
||||
- if (dtMathFabs(d) < 1e-6f) return 0;
|
||||
+ if (fabsf(d) < 1e-6f) return 0;
|
||||
d = 1.0f/d;
|
||||
t = dtVperp2D(v,w) * d;
|
||||
if (t < 0 || t > 1) return 0;
|
||||
@@ -482,7 +482,7 @@ int dtObstacleAvoidanceQuery::sampleVelocityAdaptive(const float* pos, const flo
|
||||
const int nd = dtClamp(ndivs, 1, DT_MAX_PATTERN_DIVS);
|
||||
const int nr = dtClamp(nrings, 1, DT_MAX_PATTERN_RINGS);
|
||||
const float da = (1.0f/nd) * DT_PI*2;
|
||||
- const float dang = dtMathAtan2f(dvel[2], dvel[0]);
|
||||
+ const float dang = atan2f(dvel[2], dvel[0]);
|
||||
|
||||
// Always add sample at zero
|
||||
pat[npat*2+0] = 0;
|
||||
diff --git a/Recast/Include/Recast.h b/Recast/Include/Recast.h
|
||||
index 83ca606..66974cd 100644
|
||||
index d8bdde2..d3e9219 100644
|
||||
--- a/Recast/Include/Recast.h
|
||||
+++ b/Recast/Include/Recast.h
|
||||
@@ -243,7 +243,7 @@ struct rcConfig
|
||||
@@ -443,6 +325,32 @@ index 83ca606..66974cd 100644
|
||||
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.0.msysgit.0
|
||||
1.9.5.msysgit.0
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ dtPolyRef PathGenerator::GetPathPolyByPosition(dtPolyRef const* polyPath, uint32
|
||||
}
|
||||
|
||||
if (distance)
|
||||
*distance = dtSqrt(minDist3d);
|
||||
*distance = dtMathSqrtf(minDist3d);
|
||||
|
||||
return (minDist2d < 3.0f) ? nearestPoly : INVALID_POLYREF;
|
||||
}
|
||||
@@ -799,7 +799,7 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo
|
||||
// Find movement delta.
|
||||
float delta[VERTEX_SIZE];
|
||||
dtVsub(delta, steerPos, iterPos);
|
||||
float len = dtSqrt(dtVdot(delta, delta));
|
||||
float len = dtMathSqrtf(dtVdot(delta, delta));
|
||||
// If the steer target is end of path or off-mesh link, do not move past the location.
|
||||
if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE)
|
||||
len = 1.0f;
|
||||
|
||||
Reference in New Issue
Block a user