1
This commit is contained in:
parent
0223227a47
commit
d7c6c79045
@ -306,6 +306,10 @@ struct BuilderParams
|
|||||||
LinearAllocator* talloc = nullptr;
|
LinearAllocator* talloc = nullptr;
|
||||||
FastLZCompressor* tcomp = nullptr;
|
FastLZCompressor* tcomp = nullptr;
|
||||||
MeshProcess* tmproc = nullptr;
|
MeshProcess* tmproc = nullptr;
|
||||||
|
int gw = 0;
|
||||||
|
int gh = 0;
|
||||||
|
|
||||||
|
int ts = 0;
|
||||||
int tw = 0;
|
int tw = 0;
|
||||||
int th = 0;
|
int th = 0;
|
||||||
};
|
};
|
||||||
@ -314,11 +318,14 @@ dtNavMesh* NavMeshBuilder::Build(MapInstance* map_instance)
|
|||||||
{
|
{
|
||||||
BuilderParams builder_params;
|
BuilderParams builder_params;
|
||||||
// Init cache
|
// Init cache
|
||||||
int gw = 0, gh = 0;
|
rcCalcGridSize(builder_params.bmin,
|
||||||
rcCalcGridSize(builder_params.bmin, builder_params.bmax, builder_params.kCellSize, &gw, &gh);
|
builder_params.bmax,
|
||||||
const int ts = (int)kTileSize;
|
builder_params.kCellSize,
|
||||||
const int tw = (gw + ts-1) / ts;
|
&builder_params.gw,
|
||||||
const int th = (gh + ts-1) / ts;
|
&builder_params.gh);
|
||||||
|
builder_params.ts = (int)kTileSize;
|
||||||
|
builder_params.tw = (builder_params.gw + builder_params.ts-1) / builder_params.ts;
|
||||||
|
builder_params.th = (builder_params.gh + builder_params.ts-1) / builder_params.ts;
|
||||||
|
|
||||||
InitRcConfig(builder_params);
|
InitRcConfig(builder_params);
|
||||||
InitTileCacheParams(builder_params);
|
InitTileCacheParams(builder_params);
|
||||||
@ -351,8 +358,8 @@ dtNavMesh* NavMeshBuilder::Build(MapInstance* map_instance)
|
|||||||
int m_cacheCompressedSize = 0;
|
int m_cacheCompressedSize = 0;
|
||||||
int m_cacheRawSize = 0;
|
int m_cacheRawSize = 0;
|
||||||
|
|
||||||
for (int y = 0; y < th; ++y) {
|
for (int y = 0; y < builder_params.th; ++y) {
|
||||||
for (int x = 0; x < tw; ++x) {
|
for (int x = 0; x < builder_params.tw; ++x) {
|
||||||
TileCacheData tiles[MAX_LAYERS];
|
TileCacheData tiles[MAX_LAYERS];
|
||||||
memset(tiles, 0, sizeof(tiles));
|
memset(tiles, 0, sizeof(tiles));
|
||||||
int ntiles = RasterizeTileLayers(x, y, builder_params.cfg, tiles, MAX_LAYERS);
|
int ntiles = RasterizeTileLayers(x, y, builder_params.cfg, tiles, MAX_LAYERS);
|
||||||
@ -376,8 +383,8 @@ dtNavMesh* NavMeshBuilder::Build(MapInstance* map_instance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build initial meshes
|
// Build initial meshes
|
||||||
for (int y = 0; y < th; ++y) {
|
for (int y = 0; y < builder_params.th; ++y) {
|
||||||
for (int x = 0; x < tw; ++x) {
|
for (int x = 0; x < builder_params.tw; ++x) {
|
||||||
tile_cache->buildNavMeshTilesAt(x,y, navmesh);
|
tile_cache->buildNavMeshTilesAt(x,y, navmesh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user