mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-07 12:54:00 +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.
35 lines
672 B
C++
35 lines
672 B
C++
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHDATA_H
|
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVMESHDATA_H
|
|
|
|
#include <DetourAlloc.h>
|
|
|
|
#include <memory>
|
|
|
|
namespace DetourNavigator
|
|
{
|
|
struct NavMeshDataValueDeleter
|
|
{
|
|
void operator ()(unsigned char* value) const
|
|
{
|
|
dtFree(value);
|
|
}
|
|
};
|
|
|
|
using NavMeshDataValue = std::unique_ptr<unsigned char, NavMeshDataValueDeleter>;
|
|
|
|
struct NavMeshData
|
|
{
|
|
NavMeshDataValue mValue;
|
|
int mSize;
|
|
|
|
NavMeshData() = default;
|
|
|
|
NavMeshData(unsigned char* value, int size)
|
|
: mValue(value)
|
|
, mSize(size)
|
|
{}
|
|
};
|
|
}
|
|
|
|
#endif
|