Fix for Issue 68
This commit is contained in:
parent
07c5750e8a
commit
32b54f7981
@ -120,7 +120,7 @@ inline bool dtVequal(const float* p0, const float* p1)
|
||||
return d < thr;
|
||||
}
|
||||
|
||||
inline unsigned int nextPow2(unsigned int v)
|
||||
inline unsigned int dtNextPow2(unsigned int v)
|
||||
{
|
||||
v--;
|
||||
v |= v >> 1;
|
||||
@ -132,7 +132,7 @@ inline unsigned int nextPow2(unsigned int v)
|
||||
return v;
|
||||
}
|
||||
|
||||
inline unsigned int ilog2(unsigned int v)
|
||||
inline unsigned int dtIlog2(unsigned int v)
|
||||
{
|
||||
unsigned int r;
|
||||
unsigned int shift;
|
||||
@ -144,19 +144,19 @@ inline unsigned int ilog2(unsigned int v)
|
||||
return r;
|
||||
}
|
||||
|
||||
inline int align4(int x) { return (x+3) & ~3; }
|
||||
inline int dtAlign4(int x) { return (x+3) & ~3; }
|
||||
|
||||
inline float vdot2D(const float* u, const float* v)
|
||||
inline float dtVdot2D(const float* u, const float* v)
|
||||
{
|
||||
return u[0]*v[0] + u[2]*v[2];
|
||||
}
|
||||
|
||||
inline float vperp2D(const float* u, const float* v)
|
||||
inline float dtVperp2D(const float* u, const float* v)
|
||||
{
|
||||
return u[2]*v[0] - u[0]*v[2];
|
||||
}
|
||||
|
||||
inline float triArea2D(const float* a, const float* b, const float* c)
|
||||
inline float dtTriArea2D(const float* a, const float* b, const float* c)
|
||||
{
|
||||
const float abx = b[0] - a[0];
|
||||
const float abz = b[2] - a[2];
|
||||
@ -165,7 +165,7 @@ inline float triArea2D(const float* a, const float* b, const float* c)
|
||||
return acx*abz - abx*acz;
|
||||
}
|
||||
|
||||
inline bool checkOverlapBox(const unsigned short amin[3], const unsigned short amax[3],
|
||||
inline bool dtCheckOverlapBox(const unsigned short amin[3], const unsigned short amax[3],
|
||||
const unsigned short bmin[3], const unsigned short bmax[3])
|
||||
{
|
||||
bool overlap = true;
|
||||
@ -175,7 +175,7 @@ inline bool checkOverlapBox(const unsigned short amin[3], const unsigned short a
|
||||
return overlap;
|
||||
}
|
||||
|
||||
inline bool overlapBounds(const float* amin, const float* amax, const float* bmin, const float* bmax)
|
||||
inline bool dtOverlapBounds(const float* amin, const float* amax, const float* bmin, const float* bmax)
|
||||
{
|
||||
bool overlap = true;
|
||||
overlap = (amin[0] > bmax[0] || amax[0] < bmin[0]) ? false : overlap;
|
||||
@ -184,21 +184,21 @@ inline bool overlapBounds(const float* amin, const float* amax, const float* bmi
|
||||
return overlap;
|
||||
}
|
||||
|
||||
void closestPtPointTriangle(float* closest, const float* p,
|
||||
void dtClosestPtPointTriangle(float* closest, const float* p,
|
||||
const float* a, const float* b, const float* c);
|
||||
|
||||
bool closestHeightPointTriangle(const float* p, const float* a, const float* b, const float* c, float& h);
|
||||
bool dtClosestHeightPointTriangle(const float* p, const float* a, const float* b, const float* c, float& h);
|
||||
|
||||
bool intersectSegmentPoly2D(const float* p0, const float* p1,
|
||||
bool dtIntersectSegmentPoly2D(const float* p0, const float* p1,
|
||||
const float* verts, int nverts,
|
||||
float& tmin, float& tmax,
|
||||
int& segMin, int& segMax);
|
||||
|
||||
bool distancePtPolyEdgesSqr(const float* pt, const float* verts, const int nverts,
|
||||
bool dtDistancePtPolyEdgesSqr(const float* pt, const float* verts, const int nverts,
|
||||
float* ed, float* et);
|
||||
|
||||
float distancePtSegSqr2D(const float* pt, const float* p, const float* q, float& t);
|
||||
float dtDistancePtSegSqr2D(const float* pt, const float* p, const float* q, float& t);
|
||||
|
||||
void calcPolyCenter(float* tc, const unsigned short* idx, int nidx, const float* verts);
|
||||
void dtCalcPolyCenter(float* tc, const unsigned short* idx, int nidx, const float* verts);
|
||||
|
||||
#endif // DETOURCOMMON_H
|
@ -19,7 +19,7 @@
|
||||
#include <math.h>
|
||||
#include "DetourCommon.h"
|
||||
|
||||
void closestPtPointTriangle(float* closest, const float* p,
|
||||
void dtClosestPtPointTriangle(float* closest, const float* p,
|
||||
const float* a, const float* b, const float* c)
|
||||
{
|
||||
// Check if P in vertex region outside A
|
||||
@ -105,7 +105,7 @@ void closestPtPointTriangle(float* closest, const float* p,
|
||||
closest[2] = a[2] + ab[2] * v + ac[2] * w;
|
||||
}
|
||||
|
||||
bool intersectSegmentPoly2D(const float* p0, const float* p1,
|
||||
bool dtIntersectSegmentPoly2D(const float* p0, const float* p1,
|
||||
const float* verts, int nverts,
|
||||
float& tmin, float& tmax,
|
||||
int& segMin, int& segMax)
|
||||
@ -125,8 +125,8 @@ bool intersectSegmentPoly2D(const float* p0, const float* p1,
|
||||
float edge[3], diff[3];
|
||||
dtVsub(edge, &verts[i*3], &verts[j*3]);
|
||||
dtVsub(diff, p0, &verts[j*3]);
|
||||
float n = vperp2D(edge, diff);
|
||||
float d = -vperp2D(edge, dir);
|
||||
float n = dtVperp2D(edge, diff);
|
||||
float d = -dtVperp2D(edge, dir);
|
||||
if (fabsf(d) < EPS)
|
||||
{
|
||||
// S is nearly parallel to this edge
|
||||
@ -165,7 +165,7 @@ bool intersectSegmentPoly2D(const float* p0, const float* p1,
|
||||
return true;
|
||||
}
|
||||
|
||||
float distancePtSegSqr2D(const float* pt, const float* p, const float* q, float& t)
|
||||
float dtDistancePtSegSqr2D(const float* pt, const float* p, const float* q, float& t)
|
||||
{
|
||||
float pqx = q[0] - p[0];
|
||||
float pqz = q[2] - p[2];
|
||||
@ -181,7 +181,7 @@ float distancePtSegSqr2D(const float* pt, const float* p, const float* q, float&
|
||||
return dx*dx + dz*dz;
|
||||
}
|
||||
|
||||
void calcPolyCenter(float* tc, const unsigned short* idx, int nidx, const float* verts)
|
||||
void dtCalcPolyCenter(float* tc, const unsigned short* idx, int nidx, const float* verts)
|
||||
{
|
||||
tc[0] = 0.0f;
|
||||
tc[1] = 0.0f;
|
||||
@ -199,23 +199,23 @@ void calcPolyCenter(float* tc, const unsigned short* idx, int nidx, const float*
|
||||
tc[2] *= s;
|
||||
}
|
||||
|
||||
bool closestHeightPointTriangle(const float* p, const float* a, const float* b, const float* c, float& h)
|
||||
bool dtClosestHeightPointTriangle(const float* p, const float* a, const float* b, const float* c, float& h)
|
||||
{
|
||||
float v0[3], v1[3], v2[3];
|
||||
dtVsub(v0, c,a);
|
||||
dtVsub(v1, b,a);
|
||||
dtVsub(v2, p,a);
|
||||
|
||||
const float dot00 = vdot2D(v0, v0);
|
||||
const float dot01 = vdot2D(v0, v1);
|
||||
const float dot02 = vdot2D(v0, v2);
|
||||
const float dot11 = vdot2D(v1, v1);
|
||||
const float dot12 = vdot2D(v1, v2);
|
||||
const float dot00 = dtVdot2D(v0, v0);
|
||||
const float dot01 = dtVdot2D(v0, v1);
|
||||
const float dot02 = dtVdot2D(v0, v2);
|
||||
const float dot11 = dtVdot2D(v1, v1);
|
||||
const float dot12 = dtVdot2D(v1, v2);
|
||||
|
||||
// Compute barycentric coordinates
|
||||
float invDenom = 1.0f / (dot00 * dot11 - dot01 * dot01);
|
||||
float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
|
||||
float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
|
||||
const float invDenom = 1.0f / (dot00 * dot11 - dot01 * dot01);
|
||||
const float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
|
||||
const float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
|
||||
|
||||
// The (sloppy) epsilon is needed to allow to get height of points which
|
||||
// are interpolated along the edges of the triangles.
|
||||
@ -231,7 +231,7 @@ bool closestHeightPointTriangle(const float* p, const float* a, const float* b,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool distancePtPolyEdgesSqr(const float* pt, const float* verts, const int nverts,
|
||||
bool dtDistancePtPolyEdgesSqr(const float* pt, const float* verts, const int nverts,
|
||||
float* ed, float* et)
|
||||
{
|
||||
// TODO: Replace pnpoly with triArea2D tests?
|
||||
@ -244,7 +244,7 @@ bool distancePtPolyEdgesSqr(const float* pt, const float* verts, const int nvert
|
||||
if (((vi[2] > pt[2]) != (vj[2] > pt[2])) &&
|
||||
(pt[0] < (vj[0]-vi[0]) * (pt[2]-vi[2]) / (vj[2]-vi[2]) + vi[0]) )
|
||||
c = !c;
|
||||
ed[j] = distancePtSegSqr2D(pt, vj, vi, et[j]);
|
||||
ed[j] = dtDistancePtSegSqr2D(pt, vj, vi, et[j]);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ bool dtNavMesh::init(const dtNavMeshParams* params)
|
||||
|
||||
// Init tiles
|
||||
m_maxTiles = params->maxTiles;
|
||||
m_tileLutSize = nextPow2(params->maxTiles/4);
|
||||
m_tileLutSize = dtNextPow2(params->maxTiles/4);
|
||||
if (!m_tileLutSize) m_tileLutSize = 1;
|
||||
m_tileLutMask = m_tileLutSize-1;
|
||||
|
||||
@ -168,7 +168,7 @@ bool dtNavMesh::init(const dtNavMeshParams* params)
|
||||
|
||||
if (!m_nodePool)
|
||||
{
|
||||
m_nodePool = new dtNodePool(params->maxNodes, nextPow2(params->maxNodes/4));
|
||||
m_nodePool = new dtNodePool(params->maxNodes, dtNextPow2(params->maxNodes/4));
|
||||
if (!m_nodePool)
|
||||
return false;
|
||||
}
|
||||
@ -181,8 +181,8 @@ bool dtNavMesh::init(const dtNavMeshParams* params)
|
||||
}
|
||||
|
||||
// Init ID generator values.
|
||||
m_tileBits = dtMax((unsigned int)1,ilog2(nextPow2((unsigned int)params->maxTiles)));
|
||||
m_polyBits = dtMax((unsigned int)1,ilog2(nextPow2((unsigned int)params->maxPolys)));
|
||||
m_tileBits = dtMax((unsigned int)1, dtIlog2(dtNextPow2((unsigned int)params->maxTiles)));
|
||||
m_polyBits = dtMax((unsigned int)1, dtIlog2(dtNextPow2((unsigned int)params->maxPolys)));
|
||||
m_saltBits = 32 - m_tileBits - m_polyBits;
|
||||
if (m_saltBits < 10)
|
||||
return false;
|
||||
@ -591,15 +591,15 @@ dtTileRef dtNavMesh::addTile(unsigned char* data, int dataSize, int flags, dtTil
|
||||
m_posLookup[h] = tile;
|
||||
|
||||
// Patch header pointers.
|
||||
const int headerSize = align4(sizeof(dtMeshHeader));
|
||||
const int vertsSize = align4(sizeof(float)*3*header->vertCount);
|
||||
const int polysSize = align4(sizeof(dtPoly)*header->polyCount);
|
||||
const int linksSize = align4(sizeof(dtLink)*(header->maxLinkCount));
|
||||
const int detailMeshesSize = align4(sizeof(dtPolyDetail)*header->detailMeshCount);
|
||||
const int detailVertsSize = align4(sizeof(float)*3*header->detailVertCount);
|
||||
const int detailTrisSize = align4(sizeof(unsigned char)*4*header->detailTriCount);
|
||||
const int bvtreeSize = align4(sizeof(dtBVNode)*header->bvNodeCount);
|
||||
const int offMeshLinksSize = align4(sizeof(dtOffMeshConnection)*header->offMeshConCount);
|
||||
const int headerSize = dtAlign4(sizeof(dtMeshHeader));
|
||||
const int vertsSize = dtAlign4(sizeof(float)*3*header->vertCount);
|
||||
const int polysSize = dtAlign4(sizeof(dtPoly)*header->polyCount);
|
||||
const int linksSize = dtAlign4(sizeof(dtLink)*(header->maxLinkCount));
|
||||
const int detailMeshesSize = dtAlign4(sizeof(dtPolyDetail)*header->detailMeshCount);
|
||||
const int detailVertsSize = dtAlign4(sizeof(float)*3*header->detailVertCount);
|
||||
const int detailTrisSize = dtAlign4(sizeof(unsigned char)*4*header->detailTriCount);
|
||||
const int bvtreeSize = dtAlign4(sizeof(dtBVNode)*header->bvNodeCount);
|
||||
const int offMeshLinksSize = dtAlign4(sizeof(dtOffMeshConnection)*header->offMeshConCount);
|
||||
|
||||
unsigned char* d = data + headerSize;
|
||||
tile->verts = (float*)d; d += vertsSize;
|
||||
@ -831,8 +831,8 @@ struct dtPolyState
|
||||
int dtNavMesh::getTileStateSize(const dtMeshTile* tile) const
|
||||
{
|
||||
if (!tile) return 0;
|
||||
const int headerSize = align4(sizeof(dtTileState));
|
||||
const int polyStateSize = align4(sizeof(dtPolyState) * tile->header->polyCount);
|
||||
const int headerSize = dtAlign4(sizeof(dtTileState));
|
||||
const int polyStateSize = dtAlign4(sizeof(dtPolyState) * tile->header->polyCount);
|
||||
return headerSize + polyStateSize;
|
||||
}
|
||||
|
||||
@ -843,8 +843,8 @@ bool dtNavMesh::storeTileState(const dtMeshTile* tile, unsigned char* data, cons
|
||||
if (maxDataSize < sizeReq)
|
||||
return false;
|
||||
|
||||
dtTileState* tileState = (dtTileState*)data; data += align4(sizeof(dtTileState));
|
||||
dtPolyState* polyStates = (dtPolyState*)data; data += align4(sizeof(dtPolyState) * tile->header->polyCount);
|
||||
dtTileState* tileState = (dtTileState*)data; data += dtAlign4(sizeof(dtTileState));
|
||||
dtPolyState* polyStates = (dtPolyState*)data; data += dtAlign4(sizeof(dtPolyState) * tile->header->polyCount);
|
||||
|
||||
// Store tile state.
|
||||
tileState->magic = DT_NAVMESH_STATE_MAGIC;
|
||||
@ -870,8 +870,8 @@ bool dtNavMesh::restoreTileState(dtMeshTile* tile, const unsigned char* data, co
|
||||
if (maxDataSize < sizeReq)
|
||||
return false;
|
||||
|
||||
const dtTileState* tileState = (const dtTileState*)data; data += align4(sizeof(dtTileState));
|
||||
const dtPolyState* polyStates = (const dtPolyState*)data; data += align4(sizeof(dtPolyState) * tile->header->polyCount);
|
||||
const dtTileState* tileState = (const dtTileState*)data; data += dtAlign4(sizeof(dtTileState));
|
||||
const dtPolyState* polyStates = (const dtPolyState*)data; data += dtAlign4(sizeof(dtPolyState) * tile->header->polyCount);
|
||||
|
||||
// Check that the restore is possible.
|
||||
if (tileState->magic != DT_NAVMESH_STATE_MAGIC)
|
||||
@ -926,7 +926,7 @@ bool dtNavMesh::closestPointOnPolyInTile(const dtMeshTile* tile, unsigned int ip
|
||||
v[k] = &tile->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3];
|
||||
}
|
||||
float pt[3];
|
||||
closestPtPointTriangle(pt, pos, v[0], v[1], v[2]);
|
||||
dtClosestPtPointTriangle(pt, pos, v[0], v[1], v[2]);
|
||||
float d = dtVdistSqr(pos, pt);
|
||||
if (d < closestDistSqr)
|
||||
{
|
||||
@ -960,7 +960,7 @@ bool dtNavMesh::closestPointOnPolyBoundary(dtPolyRef ref, const float* pos, floa
|
||||
nv++;
|
||||
}
|
||||
|
||||
bool inside = distancePtPolyEdgesSqr(pos, verts, nv, edged, edget);
|
||||
bool inside = dtDistancePtPolyEdgesSqr(pos, verts, nv, edged, edget);
|
||||
if (inside)
|
||||
{
|
||||
// Point is inside the polygon, return the point.
|
||||
@ -1065,7 +1065,7 @@ bool dtNavMesh::getPolyHeight(dtPolyRef ref, const float* pos, float* height) co
|
||||
v[k] = &tile->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3];
|
||||
}
|
||||
float h;
|
||||
if (closestHeightPointTriangle(pos, v[0], v[1], v[2], h))
|
||||
if (dtClosestHeightPointTriangle(pos, v[0], v[1], v[2], h))
|
||||
{
|
||||
if (height)
|
||||
*height = h;
|
||||
@ -1185,8 +1185,8 @@ int dtNavMesh::queryPolygonsInTile(dtMeshTile* tile, const float* qmin, const fl
|
||||
int n = 0;
|
||||
while (node < end)
|
||||
{
|
||||
bool overlap = checkOverlapBox(bmin, bmax, node->bmin, node->bmax);
|
||||
bool isLeafNode = node->i >= 0;
|
||||
const bool overlap = dtCheckOverlapBox(bmin, bmax, node->bmin, node->bmax);
|
||||
const bool isLeafNode = node->i >= 0;
|
||||
|
||||
if (isLeafNode && overlap)
|
||||
{
|
||||
@ -1540,7 +1540,7 @@ int dtNavMesh::findStraightPath(const float* startPos, const float* endPos,
|
||||
if (i == 0)
|
||||
{
|
||||
float t;
|
||||
if (distancePtSegSqr2D(portalApex, left, right, t) < (0.001*0.001f))
|
||||
if (dtDistancePtSegSqr2D(portalApex, left, right, t) < (0.001*0.001f))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1554,9 +1554,9 @@ int dtNavMesh::findStraightPath(const float* startPos, const float* endPos,
|
||||
}
|
||||
|
||||
// Right vertex.
|
||||
if (triArea2D(portalApex, portalRight, right) <= 0.0f)
|
||||
if (dtTriArea2D(portalApex, portalRight, right) <= 0.0f)
|
||||
{
|
||||
if (dtVequal(portalApex, portalRight) || triArea2D(portalApex, portalLeft, right) > 0.0f)
|
||||
if (dtVequal(portalApex, portalRight) || dtTriArea2D(portalApex, portalLeft, right) > 0.0f)
|
||||
{
|
||||
dtVcopy(portalRight, right);
|
||||
rightPolyRef = (i+1 < pathSize) ? path[i+1] : 0;
|
||||
@ -1610,9 +1610,9 @@ int dtNavMesh::findStraightPath(const float* startPos, const float* endPos,
|
||||
}
|
||||
|
||||
// Left vertex.
|
||||
if (triArea2D(portalApex, portalLeft, left) >= 0.0f)
|
||||
if (dtTriArea2D(portalApex, portalLeft, left) >= 0.0f)
|
||||
{
|
||||
if (dtVequal(portalApex, portalLeft) || triArea2D(portalApex, portalRight, left) < 0.0f)
|
||||
if (dtVequal(portalApex, portalLeft) || dtTriArea2D(portalApex, portalRight, left) < 0.0f)
|
||||
{
|
||||
dtVcopy(portalLeft, left);
|
||||
leftPolyRef = (i+1 < pathSize) ? path[i+1] : 0;
|
||||
@ -1735,7 +1735,7 @@ int dtNavMesh::moveAlongPathCorridor(const float* startPos, const float* endPos,
|
||||
nv++;
|
||||
}
|
||||
|
||||
bool inside = distancePtPolyEdgesSqr(endPos, verts, nv, edged, edget);
|
||||
const bool inside = dtDistancePtPolyEdgesSqr(endPos, verts, nv, edged, edget);
|
||||
if (inside)
|
||||
{
|
||||
// The end point is inside the current polygon.
|
||||
@ -1769,7 +1769,7 @@ int dtNavMesh::moveAlongPathCorridor(const float* startPos, const float* endPos,
|
||||
return n;
|
||||
// If the dtClamped point is close to the next portal edge, advance to next poly.
|
||||
float t;
|
||||
float d = distancePtSegSqr2D(resultPos, left, right, t);
|
||||
const float d = dtDistancePtSegSqr2D(resultPos, left, right, t);
|
||||
if (d > SLOP*SLOP)
|
||||
return n;
|
||||
// Advance to next polygon.
|
||||
@ -2002,7 +2002,7 @@ int dtNavMesh::raycast(dtPolyRef centerRef, const float* startPos, const float*
|
||||
|
||||
float tmin, tmax;
|
||||
int segMin, segMax;
|
||||
if (!intersectSegmentPoly2D(startPos, endPos, verts, nv, tmin, tmax, segMin, segMax))
|
||||
if (!dtIntersectSegmentPoly2D(startPos, endPos, verts, nv, tmin, tmax, segMin, segMax))
|
||||
{
|
||||
// Could not hit the polygon, keep the old t and report hit.
|
||||
return n;
|
||||
@ -2203,7 +2203,7 @@ int dtNavMesh::findPolysAround(dtPolyRef centerRef, const float* centerPos, floa
|
||||
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);
|
||||
float distSqr = dtDistancePtSegSqr2D(centerPos, va, vb, tseg);
|
||||
|
||||
// If the circle is not touching the next polygon, skip it.
|
||||
if (distSqr > radiusSqr)
|
||||
@ -2353,7 +2353,7 @@ float dtNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos,
|
||||
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);
|
||||
float distSqr = dtDistancePtSegSqr2D(centerPos, vj, vi, tseg);
|
||||
|
||||
// Edge is too far, skip.
|
||||
if (distSqr > radiusSqr)
|
||||
@ -2379,7 +2379,7 @@ float dtNavMesh::findDistanceToWall(dtPolyRef centerRef, const float* centerPos,
|
||||
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);
|
||||
float distSqr = dtDistancePtSegSqr2D(centerPos, va, vb, tseg);
|
||||
|
||||
// If the circle is not touching the next polygon, skip it.
|
||||
if (distSqr > radiusSqr)
|
||||
|
@ -332,15 +332,15 @@ bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData,
|
||||
}
|
||||
|
||||
// Calculate data size
|
||||
const int headerSize = align4(sizeof(dtMeshHeader));
|
||||
const int vertsSize = align4(sizeof(float)*3*totVertCount);
|
||||
const int polysSize = align4(sizeof(dtPoly)*totPolyCount);
|
||||
const int linksSize = align4(sizeof(dtLink)*maxLinkCount);
|
||||
const int detailMeshesSize = align4(sizeof(dtPolyDetail)*params->polyCount);
|
||||
const int detailVertsSize = align4(sizeof(float)*3*uniqueDetailVertCount);
|
||||
const int detailTrisSize = align4(sizeof(unsigned char)*4*params->detailTriCount);
|
||||
const int bvTreeSize = align4(sizeof(dtBVNode)*params->polyCount*2);
|
||||
const int offMeshConsSize = align4(sizeof(dtOffMeshConnection)*storedOffMeshConCount);
|
||||
const int headerSize = dtAlign4(sizeof(dtMeshHeader));
|
||||
const int vertsSize = dtAlign4(sizeof(float)*3*totVertCount);
|
||||
const int polysSize = dtAlign4(sizeof(dtPoly)*totPolyCount);
|
||||
const int linksSize = dtAlign4(sizeof(dtLink)*maxLinkCount);
|
||||
const int detailMeshesSize = dtAlign4(sizeof(dtPolyDetail)*params->polyCount);
|
||||
const int detailVertsSize = dtAlign4(sizeof(float)*3*uniqueDetailVertCount);
|
||||
const int detailTrisSize = dtAlign4(sizeof(unsigned char)*4*params->detailTriCount);
|
||||
const int bvTreeSize = dtAlign4(sizeof(dtBVNode)*params->polyCount*2);
|
||||
const int offMeshConsSize = dtAlign4(sizeof(dtOffMeshConnection)*storedOffMeshConCount);
|
||||
|
||||
const int dataSize = headerSize + vertsSize + polysSize + linksSize +
|
||||
detailMeshesSize + detailVertsSize + detailTrisSize +
|
||||
@ -631,15 +631,15 @@ bool dtNavMeshDataSwapEndian(unsigned char* data, const int /*dataSize*/)
|
||||
return false;
|
||||
|
||||
// Patch header pointers.
|
||||
const int headerSize = align4(sizeof(dtMeshHeader));
|
||||
const int vertsSize = align4(sizeof(float)*3*header->vertCount);
|
||||
const int polysSize = align4(sizeof(dtPoly)*header->polyCount);
|
||||
const int linksSize = align4(sizeof(dtLink)*(header->maxLinkCount));
|
||||
const int detailMeshesSize = align4(sizeof(dtPolyDetail)*header->detailMeshCount);
|
||||
const int detailVertsSize = align4(sizeof(float)*3*header->detailVertCount);
|
||||
const int detailTrisSize = align4(sizeof(unsigned char)*4*header->detailTriCount);
|
||||
const int bvtreeSize = align4(sizeof(dtBVNode)*header->bvNodeCount);
|
||||
const int offMeshLinksSize = align4(sizeof(dtOffMeshConnection)*header->offMeshConCount);
|
||||
const int headerSize = dtAlign4(sizeof(dtMeshHeader));
|
||||
const int vertsSize = dtAlign4(sizeof(float)*3*header->vertCount);
|
||||
const int polysSize = dtAlign4(sizeof(dtPoly)*header->polyCount);
|
||||
const int linksSize = dtAlign4(sizeof(dtLink)*(header->maxLinkCount));
|
||||
const int detailMeshesSize = dtAlign4(sizeof(dtPolyDetail)*header->detailMeshCount);
|
||||
const int detailVertsSize = dtAlign4(sizeof(float)*3*header->detailVertCount);
|
||||
const int detailTrisSize = dtAlign4(sizeof(unsigned char)*4*header->detailTriCount);
|
||||
const int bvtreeSize = dtAlign4(sizeof(dtBVNode)*header->bvNodeCount);
|
||||
const int offMeshLinksSize = dtAlign4(sizeof(dtOffMeshConnection)*header->offMeshConCount);
|
||||
|
||||
unsigned char* d = data + headerSize;
|
||||
float* verts = (float*)d; d += vertsSize;
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -216,10 +216,10 @@
|
||||
<key>_historyCapacity</key>
|
||||
<integer>0</integer>
|
||||
<key>bookmark</key>
|
||||
<string>6BF5F5571176FB74000502A6</string>
|
||||
<string>6B6C465F117C998D002CDD36</string>
|
||||
<key>history</key>
|
||||
<array>
|
||||
<string>6BF5F3751175AACB000502A6</string>
|
||||
<string>6BF5F55B1176FEC8000502A6</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>SplitCount</key>
|
||||
@ -323,13 +323,14 @@
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
|
||||
<array>
|
||||
<array>
|
||||
<integer>46</integer>
|
||||
<integer>18</integer>
|
||||
<integer>11</integer>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</array>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
|
||||
<string>{{0, 396}, {264, 643}}</string>
|
||||
<string>{{0, 102}, {264, 643}}</string>
|
||||
</dict>
|
||||
<key>PBXTopSmartGroupGIDs</key>
|
||||
<array/>
|
||||
@ -364,7 +365,7 @@
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>6B8632A30F78115100E2684A</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>main.cpp</string>
|
||||
<string>DetourNavMesh.cpp</string>
|
||||
<key>PBXSplitModuleInNavigatorKey</key>
|
||||
<dict>
|
||||
<key>Split0</key>
|
||||
@ -372,11 +373,11 @@
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>6B8632A40F78115100E2684A</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>main.cpp</string>
|
||||
<string>DetourNavMesh.cpp</string>
|
||||
<key>_historyCapacity</key>
|
||||
<integer>0</integer>
|
||||
<key>bookmark</key>
|
||||
<string>6BF5F5561176FB74000502A6</string>
|
||||
<string>6B6C4658117C998D002CDD36</string>
|
||||
<key>history</key>
|
||||
<array>
|
||||
<string>6BBB4A96115B4F3400CF791D</string>
|
||||
@ -427,11 +428,7 @@
|
||||
<string>6BF5F47D117644A2000502A6</string>
|
||||
<string>6BF5F47E117644A2000502A6</string>
|
||||
<string>6BF5F47F117644A2000502A6</string>
|
||||
<string>6BF5F482117644A2000502A6</string>
|
||||
<string>6BF5F484117644A2000502A6</string>
|
||||
<string>6BF5F4C11176EB03000502A6</string>
|
||||
<string>6BF5F4EB1176F3A4000502A6</string>
|
||||
<string>6BF5F5031176F5F8000502A6</string>
|
||||
<string>6BF5F5041176F5F8000502A6</string>
|
||||
<string>6BF5F5051176F5F8000502A6</string>
|
||||
<string>6BF5F5061176F5F8000502A6</string>
|
||||
@ -443,7 +440,11 @@
|
||||
<string>6BF5F50C1176F5F8000502A6</string>
|
||||
<string>6BF5F50D1176F5F8000502A6</string>
|
||||
<string>6BF5F52C1176FA0B000502A6</string>
|
||||
<string>6BF5F5321176FA1E000502A6</string>
|
||||
<string>6B6C464A117C9962002CDD36</string>
|
||||
<string>6B6C464B117C9962002CDD36</string>
|
||||
<string>6B6C464C117C9962002CDD36</string>
|
||||
<string>6B6C464D117C9962002CDD36</string>
|
||||
<string>6B6C464E117C9962002CDD36</string>
|
||||
</array>
|
||||
<key>prevStack</key>
|
||||
<array>
|
||||
@ -511,91 +512,11 @@
|
||||
<string>6BF5F33811759C3C000502A6</string>
|
||||
<string>6BF5F33911759C3C000502A6</string>
|
||||
<string>6BF5F34A11759C3C000502A6</string>
|
||||
<string>6BF5F486117644A2000502A6</string>
|
||||
<string>6BF5F487117644A2000502A6</string>
|
||||
<string>6BF5F488117644A2000502A6</string>
|
||||
<string>6BF5F489117644A2000502A6</string>
|
||||
<string>6BF5F48A117644A2000502A6</string>
|
||||
<string>6BF5F48B117644A2000502A6</string>
|
||||
<string>6BF5F48C117644A2000502A6</string>
|
||||
<string>6BF5F48D117644A2000502A6</string>
|
||||
<string>6BF5F48E117644A2000502A6</string>
|
||||
<string>6BF5F48F117644A2000502A6</string>
|
||||
<string>6BF5F490117644A2000502A6</string>
|
||||
<string>6BF5F491117644A2000502A6</string>
|
||||
<string>6BF5F492117644A2000502A6</string>
|
||||
<string>6BF5F493117644A2000502A6</string>
|
||||
<string>6BF5F494117644A2000502A6</string>
|
||||
<string>6BF5F495117644A2000502A6</string>
|
||||
<string>6BF5F496117644A2000502A6</string>
|
||||
<string>6BF5F497117644A2000502A6</string>
|
||||
<string>6BF5F498117644A2000502A6</string>
|
||||
<string>6BF5F499117644A2000502A6</string>
|
||||
<string>6BF5F49A117644A2000502A6</string>
|
||||
<string>6BF5F49B117644A2000502A6</string>
|
||||
<string>6BF5F49C117644A2000502A6</string>
|
||||
<string>6BF5F49D117644A2000502A6</string>
|
||||
<string>6BF5F49E117644A2000502A6</string>
|
||||
<string>6BF5F49F117644A2000502A6</string>
|
||||
<string>6BF5F4A0117644A2000502A6</string>
|
||||
<string>6BF5F4A1117644A2000502A6</string>
|
||||
<string>6BF5F4A2117644A2000502A6</string>
|
||||
<string>6BF5F4A3117644A2000502A6</string>
|
||||
<string>6BF5F4A4117644A2000502A6</string>
|
||||
<string>6BF5F4A5117644A2000502A6</string>
|
||||
<string>6BF5F4A6117644A2000502A6</string>
|
||||
<string>6BF5F4B61176E648000502A6</string>
|
||||
<string>6BF5F4B71176E648000502A6</string>
|
||||
<string>6BF5F4B81176E648000502A6</string>
|
||||
<string>6BF5F4B91176E648000502A6</string>
|
||||
<string>6BF5F4BA1176E648000502A6</string>
|
||||
<string>6BF5F4BB1176E648000502A6</string>
|
||||
<string>6BF5F4BC1176E648000502A6</string>
|
||||
<string>6BF5F4C31176EB03000502A6</string>
|
||||
<string>6BF5F4C41176EB03000502A6</string>
|
||||
<string>6BF5F4C51176EB03000502A6</string>
|
||||
<string>6BF5F4C61176EB03000502A6</string>
|
||||
<string>6BF5F4C71176EB03000502A6</string>
|
||||
<string>6BF5F4CD1176EE8E000502A6</string>
|
||||
<string>6BF5F4CE1176EE8E000502A6</string>
|
||||
<string>6BF5F4CF1176EE8E000502A6</string>
|
||||
<string>6BF5F4D41176F005000502A6</string>
|
||||
<string>6BF5F4D51176F005000502A6</string>
|
||||
<string>6BF5F4D61176F005000502A6</string>
|
||||
<string>6BF5F4D71176F005000502A6</string>
|
||||
<string>6BF5F4D81176F005000502A6</string>
|
||||
<string>6BF5F4D91176F005000502A6</string>
|
||||
<string>6BF5F4DA1176F005000502A6</string>
|
||||
<string>6BF5F4ED1176F3A4000502A6</string>
|
||||
<string>6BF5F4EE1176F3A4000502A6</string>
|
||||
<string>6BF5F4EF1176F3A4000502A6</string>
|
||||
<string>6BF5F4F01176F3A4000502A6</string>
|
||||
<string>6BF5F4F11176F3A4000502A6</string>
|
||||
<string>6BF5F4F21176F3A4000502A6</string>
|
||||
<string>6BF5F4F31176F3A4000502A6</string>
|
||||
<string>6BF5F4F41176F3A4000502A6</string>
|
||||
<string>6BF5F4F51176F3A4000502A6</string>
|
||||
<string>6BF5F50F1176F5F8000502A6</string>
|
||||
<string>6BF5F5101176F5F8000502A6</string>
|
||||
<string>6BF5F5111176F5F8000502A6</string>
|
||||
<string>6BF5F5121176F5F8000502A6</string>
|
||||
<string>6BF5F5131176F5F8000502A6</string>
|
||||
<string>6BF5F5141176F5F8000502A6</string>
|
||||
<string>6BF5F5151176F5F8000502A6</string>
|
||||
<string>6BF5F5161176F5F8000502A6</string>
|
||||
<string>6BF5F5171176F5F8000502A6</string>
|
||||
<string>6BF5F5181176F5F8000502A6</string>
|
||||
<string>6BF5F5191176F5F8000502A6</string>
|
||||
<string>6BF5F51A1176F5F8000502A6</string>
|
||||
<string>6BF5F51B1176F5F8000502A6</string>
|
||||
<string>6BF5F51C1176F5F8000502A6</string>
|
||||
<string>6BF5F51D1176F5F8000502A6</string>
|
||||
<string>6BF5F51E1176F5F8000502A6</string>
|
||||
<string>6BF5F51F1176F5F8000502A6</string>
|
||||
<string>6BF5F5201176F5F8000502A6</string>
|
||||
<string>6BF5F5211176F5F8000502A6</string>
|
||||
<string>6BF5F5221176F5F8000502A6</string>
|
||||
<string>6BF5F52E1176FA0B000502A6</string>
|
||||
<string>6B6C464F117C9962002CDD36</string>
|
||||
<string>6B6C4650117C9962002CDD36</string>
|
||||
<string>6B6C4651117C9962002CDD36</string>
|
||||
<string>6B6C4652117C9962002CDD36</string>
|
||||
<string>6B6C4653117C9962002CDD36</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>SplitCount</key>
|
||||
@ -609,18 +530,18 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {970, 530}}</string>
|
||||
<string>{{0, 0}, {970, 490}}</string>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>13 75 1256 702 0 0 1280 778 </string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXNavigatorGroup</string>
|
||||
<key>Proportion</key>
|
||||
<string>530pt</string>
|
||||
<string>490pt</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Proportion</key>
|
||||
<string>126pt</string>
|
||||
<string>166pt</string>
|
||||
<key>Tabs</key>
|
||||
<array>
|
||||
<dict>
|
||||
@ -634,7 +555,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {970, 83}}</string>
|
||||
<string>{{10, 27}, {970, 139}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>XCDetailModule</string>
|
||||
@ -688,7 +609,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {970, 99}}</string>
|
||||
<string>{{10, 27}, {970, 139}}</string>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>13 75 1256 702 0 0 1280 778 </string>
|
||||
</dict>
|
||||
@ -718,11 +639,11 @@
|
||||
</array>
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>6BF5F4A8117644A2000502A6</string>
|
||||
<string>6B6C463C117C97EF002CDD36</string>
|
||||
<string>1CA23ED40692098700951B8B</string>
|
||||
<string>6BF5F4A9117644A2000502A6</string>
|
||||
<string>6B6C463D117C97EF002CDD36</string>
|
||||
<string>6B8632A30F78115100E2684A</string>
|
||||
<string>6BF5F4AA117644A2000502A6</string>
|
||||
<string>6B6C463E117C97EF002CDD36</string>
|
||||
<string>1CA23EDF0692099D00951B8B</string>
|
||||
<string>1CA23EE00692099D00951B8B</string>
|
||||
<string>1CA23EE10692099D00951B8B</string>
|
||||
@ -871,14 +792,14 @@
|
||||
</array>
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>6BF5F4AB117644A2000502A6</string>
|
||||
<string>6B6C4659117C998D002CDD36</string>
|
||||
<string>1CCC7628064C1048000F2A68</string>
|
||||
<string>1CCC7629064C1048000F2A68</string>
|
||||
<string>6BF5F4AC117644A2000502A6</string>
|
||||
<string>6BF5F4AD117644A2000502A6</string>
|
||||
<string>6BF5F4AE117644A2000502A6</string>
|
||||
<string>6BF5F4AF117644A2000502A6</string>
|
||||
<string>6BF5F4B0117644A2000502A6</string>
|
||||
<string>6B6C465A117C998D002CDD36</string>
|
||||
<string>6B6C465B117C998D002CDD36</string>
|
||||
<string>6B6C465C117C998D002CDD36</string>
|
||||
<string>6B6C465D117C998D002CDD36</string>
|
||||
<string>6B6C465E117C998D002CDD36</string>
|
||||
</array>
|
||||
<key>ToolbarConfigUserDefaultsMinorVersion</key>
|
||||
<string>2</string>
|
||||
@ -910,8 +831,6 @@
|
||||
<integer>5</integer>
|
||||
<key>WindowOrderList</key>
|
||||
<array>
|
||||
<string>6BF5F5491176FAD9000502A6</string>
|
||||
<string>6BF5F54A1176FAD9000502A6</string>
|
||||
<string>6BF5F29911747CFA000502A6</string>
|
||||
<string>/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/Recast.xcodeproj</string>
|
||||
</array>
|
||||
|
Loading…
x
Reference in New Issue
Block a user