mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: improve naming and documentation for static path build code
This commit is contained in:
parent
e3bca38a0e
commit
e8398ea60c
@ -759,7 +759,7 @@ void Editor_TileMesh::buildAllTiles()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dtBuildStaticPathingData(m_navMesh))
|
if (!dtCreateStaticPathingData(m_navMesh))
|
||||||
{
|
{
|
||||||
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Failed to build static pathing data.");
|
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Failed to build static pathing data.");
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,11 @@ private:
|
|||||||
rdIntArray parent;
|
rdIntArray parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool dtBuildStaticPathingData(dtNavMesh* mesh);
|
/// Builds navigation mesh static pathing data from the provided navmesh.
|
||||||
|
/// @ingroup detour
|
||||||
|
/// @param[in] mesh Tile creation data.
|
||||||
|
/// @return True if the static pathing data was successfully created.
|
||||||
|
bool dtCreateStaticPathingData(dtNavMesh* mesh);
|
||||||
|
|
||||||
/// Builds navigation mesh tile data from the provided tile creation data.
|
/// Builds navigation mesh tile data from the provided tile creation data.
|
||||||
/// @ingroup detour
|
/// @ingroup detour
|
||||||
|
@ -269,7 +269,7 @@ static unsigned char classifyOffMeshPoint(const float* pt, const float* bmin, co
|
|||||||
return 0xff;
|
return 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setReachable(int* const tableData, const int numPolyGroups,
|
static void setPolyGroupsReachability(int* const tableData, const int numPolyGroups,
|
||||||
const int polyGroup1, const int polyGroup2, const bool isReachable)
|
const int polyGroup1, const int polyGroup2, const bool isReachable)
|
||||||
{
|
{
|
||||||
const int index = polyGroup1*((numPolyGroups+31)/32)+(polyGroup2/32);
|
const int index = polyGroup1*((numPolyGroups+31)/32)+(polyGroup2/32);
|
||||||
@ -281,7 +281,7 @@ static void setReachable(int* const tableData, const int numPolyGroups,
|
|||||||
tableData[index] &= ~value;
|
tableData[index] &= ~value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dtBuildStaticPathingData(dtNavMesh* mesh)
|
bool dtCreateStaticPathingData(dtNavMesh* mesh)
|
||||||
{
|
{
|
||||||
rdAssert(mesh);
|
rdAssert(mesh);
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ bool dtBuildStaticPathingData(dtNavMesh* mesh)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// First pass.
|
// First pass to group linked and unlinked poly islands.
|
||||||
std::set<int> nlabels;
|
std::set<int> nlabels;
|
||||||
for (int i = 0; i < mesh->getMaxTiles(); ++i)
|
for (int i = 0; i < mesh->getMaxTiles(); ++i)
|
||||||
{
|
{
|
||||||
@ -347,7 +347,7 @@ bool dtBuildStaticPathingData(dtNavMesh* mesh)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second pass.
|
// Second pass to ensure all poly's have their root disjoint set ID.
|
||||||
for (int i = 0; i < mesh->getMaxTiles(); ++i)
|
for (int i = 0; i < mesh->getMaxTiles(); ++i)
|
||||||
{
|
{
|
||||||
dtMeshTile* tile = mesh->getTile(i);
|
dtMeshTile* tile = mesh->getTile(i);
|
||||||
@ -418,8 +418,9 @@ bool dtBuildStaticPathingData(dtNavMesh* mesh)
|
|||||||
{
|
{
|
||||||
for (int k = 0; k < numPolyGroups; k++)
|
for (int k = 0; k < numPolyGroups; k++)
|
||||||
{
|
{
|
||||||
|
// Only reachable if its the same polygroup or if they are linked!
|
||||||
const bool isReachable = j == k || data.find(j) == data.find(k);
|
const bool isReachable = j == k || data.find(j) == data.find(k);
|
||||||
setReachable(reachabilityTable, numPolyGroups, j, k, isReachable);
|
setPolyGroupsReachability(reachabilityTable, numPolyGroups, j, k, isReachable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user