Blender  V3.3
GeomCleaner.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
10 #include "Geom.h"
11 
12 #include "../system/FreestyleConfig.h"
13 
14 #ifdef WITH_CXX_GUARDEDALLOC
15 # include "MEM_guardedalloc.h"
16 #endif
17 
18 namespace Freestyle {
19 
20 using namespace Geometry;
21 
22 class GeomCleaner {
23  public:
24  inline GeomCleaner()
25  {
26  }
27  inline ~GeomCleaner()
28  {
29  }
30 
52  static void SortIndexedVertexArray(const float *iVertices,
53  unsigned iVSize,
54  const unsigned *iIndices,
55  unsigned iISize,
56  float **oVertices,
57  unsigned **oIndices);
58 
80  static void CompressIndexedVertexArray(const float *iVertices,
81  unsigned iVSize,
82  const unsigned *iIndices,
83  unsigned iISize,
84  float **oVertices,
85  unsigned *oVSize,
86  unsigned **oIndices);
87 
108  static void SortAndCompressIndexedVertexArray(const float *iVertices,
109  unsigned iVSize,
110  const unsigned *iIndices,
111  unsigned iISize,
112  float **oVertices,
113  unsigned *oVSize,
114  unsigned **oIndices);
115 
137  static void CleanIndexedVertexArray(const float *iVertices,
138  unsigned iVSize,
139  const unsigned *iIndices,
140  unsigned iISize,
141  float **oVertices,
142  unsigned *oVSize,
143  unsigned **oIndices);
144 
145 #ifdef WITH_CXX_GUARDEDALLOC
146  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:GeomCleaner")
147 #endif
148 };
149 
151 // inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
152 
156  private:
157  Vec3f _Vector;
158  unsigned _index;
159 
160  public:
161  inline IndexedVertex()
162  {
163  }
164 
165  inline IndexedVertex(Vec3f iVector, unsigned iIndex)
166  {
167  _Vector = iVector;
168  _index = iIndex;
169  }
170 
172  inline const Vec3f &vector() const
173  {
174  return _Vector;
175  }
176 
177  inline unsigned index()
178  {
179  return _index;
180  }
181 
182  inline float x()
183  {
184  return _Vector[0];
185  }
186 
187  inline float y()
188  {
189  return _Vector[1];
190  }
191 
192  inline float z()
193  {
194  return _Vector[2];
195  }
196 
198  inline void setVector(const Vec3f &iVector)
199  {
200  _Vector = iVector;
201  }
202 
203  inline void setIndex(unsigned iIndex)
204  {
205  _index = iIndex;
206  }
207 
210  {
211  _Vector = iv._Vector;
212  _index = iv._index;
213  return *this;
214  }
215 
216  inline float operator[](const unsigned i)
217  {
218  return _Vector[i];
219  }
220 
221  // friend inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
222  inline bool operator<(const IndexedVertex &v) const
223  {
224  return (_Vector < v._Vector);
225  }
226 
227  inline bool operator==(const IndexedVertex &v)
228  {
229  return (_Vector == v._Vector);
230  }
231 
232 #ifdef WITH_CXX_GUARDEDALLOC
233  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IndexedVertex")
234 #endif
235 };
236 
237 #if 0
238 bool operator<(const IndexedVertex &iv1, const IndexedVertex &iv2)
239 {
240  return iv1.operator<(iv2);
241 }
242 #endif
243 
244 } /* namespace Freestyle */
Vectors and Matrices (useful type definitions)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
void setIndex(unsigned iIndex)
Definition: GeomCleaner.h:203
const Vec3f & vector() const
Definition: GeomCleaner.h:172
IndexedVertex(Vec3f iVector, unsigned iIndex)
Definition: GeomCleaner.h:165
float operator[](const unsigned i)
Definition: GeomCleaner.h:216
void setVector(const Vec3f &iVector)
Definition: GeomCleaner.h:198
IndexedVertex & operator=(const IndexedVertex &iv)
Definition: GeomCleaner.h:209
bool operator<(const IndexedVertex &v) const
Definition: GeomCleaner.h:222
bool operator==(const IndexedVertex &v)
Definition: GeomCleaner.h:227
inherits from class Rep
Definition: AppCanvas.cpp:18
constexpr bool operator<(StringRef a, StringRef b)