Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-09-15 19:29:40 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-09-15 19:29:40 +0400
commit41e5040e2f66ac4aa2898611459fe26334583b31 (patch)
tree647e4e6f062d0210babb5a9cfcb3298ec50b9d12 /extern/recastnavigation
parentf8af915b5152c660a75511333314b780a64b3dba (diff)
Use static context trick for all platforms.
Should be safe until modifier stack is not threaded. Solves issues with mingw and older glibc version (like used in release environment).
Diffstat (limited to 'extern/recastnavigation')
-rw-r--r--extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp38
1 files changed, 5 insertions, 33 deletions
diff --git a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
index f1d2113a8c7..55ba28ae7cf 100644
--- a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
+++ b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
@@ -94,31 +94,12 @@ static int circumCircle(const float xp, const float yp,
return (drsqr <= rsqr) ? 1 : 0;
}
-#ifdef FREE_WINDOWS
-static float *_mingw_verts;
+
+static float *_qsort_verts;
static int ptcmp(const void *v1, const void *v2)
{
- const float* p1 = &_mingw_verts[(*(const int*)v1)*3];
- const float* p2 = &_mingw_verts[(*(const int*)v2)*3];
- if (p1[0] < p2[0])
- return -1;
- else if (p1[0] > p2[0])
- return 1;
- else
- return 0;
-}
-#else
-#if defined(_MSC_VER)
-static int ptcmp(void* up, const void *v1, const void *v2)
-#elif defined(__APPLE__) || defined(__FreeBSD__)
-static int ptcmp(void* up, const void *v1, const void *v2)
-#else
-static int ptcmp(const void *v1, const void *v2, void* up)
-#endif
-{
- const float* verts = (const float*)up;
- const float* p1 = &verts[(*(const int*)v1)*3];
- const float* p2 = &verts[(*(const int*)v2)*3];
+ const float* p1 = &_qsort_verts[(*(const int*)v1)*3];
+ const float* p2 = &_qsort_verts[(*(const int*)v2)*3];
if (p1[0] < p2[0])
return -1;
else if (p1[0] > p2[0])
@@ -126,7 +107,6 @@ static int ptcmp(const void *v1, const void *v2, void* up)
else
return 0;
}
-#endif
// Based on Paul Bourke's triangulate.c
// http://astronomy.swin.edu.au/~pbourke/terrain/triangulate/triangulate.c
@@ -136,16 +116,8 @@ static void delaunay(const int nv, float *verts, rcIntArray& idx, rcIntArray& tr
idx.resize(nv);
for (int i = 0; i < nv; ++i)
idx[i] = i;
-#if defined(_MSC_VER)
- qsort_s(&idx[0], idx.size(), sizeof(int), ptcmp, verts);
-#elif defined(__APPLE__) || defined(__FreeBSD__)
- qsort_r(&idx[0], idx.size(), sizeof(int), verts, ptcmp);
-#elif defined(FREE_WINDOWS)
- _mingw_verts = verts;
+ _qsort_verts = verts;
qsort(&idx[0], idx.size(), sizeof(int), ptcmp);
-#else
- qsort_r(&idx[0], idx.size(), sizeof(int), ptcmp, verts);
-#endif
// Find the maximum and minimum vertex bounds.
// This is to allow calculation of the bounding triangle