diff --git a/components/detournavigator/findsmoothpath.hpp b/components/detournavigator/findsmoothpath.hpp index 07d3054e19..2e63340578 100644 --- a/components/detournavigator/findsmoothpath.hpp +++ b/components/detournavigator/findsmoothpath.hpp @@ -18,6 +18,7 @@ #include #include +#include class dtNavMesh; diff --git a/components/detournavigator/makenavmesh.cpp b/components/detournavigator/makenavmesh.cpp index 3f133f5033..3043c36308 100644 --- a/components/detournavigator/makenavmesh.cpp +++ b/components/detournavigator/makenavmesh.cpp @@ -198,7 +198,7 @@ namespace } bool rasterizeTriangles(rcContext& context, const Rectangle& rectangle, const rcConfig& config, - const unsigned char* areas, std::size_t areasSize, rcHeightfield& solid) + AreaType areaType, rcHeightfield& solid) { const osg::Vec2f tileBoundsMin( std::clamp(rectangle.mBounds.mMin.x(), config.bmin[0], config.bmax[0]), @@ -224,13 +224,15 @@ namespace 0, 2, 3, }; + const std::array areas {areaType, areaType}; + return rcRasterizeTriangles( &context, vertices.data(), static_cast(vertices.size() / 3), indices.data(), - areas, - static_cast(areasSize), + areas.data(), + static_cast(areas.size()), solid, config.walkableClimb ); @@ -239,11 +241,10 @@ namespace bool rasterizeTriangles(rcContext& context, const osg::Vec3f& agentHalfExtents, const std::vector& cells, const Settings& settings, const rcConfig& config, rcHeightfield& solid) { - const std::array areas {{AreaType_water, AreaType_water}}; for (const Cell& cell : cells) { const Rectangle rectangle = getSwimRectangle(cell, settings, agentHalfExtents); - if (!rasterizeTriangles(context, rectangle, config, areas.data(), areas.size(), solid)) + if (!rasterizeTriangles(context, rectangle, config, AreaType_water, solid)) return false; } return true; @@ -254,9 +255,8 @@ namespace { for (const FlatHeightfield& heightfield : heightfields) { - const std::array areas {{AreaType_ground, AreaType_ground}}; const Rectangle rectangle {heightfield.mBounds, toNavMeshCoordinates(settings, heightfield.mHeight)}; - if (!rasterizeTriangles(context, rectangle, config, areas.data(), areas.size(), solid)) + if (!rasterizeTriangles(context, rectangle, config, AreaType_ground, solid)) return false; } return true; diff --git a/components/detournavigator/recastmesh.hpp b/components/detournavigator/recastmesh.hpp index c8e160603b..e2e7b9e188 100644 --- a/components/detournavigator/recastmesh.hpp +++ b/components/detournavigator/recastmesh.hpp @@ -132,11 +132,6 @@ namespace DetourNavigator std::vector mFlatHeightfields; Bounds mBounds; - friend inline bool operator <(const RecastMesh& lhs, const RecastMesh& rhs) noexcept - { - return std::tie(lhs.mMesh, lhs.mWater) < std::tie(rhs.mMesh, rhs.mWater); - } - friend inline std::size_t getSize(const RecastMesh& value) noexcept { return getSize(value.mMesh) + value.mWater.size() * sizeof(Cell) diff --git a/components/detournavigator/recastmeshbuilder.cpp b/components/detournavigator/recastmeshbuilder.cpp index 8f860d2eb1..ae3458a011 100644 --- a/components/detournavigator/recastmeshbuilder.cpp +++ b/components/detournavigator/recastmeshbuilder.cpp @@ -242,7 +242,7 @@ namespace DetourNavigator heightfield.mShift = shift + osg::Vec3f(minX, minY, 0) * stepSize - osg::Vec3f(halfCellSize, halfCellSize, 0); heightfield.mScale = stepSize; heightfield.mHeights = std::move(tileHeights); - mHeightfields.emplace_back(heightfield); + mHeightfields.push_back(std::move(heightfield)); } std::shared_ptr RecastMeshBuilder::create(std::size_t generation, std::size_t revision) &&