mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: properly calculate tile and poly bits during build
Tile bits should be 16, and polyBits 28 - tileBits. This is also the reason why the 'm_saltBits < 10' check no longer exists in the executable.
This commit is contained in:
parent
97204c20dc
commit
4ced95e2c1
@ -236,7 +236,7 @@ void Editor_TileMesh::handleSettings()
|
||||
m_buildAll = !m_buildAll;
|
||||
|
||||
imguiLabel("Tiling");
|
||||
imguiSlider("TileSize", &m_tileSize, 16.0f, 1024.0f, 16.0f);
|
||||
imguiSlider("TileSize", &m_tileSize, 8.0f, 1024.0f, 8.0f);
|
||||
|
||||
if (m_geom)
|
||||
{
|
||||
@ -252,11 +252,11 @@ void Editor_TileMesh::handleSettings()
|
||||
imguiValue(text);
|
||||
snprintf(text, 64, "Tile Sizes %g x %g", tw*m_cellSize, th*m_cellSize);
|
||||
imguiValue(text);
|
||||
// Max tiles and max polys affect how the tile IDs are caculated.
|
||||
// There are 22 bits available for identifying a tile and a polygon.
|
||||
int tileBits = rcMin((int)ilog2(nextPow2(tw*th)), 28);
|
||||
if (tileBits > 28) tileBits = 28;
|
||||
int polyBits = 22 - tileBits;
|
||||
// Max tiles and max polys affect how the tile IDs are calculated.
|
||||
// There are 28 bits available for identifying a tile and a polygon.
|
||||
int tileBits = rcMin((int)ilog2(nextPow2(tw*th)), 16);
|
||||
if (tileBits > 16) tileBits = 16;
|
||||
int polyBits = 28 - tileBits;
|
||||
m_maxTiles = 1 << tileBits;
|
||||
m_maxPolysPerTile = 1 << polyBits;
|
||||
snprintf(text, 64, "Max Tiles %d", m_maxTiles);
|
||||
|
@ -257,10 +257,6 @@ dtStatus dtNavMesh::init(const dtNavMeshParams* params)
|
||||
m_polyBits = dtIlog2(dtNextPow2((unsigned int)params->maxPolys));
|
||||
// Only allow 31 salt bits, since the salt mask is calculated using 32bit uint and it will overflow.
|
||||
m_saltBits = dtMin((unsigned int)31, 32 - m_tileBits - m_polyBits);
|
||||
|
||||
// NOTE[ AMOS ]: this check doesn't exist in R5!
|
||||
if (m_saltBits < 10)
|
||||
return DT_FAILURE | DT_INVALID_PARAM;
|
||||
#endif
|
||||
|
||||
return DT_SUCCESS;
|
||||
|
@ -165,10 +165,6 @@ dtStatus dtTileCache::init(const dtTileCacheParams* params,
|
||||
// Only allow 31 salt bits, since the salt mask is calculated using 32bit uint and it will overflow.
|
||||
m_saltBits = dtMin((unsigned int)31, 32 - m_tileBits);
|
||||
|
||||
// NOTE[ AMOS ]: this check doesn't exist in dtNavMesh::init for R5, so it probably also doesn't exist here!
|
||||
if (m_saltBits < 10)
|
||||
return DT_FAILURE | DT_INVALID_PARAM;
|
||||
|
||||
return DT_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user