mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-04 02:41:19 +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.
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_PREPAREDNAVMESHDATA_H
|
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_PREPAREDNAVMESHDATA_H
|
|
|
|
#include "recast.hpp"
|
|
|
|
#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;
|
|
PreparedNavMeshData(const PreparedNavMeshData& other);
|
|
|
|
~PreparedNavMeshData() noexcept;
|
|
|
|
friend bool operator==(const PreparedNavMeshData& lhs, const PreparedNavMeshData& rhs) noexcept;
|
|
};
|
|
|
|
inline constexpr std::size_t getSize(const rcPolyMesh& value) noexcept
|
|
{
|
|
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);
|
|
}
|
|
|
|
inline constexpr std::size_t getSize(const rcPolyMeshDetail& value) noexcept
|
|
{
|
|
return getMeshesLength(value) * sizeof(*value.meshes)
|
|
+ getVertsLength(value) * sizeof(*value.verts)
|
|
+ getTrisLength(value) * sizeof(*value.tris);
|
|
}
|
|
|
|
inline constexpr std::size_t getSize(const PreparedNavMeshData& value) noexcept
|
|
{
|
|
return getSize(value.mPolyMesh) + getSize(value.mPolyMeshDetail);
|
|
}
|
|
}
|
|
|
|
#endif
|