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

Method SetupVectorMode

Rendering/VolumeOpenGL2/vtkSmartVolumeMapper.cxx:614–733  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

612
613//------------------------------------------------------------------------------
614void 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 {

Callers 1

ComputeRenderModeMethod · 0.95

Calls 15

ConnectMapperInputMethod · 0.95
GetScalarOpacityMethod · 0.80
SetScalarOpacityMethod · 0.80
SetComponentWeightMethod · 0.80
GetScalarsClass · 0.50
NewFunction · 0.50
GetInputMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetMTimeMethod · 0.45

Tested by

no test coverage detected