diff options
Diffstat (limited to 'libraries/irrlicht-1.8.1/source/Irrlicht/CTerrainTriangleSelector.h')
-rw-r--r-- | libraries/irrlicht-1.8.1/source/Irrlicht/CTerrainTriangleSelector.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8.1/source/Irrlicht/CTerrainTriangleSelector.h b/libraries/irrlicht-1.8.1/source/Irrlicht/CTerrainTriangleSelector.h new file mode 100644 index 0000000..f452a2e --- /dev/null +++ b/libraries/irrlicht-1.8.1/source/Irrlicht/CTerrainTriangleSelector.h | |||
@@ -0,0 +1,100 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
2 | // This file is part of the "Irrlicht Engine". | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | ||
4 | |||
5 | // The code for the TerrainTriangleSelector is based on the GeoMipMapSelector | ||
6 | // developed by Spintz. He made it available for Irrlicht and allowed it to be | ||
7 | // distributed under this licence. I only modified some parts. A lot of thanks go to him. | ||
8 | |||
9 | #ifndef __C_TERRAIN_TRIANGLE_SELECTOR_H__ | ||
10 | #define __C_TERRAIN_TRIANGLE_SELECTOR_H__ | ||
11 | |||
12 | #include "ITriangleSelector.h" | ||
13 | #include "irrArray.h" | ||
14 | |||
15 | namespace irr | ||
16 | { | ||
17 | namespace scene | ||
18 | { | ||
19 | |||
20 | class ITerrainSceneNode; | ||
21 | |||
22 | //! Triangle Selector for the TerrainSceneNode | ||
23 | /** The code for the TerrainTriangleSelector is based on the GeoMipMapSelector | ||
24 | developed by Spintz. He made it available for Irrlicht and allowed it to be | ||
25 | distributed under this licence. I only modified some parts. A lot of thanks go | ||
26 | to him. | ||
27 | */ | ||
28 | class CTerrainTriangleSelector : public ITriangleSelector | ||
29 | { | ||
30 | public: | ||
31 | |||
32 | //! Constructs a selector based on an ITerrainSceneNode | ||
33 | CTerrainTriangleSelector(ITerrainSceneNode* node, s32 LOD); | ||
34 | |||
35 | //! Destructor | ||
36 | virtual ~CTerrainTriangleSelector(); | ||
37 | |||
38 | //! Clears and sets triangle data | ||
39 | virtual void setTriangleData (ITerrainSceneNode* node, s32 LOD); | ||
40 | |||
41 | //! Gets all triangles. | ||
42 | void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount, | ||
43 | const core::matrix4* transform=0) const; | ||
44 | |||
45 | //! Gets all triangles which lie within a specific bounding box. | ||
46 | void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount, | ||
47 | const core::aabbox3d<f32>& box, const core::matrix4* transform=0) const; | ||
48 | |||
49 | //! Gets all triangles which have or may have contact with a 3d line. | ||
50 | virtual void getTriangles(core::triangle3df* triangles, s32 arraySize, | ||
51 | s32& outTriangleCount, const core::line3d<f32>& line, | ||
52 | const core::matrix4* transform=0) const; | ||
53 | |||
54 | //! Returns amount of all available triangles in this selector | ||
55 | virtual s32 getTriangleCount() const; | ||
56 | |||
57 | //! Return the scene node associated with a given triangle. | ||
58 | virtual ISceneNode* getSceneNodeForTriangle(u32 triangleIndex) const; | ||
59 | |||
60 | // Get the number of TriangleSelectors that are part of this one | ||
61 | virtual u32 getSelectorCount() const; | ||
62 | |||
63 | // Get the TriangleSelector based on index based on getSelectorCount | ||
64 | virtual ITriangleSelector* getSelector(u32 index); | ||
65 | |||
66 | // Get the TriangleSelector based on index based on getSelectorCount | ||
67 | virtual const ITriangleSelector* getSelector(u32 index) const; | ||
68 | |||
69 | private: | ||
70 | |||
71 | friend class CTerrainSceneNode; | ||
72 | |||
73 | struct SGeoMipMapTrianglePatch | ||
74 | { | ||
75 | core::array<core::triangle3df> Triangles; | ||
76 | s32 NumTriangles; | ||
77 | core::aabbox3df Box; | ||
78 | }; | ||
79 | |||
80 | struct SGeoMipMapTrianglePatches | ||
81 | { | ||
82 | SGeoMipMapTrianglePatches() : | ||
83 | NumPatches(0), TotalTriangles(0) | ||
84 | { | ||
85 | } | ||
86 | |||
87 | core::array<SGeoMipMapTrianglePatch> TrianglePatchArray; | ||
88 | s32 NumPatches; | ||
89 | u32 TotalTriangles; | ||
90 | }; | ||
91 | |||
92 | ITerrainSceneNode* SceneNode; | ||
93 | SGeoMipMapTrianglePatches TrianglePatches; | ||
94 | }; | ||
95 | |||
96 | } // end namespace scene | ||
97 | } // end namespace irr | ||
98 | |||
99 | |||
100 | #endif // __C_TERRAIN_TRIANGLE_SELECTOR_H__ | ||