mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-28 00:15:06 +00:00
96eb8d7be9
Perform all request to db in a single thread to avoid blocking navmesh generator threads due to slow write operations. Write to db navmesh for all changes except update as it done for memory cache. Batch multiple db operations into a single transaction to speed up writing by not executing fsync after each insert/update query. All reads are performed in the same transaction so they see uncommited data.
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include "preparednavmeshdata.hpp"
|
|
#include "preparednavmeshdatatuple.hpp"
|
|
#include "recast.hpp"
|
|
|
|
#include <Recast.h>
|
|
|
|
#include <cstring>
|
|
|
|
namespace
|
|
{
|
|
void initPolyMeshDetail(rcPolyMeshDetail& value) noexcept
|
|
{
|
|
value.meshes = nullptr;
|
|
value.verts = nullptr;
|
|
value.tris = nullptr;
|
|
value.nmeshes = 0;
|
|
value.nverts = 0;
|
|
value.ntris = 0;
|
|
}
|
|
}
|
|
|
|
namespace DetourNavigator
|
|
{
|
|
PreparedNavMeshData::PreparedNavMeshData() noexcept
|
|
{
|
|
initPolyMeshDetail(mPolyMeshDetail);
|
|
}
|
|
|
|
PreparedNavMeshData::PreparedNavMeshData(const PreparedNavMeshData& other)
|
|
: mUserId(other.mUserId)
|
|
, mCellSize(other.mCellSize)
|
|
, mCellHeight(other.mCellHeight)
|
|
{
|
|
copyPolyMesh(other.mPolyMesh, mPolyMesh);
|
|
copyPolyMeshDetail(other.mPolyMeshDetail, mPolyMeshDetail);
|
|
}
|
|
|
|
PreparedNavMeshData::~PreparedNavMeshData() noexcept
|
|
{
|
|
freePolyMeshDetail(mPolyMeshDetail);
|
|
}
|
|
|
|
bool operator==(const PreparedNavMeshData& lhs, const PreparedNavMeshData& rhs) noexcept
|
|
{
|
|
return makeTuple(lhs) == makeTuple(rhs);
|
|
}
|
|
}
|