Blender  V2.93
IndexedFaceSet.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include <memory.h>
25 #include <stdio.h>
26 
28 #include "Rep.h"
29 
30 #include "../system/FreestyleConfig.h"
31 
32 namespace Freestyle {
33 
34 class IndexedFaceSet : public Rep {
35  public:
41  };
42 
44  /* XXX Why in hell not use an enum here too? */
45  typedef unsigned char FaceEdgeMark;
46  static const FaceEdgeMark FACE_MARK = 1 << 0;
47  static const FaceEdgeMark EDGE_MARK_V1V2 = 1 << 1;
48  static const FaceEdgeMark EDGE_MARK_V2V3 = 1 << 2;
49  static const FaceEdgeMark EDGE_MARK_V3V1 = 1 << 3;
50 
53 
107  IndexedFaceSet(float *iVertices,
108  unsigned iVSize,
109  float *iNormals,
110  unsigned iNSize,
111  FrsMaterial **iMaterials,
112  unsigned iMSize,
113  float *iTexCoords,
114  unsigned iTSize,
115  unsigned iNumFaces,
116  unsigned *iNumVertexPerFace,
117  TRIANGLES_STYLE *iFaceStyle,
118  FaceEdgeMark *iFaceEdgeMarks,
119  unsigned *iVIndices,
120  unsigned iVISize,
121  unsigned *iNIndices,
122  unsigned iNISize,
123  unsigned *iMIndices,
124  unsigned iMISize,
125  unsigned *iTIndices,
126  unsigned iTISize,
127  unsigned iCopy = 1);
128 
130  IndexedFaceSet(const IndexedFaceSet &iBrother);
131 
132  void swap(IndexedFaceSet &ioOther)
133  {
134  std::swap(_Vertices, ioOther._Vertices);
135  std::swap(_Normals, ioOther._Normals);
137  std::swap(_TexCoords, ioOther._TexCoords);
139 
140  std::swap(_VSize, ioOther._VSize);
141  std::swap(_NSize, ioOther._NSize);
142  std::swap(_MSize, ioOther._MSize);
143  std::swap(_TSize, ioOther._TSize);
144 
145  std::swap(_NumFaces, ioOther._NumFaces);
147  std::swap(_FaceStyle, ioOther._FaceStyle);
148 
149  std::swap(_VIndices, ioOther._VIndices);
150  std::swap(_NIndices, ioOther._NIndices);
151  std::swap(_MIndices, ioOther._MIndices); // Material Indices
152  std::swap(_TIndices, ioOther._TIndices);
153 
154  std::swap(_VISize, ioOther._VISize);
155  std::swap(_NISize, ioOther._NISize);
156  std::swap(_MISize, ioOther._MISize);
157  std::swap(_TISize, ioOther._TISize);
158 
159  Rep::swap(ioOther);
160  }
161 
163  {
164  IndexedFaceSet tmp(iBrother);
165  swap(tmp);
166  return *this;
167  }
168 
172  virtual ~IndexedFaceSet();
173 
175  virtual void accept(SceneVisitor &v);
176 
178  virtual void ComputeBBox();
179 
181  virtual const float *vertices() const
182  {
183  return _Vertices;
184  }
185 
186  virtual const float *normals() const
187  {
188  return _Normals;
189  }
190 
191  virtual const FrsMaterial *const *frs_materials() const
192  {
193  return _FrsMaterials;
194  }
195 
196  virtual const float *texCoords() const
197  {
198  return _TexCoords;
199  }
200 
201  virtual const unsigned vsize() const
202  {
203  return _VSize;
204  }
205 
206  virtual const unsigned nsize() const
207  {
208  return _NSize;
209  }
210 
211  virtual const unsigned msize() const
212  {
213  return _MSize;
214  }
215 
216  virtual const unsigned tsize() const
217  {
218  return _TSize;
219  }
220 
221  virtual const unsigned numFaces() const
222  {
223  return _NumFaces;
224  }
225 
226  virtual const unsigned *numVertexPerFaces() const
227  {
228  return _NumVertexPerFace;
229  }
230 
231  virtual const TRIANGLES_STYLE *trianglesStyle() const
232  {
233  return _FaceStyle;
234  }
235 
236  virtual const unsigned char *faceEdgeMarks() const
237  {
238  return _FaceEdgeMarks;
239  }
240 
241  virtual const unsigned *vindices() const
242  {
243  return _VIndices;
244  }
245 
246  virtual const unsigned *nindices() const
247  {
248  return _NIndices;
249  }
250 
251  virtual const unsigned *mindices() const
252  {
253  return _MIndices;
254  }
255 
256  virtual const unsigned *tindices() const
257  {
258  return _TIndices;
259  }
260 
261  virtual const unsigned visize() const
262  {
263  return _VISize;
264  }
265 
266  virtual const unsigned nisize() const
267  {
268  return _NISize;
269  }
270 
271  virtual const unsigned misize() const
272  {
273  return _MISize;
274  }
275 
276  virtual const unsigned tisize() const
277  {
278  return _TISize;
279  }
280 
281  protected:
282  float *_Vertices;
283  float *_Normals;
285  float *_TexCoords;
286 
287  unsigned _VSize;
288  unsigned _NSize;
289  unsigned _MSize;
290  unsigned _TSize;
291 
292  unsigned _NumFaces;
293  unsigned *_NumVertexPerFace;
296 
297  unsigned *_VIndices;
298  unsigned *_NIndices;
299  unsigned *_MIndices; // Material Indices
300  unsigned *_TIndices; // Texture coordinates Indices
301 
302  unsigned _VISize;
303  unsigned _NISize;
304  unsigned _MISize;
305  unsigned _TISize;
306 
307 #ifdef WITH_CXX_GUARDEDALLOC
308  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IndexedFaceSet")
309 #endif
310 };
311 
312 } /* namespace Freestyle */
void swap(T &a, T &b)
Definition: Common.h:33
Base class for all shapes. Inherits from BasicObjects for references counter management (addRef,...
ATTR_WARN_UNUSED_RESULT const BMVert * v
virtual const unsigned nisize() const
virtual const unsigned * nindices() const
virtual const unsigned tisize() const
virtual const FrsMaterial *const * frs_materials() const
static const FaceEdgeMark EDGE_MARK_V2V3
virtual const float * normals() const
virtual const unsigned vsize() const
static const FaceEdgeMark EDGE_MARK_V1V2
virtual const float * texCoords() const
virtual const unsigned char * faceEdgeMarks() const
void swap(IndexedFaceSet &ioOther)
virtual void accept(SceneVisitor &v)
virtual const unsigned numFaces() const
virtual const unsigned * vindices() const
virtual const unsigned * mindices() const
virtual const unsigned tsize() const
FaceEdgeMark * _FaceEdgeMarks
FrsMaterial ** _FrsMaterials
virtual const unsigned * numVertexPerFaces() const
IndexedFaceSet & operator=(const IndexedFaceSet &iBrother)
virtual const unsigned nsize() const
virtual const unsigned visize() const
virtual const unsigned * tindices() const
virtual const float * vertices() const
virtual const TRIANGLES_STYLE * trianglesStyle() const
static const FaceEdgeMark FACE_MARK
virtual const unsigned misize() const
static const FaceEdgeMark EDGE_MARK_V3V1
virtual const unsigned msize() const
TRIANGLES_STYLE * _FaceStyle
void swap(Rep &ioOther)
Definition: Rep.h:66
inherits from class Rep
Definition: AppCanvas.cpp:32