MCPcopy Create free account
hub / github.com/Kitware/VTK / PopulateCellCellMap

Method PopulateCellCellMap

Rendering/OpenGL2/vtkValuePass.cxx:375–452  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

373
374//------------------------------------------------------------------------------
375void vtkValuePass::PopulateCellCellMap(const vtkRenderState* s)
376{
377 int const count = s->GetPropArrayCount();
378 for (int i = 0; i < count; ++i)
379 {
380 vtkProp* prop = s->GetPropArray()[i];
381 vtkActor* actor = vtkActor::SafeDownCast(prop);
382 if (!actor)
383 {
384 continue;
385 }
386 vtkProperty* property = actor->GetProperty();
387 vtkMapper* mapper = actor->GetMapper();
388
389 // The mapper may be a vtkCompositePolyDataMapper, in that case, we should not return.
390 // It is hard to determine if that CPDM uses OpenGL delegates. But if execution reaches
391 // here, it is very likely that OpenGL classes are used.
392 vtkOpenGLPolyDataMapper* pdm = vtkOpenGLPolyDataMapper::SafeDownCast(mapper);
393 vtkCompositePolyDataMapper* cpdm = vtkCompositePolyDataMapper::SafeDownCast(mapper);
394 if (!pdm && !cpdm)
395 {
396 continue;
397 }
398
399 vtkMTimeType maptime = pdm->GetInputDataObject(0, 0)->GetMTime();
400 if (this->ImplFloat->CCMapTime >= maptime)
401 {
402 // reuse
403 return;
404 }
405 this->ImplFloat->CellCellMap.clear();
406 this->ImplFloat->CCMapTime = maptime;
407
408 if (cpdm)
409 {
410 vtkIdType offset = 0;
411 std::vector<vtkPolyData*> pdl = cpdm->GetRenderedList();
412 std::vector<vtkPolyData*>::iterator it;
413 for (it = pdl.begin(); it != pdl.end(); ++it)
414 {
415 vtkPolyData* poly = *it;
416 vtkCellArray* prims[4];
417 prims[0] = poly->GetVerts();
418 prims[1] = poly->GetLines();
419 prims[2] = poly->GetPolys();
420 prims[3] = poly->GetStrips();
421 int representation = property->GetRepresentation();
422 vtkPoints* points = poly->GetPoints();
423 vtkNew<vtkOpenGLCellToVTKCellMap> aCellCellMap;
424 aCellCellMap->Update(prims, representation, points);
425 for (size_t c = 0; c < aCellCellMap->GetSize(); ++c)
426 {
427 this->ImplFloat->CellCellMap.push_back(aCellCellMap->GetValue(c) + offset);
428 }
429 offset += poly->GetNumberOfCells();
430 }
431 }
432 else if (pdm)

Callers 1

RenderMethod · 0.95

Calls 15

GetPropArrayCountMethod · 0.80
GetPropArrayMethod · 0.80
GetMapperMethod · 0.80
GetInputDataObjectMethod · 0.80
GetVertsMethod · 0.80
GetPolysMethod · 0.80
GetStripsMethod · 0.80
GetRepresentationMethod · 0.80
GetPropertyMethod · 0.45
GetMTimeMethod · 0.45
clearMethod · 0.45
GetRenderedListMethod · 0.45

Tested by

no test coverage detected