mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
feat(Tools/MMaps): Allow to specify different Recast settings for different maps (#10922)
This commit is contained in:
committed by
GitHub
parent
62f6513c9a
commit
5b0af98097
@@ -545,40 +545,10 @@ namespace MMAP
|
||||
int lTriCount = meshData.liquidTris.size() / 3;
|
||||
uint8* lTriFlags = meshData.liquidType.getCArray();
|
||||
|
||||
// these are WORLD UNIT based metrics
|
||||
// this are basic unit dimentions
|
||||
// value have to divide GRID_SIZE(533.3333f) ( aka: 0.5333, 0.2666, 0.3333, 0.1333, etc )
|
||||
const static float BASE_UNIT_DIM = m_bigBaseUnit ? 0.5333333f : 0.2666666f;
|
||||
|
||||
// All are in UNIT metrics!
|
||||
const static int VERTEX_PER_MAP = int(GRID_SIZE / BASE_UNIT_DIM + 0.5f);
|
||||
const static int VERTEX_PER_TILE = m_bigBaseUnit ? 40 : 80; // must divide VERTEX_PER_MAP
|
||||
const static int TILES_PER_MAP = VERTEX_PER_MAP / VERTEX_PER_TILE;
|
||||
|
||||
rcConfig config;
|
||||
memset(&config, 0, sizeof(rcConfig));
|
||||
|
||||
rcVcopy(config.bmin, bmin);
|
||||
rcVcopy(config.bmax, bmax);
|
||||
|
||||
config.maxVertsPerPoly = DT_VERTS_PER_POLYGON;
|
||||
config.cs = BASE_UNIT_DIM;
|
||||
config.ch = BASE_UNIT_DIM;
|
||||
config.walkableSlopeAngle = m_maxWalkableAngle;
|
||||
config.tileSize = VERTEX_PER_TILE;
|
||||
config.walkableRadius = m_bigBaseUnit ? 1 : 2;
|
||||
config.borderSize = config.walkableRadius + 3;
|
||||
config.maxEdgeLen = VERTEX_PER_TILE + 1; // anything bigger than tileSize
|
||||
// a value >= 3|6 allows npcs to walk over some fences
|
||||
// a value >= 4|8 allows npcs to walk over all fences
|
||||
// we prefer 3 and 6 for both Height/Climb as it's closer to be like retail
|
||||
config.walkableHeight = m_bigBaseUnit ? 3 : 6;
|
||||
config.walkableClimb = m_bigBaseUnit ? 3 : 6;
|
||||
config.minRegionArea = rcSqr(60);
|
||||
config.mergeRegionArea = rcSqr(50);
|
||||
config.maxSimplificationError = 1.8f; // eliminates most jagged edges (tiny polygons)
|
||||
config.detailSampleDist = config.cs * 16;
|
||||
config.detailSampleMaxError = config.ch * 1;
|
||||
const TileConfig tileConfig = TileConfig(m_bigBaseUnit);
|
||||
int TILES_PER_MAP = tileConfig.TILES_PER_MAP;
|
||||
float BASE_UNIT_DIM = tileConfig.BASE_UNIT_DIM;
|
||||
rcConfig config = GetMapSpecificConfig(mapID, bmin, bmax, tileConfig);
|
||||
|
||||
// this sets the dimensions of the heightfield - should maybe happen before border padding
|
||||
rcCalcGridSize(config.bmin, config.bmax, config.cs, &config.width, &config.height);
|
||||
@@ -1003,6 +973,45 @@ namespace MMAP
|
||||
return true;
|
||||
}
|
||||
|
||||
rcConfig MapBuilder::GetMapSpecificConfig(uint32 mapID, float bmin[3], float bmax[3], const TileConfig &tileConfig)
|
||||
{
|
||||
rcConfig config;
|
||||
memset(&config, 0, sizeof(rcConfig));
|
||||
|
||||
rcVcopy(config.bmin, bmin);
|
||||
rcVcopy(config.bmax, bmax);
|
||||
|
||||
config.maxVertsPerPoly = DT_VERTS_PER_POLYGON;
|
||||
config.cs = tileConfig.BASE_UNIT_DIM;
|
||||
config.ch = tileConfig.BASE_UNIT_DIM;
|
||||
config.walkableSlopeAngle = m_maxWalkableAngle;
|
||||
config.tileSize = tileConfig.VERTEX_PER_TILE;
|
||||
config.walkableRadius = m_bigBaseUnit ? 1 : 2;
|
||||
config.borderSize = config.walkableRadius + 3;
|
||||
config.maxEdgeLen = tileConfig.VERTEX_PER_TILE + 1; // anything bigger than tileSize
|
||||
config.walkableHeight = m_bigBaseUnit ? 3 : 6;
|
||||
// a value >= 3|6 allows npcs to walk over some fences
|
||||
// a value >= 4|8 allows npcs to walk over all fences
|
||||
config.walkableClimb = m_bigBaseUnit ? 4 : 8;
|
||||
config.minRegionArea = rcSqr(60);
|
||||
config.mergeRegionArea = rcSqr(50);
|
||||
config.maxSimplificationError = 1.8f; // eliminates most jagged edges (tiny polygons)
|
||||
config.detailSampleDist = config.cs * 16;
|
||||
config.detailSampleMaxError = config.ch * 1;
|
||||
|
||||
switch (mapID)
|
||||
{
|
||||
// Blade's Edge Arena
|
||||
case 562:
|
||||
config.walkableRadius = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
uint32 MapBuilder::percentageDone(uint32 totalTiles, uint32 totalTilesBuilt)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user