arsa  2.7
ITriangleSelector.h
Go to the documentation of this file.
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 __I_TRIANGLE_SELECTOR_H_INCLUDED__
6 #define __I_TRIANGLE_SELECTOR_H_INCLUDED__
7 
8 #include "IReferenceCounted.h"
9 #include "triangle3d.h"
10 #include "aabbox3d.h"
11 #include "matrix4.h"
12 #include "line3d.h"
13 #include "irrArray.h"
14 
15 namespace irr
16 {
17 namespace scene
18 {
19 
20 class ISceneNode;
21 class ITriangleSelector;
22 class IMeshBuffer;
23 
25 
29 {
31  : RangeStart(0), RangeSize(0)
32  , Selector(0), SceneNode(0)
33  , MeshBuffer(0), MaterialIndex(0)
34  {}
35 
37 
40  bool isIndexInRange(irr::u32 triangleIndex) const
41  {
42  return triangleIndex >= RangeStart && triangleIndex < RangeStart+RangeSize;
43  }
44 
47 
50 
53 
56 
60 
63 };
64 
66 
72 class ITriangleSelector : public virtual IReferenceCounted
73 {
74 public:
75 
77  virtual s32 getTriangleCount() const = 0;
78 
80 
100  virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
101  s32& outTriangleCount, const core::matrix4* transform=0,
102  bool useNodeTransform=true,
103  irr::core::array<SCollisionTriangleRange>* outTriangleInfo=0) const = 0;
104 
106 
130  virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
131  s32& outTriangleCount, const core::aabbox3d<f32>& box,
132  const core::matrix4* transform=0, bool useNodeTransform=true,
133  irr::core::array<SCollisionTriangleRange>* outTriangleInfo=0) const = 0;
134 
136 
160  virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
161  s32& outTriangleCount, const core::line3d<f32>& line,
162  const core::matrix4* transform=0, bool useNodeTransform=true,
163  irr::core::array<SCollisionTriangleRange>* outTriangleInfo=0) const = 0;
164 
166 
168  virtual u32 getSelectorCount() const = 0;
169 
171 
173  virtual ITriangleSelector* getSelector(u32 index) = 0;
174 
176 
178  virtual const ITriangleSelector* getSelector(u32 index) const = 0;
179 
181 
189  virtual ISceneNode* getSceneNodeForTriangle(u32 triangleIndex) const = 0;
190 };
191 
192 } // end namespace scene
193 } // end namespace irr
194 
195 #endif
Interface to return triangles with specific properties.
Additional information about the triangle arrays returned by ITriangleSelector::getTriangles.
Scene node interface.
Definition: ISceneNode.h:40
3d triangle template class for doing collision detection and other things.
Definition: triangle3d.h:20
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
virtual u32 getSelectorCount() const =0
Get number of TriangleSelectors that are part of this one.
3D line between two points with intersection methods.
Definition: line3d.h:18
irr::u32 RangeStart
First index in the returned triangle array for which this struct is valid.
ITriangleSelector * Selector
Real selector which contained those triangles (useful when working with MetaTriangleSelector)
virtual void getTriangles(core::triangle3df *triangles, s32 arraySize, s32 &outTriangleCount, const core::matrix4 *transform=0, bool useNodeTransform=true, irr::core::array< SCollisionTriangleRange > *outTriangleInfo=0) const =0
Gets the triangles for one associated node.
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
Struct for holding a mesh with a single material.
Definition: IMeshBuffer.h:39
virtual ITriangleSelector * getSelector(u32 index)=0
Get TriangleSelector based on index based on getSelectorCount.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
virtual ISceneNode * getSceneNodeForTriangle(u32 triangleIndex) const =0
Get scene node associated with a given triangle.
GLuint index
irr::u32 MaterialIndex
Index of selected material in the SceneNode. Usually only valid when MeshBuffer is also set,...
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Definition: matrix4.h:45
Self reallocating template array (like stl vector) with additional features.
Definition: irrArray.h:22
irr::u32 RangeSize
Number of elements in the returned triangle array for which this struct is valid (starting with Range...
GLuint GLenum GLenum transform
Base class of most objects of the Irrlicht Engine.
virtual s32 getTriangleCount() const =0
Get amount of all available triangles in this selector.
bool isIndexInRange(irr::u32 triangleIndex) const
Check if this triangle index inside the range.
ISceneNode * SceneNode
SceneNode from which the triangles are from.