mirror of
https://github.com/recastnavigation/recastnavigation.git
synced 2026-10-24 17:51:06 +00:00
TileCache progress: Moved tile cache to Detour and made proper class for it. Better obstacles and tile layer management.
This commit is contained in:
@@ -37,8 +37,6 @@ void duDebugDrawNavMeshBVTree(struct duDebugDraw* dd, const dtNavMesh& mesh);
|
||||
void duDebugDrawNavMeshPortals(struct duDebugDraw* dd, const dtNavMesh& mesh);
|
||||
void duDebugDrawNavMeshPoly(struct duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef ref, const unsigned int col);
|
||||
|
||||
void duDebugDrawTileCacheLayer(struct duDebugDraw* dd, const dtTileCacheLayer& layer,
|
||||
const float* bmin, const float* bmax,
|
||||
const float cs, const float ch, const int idx);
|
||||
void duDebugDrawTileCacheLayer(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch);
|
||||
|
||||
#endif // DETOURDEBUGDRAW_H
|
||||
@@ -473,12 +473,13 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re
|
||||
|
||||
}
|
||||
|
||||
void duDebugDrawTileCacheLayer(struct duDebugDraw* dd, const dtTileCacheLayer& layer,
|
||||
const float* bmin, const float* bmax,
|
||||
const float cs, const float ch, const int idx)
|
||||
void duDebugDrawTileCacheLayer(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch)
|
||||
{
|
||||
const int w = (int)layer.header->width;
|
||||
const int h = (int)layer.header->height;
|
||||
const float* bmin = layer.header->bmin;
|
||||
const float* bmax = layer.header->bmax;
|
||||
const int idx = layer.header->tlayer;
|
||||
|
||||
unsigned int color = duIntToCol(idx+1, 255);
|
||||
|
||||
|
||||
@@ -22,19 +22,18 @@
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourStatus.h"
|
||||
|
||||
static const int DT_TILECACHE_MAGIC = 'D'<<24 | 'T'<<16 | 'I'<<8 | 'C'; //'DTIC';
|
||||
static const int DT_TILECACHE_MAGIC = 'D'<<24 | 'T'<<16 | 'L'<<8 | 'R'; //'DTLR';
|
||||
static const int DT_TILECACHE_VERSION = 1;
|
||||
|
||||
struct dtTileCacheLayerParams
|
||||
{
|
||||
float bmin[3], bmax[3]; // Bounding box of the heightfield.
|
||||
float cs, ch; // Cell size and height.
|
||||
};
|
||||
static const unsigned char DT_TILECACHE_NULL_AREA = 0;
|
||||
static const unsigned char DT_TILECACHE_WALKABLE_AREA = 63;
|
||||
|
||||
struct dtTileCacheLayerHeader
|
||||
{
|
||||
int magic; // Data magic
|
||||
int version; // Data version
|
||||
int tx,ty,tlayer;
|
||||
float bmin[3], bmax[3];
|
||||
unsigned short hmin, hmax; // Height min/max range
|
||||
unsigned char width, height; // Dimension of the layer.
|
||||
unsigned char minx, maxx, miny, maxy; // Usable sub-region.
|
||||
@@ -77,6 +76,10 @@ struct dtTileCachePolyMesh
|
||||
|
||||
struct dtTileCacheAlloc
|
||||
{
|
||||
virtual void reset()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void* alloc(const int size)
|
||||
{
|
||||
return dtAlloc(size, DT_ALLOC_TEMP);
|
||||
@@ -88,12 +91,28 @@ struct dtTileCacheAlloc
|
||||
}
|
||||
};
|
||||
|
||||
struct dtTileCacheCompressor
|
||||
{
|
||||
virtual int maxCompressedSize(const int bufferSize) = 0;
|
||||
virtual dtStatus compress(const unsigned char* buffer, const int bufferSize,
|
||||
unsigned char* compressed, const int maxCompressedSize, int* compressedSize) = 0;
|
||||
virtual dtStatus decompress(const unsigned char* compressed, const int compressedSize,
|
||||
unsigned char* buffer, const int maxBufferSize, int* bufferSize) = 0;
|
||||
};
|
||||
|
||||
dtStatus dtCastTileCacheLayer(dtTileCacheLayer& layer, unsigned char* buffer, const int bufferSize);
|
||||
|
||||
// Returns the amount of memory requires for specific grid size.
|
||||
int dtCalcTileCacheLayerBufferSize(const int gridWidth, const int gridHeight);
|
||||
|
||||
dtStatus dtBuildTileCacheLayer(dtTileCacheCompressor* comp,
|
||||
dtTileCacheLayerHeader* header,
|
||||
const unsigned char* heights,
|
||||
const unsigned char* areas,
|
||||
const unsigned char* cons,
|
||||
unsigned char** outData, int* outDataSize);
|
||||
|
||||
void dtFreeTileCacheLayer(dtTileCacheAlloc* alloc, dtTileCacheLayer* layer);
|
||||
|
||||
dtStatus dtDecompressTileCacheLayer(dtTileCacheAlloc* alloc, dtTileCacheCompressor* comp,
|
||||
unsigned char* compressed, const int compressedSize,
|
||||
dtTileCacheLayer** layerOut);
|
||||
|
||||
dtTileCacheContourSet* dtAllocTileCacheContourSet(dtTileCacheAlloc* alloc);
|
||||
void dtFreeTileCacheContourSet(dtTileCacheAlloc* alloc, dtTileCacheContourSet* cset);
|
||||
@@ -101,6 +120,8 @@ void dtFreeTileCacheContourSet(dtTileCacheAlloc* alloc, dtTileCacheContourSet* c
|
||||
dtTileCachePolyMesh* dtAllocTileCachePolyMesh(dtTileCacheAlloc* alloc);
|
||||
void dtFreeTileCachePolyMesh(dtTileCacheAlloc* alloc, dtTileCachePolyMesh* lmesh);
|
||||
|
||||
dtStatus dtMarkCylinderArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch,
|
||||
const float* pos, const float radius, const float height, const unsigned char areaId);
|
||||
|
||||
dtStatus dtBuildTileCacheRegions(dtTileCacheAlloc* alloc,
|
||||
dtTileCacheLayer& layer,
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "DetourAssert.h"
|
||||
#include "DetourTileCacheBuilder.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
template<class T> class dtFixedArray
|
||||
@@ -39,7 +40,6 @@ public:
|
||||
};
|
||||
|
||||
static const unsigned short DT_TILECACHE_NULL_IDX = 0xffff;
|
||||
static const unsigned char DT_TILECACHE_NULL_AREA = 0;
|
||||
|
||||
inline int getDirOffsetX(int dir)
|
||||
{
|
||||
@@ -58,41 +58,6 @@ static const int MAX_REM_EDGES = 48; // TODO: make this an expression.
|
||||
|
||||
|
||||
|
||||
int dtCalcTileCacheLayerBufferSize(const int gridWidth, const int gridHeight)
|
||||
{
|
||||
const int headerSize = dtAlign4(sizeof(dtTileCacheLayerHeader));
|
||||
const int gridSize = gridWidth * gridHeight;
|
||||
return headerSize + gridSize*4;
|
||||
}
|
||||
|
||||
dtStatus dtCastTileCacheLayer(dtTileCacheLayer& layer, unsigned char* buffer, const int bufferSize)
|
||||
{
|
||||
if (!buffer)
|
||||
return DT_FAILURE;
|
||||
|
||||
dtTileCacheLayerHeader* header = (dtTileCacheLayerHeader*)buffer;
|
||||
if (header->magic != DT_TILECACHE_MAGIC)
|
||||
return DT_FAILURE | DT_WRONG_MAGIC;
|
||||
if (header->version != DT_TILECACHE_VERSION)
|
||||
return DT_FAILURE | DT_WRONG_VERSION;
|
||||
|
||||
const int headerSize = dtAlign4(sizeof(dtTileCacheLayerHeader));
|
||||
const int gridSize = (int)header->width * (int)header->height;
|
||||
const int memUsage = headerSize + gridSize*4;
|
||||
if (bufferSize < memUsage)
|
||||
return DT_FAILURE | DT_BUFFER_TOO_SMALL;
|
||||
|
||||
memset(&layer, 0, sizeof(layer));
|
||||
|
||||
layer.header = header;
|
||||
layer.heights = buffer + headerSize;
|
||||
layer.areas = buffer + headerSize + gridSize;
|
||||
layer.cons = buffer + headerSize + gridSize*2;
|
||||
layer.regs = buffer + headerSize + gridSize*3;
|
||||
|
||||
return DT_SUCCESS;
|
||||
}
|
||||
|
||||
dtTileCacheContourSet* dtAllocTileCacheContourSet(dtTileCacheAlloc* alloc)
|
||||
{
|
||||
dtAssert(alloc);
|
||||
@@ -740,7 +705,7 @@ static unsigned char getCornerHeight(dtTileCacheLayer& layer,
|
||||
{
|
||||
const int idx = px + pz*w;
|
||||
const int h = (int)layer.heights[idx];
|
||||
if (dtAbs(h-y) <= walkableClimb)
|
||||
if (dtAbs(h-y) <= walkableClimb && layer.areas[idx] != DT_TILECACHE_NULL_AREA)
|
||||
{
|
||||
height = dtMax(height, (unsigned char)h);
|
||||
portal &= (layer.cons[idx] >> 4);
|
||||
@@ -783,7 +748,7 @@ dtStatus dtBuildTileCacheContours(dtTileCacheAlloc* alloc,
|
||||
memset(lcset.conts, 0, sizeof(dtTileCacheContour)*lcset.nconts);
|
||||
|
||||
// Allocate temp buffer for contour tracing.
|
||||
const int maxTempVerts = (w*h*2) * 2; // Twice around the layer.
|
||||
const int maxTempVerts = (w+h)*2 * 2; // Twice around the layer.
|
||||
|
||||
dtFixedArray<unsigned char> tempVerts(alloc, maxTempVerts*4);
|
||||
if (!tempVerts)
|
||||
@@ -1974,3 +1939,167 @@ dtStatus dtBuildTileCachePolyMesh(dtTileCacheAlloc* alloc,
|
||||
return DT_SUCCESS;
|
||||
}
|
||||
|
||||
dtStatus dtMarkCylinderArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch,
|
||||
const float* pos, const float radius, const float height, const unsigned char areaId)
|
||||
{
|
||||
float bmin[3], bmax[3];
|
||||
bmin[0] = pos[0] - radius;
|
||||
bmin[1] = pos[1];
|
||||
bmin[2] = pos[2] - radius;
|
||||
bmax[0] = pos[0] + radius;
|
||||
bmax[1] = pos[1] + height;
|
||||
bmax[2] = pos[2] + radius;
|
||||
const float r2 = dtSqr(radius/cs + 0.5f);
|
||||
|
||||
const int w = (int)layer.header->width;
|
||||
const int h = (int)layer.header->height;
|
||||
const float ics = 1.0f/cs;
|
||||
const float ich = 1.0f/ch;
|
||||
|
||||
const float px = (pos[0]-orig[0])*ics;
|
||||
const float pz = (pos[2]-orig[2])*ics;
|
||||
|
||||
int minx = (int)floorf((bmin[0]-orig[0])*ics);
|
||||
int miny = (int)floorf((bmin[1]-orig[1])*ich);
|
||||
int minz = (int)floorf((bmin[2]-orig[2])*ics);
|
||||
int maxx = (int)floorf((bmax[0]-orig[0])*ics);
|
||||
int maxy = (int)floorf((bmax[1]-orig[1])*ich);
|
||||
int maxz = (int)floorf((bmax[2]-orig[2])*ics);
|
||||
|
||||
if (maxx < 0) return DT_SUCCESS;
|
||||
if (minx >= w) return DT_SUCCESS;
|
||||
if (maxz < 0) return DT_SUCCESS;
|
||||
if (minz >= h) return DT_SUCCESS;
|
||||
|
||||
if (minx < 0) minx = 0;
|
||||
if (maxx >= w) maxx = w-1;
|
||||
if (minz < 0) minz = 0;
|
||||
if (maxz >= h) maxz = h-1;
|
||||
|
||||
for (int z = minz; z <= maxz; ++z)
|
||||
{
|
||||
for (int x = minx; x <= maxx; ++x)
|
||||
{
|
||||
const float dx = (float)(x+0.5f) - px;
|
||||
const float dz = (float)(z+0.5f) - pz;
|
||||
if (dx*dx + dz*dz > r2)
|
||||
continue;
|
||||
const int y = layer.heights[x+z*w];
|
||||
if (y < miny || y > maxy)
|
||||
continue;
|
||||
layer.areas[x+z*w] = areaId;
|
||||
}
|
||||
}
|
||||
|
||||
return DT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
dtStatus dtBuildTileCacheLayer(dtTileCacheCompressor* comp,
|
||||
dtTileCacheLayerHeader* header,
|
||||
const unsigned char* heights,
|
||||
const unsigned char* areas,
|
||||
const unsigned char* cons,
|
||||
unsigned char** outData, int* outDataSize)
|
||||
{
|
||||
const int headerSize = dtAlign4(sizeof(dtTileCacheLayerHeader));
|
||||
const int gridSize = (int)header->width * (int)header->height;
|
||||
const int maxDataSize = headerSize + comp->maxCompressedSize(gridSize*3);
|
||||
unsigned char* data = (unsigned char*)dtAlloc(maxDataSize, DT_ALLOC_PERM);
|
||||
if (!data)
|
||||
return DT_FAILURE | DT_OUT_OF_MEMORY;
|
||||
memset(data, 0, maxDataSize);
|
||||
|
||||
// Store header
|
||||
memcpy(data, header, sizeof(dtTileCacheLayerHeader));
|
||||
|
||||
// Concatenate grid data for compression.
|
||||
const int bufferSize = gridSize*3;
|
||||
unsigned char* buffer = (unsigned char*)dtAlloc(bufferSize, DT_ALLOC_TEMP);
|
||||
if (!buffer)
|
||||
return DT_FAILURE | DT_OUT_OF_MEMORY;
|
||||
memcpy(buffer, heights, gridSize);
|
||||
memcpy(buffer+gridSize, areas, gridSize);
|
||||
memcpy(buffer+gridSize*2, cons, gridSize);
|
||||
|
||||
// Compress
|
||||
unsigned char* compressed = data + headerSize;
|
||||
const int maxCompressedSize = maxDataSize - headerSize;
|
||||
int compressedSize = 0;
|
||||
dtStatus status = comp->compress(buffer, bufferSize, compressed, maxCompressedSize, &compressedSize);
|
||||
if (dtStatusFailed(status))
|
||||
return status;
|
||||
|
||||
*outData = data;
|
||||
*outDataSize = headerSize + compressedSize;
|
||||
|
||||
dtFree(buffer);
|
||||
|
||||
return DT_SUCCESS;
|
||||
}
|
||||
|
||||
void dtFreeTileCacheLayer(dtTileCacheAlloc* alloc, dtTileCacheLayer* layer)
|
||||
{
|
||||
dtAssert(alloc);
|
||||
// The layer is allocated as one conitguous blob of data.
|
||||
alloc->free(layer);
|
||||
}
|
||||
|
||||
dtStatus dtDecompressTileCacheLayer(dtTileCacheAlloc* alloc, dtTileCacheCompressor* comp,
|
||||
unsigned char* compressed, const int compressedSize,
|
||||
dtTileCacheLayer** layerOut)
|
||||
{
|
||||
dtAssert(alloc);
|
||||
dtAssert(comp);
|
||||
|
||||
if (!layerOut)
|
||||
return DT_FAILURE | DT_INVALID_PARAM;
|
||||
if (!compressed)
|
||||
return DT_FAILURE | DT_INVALID_PARAM;
|
||||
|
||||
*layerOut = 0;
|
||||
|
||||
dtTileCacheLayerHeader* compressedHeader = (dtTileCacheLayerHeader*)compressed;
|
||||
if (compressedHeader->magic != DT_TILECACHE_MAGIC)
|
||||
return DT_FAILURE | DT_WRONG_MAGIC;
|
||||
if (compressedHeader->version != DT_TILECACHE_VERSION)
|
||||
return DT_FAILURE | DT_WRONG_VERSION;
|
||||
|
||||
const int layerSize = dtAlign4(sizeof(dtTileCacheLayer));
|
||||
const int headerSize = dtAlign4(sizeof(dtTileCacheLayerHeader));
|
||||
const int gridSize = (int)compressedHeader->width * (int)compressedHeader->height;
|
||||
const int bufferSize = layerSize + headerSize + gridSize*4;
|
||||
|
||||
unsigned char* buffer = (unsigned char*)alloc->alloc(bufferSize);
|
||||
if (!buffer)
|
||||
return DT_FAILURE | DT_OUT_OF_MEMORY;
|
||||
memset(buffer, 0, bufferSize);
|
||||
|
||||
dtTileCacheLayer* layer = (dtTileCacheLayer*)buffer;
|
||||
dtTileCacheLayerHeader* header = (dtTileCacheLayerHeader*)(buffer + layerSize);
|
||||
unsigned char* grids = buffer + layerSize + headerSize;
|
||||
const int gridsSize = bufferSize - (layerSize + headerSize);
|
||||
|
||||
// Copy header
|
||||
memcpy(header, compressedHeader, headerSize);
|
||||
// Decompress grid.
|
||||
int size = 0;
|
||||
dtStatus status = comp->decompress(compressed+headerSize, compressedSize-headerSize,
|
||||
grids, gridsSize, &size);
|
||||
if (dtStatusFailed(status))
|
||||
{
|
||||
dtFree(buffer);
|
||||
return status;
|
||||
}
|
||||
|
||||
layer->header = header;
|
||||
layer->heights = grids;
|
||||
layer->areas = grids + gridSize;
|
||||
layer->cons = grids + gridSize*2;
|
||||
layer->regs = grids + gridSize*3;
|
||||
|
||||
*layerOut = layer;
|
||||
|
||||
return DT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
rcVcopy(layer->bmin, bmin);
|
||||
rcVcopy(layer->bmax, bmax);
|
||||
layer->bmin[1] = bmin[1] + hmin*chf.ch;
|
||||
layer->bmax[1] = bmin[1] + hmax*chf.ch;
|
||||
layer->bmax[1] = bmin[1] + hmax*chf.ch;
|
||||
layer->hmin = hmin;
|
||||
layer->hmax = hmax;
|
||||
|
||||
@@ -581,7 +581,13 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
unsigned char alid = srcReg[ai] != 0xff ? regs[srcReg[ai]].layerId : 0xff;
|
||||
// Portal mask
|
||||
if (chf.areas[ai] != RC_NULL_AREA && lid != alid)
|
||||
{
|
||||
portal |= (unsigned char)(1<<dir);
|
||||
// Update height so that it matches on both sides of the portal.
|
||||
const rcCompactSpan& as = chf.spans[ai];
|
||||
if (as.y > hmin)
|
||||
layer->heights[idx] = rcMax(layer->heights[idx], (unsigned char)(as.y - hmin));
|
||||
}
|
||||
// Valid connection mask
|
||||
if (chf.areas[ai] != RC_NULL_AREA && lid == alid)
|
||||
{
|
||||
@@ -597,6 +603,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (layer->minx > layer->maxx)
|
||||
layer->minx = layer->maxx = 0;
|
||||
if (layer->miny > layer->maxy)
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
6B3F9D6D13179EFC000B33D9 /* RecastLayers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B3F9D6C13179EFC000B33D9 /* RecastLayers.cpp */; };
|
||||
6B555DB1100B212E00247EA3 /* imguiRenderGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B555DB0100B212E00247EA3 /* imguiRenderGL.cpp */; };
|
||||
6B5683B812D9E7D3000B9960 /* Sample_TempObstacles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B5683B712D9E7D3000B9960 /* Sample_TempObstacles.cpp */; };
|
||||
6B5DC3B713350E6300D33D05 /* DetourTileCacheBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B5DC3B513350E6300D33D05 /* DetourTileCacheBuilder.cpp */; };
|
||||
6B62416A103434880002E346 /* RecastMeshDetail.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B624169103434880002E346 /* RecastMeshDetail.cpp */; };
|
||||
6B8036AE113BAABE005ED67B /* Sample_Debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B8036AD113BAABE005ED67B /* Sample_Debug.cpp */; };
|
||||
6B847777122D221D00ADF63D /* ValueHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B847776122D221C00ADF63D /* ValueHistory.cpp */; };
|
||||
@@ -54,6 +53,8 @@
|
||||
6BB93C7E10CFE1D500F74F2B /* DetourDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93C7B10CFE1D500F74F2B /* DetourDebugDraw.cpp */; };
|
||||
6BB93C7F10CFE1D500F74F2B /* RecastDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93C7C10CFE1D500F74F2B /* RecastDebugDraw.cpp */; };
|
||||
6BB93CF610CFEC4500F74F2B /* RecastDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93CF510CFEC4500F74F2B /* RecastDump.cpp */; };
|
||||
6BC048CA134F23330047265D /* DetourTileCacheBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BC048C9134F23330047265D /* DetourTileCacheBuilder.cpp */; };
|
||||
6BC048CD134F23620047265D /* DetourTileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BC048CC134F23620047265D /* DetourTileCache.cpp */; };
|
||||
6BCF32361104CD05009445BF /* OffMeshConnectionTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BCF32351104CD05009445BF /* OffMeshConnectionTool.cpp */; };
|
||||
6BD1B1D01323E2EC00587F83 /* Sample_SoloMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BD1B1CF1323E2EC00587F83 /* Sample_SoloMesh.cpp */; };
|
||||
6BD402011224279400995864 /* PerfTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BD402001224279400995864 /* PerfTimer.cpp */; };
|
||||
@@ -104,8 +105,6 @@
|
||||
6B555DF6100B273500247EA3 /* stb_truetype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stb_truetype.h; path = ../../Contrib/stb_truetype.h; sourceTree = SOURCE_ROOT; };
|
||||
6B5683B612D9E7D3000B9960 /* Sample_TempObstacles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sample_TempObstacles.h; path = ../../Include/Sample_TempObstacles.h; sourceTree = SOURCE_ROOT; };
|
||||
6B5683B712D9E7D3000B9960 /* Sample_TempObstacles.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sample_TempObstacles.cpp; path = ../../Source/Sample_TempObstacles.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B5DC3B513350E6300D33D05 /* DetourTileCacheBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourTileCacheBuilder.cpp; sourceTree = "<group>"; };
|
||||
6B5DC3B613350E6300D33D05 /* DetourTileCacheBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourTileCacheBuilder.h; sourceTree = "<group>"; };
|
||||
6B624169103434880002E346 /* RecastMeshDetail.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastMeshDetail.cpp; path = ../../../Recast/Source/RecastMeshDetail.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B8036AC113BAABE005ED67B /* Sample_Debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sample_Debug.h; path = ../../Include/Sample_Debug.h; sourceTree = SOURCE_ROOT; };
|
||||
6B8036AD113BAABE005ED67B /* Sample_Debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sample_Debug.cpp; path = ../../Source/Sample_Debug.cpp; sourceTree = SOURCE_ROOT; };
|
||||
@@ -158,6 +157,10 @@
|
||||
6BB93C7C10CFE1D500F74F2B /* RecastDebugDraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastDebugDraw.cpp; path = ../../../DebugUtils/Source/RecastDebugDraw.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6BB93CF410CFEC4500F74F2B /* RecastDump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RecastDump.h; path = ../../../DebugUtils/Include/RecastDump.h; sourceTree = SOURCE_ROOT; };
|
||||
6BB93CF510CFEC4500F74F2B /* RecastDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastDump.cpp; path = ../../../DebugUtils/Source/RecastDump.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6BC048C8134F23330047265D /* DetourTileCacheBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourTileCacheBuilder.h; path = Include/DetourTileCacheBuilder.h; sourceTree = "<group>"; };
|
||||
6BC048C9134F23330047265D /* DetourTileCacheBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourTileCacheBuilder.cpp; path = Source/DetourTileCacheBuilder.cpp; sourceTree = "<group>"; };
|
||||
6BC048CB134F23450047265D /* DetourTileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourTileCache.h; path = Include/DetourTileCache.h; sourceTree = "<group>"; };
|
||||
6BC048CC134F23620047265D /* DetourTileCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourTileCache.cpp; path = Source/DetourTileCache.cpp; sourceTree = "<group>"; };
|
||||
6BCF32341104CD05009445BF /* OffMeshConnectionTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OffMeshConnectionTool.h; path = ../../Include/OffMeshConnectionTool.h; sourceTree = SOURCE_ROOT; };
|
||||
6BCF32351104CD05009445BF /* OffMeshConnectionTool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OffMeshConnectionTool.cpp; path = ../../Source/OffMeshConnectionTool.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6BD1B1CE1323E2EC00587F83 /* Sample_SoloMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sample_SoloMesh.h; path = ../../Include/Sample_SoloMesh.h; sourceTree = SOURCE_ROOT; };
|
||||
@@ -338,8 +341,10 @@
|
||||
6B5DC3B413350E6300D33D05 /* DetourTileCache */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6B5DC3B613350E6300D33D05 /* DetourTileCacheBuilder.h */,
|
||||
6B5DC3B513350E6300D33D05 /* DetourTileCacheBuilder.cpp */,
|
||||
6BC048C8134F23330047265D /* DetourTileCacheBuilder.h */,
|
||||
6BC048C9134F23330047265D /* DetourTileCacheBuilder.cpp */,
|
||||
6BC048CB134F23450047265D /* DetourTileCache.h */,
|
||||
6BC048CC134F23620047265D /* DetourTileCache.cpp */,
|
||||
);
|
||||
name = DetourTileCache;
|
||||
path = ../../../DetourTileCache;
|
||||
@@ -531,7 +536,8 @@
|
||||
6B86C9AA12F69DD500C92D2E /* fastlz.c in Sources */,
|
||||
6B3F9D6D13179EFC000B33D9 /* RecastLayers.cpp in Sources */,
|
||||
6BD1B1D01323E2EC00587F83 /* Sample_SoloMesh.cpp in Sources */,
|
||||
6B5DC3B713350E6300D33D05 /* DetourTileCacheBuilder.cpp in Sources */,
|
||||
6BC048CA134F23330047265D /* DetourTileCacheBuilder.cpp in Sources */,
|
||||
6BC048CD134F23620047265D /* DetourTileCache.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -29,10 +29,17 @@ class Sample_TempObstacles : public Sample
|
||||
{
|
||||
protected:
|
||||
bool m_keepInterResults;
|
||||
float m_cacheBuildTimeMs;
|
||||
|
||||
class TileCache* m_tileCache;
|
||||
class ObstacleSet* m_obs;
|
||||
class LinearAllocator* m_talloc;
|
||||
class FastLZCompressor* m_tcomp;
|
||||
|
||||
class dtTileCache* m_tileCache;
|
||||
|
||||
float m_cacheBuildTimeMs;
|
||||
int m_cacheCompressedSize;
|
||||
int m_cacheRawSize;
|
||||
int m_cacheLayerCount;
|
||||
int m_cacheBuildMemUsage;
|
||||
|
||||
enum DrawMode
|
||||
{
|
||||
@@ -53,14 +60,6 @@ protected:
|
||||
int m_maxPolysPerTile;
|
||||
float m_tileSize;
|
||||
|
||||
int m_rebuildTileCount;
|
||||
float m_rebuildTime;
|
||||
|
||||
int calcTouchedTiles(const float minx, const float minz, const float maxx, const float maxz,
|
||||
struct TouchedTile* touched, const int maxTouched);
|
||||
|
||||
void rebuildTiles(const struct TouchedTile* touched, const int ntouched);
|
||||
|
||||
public:
|
||||
Sample_TempObstacles();
|
||||
virtual ~Sample_TempObstacles();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user