1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-27 14:40:27 +00:00
openmw/components/detournavigator/recastmesh.hpp
elsid ed73d130f9
Cache navmesh tiles
Use LRU modification to hold currently used items. Use RecastMesh binary
data for item key.

Store original pointer of btCollisionShape in user pointer to make available
it as an identifier within all duplicates. Use pointer to heights data array
for btHeightfieldTerrainShape.
2018-10-13 22:22:12 +03:00

85 lines
1.8 KiB
C++

#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESH_H
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTMESH_H
#include "areatype.hpp"
#include "chunkytrimesh.hpp"
#include <memory>
#include <string>
#include <vector>
#include <osg/Vec3f>
#include <LinearMath/btTransform.h>
namespace DetourNavigator
{
class RecastMesh
{
public:
struct Water
{
int mCellSize;
btTransform mTransform;
};
RecastMesh(std::vector<int> indices, std::vector<float> vertices, std::vector<AreaType> areaTypes,
std::vector<Water> water, const std::size_t trianglesPerChunk);
const std::vector<int>& getIndices() const
{
return mIndices;
}
const std::vector<float>& getVertices() const
{
return mVertices;
}
const std::vector<AreaType>& getAreaTypes() const
{
return mAreaTypes;
}
const std::vector<Water>& getWater() const
{
return mWater;
}
std::size_t getVerticesCount() const
{
return mVertices.size() / 3;
}
std::size_t getTrianglesCount() const
{
return mIndices.size() / 3;
}
const ChunkyTriMesh& getChunkyTriMesh() const
{
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;
std::vector<AreaType> mAreaTypes;
std::vector<Water> mWater;
ChunkyTriMesh mChunkyTriMesh;
osg::Vec3f mBoundsMin;
osg::Vec3f mBoundsMax;
};
}
#endif