1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-10 06:44:29 +00:00

Log worldspace in RecastContext

This commit is contained in:
elsid 2023-06-10 13:23:47 +02:00
parent e6e6b65ab3
commit 180dd7dc64
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625
6 changed files with 20 additions and 14 deletions

View File

@ -433,8 +433,8 @@ namespace DetourNavigator
return JobStatus::MemoryCacheMiss; return JobStatus::MemoryCacheMiss;
} }
preparedNavMeshData preparedNavMeshData = prepareNavMeshTileData(
= prepareNavMeshTileData(*recastMesh, job.mChangedTile, job.mAgentBounds, mSettings.get().mRecast); *recastMesh, job.mWorldspace, job.mChangedTile, job.mAgentBounds, mSettings.get().mRecast);
if (preparedNavMeshData == nullptr) if (preparedNavMeshData == nullptr)
{ {
@ -483,8 +483,8 @@ namespace DetourNavigator
if (preparedNavMeshData == nullptr) if (preparedNavMeshData == nullptr)
{ {
preparedNavMeshData preparedNavMeshData = prepareNavMeshTileData(
= prepareNavMeshTileData(*job.mRecastMesh, job.mChangedTile, job.mAgentBounds, mSettings.get().mRecast); *job.mRecastMesh, job.mWorldspace, job.mChangedTile, job.mAgentBounds, mSettings.get().mRecast);
generatedNavMeshData = true; generatedNavMeshData = true;
} }

View File

@ -79,7 +79,8 @@ namespace DetourNavigator
return; return;
} }
const auto data = prepareNavMeshTileData(*recastMesh, mTilePosition, mAgentBounds, mSettings.mRecast); const auto data
= prepareNavMeshTileData(*recastMesh, mWorldspace, mTilePosition, mAgentBounds, mSettings.mRecast);
if (data == nullptr) if (data == nullptr)
return; return;

View File

@ -517,9 +517,10 @@ namespace DetourNavigator
namespace DetourNavigator namespace DetourNavigator
{ {
std::unique_ptr<PreparedNavMeshData> prepareNavMeshTileData(const RecastMesh& recastMesh, std::unique_ptr<PreparedNavMeshData> prepareNavMeshTileData(const RecastMesh& recastMesh,
const TilePosition& tilePosition, const AgentBounds& agentBounds, const RecastSettings& settings) std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds,
const RecastSettings& settings)
{ {
RecastContext context(tilePosition, agentBounds); RecastContext context(worldspace, tilePosition, agentBounds);
const auto [minZ, maxZ] = getBoundsByZ(recastMesh, agentBounds.mHalfExtents.z(), settings); const auto [minZ, maxZ] = getBoundsByZ(recastMesh, agentBounds.mHalfExtents.z(), settings);

View File

@ -42,7 +42,8 @@ namespace DetourNavigator
} }
std::unique_ptr<PreparedNavMeshData> prepareNavMeshTileData(const RecastMesh& recastMesh, std::unique_ptr<PreparedNavMeshData> prepareNavMeshTileData(const RecastMesh& recastMesh,
const TilePosition& tilePosition, const AgentBounds& agentBounds, const RecastSettings& settings); std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds,
const RecastSettings& settings);
NavMeshData makeNavMeshTileData(const PreparedNavMeshData& data, NavMeshData makeNavMeshTileData(const PreparedNavMeshData& data,
const std::vector<OffMeshConnection>& offMeshConnections, const AgentBounds& agentBounds, const std::vector<OffMeshConnection>& offMeshConnections, const AgentBounds& agentBounds,

View File

@ -23,17 +23,19 @@ namespace DetourNavigator
return Debug::Debug; return Debug::Debug;
} }
std::string formatPrefix(const TilePosition& tilePosition, const AgentBounds& agentBounds) std::string formatPrefix(
std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds)
{ {
std::ostringstream stream; std::ostringstream stream;
stream << "Tile position: " << tilePosition.x() << ", " << tilePosition.y() stream << "Worldspace: " << worldspace << "; tile position: " << tilePosition.x() << ", "
<< "; agent bounds: " << agentBounds << "; "; << tilePosition.y() << "; agent bounds: " << agentBounds << "; ";
return stream.str(); return stream.str();
} }
} }
RecastContext::RecastContext(const TilePosition& tilePosition, const AgentBounds& agentBounds) RecastContext::RecastContext(
: mPrefix(formatPrefix(tilePosition, agentBounds)) std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds)
: mPrefix(formatPrefix(worldspace, tilePosition, agentBounds))
{ {
} }

View File

@ -14,7 +14,8 @@ namespace DetourNavigator
class RecastContext final : public rcContext class RecastContext final : public rcContext
{ {
public: public:
explicit RecastContext(const TilePosition& tilePosition, const AgentBounds& agentBounds); explicit RecastContext(
std::string_view worldspace, const TilePosition& tilePosition, const AgentBounds& agentBounds);
const std::string& getPrefix() const { return mPrefix; } const std::string& getPrefix() const { return mPrefix; }