Permalink
Browse files

Core/MMAPS: Update recastnavigation!

* Complete changelog can be found at http://code.google.com/p/recastnavigation/
* Adjusted a few config values

Important:
* New mmaps extraction is required
* Folder size will be increased
  • Loading branch information...
1 parent 9b4f14c commit aa645683b8b25bfb35cb977678daf5c56c1531e6 @kaelima kaelima committed Jun 17, 2013
Showing with 5,348 additions and 1,694 deletions.
  1. +25 −2 dep/recastnavigation/Detour/DetourAlloc.h
  2. +1 −1 dep/recastnavigation/Detour/DetourAssert.h
  3. +64 −0 dep/recastnavigation/Detour/DetourCommon.cpp
  4. +310 −28 dep/recastnavigation/Detour/DetourCommon.h
  5. +407 −166 dep/recastnavigation/Detour/DetourNavMesh.cpp
  6. +496 −214 dep/recastnavigation/Detour/DetourNavMesh.h
  7. +207 −149 dep/recastnavigation/Detour/DetourNavMeshBuilder.cpp
  8. +114 −43 dep/recastnavigation/Detour/DetourNavMeshBuilder.h
  9. +1,040 −225 dep/recastnavigation/Detour/DetourNavMeshQuery.cpp
  10. +336 −255 dep/recastnavigation/Detour/DetourNavMeshQuery.h
  11. +9 −8 dep/recastnavigation/Detour/DetourNode.cpp
  12. +17 −15 dep/recastnavigation/Detour/DetourNode.h
  13. +64 −0 dep/recastnavigation/Detour/DetourStatus.h
  14. +1 −0 dep/recastnavigation/Recast/CMakeLists.txt
  15. +75 −5 dep/recastnavigation/Recast/Recast.cpp
  16. +811 −369 dep/recastnavigation/Recast/Recast.h
  17. +21 −0 dep/recastnavigation/Recast/RecastAlloc.cpp
  18. +60 −5 dep/recastnavigation/Recast/RecastAlloc.h
  19. +194 −5 dep/recastnavigation/Recast/RecastArea.cpp
  20. +1 −1 dep/recastnavigation/Recast/RecastAssert.h
  21. +61 −14 dep/recastnavigation/Recast/RecastContour.cpp
  22. +31 −3 dep/recastnavigation/Recast/RecastFilter.cpp
  23. +620 −0 dep/recastnavigation/Recast/RecastLayers.cpp
  24. +117 −11 dep/recastnavigation/Recast/RecastMesh.cpp
  25. +24 −16 dep/recastnavigation/Recast/RecastMeshDetail.cpp
  26. +27 −0 dep/recastnavigation/Recast/RecastRasterization.cpp
  27. +85 −31 dep/recastnavigation/Recast/RecastRegion.cpp
  28. +5 −5 src/server/collision/Management/MMapManager.cpp
  29. +1 −1 src/server/game/Grids/GridDefines.h
  30. +1 −1 src/server/game/Miscellaneous/SharedDefines.h
  31. +17 −17 src/server/game/Movement/PathGenerator.cpp
  32. +15 −6 src/server/scripts/Commands/cs_mmaps.cpp
  33. +2 −2 src/tools/mmaps_generator/Info/readme.txt
  34. +86 −93 src/tools/mmaps_generator/MapBuilder.cpp
  35. +1 −1 src/tools/mmaps_generator/MapBuilder.h
  36. +1 −1 src/tools/mmaps_generator/PathGenerator.cpp
  37. +1 −1 src/tools/mmaps_generator/TerrainBuilder.h
