1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 12:32:36 +00:00

28 lines
1.1 KiB
C++
Raw Normal View History

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)
2019-11-27 23:45:01 +01:00
: 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-03-14 01:49:08 +03:00
{
2018-07-18 22:09:50 +03:00
if (getTrianglesCount() != mAreaTypes.size())
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());
2021-07-03 17:39:34 +02:00
mIndices.shrink_to_fit();
mVertices.shrink_to_fit();
mAreaTypes.shrink_to_fit();
mWater.shrink_to_fit();
2018-03-14 01:49:08 +03:00
}
}