mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-29 03:19:44 +00:00
beeb882ea8
To reduce cache size and make it more flexible. Adding off mesh connections to the navmesh is the last step of navmesh generation and it's very fast comparing to other steps (microseconds vs milliseconds). Having less cache size makes get and set operations almost 2x times faster that also have an order of microseconds. So in total there is no performance impact.
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_PREPAREDNAVMESHDATATUPLE_H
|
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_PREPAREDNAVMESHDATATUPLE_H
|
|
|
|
#include "preparednavmeshdata.hpp"
|
|
#include "ref.hpp"
|
|
|
|
#include <Recast.h>
|
|
|
|
#include <tuple>
|
|
|
|
namespace DetourNavigator
|
|
{
|
|
constexpr auto makeTuple(const rcPolyMesh& v) noexcept
|
|
{
|
|
return std::tuple(
|
|
Span(v.verts, 3 * v.nverts),
|
|
Span(v.polys, v.maxpolys * 2 * v.nvp),
|
|
Span(v.regs, v.maxpolys),
|
|
Span(v.flags, v.maxpolys),
|
|
Span(v.areas, v.maxpolys),
|
|
ArrayRef(v.bmin),
|
|
ArrayRef(v.bmax),
|
|
v.cs,
|
|
v.ch,
|
|
v.borderSize,
|
|
v.maxEdgeError
|
|
);
|
|
}
|
|
|
|
constexpr auto makeTuple(const rcPolyMeshDetail& v) noexcept
|
|
{
|
|
return std::tuple(
|
|
Span(v.meshes, 4 * v.nmeshes),
|
|
Span(v.verts, 3 * v.nverts),
|
|
Span(v.tris, 4 * v.ntris)
|
|
);
|
|
}
|
|
|
|
constexpr auto makeTuple(const PreparedNavMeshData& v) noexcept
|
|
{
|
|
return std::tuple(
|
|
v.mUserId,
|
|
v.mCellHeight,
|
|
v.mCellSize,
|
|
Ref(v.mPolyMesh),
|
|
Ref(v.mPolyMeshDetail)
|
|
);
|
|
}
|
|
}
|
|
|
|
#endif
|