mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 18:39:39 +00:00
Store recast mesh bounds
This commit is contained in:
parent
d1d034a1ec
commit
f8909218ee
3 changed files with 19 additions and 5 deletions
|
@ -252,10 +252,8 @@ namespace DetourNavigator
|
|||
getRadius(settings, agentHalfExtents),
|
||||
" changedTile=", changedTile);
|
||||
|
||||
osg::Vec3f boundsMin;
|
||||
osg::Vec3f boundsMax;
|
||||
rcCalcBounds(recastMesh.getVertices().data(), int(recastMesh.getVerticesCount()),
|
||||
boundsMin.ptr(), boundsMax.ptr());
|
||||
const auto& boundsMin = recastMesh.getBoundsMin();
|
||||
const auto& boundsMax = recastMesh.getBoundsMax();
|
||||
|
||||
const auto& params = *navMesh.lock()->getParams();
|
||||
const osg::Vec3f origin(params.orig[0], params.orig[1], params.orig[2]);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "recastmesh.hpp"
|
||||
#include "chunkytrimesh.hpp"
|
||||
#include "settings.hpp"
|
||||
|
||||
#include <Recast.h>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
RecastMesh::RecastMesh(std::vector<int> indices, std::vector<float> vertices, const Settings& settings)
|
||||
|
@ -9,5 +10,6 @@ namespace DetourNavigator
|
|||
, mVertices(std::move(vertices))
|
||||
, mChunkyTriMesh(mVertices, mIndices, settings.mTrianglesPerChunk)
|
||||
{
|
||||
rcCalcBounds(mVertices.data(), static_cast<int>(getVerticesCount()), mBoundsMin.ptr(), mBoundsMax.ptr());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <osg/Vec3f>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
struct Settings;
|
||||
|
@ -40,10 +42,22 @@ namespace DetourNavigator
|
|||
return mChunkyTriMesh;
|
||||
}
|
||||
|
||||
const osg::Vec3f& getBoundsMin() const
|
||||
{
|
||||
return mBoundsMin;
|
||||
}
|
||||
|
||||
const osg::Vec3f& getBoundsMax() const
|
||||
{
|
||||
return mBoundsMax;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<int> mIndices;
|
||||
std::vector<float> mVertices;
|
||||
ChunkyTriMesh mChunkyTriMesh;
|
||||
osg::Vec3f mBoundsMin;
|
||||
osg::Vec3f mBoundsMax;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue