mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: create method for getting actual tile bounds
Properly calculate the height of the tile bounding.
This commit is contained in:
parent
12e370e630
commit
7ec6ab5b3f
@ -425,6 +425,8 @@ public:
|
||||
|
||||
bool linkCountAvailable(const int count) const;
|
||||
|
||||
void getTightBounds(float* bminOut, float* bmaxOut) const;
|
||||
|
||||
unsigned int salt; ///Counter describing modifications to the tile.
|
||||
|
||||
unsigned int linksFreeList; ///Index to the next free link.
|
||||
|
@ -149,6 +149,40 @@ bool dtMeshTile::linkCountAvailable(const int count) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void dtMeshTile::getTightBounds(float* bminOut, float* bmaxOut) const
|
||||
{
|
||||
float hmin = FLT_MAX;
|
||||
float hmax = -FLT_MAX;
|
||||
|
||||
if (detailVerts && header->detailVertCount)
|
||||
{
|
||||
for (int i = 0; i < header->detailVertCount; ++i)
|
||||
{
|
||||
const float h = detailVerts[i*3+2];
|
||||
hmin = rdMin(hmin, h);
|
||||
hmax = rdMax(hmax, h);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < header->vertCount; ++i)
|
||||
{
|
||||
const float h = verts[i*3+2];
|
||||
hmin = rdMin(hmin, h);
|
||||
hmax = rdMax(hmax, h);
|
||||
}
|
||||
}
|
||||
|
||||
hmin -= header->walkableClimb;
|
||||
hmax += header->walkableClimb;
|
||||
|
||||
rdVcopy(bminOut, header->bmin);
|
||||
rdVcopy(bmaxOut, header->bmax);
|
||||
|
||||
bminOut[2] = hmin;
|
||||
bmaxOut[2] = hmax;
|
||||
}
|
||||
|
||||
int dtCalcTraverseTableCellIndex(const int numPolyGroups,
|
||||
const unsigned short polyGroup1, const unsigned short polyGroup2)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user