- Updated win32 project
- Fixed VC compile errors
This commit is contained in:
parent
1de5e2f119
commit
76444aa747
@ -72,7 +72,7 @@ static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshTile* tile,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (con)
|
if (con)
|
||||||
c = duRGBA(255,255,255,24);
|
c = duRGBA(255,255,255,48);
|
||||||
else
|
else
|
||||||
c = duRGBA(0,0,0,48);
|
c = duRGBA(0,0,0,48);
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ void duDebugDrawCompactHeightfieldDistance(duDebugDraw* dd, const rcCompactHeigh
|
|||||||
dd->end();
|
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 cs = layer->cs;
|
||||||
const float ch = layer->ch;
|
const float ch = layer->ch;
|
||||||
@ -418,7 +418,7 @@ void duDebugDrawHeightfieldLayer(duDebugDraw* dd, const struct rcHeightfieldLaye
|
|||||||
dd->end();
|
dd->end();
|
||||||
|
|
||||||
// Portals
|
// Portals
|
||||||
drawLayerPortals(dd, &layer, color);
|
drawLayerPortals(dd, &layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void duDebugDrawHeightfieldLayers(duDebugDraw* dd, const struct rcHeightfieldLayerSet& lset)
|
void duDebugDrawHeightfieldLayers(duDebugDraw* dd, const struct rcHeightfieldLayerSet& lset)
|
||||||
|
@ -28,7 +28,7 @@ enum dtNodeFlags
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef unsigned short dtNodeIndex;
|
typedef unsigned short dtNodeIndex;
|
||||||
static const dtNodeIndex DT_NULL_IDX = ~0;
|
static const dtNodeIndex DT_NULL_IDX = (dtNodeIndex)~0;
|
||||||
|
|
||||||
struct dtNode
|
struct dtNode
|
||||||
{
|
{
|
||||||
|
@ -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,
|
static int getNeighbours(const float* pos, const float height, const float range,
|
||||||
const dtCrowdAgent* skip, dtCrowdNeighbour* result, const int maxResult,
|
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;
|
int n = 0;
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ template<class T> class dtFixedArray
|
|||||||
T* m_ptr;
|
T* m_ptr;
|
||||||
const int m_size;
|
const int m_size;
|
||||||
inline T* operator=(T* p);
|
inline T* operator=(T* p);
|
||||||
|
inline void operator=(dtFixedArray<T>& p);
|
||||||
inline dtFixedArray();
|
inline dtFixedArray();
|
||||||
public:
|
public:
|
||||||
inline dtFixedArray(dtTileCacheAlloc* a, const int s) : m_alloc(a), m_ptr((T*)a->alloc(sizeof(T)*s)), m_size(s) {}
|
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.
|
// No connection, return portal or hard edge.
|
||||||
if (portal & mask)
|
if (portal & mask)
|
||||||
return 0xf8 + dir;
|
return 0xf8 + (unsigned char)dir;
|
||||||
return 0xff;
|
return 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,7 +599,7 @@ static void simplifyContour(dtTempContour& cont, const float maxError)
|
|||||||
unsigned char ra = cont.verts[j*4+3];
|
unsigned char ra = cont.verts[j*4+3];
|
||||||
unsigned char rb = cont.verts[i*4+3];
|
unsigned char rb = cont.verts[i*4+3];
|
||||||
if (ra != rb)
|
if (ra != rb)
|
||||||
cont.poly[cont.npoly++] = i;
|
cont.poly[cont.npoly++] = (unsigned short)i;
|
||||||
}
|
}
|
||||||
if (cont.npoly < 2)
|
if (cont.npoly < 2)
|
||||||
{
|
{
|
||||||
@ -629,8 +630,8 @@ static void simplifyContour(dtTempContour& cont, const float maxError)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cont.npoly = 0;
|
cont.npoly = 0;
|
||||||
cont.poly[cont.npoly++] = lli;
|
cont.poly[cont.npoly++] = (unsigned short)lli;
|
||||||
cont.poly[cont.npoly++] = uri;
|
cont.poly[cont.npoly++] = (unsigned short)uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add points until all raw points are within
|
// Add points until all raw points are within
|
||||||
@ -716,7 +717,7 @@ static void simplifyContour(dtTempContour& cont, const float maxError)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getCornerHeight(dtTileCacheLayer& layer,
|
static unsigned char getCornerHeight(dtTileCacheLayer& layer,
|
||||||
const int x, const int y, const int z,
|
const int x, const int y, const int z,
|
||||||
const int walkableClimb,
|
const int walkableClimb,
|
||||||
bool& shouldRemove)
|
bool& shouldRemove)
|
||||||
@ -727,7 +728,7 @@ static int getCornerHeight(dtTileCacheLayer& layer,
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
unsigned char portal = 0xf;
|
unsigned char portal = 0xf;
|
||||||
int height = 0;
|
unsigned char height = 0;
|
||||||
|
|
||||||
for (int dz = -1; dz <= 0; ++dz)
|
for (int dz = -1; dz <= 0; ++dz)
|
||||||
{
|
{
|
||||||
@ -741,7 +742,7 @@ static int getCornerHeight(dtTileCacheLayer& layer,
|
|||||||
const int h = (int)layer.heights[idx];
|
const int h = (int)layer.heights[idx];
|
||||||
if (dtAbs(h-y) <= walkableClimb)
|
if (dtAbs(h-y) <= walkableClimb)
|
||||||
{
|
{
|
||||||
height = dtMax(height, h);
|
height = dtMax(height, (unsigned char)h);
|
||||||
portal &= (layer.cons[idx] >> 4);
|
portal &= (layer.cons[idx] >> 4);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
@ -885,7 +886,7 @@ static unsigned short addVertex(unsigned short x, unsigned short y, unsigned sho
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Could not find, create new.
|
// Could not find, create new.
|
||||||
i = nv; nv++;
|
i = (unsigned short)nv; nv++;
|
||||||
unsigned short* v = &verts[i*3];
|
unsigned short* v = &verts[i*3];
|
||||||
v[0] = x;
|
v[0] = x;
|
||||||
v[1] = y;
|
v[1] = y;
|
||||||
@ -1424,7 +1425,7 @@ static void pushBack(unsigned short v, unsigned short* arr, int& an)
|
|||||||
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.
|
// Count number of polygons to remove.
|
||||||
int numRemovedVerts = 0;
|
int numRemovedVerts = 0;
|
||||||
@ -1499,8 +1500,8 @@ static bool canRemoveVertex(dtTileCacheAlloc* alloc, dtTileCachePolyMesh& mesh,
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
unsigned short* e = &edges[nedges*3];
|
unsigned short* e = &edges[nedges*3];
|
||||||
e[0] = a;
|
e[0] = (unsigned short)a;
|
||||||
e[1] = b;
|
e[1] = (unsigned short)b;
|
||||||
e[2] = 1;
|
e[2] = 1;
|
||||||
nedges++;
|
nedges++;
|
||||||
}
|
}
|
||||||
@ -1523,7 +1524,7 @@ static bool canRemoveVertex(dtTileCacheAlloc* alloc, dtTileCachePolyMesh& mesh,
|
|||||||
return true;
|
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.
|
// Count number of polygons to remove.
|
||||||
int numRemovedVerts = 0;
|
int numRemovedVerts = 0;
|
||||||
@ -1702,7 +1703,8 @@ static dtStatus removeVertex(dtTileCacheAlloc* alloc, dtTileCachePolyMesh& mesh,
|
|||||||
return DT_SUCCESS;
|
return DT_SUCCESS;
|
||||||
|
|
||||||
// Merge polygons.
|
// Merge polygons.
|
||||||
if (MAX_VERTS_PER_POLY > 3)
|
int maxVertsPerPoly = MAX_VERTS_PER_POLY;
|
||||||
|
if (maxVertsPerPoly > 3)
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@ -1887,7 +1889,8 @@ dtStatus dtBuildTileCachePolyMesh(dtTileCacheAlloc* alloc,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Merge polygons.
|
// Merge polygons.
|
||||||
if (MAX_VERTS_PER_POLY > 3)
|
int maxVertsPerPoly =MAX_VERTS_PER_POLY ;
|
||||||
|
if (maxVertsPerPoly > 3)
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
@ -1951,9 +1954,9 @@ dtStatus dtBuildTileCachePolyMesh(dtTileCacheAlloc* alloc,
|
|||||||
{
|
{
|
||||||
if (vflags[i])
|
if (vflags[i])
|
||||||
{
|
{
|
||||||
if (!canRemoveVertex(alloc, mesh, (unsigned short)i))
|
if (!canRemoveVertex(mesh, (unsigned short)i))
|
||||||
continue;
|
continue;
|
||||||
dtStatus status = removeVertex(alloc, mesh, (unsigned short)i, maxTris);
|
dtStatus status = removeVertex(mesh, (unsigned short)i, maxTris);
|
||||||
if (dtStatusFailed(status))
|
if (dtStatusFailed(status))
|
||||||
return status;
|
return status;
|
||||||
// Remove vertex
|
// Remove vertex
|
||||||
|
@ -345,7 +345,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Merge non-overlapping regions that are close in height.
|
// 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)
|
for (int i = 0; i < nregs; ++i)
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
@ -41,7 +41,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
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"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@ -62,11 +62,12 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
|
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
|
||||||
LinkIncremental="1"
|
LinkIncremental="0"
|
||||||
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
|
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
TargetMachine="1"
|
TargetMachine="1"
|
||||||
|
CLRThreadAttribute="0"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
@ -117,7 +118,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
EnableIntrinsicFunctions="true"
|
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"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
EnableFunctionLevelLinking="true"
|
EnableFunctionLevelLinking="true"
|
||||||
@ -137,7 +138,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
|
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
|
||||||
LinkIncremental="1"
|
LinkIncremental="0"
|
||||||
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
|
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
@ -219,6 +220,10 @@
|
|||||||
RelativePath="..\..\..\Recast\Source\RecastFilter.cpp"
|
RelativePath="..\..\..\Recast\Source\RecastFilter.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastLayers.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\Recast\Source\RecastMesh.cpp"
|
RelativePath="..\..\..\Recast\Source\RecastMesh.cpp"
|
||||||
>
|
>
|
||||||
@ -360,11 +365,7 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Include\Sample_SoloMeshSimple.h"
|
RelativePath="..\..\Include\Sample_SoloMesh.h"
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\Include\Sample_SoloMeshTiled.h"
|
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
@ -460,11 +461,7 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Source\Sample_SoloMeshSimple.cpp"
|
RelativePath="..\..\Source\Sample_SoloMesh.cpp"
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\Source\Sample_SoloMeshTiled.cpp"
|
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
@ -609,6 +606,18 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="DetourTileCache"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DetourTileCache\DetourTileCacheBuilder.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DetourTileCache\DetourTileCacheBuilder.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
@ -615,7 +615,7 @@ public:
|
|||||||
return true;
|
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;
|
/* static const int MAX_TIME_USEC = 1000;
|
||||||
|
|
||||||
@ -667,7 +667,7 @@ public:
|
|||||||
bmax[2] = m_params.orig[2] + (ty+1)*th;
|
bmax[2] = m_params.orig[2] + (ty+1)*th;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool buildNavMeshTilesAt(ObstacleSet* obs,
|
bool buildNavMeshTilesAt(ObstacleSet* /*obs*/,
|
||||||
const int tx, const int ty,
|
const int tx, const int ty,
|
||||||
dtNavMesh* navMesh)
|
dtNavMesh* navMesh)
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
|
# define putenv _putenv
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct SampleItem
|
struct SampleItem
|
||||||
@ -69,6 +70,9 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Center window
|
||||||
|
putenv("SDL_VIDEO_CENTERED=1");
|
||||||
|
|
||||||
// Init OpenGL
|
// Init OpenGL
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||||
@ -76,8 +80,10 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
|
||||||
|
//#ifndef WIN32
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||||
|
//#endif
|
||||||
|
|
||||||
const SDL_VideoInfo* vi = SDL_GetVideoInfo();
|
const SDL_VideoInfo* vi = SDL_GetVideoInfo();
|
||||||
|
|
||||||
@ -105,6 +111,8 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glEnable(GL_MULTISAMPLE);
|
||||||
|
|
||||||
SDL_WM_SetCaption("Recast Demo", 0);
|
SDL_WM_SetCaption("Recast Demo", 0);
|
||||||
|
|
||||||
if (!imguiRenderGLInit("DroidSans.ttf"))
|
if (!imguiRenderGLInit("DroidSans.ttf"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user