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

Method GetColorsFromPolyData

Web/WebGLExporter/vtkWebGLPolyData.cxx:518–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516}
517
518void vtkWebGLPolyData::GetColorsFromPolyData(
519 unsigned char* color, vtkPolyData* polydata, vtkActor* actor)
520{
521 int celldata;
522 vtkDataArray* array = vtkAbstractMapper::GetScalars(polydata, actor->GetMapper()->GetScalarMode(),
523 actor->GetMapper()->GetArrayAccessMode(), actor->GetMapper()->GetArrayId(),
524 actor->GetMapper()->GetArrayName(), celldata);
525 if (actor->GetMapper()->GetScalarVisibility() && array != nullptr)
526 {
527 vtkScalarsToColors* table = actor->GetMapper()->GetLookupTable();
528
529 vtkUnsignedCharArray* cor =
530 table->MapScalars(array, table->GetVectorMode(), table->GetVectorComponent());
531 memcpy(color, cor->GetPointer(0), polydata->GetNumberOfPoints() * 4);
532 cor->Delete();
533 }
534 else
535 {
536 for (int i = 0; i < polydata->GetNumberOfPoints(); i++)
537 {
538 color[i * 4 + 0] = (unsigned char)255;
539 color[i * 4 + 1] = (unsigned char)255;
540 color[i * 4 + 2] = (unsigned char)255;
541 color[i * 4 + 3] = (unsigned char)255;
542 }
543 }
544}
545
546void vtkWebGLPolyData::GetPolygonsFromPointData(
547 vtkTriangleFilter* polydata, vtkActor* actor, int maxSize)

Callers 2

GetLinesMethod · 0.95
GetPointsMethod · 0.95

Calls 10

GetMapperMethod · 0.80
GetArrayAccessModeMethod · 0.80
GetArrayIdMethod · 0.80
DeleteMethod · 0.65
GetScalarsClass · 0.50
GetArrayNameMethod · 0.45
GetLookupTableMethod · 0.45
MapScalarsMethod · 0.45
GetPointerMethod · 0.45
GetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected