Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials
SSharedMeshBuffer.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 __S_SHARED_MESH_BUFFER_H_INCLUDED__
6 #define __S_SHARED_MESH_BUFFER_H_INCLUDED__
7 
8 #include "irrArray.h"
9 #include "IMeshBuffer.h"
10 
11 namespace irr
12 {
13 namespace scene
14 {
17  {
20  {
21  #ifdef _DEBUG
22  setDebugName("SSharedMeshBuffer");
23  #endif
24  }
25 
28  {
29  #ifdef _DEBUG
30  setDebugName("SSharedMeshBuffer");
31  #endif
32  }
33 
35  virtual const video::SMaterial& getMaterial() const
36  {
37  return Material;
38  }
39 
42  {
43  return Material;
44  }
45 
47  virtual const void* getVertices() const
48  {
49  if (Vertices)
50  return Vertices->const_pointer();
51  else
52  return 0;
53  }
54 
56  virtual void* getVertices()
57  {
58  if (Vertices)
59  return Vertices->pointer();
60  else
61  return 0;
62  }
63 
65  virtual u32 getVertexCount() const
66  {
67  if (Vertices)
68  return Vertices->size();
69  else
70  return 0;
71  }
72 
74  virtual const u16* getIndices() const
75  {
76  return Indices.const_pointer();
77  }
78 
80  virtual u16* getIndices()
81  {
82  return Indices.pointer();
83  }
84 
86  virtual u32 getIndexCount() const
87  {
88  return Indices.size();
89  }
90 
93  {
94  return video::EIT_16BIT;
95  }
96 
98  virtual const core::aabbox3d<f32>& getBoundingBox() const
99  {
100  return BoundingBox;
101  }
102 
104  virtual void setBoundingBox( const core::aabbox3df& box)
105  {
106  BoundingBox = box;
107  }
108 
111  {
112  return video::EVT_STANDARD;
113  }
114 
116  virtual void recalculateBoundingBox()
117  {
118  if (!Vertices || Vertices->empty() || Indices.empty())
119  BoundingBox.reset(0,0,0);
120  else
121  {
122  BoundingBox.reset((*Vertices)[Indices[0]].Pos);
123  for (u32 i=1; i<Indices.size(); ++i)
125  }
126  }
127 
129  virtual const core::vector3df& getPosition(u32 i) const
130  {
132  return (*Vertices)[Indices[i]].Pos;
133  }
134 
137  {
139  return (*Vertices)[Indices[i]].Pos;
140  }
141 
143  virtual const core::vector3df& getNormal(u32 i) const
144  {
146  return (*Vertices)[Indices[i]].Normal;
147  }
148 
151  {
153  return (*Vertices)[Indices[i]].Normal;
154  }
155 
157  virtual const core::vector2df& getTCoords(u32 i) const
158  {
160  return (*Vertices)[Indices[i]].TCoords;
161  }
162 
165  {
167  return (*Vertices)[Indices[i]].TCoords;
168  }
169 
171  virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) {}
172 
174  virtual void append(const IMeshBuffer* const other) {}
175 
178  {
179  return MappingHintVertex;
180  }
181 
184  {
185  return MappingHintIndex;
186  }
187 
190  {
191  if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX)
192  MappingHintVertex=NewMappingHint;
193  if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX)
194  MappingHintIndex=NewMappingHint;
195  }
196 
199  {
200  if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX)
202  if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX)
203  ++ChangedID_Index;
204  }
205 
207 
208  virtual u32 getChangedID_Vertex() const {return ChangedID_Vertex;}
209 
211 
212  virtual u32 getChangedID_Index() const {return ChangedID_Index;}
213 
216 
219 
222 
225 
228 
231 
235  };
236 
237 
238 } // end namespace scene
239 } // end namespace irr
240 
241 #endif
242 

The Irrlicht Engine
The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Mon May 6 2013 07:46:00 by Doxygen (1.8.1.2)