aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CTriangleSelector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CTriangleSelector.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CTriangleSelector.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CTriangleSelector.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CTriangleSelector.h
new file mode 100644
index 0000000..3d3b5f7
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CTriangleSelector.h
@@ -0,0 +1,92 @@
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#ifndef __C_TRIANGLE_SELECTOR_H_INCLUDED__
6#define __C_TRIANGLE_SELECTOR_H_INCLUDED__
7
8#include "ITriangleSelector.h"
9#include "IMesh.h"
10#include "irrArray.h"
11#include "aabbox3d.h"
12
13namespace irr
14{
15namespace scene
16{
17
18class ISceneNode;
19class IAnimatedMeshSceneNode;
20
21//! Stupid triangle selector without optimization
22class CTriangleSelector : public ITriangleSelector
23{
24public:
25
26 //! Constructs a selector based on a mesh
27 CTriangleSelector(ISceneNode* node);
28
29 //! Constructs a selector based on a mesh
30 CTriangleSelector(const IMesh* mesh, ISceneNode* node);
31
32 //! Constructs a selector based on an animated mesh scene node
33 //!\param node An animated mesh scene node, which must have a valid mesh
34 CTriangleSelector(IAnimatedMeshSceneNode* node);
35
36 //! Constructs a selector based on a bounding box
37 CTriangleSelector(const core::aabbox3d<f32>& box, ISceneNode* node);
38
39 //! Gets all triangles.
40 void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount,
41 const core::matrix4* transform=0) const;
42
43 //! Gets all triangles which lie within a specific bounding box.
44 void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount,
45 const core::aabbox3d<f32>& box, const core::matrix4* transform=0) const;
46
47 //! Gets all triangles which have or may have contact with a 3d line.
48 virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
49 s32& outTriangleCount, const core::line3d<f32>& line,
50 const core::matrix4* transform=0) const;
51
52 //! Returns amount of all available triangles in this selector
53 virtual s32 getTriangleCount() const;
54
55 //! Return the scene node associated with a given triangle.
56 virtual ISceneNode* getSceneNodeForTriangle(u32 triangleIndex) const { return SceneNode; }
57
58 // Get the number of TriangleSelectors that are part of this one
59 virtual u32 getSelectorCount() const;
60
61 // Get the TriangleSelector based on index based on getSelectorCount
62 virtual ITriangleSelector* getSelector(u32 index);
63
64 // Get the TriangleSelector based on index based on getSelectorCount
65 virtual const ITriangleSelector* getSelector(u32 index) const;
66
67protected:
68 //! Create from a mesh
69 virtual void createFromMesh(const IMesh* mesh);
70
71 //! Update when the mesh has changed
72 virtual void updateFromMesh(const IMesh* mesh) const;
73
74 //! Update the triangle selector, which will only have an effect if it
75 //! was built from an animated mesh and that mesh's frame has changed
76 //! since the last time it was updated.
77 virtual void update(void) const;
78
79 ISceneNode* SceneNode;
80 mutable core::array<core::triangle3df> Triangles; // (mutable for CTriangleBBSelector)
81 mutable core::aabbox3df BoundingBox; // Allows for trivial rejection
82
83 IAnimatedMeshSceneNode* AnimatedNode;
84 mutable u32 LastMeshFrame;
85};
86
87} // end namespace scene
88} // end namespace irr
89
90
91#endif
92