Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated recast to 1.5.1 #1855

Merged
merged 1 commit into from
Dec 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions Engine/lib/recast/CMakeLists.txt

This file was deleted.

23 changes: 0 additions & 23 deletions Engine/lib/recast/DebugUtils/CMakeLists.txt

This file was deleted.

4 changes: 4 additions & 0 deletions Engine/lib/recast/DebugUtils/Include/DebugDraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ class duDisplayList : public duDebugDraw
virtual void end();
void clear();
void draw(struct duDebugDraw* dd);
private:
// Explicitly disabled copy constructor and copy assignment operator.
duDisplayList(const duDisplayList&);
duDisplayList& operator=(const duDisplayList&);
};


Expand Down
2 changes: 1 addition & 1 deletion Engine/lib/recast/DebugUtils/Include/DetourDebugDraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ void duDebugDrawTileCacheContours(duDebugDraw* dd, const struct dtTileCacheConto
void duDebugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyMesh& lmesh,
const float* orig, const float cs, const float ch);

#endif // DETOURDEBUGDRAW_H
#endif // DETOURDEBUGDRAW_H
4 changes: 0 additions & 4 deletions Engine/lib/recast/DebugUtils/Include/RecastDebugDraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ void duDebugDrawHeightfieldLayer(duDebugDraw* dd, const struct rcHeightfieldLaye
void duDebugDrawHeightfieldLayers(duDebugDraw* dd, const struct rcHeightfieldLayerSet& lset);
void duDebugDrawHeightfieldLayersRegions(duDebugDraw* dd, const struct rcHeightfieldLayerSet& lset);

void duDebugDrawLayerContours(duDebugDraw* dd, const struct rcLayerContourSet& lcset);
void duDebugDrawLayerPolyMesh(duDebugDraw* dd, const struct rcLayerPolyMesh& lmesh);


void duDebugDrawRegionConnections(struct duDebugDraw* dd, const struct rcContourSet& cset, const float alpha = 1.0f);
void duDebugDrawRawContours(struct duDebugDraw* dd, const struct rcContourSet& cset, const float alpha = 1.0f);
void duDebugDrawContours(struct duDebugDraw* dd, const struct rcContourSet& cset, const float alpha = 1.0f);
Expand Down
6 changes: 3 additions & 3 deletions Engine/lib/recast/DebugUtils/Source/DebugDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//

#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
#include "DebugDraw.h"
#include "DetourMath.h"


duDebugDraw::~duDebugDraw()
Expand Down Expand Up @@ -180,8 +180,8 @@ void duAppendCylinderWire(struct duDebugDraw* dd, float minx, float miny, float
for (int i = 0; i < NUM_SEG; ++i)
{
const float a = (float)i/(float)NUM_SEG*DU_PI*2;
dir[i*2] = cosf(a);
dir[i*2+1] = sinf(a);
dir[i*2] = dtMathCosf(a);
dir[i*2+1] = dtMathSinf(a);
}
}

Expand Down
1 change: 0 additions & 1 deletion Engine/lib/recast/DebugUtils/Source/DetourDebugDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// 3. This notice may not be removed or altered from any source distribution.
//

#include <math.h>
#include "DebugDraw.h"
#include "DetourDebugDraw.h"
#include "DetourNavMesh.h"
Expand Down
2 changes: 1 addition & 1 deletion Engine/lib/recast/DebugUtils/Source/RecastDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ bool duReadCompactHeightfield(struct rcCompactHeightfield& chf, duFileIO* io)

io->read(&chf.walkableHeight, sizeof(chf.walkableHeight));
io->read(&chf.walkableClimb, sizeof(chf.walkableClimb));
io->write(&chf.borderSize, sizeof(chf.borderSize));
io->read(&chf.borderSize, sizeof(chf.borderSize));

io->read(&chf.maxDistance, sizeof(chf.maxDistance));
io->read(&chf.maxRegions, sizeof(chf.maxRegions));
Expand Down
24 changes: 0 additions & 24 deletions Engine/lib/recast/Detour/CMakeLists.txt

This file was deleted.

6 changes: 4 additions & 2 deletions Engine/lib/recast/Detour/Include/DetourAlloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#ifndef DETOURALLOCATOR_H
#define DETOURALLOCATOR_H

#include <stddef.h>

/// Provides hint values to the memory allocator on how long the
/// memory is expected to be used.
enum dtAllocHint
Expand All @@ -32,7 +34,7 @@ enum dtAllocHint
// @param[in] rcAllocHint A hint to the allocator on how long the memory is expected to be in use.
// @return A pointer to the beginning of the allocated memory block, or null if the allocation failed.
/// @see dtAllocSetCustom
typedef void* (dtAllocFunc)(int size, dtAllocHint hint);
typedef void* (dtAllocFunc)(size_t size, dtAllocHint hint);

/// A memory deallocation function.
/// @param[in] ptr A pointer to a memory block previously allocated using #dtAllocFunc.
Expand All @@ -49,7 +51,7 @@ void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc);
/// @param[in] hint A hint to the allocator on how long the memory is expected to be in use.
/// @return A pointer to the beginning of the allocated memory block, or null if the allocation failed.
/// @see dtFree
void* dtAlloc(int size, dtAllocHint hint);
void* dtAlloc(size_t size, dtAllocHint hint);

/// Deallocates a memory block.
/// @param[in] ptr A pointer to a memory block previously allocated using #dtAlloc.
Expand Down
24 changes: 15 additions & 9 deletions Engine/lib/recast/Detour/Include/DetourCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#ifndef DETOURCOMMON_H
#define DETOURCOMMON_H

#include "DetourMath.h"

/**
@defgroup detour Detour

Expand All @@ -32,6 +34,11 @@ feature to find minor members.
/// @name General helper functions
/// @{

/// Used to ignore a function parameter. VS complains about unused parameters
/// and this silences the warning.
/// @param [in] _ Unused parameter
template<class T> void dtIgnoreUnused(const T&) { }

/// Swaps the values of the two parameters.
/// @param[in,out] a Value A
/// @param[in,out] b Value B
Expand Down Expand Up @@ -66,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.
/// @{
Expand Down Expand Up @@ -197,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)
Expand All @@ -217,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.
Expand All @@ -242,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.
Expand All @@ -260,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;
Expand Down Expand Up @@ -376,6 +378,10 @@ bool dtIntersectSegmentPoly2D(const float* p0, const float* p1,
float& tmin, float& tmax,
int& segMin, int& segMax);

bool dtIntersectSegSeg2D(const float* ap, const float* aq,
const float* bp, const float* bq,
float& s, float& t);

/// Determines if the specified point is inside the convex polygon on the xz-plane.
/// @param[in] pt The point to check. [(x, y, z)]
/// @param[in] verts The polygon vertices. [(x, y, z) * @p nverts]
Expand Down
20 changes: 20 additions & 0 deletions Engine/lib/recast/Detour/Include/DetourMath.h
Original file line number Diff line number Diff line change
@@ -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
Loading