|
|
@ -17,6 +17,8 @@
|
|
|
|
#include <Recast.h>
|
|
|
|
#include <Recast.h>
|
|
|
|
#include <RecastAlloc.h>
|
|
|
|
#include <RecastAlloc.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <components/debug/debuglog.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <iomanip>
|
|
|
|
#include <iomanip>
|
|
|
|
#include <limits>
|
|
|
|
#include <limits>
|
|
|
@ -486,23 +488,21 @@ namespace DetourNavigator
|
|
|
|
const std::vector<OffMeshConnection>& offMeshConnections, const Settings& settings,
|
|
|
|
const std::vector<OffMeshConnection>& offMeshConnections, const Settings& settings,
|
|
|
|
const SharedNavMeshCacheItem& navMeshCacheItem, NavMeshTilesCache& navMeshTilesCache)
|
|
|
|
const SharedNavMeshCacheItem& navMeshCacheItem, NavMeshTilesCache& navMeshTilesCache)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log("update NavMesh with mutiple tiles:",
|
|
|
|
Log(Debug::Debug) << std::fixed << std::setprecision(2) <<
|
|
|
|
" agentHeight=", std::setprecision(std::numeric_limits<float>::max_exponent10),
|
|
|
|
"Update NavMesh with multiple tiles:" <<
|
|
|
|
getHeight(settings, agentHalfExtents),
|
|
|
|
" agentHeight=" << getHeight(settings, agentHalfExtents) <<
|
|
|
|
" agentMaxClimb=", std::setprecision(std::numeric_limits<float>::max_exponent10),
|
|
|
|
" agentMaxClimb=" << getMaxClimb(settings) <<
|
|
|
|
getMaxClimb(settings),
|
|
|
|
" agentRadius=" << getRadius(settings, agentHalfExtents) <<
|
|
|
|
" agentRadius=", std::setprecision(std::numeric_limits<float>::max_exponent10),
|
|
|
|
" changedTile=(" << changedTile << ")" <<
|
|
|
|
getRadius(settings, agentHalfExtents),
|
|
|
|
" playerTile=(" << playerTile << ")" <<
|
|
|
|
" changedTile=", changedTile,
|
|
|
|
" changedTileDistance=" << getDistance(changedTile, playerTile);
|
|
|
|
" playerTile=", playerTile,
|
|
|
|
|
|
|
|
" changedTileDistance=", getDistance(changedTile, playerTile));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const auto params = *navMeshCacheItem->lockConst()->getImpl().getParams();
|
|
|
|
const auto params = *navMeshCacheItem->lockConst()->getImpl().getParams();
|
|
|
|
const osg::Vec3f origin(params.orig[0], params.orig[1], params.orig[2]);
|
|
|
|
const osg::Vec3f origin(params.orig[0], params.orig[1], params.orig[2]);
|
|
|
|
|
|
|
|
|
|
|
|
if (!recastMesh)
|
|
|
|
if (!recastMesh)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log("ignore add tile: recastMesh is null");
|
|
|
|
Log(Debug::Debug) << "Ignore add tile: recastMesh is null";
|
|
|
|
return navMeshCacheItem->lock()->removeTile(changedTile);
|
|
|
|
return navMeshCacheItem->lock()->removeTile(changedTile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -517,13 +517,13 @@ namespace DetourNavigator
|
|
|
|
|
|
|
|
|
|
|
|
if (isEmpty(recastMeshBounds))
|
|
|
|
if (isEmpty(recastMeshBounds))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log("ignore add tile: recastMesh is empty");
|
|
|
|
Log(Debug::Debug) << "Ignore add tile: recastMesh is empty";
|
|
|
|
return navMeshCacheItem->lock()->removeTile(changedTile);
|
|
|
|
return navMeshCacheItem->lock()->removeTile(changedTile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!shouldAddTile(changedTile, playerTile, std::min(settings.mMaxTilesNumber, params.maxTiles)))
|
|
|
|
if (!shouldAddTile(changedTile, playerTile, std::min(settings.mMaxTilesNumber, params.maxTiles)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log("ignore add tile: too far from player");
|
|
|
|
Log(Debug::Debug) << "Ignore add tile: too far from player";
|
|
|
|
return navMeshCacheItem->lock()->removeTile(changedTile);
|
|
|
|
return navMeshCacheItem->lock()->removeTile(changedTile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -540,7 +540,7 @@ namespace DetourNavigator
|
|
|
|
|
|
|
|
|
|
|
|
if (!navMeshData.mValue)
|
|
|
|
if (!navMeshData.mValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log("ignore add tile: NavMeshData is null");
|
|
|
|
Log(Debug::Debug) << "Ignore add tile: NavMeshData is null";
|
|
|
|
return navMeshCacheItem->lock()->removeTile(changedTile);
|
|
|
|
return navMeshCacheItem->lock()->removeTile(changedTile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -557,7 +557,7 @@ namespace DetourNavigator
|
|
|
|
|
|
|
|
|
|
|
|
if (!cachedNavMeshData)
|
|
|
|
if (!cachedNavMeshData)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log("cache overflow");
|
|
|
|
Log(Debug::Debug) << "Navigator cache overflow";
|
|
|
|
return navMeshCacheItem->lock()->updateTile(changedTile, std::move(navMeshData));
|
|
|
|
return navMeshCacheItem->lock()->updateTile(changedTile, std::move(navMeshData));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|