------------------------------------------------------------------------------
| 669 | |
| 670 | //------------------------------------------------------------------------------ |
| 671 | bool vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::LoadMask(vtkRenderer* ren, vtkVolume* vol) |
| 672 | { |
| 673 | bool result = true; |
| 674 | auto maskInput = this->Parent->MaskInput; |
| 675 | if (maskInput) |
| 676 | { |
| 677 | if (!this->CurrentMask) |
| 678 | { |
| 679 | this->CurrentMask = vtkSmartPointer<vtkVolumeTexture>::New(); |
| 680 | |
| 681 | const auto part = this->Partitions; |
| 682 | this->CurrentMask->SetPartitions(part[0], part[1], part[2]); |
| 683 | } |
| 684 | |
| 685 | int isCellData; |
| 686 | vtkDataArray* arr = |
| 687 | vtkOpenGLGPUVolumeRayCastMapper::GetScalars(maskInput, this->Parent->ScalarMode, |
| 688 | this->Parent->ArrayAccessMode, this->Parent->ArrayId, this->Parent->ArrayName, isCellData); |
| 689 | if (maskInput->GetMTime() > this->MaskUpdateTime || |
| 690 | this->CurrentMask->GetLoadedScalars() != arr || |
| 691 | (arr && arr->GetMTime() > this->MaskUpdateTime)) |
| 692 | { |
| 693 | // Setup the scalar range of the mask volume based on the number of transfer functions in the |
| 694 | // property. This is done so that the value for texture lookup in the shader is scaled and |
| 695 | // biased based on the range of the texture created by the label transfer functions. |
| 696 | vtkVolumeProperty* volumeProperty = vol->GetProperty(); |
| 697 | auto const numLabels = volumeProperty->GetLabelMapLabels().size(); |
| 698 | double maskRange[2] = { 0.0, (numLabels > 0.0 ? numLabels : 1.0) }; |
| 699 | vtkNew<vtkInformationVector> infoVec; |
| 700 | infoVec->SetNumberOfInformationObjects(1); |
| 701 | infoVec->GetInformationObject(0)->Set(vtkDataArray::COMPONENT_RANGE(), maskRange, 2); |
| 702 | arr->GetInformation()->Set(vtkDataArray::PER_FINITE_COMPONENT(), infoVec); |
| 703 | result = |
| 704 | this->CurrentMask->LoadVolume(ren, maskInput, arr, isCellData, VTK_NEAREST_INTERPOLATION); |
| 705 | |
| 706 | this->MaskUpdateTime.Modified(); |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | return result; |
| 711 | } |
| 712 | |
| 713 | //------------------------------------------------------------------------------ |
| 714 | void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::ReleaseGraphicsMaskTransfer(vtkWindow* window) |
no test coverage detected