LVRMeshBufferBridge.cpp
Go to the documentation of this file.
1 
34 #include "LVRMeshBufferBridge.hpp"
35 
36 #include <vtkSmartPointer.h>
37 #include <vtkPolyData.h>
38 #include <vtkCellArray.h>
39 #include <vtkPolyDataMapper.h>
40 #include <vtkPoints.h>
41 #include <vtkActor.h>
42 #include <vtkTriangle.h>
43 #include <vtkProperty.h>
44 #include <vtkImageData.h>
45 #include <vtkTexture.h>
46 #include <vtkFloatArray.h>
47 #include <vtkPointData.h>
48 #include <vtkCellData.h>
49 
50 #include "lvr2/util/Util.hpp"
51 
52 namespace lvr2
53 {
54 
56  m_meshBuffer(meshBuffer)
57  {
58  if(meshBuffer)
59  {
60  computeMeshActor(meshBuffer);
61  m_numVertices = meshBuffer->numVertices();
62  m_numFaces = meshBuffer->numFaces();
63  }
64  else
65  {
66  m_numFaces = 0;
67  m_numVertices = 0;
68  }
69 
72  m_numTextures = 0;
73  }
74 
75  void LVRMeshBufferBridge::setBaseColor(float r, float g, float b)
76  {
77  vtkSmartPointer<vtkProperty> p = m_meshActor->GetProperty();
78  p->SetColor(r, g, b);
79  m_meshActor->SetProperty(p);
80 
81  p = m_wireframeActor->GetProperty();
82  float inv_r = (float)1 - r;
83  float inv_g = (float)1 - g;
84  float inv_b = (float)1 - b;
85  p->SetColor(inv_r, inv_g, inv_b);
86  m_wireframeActor->SetProperty(p);
87  }
88 
90  {
95  }
96 
98  {
99  return m_numColoredFaces;
100  }
101 
103  {
104  return m_numTexturedFaces;
105  }
107  {
108  return m_numTextures;
109  }
110 
112  {
113  return m_numFaces;
114  }
115 
117  {
118  return m_numVertices;
119  }
120 
122  {
123  return m_meshBuffer;
124  }
125 
127  {
128  // TODO Auto-generated destructor stub
129  }
130 
132  {
133  if(meshbuffer)
134  {
135  vtkSmartPointer<vtkPolyData> mesh = vtkSmartPointer<vtkPolyData>::New();
136 
137  // Parse vertex and index buffer
138  size_t n_v, n_i, n_c;
139  size_t w_color;
140  n_v = meshbuffer->numVertices();
141  floatArr vertices = meshbuffer->getVertices();
142  n_i = meshbuffer->numFaces();
143  indexArray indices = meshbuffer->getFaceIndices();
144  n_c = n_v;
145  ucharArr colors = meshbuffer->getVertexColors(w_color);
146 
147  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
148  vtkSmartPointer<vtkCellArray> triangles = vtkSmartPointer<vtkCellArray>::New();
149 
150  vtkSmartPointer<vtkUnsignedCharArray> scalars = vtkSmartPointer<vtkUnsignedCharArray>::New();
151  scalars->SetNumberOfComponents(3);
152  scalars->SetName("Colors");
153 
154  for(size_t i = 0; i < n_v; i++){
155  size_t index = 3 * i;
156  points->InsertNextPoint(
157  vertices[index ],
158  vertices[index + 1],
159  vertices[index + 2]);
160 
161  if(colors)
162  {
163  size_t color_index = w_color * i;
164  unsigned char color[3];
165  color[0] = colors[color_index ];
166  color[1] = colors[color_index + 1];
167  color[2] = colors[color_index + 2];
168 #if VTK_MAJOR_VERSION < 7
169  scalars->InsertNextTupleValue(color);
170 #else
171  scalars->InsertNextTypedTuple(color);
172 #endif
173  }
174  }
175 
176  for(size_t i = 0; i < n_i; i++)
177  {
178  size_t index = 3 * i;
179  vtkSmartPointer<vtkTriangle> t = vtkSmartPointer<vtkTriangle>::New();
180  t->GetPointIds()->SetId(0, indices[index]);
181  t->GetPointIds()->SetId(1, indices[index + 1]);
182  t->GetPointIds()->SetId(2, indices[index + 2]);
183  triangles->InsertNextCell(t);
184 
185  }
186 
187  mesh->SetPoints(points);
188  mesh->SetPolys(triangles);
189 
190  if(colors)
191  {
192  mesh->GetPointData()->SetScalars(scalars);
193  }
194 
195  vtkSmartPointer<vtkPolyDataMapper> mesh_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
196 #ifdef LVR2_USE_VTK5
197  mesh_mapper->SetInput(mesh);
198 #else
199  mesh_mapper->SetInputData(mesh);
200 #endif
201  m_meshActor = vtkSmartPointer<vtkActor>::New();
202  m_meshActor->SetMapper(mesh_mapper);
203  m_meshActor->GetProperty()->BackfaceCullingOff();
204  vtkSmartPointer<vtkPolyDataMapper> wireframe_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
205 #ifdef LVR2_USE_VTK5
206  wireframe_mapper->SetInput(mesh);
207 #else
208  wireframe_mapper->SetInputData(mesh);
209 #endif
210  m_wireframeActor = vtkSmartPointer<vtkActor>::New();
211  m_wireframeActor->ShallowCopy(m_meshActor);
212  m_wireframeActor->SetMapper(wireframe_mapper);
213  vtkSmartPointer<vtkProperty> p = vtkSmartPointer<vtkProperty>::New();
214  p->DeepCopy(m_meshActor->GetProperty());
215  p->SetRepresentationToWireframe();
216  m_wireframeActor->SetProperty(p);
217 
218  setBaseColor(0.9, 0.9, 0.9);
219  }
220  }
221 
222  void LVRMeshBufferBridge::setOpacity(float opacityValue)
223  {
224  vtkSmartPointer<vtkProperty> p = m_meshActor->GetProperty();
225  p->SetOpacity(opacityValue);
226  m_meshActor->SetProperty(p);
227  if (hasTextures())
228  {
229  vtkSmartPointer<vtkProperty> prop = getTexturedActors()->GetLastActor()->GetProperty();
230  prop->SetOpacity(opacityValue);
231  getTexturedActors()->ApplyProperties(prop);
232  }
233  }
234 
236  {
237  if(visible)
238  {
239  m_meshActor->VisibilityOn();
240  m_wireframeActor->VisibilityOn();
241 
242  if (m_texturedActors)
243  {
244  m_texturedActors->InitTraversal();
245  for(vtkIdType i = 0; i < m_texturedActors->GetNumberOfItems(); i++)
246  {
247  m_texturedActors->GetNextActor()->VisibilityOn();
248  }
249 
250  }
251  }
252  else
253  {
254  m_meshActor->VisibilityOff();
255  m_wireframeActor->VisibilityOff();
256  if (m_texturedActors)
257  {
258  m_texturedActors->InitTraversal();
259  for(vtkIdType i = 0; i < m_texturedActors->GetNumberOfItems(); i++)
260  {
261  m_texturedActors->GetNextActor()->VisibilityOff();
262  }
263 
264  }
265  }
266  }
267 
269  {
270  vtkSmartPointer<vtkProperty> p = m_meshActor->GetProperty();
271  p->SetShading(shader);
272  m_meshActor->SetProperty(p);
273  }
274 
275  vtkSmartPointer<vtkActor> LVRMeshBufferBridge::getWireframeActor()
276  {
277  return m_wireframeActor;
278  }
279 
280  vtkSmartPointer<vtkActor> LVRMeshBufferBridge::getMeshActor()
281  {
282  return m_meshActor;
283  }
284 
285  void LVRMeshBufferBridge::computeMaterialGroups(vector<MaterialGroup*>& textureMaterials, vector<MaterialGroup*>& colorMaterials)
286  {
287  map<int, MaterialGroup*> texMatMap;
288  map<VecUChar, MaterialGroup*, Util::ColorVecCompare> colorMatMap;
289 
290  // Get buffers
291  vector<Material> &materials = m_meshBuffer->getMaterials();
292  vector<Texture> &textures = m_meshBuffer->getTextures();
293  floatArr textureCoords;
294  indexArray faceMaterials;
295 
296  size_t numMaterials = materials.size();
297 
298  size_t numFaceMaterials = m_meshBuffer->numFaces();
299  faceMaterials = m_meshBuffer->getFaceMaterialIndices();
300 
301  // Iterate over face material buffer and
302  // sort faces by their material
303  for(size_t i = 0; i < m_numFaces; i++)
304  {
305  map<int, MaterialGroup*>::iterator texIt;
306  map<VecUChar, MaterialGroup*, Util::ColorVecCompare>::iterator colIt;
307 
308  // Get material by index and lookup in map. If present
309  // add face index to the corresponding group. Create a new
310  // group if none was found. For efficient rendering we have to
311  // create groups by color and texture index,
312  const Material &m = materials[faceMaterials[i]];
313 
314  if(m.m_texture)
315  {
316 
317  texIt = texMatMap.find(m.m_texture->idx());
318  if(texIt == texMatMap.end())
319  {
320  MaterialGroup* g = new MaterialGroup;
321  g->textureIndex = m.m_texture->idx();
322  g->color = Vec(1.0, 1.0, 1.0);
323  g->faceBuffer.push_back(i);
324  textureMaterials.push_back(g);
325  texMatMap[m.m_texture->idx()] = g;
326  }
327  else
328  {
329  texIt->second->faceBuffer.push_back(i);
330  }
331  }
332  else
333  {
334  colIt = colorMatMap.find(VecUChar(m.m_color->at(0),m.m_color->at(1), m.m_color->at(2)));
335  if(colIt == colorMatMap.end())
336  {
337  MaterialGroup* g = new MaterialGroup;
338  g->textureIndex = -1;
339  g->faceBuffer.push_back(i);
340  g->color = Vec(m.m_color->at(0) / 255.0f, m.m_color->at(1) / 255.0f, m.m_color->at(2) / 255.0f);
341  colorMaterials.push_back(g);
342  }
343  else
344  {
345  colIt->second->faceBuffer.push_back(i);
346  }
347  }
348  }
349  }
350 
351 
352 
354  MaterialGroup* g,
355  vector<Vec >& vertices,
356  vector<Vec >& texCoords,
357  vector<int>& indices)
358  {
359  // Mapping stuff
360  map<int, int> indexMap;
361  map<int, int>::iterator it;
362  int globalIndex = 0;
363 
364  // Get vertex buffer
365  size_t n = m_meshBuffer->numVertices();
366  size_t n_i = m_meshBuffer->numFaces();
367  size_t nc = n;
368  floatArr vertexBuffer = m_meshBuffer->getVertices();
369  indexArray faceBuffer = m_meshBuffer->getFaceIndices();
370  floatArr textures = m_meshBuffer->getTextureCoordinates();
371 
372  // Iterate through the index buffer that references global indices
373  // and create new vertex and index buffer using local indices
374  for(size_t i = 0; i < g->faceBuffer.size(); i++)
375  {
376  int a = faceBuffer[g->faceBuffer[i] * 3 ];
377  int b = faceBuffer[g->faceBuffer[i] * 3 + 1];
378  int c = faceBuffer[g->faceBuffer[i] * 3 + 2];
379 
380 
381  // Lookup a *******************************************************************************
382  it = indexMap.find(a);
383  if(it == indexMap.end())
384  {
385  indexMap[a] = globalIndex;
386  indices.push_back(globalIndex);
387  Vec v(vertexBuffer[3 * a], vertexBuffer[3 * a + 1], vertexBuffer[3 * a + 2]);
388  Vec t(textures[2 * a], textures[2 * a + 1], 0.0);
389  texCoords.push_back(t);
390  vertices.push_back(v);
391  globalIndex++;
392  }
393  else
394  {
395  indices.push_back(indexMap[a]);
396  }
397 
398  // Lookup b *******************************************************************************
399  it = indexMap.find(b);
400  if(it == indexMap.end())
401  {
402  indexMap[b] = globalIndex;
403  indices.push_back(globalIndex);
404  Vec v(vertexBuffer[3 * b], vertexBuffer[3 * b + 1], vertexBuffer[3 * b + 2]);
405  Vec t(textures[2 * b], textures[2 * b + 1], 0.0);
406  texCoords.push_back(t);
407  vertices.push_back(v);
408  globalIndex++;
409  }
410  else
411  {
412  indices.push_back(indexMap[b]);
413  }
414 
415  // Lookup c *******************************************************************************
416  it = indexMap.find(c);
417  if(it == indexMap.end())
418  {
419  indexMap[c] = globalIndex;
420  indices.push_back(globalIndex);
421  Vec v(vertexBuffer[3 * c], vertexBuffer[3 * c + 1], vertexBuffer[3 * c + 2]);
422  Vec t(textures[2 * c], textures[2 * c + 1], 0.0);
423  texCoords.push_back(t);
424  vertices.push_back(v);
425  globalIndex++;
426  }
427  else
428  {
429  indices.push_back(indexMap[c]);
430  }
431 
432  }
433  }
434 
436  vector<MaterialGroup*> groups,
437  vector<Vec >& vertices,
438  vector<VecUChar>& colors,
439  vector<int>& indices)
440  {
441  int globalIndex = 0;
442  map<int, int> indexMap;
443  map<int, int>::iterator it;
444 
445  size_t n = m_meshBuffer->numVertices();
446  size_t n_i = m_meshBuffer->numFaces();
447  floatArr vertexBuffer = m_meshBuffer->getVertices();
448  uintArr faceBuffer = m_meshBuffer->getFaceIndices();
449 
450  for(size_t a = 0; a < groups.size(); a++)
451  {
452  MaterialGroup* g = groups[a];
453 
454  for(size_t i = 0; i < g->faceBuffer.size(); i++)
455  {
456  int a = faceBuffer[g->faceBuffer[i] * 3 ];
457  int b = faceBuffer[g->faceBuffer[i] * 3 + 1];
458  int c = faceBuffer[g->faceBuffer[i] * 3 + 2];
459 
460  colors.push_back(
461  VecUChar(
462  (unsigned char) (255*g->color[0]),
463  (unsigned char) (255*g->color[1]),
464  (unsigned char) (255*g->color[2])
465  ));
466 
467  // Lookup a *******************************************************************************
468  it = indexMap.find(a);
469  if(it == indexMap.end())
470  {
471  indexMap[a] = globalIndex;
472  indices.push_back(globalIndex);
473  Vec v(vertexBuffer[3 * a], vertexBuffer[3 * a + 1], vertexBuffer[3 * a + 2]);
474  vertices.push_back(v);
475  globalIndex++;
476  }
477  else
478  {
479  indices.push_back(indexMap[a]);
480  }
481 
482  // Lookup b *******************************************************************************
483  it = indexMap.find(b);
484  if(it == indexMap.end())
485  {
486  indexMap[b] = globalIndex;
487  indices.push_back(globalIndex);
488  Vec v(vertexBuffer[3 * b], vertexBuffer[3 * b + 1], vertexBuffer[3 * b + 2]);
489  vertices.push_back(v);
490  globalIndex++;
491  }
492  else
493  {
494  indices.push_back(indexMap[b]); }
495 
496  // Lookup c *******************************************************************************
497  it = indexMap.find(c);
498  if(it == indexMap.end())
499  {
500  indexMap[c] = globalIndex;
501  indices.push_back(globalIndex);
502  Vec v(vertexBuffer[3 * c], vertexBuffer[3 * c + 1], vertexBuffer[3 * c + 2]);
503  vertices.push_back(v);
504  globalIndex++;
505  }
506  else
507  {
508  indices.push_back(indexMap[c]);
509  }
510 
511  }
512 
513  }
514  }
515 
516 
518  {
519  vtkSmartPointer<vtkPolyData> mesh = vtkSmartPointer<vtkPolyData>::New();
520  vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
521 
522  // Remap global indices for new actor
523  vector<Vec > vertices;
524  vector<Vec > texCoords;
525  vector<int> indices;
526  remapTexturedIndices(g, vertices, texCoords, indices);
527 
528  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
529  vtkSmartPointer<vtkCellArray> triangles = vtkSmartPointer<vtkCellArray>::New();
530  vtkSmartPointer<vtkFloatArray> tc = vtkSmartPointer<vtkFloatArray>::New();
531  tc->SetNumberOfComponents(3);
532  tc->SetName("TextureCoordinates");
533 
534  // Insert used vertices and texture coordinates into new arrays
535  for(size_t i = 0; i < vertices.size(); i++){
536  points->InsertNextPoint(
537  vertices[i][0],
538  vertices[i][1],
539  vertices[i][2]);
540  tc->InsertNextTuple3(texCoords[i][1], texCoords[i][0], 0.0);
541 
542  }
543 
544  // Add triangles
545  for(size_t i = 0; i < indices.size() / 3; i++)
546  {
547  size_t index = 3 * i;
548  vtkSmartPointer<vtkTriangle> t = vtkSmartPointer<vtkTriangle>::New();
549  t->GetPointIds()->SetId(0, indices[index]);
550  t->GetPointIds()->SetId(1, indices[index + 1]);
551  t->GetPointIds()->SetId(2, indices[index + 2]);
552  triangles->InsertNextCell(t);
554  }
555 
556  // Build polydata
557  mesh->SetPoints(points);
558  mesh->SetPolys(triangles);
559  mesh->GetPointData()->SetTCoords(tc);
560 
561 
562  // Generate actor
563  vtkSmartPointer<vtkPolyDataMapper> mesh_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
564 #ifdef LVR2_USE_VTK5
565  mesh_mapper->SetInput(mesh);
566 #else
567  mesh_mapper->SetInputData(mesh);
568 #endif
569  actor = vtkSmartPointer<vtkActor>::New();
570  actor->SetMapper(mesh_mapper);
571  actor->SetTexture(getTexture(g->textureIndex));
572 
573  // Set color properties
574  vtkSmartPointer<vtkProperty> property = vtkSmartPointer<vtkProperty>::New();
575  property->SetColor(g->color[0], g->color[1], g->color[2]);
576  actor->SetProperty(property);
577 
578  return actor;
579  }
580 
581  vtkSmartPointer<vtkTexture> LVRMeshBufferBridge::getTexture(int index)
582  {
583  vector<Texture> &textures = m_meshBuffer->getTextures();
584  size_t n = textures.size();
585  Texture &tex = textures[index];
586  int w = tex.m_width;
587  int h = tex.m_height;
588  unsigned char numChannels = tex.m_numChannels;
589  unsigned char numBytesPerChan = tex.m_numBytesPerChan;
590  unsigned char* texData = tex.m_data;
591 
592  vtkSmartPointer<vtkImageData> data = vtkSmartPointer<vtkImageData>::New();
593  data->SetDimensions(h, w, 1);
594 #ifdef LVR2_USE_VTK5
595  data->SetNumberOfScalarComponents(3);
596  data->SetScalarTypeToUnsignedChar();
597  data->AllocateScalars();
598 #else
599  data->AllocateScalars(VTK_UNSIGNED_CHAR, 3);
600 #endif
601  int c = 0;
602  for(int i = 0; i < h; i++)
603  {
604  for(int j = 0; j < w; j++)
605  {
606  unsigned char* pixel = static_cast<unsigned char*>(data->GetScalarPointer(i,j,0));
607  size_t index = numChannels * numBytesPerChan * c;
608  pixel[0] = texData[index ];
609  pixel[1] = texData[index + 1 * numBytesPerChan];
610  pixel[2] = texData[index + 2 * numBytesPerChan];
611  c++;
612  }
613  }
614  data->Modified();
615 
616  vtkSmartPointer<vtkTexture> texture = vtkSmartPointer<vtkTexture>::New();
617 #ifdef LVR2_USE_VTK5
618  texture->SetInput(data);
619 #else
620  texture->SetInputData(data);
621 #endif
622 
623  return texture;
624  }
625 
626 
627  vtkSmartPointer<vtkActorCollection> LVRMeshBufferBridge::getTexturedActors()
628  {
629  if (!m_texturedActors)
630  {
631  vector<MaterialGroup*> textureGroups;
632  vector<MaterialGroup*> colorGroups;
633  computeMaterialGroups(textureGroups, colorGroups);
634 
635  m_numTextures = textureGroups.size();
636 
637  m_texturedActors = vtkSmartPointer<vtkActorCollection>::New();
638  for(size_t i = 0; i < textureGroups.size(); i++)
639  {
640  //cout << i << " / " << textureGroups.size() << endl;
641  vtkSmartPointer<vtkActor> a = getTexturedActor(textureGroups[i]);
642  m_texturedActors->AddItem(a);
643  }
644 
645  vtkSmartPointer<vtkActor> a = getColorMeshActor(colorGroups);
646  m_texturedActors->AddItem(a);
647 
648  for (auto m : textureGroups)
649  {
650  delete m;
651  }
652  for (auto m : colorGroups)
653  {
654  delete m;
655  }
656 
657  }
658 
659  return m_texturedActors;
660  }
661 
662  vtkSmartPointer<vtkActor> LVRMeshBufferBridge::getColorMeshActor(vector<MaterialGroup*> groups)
663  {
664  vector<Vec> vertices;
665  vector<int> indices;
666  vector<VecUChar> colors;
667 
668  vtkSmartPointer<vtkPolyData> mesh = vtkSmartPointer<vtkPolyData>::New();
669  vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
670 
671  remapIndices(groups, vertices, colors, indices);
672 
673  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
674  vtkSmartPointer<vtkCellArray> triangles = vtkSmartPointer<vtkCellArray>::New();
675 
676  vtkSmartPointer<vtkUnsignedCharArray> scalars = vtkSmartPointer<vtkUnsignedCharArray>::New();
677  scalars->SetNumberOfComponents(3);
678  scalars->SetName("Colors");
679 
680  // Insert used vertices and texture coordinates into new arrays
681  for(size_t i = 0; i < vertices.size(); i++){
682  points->InsertNextPoint(
683  vertices[i][0],
684  vertices[i][1],
685  vertices[i][2]);
686  }
687 
688  // Add triangles
689  for(size_t i = 0; i < indices.size() / 3; i++)
690  {
691  unsigned char color[3];
692  color[0] = colors[i][0];
693  color[1] = colors[i][1];
694  color[2] = colors[i][2];
695 #if VTK_MAJOR_VERSION < 7
696  scalars->InsertNextTupleValue(color);
697 #else
698  scalars->InsertNextTypedTuple(color);
699 #endif
700 
701  size_t index = 3 * i;
702  vtkSmartPointer<vtkTriangle> t = vtkSmartPointer<vtkTriangle>::New();
703  t->GetPointIds()->SetId(0, indices[index]);
704  t->GetPointIds()->SetId(1, indices[index + 1]);
705  t->GetPointIds()->SetId(2, indices[index + 2]);
706  triangles->InsertNextCell(t);
708  }
709 
710 
711  // Build polydata
712  mesh->SetPoints(points);
713  mesh->SetPolys(triangles);
714  mesh->GetCellData()->SetScalars(scalars);
715 
716 
717  // Generate actor
718  vtkSmartPointer<vtkPolyDataMapper> mesh_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
719 #ifdef LVR2_USE_VTK5
720  mesh_mapper->SetInput(mesh);
721 #else
722  mesh_mapper->SetInputData(mesh);
723 #endif
724  actor = vtkSmartPointer<vtkActor>::New();
725  actor->SetMapper(mesh_mapper);
726 
727  return actor;
728  }
729 
731  {
732  return m_meshBuffer->getTextures().size() > 0;
733  }
734 
735 } /* namespace lvr2 */
lvr2::floatArr
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
lvr2::Texture::m_data
unsigned char * m_data
The texture data.
Definition: Texture.hpp:114
lvr2::LVRMeshBufferBridge::setOpacity
void setOpacity(float opacityValue)
Definition: LVRMeshBufferBridge.cpp:222
lvr2::LVRMeshBufferBridge::m_texturedActors
vtkSmartPointer< vtkActorCollection > m_texturedActors
Definition: LVRMeshBufferBridge.hpp:85
lvr2::LVRMeshBufferBridge::getColorMeshActor
vtkSmartPointer< vtkActor > getColorMeshActor(vector< MaterialGroup * > groups)
Definition: LVRMeshBufferBridge.cpp:662
lvr2::BaseVector< float >
lvr2::LVRMeshBufferBridge
Definition: LVRMeshBufferBridge.hpp:50
lvr2::indexArray
boost::shared_array< unsigned int > indexArray
Definition: DataStruct.hpp:128
lvr2::LVRMeshBufferBridge::getMeshBuffer
MeshBufferPtr getMeshBuffer()
Definition: LVRMeshBufferBridge.cpp:121
lvr2::LVRMeshBufferBridge::m_meshActor
vtkSmartPointer< vtkActor > m_meshActor
Definition: LVRMeshBufferBridge.hpp:83
lvr2::Texture::m_numChannels
unsigned char m_numChannels
The number of color channels.
Definition: Texture.hpp:117
lvr2::color
Definition: DataStruct.hpp:81
lvr2::LVRMeshBufferBridge::getTexture
vtkSmartPointer< vtkTexture > getTexture(int index)
Definition: LVRMeshBufferBridge.cpp:581
lvr2::MaterialGroup::textureIndex
int textureIndex
Definition: TexturedMesh.hpp:48
lvr2::LVRMeshBufferBridge::LVRMeshBufferBridge
LVRMeshBufferBridge(MeshBufferPtr meshbuffer)
Definition: LVRMeshBufferBridge.cpp:55
lvr2::LVRMeshBufferBridge::m_wireframeActor
vtkSmartPointer< vtkActor > m_wireframeActor
Definition: LVRMeshBufferBridge.hpp:84
lvr2::MaterialGroup::faceBuffer
vector< size_t > faceBuffer
Definition: TexturedMesh.hpp:51
p
SharedPointer p
Definition: ConvertShared.hpp:42
lvr2::LVRMeshBufferBridge::getNumColoredFaces
size_t getNumColoredFaces()
Definition: LVRMeshBufferBridge.cpp:97
lvr2::LVRMeshBufferBridge::getNumTextures
size_t getNumTextures()
Definition: LVRMeshBufferBridge.cpp:106
lvr2::LVRMeshBufferBridge::setShading
void setShading(int shader)
Definition: LVRMeshBufferBridge.cpp:268
lvr2::MaterialGroup
Definition: TexturedMesh.hpp:46
lvr2::LVRMeshBufferBridge::m_numTexturedFaces
size_t m_numTexturedFaces
Definition: LVRMeshBufferBridge.hpp:89
lvr2::LVRMeshBufferBridge::~LVRMeshBufferBridge
virtual ~LVRMeshBufferBridge()
Definition: LVRMeshBufferBridge.cpp:126
lvr2::LVRMeshBufferBridge::m_numFaces
size_t m_numFaces
Definition: LVRMeshBufferBridge.hpp:82
lvr2::LVRMeshBufferBridge::m_numTextures
size_t m_numTextures
Definition: LVRMeshBufferBridge.hpp:90
lvr2::LVRMeshBufferBridge::hasTextures
bool hasTextures()
Definition: LVRMeshBufferBridge.cpp:730
lvr2::LVRMeshBufferBridge::remapTexturedIndices
void remapTexturedIndices(MaterialGroup *g, vector< Vec > &vertices, vector< Vec > &texCoords, vector< int > &indices)
Definition: LVRMeshBufferBridge.cpp:353
lvr2::LVRMeshBufferBridge::computeMaterialGroups
void computeMaterialGroups(vector< MaterialGroup * > &matGroups, vector< MaterialGroup * > &colorMatGroups)
Definition: LVRMeshBufferBridge.cpp:285
lvr2::LVRMeshBufferBridge::setVisibility
void setVisibility(bool visible)
Definition: LVRMeshBufferBridge.cpp:235
lvr2::Texture::m_height
unsigned short int m_height
Definition: Texture.hpp:111
lvr2::LVRMeshBufferBridge::getTexturedActors
vtkSmartPointer< vtkActorCollection > getTexturedActors()
Definition: LVRMeshBufferBridge.cpp:627
lvr2::LVRMeshBufferBridge::getWireframeActor
vtkSmartPointer< vtkActor > getWireframeActor()
Definition: LVRMeshBufferBridge.cpp:275
lvr2::LVRMeshBufferBridge::setBaseColor
void setBaseColor(float r, float g, float b)
Definition: LVRMeshBufferBridge.cpp:75
scripts.create_png.colors
colors
Definition: create_png.py:41
lvr2::LVRMeshBufferBridge::Vec
BaseVector< float > Vec
Definition: LVRMeshBufferBridge.hpp:53
lvr2::LVRMeshBufferBridge::getTexturedActor
vtkSmartPointer< vtkActor > getTexturedActor(MaterialGroup *g)
Definition: LVRMeshBufferBridge.cpp:517
lvr2::LVRMeshBufferBridge::m_numVertices
size_t m_numVertices
Definition: LVRMeshBufferBridge.hpp:81
Util.hpp
lvr2::Material
A material that stores information about color and texture of a cluster.
Definition: Material.hpp:42
lvr2::LVRMeshBufferBridge::getMeshActor
vtkSmartPointer< vtkActor > getMeshActor()
Definition: LVRMeshBufferBridge.cpp:280
lvr2::LVRMeshBufferBridge::computeMeshActor
void computeMeshActor(MeshBufferPtr meshbuffer)
Definition: LVRMeshBufferBridge.cpp:131
lvr2::ucharArr
boost::shared_array< unsigned char > ucharArr
Definition: DataStruct.hpp:137
lvr2
Definition: BaseBufferManipulators.hpp:39
LVRMeshBufferBridge.hpp
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
lvr2::LVRMeshBufferBridge::getNumVertices
size_t getNumVertices()
Definition: LVRMeshBufferBridge.cpp:116
lvr2::LVRMeshBufferBridge::getNumTexturedFaces
size_t getNumTexturedFaces()
Definition: LVRMeshBufferBridge.cpp:102
lvr2::Texture
This class represents a texture.
Definition: Texture.hpp:54
lvr2::LVRMeshBufferBridge::VecUChar
BaseVector< unsigned char > VecUChar
Definition: LVRMeshBufferBridge.hpp:54
lvr2::Texture::m_width
unsigned short int m_width
The dimensions of the texture.
Definition: Texture.hpp:111
lvr2::LVRMeshBufferBridge::remapIndices
void remapIndices(vector< MaterialGroup * > g, vector< Vec > &vertices, vector< VecUChar > &colors, vector< int > &indices)
Definition: LVRMeshBufferBridge.cpp:435
lvr2::Material::m_texture
boost::optional< TextureHandle > m_texture
Optional texture handle.
Definition: Material.hpp:45
mesh
HalfEdgeMesh< Vec > mesh
Definition: src/tools/lvr2_gs_reconstruction/Main.cpp:26
lvr2::Material::m_color
boost::optional< Rgb8Color > m_color
Optional color.
Definition: Material.hpp:47
lvr2::MaterialGroup::color
Vec color
Definition: TexturedMesh.hpp:50
lvr2::LVRMeshBufferBridge::getNumTriangles
size_t getNumTriangles()
Definition: LVRMeshBufferBridge.cpp:111
lvr2::uintArr
boost::shared_array< unsigned int > uintArr
Definition: DataStruct.hpp:130
lvr2::LVRMeshBufferBridge::m_numColoredFaces
size_t m_numColoredFaces
Definition: LVRMeshBufferBridge.hpp:88
lvr2::LVRMeshBufferBridge::m_meshBuffer
MeshBufferPtr m_meshBuffer
Definition: LVRMeshBufferBridge.hpp:86
lvr2::Texture::m_numBytesPerChan
unsigned char m_numBytesPerChan
The number of bytes per channel.
Definition: Texture.hpp:120


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24