- Updated win32 project

- Fixed VC compile errors
This commit is contained in:
Mikko Mononen 2011-03-25 10:13:27 +00:00
parent 1de5e2f119
commit 76444aa747
10 changed files with 63 additions and 43 deletions

View File

@ -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);
}

View File

@ -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)

View File

@ -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
{

View File

@ -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;

View File

@ -29,6 +29,7 @@ template<class T> class dtFixedArray
T* m_ptr;
const int m_size;
inline T* operator=(T* p);
inline void operator=(dtFixedArray<T>& 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

View File

@ -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)
{

Binary file not shown.

View File

@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\Contrib\fastlz;..\..\Contrib\SDL\include;..\..\Include;..\..\..\DetourCrowd\Include;..\..\..\Detour\Include;..\..\..\DebugUtils\Include;..\..\..\Recast\Include;..\..\Contrib"
AdditionalIncludeDirectories="..\..\Contrib\fastlz;..\..\Contrib\SDL\include;..\..\Include;..\..\..\DetourCrowd\Include;..\..\..\Detour\Include;..\..\..\DebugUtils\Include;..\..\..\Recast\Include;..\..\Contrib;..\..\..\DetourTileCache"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -62,11 +62,12 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
LinkIncremental="1"
LinkIncremental="0"
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
CLRThreadAttribute="0"
/>
<Tool
Name="VCALinkTool"
@ -117,7 +118,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\Contrib\fastlz;..\..\Contrib\SDL\include;..\..\Include;..\..\..\DetourCrowd\Include;..\..\..\Detour\Include;..\..\..\DebugUtils\Include;..\..\..\Recast\Include;..\..\Contrib"
AdditionalIncludeDirectories="..\..\Contrib\fastlz;..\..\Contrib\SDL\include;..\..\Include;..\..\..\DetourCrowd\Include;..\..\..\Detour\Include;..\..\..\DebugUtils\Include;..\..\..\Recast\Include;..\..\Contrib;..\..\..\DetourTileCache"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
@ -137,7 +138,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
LinkIncremental="1"
LinkIncremental="0"
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
GenerateDebugInformation="true"
SubSystem="2"
@ -219,6 +220,10 @@
RelativePath="..\..\..\Recast\Source\RecastFilter.cpp"
>
</File>
<File
RelativePath="..\..\..\Recast\Source\RecastLayers.cpp"
>
</File>
<File
RelativePath="..\..\..\Recast\Source\RecastMesh.cpp"
>
@ -360,11 +365,7 @@
>
</File>
<File
RelativePath="..\..\Include\Sample_SoloMeshSimple.h"
>
</File>
<File
RelativePath="..\..\Include\Sample_SoloMeshTiled.h"
RelativePath="..\..\Include\Sample_SoloMesh.h"
>
</File>
<File
@ -460,11 +461,7 @@
>
</File>
<File
RelativePath="..\..\Source\Sample_SoloMeshSimple.cpp"
>
</File>
<File
RelativePath="..\..\Source\Sample_SoloMeshTiled.cpp"
RelativePath="..\..\Source\Sample_SoloMesh.cpp"
>
</File>
<File
@ -609,6 +606,18 @@
>
</File>
</Filter>
<Filter
Name="DetourTileCache"
>
<File
RelativePath="..\..\..\DetourTileCache\DetourTileCacheBuilder.cpp"
>
</File>
<File
RelativePath="..\..\..\DetourTileCache\DetourTileCacheBuilder.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>

View File

@ -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)
{

View File

@ -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"))