1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00
OpenMW/components/detournavigator/dbrefgeometryobject.hpp
elsid 953a4c5550
Add a binary to generate navmesh from content files
Load content files based on the engine config files. Generate navmesh per cell
for all cells and store into SQLite database.
2021-12-11 00:21:56 +01:00

47 lines
1.3 KiB
C++

#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_DBREFGEOMETRYOBJECT_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_DBREFGEOMETRYOBJECT_H
#include "objecttransform.hpp"
#include "recastmesh.hpp"
#include <algorithm>
#include <cstdint>
#include <tuple>
#include <vector>
namespace DetourNavigator
{
struct DbRefGeometryObject
{
std::int64_t mShapeId;
ObjectTransform mObjectTransform;
friend inline auto tie(const DbRefGeometryObject& v)
{
return std::tie(v.mShapeId, v.mObjectTransform);
}
friend inline bool operator<(const DbRefGeometryObject& l, const DbRefGeometryObject& r)
{
return tie(l) < tie(r);
}
};
template <class ResolveMeshSource>
inline std::vector<DbRefGeometryObject> makeDbRefGeometryObjects(const std::vector<MeshSource>& meshSources,
ResolveMeshSource&& resolveMeshSource)
{
std::vector<DbRefGeometryObject> result;
result.reserve(meshSources.size());
std::transform(meshSources.begin(), meshSources.end(), std::back_inserter(result),
[&] (const MeshSource& meshSource)
{
return DbRefGeometryObject {resolveMeshSource(meshSource), meshSource.mObjectTransform};
});
std::sort(result.begin(), result.end());
return result;
}
}
#endif