Skip to content

Commit

Permalink
Merge branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Spyder committed Jan 11, 2014
2 parents be60fd9 + 33c2bd5 commit aea6e3a
Show file tree
Hide file tree
Showing 500 changed files with 8,091 additions and 7,512 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ website at [arkania.net](http://www.arkania.net).
+ MySQL ≥ 5.1.0 (included for Windows) + MySQL ≥ 5.1.0 (included for Windows)
+ CMake ≥ 2.8.0 + CMake ≥ 2.8.0
+ OpenSSL ≥ 1.0.0 + OpenSSL ≥ 1.0.0
+ GCC ≥ 4.3 (Linux only) + GCC ≥ 4.7.2 (Linux only)
+ MS Visual Studio ≥ 9 (2008) (Windows only) + MS Visual Studio ≥ 12 (2013) (Windows only)




## Install ## Install
Expand Down
2 changes: 2 additions & 0 deletions cmake/compiler/gcc/settings.cmake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ if( WITH_COREDEBUG )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
message(STATUS "GCC: Debug-flags set (-g3)") message(STATUS "GCC: Debug-flags set (-g3)")
endif() endif()

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
2 changes: 1 addition & 1 deletion cmake/platform/unix/settings.cmake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ add_custom_target(uninstall
message(STATUS "UNIX: Created uninstall target") message(STATUS "UNIX: Created uninstall target")


message(STATUS "UNIX: Detected compiler: ${CMAKE_C_COMPILER}") message(STATUS "UNIX: Detected compiler: ${CMAKE_C_COMPILER}")
if(CMAKE_C_COMPILER MATCHES "gcc") if(CMAKE_C_COMPILER MATCHES "gcc" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
include(${CMAKE_SOURCE_DIR}/cmake/compiler/gcc/settings.cmake) include(${CMAKE_SOURCE_DIR}/cmake/compiler/gcc/settings.cmake)
elseif(CMAKE_C_COMPILER MATCHES "icc") elseif(CMAKE_C_COMPILER MATCHES "icc")
include(${CMAKE_SOURCE_DIR}/cmake/compiler/icc/settings.cmake) include(${CMAKE_SOURCE_DIR}/cmake/compiler/icc/settings.cmake)
Expand Down
2 changes: 1 addition & 1 deletion dep/mysqllite/libmysql/libmysql.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2303,7 +2303,7 @@ stmt_read_row_no_result_set(MYSQL_STMT *stmt __attribute__((unused)),
mysql_stmt_attr_set() mysql_stmt_attr_set()
attr_type statement attribute attr_type statement attribute
value casted to const void * pointer to value. value cast to const void * pointer to value.
RETURN VALUE RETURN VALUE
0 success 0 success
Expand Down
4 changes: 2 additions & 2 deletions dep/recastnavigation/Detour/DetourCommon.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
// 3. This notice may not be removed or altered from any source distribution. // 3. This notice may not be removed or altered from any source distribution.
// //


#include <math.h>
#include "DetourCommon.h" #include "DetourCommon.h"
#include "DetourMath.h"


////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////


float dtSqrt(float x) float dtSqrt(float x)
{ {
return sqrtf(x); return dtMathSqrtf(x);
} }


void dtClosestPtPointTriangle(float* closest, const float* p, void dtClosestPtPointTriangle(float* closest, const float* p,
Expand Down
5 changes: 5 additions & 0 deletions dep/recastnavigation/Detour/DetourCommon.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ feature to find minor members.
/// @name General helper functions /// @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. /// Swaps the values of the two parameters.
/// @param[in,out] a Value A /// @param[in,out] a Value A
/// @param[in,out] b Value B /// @param[in,out] b Value B
Expand Down
21 changes: 21 additions & 0 deletions dep/recastnavigation/Detour/DetourMath.h
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef DETOURMATH_H
#define DETOURMATH_H

/**
@defgroup detour Detour
Members in this module are wrappers around the standard math library
*/

#include <math.h>

#define dtMathFabs(x) fabs(x)
#define dtMathSqrtf(x) sqrtf(x)
#define dtMathFloorf(x) floorf(x)
#define dtMathCeilf(x) ceilf(x)
#define dtMathCosf(x) cosf(x)
#define dtMathSinf(x) sinf(x)
#define dtMathAtan2f(y, x) atan2f(y, x)

#endif
32 changes: 22 additions & 10 deletions dep/recastnavigation/Detour/DetourNavMesh.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// 3. This notice may not be removed or altered from any source distribution. // 3. This notice may not be removed or altered from any source distribution.
// //


#include <math.h>
#include <float.h> #include <float.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "DetourNavMesh.h" #include "DetourNavMesh.h"
#include "DetourNode.h" #include "DetourNode.h"
#include "DetourCommon.h" #include "DetourCommon.h"
#include "DetourMath.h"
#include "DetourAlloc.h" #include "DetourAlloc.h"
#include "DetourAssert.h" #include "DetourAssert.h"
#include <new> #include <new>
Expand Down Expand Up @@ -193,11 +193,13 @@ dtNavMesh::dtNavMesh() :
m_tileLutMask(0), m_tileLutMask(0),
m_posLookup(0), m_posLookup(0),
m_nextFree(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)); memset(&m_params, 0, sizeof(dtNavMeshParams));
m_orig[0] = 0; m_orig[0] = 0;
m_orig[1] = 0; m_orig[1] = 0;
Expand Down Expand Up @@ -248,11 +250,17 @@ dtStatus dtNavMesh::init(const dtNavMeshParams* params)
m_nextFree = &m_tiles[i]; m_nextFree = &m_tiles[i];
} }


// Edited by TC // Init ID generator values.
m_tileBits = STATIC_TILE_BITS; #ifndef DT_POLYREF64
m_polyBits = STATIC_POLY_BITS; m_tileBits = dtIlog2(dtNextPow2((unsigned int)params->maxTiles));
m_saltBits = STATIC_SALT_BITS; 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

return DT_SUCCESS; return DT_SUCCESS;
} }


Expand Down Expand Up @@ -1206,7 +1214,11 @@ dtStatus dtNavMesh::removeTile(dtTileRef ref, unsigned char** data, int* dataSiz
tile->offMeshCons = 0; tile->offMeshCons = 0;


// Update salt, salt should never be zero. // 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); tile->salt = (tile->salt+1) & ((1<<m_saltBits)-1);
#endif
if (tile->salt == 0) if (tile->salt == 0)
tile->salt++; tile->salt++;


Expand Down
72 changes: 52 additions & 20 deletions dep/recastnavigation/Detour/DetourNavMesh.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,37 +22,39 @@
#include "DetourAlloc.h" #include "DetourAlloc.h"
#include "DetourStatus.h" #include "DetourStatus.h"



// Undefine (or define in a build cofnig) the following line to use 64bit polyref.
// Edited by TC // Generally not needed, useful for very large worlds.
#if defined(WIN32) && !defined(__MINGW32__) // Note: tiles build using 32bit refs are not compatible with 64bit refs!
typedef unsigned __int64 uint64; //#define DT_POLYREF64 1
#else
#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
#include <stdint.h> #include <stdint.h>
#ifndef uint64_t
#ifdef __linux__
#include <linux/types.h>
#endif
#endif #endif
typedef uint64_t uint64;
#endif


// Note: If you want to use 64-bit refs, change the types of both dtPolyRef & dtTileRef. // 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. // 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.
static const int STATIC_SALT_BITS = 12;
static const int STATIC_TILE_BITS = 21;
static const int STATIC_POLY_BITS = 31;

/// A handle to a polygon within a navigation mesh tile. /// A handle to a polygon within a navigation mesh tile.
/// @ingroup detour /// @ingroup detour
typedef uint64 dtPolyRef; // Edited by TC #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


/// A handle to a tile within a navigation mesh. /// A handle to a tile within a navigation mesh.
/// @ingroup detour /// @ingroup detour
typedef uint64 dtTileRef; // Edited by TC #ifdef DT_POLYREF64
typedef uint64_t dtTileRef;
#else
typedef unsigned int dtTileRef;
#endif


/// The maximum number of vertices per navigation polygon. /// The maximum number of vertices per navigation polygon.
/// @ingroup detour /// @ingroup detour
Expand Down Expand Up @@ -490,7 +492,11 @@ class dtNavMesh
/// @param[in] ip The index of the polygon within the tile. /// @param[in] ip The index of the polygon within the tile.
inline dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const 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; return ((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
#endif
} }


/// Decodes a standard polygon reference. /// Decodes a standard polygon reference.
Expand All @@ -502,12 +508,21 @@ class dtNavMesh
/// @see #encodePolyId /// @see #encodePolyId
inline void decodePolyId(dtPolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip) const 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 saltMask = ((dtPolyRef)1<<m_saltBits)-1;
const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1; const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1; const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask); salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
it = (unsigned int)((ref >> m_polyBits) & tileMask); it = (unsigned int)((ref >> m_polyBits) & tileMask);
ip = (unsigned int)(ref & polyMask); ip = (unsigned int)(ref & polyMask);
#endif
} }


