2018-03-14 01:49:08 +03:00
|
|
|
#include "recastmesh.hpp"
|
2018-07-12 11:44:11 +03:00
|
|
|
#include "exceptions.hpp"
|
2018-03-14 01:49:08 +03:00
|
|
|
|
2018-04-01 22:17:04 +03:00
|
|
|
#include <Recast.h>
|
|
|
|
|
2018-03-14 01:49:08 +03:00
|
|
|
namespace DetourNavigator
|
|
|
|
{
|
2019-11-27 23:45:01 +01:00
|
|
|
RecastMesh::RecastMesh(std::size_t generation, std::size_t revision, std::vector<int> indices, std::vector<float> vertices,
|
|
|
|
std::vector<AreaType> areaTypes, std::vector<Water> water, const std::size_t trianglesPerChunk)
|
|
|
|
: mGeneration(generation)
|
|
|
|
, mRevision(revision)
|
|
|
|
, mIndices(std::move(indices))
|
2018-03-14 01:49:08 +03:00
|
|
|
, mVertices(std::move(vertices))
|
2018-07-18 22:09:50 +03:00
|
|
|
, mAreaTypes(std::move(areaTypes))
|
2018-07-20 22:11:34 +03:00
|
|
|
, mWater(std::move(water))
|
2018-10-01 01:33:25 +03:00
|
|
|
, mChunkyTriMesh(mVertices, mIndices, mAreaTypes, trianglesPerChunk)
|
2018-03-14 01:49:08 +03:00
|
|
|
{
|
2018-07-18 22:09:50 +03:00
|
|
|
if (getTrianglesCount() != mAreaTypes.size())
|
2018-10-13 17:30:47 +03:00
|
|
|
throw InvalidArgument("Number of flags doesn't match number of triangles: triangles="
|
2018-07-18 22:09:50 +03:00
|
|
|
+ std::to_string(getTrianglesCount()) + ", areaTypes=" + std::to_string(mAreaTypes.size()));
|
2018-04-16 01:39:51 +03:00
|
|
|
if (getVerticesCount())
|
2018-10-13 20:59:00 +03:00
|
|
|
rcCalcBounds(mVertices.data(), static_cast<int>(getVerticesCount()), mBounds.mMin.ptr(), mBounds.mMax.ptr());
|
2018-03-14 01:49:08 +03:00
|
|
|
}
|
|
|
|
}
|