@@ -19,18 +19,41 @@
#ifndef DETOURALLOCATOR_H
#define DETOURALLOCATOR_H
+/// Provides hint values to the memory allocator on how long the
+/// memory is expected to be used.
enum dtAllocHint
{
- DT_ALLOC_PERM, // Memory persist after a function call.
- DT_ALLOC_TEMP // Memory used temporarily within a function.
+ DT_ALLOC_PERM, ///< Memory persist after a function call.
+ DT_ALLOC_TEMP ///< Memory used temporarily within a function.
};
+/// A memory allocation function.
+// @param[in] size The size, in bytes of memory, to allocate.
+// @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);
+
+/// A memory deallocation function.
+/// @param[in] ptr A pointer to a memory block previously allocated using #dtAllocFunc.
+/// @see dtAllocSetCustom
typedef void (dtFreeFunc)(void* ptr);
+/// Sets the base custom allocation functions to be used by Detour.
+/// @param[in] allocFunc The memory allocation function to be used by #dtAlloc
+/// @param[in] freeFunc The memory de-allocation function to be used by #dtFree
void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc);
+/// Allocates a memory block.
+/// @param[in] size The size, in bytes of memory, to allocate.
+/// @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);
+
+/// Deallocates a memory block.
+/// @param[in] ptr A pointer to a memory block previously allocated using #dtAlloc.
+/// @see dtAlloc
void dtFree(void* ptr);
#endif
@@ -24,7 +24,7 @@
#ifdef NDEBUG
// From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
-# define dtAssert(x) do { (void)sizeof(x); } while(__LINE__==-1,false)
+# define dtAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false)
#else
# include <assert.h>
# define dtAssert assert
@@ -238,6 +238,9 @@ bool dtClosestHeightPointTriangle(const float* p, const float* a, const float* b
return false;
}
+/// @par
+///
+/// All points are projected onto the xz-plane, so the y-values are ignored.
bool dtPointInPolygon(const float* pt, const float* verts, const int nverts)
{
// TODO: Replace pnpoly with triArea2D tests?
@@ -291,6 +294,9 @@ inline bool overlapRange(const float amin, const float amax,
return ((amin+eps) > bmax || (amax-eps) < bmin) ? false : true;
}
+/// @par
+///
+/// All vertices are projected onto the xz-plane, so the y-values are ignored.
bool dtOverlapPolyPoly2D(const float* polya, const int npolya,
const float* polyb, const int npolyb)
{
@@ -327,3 +333,61 @@ bool dtOverlapPolyPoly2D(const float* polya, const int npolya,
return true;
}
+// Returns a random point in a convex polygon.
+// Adapted from Graphics Gems article.
+void dtRandomPointInConvexPoly(const float* pts, const int npts, float* areas,
+ const float s, const float t, float* out)
+{
+ // Calc triangle araes
+ float areasum = 0.0f;
+ for (int i = 2; i < npts; i++) {
+ areas[i] = dtTriArea2D(&pts[0], &pts[(i-1)*3], &pts[i*3]);
+ areasum += dtMax(0.001f, areas[i]);
+ }
+ // Find sub triangle weighted by area.
+ const float thr = s*areasum;
+ float acc = 0.0f;
+ float u = 0.0f;
+ int tri = 0;
+ for (int i = 2; i < npts; i++) {
+ const float dacc = areas[i];
+ if (thr >= acc && thr < (acc+dacc))
+ {
+ u = (thr - acc) / dacc;
+ tri = i;
+ break;
+ }
+ acc += dacc;
+ }
+
+ float v = dtSqrt(t);
+
+ const float a = 1 - v;
+ const float b = (1 - u) * v;
+ const float c = u * v;
+ const float* pa = &pts[0];
+ const float* pb = &pts[(tri-1)*3];
+ const float* pc = &pts[tri*3];
+
+ out[0] = a*pa[0] + b*pb[0] + c*pc[0];
+ out[1] = a*pa[1] + b*pb[1] + c*pc[1];
+ out[2] = a*pa[2] + b*pb[2] + c*pc[2];
+}
+
+inline float vperpXZ(const float* a, const float* b) { return a[0]*b[2] - a[2]*b[0]; }
+
+bool dtIntersectSegSeg2D(const float* ap, const float* aq,
+ const float* bp, const float* bq,
+ float& s, float& t)
+{
+ float u[3], v[3], w[3];
+ dtVsub(u,aq,ap);
+ dtVsub(v,bq,bp);
+ dtVsub(w,ap,bp);
+ float d = vperpXZ(u,v);
+ if (fabsf(d) < 1e-6f) return false;
+ s = vperpXZ(v,w) / d;
+ t = vperpXZ(u,w) / d;
+ return true;
+}
+
Oops, something went wrong.

24 comments on commit aa64568

Contributor

kaelima replied Jun 17, 2013

As a warning if you think extracting is very bothersome;
Keep in mind this is a development branch. It has of course been tested locally, but I cannot guarantee anything.

Contributor

gpascualg replied Jun 17, 2013

May this solve:
#9135
#9118

I'm not home now, but as soon as I get there, I'll reextract them and test it.

Contributor

Subv replied Jun 17, 2013

Who knows, maybe.

hi is it possible to have the mmaps_generator named mmaps4_generator ?

as this caught me out after updating my core but not extracting the new mmaps as they take along time to extract

world reports "MMAP:loadmap : 5712227.mmtitle was built with generator v3, expected v4

world still loads but spams this warning for every mmap

my point being is that the normal map extractors have always had revisions like vmap3extractor ,vmap4extractor etc

so renaming this would help people see the update , and possibly stop the TCforum filling up with this report

thank you

Member

Vincent-Michael replied Jun 17, 2013

I have no problems
Finished. MMAPS were built in 3947336 ms!

INFO Loading map ./maps/5712231.map
INFO VMAP loaded name:Northrend, id:571, x:22, y:31 (vmap rep.: x:22, y:31)
INFO MMAP:loadMap: Loaded mmtile 571[22, 31] into 571[18, 15]
INFO MMAP loaded name:Northrend, id:571, x:22, y:31 (mmap rep.: x:22, y:31)

I guess you missed the part where I said " this caught me out after updating my core but not extracting the new mmaps as they take along time to extract"

this is not a problem or error but people will report this !!

I am building the new mmaps now with the new mmaps_generator

so after new maps built I don't expect the world will report mmaps mismatch

but renaming the mmaps_generator would be helpful to users updating the core

Contributor

Subv replied Jun 18, 2013

@richard2012uk I think a better solution would be to make the core crash if the mmaps don't match.

Heya
who can help me and give me the latest extractors for dbc,map,vmaps and mmaps, i wanna test the new mmaps too ( for windows 32 bit ), please upload on http://www.filebeam.com/
big tanks flying
beta

Contributor

Havenard replied Jun 19, 2013

Does it fix bugs like fear and disorientation throwing the player underground?

i dont know, can u give me the extractors ?

big thx
this extractor is now for this repo correct ?

Contributor

vlad852 replied Jun 19, 2013

Yep. It's for latest rev. (for comment time)

Contributor

vlad852 replied Jun 19, 2013

    config.walkableHeight = m_bigBaseUnit ? 2.5 : 5;
    config.walkableClimb = m_bigBaseUnit ? 1.5 : 3;   // keep less than walkableHeight

Seems solve issue with stairs

@kaelima Awesome work !!

Contributor

vlad852 replied Jun 26, 2013

BTW, there are issues with pathfinding even on smooth surfaces exists in some places in world. =(
Edit: it seems problem with tile connections

TrinityCore need to add VMSS i think

Contributor

Subv replied Jun 26, 2013

@Dokman No.

Contributor

Subv replied Jun 26, 2013

@Dokman Because we don't need them.

@Subv I think that is a good idea to add it smoothh alot the movement of the npc's which is a good idea i think

what is the number of maps in the new mmaps please?

Problems appeared after this update see this issue #10384 not only in ICC zone but in every other as well ... see the comments in the issue.

i use 006d72a and aa64568 commit
and use New MMap (5.0) . but Lichking line is Buged
in phase +2 if go ON broken Column .LK cannot attack u - valkayer dont give player and .......

Please sign in to comment.