/// Extracts a tile's salt value from the specified polygon reference. /// Extracts a tile's salt value from the specified polygon reference.
Expand All @@ -516,8 +531,13 @@ class dtNavMesh
/// @see #encodePolyId /// @see #encodePolyId
inline unsigned int decodePolyIdSalt(dtPolyRef ref) const 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; const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask); return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
#endif
} }


/// Extracts the tile's index from the specified polygon reference. /// Extracts the tile's index from the specified polygon reference.
Expand All @@ -526,8 +546,13 @@ class dtNavMesh
/// @see #encodePolyId /// @see #encodePolyId
inline unsigned int decodePolyIdTile(dtPolyRef ref) const 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; const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
return (unsigned int)((ref >> m_polyBits) & tileMask); return (unsigned int)((ref >> m_polyBits) & tileMask);
#endif
} }


/// Extracts the polygon's index (within its tile) from the specified polygon reference. /// Extracts the polygon's index (within its tile) from the specified polygon reference.
Expand All @@ -536,8 +561,13 @@ class dtNavMesh
/// @see #encodePolyId /// @see #encodePolyId
inline unsigned int decodePolyIdPoly(dtPolyRef ref) const 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; const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
return (unsigned int)(ref & polyMask); return (unsigned int)(ref & polyMask);
#endif
} }


