| 516 | } |
| 517 | |
| 518 | void 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 | |
| 546 | void vtkWebGLPolyData::GetPolygonsFromPointData( |
| 547 | vtkTriangleFilter* polydata, vtkActor* actor, int maxSize) |
no test coverage detected