mirror of
https://github.com/OpenMW/openmw.git
synced 2026-01-05 22:43:08 +00:00
Use tile coordinates from TileCachedRecastMeshManager to schedule tile generation by navmeshtool
Using a 2D range may consume a lot of memory if there is an object far from the rest.
This commit is contained in:
parent
e9468267fc
commit
1763928548
3 changed files with 7 additions and 4 deletions
|
|
@ -260,10 +260,7 @@ namespace NavMeshTool
|
|||
if (removeUnusedTiles)
|
||||
navMeshTileConsumer->removeTilesOutsideRange(data.mWorldspace, range);
|
||||
|
||||
std::vector<TilePosition> worldspaceTiles;
|
||||
|
||||
DetourNavigator::getTilesPositions(
|
||||
range, [&](const TilePosition& tilePosition) { worldspaceTiles.push_back(tilePosition); });
|
||||
std::vector<TilePosition> worldspaceTiles = data.mTiles;
|
||||
|
||||
{
|
||||
const std::size_t tiles = worldspaceTiles.size();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <ranges>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
|
@ -371,6 +372,10 @@ namespace NavMeshTool
|
|||
<< (data.mObjects.size() - cellObjectsBegin) << " objects";
|
||||
}
|
||||
|
||||
const std::map<osg::Vec2i, DetourNavigator::ChangeType> changedTiles = manager.takeChangedTiles(guard.get());
|
||||
data.mTiles.reserve(changedTiles.size());
|
||||
std::ranges::transform(changedTiles, std::back_inserter(data.mTiles), [](const auto& v) { return v.first; });
|
||||
|
||||
Log(Debug::Info) << "Processed " << cells.size() << " cells, added " << data.mObjects.size() << " objects and "
|
||||
<< data.mHeightfields.size() << " height fields";
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ namespace NavMeshTool
|
|||
std::unique_ptr<TileCachedRecastMeshManager> mTileCachedRecastMeshManager;
|
||||
btAABB mAabb;
|
||||
bool mAabbInitialized = false;
|
||||
std::vector<DetourNavigator::TilePosition> mTiles;
|
||||
std::vector<BulletObject> mObjects;
|
||||
std::vector<std::unique_ptr<ESM::Land::LandData>> mLandData;
|
||||
std::vector<std::vector<float>> mHeightfields;
|
||||
|
|
|
|||
Loading…
Reference in a new issue