/// @} /// @}
Expand Down Expand Up @@ -597,9 +627,11 @@ class dtNavMesh
dtMeshTile* m_nextFree; ///< Freelist of tiles. dtMeshTile* m_nextFree; ///< Freelist of tiles.
dtMeshTile* m_tiles; ///< List 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_saltBits; ///< Number of salt bits in the tile ID.
unsigned int m_tileBits; ///< Number of tile 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. unsigned int m_polyBits; ///< Number of poly bits in the tile ID.
#endif
}; };


/// Allocates a navigation mesh object using the Detour allocator. /// Allocates a navigation mesh object using the Detour allocator.
Expand Down
6 changes: 3 additions & 3 deletions dep/recastnavigation/Detour/DetourNavMeshBuilder.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// 3. This notice may not be removed or altered from any source distribution. // 3. This notice may not be removed or altered from any source distribution.
// //


#include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <float.h> #include <float.h>
#include "DetourNavMesh.h" #include "DetourNavMesh.h"
#include "DetourCommon.h" #include "DetourCommon.h"
#include "DetourMath.h"
#include "DetourNavMeshBuilder.h" #include "DetourNavMeshBuilder.h"
#include "DetourAlloc.h" #include "DetourAlloc.h"
#include "DetourAssert.h" #include "DetourAssert.h"
Expand Down Expand Up @@ -202,8 +202,8 @@ static int createBVTree(const unsigned short* verts, const int /*nverts*/,
if (z > it.bmax[2]) it.bmax[2] = z; if (z > it.bmax[2]) it.bmax[2] = z;
} }
// Remap y // Remap y
it.bmin[1] = (unsigned short)floorf((float)it.bmin[1]*ch/cs); it.bmin[1] = (unsigned short)dtMathFloorf((float)it.bmin[1]*ch/cs);
it.bmax[1] = (unsigned short)ceilf((float)it.bmax[1]*ch/cs); it.bmax[1] = (unsigned short)dtMathCeilf((float)it.bmax[1]*ch/cs);
} }


