1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 08:49:56 +00:00
openmw-tes3mp/components/detournavigator/recastmeshbuilder.hpp
elsid 668788a5a2
Use RecastMeshBuilder once to create RecastMesh
This allows to move all data out of the object instead of copying.
2021-08-04 09:25:19 +02:00

57 lines
1.9 KiB
C++

#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHBUILDER_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESHBUILDER_H
#include "recastmesh.hpp"
#include "tilebounds.hpp"
#include <LinearMath/btTransform.h>
class btBoxShape;
class btCollisionShape;
class btCompoundShape;
class btConcaveShape;
class btHeightfieldTerrainShape;
class btTriangleCallback;
namespace DetourNavigator
{
struct Settings;
class RecastMeshBuilder
{
public:
RecastMeshBuilder(const Settings& settings, const TileBounds& bounds);
void addObject(const btCollisionShape& shape, const btTransform& transform, const AreaType areaType);
void addObject(const btCompoundShape& shape, const btTransform& transform, const AreaType areaType);
void addObject(const btConcaveShape& shape, const btTransform& transform, const AreaType areaType);
void addObject(const btHeightfieldTerrainShape& shape, const btTransform& transform, const AreaType areaType);
void addObject(const btBoxShape& shape, const btTransform& transform, const AreaType areaType);
void addWater(const int mCellSize, const btTransform& transform);
std::shared_ptr<RecastMesh> create(std::size_t generation, std::size_t revision) &&;
private:
std::reference_wrapper<const Settings> mSettings;
TileBounds mBounds;
std::vector<int> mIndices;
std::vector<float> mVertices;
std::vector<AreaType> mAreaTypes;
std::vector<RecastMesh::Water> mWater;
void addObject(const btConcaveShape& shape, const btTransform& transform, btTriangleCallback&& callback);
void addObject(const btHeightfieldTerrainShape& shape, const btTransform& transform, btTriangleCallback&& callback);
void addTriangleVertex(const btVector3& worldPosition);
void addVertex(const btVector3& worldPosition);
};
}
#endif