------------------------------------------------------------------------------
| 612 | |
| 613 | //------------------------------------------------------------------------------ |
| 614 | void vtkSmartVolumeMapper::SetupVectorMode(vtkVolume* vol) |
| 615 | { |
| 616 | vtkDataSet* input = this->GetInput(); |
| 617 | if (!input) |
| 618 | { |
| 619 | vtkErrorMacro("Failed to setup vector rendering mode! No input."); |
| 620 | } |
| 621 | |
| 622 | int isCellData = 0; |
| 623 | vtkDataArray* dataArray = vtkSmartVolumeMapper::GetScalars( |
| 624 | input, this->ScalarMode, this->ArrayAccessMode, this->ArrayId, this->ArrayName, isCellData); |
| 625 | if (!dataArray) |
| 626 | { |
| 627 | vtkErrorMacro("Failed to locate data array."); |
| 628 | return; |
| 629 | } |
| 630 | |
| 631 | int const numComponents = dataArray->GetNumberOfComponents(); |
| 632 | switch (this->VectorMode) |
| 633 | { |
| 634 | case MAGNITUDE: |
| 635 | { |
| 636 | // ParaView sets mode as MAGNITUDE when there is a single component, |
| 637 | // so check whether magnitude makes sense. |
| 638 | if (numComponents > 1) |
| 639 | { |
| 640 | // Recompute magnitude if not up to date |
| 641 | if (!this->ImageMagnitude || |
| 642 | input->GetMTime() > this->ImageMagnitude->GetOutput()->GetMTime()) |
| 643 | { |
| 644 | if (!this->ImageMagnitude) |
| 645 | { |
| 646 | this->ImageMagnitude = vtkImageMagnitude::New(); |
| 647 | } |
| 648 | |
| 649 | // Proxy dataset (set the active attribute for the magnitude filter) |
| 650 | if (isCellData) |
| 651 | { |
| 652 | this->ComputeMagnitudeCellData(input, dataArray); |
| 653 | } |
| 654 | else |
| 655 | { |
| 656 | this->ComputeMagnitudePointData(input, dataArray); |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | if (this->InputDataMagnitude->GetMTime() > this->MagnitudeUploadTime) |
| 661 | { |
| 662 | this->GPUMapper->SetInputDataObject(this->InputDataMagnitude); |
| 663 | this->GPUMapper->SelectScalarArray("Magnitude"); |
| 664 | this->MagnitudeUploadTime.Modified(); |
| 665 | } |
| 666 | } |
| 667 | else |
| 668 | { |
| 669 | // Data is not multi-component so use the array itself. |
| 670 | if (this->ArrayAccessMode == VTK_GET_ARRAY_BY_NAME) |
| 671 | { |
no test coverage detected