1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 03:39:14 +00:00
OpenMW/components/detournavigator/recastmesh.cpp

23 lines
956 B
C++
Raw Normal View History

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