int curNode = 0; int curNode = 0;
Expand Down
15 changes: 5 additions & 10 deletions dep/recastnavigation/Detour/DetourNavMeshQuery.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// 3. This notice may not be removed or altered from any source distribution. // 3. This notice may not be removed or altered from any source distribution.
// //


#include <math.h>
#include <float.h> #include <float.h>
#include <string.h> #include <string.h>
#include "DetourNavMeshQuery.h" #include "DetourNavMeshQuery.h"
#include "DetourNavMesh.h" #include "DetourNavMesh.h"
#include "DetourNode.h" #include "DetourNode.h"
#include "DetourCommon.h" #include "DetourCommon.h"
#include "DetourMath.h"
#include "DetourAlloc.h" #include "DetourAlloc.h"
#include "DetourAssert.h" #include "DetourAssert.h"
#include <new> #include <new>
Expand Down Expand Up @@ -99,9 +99,8 @@ inline float dtQueryFilter::getCost(const float* pa, const float* pb,
return dtVdist(pa, pb) * m_areaCost[curPoly->getArea()]; return dtVdist(pa, pb) * m_areaCost[curPoly->getArea()];
} }
#endif #endif


// Edited by TC static const float H_SCALE = 0.999f; // Search heuristic scale.
static const float H_SCALE = 2.0f; // Search heuristic scale.




dtNavMeshQuery* dtAllocNavMeshQuery() dtNavMeshQuery* dtAllocNavMeshQuery()
Expand Down Expand Up @@ -511,11 +510,7 @@ dtStatus dtNavMeshQuery::closestPointOnPoly(dtPolyRef ref, const float* pos, flo
return DT_FAILURE | DT_INVALID_PARAM; return DT_FAILURE | DT_INVALID_PARAM;
if (!tile) if (!tile)
return DT_FAILURE | DT_INVALID_PARAM; return DT_FAILURE | DT_INVALID_PARAM;


// Edited by TC
if (poly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION)
return DT_FAILURE;

closestPointOnPolyInTile(tile, poly, pos, closest); closestPointOnPolyInTile(tile, poly, pos, closest);


return DT_SUCCESS; return DT_SUCCESS;
Expand Down Expand Up @@ -3347,7 +3342,7 @@ dtStatus dtNavMeshQuery::findDistanceToWall(dtPolyRef startRef, const float* cen
dtVsub(hitNormal, centerPos, hitPos); dtVsub(hitNormal, centerPos, hitPos);
dtVnormalize(hitNormal); dtVnormalize(hitNormal);


*hitDist = dtSqrt(radiusSqr); *hitDist = dtMathSqrtf(radiusSqr);


return status; return status;
} }
Expand Down
4 changes: 2 additions & 2 deletions dep/recastnavigation/Detour/DetourNavMeshQuery.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ class dtNavMeshQuery


/// Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest /// Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest
/// polygon on the existing path that was visited during the search. /// polygon on the existing path that was visited during the search.
/// @param[out] existing An array of polygon references for the existing path. /// @param[in] existing An array of polygon references for the existing path.
/// @param[out] existingSize The number of polygon in the @p existing array. /// @param[in] existingSize The number of polygon in the @p existing array.
/// @param[out] path An ordered list of polygon references representing the path. (Start to end.) /// @param[out] path An ordered list of polygon references representing the path. (Start to end.)
/// [(polyRef) * @p pathCount] /// [(polyRef) * @p pathCount]
/// @param[out] pathCount The number of polygons returned in the @p path array. /// @param[out] pathCount The number of polygons returned in the @p path array.
Expand Down
Loading

0 comments on commit aea6e3a

Please sign in to comment.