1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 12:54:00 +00:00
OpenMW/components/detournavigator/recastmesh.cpp

24 lines
952 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
{
2019-11-27 22:45:01 +00: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)
2019-11-27 22:45:01 +00:00
: mGeneration(generation)
, mRevision(revision)
, mIndices(std::move(indices))
2018-03-13 22:49:08 +00:00
, 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))
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
}
}