mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: fix incorrect reachability table buffer size calculation
Reachability table buffers were way larger than they should be due to an incorrect calculation of the buffer size. This bug fix reduced NavMesh sizes significantly (worlds edge '_small' was 200mb, and is now 20mb after this patch).
This commit is contained in:
parent
bff572659f
commit
c215fcb220
@ -439,7 +439,7 @@ void Editor::saveAll(std::string path, dtNavMesh* mesh)
|
||||
|
||||
header.params.disjointPolyGroupCount = linkData.setCount;
|
||||
header.params.reachabilityTableCount = m_reachabilityTableCount;
|
||||
header.params.reachabilityTableSize = ((header.params.disjointPolyGroupCount + 31) / 32) * header.params.disjointPolyGroupCount * 32;
|
||||
header.params.reachabilityTableSize = (linkData.setCount - 1) * ((linkData.setCount + 31) / 32) + (linkData.setCount - 1) / 32;
|
||||
|
||||
fwrite(&header, sizeof(NavMeshSetHeader), 1, fp);
|
||||
|
||||
@ -458,7 +458,7 @@ void Editor::saveAll(std::string path, dtNavMesh* mesh)
|
||||
fwrite(tile->data, tile->dataSize, 1, fp);
|
||||
}
|
||||
|
||||
std::vector<int> reachability(tableSize, 0);
|
||||
std::vector<int> reachability(header.params.reachabilityTableSize, 0);
|
||||
for (int i = 0; i < linkData.setCount; i++)
|
||||
setReachable(reachability, linkData.setCount, i, i, true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user