| 2751 | } |
| 2752 | |
| 2753 | int vtkFixedPointVolumeRayCastMapper::UpdateGradients(vtkVolume* vol) |
| 2754 | { |
| 2755 | int needToUpdate = 0; |
| 2756 | |
| 2757 | this->GradientOpacityRequired = 0; |
| 2758 | this->ShadingRequired = 0; |
| 2759 | |
| 2760 | // Get the image data |
| 2761 | vtkImageData* input = vtkImageData::SafeDownCast(this->GetInput()); |
| 2762 | |
| 2763 | if (vol->GetProperty()->GetShade()) |
| 2764 | { |
| 2765 | needToUpdate = 1; |
| 2766 | this->ShadingRequired = 1; |
| 2767 | } |
| 2768 | |
| 2769 | for (int c = 0; c < this->CurrentScalars->GetNumberOfComponents(); c++) |
| 2770 | { |
| 2771 | vtkPiecewiseFunction* f = vol->GetProperty()->GetGradientOpacity(c); |
| 2772 | if (strcmp(f->GetType(), "Constant") != 0 || f->GetValue(0.0) != 1.0) |
| 2773 | { |
| 2774 | needToUpdate = 1; |
| 2775 | this->GradientOpacityRequired = 1; |
| 2776 | } |
| 2777 | } |
| 2778 | |
| 2779 | if (!needToUpdate) |
| 2780 | { |
| 2781 | return 0; |
| 2782 | } |
| 2783 | |
| 2784 | // Check if the input has changed |
| 2785 | if (input == this->SavedGradientsInput && this->CurrentScalars == this->PreviousScalars && |
| 2786 | input->GetMTime() < this->SavedGradientsMTime.GetMTime()) |
| 2787 | { |
| 2788 | return 0; |
| 2789 | } |
| 2790 | |
| 2791 | this->ComputeGradients(vol); |
| 2792 | |
| 2793 | // Time to save the input used to update the tables |
| 2794 | this->SavedGradientsInput = vtkImageData::SafeDownCast(this->GetInput()); |
| 2795 | this->SavedGradientsMTime.Modified(); |
| 2796 | |
| 2797 | return 1; |
| 2798 | } |
| 2799 | |
| 2800 | int vtkFixedPointVolumeRayCastMapper::UpdateColorTable(vtkVolume* vol) |
| 2801 | { |
no test coverage detected