diff --git a/DebugUtils/Source/DetourDebugDraw.cpp b/DebugUtils/Source/DetourDebugDraw.cpp index effdd53..feab678 100755 --- a/DebugUtils/Source/DetourDebugDraw.cpp +++ b/DebugUtils/Source/DetourDebugDraw.cpp @@ -72,7 +72,7 @@ static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshTile* tile, } } if (con) - c = duRGBA(255,255,255,24); + c = duRGBA(255,255,255,48); else c = duRGBA(0,0,0,48); } diff --git a/DebugUtils/Source/RecastDebugDraw.cpp b/DebugUtils/Source/RecastDebugDraw.cpp index e158c35..a9ef144 100644 --- a/DebugUtils/Source/RecastDebugDraw.cpp +++ b/DebugUtils/Source/RecastDebugDraw.cpp @@ -326,7 +326,7 @@ void duDebugDrawCompactHeightfieldDistance(duDebugDraw* dd, const rcCompactHeigh dd->end(); } -static void drawLayerPortals(duDebugDraw* dd, const rcHeightfieldLayer* layer, const unsigned int color) +static void drawLayerPortals(duDebugDraw* dd, const rcHeightfieldLayer* layer) { const float cs = layer->cs; const float ch = layer->ch; @@ -418,7 +418,7 @@ void duDebugDrawHeightfieldLayer(duDebugDraw* dd, const struct rcHeightfieldLaye dd->end(); // Portals - drawLayerPortals(dd, &layer, color); + drawLayerPortals(dd, &layer); } void duDebugDrawHeightfieldLayers(duDebugDraw* dd, const struct rcHeightfieldLayerSet& lset) diff --git a/Detour/Include/DetourNode.h b/Detour/Include/DetourNode.h index e46254f..e6aa6b9 100644 --- a/Detour/Include/DetourNode.h +++ b/Detour/Include/DetourNode.h @@ -28,7 +28,7 @@ enum dtNodeFlags }; typedef unsigned short dtNodeIndex; -static const dtNodeIndex DT_NULL_IDX = ~0; +static const dtNodeIndex DT_NULL_IDX = (dtNodeIndex)~0; struct dtNode { diff --git a/DetourCrowd/Source/DetourCrowd.cpp b/DetourCrowd/Source/DetourCrowd.cpp index 82b49e1..b0dc211 100644 --- a/DetourCrowd/Source/DetourCrowd.cpp +++ b/DetourCrowd/Source/DetourCrowd.cpp @@ -172,7 +172,7 @@ static int addNeighbour(const int idx, const float dist, static int getNeighbours(const float* pos, const float height, const float range, const dtCrowdAgent* skip, dtCrowdNeighbour* result, const int maxResult, - dtCrowdAgent** agents, const int nagents, dtProximityGrid* grid) + dtCrowdAgent** agents, const int /*nagents*/, dtProximityGrid* grid) { int n = 0; diff --git a/DetourTileCache/DetourTileCacheBuilder.cpp b/DetourTileCache/DetourTileCacheBuilder.cpp index c380f74..a3504f5 100644 --- a/DetourTileCache/DetourTileCacheBuilder.cpp +++ b/DetourTileCache/DetourTileCacheBuilder.cpp @@ -29,6 +29,7 @@ template class dtFixedArray T* m_ptr; const int m_size; inline T* operator=(T* p); + inline void operator=(dtFixedArray& p); inline dtFixedArray(); public: inline dtFixedArray(dtTileCacheAlloc* a, const int s) : m_alloc(a), m_ptr((T*)a->alloc(sizeof(T)*s)), m_size(s) {} @@ -471,7 +472,7 @@ static unsigned char getNeighbourReg(dtTileCacheLayer& layer, { // No connection, return portal or hard edge. if (portal & mask) - return 0xf8 + dir; + return 0xf8 + (unsigned char)dir; return 0xff; } @@ -598,7 +599,7 @@ static void simplifyContour(dtTempContour& cont, const float maxError) unsigned char ra = cont.verts[j*4+3]; unsigned char rb = cont.verts[i*4+3]; if (ra != rb) - cont.poly[cont.npoly++] = i; + cont.poly[cont.npoly++] = (unsigned short)i; } if (cont.npoly < 2) { @@ -629,8 +630,8 @@ static void simplifyContour(dtTempContour& cont, const float maxError) } } cont.npoly = 0; - cont.poly[cont.npoly++] = lli; - cont.poly[cont.npoly++] = uri; + cont.poly[cont.npoly++] = (unsigned short)lli; + cont.poly[cont.npoly++] = (unsigned short)uri; } // Add points until all raw points are within @@ -716,10 +717,10 @@ static void simplifyContour(dtTempContour& cont, const float maxError) } } -static int getCornerHeight(dtTileCacheLayer& layer, - const int x, const int y, const int z, - const int walkableClimb, - bool& shouldRemove) +static unsigned char getCornerHeight(dtTileCacheLayer& layer, + const int x, const int y, const int z, + const int walkableClimb, + bool& shouldRemove) { const int w = (int)layer.header->width; const int h = (int)layer.header->height; @@ -727,7 +728,7 @@ static int getCornerHeight(dtTileCacheLayer& layer, int n = 0; unsigned char portal = 0xf; - int height = 0; + unsigned char height = 0; for (int dz = -1; dz <= 0; ++dz) { @@ -741,7 +742,7 @@ static int getCornerHeight(dtTileCacheLayer& layer, const int h = (int)layer.heights[idx]; if (dtAbs(h-y) <= walkableClimb) { - height = dtMax(height, h); + height = dtMax(height, (unsigned char)h); portal &= (layer.cons[idx] >> 4); n++; } @@ -885,7 +886,7 @@ static unsigned short addVertex(unsigned short x, unsigned short y, unsigned sho } // Could not find, create new. - i = nv; nv++; + i = (unsigned short)nv; nv++; unsigned short* v = &verts[i*3]; v[0] = x; v[1] = y; @@ -1424,7 +1425,7 @@ static void pushBack(unsigned short v, unsigned short* arr, int& an) an++; } -static bool canRemoveVertex(dtTileCacheAlloc* alloc, dtTileCachePolyMesh& mesh, const unsigned short rem) +static bool canRemoveVertex(dtTileCachePolyMesh& mesh, const unsigned short rem) { // Count number of polygons to remove. int numRemovedVerts = 0; @@ -1499,8 +1500,8 @@ static bool canRemoveVertex(dtTileCacheAlloc* alloc, dtTileCachePolyMesh& mesh, if (!exists) { unsigned short* e = &edges[nedges*3]; - e[0] = a; - e[1] = b; + e[0] = (unsigned short)a; + e[1] = (unsigned short)b; e[2] = 1; nedges++; } @@ -1523,7 +1524,7 @@ static bool canRemoveVertex(dtTileCacheAlloc* alloc, dtTileCachePolyMesh& mesh, return true; } -static dtStatus removeVertex(dtTileCacheAlloc* alloc, dtTileCachePolyMesh& mesh, const unsigned short rem, const int maxTris) +static dtStatus removeVertex(dtTileCachePolyMesh& mesh, const unsigned short rem, const int maxTris) { // Count number of polygons to remove. int numRemovedVerts = 0; @@ -1702,7 +1703,8 @@ static dtStatus removeVertex(dtTileCacheAlloc* alloc, dtTileCachePolyMesh& mesh, return DT_SUCCESS; // Merge polygons. - if (MAX_VERTS_PER_POLY > 3) + int maxVertsPerPoly = MAX_VERTS_PER_POLY; + if (maxVertsPerPoly > 3) { for (;;) { @@ -1887,7 +1889,8 @@ dtStatus dtBuildTileCachePolyMesh(dtTileCacheAlloc* alloc, continue; // Merge polygons. - if (MAX_VERTS_PER_POLY > 3) + int maxVertsPerPoly =MAX_VERTS_PER_POLY ; + if (maxVertsPerPoly > 3) { for(;;) { @@ -1951,9 +1954,9 @@ dtStatus dtBuildTileCachePolyMesh(dtTileCacheAlloc* alloc, { if (vflags[i]) { - if (!canRemoveVertex(alloc, mesh, (unsigned short)i)) + if (!canRemoveVertex(mesh, (unsigned short)i)) continue; - dtStatus status = removeVertex(alloc, mesh, (unsigned short)i, maxTris); + dtStatus status = removeVertex(mesh, (unsigned short)i, maxTris); if (dtStatusFailed(status)) return status; // Remove vertex diff --git a/Recast/Source/RecastLayers.cpp b/Recast/Source/RecastLayers.cpp index f2d60d2..c9ed5e0 100644 --- a/Recast/Source/RecastLayers.cpp +++ b/Recast/Source/RecastLayers.cpp @@ -345,7 +345,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, } // Merge non-overlapping regions that are close in height. - const int mergeHeight = walkableHeight * 4; + const unsigned short mergeHeight = (unsigned short)walkableHeight * 4; for (int i = 0; i < nregs; ++i) { diff --git a/RecastDemo/Bin/Recast.exe b/RecastDemo/Bin/Recast.exe index 27286a4..2cbaf2a 100644 Binary files a/RecastDemo/Bin/Recast.exe and b/RecastDemo/Bin/Recast.exe differ diff --git a/RecastDemo/Build/VC9/Recast.vcproj b/RecastDemo/Build/VC9/Recast.vcproj index 6d8dfa7..e351265 100644 --- a/RecastDemo/Build/VC9/Recast.vcproj +++ b/RecastDemo/Build/VC9/Recast.vcproj @@ -41,7 +41,7 @@ + + @@ -360,11 +365,7 @@ > - - - - + + + + + + diff --git a/RecastDemo/Source/Sample_TempObstacles.cpp b/RecastDemo/Source/Sample_TempObstacles.cpp index b94716e..0a2dab5 100644 --- a/RecastDemo/Source/Sample_TempObstacles.cpp +++ b/RecastDemo/Source/Sample_TempObstacles.cpp @@ -615,7 +615,7 @@ public: return true; } - void update(const float /*dt*/, dtNavMesh* navmesh, ObstacleSet* obs) + void update(const float /*dt*/, dtNavMesh* /*navmesh*/, ObstacleSet* /*obs*/) { /* static const int MAX_TIME_USEC = 1000; @@ -667,7 +667,7 @@ public: bmax[2] = m_params.orig[2] + (ty+1)*th; } - bool buildNavMeshTilesAt(ObstacleSet* obs, + bool buildNavMeshTilesAt(ObstacleSet* /*obs*/, const int tx, const int ty, dtNavMesh* navMesh) { diff --git a/RecastDemo/Source/main.cpp b/RecastDemo/Source/main.cpp index bc80287..1b18555 100644 --- a/RecastDemo/Source/main.cpp +++ b/RecastDemo/Source/main.cpp @@ -37,6 +37,7 @@ #ifdef WIN32 # define snprintf _snprintf +# define putenv _putenv #endif struct SampleItem @@ -69,6 +70,9 @@ int main(int /*argc*/, char** /*argv*/) return -1; } + // Center window + putenv("SDL_VIDEO_CENTERED=1"); + // Init OpenGL SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); @@ -76,9 +80,11 @@ int main(int /*argc*/, char** /*argv*/) SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); +//#ifndef WIN32 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); - +//#endif + const SDL_VideoInfo* vi = SDL_GetVideoInfo(); bool presentationMode = false; @@ -104,7 +110,9 @@ int main(int /*argc*/, char** /*argv*/) printf("Could not initialise SDL opengl\n"); return -1; } - + + glEnable(GL_MULTISAMPLE); + SDL_WM_SetCaption("Recast Demo", 0); if (!imguiRenderGLInit("DroidSans.ttf"))