diff --git a/docs/html/MeshFactory_8h_source.html b/docs/html/MeshFactory_8h_source.html index 8fda2ad6..708a7842 100644 --- a/docs/html/MeshFactory_8h_source.html +++ b/docs/html/MeshFactory_8h_source.html @@ -74,10 +74,10 @@
MeshFactory.h
-Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef MESHFACTORY_H_6014714286
13 #define MESHFACTORY_H_6014714286
14 
17 #include <Carna/base/IndexBuffer.h>
18 #include <Carna/base/ManagedMesh.h>
19 #include <Carna/base/Vertex.h>
20 #include <Carna/base/math.h>
21 #include <cstdint>
22 #include <unordered_set>
23 #include <functional>
24 #include <memory>
25 #include <istream>
26 #include <ios>
27 #include <string>
28 
33 namespace Carna
34 {
35 
36 namespace base
37 {
38 
39 
40 
41 // ----------------------------------------------------------------------------------
42 // MeshFactory
43 // ----------------------------------------------------------------------------------
44 
55 template< typename VertexType >
57 {
58 
59  template< typename VectorType >
60  static VertexType vertex( const VectorType& );
61 
62 public:
63 
68  static ManagedMesh< VertexType, uint8_t >& createBox( float width, float height, float depth );
69 
73 
78 
86  inline static ManagedMesh< VertexType, uint32_t >& createFromSTL( const std::string& path );
87 
90  static ManagedMesh< VertexType, uint32_t >& createFromSTL( std::istream& stlStream );
91 
92 }; // MeshFactory
93 
94 
95 template< typename VertexType >
96 template< typename VectorType >
97 VertexType MeshFactory< VertexType >::vertex( const VectorType& v )
98 {
99  VertexType vertex;
100  vertex.x = v.x();
101  vertex.y = v.y();
102  vertex.z = v.z();
103  return vertex;
104 }
105 
106 
107 template< typename VertexType >
109 {
110  return createBox( size.x(), size.y(), size.z() );
111 }
112 
113 
114 template< typename VertexType >
116 {
117  const math::Matrix4f baseTransform = math::scaling4f( sizeX / 2, sizeY / 2, sizeZ / 2 );
118 
119  /* Define faces.
120  */
121  math::Matrix4f transforms[ 6 ];
122  transforms[ 0 ] = math::basis4f( math::Vector3f( 0, 0, +1 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( -1, 0, 0 ) ); // left
123  transforms[ 1 ] = math::basis4f( math::Vector3f( 0, 0, -1 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( +1, 0, 0 ) ); // right
124  transforms[ 2 ] = math::basis4f( math::Vector3f( +1, 0, 0 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( 0, 0, +1 ) ); // front
125  transforms[ 3 ] = math::basis4f( math::Vector3f( -1, 0, 0 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( 0, 0, -1 ) ); // back
126  transforms[ 4 ] = math::basis4f( math::Vector3f( +1, 0, 0 ), math::Vector3f( 0, 0, -1 ), math::Vector3f( 0, +1, 0 ) ); // top
127  transforms[ 5 ] = math::basis4f( math::Vector3f( +1, 0, 0 ), math::Vector3f( 0, 0, +1 ), math::Vector3f( 0, -1, 0 ) ); // bottom
128 
129  const std::size_t verticesCount = 6 * 4;
130  const std::size_t indicesCount = 6 * 2 * 3;
131 
132  typedef ManagedMesh< VertexType, uint8_t > MeshInstance;
133  typedef typename MeshInstance::Vertex Vertex;
134  typedef typename MeshInstance:: Index Index;
135  Vertex vertices[ verticesCount ];
136  Index indices[ indicesCount ];
137 
138  int lastVertex = -1;
139  int lastIndex = -1;
140 
141  /* Create vertices and indices.
142  */
143  for( unsigned int faceIndex = 0; faceIndex < 6; ++faceIndex )
144  {
145  const math::Matrix4f transform = baseTransform * transforms[ faceIndex ];
146  vertices[ ++lastVertex ] = vertex( transform * math::Vector4f( -1, -1, 1, 1 ) );
147  vertices[ ++lastVertex ] = vertex( transform * math::Vector4f( +1, -1, 1, 1 ) );
148  vertices[ ++lastVertex ] = vertex( transform * math::Vector4f( +1, +1, 1, 1 ) );
149  vertices[ ++lastVertex ] = vertex( transform * math::Vector4f( -1, +1, 1, 1 ) );
150 
151  indices[ ++lastIndex ] = lastVertex - 3;
152  indices[ ++lastIndex ] = lastVertex - 2;
153  indices[ ++lastIndex ] = lastVertex;
154 
155  indices[ ++lastIndex ] = lastVertex;
156  indices[ ++lastIndex ] = lastVertex - 2;
157  indices[ ++lastIndex ] = lastVertex - 1;
158  }
159 
160  return MeshInstance::create
162  , vertices, verticesCount
163  , indices, indicesCount );
164 }
165 
166 
167 template< typename VertexType >
169 {
170  typedef ManagedMesh< VertexType, uint8_t > MeshInstance;
171  typedef typename MeshInstance::Vertex Vertex;
172  typedef typename MeshInstance:: Index Index;
173 
174  Vertex vertex;
175  Index index = 0;
176 
177  return MeshInstance::create( IndexBufferBase::PRIMITIVE_TYPE_POINTS, &vertex, 1, &index, 1 );
178 }
179 
180 template< typename VertexType >
182 {
183  return createFromSTL( std::fstream(path, std::ios::in | std::ios::binary) );
184 }
185 
186 template< typename VertexType >
188 {
189  auto origExceptMask = stlStream.exceptions();
190  stlStream.exceptions(std::istream::failbit | std::istream::badbit | std::istream::eofbit);
191 
192  uint32_t amountTriangles;
193 
194  //discard first 80 bytes
195  stlStream.seekg(stlStream.beg + 80);
196 
197  //read amount of triangles (32bit-uint)
198  stlStream.read(reinterpret_cast<char*>(&amountTriangles), 4);
199 
200  typedef ManagedMesh< VertexType, uint32_t > MeshInstance;
201  typedef typename MeshInstance::Vertex Vertex;
202  typedef typename MeshInstance::Index Index;
203  typedef typename std::pair< Vertex, std::size_t > VertexIndexPair;
204 
205  std::size_t indicesCount = amountTriangles * 3;
206  std::unique_ptr<Index[]> indices (new Index [indicesCount]);
207  std::unique_ptr<Vertex[]> vertices(new Vertex [indicesCount]);
208 
209  std::function<std::size_t(const VertexIndexPair&)> vertexHash =
210  [](const VertexIndexPair& vertAndIndex) -> std::size_t
211  {
212  //creates combined hash value of the 3 public members "x","y","z" of a Vertex object; ignores the second member of pair
213  //This hash-combine-technique is taken from : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3876.pdf (Page 2)
214  std::size_t hashVal = std::hash<decltype(vertAndIndex.first.x)>()(vertAndIndex.first.x);
215  hashVal ^= std::hash<decltype(vertAndIndex.first.y)>()(vertAndIndex.first.y) + 0x9e3779b9 + (hashVal << 6) + (hashVal >> 2);
216  hashVal ^= std::hash<decltype(vertAndIndex.first.z)> ()(vertAndIndex.first.z) + 0x9e3779b9 + (hashVal << 6) + (hashVal >> 2);
217  return hashVal;
218  };
219 
220  std::function<std::size_t(const VertexIndexPair&, const VertexIndexPair&)> vertexComp =
221  [](const VertexIndexPair& vertAndIndex1, const VertexIndexPair& vertAndIndex2) -> bool
222  {
223  //checks whether the members "x", "y", "z" of two Vertex objects are equal
224  return ((vertAndIndex1.first.x) == (vertAndIndex2.first.x)) && ((vertAndIndex1.first.y) == (vertAndIndex2.first.y)) && ((vertAndIndex1.first.z) == (vertAndIndex2.first.z));
225  };
226 
227  std::unordered_set< VertexIndexPair, decltype(vertexHash), decltype(vertexComp) > vertsWithArrIndices(amountTriangles * 3, vertexHash, vertexComp);
228 
229  std::size_t indicesItCount = 0;
230  std::size_t verticesItCount = 0;
231 
232  //read triangles
233  for (unsigned int i = 0; i < amountTriangles; i++)
234  {
235  //discard normal
236  stlStream.seekg(12, std::ios_base::cur);
237 
238  //read vertices
239  for (unsigned int j = 0; j < 3; j++) //read 3 vertices
240  {
241  float x, y, z;
242 
243  //read 1 vertex
244  stlStream.read(reinterpret_cast<char*>(&x), 4);
245  stlStream.read(reinterpret_cast<char*>(&y), 4);
246  stlStream.read(reinterpret_cast<char*>(&z), 4);
247 
248  Vertex vert;
249  vert.x = x;
250  vert.y = y;
251  vert.z = z;
252  //vert gets invalidated here
253  auto emplRes = vertsWithArrIndices.emplace(std::piecewise_construct, std::forward_as_tuple(std::move(vert)), std::forward_as_tuple(verticesItCount));
254 
255  if (emplRes.second)
256  {
257  vertices[verticesItCount++] = (emplRes.first)->first;
258  }
259 
260  indices[indicesItCount++] = (emplRes.first)->second;
261  }
262 
263  //discard 2 bytes
264  stlStream.seekg(2, std::ios_base::cur);
265  }
266 
267  stlStream.exceptions(origExceptMask);
268 
269  return MeshInstance::create
271  , vertices.get(), verticesItCount
272  , indices.get(), indicesCount);
273 }
274 
275 
276 
277 } // namespace Carna :: base
278 
279 } // namespace Carna
280 
281 #endif // MESHFACTORY_H_6014714286
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
+Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef MESHFACTORY_H_6014714286
13 #define MESHFACTORY_H_6014714286
14 
17 #include <Carna/base/IndexBuffer.h>
18 #include <Carna/base/ManagedMesh.h>
19 #include <Carna/base/Vertex.h>
20 #include <Carna/base/math.h>
21 #include <cstdint>
22 #include <unordered_set>
23 #include <functional>
24 #include <memory>
25 #include <istream>
26 #include <ios>
27 #include <string>
28 
33 namespace Carna
34 {
35 
36 namespace base
37 {
38 
39 
40 
41 // ----------------------------------------------------------------------------------
42 // MeshFactory
43 // ----------------------------------------------------------------------------------
44 
55 template< typename VertexType >
57 {
58 
59  template< typename VectorType >
60  static VertexType vertex( const VectorType& );
61 
62 public:
63 
68  static ManagedMesh< VertexType, uint8_t >& createBox( float width, float height, float depth );
69 
73 
81  static ManagedMesh< VertexType, uint16_t >& createBall( float radius, unsigned int degree );
82 
87 
95  inline static ManagedMesh< VertexType, uint32_t >& createFromSTL( const std::string& path );
96 
99  static ManagedMesh< VertexType, uint32_t >& createFromSTL( std::istream& stlStream );
100 
101 }; // MeshFactory
102 
103 
104 template< typename VertexType >
105 template< typename VectorType >
106 VertexType MeshFactory< VertexType >::vertex( const VectorType& v )
107 {
108  VertexType vertex;
109  vertex.x = v.x();
110  vertex.y = v.y();
111  vertex.z = v.z();
112  return vertex;
113 }
114 
115 
116 template< typename VertexType >
118 {
119  return createBox( size.x(), size.y(), size.z() );
120 }
121 
122 
123 template< typename VertexType >
125 {
126  const math::Matrix4f baseTransform = math::scaling4f( sizeX / 2, sizeY / 2, sizeZ / 2 );
127 
128  /* Define faces.
129  */
130  math::Matrix4f transforms[ 6 ];
131  transforms[ 0 ] = math::basis4f( math::Vector3f( 0, 0, +1 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( -1, 0, 0 ) ); // left
132  transforms[ 1 ] = math::basis4f( math::Vector3f( 0, 0, -1 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( +1, 0, 0 ) ); // right
133  transforms[ 2 ] = math::basis4f( math::Vector3f( +1, 0, 0 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( 0, 0, +1 ) ); // front
134  transforms[ 3 ] = math::basis4f( math::Vector3f( -1, 0, 0 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( 0, 0, -1 ) ); // back
135  transforms[ 4 ] = math::basis4f( math::Vector3f( +1, 0, 0 ), math::Vector3f( 0, 0, -1 ), math::Vector3f( 0, +1, 0 ) ); // top
136  transforms[ 5 ] = math::basis4f( math::Vector3f( +1, 0, 0 ), math::Vector3f( 0, 0, +1 ), math::Vector3f( 0, -1, 0 ) ); // bottom
137 
138  const std::size_t verticesCount = 6 * 4;
139  const std::size_t indicesCount = 6 * 2 * 3;
140 
141  typedef ManagedMesh< VertexType, uint8_t > MeshInstance;
142  typedef typename MeshInstance::Vertex Vertex;
143  typedef typename MeshInstance:: Index Index;
144  Vertex vertices[ verticesCount ];
145  Index indices[ indicesCount ];
146 
147  int lastVertex = -1;
148  int lastIndex = -1;
149 
150  /* Create vertices and indices.
151  */
152  for( unsigned int faceIndex = 0; faceIndex < 6; ++faceIndex )
153  {
154  const math::Matrix4f transform = baseTransform * transforms[ faceIndex ];
155  vertices[ ++lastVertex ] = vertex( transform * math::Vector4f( -1, -1, 1, 1 ) );
156  vertices[ ++lastVertex ] = vertex( transform * math::Vector4f( +1, -1, 1, 1 ) );
157  vertices[ ++lastVertex ] = vertex( transform * math::Vector4f( +1, +1, 1, 1 ) );
158  vertices[ ++lastVertex ] = vertex( transform * math::Vector4f( -1, +1, 1, 1 ) );
159 
160  indices[ ++lastIndex ] = lastVertex - 3;
161  indices[ ++lastIndex ] = lastVertex - 2;
162  indices[ ++lastIndex ] = lastVertex;
163 
164  indices[ ++lastIndex ] = lastVertex;
165  indices[ ++lastIndex ] = lastVertex - 2;
166  indices[ ++lastIndex ] = lastVertex - 1;
167  }
168 
169  return MeshInstance::create
171  , vertices, verticesCount
172  , indices, indicesCount );
173 }
174 
175 
176 template< typename VertexType >
178 {
179  const math::Matrix4f baseTransform = math::scaling4f( radius, radius, radius );
180  const unsigned int verticesPerEdge = 2 + degree;
181  const unsigned int verticesPerSide = verticesPerEdge * verticesPerEdge;
182  const unsigned int facesPerSide = ( verticesPerEdge - 1 ) * ( verticesPerEdge - 1 );
183  const unsigned int indicesPerSide = 6 * facesPerSide;
184 
185  /* Define sides.
186  */
187  math::Matrix4f transforms[ 6 ];
188  transforms[ 0 ] = math::basis4f( math::Vector3f( 0, 0, +1 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( -1, 0, 0 ) ); // left
189  transforms[ 1 ] = math::basis4f( math::Vector3f( 0, 0, -1 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( +1, 0, 0 ) ); // right
190  transforms[ 2 ] = math::basis4f( math::Vector3f( +1, 0, 0 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( 0, 0, +1 ) ); // front
191  transforms[ 3 ] = math::basis4f( math::Vector3f( -1, 0, 0 ), math::Vector3f( 0, +1, 0 ), math::Vector3f( 0, 0, -1 ) ); // back
192  transforms[ 4 ] = math::basis4f( math::Vector3f( +1, 0, 0 ), math::Vector3f( 0, 0, -1 ), math::Vector3f( 0, +1, 0 ) ); // top
193  transforms[ 5 ] = math::basis4f( math::Vector3f( +1, 0, 0 ), math::Vector3f( 0, 0, +1 ), math::Vector3f( 0, -1, 0 ) ); // bottom
194 
195  const std::size_t verticesCount = 6 * verticesPerSide;
196  const std::size_t indicesCount = 6 * indicesPerSide;
197  CARNA_ASSERT(indicesCount < ( 1 << 16 ));
198 
199  typedef ManagedMesh< VertexType, uint16_t > MeshInstance;
200  typedef typename MeshInstance::Vertex Vertex;
201  typedef typename MeshInstance:: Index Index;
202  Vertex vertices[ verticesCount ];
203  Index indices[ indicesCount ];
204 
205  int lastVertex = -1;
206  int lastIndex = -1;
207 
208  /* Create vertices and indices.
209  */
210  for( unsigned int sideIndex = 0; sideIndex < 6; ++sideIndex )
211  {
212  const math::Matrix4f transform = baseTransform * transforms[ sideIndex ];
213 
214  for( unsigned int y = 0; y < verticesPerEdge; ++y )
215  for( unsigned int x = 0; x < verticesPerEdge; ++x )
216  {
217  const float fx = 2 * x / float( verticesPerEdge - 1 );
218  const float fy = 2 * y / float( verticesPerEdge - 1 );
219  const auto position = math::Vector3f( -1 + fx, -1 + fy, 1 ).normalized();
220  vertices[ ++lastVertex ] = vertex( transform * math::Vector4f( position.x(), position.y(), position.z(), 1 ) );
221  }
222 
223  for( unsigned int y = 0; y < verticesPerEdge - 1; ++y )
224  for( unsigned int x = 0; x < verticesPerEdge - 1; ++x )
225  {
226  const uint16_t ul = x + y * verticesPerEdge; // upper left
227  const uint16_t ur = x + 1 + y * verticesPerEdge; // upper right
228  const uint16_t ll = x + ( y + 1 ) * verticesPerEdge; // lower left
229  const uint16_t lr = x + 1 + ( y + 1 ) * verticesPerEdge; // lower right
230 
231  indices[ ++lastIndex ] = verticesPerSide * sideIndex + ul;
232  indices[ ++lastIndex ] = verticesPerSide * sideIndex + lr;
233  indices[ ++lastIndex ] = verticesPerSide * sideIndex + ll;
234 
235  indices[ ++lastIndex ] = verticesPerSide * sideIndex + ul;
236  indices[ ++lastIndex ] = verticesPerSide * sideIndex + ur;
237  indices[ ++lastIndex ] = verticesPerSide * sideIndex + lr;
238  }
239  }
240 
241  return MeshInstance::create
243  , vertices, verticesCount
244  , indices, indicesCount );
245 }
246 
247 
248 template< typename VertexType >
250 {
251  typedef ManagedMesh< VertexType, uint8_t > MeshInstance;
252  typedef typename MeshInstance::Vertex Vertex;
253  typedef typename MeshInstance:: Index Index;
254 
255  Vertex vertex;
256  Index index = 0;
257 
258  return MeshInstance::create( IndexBufferBase::PRIMITIVE_TYPE_POINTS, &vertex, 1, &index, 1 );
259 }
260 
261 template< typename VertexType >
263 {
264  return createFromSTL( std::fstream(path, std::ios::in | std::ios::binary) );
265 }
266 
267 template< typename VertexType >
269 {
270  auto origExceptMask = stlStream.exceptions();
271  stlStream.exceptions(std::istream::failbit | std::istream::badbit | std::istream::eofbit);
272 
273  uint32_t amountTriangles;
274 
275  //discard first 80 bytes
276  stlStream.seekg(stlStream.beg + 80);
277 
278  //read amount of triangles (32bit-uint)
279  stlStream.read(reinterpret_cast<char*>(&amountTriangles), 4);
280 
281  typedef ManagedMesh< VertexType, uint32_t > MeshInstance;
282  typedef typename MeshInstance::Vertex Vertex;
283  typedef typename MeshInstance::Index Index;
284  typedef typename std::pair< Vertex, std::size_t > VertexIndexPair;
285 
286  std::size_t indicesCount = amountTriangles * 3;
287  std::unique_ptr<Index[]> indices (new Index [indicesCount]);
288  std::unique_ptr<Vertex[]> vertices(new Vertex [indicesCount]);
289 
290  std::function<std::size_t(const VertexIndexPair&)> vertexHash =
291  [](const VertexIndexPair& vertAndIndex) -> std::size_t
292  {
293  //creates combined hash value of the 3 public members "x","y","z" of a Vertex object; ignores the second member of pair
294  //This hash-combine-technique is taken from : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3876.pdf (Page 2)
295  std::size_t hashVal = std::hash<decltype(vertAndIndex.first.x)>()(vertAndIndex.first.x);
296  hashVal ^= std::hash<decltype(vertAndIndex.first.y)>()(vertAndIndex.first.y) + 0x9e3779b9 + (hashVal << 6) + (hashVal >> 2);
297  hashVal ^= std::hash<decltype(vertAndIndex.first.z)> ()(vertAndIndex.first.z) + 0x9e3779b9 + (hashVal << 6) + (hashVal >> 2);
298  return hashVal;
299  };
300 
301  std::function<std::size_t(const VertexIndexPair&, const VertexIndexPair&)> vertexComp =
302  [](const VertexIndexPair& vertAndIndex1, const VertexIndexPair& vertAndIndex2) -> bool
303  {
304  //checks whether the members "x", "y", "z" of two Vertex objects are equal
305  return ((vertAndIndex1.first.x) == (vertAndIndex2.first.x)) && ((vertAndIndex1.first.y) == (vertAndIndex2.first.y)) && ((vertAndIndex1.first.z) == (vertAndIndex2.first.z));
306  };
307 
308  std::unordered_set< VertexIndexPair, decltype(vertexHash), decltype(vertexComp) > vertsWithArrIndices(amountTriangles * 3, vertexHash, vertexComp);
309 
310  std::size_t indicesItCount = 0;
311  std::size_t verticesItCount = 0;
312 
313  //read triangles
314  for (unsigned int i = 0; i < amountTriangles; i++)
315  {
316  //discard normal
317  stlStream.seekg(12, std::ios_base::cur);
318 
319  //read vertices
320  for (unsigned int j = 0; j < 3; j++) //read 3 vertices
321  {
322  float x, y, z;
323 
324  //read 1 vertex
325  stlStream.read(reinterpret_cast<char*>(&x), 4);
326  stlStream.read(reinterpret_cast<char*>(&y), 4);
327  stlStream.read(reinterpret_cast<char*>(&z), 4);
328 
329  Vertex vert;
330  vert.x = x;
331  vert.y = y;
332  vert.z = z;
333  //vert gets invalidated here
334  auto emplRes = vertsWithArrIndices.emplace(std::piecewise_construct, std::forward_as_tuple(std::move(vert)), std::forward_as_tuple(verticesItCount));
335 
336  if (emplRes.second)
337  {
338  vertices[verticesItCount++] = (emplRes.first)->first;
339  }
340 
341  indices[indicesItCount++] = (emplRes.first)->second;
342  }
343 
344  //discard 2 bytes
345  stlStream.seekg(2, std::ios_base::cur);
346  }
347 
348  stlStream.exceptions(origExceptMask);
349 
350  return MeshInstance::create
352  , vertices.get(), verticesItCount
353  , indices.get(), indicesCount);
354 }
355 
356 
357 
358 } // namespace Carna :: base
359 
360 } // namespace Carna
361 
362 #endif // MESHFACTORY_H_6014714286
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
Matrix4f scaling4f(float x, float y, float z)
Creates scaling matrix for homogeneous coordinates.
Definition: math.h:292
static const unsigned int PRIMITIVE_TYPE_POINTS
Draws points. Indicates that each index makes up a single point.
Definition: IndexBuffer.h:102
-
static ManagedMesh< VertexType, uint8_t > & createBox(float width, float height, float depth)
Creates box with width, height and depth. The box is centered in .
Definition: MeshFactory.h:115
+
static ManagedMesh< VertexType, uint8_t > & createBox(float width, float height, float depth)
Creates box with width, height and depth. The box is centered in .
Definition: MeshFactory.h:124
Eigen::Matrix< float, 4, 1 > Vector4f
Defines vector.
Definition: math.h:195
Defines Carna::base::VertexAttributes.
static const unsigned int PRIMITIVE_TYPE_TRIANGLES
Draws triangles. Indicates that the indices make up the th triangle with .
Definition: IndexBuffer.h:65
@@ -90,9 +90,11 @@
Defines Carna::base::VertexBase.
Implements MeshBase class for particular VertexType and IndexType.
Definition: ManagedMesh.h:147
-
static ManagedMesh< VertexType, uint8_t > & createPoint()
Creates mesh that consists of a single point.
Definition: MeshFactory.h:168
+
static ManagedMesh< VertexType, uint8_t > & createPoint()
Creates mesh that consists of a single point.
Definition: MeshFactory.h:249
+
#define CARNA_ASSERT(expression)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
Defines Carna::base::VertexBuffer.
-
static ManagedMesh< VertexType, uint32_t > & createFromSTL(const std::string &path)
Creates mesh from an STL file.
Definition: MeshFactory.h:181
+
static ManagedMesh< VertexType, uint16_t > & createBall(float radius, unsigned int degree)
Creates sphere with radius and a vertices number determined by degree. The ball is centered in ...
Definition: MeshFactory.h:177
+
static ManagedMesh< VertexType, uint32_t > & createFromSTL(const std::string &path)
Creates mesh from an STL file.
Definition: MeshFactory.h:262
diff --git a/docs/html/classCarna_1_1base_1_1MeshFactory-members.html b/docs/html/classCarna_1_1base_1_1MeshFactory-members.html index 8506971a..b95b02a0 100644 --- a/docs/html/classCarna_1_1base_1_1MeshFactory-members.html +++ b/docs/html/classCarna_1_1base_1_1MeshFactory-members.html @@ -77,11 +77,12 @@

This is the complete list of members for Carna::base::MeshFactory< VertexType >, including all inherited members.

- - - - - + + + + + +
createBox(float width, float height, float depth)Carna::base::MeshFactory< VertexType >static
createBox(const math::Vector3f &size)Carna::base::MeshFactory< VertexType >static
createFromSTL(const std::string &path)Carna::base::MeshFactory< VertexType >inlinestatic
createFromSTL(std::istream &stlStream)Carna::base::MeshFactory< VertexType >static
createPoint()Carna::base::MeshFactory< VertexType >static
createBall(float radius, unsigned int degree)Carna::base::MeshFactory< VertexType >static
createBox(float width, float height, float depth)Carna::base::MeshFactory< VertexType >static
createBox(const math::Vector3f &size)Carna::base::MeshFactory< VertexType >static
createFromSTL(const std::string &path)Carna::base::MeshFactory< VertexType >inlinestatic
createFromSTL(std::istream &stlStream)Carna::base::MeshFactory< VertexType >static
createPoint()Carna::base::MeshFactory< VertexType >static