2021-07-14 00:03:10 +02:00
|
|
|
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_PREPAREDNAVMESHDATA_H
|
|
|
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_PREPAREDNAVMESHDATA_H
|
|
|
|
|
2021-07-26 20:18:01 +02:00
|
|
|
#include "recast.hpp"
|
|
|
|
|
2021-07-14 00:03:10 +02:00
|
|
|
#include <Recast.h>
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
namespace DetourNavigator
|
|
|
|
{
|
|
|
|
struct PreparedNavMeshData
|
|
|
|
{
|
|
|
|
unsigned int mUserId = 0;
|
|
|
|
float mCellSize = 0;
|
|
|
|
float mCellHeight = 0;
|
|
|
|
rcPolyMesh mPolyMesh;
|
|
|
|
rcPolyMeshDetail mPolyMeshDetail;
|
|
|
|
|
|
|
|
PreparedNavMeshData() noexcept;
|
2021-08-06 00:05:09 +02:00
|
|
|
PreparedNavMeshData(const PreparedNavMeshData& other);
|
2021-07-14 00:03:10 +02:00
|
|
|
|
|
|
|
~PreparedNavMeshData() noexcept;
|
|
|
|
|
|
|
|
friend bool operator==(const PreparedNavMeshData& lhs, const PreparedNavMeshData& rhs) noexcept;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline constexpr std::size_t getSize(const rcPolyMesh& value) noexcept
|
|
|
|
{
|
2021-07-26 20:18:01 +02:00
|
|
|
return getVertsLength(value) * sizeof(*value.verts)
|
|
|
|
+ getPolysLength(value) * sizeof(*value.polys)
|
|
|
|
+ getRegsLength(value) * sizeof(*value.regs)
|
|
|
|
+ getFlagsLength(value) * sizeof(*value.flags)
|
|
|
|
+ getAreasLength(value) * sizeof(*value.areas);
|
2021-07-14 00:03:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr std::size_t getSize(const rcPolyMeshDetail& value) noexcept
|
|
|
|
{
|
2021-07-26 20:18:01 +02:00
|
|
|
return getMeshesLength(value) * sizeof(*value.meshes)
|
|
|
|
+ getVertsLength(value) * sizeof(*value.verts)
|
|
|
|
+ getTrisLength(value) * sizeof(*value.tris);
|
2021-07-14 00:03:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline constexpr std::size_t getSize(const PreparedNavMeshData& value) noexcept
|
|
|
|
{
|
|
|
|
return getSize(value.mPolyMesh) + getSize(value.mPolyMeshDetail);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|