#ifndef __C_TERRAIN_TRIANGLE_SELECTOR_H__
#define __C_TERRAIN_TRIANGLE_SELECTOR_H__
#include "ITriangleSelector.h"
#include "irrArray.h"
namespace irr
{
namespace scene
{
class ITerrainSceneNode;
class CTerrainTriangleSelector : public ITriangleSelector
{
public:
CTerrainTriangleSelector(ITerrainSceneNode* node, s32 LOD);
virtual ~CTerrainTriangleSelector();
virtual void setTriangleData (ITerrainSceneNode* node, s32 LOD);
void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount,
const core::matrix4* transform=0) const;
void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount,
const core::aabbox3d<f32>& box, const core::matrix4* transform=0) const;
virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::line3d<f32>& line,
const core::matrix4* transform=0) const;
virtual s32 getTriangleCount() const;
virtual ISceneNode* getSceneNodeForTriangle(u32 triangleIndex) const;
private:
friend class CTerrainSceneNode;
struct SGeoMipMapTrianglePatch
{
core::array<core::triangle3df> Triangles;
s32 NumTriangles;
core::aabbox3df Box;
};
struct SGeoMipMapTrianglePatches
{
SGeoMipMapTrianglePatches() :
NumPatches(0), TotalTriangles(0)
{
}
core::array<SGeoMipMapTrianglePatch> TrianglePatchArray;
s32 NumPatches;
u32 TotalTriangles;
};
ITerrainSceneNode* SceneNode;
SGeoMipMapTrianglePatches TrianglePatches;
};
}
}
#endif