diff --git a/DebugUtils/Source/DetourDebugDraw.cpp b/DebugUtils/Source/DetourDebugDraw.cpp index 9212bb2..1342ed3 100755 --- a/DebugUtils/Source/DetourDebugDraw.cpp +++ b/DebugUtils/Source/DetourDebugDraw.cpp @@ -37,7 +37,7 @@ static float distancePtLine2d(const float* pt, const float* p, const float* q) return dx*dx + dz*dz; } -static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshHeader* header, +static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshTile* tile, const unsigned int col, const float linew, bool inner) { @@ -45,13 +45,13 @@ static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshHeader* header, dd->begin(DU_DRAW_LINES, linew); - for (int i = 0; i < header->polyCount; ++i) + for (int i = 0; i < tile->header->polyCount; ++i) { - const dtPoly* p = &header->polys[i]; + const dtPoly* p = &tile->polys[i]; if (p->type == DT_POLYTYPE_OFFMESH_CONNECTION) continue; - const dtPolyDetail* pd = &header->detailMeshes[i]; + const dtPolyDetail* pd = &tile->detailMeshes[i]; for (int j = 0, nj = (int)p->vertCount; j < nj; ++j) { @@ -62,9 +62,9 @@ static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshHeader* header, if (p->neis[j] & DT_EXT_LINK) { bool con = false; - for (unsigned int k = p->firstLink; k != DT_NULL_LINK; k = header->links[k].next) + for (unsigned int k = p->firstLink; k != DT_NULL_LINK; k = tile->links[k].next) { - if (header->links[k].edge == j) + if (tile->links[k].edge == j) { con = true; break; @@ -83,21 +83,21 @@ static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshHeader* header, if (p->neis[j] != 0) continue; } - const float* v0 = &header->verts[p->verts[j]*3]; - const float* v1 = &header->verts[p->verts[(j+1) % nj]*3]; + const float* v0 = &tile->verts[p->verts[j]*3]; + const float* v1 = &tile->verts[p->verts[(j+1) % nj]*3]; // Draw detail mesh edges which align with the actual poly edge. // This is really slow. for (int k = 0; k < pd->triCount; ++k) { - const unsigned char* t = &header->detailTris[(pd->triBase+k)*4]; + const unsigned char* t = &tile->detailTris[(pd->triBase+k)*4]; const float* tv[3]; for (int m = 0; m < 3; ++m) { if (t[m] < p->vertCount) - tv[m] = &header->verts[p->verts[t[m]]*3]; + tv[m] = &tile->verts[p->verts[t[m]]*3]; else - tv[m] = &header->detailVerts[(pd->vertBase+(t[m]-p->vertCount))*3]; + tv[m] = &tile->detailVerts[(pd->vertBase+(t[m]-p->vertCount))*3]; } for (int m = 0, n = 2; m < 3; n=m++) { @@ -117,19 +117,18 @@ static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshHeader* header, static void drawMeshTile(duDebugDraw* dd, const dtNavMesh* mesh, const dtMeshTile* tile, unsigned char flags) { - const dtMeshHeader* header = tile->header; dtPolyRef base = mesh->getTileId(tile); dd->depthMask(false); dd->begin(DU_DRAW_TRIS); - for (int i = 0; i < header->polyCount; ++i) + for (int i = 0; i < tile->header->polyCount; ++i) { - const dtPoly* p = &header->polys[i]; + const dtPoly* p = &tile->polys[i]; if (p->type == DT_POLYTYPE_OFFMESH_CONNECTION) // Skip off-mesh links. continue; - const dtPolyDetail* pd = &header->detailMeshes[i]; + const dtPolyDetail* pd = &tile->detailMeshes[i]; unsigned int col; if ((flags & DU_DRAWNAVMESH_CLOSEDLIST) && mesh->isInClosedList(base | (dtPolyRef)i)) @@ -144,30 +143,30 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh* mesh, const dtMeshTil for (int j = 0; j < pd->triCount; ++j) { - const unsigned char* t = &header->detailTris[(pd->triBase+j)*4]; + const unsigned char* t = &tile->detailTris[(pd->triBase+j)*4]; for (int k = 0; k < 3; ++k) { if (t[k] < p->vertCount) - dd->vertex(&header->verts[p->verts[t[k]]*3], col); + dd->vertex(&tile->verts[p->verts[t[k]]*3], col); else - dd->vertex(&header->detailVerts[(pd->vertBase+t[k]-p->vertCount)*3], col); + dd->vertex(&tile->detailVerts[(pd->vertBase+t[k]-p->vertCount)*3], col); } } } dd->end(); // Draw inter poly boundaries - drawPolyBoundaries(dd, header, duRGBA(0,48,64,32), 1.5f, true); + drawPolyBoundaries(dd, tile, duRGBA(0,48,64,32), 1.5f, true); // Draw outer poly boundaries - drawPolyBoundaries(dd, header, duRGBA(0,48,64,220), 2.5f, false); + drawPolyBoundaries(dd, tile, duRGBA(0,48,64,220), 2.5f, false); if (flags & DU_DRAWNAVMESH_OFFMESHCONS) { dd->begin(DU_DRAW_LINES, 2.0f); - for (int i = 0; i < header->polyCount; ++i) + for (int i = 0; i < tile->header->polyCount; ++i) { - const dtPoly* p = &header->polys[i]; + const dtPoly* p = &tile->polys[i]; if (p->type != DT_POLYTYPE_OFFMESH_CONNECTION) // Skip regular polys. continue; @@ -177,18 +176,18 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh* mesh, const dtMeshTil else col = duDarkenColor(duIntToCol(p->area, 220)); - const dtOffMeshConnection* con = &header->offMeshCons[i - header->offMeshBase]; - const float* va = &header->verts[p->verts[0]*3]; - const float* vb = &header->verts[p->verts[1]*3]; + const dtOffMeshConnection* con = &tile->offMeshCons[i - tile->header->offMeshBase]; + const float* va = &tile->verts[p->verts[0]*3]; + const float* vb = &tile->verts[p->verts[1]*3]; // Check to see if start and end end-points have links. bool startSet = false; bool endSet = false; - for (unsigned int k = p->firstLink; k != DT_NULL_LINK; k = header->links[k].next) + for (unsigned int k = p->firstLink; k != DT_NULL_LINK; k = tile->links[k].next) { - if (header->links[k].edge == 0) + if (tile->links[k].edge == 0) startSet = true; - if (header->links[k].edge == 1) + if (tile->links[k].edge == 1) endSet = true; } @@ -223,9 +222,9 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh* mesh, const dtMeshTil const unsigned int vcol = duRGBA(0,0,0,196); dd->begin(DU_DRAW_POINTS, 3.0f); - for (int i = 0; i < header->vertCount; ++i) + for (int i = 0; i < tile->header->vertCount; ++i) { - const float* v = &header->verts[i*3]; + const float* v = &tile->verts[i*3]; dd->vertex(v[0], v[1], v[2], vcol); } dd->end(); @@ -330,22 +329,20 @@ void duDebugDrawNavMesh(duDebugDraw* dd, const dtNavMesh* mesh, unsigned char fl static void drawMeshTileBVTree(duDebugDraw* dd, const dtNavMesh* mesh, const dtMeshTile* tile) { - const dtMeshHeader* header = tile->header; - // Draw BV nodes. - const float cs = 1.0f / header->bvQuantFactor; + const float cs = 1.0f / tile->header->bvQuantFactor; dd->begin(DU_DRAW_LINES, 1.0f); - for (int i = 0; i < header->bvNodeCount; ++i) + for (int i = 0; i < tile->header->bvNodeCount; ++i) { - const dtBVNode* n = &header->bvTree[i]; + const dtBVNode* n = &tile->bvTree[i]; if (n->i < 0) // Leaf indices are positive. continue; - duAppendBoxWire(dd, header->bmin[0] + n->bmin[0]*cs, - header->bmin[1] + n->bmin[1]*cs, - header->bmin[2] + n->bmin[2]*cs, - header->bmin[0] + n->bmax[0]*cs, - header->bmin[1] + n->bmax[1]*cs, - header->bmin[2] + n->bmax[2]*cs, + duAppendBoxWire(dd, tile->header->bmin[0] + n->bmin[0]*cs, + tile->header->bmin[1] + n->bmin[1]*cs, + tile->header->bmin[2] + n->bmin[2]*cs, + tile->header->bmin[0] + n->bmax[0]*cs, + tile->header->bmin[1] + n->bmax[1]*cs, + tile->header->bmin[2] + n->bmax[2]*cs, duRGBA(255,255,255,128)); } dd->end(); @@ -450,8 +447,7 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh* mesh, dtPolyRef re const dtMeshTile* tile = mesh->getTileByRef(ref, &ip); if (!tile) return; - const dtMeshHeader* header = tile->header; - const dtPoly* p = &header->polys[ip]; + const dtPoly* p = &tile->polys[ip]; dd->depthMask(false); @@ -459,7 +455,7 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh* mesh, dtPolyRef re if (p->type == DT_POLYTYPE_OFFMESH_CONNECTION) { - dtOffMeshConnection* con = &header->offMeshCons[ip - header->offMeshBase]; + dtOffMeshConnection* con = &tile->offMeshCons[ip - tile->header->offMeshBase]; dd->begin(DU_DRAW_LINES, 2.0f); @@ -472,18 +468,18 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh* mesh, dtPolyRef re } else { - const dtPolyDetail* pd = &header->detailMeshes[ip]; + const dtPolyDetail* pd = &tile->detailMeshes[ip]; dd->begin(DU_DRAW_TRIS); for (int i = 0; i < pd->triCount; ++i) { - const unsigned char* t = &header->detailTris[(pd->triBase+i)*4]; + const unsigned char* t = &tile->detailTris[(pd->triBase+i)*4]; for (int j = 0; j < 3; ++j) { if (t[j] < p->vertCount) - dd->vertex(&header->verts[p->verts[t[j]]*3], c); + dd->vertex(&tile->verts[p->verts[t[j]]*3], c); else - dd->vertex(&header->detailVerts[(pd->vertBase+t[j]-p->vertCount)*3], c); + dd->vertex(&tile->detailVerts[(pd->vertBase+t[j]-p->vertCount)*3], c); } } dd->end(); diff --git a/Detour/Include/DetourNavMesh.h b/Detour/Include/DetourNavMesh.h index 2f650ab..8dd638c 100644 --- a/Detour/Include/DetourNavMesh.h +++ b/Detour/Include/DetourNavMesh.h @@ -26,7 +26,7 @@ typedef unsigned int dtPolyRef; static const int DT_VERTS_PER_POLYGON = 6; static const int DT_NAVMESH_MAGIC = 'D'<<24 | 'N'<<16 | 'A'<<8 | 'V'; //'DNAV'; -static const int DT_NAVMESH_VERSION = 2; +static const int DT_NAVMESH_VERSION = 3; static const unsigned short DT_EXT_LINK = 0x8000; static const unsigned int DT_NULL_LINK = 0xffffffff; @@ -106,7 +106,6 @@ struct dtMeshHeader { int magic; // Magic number, used to identify the data. int version; // Data version number. - int polyCount; // Number of polygons in the tile. int vertCount; // Number of vertices in the tile. int maxLinkCount; // Number of allocated links. @@ -116,12 +115,20 @@ struct dtMeshHeader int bvNodeCount; // Number of BVtree nodes. int offMeshConCount; // Number of Off-Mesh links. int offMeshBase; // Index to first polygon which is Off-Mesh link. - unsigned int linksFreeList; // Index to next free link. float walkableHeight; // Height of the agent. float walkableRadius; // Radius of the agent float walkableClimb; // Max climb height of the agent. float bmin[3], bmax[3]; // Bounding box of the tile. float bvQuantFactor; // BVtree quantization factor (world to bvnode coords) +}; + +struct dtMeshTile +{ + unsigned int salt; // Counter describing modifications to the tile. + int x,y; // Grid location of the tile. + + unsigned int linksFreeList; // Index to next free link. + dtMeshHeader* header; // Pointer to tile header. dtPoly* polys; // Pointer to the polygons (will be updated when tile is added). float* verts; // Pointer to the vertices (will be updated when tile added). dtLink* links; // Pointer to the links (will be updated when tile added). @@ -130,13 +137,7 @@ struct dtMeshHeader unsigned char* detailTris; // Pointer to detail triangles (will be updated when tile added). dtBVNode* bvTree; // Pointer to BVtree nodes (will be updated when tile added). dtOffMeshConnection* offMeshCons; // Pointer to Off-Mesh links. (will be updated when tile added). -}; - -struct dtMeshTile -{ - unsigned int salt; // Counter describing modifications to the tile. - int x,y; // Grid location of the tile. - dtMeshHeader* header; // Pointer to tile header. + unsigned char* data; // Pointer to tile data. int dataSize; // Size of the tile data. bool ownsData; // Flag indicating of the navmesh should release the data. @@ -383,13 +384,13 @@ public: void setPolyFlags(dtPolyRef ref, unsigned short flags); // Return polygon flags. - unsigned short getPolyFlags(dtPolyRef ref); + unsigned short getPolyFlags(dtPolyRef ref) const; // Set polygon type. void setPolyArea(dtPolyRef ref, unsigned char area); // Return polygon type. - unsigned char getPolyArea(dtPolyRef ref); + unsigned char getPolyArea(dtPolyRef ref) const; // Returns pointer to a polygon based on ref. const dtPoly* getPolyByRef(dtPolyRef ref) const; @@ -463,14 +464,14 @@ private: // Returns portal points between two polygons. bool getPortalPoints(dtPolyRef from, dtPolyRef to, float* left, float* right, unsigned char& fromType, unsigned char& toType) const; - bool getPortalPoints(dtPolyRef from, const dtPoly* fromPoly, const dtMeshHeader* fromHeader, - dtPolyRef to, const dtPoly* toPoly, const dtMeshHeader* toHeader, + bool getPortalPoints(dtPolyRef from, const dtPoly* fromPoly, const dtMeshTile* fromTile, + dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile, float* left, float* right) const; // Returns edge mid point between two polygons. bool getEdgeMidPoint(dtPolyRef from, dtPolyRef to, float* mid) const; - bool getEdgeMidPoint(dtPolyRef from, const dtPoly* fromPoly, const dtMeshHeader* fromHeader, - dtPolyRef to, const dtPoly* toPoly, const dtMeshHeader* toHeader, + bool getEdgeMidPoint(dtPolyRef from, const dtPoly* fromPoly, const dtMeshTile* fromTile, + dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile, float* mid) const; float m_orig[3]; // Origin of the tile (0,0) diff --git a/Detour/Source/DetourNavMesh.cpp b/Detour/Source/DetourNavMesh.cpp index feca328..117f7a3 100644 --- a/Detour/Source/DetourNavMesh.cpp +++ b/Detour/Source/DetourNavMesh.cpp @@ -76,17 +76,17 @@ inline int computeTileHash(int x, int y, const int mask) inline unsigned int allocLink(dtMeshTile* tile) { - if (tile->header->linksFreeList == DT_NULL_LINK) + if (tile->linksFreeList == DT_NULL_LINK) return DT_NULL_LINK; - unsigned int link = tile->header->linksFreeList; - tile->header->linksFreeList = tile->header->links[link].next; + unsigned int link = tile->linksFreeList; + tile->linksFreeList = tile->links[link].next; return link; } inline void freeLink(dtMeshTile* tile, unsigned int link) { - tile->header->links[link].next = tile->header->linksFreeList; - tile->header->linksFreeList = link; + tile->links[link].next = tile->linksFreeList; + tile->linksFreeList = link; } @@ -213,10 +213,9 @@ int dtNavMesh::findConnectingPolys(const float* va, const float* vb, dtPolyRef* con, float* conarea, int maxcon) { if (!tile) return 0; - dtMeshHeader* h = tile->header; float amin[2], amax[2]; - calcRect(va,vb, amin,amax, side, 0.01f, h->walkableClimb); + calcRect(va,vb, amin,amax, side, 0.01f, tile->header->walkableClimb); // Remove links pointing to 'side' and compact the links array. float bmin[2], bmax[2]; @@ -225,18 +224,18 @@ int dtNavMesh::findConnectingPolys(const float* va, const float* vb, dtPolyRef base = getTileId(tile); - for (int i = 0; i < h->polyCount; ++i) + for (int i = 0; i < tile->header->polyCount; ++i) { - dtPoly* poly = &h->polys[i]; + dtPoly* poly = &tile->polys[i]; const int nv = poly->vertCount; for (int j = 0; j < nv; ++j) { // Skip edges which do not point to the right side. if (poly->neis[j] != m) continue; // Check if the segments touch. - const float* vc = &h->verts[poly->verts[j]*3]; - const float* vd = &h->verts[poly->verts[(j+1) % nv]*3]; - calcRect(vc,vd, bmin,bmax, side, 0.01f, h->walkableClimb); + const float* vc = &tile->verts[poly->verts[j]*3]; + const float* vd = &tile->verts[poly->verts[(j+1) % nv]*3]; + calcRect(vc,vd, bmin,bmax, side, 0.01f, tile->header->walkableClimb); if (!overlapRects(amin,amax, bmin,bmax)) continue; // Add return value. if (n < maxcon) @@ -255,23 +254,22 @@ int dtNavMesh::findConnectingPolys(const float* va, const float* vb, void dtNavMesh::unconnectExtLinks(dtMeshTile* tile, int side) { if (!tile) return; - dtMeshHeader* header = tile->header; - for (int i = 0; i < header->polyCount; ++i) + for (int i = 0; i < tile->header->polyCount; ++i) { - dtPoly* poly = &header->polys[i]; + dtPoly* poly = &tile->polys[i]; unsigned int j = poly->firstLink; unsigned int pj = DT_NULL_LINK; while (j != DT_NULL_LINK) { - if (header->links[j].side == side) + if (tile->links[j].side == side) { // Revove link. - unsigned int nj = header->links[j].next; + unsigned int nj = tile->links[j].next; if (pj == DT_NULL_LINK) poly->firstLink = nj; else - header->links[pj].next = nj; + tile->links[pj].next = nj; freeLink(tile, j); j = nj; } @@ -279,7 +277,7 @@ void dtNavMesh::unconnectExtLinks(dtMeshTile* tile, int side) { // Advance pj = j; - j = header->links[j].next; + j = tile->links[j].next; } } } @@ -288,12 +286,11 @@ void dtNavMesh::unconnectExtLinks(dtMeshTile* tile, int side) void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side) { if (!tile) return; - dtMeshHeader* header = tile->header; // Connect border links. - for (int i = 0; i < header->polyCount; ++i) + for (int i = 0; i < tile->header->polyCount; ++i) { - dtPoly* poly = &header->polys[i]; + dtPoly* poly = &tile->polys[i]; // Create new links. unsigned short m = DT_EXT_LINK | (unsigned short)side; @@ -304,8 +301,8 @@ void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side) if (poly->neis[j] != m) continue; // Create new links - const float* va = &header->verts[poly->verts[j]*3]; - const float* vb = &header->verts[poly->verts[(j+1) % nv]*3]; + const float* va = &tile->verts[poly->verts[j]*3]; + const float* vb = &tile->verts[poly->verts[(j+1) % nv]*3]; dtPolyRef nei[4]; float neia[4*2]; int nnei = findConnectingPolys(va,vb, target, opposite(side), nei,neia,4); @@ -314,7 +311,7 @@ void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side) unsigned int idx = allocLink(tile); if (idx != DT_NULL_LINK) { - dtLink* link = &header->links[idx]; + dtLink* link = &tile->links[idx]; link->ref = nei[k]; link->edge = (unsigned char)j; link->side = (unsigned char)side; @@ -346,23 +343,21 @@ void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side) void dtNavMesh::connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int side) { if (!tile) return; - dtMeshHeader* header = tile->header; // Connect off-mesh links. // We are interested on links which land from target tile to this tile. - dtMeshHeader* targetHeader = target->header; const unsigned char oppositeSide = (unsigned char)opposite(side); dtQueryFilter defaultFilter; - for (int i = 0; i < targetHeader->offMeshConCount; ++i) + for (int i = 0; i < target->header->offMeshConCount; ++i) { - dtOffMeshConnection* targetCon = &targetHeader->offMeshCons[i]; + dtOffMeshConnection* targetCon = &target->offMeshCons[i]; if (targetCon->side != oppositeSide) continue; - dtPoly* targetPoly = &targetHeader->polys[targetCon->poly]; + dtPoly* targetPoly = &target->polys[targetCon->poly]; - const float ext[3] = { targetCon->rad, targetHeader->walkableClimb, targetCon->rad }; + const float ext[3] = { targetCon->rad, target->header->walkableClimb, targetCon->rad }; // Find polygon to connect to. const float* p = &targetCon->pos[3]; @@ -373,14 +368,14 @@ void dtNavMesh::connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int if (sqr(nearestPt[0]-p[0])+sqr(nearestPt[2]-p[2]) > sqr(targetCon->rad)) continue; // Make sure the location is on current mesh. - float* v = &targetHeader->verts[targetPoly->verts[1]*3]; + float* v = &target->verts[targetPoly->verts[1]*3]; vcopy(v, nearestPt); // Link off-mesh connection to target poly. unsigned int idx = allocLink(target); if (idx != DT_NULL_LINK) { - dtLink* link = &targetHeader->links[idx]; + dtLink* link = &target->links[idx]; link->ref = ref; link->edge = (unsigned char)1; link->side = oppositeSide; @@ -397,8 +392,8 @@ void dtNavMesh::connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int if (idx != DT_NULL_LINK) { unsigned short landPolyIdx = decodePolyIdPoly(ref); - dtPoly* landPoly = &header->polys[landPolyIdx]; - dtLink* link = &header->links[idx]; + dtPoly* landPoly = &tile->polys[landPolyIdx]; + dtLink* link = &tile->links[idx]; link->ref = getTileId(target) | (unsigned int)(targetCon->poly); link->edge = 0; link->side = side; @@ -415,13 +410,12 @@ void dtNavMesh::connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int void dtNavMesh::connectIntLinks(dtMeshTile* tile) { if (!tile) return; - dtMeshHeader* header = tile->header; dtPolyRef base = getTileId(tile); - for (int i = 0; i < header->polyCount; ++i) + for (int i = 0; i < tile->header->polyCount; ++i) { - dtPoly* poly = &header->polys[i]; + dtPoly* poly = &tile->polys[i]; poly->firstLink = DT_NULL_LINK; if (poly->type == DT_POLYTYPE_OFFMESH_CONNECTION) @@ -437,7 +431,7 @@ void dtNavMesh::connectIntLinks(dtMeshTile* tile) unsigned int idx = allocLink(tile); if (idx != DT_NULL_LINK) { - dtLink* link = &header->links[idx]; + dtLink* link = &tile->links[idx]; link->ref = base | (unsigned int)(poly->neis[j]-1); link->edge = (unsigned char)j; link->side = 0xff; @@ -453,18 +447,17 @@ void dtNavMesh::connectIntLinks(dtMeshTile* tile) void dtNavMesh::connectIntOffMeshLinks(dtMeshTile* tile) { if (!tile) return; - dtMeshHeader* header = tile->header; dtPolyRef base = getTileId(tile); // Find Off-mesh connection end points. - for (int i = 0; i < header->offMeshConCount; ++i) + for (int i = 0; i < tile->header->offMeshConCount; ++i) { - dtOffMeshConnection* con = &header->offMeshCons[i]; - dtPoly* poly = &header->polys[con->poly]; + dtOffMeshConnection* con = &tile->offMeshCons[i]; + dtPoly* poly = &tile->polys[con->poly]; dtQueryFilter defaultFilter; - const float ext[3] = { con->rad, header->walkableClimb, con->rad }; + const float ext[3] = { con->rad, tile->header->walkableClimb, con->rad }; for (int j = 0; j < 2; ++j) { @@ -481,14 +474,14 @@ void dtNavMesh::connectIntOffMeshLinks(dtMeshTile* tile) if (sqr(nearestPt[0]-p[0])+sqr(nearestPt[2]-p[2]) > sqr(con->rad)) continue; // Make sure the location is on current mesh. - float* v = &header->verts[poly->verts[j]*3]; + float* v = &tile->verts[poly->verts[j]*3]; vcopy(v, nearestPt); // Link off-mesh connection to target poly. unsigned int idx = allocLink(tile); if (idx != DT_NULL_LINK) { - dtLink* link = &header->links[idx]; + dtLink* link = &tile->links[idx]; link->ref = ref; link->edge = (unsigned char)j; link->side = 0xff; @@ -507,8 +500,8 @@ void dtNavMesh::connectIntOffMeshLinks(dtMeshTile* tile) if (idx != DT_NULL_LINK) { unsigned short landPolyIdx = decodePolyIdPoly(ref); - dtPoly* landPoly = &header->polys[landPolyIdx]; - dtLink* link = &header->links[idx]; + dtPoly* landPoly = &tile->polys[landPolyIdx]; + dtLink* link = &tile->links[idx]; link->ref = base | (unsigned int)(con->poly); link->edge = 0; link->side = 0xff; @@ -560,20 +553,20 @@ bool dtNavMesh::addTileAt(int x, int y, unsigned char* data, int dataSize, bool const int offMeshLinksSize = align4(sizeof(dtOffMeshConnection)*header->offMeshConCount); unsigned char* d = data + headerSize; - header->verts = (float*)d; d += vertsSize; - header->polys = (dtPoly*)d; d += polysSize; - header->links = (dtLink*)d; d += linksSize; - header->detailMeshes = (dtPolyDetail*)d; d += detailMeshesSize; - header->detailVerts = (float*)d; d += detailVertsSize; - header->detailTris = (unsigned char*)d; d += detailTrisSize; - header->bvTree = (dtBVNode*)d; d += bvtreeSize; - header->offMeshCons = (dtOffMeshConnection*)d; d += offMeshLinksSize; + tile->verts = (float*)d; d += vertsSize; + tile->polys = (dtPoly*)d; d += polysSize; + tile->links = (dtLink*)d; d += linksSize; + tile->detailMeshes = (dtPolyDetail*)d; d += detailMeshesSize; + tile->detailVerts = (float*)d; d += detailVertsSize; + tile->detailTris = (unsigned char*)d; d += detailTrisSize; + tile->bvTree = (dtBVNode*)d; d += bvtreeSize; + tile->offMeshCons = (dtOffMeshConnection*)d; d += offMeshLinksSize; // Build links freelist - header->linksFreeList = 0; - header->links[header->maxLinkCount-1].next = DT_NULL_LINK; + tile->linksFreeList = 0; + tile->links[header->maxLinkCount-1].next = DT_NULL_LINK; for (int i = 0; i < header->maxLinkCount-1; ++i) - header->links[i].next = i+1; + tile->links[i].next = i+1; // Init tile. tile->header = header; @@ -705,6 +698,16 @@ bool dtNavMesh::removeTileAt(int x, int y, unsigned char** data, int* dataSize) if (dataSize) *dataSize = tile->dataSize; } tile->header = 0; + tile->linksFreeList = 0; + tile->polys = 0; + tile->verts = 0; + tile->links = 0; + tile->detailMeshes = 0; + tile->detailVerts = 0; + tile->detailTris = 0; + tile->bvTree = 0; + tile->offMeshCons = 0; + tile->x = tile->y = 0; tile->salt++; @@ -737,22 +740,21 @@ bool dtNavMesh::closestPointOnPoly(dtPolyRef ref, const float* pos, float* close bool dtNavMesh::closestPointOnPolyInTile(const dtMeshTile* tile, unsigned int ip, const float* pos, float* closest) const { - const dtMeshHeader* header = tile->header; - const dtPoly* poly = &header->polys[ip]; + const dtPoly* poly = &tile->polys[ip]; float closestDistSqr = FLT_MAX; - const dtPolyDetail* pd = &header->detailMeshes[ip]; + const dtPolyDetail* pd = &tile->detailMeshes[ip]; for (int j = 0; j < pd->triCount; ++j) { - const unsigned char* t = &header->detailTris[(pd->triBase+j)*4]; + const unsigned char* t = &tile->detailTris[(pd->triBase+j)*4]; const float* v[3]; for (int k = 0; k < 3; ++k) { if (t[k] < poly->vertCount) - v[k] = &header->verts[poly->verts[t[k]]*3]; + v[k] = &tile->verts[poly->verts[t[k]]*3]; else - v[k] = &header->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3]; + v[k] = &tile->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3]; } float pt[3]; closestPtPointTriangle(pt, pos, v[0], v[1], v[2]); @@ -773,10 +775,10 @@ bool dtNavMesh::closestPointOnPolyBoundary(dtPolyRef ref, const float* pos, floa decodePolyId(ref, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return false; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return false; - const dtMeshHeader* header = m_tiles[it].header; + const dtMeshTile* tile = &m_tiles[it]; - if (ip >= (unsigned int)header->polyCount) return false; - const dtPoly* poly = &header->polys[ip]; + if (ip >= (unsigned int)tile->header->polyCount) return false; + const dtPoly* poly = &tile->polys[ip]; // Collect vertices. float verts[DT_VERTS_PER_POLYGON*3]; @@ -785,7 +787,7 @@ bool dtNavMesh::closestPointOnPolyBoundary(dtPolyRef ref, const float* pos, floa int nv = 0; for (int i = 0; i < (int)poly->vertCount; ++i) { - vcopy(&verts[nv*3], &header->verts[poly->verts[i]*3]); + vcopy(&verts[nv*3], &tile->verts[poly->verts[i]*3]); nv++; } @@ -825,9 +827,9 @@ bool dtNavMesh::getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef p decodePolyId(polyRef, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return false; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return false; - const dtMeshHeader* header = m_tiles[it].header; - if (ip >= (unsigned int)header->polyCount) return false; - const dtPoly* poly = &header->polys[ip]; + const dtMeshTile* tile = &m_tiles[it]; + if (ip >= (unsigned int)tile->header->polyCount) return false; + const dtPoly* poly = &tile->polys[ip]; // Make sure that the current poly is indeed off-mesh link. if (poly->type != DT_POLYTYPE_OFFMESH_CONNECTION) @@ -837,11 +839,11 @@ bool dtNavMesh::getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef p int idx0 = 0, idx1 = 1; // Find link that points to first vertex. - for (unsigned int i = poly->firstLink; i != DT_NULL_LINK; i = header->links[i].next) + for (unsigned int i = poly->firstLink; i != DT_NULL_LINK; i = tile->links[i].next) { - if (header->links[i].edge == 0) + if (tile->links[i].edge == 0) { - if (header->links[i].ref != prevRef) + if (tile->links[i].ref != prevRef) { idx0 = 1; idx1 = 0; @@ -850,8 +852,8 @@ bool dtNavMesh::getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef p } } - vcopy(startPos, &header->verts[poly->verts[idx0]*3]); - vcopy(endPos, &header->verts[poly->verts[idx1]*3]); + vcopy(startPos, &tile->verts[poly->verts[idx0]*3]); + vcopy(endPos, &tile->verts[poly->verts[idx1]*3]); return true; } @@ -863,15 +865,15 @@ bool dtNavMesh::getPolyHeight(dtPolyRef ref, const float* pos, float* height) co decodePolyId(ref, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return false; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return false; - const dtMeshHeader* header = m_tiles[it].header; + const dtMeshTile* tile = &m_tiles[it]; - if (ip >= (unsigned int)header->polyCount) return false; - const dtPoly* poly = &header->polys[ip]; + if (ip >= (unsigned int)tile->header->polyCount) return false; + const dtPoly* poly = &tile->polys[ip]; if (poly->type == DT_POLYTYPE_OFFMESH_CONNECTION) { - const float* v0 = &header->verts[poly->verts[0]*3]; - const float* v1 = &header->verts[poly->verts[1]*3]; + const float* v0 = &tile->verts[poly->verts[0]*3]; + const float* v1 = &tile->verts[poly->verts[1]*3]; const float d0 = vdist(pos, v0); const float d1 = vdist(pos, v1); const float u = d0 / (d0+d1); @@ -881,17 +883,17 @@ bool dtNavMesh::getPolyHeight(dtPolyRef ref, const float* pos, float* height) co } else { - const dtPolyDetail* pd = &header->detailMeshes[ip]; + const dtPolyDetail* pd = &tile->detailMeshes[ip]; for (int j = 0; j < pd->triCount; ++j) { - const unsigned char* t = &header->detailTris[(pd->triBase+j)*4]; + const unsigned char* t = &tile->detailTris[(pd->triBase+j)*4]; const float* v[3]; for (int k = 0; k < 3; ++k) { if (t[k] < poly->vertCount) - v[k] = &header->verts[poly->verts[t[k]]*3]; + v[k] = &tile->verts[poly->verts[t[k]]*3]; else - v[k] = &header->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3]; + v[k] = &tile->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3]; } float h; if (closestHeightPointTriangle(pos, v[0], v[1], v[2], h)) @@ -984,28 +986,30 @@ int dtNavMesh::queryPolygonsInTile(dtMeshTile* tile, const float* qmin, const fl dtQueryFilter* filter, dtPolyRef* polys, const int maxPolys) { - const dtMeshHeader* header = tile->header; - if (header->bvTree) + if (tile->bvTree) { - const dtBVNode* node = &header->bvTree[0]; - const dtBVNode* end = &header->bvTree[header->bvNodeCount]; - + const dtBVNode* node = &tile->bvTree[0]; + const dtBVNode* end = &tile->bvTree[tile->header->bvNodeCount]; + const float* tbmin = tile->header->bmin; + const float* tbmax = tile->header->bmax; + const float qfac = tile->header->bvQuantFactor; + // Calculate quantized box unsigned short bmin[3], bmax[3]; // Clamp query box to world box. - float minx = clamp(qmin[0], header->bmin[0], header->bmax[0]) - header->bmin[0]; - float miny = clamp(qmin[1], header->bmin[1], header->bmax[1]) - header->bmin[1]; - float minz = clamp(qmin[2], header->bmin[2], header->bmax[2]) - header->bmin[2]; - float maxx = clamp(qmax[0], header->bmin[0], header->bmax[0]) - header->bmin[0]; - float maxy = clamp(qmax[1], header->bmin[1], header->bmax[1]) - header->bmin[1]; - float maxz = clamp(qmax[2], header->bmin[2], header->bmax[2]) - header->bmin[2]; + float minx = clamp(qmin[0], tbmin[0], tbmax[0]) - tbmin[0]; + float miny = clamp(qmin[1], tbmin[1], tbmax[1]) - tbmin[1]; + float minz = clamp(qmin[2], tbmin[2], tbmax[2]) - tbmin[2]; + float maxx = clamp(qmax[0], tbmin[0], tbmax[0]) - tbmin[0]; + float maxy = clamp(qmax[1], tbmin[1], tbmax[1]) - tbmin[1]; + float maxz = clamp(qmax[2], tbmin[2], tbmax[2]) - tbmin[2]; // Quantize - bmin[0] = (unsigned short)(header->bvQuantFactor * minx) & 0xfffe; - bmin[1] = (unsigned short)(header->bvQuantFactor * miny) & 0xfffe; - bmin[2] = (unsigned short)(header->bvQuantFactor * minz) & 0xfffe; - bmax[0] = (unsigned short)(header->bvQuantFactor * maxx + 1) | 1; - bmax[1] = (unsigned short)(header->bvQuantFactor * maxy + 1) | 1; - bmax[2] = (unsigned short)(header->bvQuantFactor * maxz + 1) | 1; + bmin[0] = (unsigned short)(qfac * minx) & 0xfffe; + bmin[1] = (unsigned short)(qfac * miny) & 0xfffe; + bmin[2] = (unsigned short)(qfac * minz) & 0xfffe; + bmax[0] = (unsigned short)(qfac * maxx + 1) | 1; + bmax[1] = (unsigned short)(qfac * maxy + 1) | 1; + bmax[2] = (unsigned short)(qfac * maxz + 1) | 1; // Traverse tree dtPolyRef base = getTileId(tile); @@ -1017,7 +1021,7 @@ int dtNavMesh::queryPolygonsInTile(dtMeshTile* tile, const float* qmin, const fl if (isLeafNode && overlap) { - if (passFilter(filter, header->polys[node->i].flags)) + if (passFilter(filter, tile->polys[node->i].flags)) { if (n < maxPolys) polys[n++] = base | (dtPolyRef)node->i; @@ -1038,19 +1042,18 @@ int dtNavMesh::queryPolygonsInTile(dtMeshTile* tile, const float* qmin, const fl else { float bmin[3], bmax[3]; - const dtMeshHeader* header = tile->header; int n = 0; dtPolyRef base = getTileId(tile); - for (int i = 0; i < header->polyCount; ++i) + for (int i = 0; i < tile->header->polyCount; ++i) { // Calc polygon bounds. - dtPoly* p = &header->polys[i]; - const float* v = &header->verts[p->verts[0]*3]; + dtPoly* p = &tile->polys[i]; + const float* v = &tile->verts[p->verts[0]*3]; vcopy(bmin, v); vcopy(bmax, v); for (int j = 1; j < p->vertCount; ++j) { - v = &header->verts[p->verts[j]*3]; + v = &tile->verts[p->verts[j]*3]; vmin(bmin, v); vmax(bmax, v); } @@ -1157,12 +1160,12 @@ int dtNavMesh::findPath(dtPolyRef startRef, dtPolyRef endRef, const dtPolyRef bestRef = bestNode->id; it = decodePolyIdTile(bestRef); ip = decodePolyIdPoly(bestRef); - const dtMeshHeader* bestHeader = m_tiles[it].header; - const dtPoly* bestPoly = &bestHeader->polys[ip]; + const dtMeshTile* bestTile = &m_tiles[it]; + const dtPoly* bestPoly = &bestTile->polys[ip]; // Get parent poly and tile. dtPolyRef parentRef = 0; - const dtMeshHeader* parentHeader = 0; + const dtMeshTile* parentTile = 0; const dtPoly* parentPoly = 0; if (bestNode->pidx) parentRef = m_nodePool->getNodeAtIdx(bestNode->pidx)->id; @@ -1170,20 +1173,20 @@ int dtNavMesh::findPath(dtPolyRef startRef, dtPolyRef endRef, { it = decodePolyIdTile(parentRef); ip = decodePolyIdPoly(parentRef); - parentHeader = m_tiles[it].header; - parentPoly = &parentHeader->polys[ip]; + parentTile = &m_tiles[it]; + parentPoly = &parentTile->polys[ip]; - getEdgeMidPoint(parentRef, parentPoly, parentHeader, - bestRef, bestPoly, bestHeader, previousEdgeMidPoint); + getEdgeMidPoint(parentRef, parentPoly, parentTile, + bestRef, bestPoly, bestTile, previousEdgeMidPoint); } else { vcopy(previousEdgeMidPoint, startPos); } - for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestHeader->links[i].next) + for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestTile->links[i].next) { - dtPolyRef neighbourRef = bestHeader->links[i].ref; + dtPolyRef neighbourRef = bestTile->links[i].ref; // Skip invalid ids and do not expand back to where we came from. if (!neighbourRef || neighbourRef == bestRef) @@ -1193,8 +1196,8 @@ int dtNavMesh::findPath(dtPolyRef startRef, dtPolyRef endRef, // The API input has been cheked already, skip checking internal data. it = decodePolyIdTile(neighbourRef); ip = decodePolyIdPoly(neighbourRef); - const dtMeshHeader* neighbourHeader = m_tiles[it].header; - const dtPoly* neighbourPoly = &neighbourHeader->polys[ip]; + const dtMeshTile* neighbourTile = &m_tiles[it]; + const dtPoly* neighbourPoly = &neighbourTile->polys[ip]; if (!passFilter(filter, neighbourPoly->flags)) continue; @@ -1206,8 +1209,8 @@ int dtNavMesh::findPath(dtPolyRef startRef, dtPolyRef endRef, // Calculate cost. float edgeMidPoint[3]; - getEdgeMidPoint(bestRef, bestPoly, bestHeader, - neighbourRef, neighbourPoly, neighbourHeader, edgeMidPoint); + getEdgeMidPoint(bestRef, bestPoly, bestTile, + neighbourRef, neighbourPoly, neighbourTile, edgeMidPoint); // Special case for last node. float h = 0; @@ -1542,8 +1545,8 @@ int dtNavMesh::moveAlongPathCorridor(const float* startPos, const float* endPos, if (it >= (unsigned int)m_maxTiles) return n; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return n; if (ip >= (unsigned int)m_tiles[it].header->polyCount) return n; - const dtMeshHeader* header = m_tiles[it].header; - const dtPoly* poly = &header->polys[ip]; + const dtMeshTile* tile = &m_tiles[it]; + const dtPoly* poly = &tile->polys[ip]; // In case of Off-Mesh link, just snap to the end location and advance over it. if (poly->type == DT_POLYTYPE_OFFMESH_CONNECTION) @@ -1563,7 +1566,7 @@ int dtNavMesh::moveAlongPathCorridor(const float* startPos, const float* endPos, int nv = 0; for (int i = 0; i < (int)poly->vertCount; ++i) { - vcopy(&verts[nv*3], &header->verts[poly->verts[i]*3]); + vcopy(&verts[nv*3], &tile->verts[poly->verts[i]*3]); nv++; } @@ -1594,6 +1597,7 @@ int dtNavMesh::moveAlongPathCorridor(const float* startPos, const float* endPos, // Check to see if the point is on the portal edge to the next polygon. if (n+1 >= pathSize) return n; + // TODO: optimize float left[3], right[3]; unsigned char fromType, toType; if (!getPortalPoints(path[n], path[n+1], left, right, fromType, toType)) @@ -1617,36 +1621,36 @@ bool dtNavMesh::getPortalPoints(dtPolyRef from, dtPolyRef to, float* left, float decodePolyId(from, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return false; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return false; - if (ip >= (unsigned int)m_tiles[it].header->polyCount) return false; - const dtMeshHeader* fromHeader = m_tiles[it].header; - const dtPoly* fromPoly = &fromHeader->polys[ip]; + const dtMeshTile* fromTile = &m_tiles[it]; + if (ip >= (unsigned int)fromTile->header->polyCount) return false; + const dtPoly* fromPoly = &fromTile->polys[ip]; fromType = fromPoly->type; decodePolyId(to, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return false; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return false; - if (ip >= (unsigned int)m_tiles[it].header->polyCount) return false; - const dtMeshHeader* toHeader = m_tiles[it].header; - const dtPoly* toPoly = &toHeader->polys[ip]; + const dtMeshTile* toTile = &m_tiles[it]; + if (ip >= (unsigned int)toTile->header->polyCount) return false; + const dtPoly* toPoly = &toTile->polys[ip]; toType = toPoly->type; - return getPortalPoints(from, fromPoly, fromHeader, - to, toPoly, toHeader, + return getPortalPoints(from, fromPoly, fromTile, + to, toPoly, toTile, left, right); } // Returns portal points between two polygons. -bool dtNavMesh::getPortalPoints(dtPolyRef from, const dtPoly* fromPoly, const dtMeshHeader* fromHeader, - dtPolyRef to, const dtPoly* toPoly, const dtMeshHeader* toHeader, +bool dtNavMesh::getPortalPoints(dtPolyRef from, const dtPoly* fromPoly, const dtMeshTile* fromTile, + dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile, float* left, float* right) const { // Find the link that points to the 'to' polygon. const dtLink* link = 0; - for (unsigned int i = fromPoly->firstLink; i != DT_NULL_LINK; i = fromHeader->links[i].next) + for (unsigned int i = fromPoly->firstLink; i != DT_NULL_LINK; i = fromTile->links[i].next) { - if (fromHeader->links[i].ref == to) + if (fromTile->links[i].ref == to) { - link = &fromHeader->links[i]; + link = &fromTile->links[i]; break; } } @@ -1657,13 +1661,13 @@ bool dtNavMesh::getPortalPoints(dtPolyRef from, const dtPoly* fromPoly, const dt if (fromPoly->type == DT_POLYTYPE_OFFMESH_CONNECTION) { // Find link that points to first vertex. - for (unsigned int i = fromPoly->firstLink; i != DT_NULL_LINK; i = fromHeader->links[i].next) + for (unsigned int i = fromPoly->firstLink; i != DT_NULL_LINK; i = fromTile->links[i].next) { - if (fromHeader->links[i].ref == to) + if (fromTile->links[i].ref == to) { - const int v = fromHeader->links[i].edge; - vcopy(left, &fromHeader->verts[fromPoly->verts[v]*3]); - vcopy(right, &fromHeader->verts[fromPoly->verts[v]*3]); + const int v = fromTile->links[i].edge; + vcopy(left, &fromTile->verts[fromPoly->verts[v]*3]); + vcopy(right, &fromTile->verts[fromPoly->verts[v]*3]); return true; } } @@ -1672,13 +1676,13 @@ bool dtNavMesh::getPortalPoints(dtPolyRef from, const dtPoly* fromPoly, const dt if (toPoly->type == DT_POLYTYPE_OFFMESH_CONNECTION) { - for (unsigned int i = toPoly->firstLink; i != DT_NULL_LINK; i = toHeader->links[i].next) + for (unsigned int i = toPoly->firstLink; i != DT_NULL_LINK; i = toTile->links[i].next) { - if (toHeader->links[i].ref == from) + if (toTile->links[i].ref == from) { - const int v = toHeader->links[i].edge; - vcopy(left, &toHeader->verts[toPoly->verts[v]*3]); - vcopy(right, &toHeader->verts[toPoly->verts[v]*3]); + const int v = toTile->links[i].edge; + vcopy(left, &toTile->verts[toPoly->verts[v]*3]); + vcopy(right, &toTile->verts[toPoly->verts[v]*3]); return true; } } @@ -1688,8 +1692,8 @@ bool dtNavMesh::getPortalPoints(dtPolyRef from, const dtPoly* fromPoly, const dt // Find portal vertices. const int v0 = fromPoly->verts[link->edge]; const int v1 = fromPoly->verts[(link->edge+1) % (int)fromPoly->vertCount]; - vcopy(left, &fromHeader->verts[v0*3]); - vcopy(right, &fromHeader->verts[v1*3]); + vcopy(left, &fromTile->verts[v0*3]); + vcopy(right, &fromTile->verts[v1*3]); // If the link is at tile boundary, clamp the vertices to // the link width. @@ -1735,12 +1739,12 @@ bool dtNavMesh::getEdgeMidPoint(dtPolyRef from, dtPolyRef to, float* mid) const return true; } -bool dtNavMesh::getEdgeMidPoint(dtPolyRef from, const dtPoly* fromPoly, const dtMeshHeader* fromHeader, - dtPolyRef to, const dtPoly* toPoly, const dtMeshHeader* toHeader, +bool dtNavMesh::getEdgeMidPoint(dtPolyRef from, const dtPoly* fromPoly, const dtMeshTile* fromTile, + dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile, float* mid) const { float left[3], right[3]; - if (!getPortalPoints(from, fromPoly, fromHeader, to, toPoly, toHeader, left, right)) + if (!getPortalPoints(from, fromPoly, fromTile, to, toPoly, toTile, left, right)) return false; mid[0] = (left[0]+right[0])*0.5f; mid[1] = (left[1]+right[1])*0.5f; @@ -1754,22 +1758,22 @@ void dtNavMesh::setPolyFlags(dtPolyRef ref, unsigned short flags) decodePolyId(ref, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return; - if (ip >= (unsigned int)m_tiles[it].header->polyCount) return; - dtMeshHeader* header = m_tiles[it].header; - dtPoly* poly = &header->polys[ip]; + dtMeshTile* tile = &m_tiles[it]; + if (ip >= (unsigned int)tile->header->polyCount) return; + dtPoly* poly = &tile->polys[ip]; // Change flags. poly->flags = flags; } -unsigned short dtNavMesh::getPolyFlags(dtPolyRef ref) +unsigned short dtNavMesh::getPolyFlags(dtPolyRef ref) const { unsigned int salt, it, ip; decodePolyId(ref, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return 0; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0; - if (ip >= (unsigned int)m_tiles[it].header->polyCount) return 0; - const dtMeshHeader* header = m_tiles[it].header; - const dtPoly* poly = &header->polys[ip]; + const dtMeshTile* tile = &m_tiles[it]; + if (ip >= (unsigned int)tile->header->polyCount) return 0; + const dtPoly* poly = &tile->polys[ip]; return poly->flags; } @@ -1779,21 +1783,21 @@ void dtNavMesh::setPolyArea(dtPolyRef ref, unsigned char area) decodePolyId(ref, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return; - if (ip >= (unsigned int)m_tiles[it].header->polyCount) return; - dtMeshHeader* header = m_tiles[it].header; - dtPoly* poly = &header->polys[ip]; + dtMeshTile* tile = &m_tiles[it]; + if (ip >= (unsigned int)tile->header->polyCount) return; + dtPoly* poly = &tile->polys[ip]; poly->area = area; } -unsigned char dtNavMesh::getPolyArea(dtPolyRef ref) +unsigned char dtNavMesh::getPolyArea(dtPolyRef ref) const { unsigned int salt, it, ip; decodePolyId(ref, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return 0; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0; - if (ip >= (unsigned int)m_tiles[it].header->polyCount) return 0; - const dtMeshHeader* header = m_tiles[it].header; - const dtPoly* poly = &header->polys[ip]; + const dtMeshTile* tile = &m_tiles[it]; + if (ip >= (unsigned int)tile->header->polyCount) return 0; + const dtPoly* poly = &tile->polys[ip]; return poly->area; } @@ -1820,14 +1824,14 @@ int dtNavMesh::raycast(dtPolyRef centerRef, const float* startPos, const float* // The API input has been cheked already, skip checking internal data. unsigned int it = decodePolyIdTile(curRef); unsigned int ip = decodePolyIdPoly(curRef); - const dtMeshHeader* header = m_tiles[it].header; - const dtPoly* poly = &header->polys[ip]; + const dtMeshTile* tile = &m_tiles[it]; + const dtPoly* poly = &tile->polys[ip]; // Collect vertices. int nv = 0; for (int i = 0; i < (int)poly->vertCount; ++i) { - vcopy(&verts[nv*3], &header->verts[poly->verts[i]*3]); + vcopy(&verts[nv*3], &tile->verts[poly->verts[i]*3]); nv++; } @@ -1848,9 +1852,9 @@ int dtNavMesh::raycast(dtPolyRef centerRef, const float* startPos, const float* // Follow neighbours. dtPolyRef nextRef = 0; - for (unsigned int i = poly->firstLink; i != DT_NULL_LINK; i = header->links[i].next) + for (unsigned int i = poly->firstLink; i != DT_NULL_LINK; i = tile->links[i].next) { - const dtLink* link = &header->links[i]; + const dtLink* link = &tile->links[i]; if ((int)link->edge == segMax) { // If the link is internal, just return the ref. @@ -1863,8 +1867,8 @@ int dtNavMesh::raycast(dtPolyRef centerRef, const float* startPos, const float* // If the link is at tile boundary, const int v0 = poly->verts[link->edge]; const int v1 = poly->verts[(link->edge+1) % poly->vertCount]; - const float* left = &header->verts[v0*3]; - const float* right = &header->verts[v1*3]; + const float* left = &tile->verts[v0*3]; + const float* right = &tile->verts[v1*3]; // Check that the intersection lies inside the link portal. if (link->side == 0 || link->side == 4) @@ -1974,12 +1978,12 @@ int dtNavMesh::findPolysAround(dtPolyRef centerRef, const float* centerPos, floa const dtPolyRef bestRef = bestNode->id; it = decodePolyIdTile(bestRef); ip = decodePolyIdPoly(bestRef); - const dtMeshHeader* bestHeader = m_tiles[it].header; - const dtPoly* bestPoly = &bestHeader->polys[ip]; + const dtMeshTile* bestTile = &m_tiles[it]; + const dtPoly* bestPoly = &bestTile->polys[ip]; // Get parent poly and tile. dtPolyRef parentRef = 0; - const dtMeshHeader* parentHeader = 0; + const dtMeshTile* parentTile = 0; const dtPoly* parentPoly = 0; if (bestNode->pidx) parentRef = m_nodePool->getNodeAtIdx(bestNode->pidx)->id; @@ -1987,28 +1991,28 @@ int dtNavMesh::findPolysAround(dtPolyRef centerRef, const float* centerPos, floa { it = decodePolyIdTile(parentRef); ip = decodePolyIdPoly(parentRef); - parentHeader = m_tiles[it].header; - parentPoly = &parentHeader->polys[ip]; + parentTile = &m_tiles[it]; + parentPoly = &parentTile->polys[ip]; - getEdgeMidPoint(parentRef, parentPoly, parentHeader, - bestRef, bestPoly, bestHeader, previousEdgeMidPoint); + getEdgeMidPoint(parentRef, parentPoly, parentTile, + bestRef, bestPoly, bestTile, previousEdgeMidPoint); } else { vcopy(previousEdgeMidPoint, centerPos); } - for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestHeader->links[i].next) + for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestTile->links[i].next) { - const dtLink* link = &bestHeader->links[i]; + const dtLink* link = &bestTile->links[i]; dtPolyRef neighbourRef = link->ref; // Skip invalid neighbours and do not follow back to parent. if (!neighbourRef || neighbourRef == parentRef) continue; // Calc distance to the edge. - const float* va = &bestHeader->verts[bestPoly->verts[link->edge]*3]; - const float* vb = &bestHeader->verts[bestPoly->verts[(link->edge+1) % bestPoly->vertCount]*3]; + const float* va = &bestTile->verts[bestPoly->verts[link->edge]*3]; + const float* vb = &bestTile->verts[bestPoly->verts[(link->edge+1) % bestPoly->vertCount]*3]; float tseg; float distSqr = distancePtSegSqr2D(centerPos, va, vb, tseg); @@ -2019,8 +2023,8 @@ int dtNavMesh::findPolysAround(dtPolyRef centerRef, const float* centerPos, floa // Expand to neighbour it = decodePolyIdTile(neighbourRef); ip = decodePolyIdPoly(neighbourRef); - const dtMeshHeader* neighbourHeader = m_tiles[it].header; - const dtPoly* neighbourPoly = &neighbourHeader->polys[ip]; + const dtMeshTile* neighbourTile = &m_tiles[it]; + const dtPoly* neighbourPoly = &neighbourTile->polys[ip]; if (!passFilter(filter, neighbourPoly->flags)) continue; @@ -2031,8 +2035,8 @@ int dtNavMesh::findPolysAround(dtPolyRef centerRef, const float* centerPos, floa // Cost float edgeMidPoint[3]; - getEdgeMidPoint(bestRef, bestPoly, bestHeader, - neighbourRef, neighbourPoly, neighbourHeader, edgeMidPoint); + getEdgeMidPoint(bestRef, bestPoly, bestTile, + neighbourRef, neighbourPoly, neighbourTile, edgeMidPoint); newNode.total = bestNode->total + vdist(previousEdgeMidPoint, edgeMidPoint); @@ -2106,12 +2110,12 @@ float dtNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos, const dtPolyRef bestRef = bestNode->id; it = decodePolyIdTile(bestRef); ip = decodePolyIdPoly(bestRef); - const dtMeshHeader* bestHeader = m_tiles[it].header; - const dtPoly* bestPoly = &bestHeader->polys[ip]; + const dtMeshTile* bestTile = &m_tiles[it]; + const dtPoly* bestPoly = &bestTile->polys[ip]; // Get parent poly and tile. dtPolyRef parentRef = 0; - const dtMeshHeader* parentHeader = 0; + const dtMeshTile* parentTile = 0; const dtPoly* parentPoly = 0; if (bestNode->pidx) parentRef = m_nodePool->getNodeAtIdx(bestNode->pidx)->id; @@ -2119,11 +2123,11 @@ float dtNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos, { it = decodePolyIdTile(parentRef); ip = decodePolyIdPoly(parentRef); - parentHeader = m_tiles[it].header; - parentPoly = &parentHeader->polys[ip]; + parentTile = &m_tiles[it]; + parentPoly = &parentTile->polys[ip]; - getEdgeMidPoint(parentRef, parentPoly, parentHeader, - bestRef, bestPoly, bestHeader, previousEdgeMidPoint); + getEdgeMidPoint(parentRef, parentPoly, parentTile, + bestRef, bestPoly, bestTile, previousEdgeMidPoint); } else { @@ -2138,9 +2142,9 @@ float dtNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos, { // Tile border. bool solid = true; - for (unsigned int k = bestPoly->firstLink; k != DT_NULL_LINK; k = bestHeader->links[k].next) + for (unsigned int k = bestPoly->firstLink; k != DT_NULL_LINK; k = bestTile->links[k].next) { - const dtLink* link = &bestHeader->links[k]; + const dtLink* link = &bestTile->links[k]; if (link->edge == j) { if (link->ref != 0 && passFilter(filter, getPolyFlags(link->ref))) @@ -2150,15 +2154,15 @@ float dtNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos, } if (!solid) continue; } - else if (bestPoly->neis[j] && passFilter(filter, bestHeader->polys[bestPoly->neis[j]].flags)) + else if (bestPoly->neis[j] && passFilter(filter, bestTile->polys[bestPoly->neis[j]].flags)) { // Internal edge continue; } // Calc distance to the edge. - const float* vj = &bestHeader->verts[bestPoly->verts[j]*3]; - const float* vi = &bestHeader->verts[bestPoly->verts[i]*3]; + const float* vj = &bestTile->verts[bestPoly->verts[j]*3]; + const float* vi = &bestTile->verts[bestPoly->verts[i]*3]; float tseg; float distSqr = distancePtSegSqr2D(centerPos, vj, vi, tseg); @@ -2174,17 +2178,17 @@ float dtNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos, hitPos[2] = vj[2] + (vi[2] - vj[2])*tseg; } - for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestHeader->links[i].next) + for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestTile->links[i].next) { - const dtLink* link = &bestHeader->links[i]; + const dtLink* link = &bestTile->links[i]; dtPolyRef neighbourRef = link->ref; // Skip invalid neighbours and do not follow back to parent. if (!neighbourRef || neighbourRef == parentRef) continue; // Calc distance to the edge. - const float* va = &bestHeader->verts[bestPoly->verts[link->edge]*3]; - const float* vb = &bestHeader->verts[bestPoly->verts[(link->edge+1) % bestPoly->vertCount]*3]; + const float* va = &bestTile->verts[bestPoly->verts[link->edge]*3]; + const float* vb = &bestTile->verts[bestPoly->verts[(link->edge+1) % bestPoly->vertCount]*3]; float tseg; float distSqr = distancePtSegSqr2D(centerPos, va, vb, tseg); @@ -2195,8 +2199,8 @@ float dtNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos, // Expand to neighbour. it = decodePolyIdTile(neighbourRef); ip = decodePolyIdPoly(neighbourRef); - const dtMeshHeader* neighbourHeader = m_tiles[it].header; - const dtPoly* neighbourPoly = &neighbourHeader->polys[ip]; + const dtMeshTile* neighbourTile = &m_tiles[it]; + const dtPoly* neighbourPoly = &neighbourTile->polys[ip]; if (!passFilter(filter, neighbourPoly->flags)) continue; @@ -2207,8 +2211,8 @@ float dtNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos, // Cost float edgeMidPoint[3]; - getEdgeMidPoint(bestRef, bestPoly, bestHeader, - neighbourRef, neighbourPoly, neighbourHeader, edgeMidPoint); + getEdgeMidPoint(bestRef, bestPoly, bestTile, + neighbourRef, neighbourPoly, neighbourTile, edgeMidPoint); newNode.total = bestNode->total + vdist(previousEdgeMidPoint, edgeMidPoint); @@ -2250,7 +2254,7 @@ const dtPoly* dtNavMesh::getPolyByRef(dtPolyRef ref) const if (it >= (unsigned int)m_maxTiles) return 0; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0; if (ip >= (unsigned int)m_tiles[it].header->polyCount) return 0; - return &m_tiles[it].header->polys[ip]; + return &m_tiles[it].polys[ip]; } const float* dtNavMesh::getPolyVertsByRef(dtPolyRef ref) const @@ -2260,7 +2264,7 @@ const float* dtNavMesh::getPolyVertsByRef(dtPolyRef ref) const if (it >= (unsigned int)m_maxTiles) return 0; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0; if (ip >= (unsigned int)m_tiles[it].header->polyCount) return 0; - return m_tiles[it].header->verts; + return m_tiles[it].verts; } const dtLink* dtNavMesh::getPolyLinksByRef(dtPolyRef ref) const @@ -2270,7 +2274,7 @@ const dtLink* dtNavMesh::getPolyLinksByRef(dtPolyRef ref) const if (it >= (unsigned int)m_maxTiles) return 0; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0; if (ip >= (unsigned int)m_tiles[it].header->polyCount) return 0; - return m_tiles[it].header->links; + return m_tiles[it].links; } bool dtNavMesh::isInClosedList(dtPolyRef ref) const diff --git a/RecastDemo/Bin/Recast.app/Contents/MacOS/Recast b/RecastDemo/Bin/Recast.app/Contents/MacOS/Recast index b5f3ccf..f89f3ae 100755 Binary files a/RecastDemo/Bin/Recast.app/Contents/MacOS/Recast and b/RecastDemo/Bin/Recast.app/Contents/MacOS/Recast differ diff --git a/RecastDemo/Build/Xcode/Recast.xcodeproj/memon.pbxuser b/RecastDemo/Build/Xcode/Recast.xcodeproj/memon.pbxuser index 8453ec8..d3e438a 100644 --- a/RecastDemo/Build/Xcode/Recast.xcodeproj/memon.pbxuser +++ b/RecastDemo/Build/Xcode/Recast.xcodeproj/memon.pbxuser @@ -16,10 +16,10 @@ 8D1107260486CEB800E47090 /* Recast */, ); breakpoints = ( - 6B84BDF5110DF38D007D997B /* DetourNavMesh.cpp:254 */, + 6B84BDF5110DF38D007D997B /* DetourNavMesh.cpp:253 */, 6B84BE1D110DF6C6007D997B /* Sample_TileMesh.cpp:481 */, 6B324BE6111C511800EBD2FD /* BoxVolumeTool.cpp:27 */, - 6BE91065112A84B700F5C17A /* DetourNavMesh.cpp:1353 */, + 6BE91065112A84B700F5C17A /* DetourNavMesh.cpp:1356 */, ); codeSenseManager = 6B8632AA0F78115100E2684A /* Code sense */; executables = ( @@ -245,6 +245,37 @@ 6B8036EF113BB180005ED67B /* PBXTextBookmark */ = 6B8036EF113BB180005ED67B /* PBXTextBookmark */; 6B8036F0113BB180005ED67B /* PBXTextBookmark */ = 6B8036F0113BB180005ED67B /* PBXTextBookmark */; 6B8036F1113BB180005ED67B /* PBXTextBookmark */ = 6B8036F1113BB180005ED67B /* PBXTextBookmark */; + 6B8036F6113BB746005ED67B /* PBXTextBookmark */ = 6B8036F6113BB746005ED67B /* PBXTextBookmark */; + 6B8036F7113BB746005ED67B /* PBXTextBookmark */ = 6B8036F7113BB746005ED67B /* PBXTextBookmark */; + 6B8036F8113BB746005ED67B /* PBXTextBookmark */ = 6B8036F8113BB746005ED67B /* PBXTextBookmark */; + 6B8036F9113BB746005ED67B /* PBXTextBookmark */ = 6B8036F9113BB746005ED67B /* PBXTextBookmark */; + 6B8036FA113BB746005ED67B /* PBXTextBookmark */ = 6B8036FA113BB746005ED67B /* PBXTextBookmark */; + 6B8036FB113BB746005ED67B /* PBXTextBookmark */ = 6B8036FB113BB746005ED67B /* PBXTextBookmark */; + 6B8036FC113BB746005ED67B /* PBXTextBookmark */ = 6B8036FC113BB746005ED67B /* PBXTextBookmark */; + 6B8036FD113BB746005ED67B /* PBXTextBookmark */ = 6B8036FD113BB746005ED67B /* PBXTextBookmark */; + 6B8036FE113BB746005ED67B /* PBXTextBookmark */ = 6B8036FE113BB746005ED67B /* PBXTextBookmark */; + 6B8036FF113BB746005ED67B /* PBXTextBookmark */ = 6B8036FF113BB746005ED67B /* PBXTextBookmark */; + 6B803700113BB746005ED67B /* PBXTextBookmark */ = 6B803700113BB746005ED67B /* PBXTextBookmark */; + 6B803701113BB746005ED67B /* PBXTextBookmark */ = 6B803701113BB746005ED67B /* PBXTextBookmark */; + 6B803728113D1079005ED67B /* PBXTextBookmark */ = 6B803728113D1079005ED67B /* PBXTextBookmark */; + 6B803729113D1079005ED67B /* PBXTextBookmark */ = 6B803729113D1079005ED67B /* PBXTextBookmark */; + 6B80372A113D1079005ED67B /* PBXTextBookmark */ = 6B80372A113D1079005ED67B /* PBXTextBookmark */; + 6B80372B113D1079005ED67B /* PBXTextBookmark */ = 6B80372B113D1079005ED67B /* PBXTextBookmark */; + 6B80372C113D1079005ED67B /* PBXTextBookmark */ = 6B80372C113D1079005ED67B /* PBXTextBookmark */; + 6B80372D113D1079005ED67B /* PBXTextBookmark */ = 6B80372D113D1079005ED67B /* PBXTextBookmark */; + 6B80372E113D1079005ED67B /* PBXTextBookmark */ = 6B80372E113D1079005ED67B /* PBXTextBookmark */; + 6B80372F113D1079005ED67B /* PBXTextBookmark */ = 6B80372F113D1079005ED67B /* PBXTextBookmark */; + 6B803730113D1079005ED67B /* PBXTextBookmark */ = 6B803730113D1079005ED67B /* PBXTextBookmark */; + 6B803731113D1079005ED67B /* PBXTextBookmark */ = 6B803731113D1079005ED67B /* PBXTextBookmark */; + 6B803732113D1079005ED67B /* PBXTextBookmark */ = 6B803732113D1079005ED67B /* PBXTextBookmark */; + 6B803733113D1079005ED67B /* PBXTextBookmark */ = 6B803733113D1079005ED67B /* PBXTextBookmark */; + 6B803734113D1079005ED67B /* PBXTextBookmark */ = 6B803734113D1079005ED67B /* PBXTextBookmark */; + 6B803735113D1079005ED67B /* PBXTextBookmark */ = 6B803735113D1079005ED67B /* PBXTextBookmark */; + 6B803736113D1079005ED67B /* PBXTextBookmark */ = 6B803736113D1079005ED67B /* PBXTextBookmark */; + 6B803737113D1079005ED67B /* PBXTextBookmark */ = 6B803737113D1079005ED67B /* PBXTextBookmark */; + 6B803738113D1079005ED67B /* PBXTextBookmark */ = 6B803738113D1079005ED67B /* PBXTextBookmark */; + 6B803739113D1079005ED67B /* PBXTextBookmark */ = 6B803739113D1079005ED67B /* PBXTextBookmark */; + 6B80373A113D1079005ED67B /* PBXTextBookmark */ = 6B80373A113D1079005ED67B /* PBXTextBookmark */; 6B8DE70D10B01BBF00DF20FB = 6B8DE70D10B01BBF00DF20FB /* PBXTextBookmark */; 6BB700C310FA3AB1006DA0A6 = 6BB700C310FA3AB1006DA0A6 /* PBXTextBookmark */; 6BB7FDC010F37703006DA0A6 = 6BB7FDC010F37703006DA0A6 /* PBXTextBookmark */; @@ -374,9 +405,9 @@ }; 6B1185F61006896B0018F96F /* DetourNode.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {815, 2176}}"; + sepNavIntBoundsRect = "{{0, 0}, {815, 2016}}"; sepNavSelRange = "{1084, 0}"; - sepNavVisRange = "{391, 852}"; + sepNavVisRange = "{317, 973}"; }; }; 6B1185FC10068B040018F96F /* DetourCommon.h */ = { @@ -530,14 +561,14 @@ }; 6B25B6180FFA62BE004F1BC4 /* main.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {815, 14272}}"; - sepNavSelRange = "{1353, 0}"; - sepNavVisRange = "{516, 887}"; + sepNavIntBoundsRect = "{{0, 0}, {815, 14448}}"; + sepNavSelRange = "{8787, 0}"; + sepNavVisRange = "{8599, 680}"; }; }; 6B2AEC510FFB8946005BE9CC /* Sample_TileMesh.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {815, 1216}}"; + sepNavIntBoundsRect = "{{0, 0}, {815, 1136}}"; sepNavSelRange = "{982, 117}"; sepNavVisRange = "{0, 1254}"; sepNavWindowFrame = "{{15, 78}, {1011, 695}}"; @@ -545,9 +576,9 @@ }; 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {815, 14704}}"; - sepNavSelRange = "{3747, 0}"; - sepNavVisRange = "{3540, 552}"; + sepNavIntBoundsRect = "{{0, 0}, {1223, 15120}}"; + sepNavSelRange = "{12492, 13}"; + sepNavVisRange = "{15543, 880}"; sepNavWindowFrame = "{{38, 30}, {1214, 722}}"; }; }; @@ -1095,7 +1126,7 @@ fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; name = "main.cpp: 532"; rLen = 0; - rLoc = 11502; + rLoc = 11512; rType = 0; vrLen = 681; vrLoc = 12261; @@ -1105,7 +1136,7 @@ fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; name = "main.cpp: 532"; rLen = 0; - rLoc = 11502; + rLoc = 11512; rType = 0; vrLen = 681; vrLoc = 12261; @@ -1115,7 +1146,7 @@ fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; name = "main.cpp: 532"; rLen = 0; - rLoc = 11502; + rLoc = 11512; rType = 0; vrLen = 681; vrLoc = 12261; @@ -1125,7 +1156,7 @@ fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; name = "main.cpp: 532"; rLen = 0; - rLoc = 11502; + rLoc = 11512; rType = 0; vrLen = 777; vrLoc = 4081; @@ -1142,7 +1173,7 @@ fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; name = "main.cpp: 532"; rLen = 0; - rLoc = 11502; + rLoc = 11512; rType = 0; vrLen = 777; vrLoc = 4081; @@ -1202,7 +1233,7 @@ fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; name = "main.cpp: 467"; rLen = 0; - rLoc = 11502; + rLoc = 11512; rType = 0; vrLen = 704; vrLoc = 10946; @@ -1332,7 +1363,7 @@ fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; name = "main.cpp: 467"; rLen = 0; - rLoc = 11502; + rLoc = 11512; rType = 0; vrLen = 704; vrLoc = 10946; @@ -1446,7 +1477,7 @@ fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; name = "main.cpp: 700"; rLen = 0; - rLoc = 16223; + rLoc = 16243; rType = 0; vrLen = 807; vrLoc = 15747; @@ -1808,7 +1839,317 @@ vrLen = 1092; vrLoc = 14776; }; - 6B84BDF5110DF38D007D997B /* DetourNavMesh.cpp:254 */ = { + 6B8036F6113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */; + name = "Sample_SoloMeshSimple.cpp: 501"; + rLen = 0; + rLoc = 15545; + rType = 0; + vrLen = 974; + vrLoc = 14896; + }; + 6B8036F7113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6BB93CF410CFEC4500F74F2B /* RecastDump.h */; + name = "RecastDump.h: 16"; + rLen = 0; + rLoc = 884; + rType = 0; + vrLen = 1324; + vrLoc = 0; + }; + 6B8036F8113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B2AEC510FFB8946005BE9CC /* Sample_TileMesh.h */; + name = "Sample_TileMesh.h: 22"; + rLen = 117; + rLoc = 982; + rType = 0; + vrLen = 1254; + vrLoc = 0; + }; + 6B8036F9113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */; + name = "Sample_TileMesh.cpp: 518"; + rLen = 13; + rLoc = 12492; + rType = 0; + vrLen = 880; + vrLoc = 15543; + }; + 6B8036FA113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6BA1E88910C7BFC9008007F6 /* Sample_SoloMeshTiled.cpp */; + name = "Sample_SoloMeshTiled.cpp: 801"; + rLen = 0; + rLoc = 23810; + rType = 0; + vrLen = 1088; + vrLoc = 23487; + }; + 6B8036FB113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; + name = "main.cpp: 41"; + rLen = 0; + rLoc = 1353; + rType = 0; + vrLen = 886; + vrLoc = 516; + }; + 6B8036FC113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */; + name = "Sample_SoloMeshSimple.cpp: 501"; + rLen = 0; + rLoc = 15545; + rType = 0; + vrLen = 974; + vrLoc = 14896; + }; + 6B8036FD113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6BB93CF410CFEC4500F74F2B /* RecastDump.h */; + name = "RecastDump.h: 16"; + rLen = 0; + rLoc = 884; + rType = 0; + vrLen = 1324; + vrLoc = 0; + }; + 6B8036FE113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B2AEC510FFB8946005BE9CC /* Sample_TileMesh.h */; + name = "Sample_TileMesh.h: 22"; + rLen = 117; + rLoc = 982; + rType = 0; + vrLen = 1254; + vrLoc = 0; + }; + 6B8036FF113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */; + name = "Sample_TileMesh.cpp: 518"; + rLen = 13; + rLoc = 12492; + rType = 0; + vrLen = 880; + vrLoc = 15543; + }; + 6B803700113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6BA1E88910C7BFC9008007F6 /* Sample_SoloMeshTiled.cpp */; + name = "Sample_SoloMeshTiled.cpp: 801"; + rLen = 0; + rLoc = 23810; + rType = 0; + vrLen = 1088; + vrLoc = 23487; + }; + 6B803701113BB746005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; + name = "main.cpp: 304"; + rLen = 0; + rLoc = 6784; + rType = 0; + vrLen = 676; + vrLoc = 8599; + }; + 6B803728113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; + name = "main.cpp: 381"; + rLen = 0; + rLoc = 8787; + rType = 0; + vrLen = 680; + vrLoc = 8599; + }; + 6B803729113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B1185F61006896B0018F96F /* DetourNode.h */; + name = "DetourNode.h: 32"; + rLen = 0; + rLoc = 1084; + rType = 0; + vrLen = 973; + vrLoc = 317; + }; + 6B80372A113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; + name = "DetourNavMesh.cpp: 2131"; + rLen = 0; + rLoc = 57960; + rType = 0; + vrLen = 975; + vrLoc = 56923; + }; + 6B80372B113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6BB93C7B10CFE1D500F74F2B /* DetourDebugDraw.cpp */; + name = "DetourDebugDraw.cpp: 468"; + rLen = 0; + rLoc = 14205; + rType = 0; + vrLen = 756; + vrLoc = 13905; + }; + 6B80372C113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; + name = "DetourNavMesh.h: 393"; + rLen = 0; + rLoc = 17252; + rType = 0; + vrLen = 1034; + vrLoc = 16661; + }; + 6B80372D113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; + name = "main.cpp: 381"; + rLen = 0; + rLoc = 8787; + rType = 0; + vrLen = 680; + vrLoc = 8599; + }; + 6B80372E113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B1185F61006896B0018F96F /* DetourNode.h */; + name = "DetourNode.h: 32"; + rLen = 0; + rLoc = 1084; + rType = 0; + vrLen = 973; + vrLoc = 317; + }; + 6B80372F113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; + name = "DetourNavMesh.h: 139"; + rLen = 0; + rLoc = 5771; + rType = 0; + vrLen = 1993; + vrLoc = 4032; + }; + 6B803730113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; + name = "DetourNavMesh.cpp: 573"; + rLen = 0; + rLoc = 16342; + rType = 0; + vrLen = 1466; + vrLoc = 15532; + }; + 6B803731113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; + name = "DetourNavMesh.h: 131"; + rLen = 0; + rLoc = 4994; + rType = 0; + vrLen = 1938; + vrLoc = 3931; + }; + 6B803732113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; + name = "DetourNavMesh.cpp: 708"; + rLen = 0; + rLoc = 19277; + rType = 0; + vrLen = 605; + vrLoc = 19041; + }; + 6B803733113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; + name = "DetourNavMesh.h: 130"; + rLen = 835; + rLoc = 4934; + rType = 0; + vrLen = 1938; + vrLoc = 3931; + }; + 6B803734113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; + name = "DetourNavMesh.cpp: 1171"; + rLen = 1; + rLoc = 31412; + rType = 0; + vrLen = 894; + vrLoc = 30824; + }; + 6B803735113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; + name = "DetourNavMesh.h: 467"; + rLen = 15; + rLoc = 20016; + rType = 0; + vrLen = 1726; + vrLoc = 19511; + }; + 6B803736113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; + name = "DetourNavMesh.cpp: 1770"; + rLen = 0; + rLoc = 47952; + rType = 0; + vrLen = 919; + vrLoc = 47803; + }; + 6B803737113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; + name = "DetourNavMesh.h: 393"; + rLen = 0; + rLoc = 17252; + rType = 0; + vrLen = 1034; + vrLoc = 16661; + }; + 6B803738113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; + name = "DetourNavMesh.cpp: 2131"; + rLen = 0; + rLoc = 57960; + rType = 0; + vrLen = 975; + vrLoc = 56923; + }; + 6B803739113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6BB93C7B10CFE1D500F74F2B /* DetourDebugDraw.cpp */; + name = "DetourDebugDraw.cpp: 468"; + rLen = 0; + rLoc = 14205; + rType = 0; + vrLen = 756; + vrLoc = 13905; + }; + 6B80373A113D1079005ED67B /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; + name = "DetourNavMesh.h: 36"; + rLen = 0; + rLoc = 1449; + rType = 0; + vrLen = 1224; + vrLoc = 706; + }; + 6B84BDF5110DF38D007D997B /* DetourNavMesh.cpp:253 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -1820,7 +2161,7 @@ functionName = "dtNavMesh::checkLinks(dtMeshTile* tile)"; hitCount = 0; ignoreCount = 0; - lineNumber = 254; + lineNumber = 253; location = Recast; modificationTime = 289124310.659572; state = 1; @@ -1910,9 +2251,9 @@ }; 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {817, 36224}}"; - sepNavSelRange = "{31872, 0}"; - sepNavVisRange = "{31353, 1135}"; + sepNavIntBoundsRect = "{{0, 0}, {971, 36416}}"; + sepNavSelRange = "{57960, 0}"; + sepNavVisRange = "{56923, 975}"; sepNavWindowFrame = "{{15, 51}, {1214, 722}}"; }; }; @@ -1925,9 +2266,9 @@ }; 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {845, 7952}}"; - sepNavSelRange = "{17660, 0}"; - sepNavVisRange = "{3977, 2045}"; + sepNavIntBoundsRect = "{{0, 0}, {845, 7904}}"; + sepNavSelRange = "{1449, 0}"; + sepNavVisRange = "{706, 1224}"; }; }; 6B8DE88C10B69E4C00DF20FB /* DetourNavMeshBuilder.h */ = { @@ -1942,7 +2283,7 @@ fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; name = detail; rLen = 0; - rLoc = 17751; + rLoc = 17764; rType = 0; vrLen = 1182; vrLoc = 9676; @@ -1950,15 +2291,15 @@ 6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {908, 10976}}"; - sepNavSelRange = "{15421, 0}"; - sepNavVisRange = "{14776, 1092}"; + sepNavSelRange = "{15545, 0}"; + sepNavVisRange = "{14896, 974}"; }; }; 6BA1E88910C7BFC9008007F6 /* Sample_SoloMeshTiled.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {815, 19372}}"; - sepNavSelRange = "{2109, 0}"; - sepNavVisRange = "{1871, 528}"; + sepNavIntBoundsRect = "{{0, 0}, {1006, 19360}}"; + sepNavSelRange = "{23810, 0}"; + sepNavVisRange = "{23487, 1088}"; }; }; 6BA1E88E10C7BFD3008007F6 /* Sample_SoloMeshSimple.h */ = { @@ -2127,9 +2468,9 @@ }; 6BB93C7B10CFE1D500F74F2B /* DetourDebugDraw.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {815, 7984}}"; - sepNavSelRange = "{14462, 0}"; - sepNavVisRange = "{14041, 759}"; + sepNavIntBoundsRect = "{{0, 0}, {815, 7872}}"; + sepNavSelRange = "{14205, 0}"; + sepNavVisRange = "{13905, 756}"; }; }; 6BB93C7C10CFE1D500F74F2B /* RecastDebugDraw.cpp */ = { @@ -2142,7 +2483,7 @@ 6BB93CF410CFEC4500F74F2B /* RecastDump.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {815, 555}}"; - sepNavSelRange = "{1162, 20}"; + sepNavSelRange = "{884, 0}"; sepNavVisRange = "{0, 1324}"; sepNavWindowFrame = "{{38, 15}, {1174, 737}}"; }; @@ -2293,7 +2634,7 @@ fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; name = "DetourNavMesh.h: 406"; rLen = 62; - rLoc = 17660; + rLoc = 17673; rType = 0; vrLen = 1097; vrLoc = 17341; @@ -2393,9 +2734,9 @@ fRef = 6BB93C7B10CFE1D500F74F2B /* DetourDebugDraw.cpp */; name = "DetourDebugDraw.cpp: 479"; rLen = 0; - rLoc = 14462; + rLoc = 14352; rType = 0; - vrLen = 759; + vrLen = 736; vrLoc = 14041; }; 6BE91033112A7D9600F5C17A /* PBXTextBookmark */ = { @@ -2413,12 +2754,12 @@ fRef = 6BB93C7B10CFE1D500F74F2B /* DetourDebugDraw.cpp */; name = "DetourDebugDraw.cpp: 479"; rLen = 0; - rLoc = 14462; + rLoc = 14352; rType = 0; - vrLen = 759; + vrLen = 736; vrLoc = 14041; }; - 6BE91065112A84B700F5C17A /* DetourNavMesh.cpp:1353 */ = { + 6BE91065112A84B700F5C17A /* DetourNavMesh.cpp:1356 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -2430,7 +2771,7 @@ functionName = "dtNavMesh::findPath(dtPolyRef startRef, dtPolyRef endRef, const float* startPos, const float* endPos, dtQueryFilter* filter, dtPolyRef* path, const int maxPathSize)"; hitCount = 0; ignoreCount = 0; - lineNumber = 1353; + lineNumber = 1356; location = Recast; modificationTime = 289124310.660328; state = 1; @@ -2450,7 +2791,7 @@ fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; name = "DetourNavMesh.h: 406"; rLen = 0; - rLoc = 17660; + rLoc = 17673; rType = 0; vrLen = 2045; vrLoc = 3977; @@ -2472,7 +2813,7 @@ rLen = 0; rLoc = 2673; rType = 0; - vrLen = 486; + vrLen = 264; vrLoc = 2714; }; 6BE9108C112A898E00F5C17A /* PBXTextBookmark */ = { @@ -2480,7 +2821,7 @@ fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; name = "DetourNavMesh.h: 406"; rLen = 0; - rLoc = 17660; + rLoc = 17673; rType = 0; vrLen = 2045; vrLoc = 3977; @@ -2510,7 +2851,7 @@ fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; name = "DetourNavMesh.cpp: 1168"; rLen = 0; - rLoc = 31682; + rLoc = 31254; rType = 0; vrLen = 846; vrLoc = 31074; @@ -2620,7 +2961,7 @@ fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; name = "DetourNavMesh.cpp: 1294"; rLen = 0; - rLoc = 35472; + rLoc = 35006; rType = 0; vrLen = 990; vrLoc = 34714; @@ -2850,7 +3191,7 @@ fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; name = "DetourNavMesh.cpp: 1167"; rLen = 0; - rLoc = 31794; + rLoc = 31362; rType = 0; vrLen = 1167; vrLoc = 31321; @@ -2880,7 +3221,7 @@ fRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; name = "DetourNavMesh.cpp: 1169"; rLen = 0; - rLoc = 31872; + rLoc = 31440; rType = 0; vrLen = 1135; vrLoc = 31353; diff --git a/RecastDemo/Build/Xcode/Recast.xcodeproj/memon.perspectivev3 b/RecastDemo/Build/Xcode/Recast.xcodeproj/memon.perspectivev3 index c2203cc..42920b3 100644 --- a/RecastDemo/Build/Xcode/Recast.xcodeproj/memon.perspectivev3 +++ b/RecastDemo/Build/Xcode/Recast.xcodeproj/memon.perspectivev3 @@ -281,14 +281,14 @@ PBXSmartGroupTreeModuleOutlineStateSelectionKey - 39 - 35 + 13 + 12 1 0 PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 370}, {358, 643}} + {{0, 99}, {358, 643}} PBXTopSmartGroupGIDs @@ -323,7 +323,7 @@ PBXProjectModuleGUID 6B8632A30F78115100E2684A PBXProjectModuleLabel - Sample_SoloMeshSimple.cpp + DetourNavMesh.h PBXSplitModuleInNavigatorKey Split0 @@ -331,11 +331,11 @@ PBXProjectModuleGUID 6B8632A40F78115100E2684A PBXProjectModuleLabel - Sample_SoloMeshSimple.cpp + DetourNavMesh.h _historyCapacity 0 bookmark - 6B8036F1113BB180005ED67B + 6B80373A113D1079005ED67B history 6B8DE70D10B01BBF00DF20FB @@ -361,7 +361,6 @@ 6B324E3B11255BA700EBD2FD 6B324E7011256D1000EBD2FD 6B324E7111256D1000EBD2FD - 6B324E7311256D1000EBD2FD 6B324F1311257F9A00EBD2FD 6B324F1E1125818400EBD2FD 6B324F1F1125818400EBD2FD @@ -372,11 +371,8 @@ 6B324FCD1125A7BB00EBD2FD 6BE90FDE112A770600F5C17A 6BE90FDF112A770600F5C17A - 6BE91032112A7D9600F5C17A 6BE91033112A7D9600F5C17A 6BE91085112A898E00F5C17A - 6BE91087112A898E00F5C17A - 6BE91095112A8AC800F5C17A 6BE910BA112A91D900F5C17A 6BE910BB112A91D900F5C17A 6BE910C2112A92A300F5C17A @@ -385,22 +381,26 @@ 6BE910F11130617300F5C17A 6BE910F21130617300F5C17A 6BE910F31130617300F5C17A - 6BE911011130618A00F5C17A 6BE9113A11379F5000F5C17A 6BE9113C11379F5000F5C17A 6B803699113BAA82005ED67B 6B80369C113BAA82005ED67B - 6B8036B8113BAF47005ED67B - 6B8036B9113BAF47005ED67B - 6B8036BA113BAF47005ED67B 6B8036BB113BAF47005ED67B 6B8036BC113BAF47005ED67B 6B8036BE113BAF47005ED67B - 6B8036CF113BAF79005ED67B 6B8036D0113BAF79005ED67B 6B8036EA113BB055005ED67B 6B8036EE113BB180005ED67B - 6B8036EF113BB180005ED67B + 6B8036F6113BB746005ED67B + 6B8036F7113BB746005ED67B + 6B8036F8113BB746005ED67B + 6B8036F9113BB746005ED67B + 6B8036FA113BB746005ED67B + 6B803728113D1079005ED67B + 6B803729113D1079005ED67B + 6B80372A113D1079005ED67B + 6B80372B113D1079005ED67B + 6B80372C113D1079005ED67B prevStack @@ -476,6 +476,24 @@ 6B8036D4113BAF79005ED67B 6B8036D5113BAF79005ED67B 6B8036F0113BB180005ED67B + 6B8036FC113BB746005ED67B + 6B8036FD113BB746005ED67B + 6B8036FE113BB746005ED67B + 6B8036FF113BB746005ED67B + 6B803700113BB746005ED67B + 6B80372D113D1079005ED67B + 6B80372E113D1079005ED67B + 6B80372F113D1079005ED67B + 6B803730113D1079005ED67B + 6B803731113D1079005ED67B + 6B803732113D1079005ED67B + 6B803733113D1079005ED67B + 6B803734113D1079005ED67B + 6B803735113D1079005ED67B + 6B803736113D1079005ED67B + 6B803737113D1079005ED67B + 6B803738113D1079005ED67B + 6B803739113D1079005ED67B SplitCount diff --git a/RecastDemo/Source/Sample_SoloMeshTiled.cpp b/RecastDemo/Source/Sample_SoloMeshTiled.cpp index 7bf1671..881d561 100644 --- a/RecastDemo/Source/Sample_SoloMeshTiled.cpp +++ b/RecastDemo/Source/Sample_SoloMeshTiled.cpp @@ -797,8 +797,8 @@ bool Sample_SoloMeshTiled::handleBuild() tbmin[1] = tileCfg.bmin[2]; tbmax[0] = tileCfg.bmax[0]; tbmax[1] = tileCfg.bmax[2]; - int cid[256];// TODO: Make grow when returning too many items. - const int ncid = rcGetChunksInRect(chunkyMesh, tbmin, tbmax, cid, 256); + int cid[512];// TODO: Make grow when returning too many items. + const int ncid = rcGetChunksInRect(chunkyMesh, tbmin, tbmax, cid, 512); if (!ncid) continue; diff --git a/RecastDemo/Source/main.cpp b/RecastDemo/Source/main.cpp index ecb99c1..712a973 100644 --- a/RecastDemo/Source/main.cpp +++ b/RecastDemo/Source/main.cpp @@ -299,7 +299,7 @@ int main(int argc, char *argv[]) bmin = sample->getBoundsMin(); bmax = sample->getBoundsMax(); } - else + else if (geom) { bmin = geom->getMeshBoundsMin(); bmax = geom->getMeshBoundsMax(); @@ -694,7 +694,7 @@ int main(int argc, char *argv[]) bmin = sample->getBoundsMin(); bmax = sample->getBoundsMax(); } - else + else if (geom) { bmin = geom->getMeshBoundsMin(); bmax = geom->getMeshBoundsMax(); @@ -811,7 +811,7 @@ int main(int argc, char *argv[]) bmin = sample->getBoundsMin(); bmax = sample->getBoundsMax(); } - else + else if (geom) { bmin = geom->getMeshBoundsMin(); bmax = geom->getMeshBoundsMax();