mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-21 13:11:33 +00:00
Merge branch 'navigator_debug' into 'master'
Navigator debugging and logging See merge request OpenMW/openmw!3122
This commit is contained in:
commit
613003e1c7
9 changed files with 55 additions and 20 deletions
|
@ -38,9 +38,8 @@ namespace testing
|
||||||
template <>
|
template <>
|
||||||
inline testing::Message& Message::operator<<(const osg::Vec3f& value)
|
inline testing::Message& Message::operator<<(const osg::Vec3f& value)
|
||||||
{
|
{
|
||||||
return (*this) << "Vec3fEq(" << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.x()
|
return (*this) << std::setprecision(std::numeric_limits<float>::max_exponent10) << "Vec3fEq(" << value.x()
|
||||||
<< ", " << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.y() << ", "
|
<< ", " << value.y() << ", " << value.z() << ')';
|
||||||
<< std::setprecision(std::numeric_limits<float>::max_exponent10) << value.z() << ')';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,9 +114,17 @@ namespace DetourNavigator
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& stream, const WriteDtStatus& value)
|
std::ostream& operator<<(std::ostream& stream, const WriteDtStatus& value)
|
||||||
{
|
{
|
||||||
for (const auto& status : dtStatuses)
|
bool first = true;
|
||||||
if (value.mStatus & status.mStatus)
|
for (const auto& v : dtStatuses)
|
||||||
stream << status.mString;
|
{
|
||||||
|
if ((value.mStatus & v.mStatus) == 0)
|
||||||
|
continue;
|
||||||
|
if (first)
|
||||||
|
first = false;
|
||||||
|
else
|
||||||
|
stream << " | ";
|
||||||
|
stream << v.mString;
|
||||||
|
}
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +215,22 @@ namespace DetourNavigator
|
||||||
return stream << "TilesPositionsRange {" << value.mBegin << ", " << value.mEnd << "}";
|
return stream << "TilesPositionsRange {" << value.mBegin << ", " << value.mEnd << "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& stream, const AreaCosts& value)
|
||||||
|
{
|
||||||
|
return stream << "AreaCosts {"
|
||||||
|
<< ".mWater = " << value.mWater << ", .mDoor = " << value.mDoor
|
||||||
|
<< ", .mPathgrid = " << value.mPathgrid << ", .mGround = " << value.mGround << "}";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& stream, const DetourSettings& value)
|
||||||
|
{
|
||||||
|
return stream << "DetourSettings {"
|
||||||
|
<< ".mMaxPolys = " << value.mMaxPolys
|
||||||
|
<< ", .mMaxNavMeshQueryNodes = " << value.mMaxNavMeshQueryNodes
|
||||||
|
<< ", .mMaxPolygonPathSize = " << value.mMaxPolygonPathSize
|
||||||
|
<< ", .mMaxSmoothPathSize = " << value.mMaxSmoothPathSize << "}";
|
||||||
|
}
|
||||||
|
|
||||||
void writeToFile(const RecastMesh& recastMesh, const std::string& pathPrefix, const std::string& revision,
|
void writeToFile(const RecastMesh& recastMesh, const std::string& pathPrefix, const std::string& revision,
|
||||||
const RecastSettings& settings)
|
const RecastSettings& settings)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,8 @@ namespace DetourNavigator
|
||||||
{
|
{
|
||||||
struct Version;
|
struct Version;
|
||||||
struct TilesPositionsRange;
|
struct TilesPositionsRange;
|
||||||
|
struct AreaCosts;
|
||||||
|
struct DetourSettings;
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& stream, const TileBounds& value);
|
std::ostream& operator<<(std::ostream& stream, const TileBounds& value);
|
||||||
|
|
||||||
|
@ -61,6 +63,10 @@ namespace DetourNavigator
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& stream, const TilesPositionsRange& value);
|
std::ostream& operator<<(std::ostream& stream, const TilesPositionsRange& value);
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& stream, const AreaCosts& value);
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& stream, const DetourSettings& value);
|
||||||
|
|
||||||
class RecastMesh;
|
class RecastMesh;
|
||||||
struct RecastSettings;
|
struct RecastSettings;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue