mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 07:15:34 +00:00
Move std::ostream& operator<< to .cpp
This commit is contained in:
parent
cef4ce2c01
commit
1a5932a669
19 changed files with 335 additions and 293 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include <osg/Matrixf>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/misc/rng.hpp>
|
||||
#include <components/esm3/aisequence.hpp>
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
#include <iterator>
|
||||
#include <limits>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <components/detournavigator/navigatorutils.hpp>
|
||||
#include <components/detournavigator/debug.hpp>
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/misc/coordinateconverter.hpp>
|
||||
#include <components/misc/math.hpp>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <components/resource/scenemanager.hpp>
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
#include <components/detournavigator/navigator.hpp>
|
||||
#include <components/detournavigator/debug.hpp>
|
||||
#include <components/misc/convert.hpp>
|
||||
#include <components/detournavigator/heightfieldshape.hpp>
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include <MyGUI_TextIterator.h>
|
||||
|
||||
#include <LinearMath/btAabbUtil2.h>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include <components/esm3/esmreader.hpp>
|
||||
|
|
70
components/bullethelpers/debug.hpp
Normal file
70
components/bullethelpers/debug.hpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
#ifndef OPENMW_COMPONENTS_BULLETHELPERS_DEBUG_H
|
||||
#define OPENMW_COMPONENTS_BULLETHELPERS_DEBUG_H
|
||||
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <ostream>
|
||||
|
||||
#include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h>
|
||||
|
||||
#include <LinearMath/btVector3.h>
|
||||
|
||||
inline std::ostream& operator <<(std::ostream& stream, const btVector3& value)
|
||||
{
|
||||
return stream << "btVector3(" << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.x()
|
||||
<< ", " << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.y()
|
||||
<< ", " << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.z()
|
||||
<< ')';
|
||||
}
|
||||
|
||||
inline std::ostream& operator <<(std::ostream& stream, BroadphaseNativeTypes value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
#ifndef SHAPE_NAME
|
||||
#define SHAPE_NAME(name) case name: return stream << #name;
|
||||
SHAPE_NAME(BOX_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(TRIANGLE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(TETRAHEDRAL_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_HULL_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CUSTOM_POLYHEDRAL_SHAPE_TYPE)
|
||||
SHAPE_NAME(IMPLICIT_CONVEX_SHAPES_START_HERE)
|
||||
SHAPE_NAME(SPHERE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MULTI_SPHERE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CAPSULE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CYLINDER_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(UNIFORM_SCALING_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MINKOWSKI_SUM_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(BOX_2D_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_2D_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CUSTOM_CONVEX_SHAPE_TYPE)
|
||||
SHAPE_NAME(CONCAVE_SHAPES_START_HERE)
|
||||
SHAPE_NAME(TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(FAST_CONCAVE_MESH_PROXYTYPE)
|
||||
SHAPE_NAME(TERRAIN_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(GIMPACT_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE)
|
||||
SHAPE_NAME(EMPTY_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(STATIC_PLANE_PROXYTYPE)
|
||||
SHAPE_NAME(CUSTOM_CONCAVE_SHAPE_TYPE)
|
||||
SHAPE_NAME(CONCAVE_SHAPES_END_HERE)
|
||||
SHAPE_NAME(COMPOUND_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(SOFTBODY_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(HFFLUID_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(HFFLUID_BUOYANT_CONVEX_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(INVALID_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MAX_BROADPHASE_COLLISION_TYPES)
|
||||
#undef SHAPE_NAME
|
||||
#endif
|
||||
default:
|
||||
return stream << "undefined(" << static_cast<int>(value) << ")";
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,73 +1,10 @@
|
|||
#ifndef OPENMW_COMPONENTS_BULLETHELPERS_OPERATORS_H
|
||||
#define OPENMW_COMPONENTS_BULLETHELPERS_OPERATORS_H
|
||||
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <ostream>
|
||||
#include <tuple>
|
||||
|
||||
#include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h>
|
||||
|
||||
#include <LinearMath/btVector3.h>
|
||||
#include <LinearMath/btTransform.h>
|
||||
#include <LinearMath/btAabbUtil2.h>
|
||||
|
||||
inline std::ostream& operator <<(std::ostream& stream, const btVector3& value)
|
||||
{
|
||||
return stream << "btVector3(" << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.x()
|
||||
<< ", " << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.y()
|
||||
<< ", " << std::setprecision(std::numeric_limits<float>::max_exponent10) << value.z()
|
||||
<< ')';
|
||||
}
|
||||
|
||||
inline std::ostream& operator <<(std::ostream& stream, BroadphaseNativeTypes value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
#ifndef SHAPE_NAME
|
||||
#define SHAPE_NAME(name) case name: return stream << #name;
|
||||
SHAPE_NAME(BOX_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(TRIANGLE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(TETRAHEDRAL_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_HULL_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CUSTOM_POLYHEDRAL_SHAPE_TYPE)
|
||||
SHAPE_NAME(IMPLICIT_CONVEX_SHAPES_START_HERE)
|
||||
SHAPE_NAME(SPHERE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MULTI_SPHERE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CAPSULE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CYLINDER_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(UNIFORM_SCALING_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MINKOWSKI_SUM_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(BOX_2D_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CONVEX_2D_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(CUSTOM_CONVEX_SHAPE_TYPE)
|
||||
SHAPE_NAME(CONCAVE_SHAPES_START_HERE)
|
||||
SHAPE_NAME(TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(FAST_CONCAVE_MESH_PROXYTYPE)
|
||||
SHAPE_NAME(TERRAIN_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(GIMPACT_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE)
|
||||
SHAPE_NAME(EMPTY_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(STATIC_PLANE_PROXYTYPE)
|
||||
SHAPE_NAME(CUSTOM_CONCAVE_SHAPE_TYPE)
|
||||
SHAPE_NAME(CONCAVE_SHAPES_END_HERE)
|
||||
SHAPE_NAME(COMPOUND_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(SOFTBODY_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(HFFLUID_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(HFFLUID_BUOYANT_CONVEX_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(INVALID_SHAPE_PROXYTYPE)
|
||||
SHAPE_NAME(MAX_BROADPHASE_COLLISION_TYPES)
|
||||
#undef SHAPE_NAME
|
||||
#endif
|
||||
default:
|
||||
return stream << "undefined(" << static_cast<int>(value) << ")";
|
||||
}
|
||||
}
|
||||
|
||||
inline bool operator <(const btVector3& lhs, const btVector3& rhs)
|
||||
{
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
#include <Recast.h>
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
enum AreaType : unsigned char
|
||||
|
@ -23,19 +21,6 @@ namespace DetourNavigator
|
|||
float mPathgrid = 1.0f;
|
||||
float mGround = 1.0f;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& stream, AreaType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case AreaType_null: return stream << "null";
|
||||
case AreaType_water: return stream << "water";
|
||||
case AreaType_door: return stream << "door";
|
||||
case AreaType_pathgrid: return stream << "pathgrid";
|
||||
case AreaType_ground: return stream << "ground";
|
||||
}
|
||||
return stream << "unknown area type (" << static_cast<std::underlying_type_t<AreaType>>(value) << ")";
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <DetourNavMesh.h>
|
||||
|
||||
#include <osg/Stats>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
@ -112,6 +113,17 @@ namespace DetourNavigator
|
|||
}
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, JobStatus value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case JobStatus::Done: return stream << "JobStatus::Done";
|
||||
case JobStatus::Fail: return stream << "JobStatus::Fail";
|
||||
case JobStatus::MemoryCacheMiss: return stream << "JobStatus::MemoryCacheMiss";
|
||||
}
|
||||
return stream << "JobStatus::" << static_cast<std::underlying_type_t<JobState>>(value);
|
||||
}
|
||||
|
||||
Job::Job(const AgentBounds& agentBounds, std::weak_ptr<GuardedNavMeshCacheItem> navMeshCacheItem,
|
||||
std::string_view worldspace, const TilePosition& changedTile, ChangeType changeType, int distanceToPlayer,
|
||||
std::chrono::steady_clock::time_point processTime)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <tuple>
|
||||
#include <list>
|
||||
#include <optional>
|
||||
#include <iosfwd>
|
||||
|
||||
class dtNavMesh;
|
||||
|
||||
|
@ -72,16 +73,7 @@ namespace DetourNavigator
|
|||
MemoryCacheMiss,
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& stream, JobStatus value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case JobStatus::Done: return stream << "JobStatus::Done";
|
||||
case JobStatus::Fail: return stream << "JobStatus::Fail";
|
||||
case JobStatus::MemoryCacheMiss: return stream << "JobStatus::MemoryCacheMiss";
|
||||
}
|
||||
return stream << "JobStatus::" << static_cast<std::underlying_type_t<JobState>>(value);
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& stream, JobStatus value);
|
||||
|
||||
class DbJobQueue
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_CHANGETYPE_H
|
||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_CHANGETYPE_H
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
enum class ChangeType
|
||||
|
@ -12,22 +10,6 @@ namespace DetourNavigator
|
|||
add = 2,
|
||||
update = 3,
|
||||
};
|
||||
|
||||
inline std::ostream& operator <<(std::ostream& stream, ChangeType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case ChangeType::remove:
|
||||
return stream << "ChangeType::remove";
|
||||
case ChangeType::mixed:
|
||||
return stream << "ChangeType::mixed";
|
||||
case ChangeType::add:
|
||||
return stream << "ChangeType::add";
|
||||
case ChangeType::update:
|
||||
return stream << "ChangeType::update";
|
||||
}
|
||||
return stream << "ChangeType::" << static_cast<int>(value);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,13 +4,192 @@
|
|||
#include "settings.hpp"
|
||||
#include "settingsutils.hpp"
|
||||
|
||||
#include <components/bullethelpers/operators.hpp>
|
||||
|
||||
#include <DetourNavMesh.h>
|
||||
#include <DetourStatus.h>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <ostream>
|
||||
#include <array>
|
||||
#include <string_view>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
std::ostream& operator<<(std::ostream& stream, const TileBounds& value)
|
||||
{
|
||||
return stream << "TileBounds {" << value.mMin << ", " << value.mMax << "}";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, Status value)
|
||||
{
|
||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(name) \
|
||||
case Status::name: return stream << "DetourNavigator::Status::"#name;
|
||||
switch (value)
|
||||
{
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(Success)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(PartialPath)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(NavMeshNotFound)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(StartPolygonNotFound)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(EndPolygonNotFound)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(MoveAlongSurfaceFailed)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(FindPathOverPolygonsFailed)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(GetPolyHeightFailed)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(InitNavMeshQueryFailed)
|
||||
}
|
||||
#undef OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE
|
||||
return stream << "DetourNavigator::Error::" << static_cast<int>(value);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const Water& v)
|
||||
{
|
||||
return s << "Water {" << v.mCellSize << ", " << v.mLevel << "}";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const CellWater& v)
|
||||
{
|
||||
return s << "CellWater {" << v.mCellPosition << ", " << v.mWater << "}";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const FlatHeightfield& v)
|
||||
{
|
||||
return s << "FlatHeightfield {" << v.mCellPosition << ", " << v.mCellSize << ", " << v.mHeight << "}";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const Heightfield& v)
|
||||
{
|
||||
s << "Heightfield {.mCellPosition=" << v.mCellPosition
|
||||
<< ", .mCellSize=" << v.mCellSize
|
||||
<< ", .mLength=" << static_cast<int>(v.mLength)
|
||||
<< ", .mMinHeight=" << v.mMinHeight
|
||||
<< ", .mMaxHeight=" << v.mMaxHeight
|
||||
<< ", .mHeights={";
|
||||
for (float h : v.mHeights)
|
||||
s << h << ", ";
|
||||
s << "}";
|
||||
return s << ", .mOriginalSize=" << v.mOriginalSize << "}";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, CollisionShapeType v)
|
||||
{
|
||||
switch (v)
|
||||
{
|
||||
case CollisionShapeType::Aabb: return s << "AgentShapeType::Aabb";
|
||||
case CollisionShapeType::RotatingBox: return s << "AgentShapeType::RotatingBox";
|
||||
}
|
||||
return s << "AgentShapeType::" << static_cast<std::underlying_type_t<CollisionShapeType>>(v);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const AgentBounds& v)
|
||||
{
|
||||
return s << "AgentBounds {" << v.mShapeType << ", " << v.mHalfExtents << "}";
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct StatusString
|
||||
{
|
||||
dtStatus mStatus;
|
||||
std::string_view mString;
|
||||
};
|
||||
}
|
||||
|
||||
static constexpr std::array dtStatuses {
|
||||
StatusString {DT_FAILURE, "DT_FAILURE"},
|
||||
StatusString {DT_SUCCESS, "DT_SUCCESS"},
|
||||
StatusString {DT_IN_PROGRESS, "DT_IN_PROGRESS"},
|
||||
StatusString {DT_WRONG_MAGIC, "DT_WRONG_MAGIC"},
|
||||
StatusString {DT_WRONG_VERSION, "DT_WRONG_VERSION"},
|
||||
StatusString {DT_OUT_OF_MEMORY, "DT_OUT_OF_MEMORY"},
|
||||
StatusString {DT_INVALID_PARAM, "DT_INVALID_PARAM"},
|
||||
StatusString {DT_BUFFER_TOO_SMALL, "DT_BUFFER_TOO_SMALL"},
|
||||
StatusString {DT_OUT_OF_NODES, "DT_OUT_OF_NODES"},
|
||||
StatusString {DT_PARTIAL_RESULT, "DT_PARTIAL_RESULT"},
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const WriteDtStatus& value)
|
||||
{
|
||||
for (const auto& status : dtStatuses)
|
||||
if (value.mStatus & status.mStatus)
|
||||
stream << status.mString;
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const Flag value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case Flag_none:
|
||||
return stream << "none";
|
||||
case Flag_walk:
|
||||
return stream << "walk";
|
||||
case Flag_swim:
|
||||
return stream << "swim";
|
||||
case Flag_openDoor:
|
||||
return stream << "openDoor";
|
||||
case Flag_usePathgrid:
|
||||
return stream << "usePathgrid";
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const WriteFlags& value)
|
||||
{
|
||||
if (value.mValue == Flag_none)
|
||||
{
|
||||
return stream << Flag_none;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool first = true;
|
||||
for (const auto flag : {Flag_walk, Flag_swim, Flag_openDoor, Flag_usePathgrid})
|
||||
{
|
||||
if (value.mValue & flag)
|
||||
{
|
||||
if (!first)
|
||||
stream << " | ";
|
||||
first = false;
|
||||
stream << flag;
|
||||
}
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, AreaType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case AreaType_null: return stream << "null";
|
||||
case AreaType_water: return stream << "water";
|
||||
case AreaType_door: return stream << "door";
|
||||
case AreaType_pathgrid: return stream << "pathgrid";
|
||||
case AreaType_ground: return stream << "ground";
|
||||
}
|
||||
return stream << "unknown area type (" << static_cast<std::underlying_type_t<AreaType>>(value) << ")";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, ChangeType value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case ChangeType::remove:
|
||||
return stream << "ChangeType::remove";
|
||||
case ChangeType::mixed:
|
||||
return stream << "ChangeType::mixed";
|
||||
case ChangeType::add:
|
||||
return stream << "ChangeType::add";
|
||||
case ChangeType::update:
|
||||
return stream << "ChangeType::update";
|
||||
}
|
||||
return stream << "ChangeType::" << static_cast<int>(value);
|
||||
}
|
||||
|
||||
void writeToFile(const RecastMesh& recastMesh, const std::string& pathPrefix,
|
||||
const std::string& revision, const RecastSettings& settings)
|
||||
{
|
||||
|
|
|
@ -5,85 +5,54 @@
|
|||
#include "status.hpp"
|
||||
#include "recastmesh.hpp"
|
||||
#include "agentbounds.hpp"
|
||||
#include "flags.hpp"
|
||||
#include "areatype.hpp"
|
||||
#include "changetype.hpp"
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <components/bullethelpers/operators.hpp>
|
||||
#include <DetourStatus.h>
|
||||
|
||||
#include <string>
|
||||
#include <iosfwd>
|
||||
|
||||
class dtNavMesh;
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
inline std::ostream& operator <<(std::ostream& stream, const TileBounds& value)
|
||||
{
|
||||
return stream << "TileBounds {" << value.mMin << ", " << value.mMax << "}";
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& stream, const TileBounds& value);
|
||||
|
||||
inline std::ostream& operator <<(std::ostream& stream, Status value)
|
||||
{
|
||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(name) \
|
||||
case Status::name: return stream << "DetourNavigator::Status::"#name;
|
||||
switch (value)
|
||||
{
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(Success)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(PartialPath)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(NavMeshNotFound)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(StartPolygonNotFound)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(EndPolygonNotFound)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(MoveAlongSurfaceFailed)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(FindPathOverPolygonsFailed)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(GetPolyHeightFailed)
|
||||
OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE(InitNavMeshQueryFailed)
|
||||
}
|
||||
#undef OPENMW_COMPONENTS_DETOURNAVIGATOR_DEBUG_STATUS_MESSAGE
|
||||
return stream << "DetourNavigator::Error::" << static_cast<int>(value);
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& stream, Status value);
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const Water& v)
|
||||
{
|
||||
return s << "Water {" << v.mCellSize << ", " << v.mLevel << "}";
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& s, const Water& v);
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const CellWater& v)
|
||||
{
|
||||
return s << "CellWater {" << v.mCellPosition << ", " << v.mWater << "}";
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& s, const CellWater& v);
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const FlatHeightfield& v)
|
||||
{
|
||||
return s << "FlatHeightfield {" << v.mCellPosition << ", " << v.mCellSize << ", " << v.mHeight << "}";
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& s, const FlatHeightfield& v);
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const Heightfield& v)
|
||||
{
|
||||
s << "Heightfield {.mCellPosition=" << v.mCellPosition
|
||||
<< ", .mCellSize=" << v.mCellSize
|
||||
<< ", .mLength=" << static_cast<int>(v.mLength)
|
||||
<< ", .mMinHeight=" << v.mMinHeight
|
||||
<< ", .mMaxHeight=" << v.mMaxHeight
|
||||
<< ", .mHeights={";
|
||||
for (float h : v.mHeights)
|
||||
s << h << ", ";
|
||||
s << "}";
|
||||
return s << ", .mOriginalSize=" << v.mOriginalSize << "}";
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& s, const Heightfield& v);
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, CollisionShapeType v)
|
||||
{
|
||||
switch (v)
|
||||
{
|
||||
case CollisionShapeType::Aabb: return s << "AgentShapeType::Aabb";
|
||||
case CollisionShapeType::RotatingBox: return s << "AgentShapeType::RotatingBox";
|
||||
}
|
||||
return s << "AgentShapeType::" << static_cast<std::underlying_type_t<CollisionShapeType>>(v);
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& s, CollisionShapeType v);
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const AgentBounds& v)
|
||||
std::ostream& operator<<(std::ostream& s, const AgentBounds& v);
|
||||
|
||||
struct WriteDtStatus
|
||||
{
|
||||
return s << "AgentBounds {" << v.mShapeType << ", " << v.mHalfExtents << "}";
|
||||
}
|
||||
dtStatus mStatus;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const WriteDtStatus& value);
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const Flag value);
|
||||
|
||||
struct WriteFlags
|
||||
{
|
||||
Flags mValue;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const WriteFlags& value);
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, AreaType value);
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, ChangeType value);
|
||||
|
||||
class RecastMesh;
|
||||
struct RecastSettings;
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_DTSTATUS_H
|
||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_DTSTATUS_H
|
||||
|
||||
#include <DetourStatus.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
struct WriteDtStatus
|
||||
{
|
||||
dtStatus status;
|
||||
};
|
||||
|
||||
static const std::vector<std::pair<const dtStatus, const char* const>> dtStatuses {
|
||||
{DT_FAILURE, "DT_FAILURE"},
|
||||
{DT_SUCCESS, "DT_SUCCESS"},
|
||||
{DT_IN_PROGRESS, "DT_IN_PROGRESS"},
|
||||
{DT_WRONG_MAGIC, "DT_WRONG_MAGIC"},
|
||||
{DT_WRONG_VERSION, "DT_WRONG_VERSION"},
|
||||
{DT_OUT_OF_MEMORY, "DT_OUT_OF_MEMORY"},
|
||||
{DT_INVALID_PARAM, "DT_INVALID_PARAM"},
|
||||
{DT_BUFFER_TOO_SMALL, "DT_BUFFER_TOO_SMALL"},
|
||||
{DT_OUT_OF_NODES, "DT_OUT_OF_NODES"},
|
||||
{DT_PARTIAL_RESULT, "DT_PARTIAL_RESULT"},
|
||||
};
|
||||
|
||||
inline std::ostream& operator <<(std::ostream& stream, const WriteDtStatus& value)
|
||||
{
|
||||
for (const auto& status : dtStatuses)
|
||||
if (value.status & status.first)
|
||||
stream << status.second << " ";
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,12 +1,10 @@
|
|||
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_FINDSMOOTHPATH_H
|
||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_FINDSMOOTHPATH_H
|
||||
|
||||
#include "dtstatus.hpp"
|
||||
#include "exceptions.hpp"
|
||||
#include "flags.hpp"
|
||||
#include "settings.hpp"
|
||||
#include "settingsutils.hpp"
|
||||
#include "debug.hpp"
|
||||
#include "status.hpp"
|
||||
#include "areatype.hpp"
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_FLAGS_H
|
||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_FLAGS_H
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
using Flags = unsigned short;
|
||||
|
@ -15,54 +13,6 @@ namespace DetourNavigator
|
|||
Flag_openDoor = 1 << 2,
|
||||
Flag_usePathgrid = 1 << 3,
|
||||
};
|
||||
|
||||
inline std::ostream& operator <<(std::ostream& stream, const Flag value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case Flag_none:
|
||||
return stream << "none";
|
||||
case Flag_walk:
|
||||
return stream << "walk";
|
||||
case Flag_swim:
|
||||
return stream << "swim";
|
||||
case Flag_openDoor:
|
||||
return stream << "openDoor";
|
||||
case Flag_usePathgrid:
|
||||
return stream << "usePathgrid";
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
struct WriteFlags
|
||||
{
|
||||
Flags mValue;
|
||||
|
||||
friend inline std::ostream& operator <<(std::ostream& stream, const WriteFlags& value)
|
||||
{
|
||||
if (value.mValue == Flag_none)
|
||||
{
|
||||
return stream << Flag_none;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool first = true;
|
||||
for (const auto flag : {Flag_walk, Flag_swim, Flag_openDoor, Flag_usePathgrid})
|
||||
{
|
||||
if (value.mValue & flag)
|
||||
{
|
||||
if (!first)
|
||||
stream << " | ";
|
||||
first = false;
|
||||
stream << flag;
|
||||
}
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "tileposition.hpp"
|
||||
#include "navmeshtilescache.hpp"
|
||||
#include "dtstatus.hpp"
|
||||
#include "navmeshtileview.hpp"
|
||||
#include "navmeshcacheitem.hpp"
|
||||
#include "navmeshdata.hpp"
|
||||
|
@ -9,6 +8,8 @@
|
|||
|
||||
#include <DetourNavMesh.h>
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace
|
||||
{
|
||||
using DetourNavigator::TilePosition;
|
||||
|
@ -35,6 +36,32 @@ namespace
|
|||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
std::ostream& operator<<(std::ostream& stream, UpdateNavMeshStatus value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case UpdateNavMeshStatus::ignored:
|
||||
return stream << "ignore";
|
||||
case UpdateNavMeshStatus::removed:
|
||||
return stream << "removed";
|
||||
case UpdateNavMeshStatus::added:
|
||||
return stream << "add";
|
||||
case UpdateNavMeshStatus::replaced:
|
||||
return stream << "replaced";
|
||||
case UpdateNavMeshStatus::failed:
|
||||
return stream << "failed";
|
||||
case UpdateNavMeshStatus::lost:
|
||||
return stream << "lost";
|
||||
case UpdateNavMeshStatus::cached:
|
||||
return stream << "cached";
|
||||
case UpdateNavMeshStatus::unchanged:
|
||||
return stream << "unchanged";
|
||||
case UpdateNavMeshStatus::restored:
|
||||
return stream << "restored";
|
||||
}
|
||||
return stream << "unknown(" << static_cast<unsigned>(value) << ")";
|
||||
}
|
||||
|
||||
const dtMeshTile* getTile(const dtNavMesh& navMesh, const TilePosition& position)
|
||||
{
|
||||
const int layer = 0;
|
||||
|
|
|
@ -4,14 +4,13 @@
|
|||
#include "sharednavmesh.hpp"
|
||||
#include "tileposition.hpp"
|
||||
#include "navmeshtilescache.hpp"
|
||||
#include "dtstatus.hpp"
|
||||
#include "navmeshdata.hpp"
|
||||
#include "version.hpp"
|
||||
|
||||
#include <components/misc/guarded.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <ostream>
|
||||
#include <iosfwd>
|
||||
#include <set>
|
||||
|
||||
struct dtMeshTile;
|
||||
|
@ -36,31 +35,7 @@ namespace DetourNavigator
|
|||
return (static_cast<unsigned>(value) & static_cast<unsigned>(UpdateNavMeshStatus::failed)) == 0;
|
||||
}
|
||||
|
||||
inline std::ostream& operator <<(std::ostream& stream, UpdateNavMeshStatus value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case UpdateNavMeshStatus::ignored:
|
||||
return stream << "ignore";
|
||||
case UpdateNavMeshStatus::removed:
|
||||
return stream << "removed";
|
||||
case UpdateNavMeshStatus::added:
|
||||
return stream << "add";
|
||||
case UpdateNavMeshStatus::replaced:
|
||||
return stream << "replaced";
|
||||
case UpdateNavMeshStatus::failed:
|
||||
return stream << "failed";
|
||||
case UpdateNavMeshStatus::lost:
|
||||
return stream << "lost";
|
||||
case UpdateNavMeshStatus::cached:
|
||||
return stream << "cached";
|
||||
case UpdateNavMeshStatus::unchanged:
|
||||
return stream << "unchanged";
|
||||
case UpdateNavMeshStatus::restored:
|
||||
return stream << "restored";
|
||||
}
|
||||
return stream << "unknown(" << static_cast<unsigned>(value) << ")";
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& stream, UpdateNavMeshStatus value);
|
||||
|
||||
class UpdateNavMeshStatusBuilder
|
||||
{
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <components/bullethelpers/heightfield.hpp>
|
||||
#include <components/misc/convert.hpp>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <DetourNavMesh.h>
|
||||
|
||||
#include <iterator>
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
#include "detourdebugdraw.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include <components/detournavigator/debug.hpp>
|
||||
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/Group>
|
||||
#include <osg/LineWidth>
|
||||
|
||||
namespace
|
||||
{
|
||||
using DetourNavigator::operator<<;
|
||||
|
||||
osg::PrimitiveSet::Mode toOsgPrimitiveSetMode(duDebugDrawPrimitives value)
|
||||
{
|
||||
switch (value)
|
||||
|
|
Loading…
Reference in a new issue