Updated VC project to include new tiled navmesh.
Fixed warnings for VC.
This commit is contained in:
parent
7b20818706
commit
aa7357d897
@ -83,16 +83,16 @@ struct dtTile
|
||||
dtTile* next;
|
||||
};
|
||||
|
||||
inline dtTilePolyRef encodeId(unsigned int salt, unsigned int it, unsigned int ip)
|
||||
inline dtTilePolyRef encodeId(int salt, int it, int ip)
|
||||
{
|
||||
return (salt << (DT_TILE_REF_POLY_BITS+DT_TILE_REF_TILE_BITS)) | ((it+1) << DT_TILE_REF_POLY_BITS) | ip;
|
||||
return ((unsigned int)salt << (DT_TILE_REF_POLY_BITS+DT_TILE_REF_TILE_BITS)) | ((unsigned int)(it+1) << DT_TILE_REF_POLY_BITS) | (unsigned int)ip;
|
||||
}
|
||||
|
||||
inline void decodeId(dtTilePolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip)
|
||||
inline void decodeId(dtTilePolyRef ref, int& salt, int& it, int& ip)
|
||||
{
|
||||
salt = (ref >> (DT_TILE_REF_POLY_BITS+DT_TILE_REF_TILE_BITS)) & DT_TILE_REF_SALT_MASK;
|
||||
it = ((ref >> DT_TILE_REF_POLY_BITS) & DT_TILE_REF_TILE_MASK) - 1;
|
||||
ip = ref & DT_TILE_REF_POLY_MASK;
|
||||
salt = (int)((ref >> (DT_TILE_REF_POLY_BITS+DT_TILE_REF_TILE_BITS)) & DT_TILE_REF_SALT_MASK);
|
||||
it = (int)(((ref >> DT_TILE_REF_POLY_BITS) & DT_TILE_REF_TILE_MASK) - 1);
|
||||
ip = (int)(ref & DT_TILE_REF_POLY_MASK);
|
||||
}
|
||||
|
||||
static const int DT_TILE_LOOKUP_SIZE = DT_MAX_TILES/4;
|
||||
@ -150,7 +150,7 @@ public:
|
||||
|
||||
inline const dtTilePoly* getPolyByRef(dtTilePolyRef ref) const
|
||||
{
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
decodeId(ref, salt, it, ip);
|
||||
if (it >= DT_MAX_TILES) return 0;
|
||||
if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0;
|
||||
@ -160,7 +160,7 @@ public:
|
||||
|
||||
inline const float* getPolyVertsByRef(dtTilePolyRef ref) const
|
||||
{
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
decodeId(ref, salt, it, ip);
|
||||
if (it >= DT_MAX_TILES) return 0;
|
||||
if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0;
|
||||
|
@ -671,7 +671,7 @@ int dtStatNavMesh::findPath(dtPolyRef startRef, dtPolyRef endRef,
|
||||
m_openList->push(startNode);
|
||||
|
||||
dtNode* lastBestNode = startNode;
|
||||
unsigned short lastBestNodeCost = startNode->total;
|
||||
float lastBestNodeCost = startNode->total;
|
||||
while (!m_openList->empty())
|
||||
{
|
||||
dtNode* bestNode = m_openList->pop();
|
||||
@ -1204,7 +1204,7 @@ int dtStatNavMesh::findPolysAround(dtPolyRef centerRef, const float* centerPos,
|
||||
if (resultCost)
|
||||
resultCost[n] = actualNode->total;
|
||||
if (resultDepth)
|
||||
resultDepth[n] = actualNode->cost;
|
||||
resultDepth[n] = (unsigned short)actualNode->cost;
|
||||
++n;
|
||||
}
|
||||
actualNode->flags = dtNode::OPEN;
|
||||
|
@ -610,7 +610,7 @@ bool dtTiledNavMesh::init(const float* orig, float tileSize, float portalHeight)
|
||||
|
||||
int dtTiledNavMesh::getPolyNeighbours(dtTilePolyRef ref, dtTilePolyRef* nei, int maxNei) const
|
||||
{
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
decodeId(ref, salt, it, ip);
|
||||
if (it >= DT_MAX_TILES) return 0;
|
||||
if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0;
|
||||
@ -934,7 +934,7 @@ bool dtTiledNavMesh::removeTile(int x, int y)
|
||||
|
||||
bool dtTiledNavMesh::closestPointToPoly(dtTilePolyRef ref, const float* pos, float* closest) const
|
||||
{
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
decodeId(ref, salt, it, ip);
|
||||
if (it >= DT_MAX_TILES) return false;
|
||||
if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return false;
|
||||
@ -1063,7 +1063,7 @@ int dtTiledNavMesh::queryPolygons(const float* center, const float* extents,
|
||||
|
||||
float dtTiledNavMesh::getCost(dtTilePolyRef prev, dtTilePolyRef from, dtTilePolyRef to) const
|
||||
{
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
if (prev) from = prev;
|
||||
// The API input has been cheked already, skip checking internal data.
|
||||
decodeId(from, salt, it, ip);
|
||||
@ -1086,7 +1086,7 @@ float dtTiledNavMesh::getCost(dtTilePolyRef prev, dtTilePolyRef from, dtTilePoly
|
||||
|
||||
float dtTiledNavMesh::getHeuristic(dtTilePolyRef from, dtTilePolyRef to) const
|
||||
{
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
// The API input has been cheked already, skip checking internal data.
|
||||
decodeId(from, salt, it, ip);
|
||||
const dtTileHeader* fromHeader = m_tiles[it].header;
|
||||
@ -1139,7 +1139,7 @@ int dtTiledNavMesh::findPath(dtTilePolyRef startRef, dtTilePolyRef endRef,
|
||||
m_openList->push(startNode);
|
||||
|
||||
dtTileNode* lastBestNode = startNode;
|
||||
unsigned short lastBestNodeCost = startNode->total;
|
||||
float lastBestNodeCost = startNode->total;
|
||||
while (!m_openList->empty())
|
||||
{
|
||||
dtTileNode* bestNode = m_openList->pop();
|
||||
@ -1151,7 +1151,7 @@ int dtTiledNavMesh::findPath(dtTilePolyRef startRef, dtTilePolyRef endRef,
|
||||
}
|
||||
|
||||
// Get poly and tile.
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
decodeId(bestNode->id, salt, it, ip);
|
||||
// The API input has been cheked already, skip checking internal data.
|
||||
const dtTileHeader* h = m_tiles[it].header;
|
||||
@ -1383,7 +1383,7 @@ int dtTiledNavMesh::findStraightPath(const float* startPos, const float* endPos,
|
||||
// Returns portal points between two polygons.
|
||||
bool dtTiledNavMesh::getPortalPoints(dtTilePolyRef from, dtTilePolyRef to, float* left, float* right) const
|
||||
{
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
decodeId(from, salt, it, ip);
|
||||
if (it >= DT_MAX_TILES) return false;
|
||||
if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return false;
|
||||
@ -1440,7 +1440,7 @@ int dtTiledNavMesh::raycast(dtTilePolyRef centerRef, const float* startPos, cons
|
||||
// Cast ray against current polygon.
|
||||
|
||||
// The API input has been cheked already, skip checking internal data.
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
decodeId(curRef, salt, it, ip);
|
||||
const dtTileHeader* h = m_tiles[it].header;
|
||||
const dtTilePoly* poly = &h->polys[ip];
|
||||
@ -1564,7 +1564,7 @@ int dtTiledNavMesh::findPolysAround(dtTilePolyRef centerRef, const float* center
|
||||
dtTileNode* bestNode = m_openList->pop();
|
||||
|
||||
// Get poly and tile.
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
decodeId(bestNode->id, salt, it, ip);
|
||||
// The API input has been cheked already, skip checking internal data.
|
||||
const dtTileHeader* h = m_tiles[it].header;
|
||||
@ -1623,7 +1623,7 @@ int dtTiledNavMesh::findPolysAround(dtTilePolyRef centerRef, const float* center
|
||||
if (resultCost)
|
||||
resultCost[n] = actualNode->total;
|
||||
if (resultDepth)
|
||||
resultDepth[n] = actualNode->cost;
|
||||
resultDepth[n] = (unsigned short)actualNode->cost;
|
||||
++n;
|
||||
}
|
||||
actualNode->flags = dtTileNode::OPEN;
|
||||
@ -1662,7 +1662,7 @@ float dtTiledNavMesh::findDistanceToWall(dtTilePolyRef centerRef, const float* c
|
||||
dtTileNode* bestNode = m_openList->pop();
|
||||
|
||||
// Get poly and tile.
|
||||
unsigned int salt, it, ip;
|
||||
int salt, it, ip;
|
||||
decodeId(bestNode->id, salt, it, ip);
|
||||
// The API input has been cheked already, skip checking internal data.
|
||||
const dtTileHeader* h = m_tiles[it].header;
|
||||
|
Binary file not shown.
@ -189,7 +189,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\BuilderStatMeshTiling.cpp"
|
||||
RelativePath="..\..\Source\BuilderStatMeshTiled.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -208,6 +208,14 @@
|
||||
RelativePath="..\..\..\Detour\Source\DetourStatNavMeshBuilder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\Detour\Source\DetourTiledNavMesh.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\Detour\Source\DetourTiledNavMeshBuilder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\glfont.cpp"
|
||||
>
|
||||
@ -279,7 +287,15 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Include\BuilderStatMeshTiling.h"
|
||||
RelativePath="..\..\Include\BuilderStatMeshTiled.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Source\BuilderTiledMesh.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Include\BuilderTiledMesh.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -298,6 +314,14 @@
|
||||
RelativePath="..\..\..\Detour\Include\DetourStatNavMeshBuilder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\Detour\Include\DetourTiledNavMesh.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\Detour\Include\DetourTiledNavMeshBuilder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Include\glfont.h"
|
||||
>
|
||||
|
@ -390,20 +390,20 @@ static void drawLabels(int x, int y, int w, int h,
|
||||
float d = nicenum(range/(float)(nticks-1), 1);
|
||||
float graphmin = floorf(vmin/d)*d;
|
||||
float graphmax = ceilf(vmax/d)*d;
|
||||
int nfrac = -floorf(log10f(d));
|
||||
int nfrac = (int)-floorf(log10f(d));
|
||||
if (nfrac < 0) nfrac = 0;
|
||||
snprintf(str, 6, "%%.%df %%s", nfrac);
|
||||
|
||||
for (float v = graphmin; v < graphmax+d/2; v += d)
|
||||
{
|
||||
int lx = x + (int)((v-vmin) / (vmax-vmin) * w);
|
||||
float lx = x + (v-vmin)/(vmax-vmin)*w;
|
||||
if (lx < 0 || lx > w) continue;
|
||||
snprintf(temp, 20, str, v, unit);
|
||||
font->drawText(lx+2, y+2, temp, GLFont::RGBA(255,255,255));
|
||||
font->drawText(lx+2, (float)y+2, temp, GLFont::RGBA(255,255,255));
|
||||
glColor4ub(0,0,0,64);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(lx,y);
|
||||
glVertex2f(lx,y+h);
|
||||
glVertex2f(lx,(float)y);
|
||||
glVertex2f(lx,(float)(y+h));
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
@ -459,9 +459,9 @@ static void drawGraph(const char* name, int x, int y, int w, int h, float sd,
|
||||
glEnd();
|
||||
|
||||
snprintf(text,64,"%d", maxval);
|
||||
font->drawText(x+w-20+2,y+h-2-font->getLineHeight(),text,GLFont::RGBA(0,0,0));
|
||||
font->drawText((float)x+w-20+2,(float)y+h-2-font->getLineHeight(),text,GLFont::RGBA(0,0,0));
|
||||
|
||||
font->drawText(x+2,y+h-2-font->getLineHeight(),name,GLFont::RGBA(255,255,255));
|
||||
font->drawText((float)x+2,(float)y+h-2-font->getLineHeight(),name,GLFont::RGBA(255,255,255));
|
||||
|
||||
drawLabels(x, y, w, h, 10, first*sd, last*sd, unit, font);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user