------------------------------------------------------------------------------
| 3014 | |
| 3015 | //------------------------------------------------------------------------------ |
| 3016 | bool vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateInputs(vtkRenderer* ren, vtkVolume* vol) |
| 3017 | { |
| 3018 | this->VolumePropertyChanged = false; |
| 3019 | bool orderChanged = false; |
| 3020 | bool success = true; |
| 3021 | for (const auto& port : this->Parent->Ports) |
| 3022 | { |
| 3023 | if (this->MultiVolume) |
| 3024 | { |
| 3025 | vol = this->MultiVolume->GetVolume(port); |
| 3026 | } |
| 3027 | auto property = vol->GetProperty(); |
| 3028 | auto input = this->Parent->GetTransformedInput(port); |
| 3029 | |
| 3030 | // Check for property changes |
| 3031 | this->VolumePropertyChanged |= property->GetMTime() > this->ShaderBuildTime.GetMTime(); |
| 3032 | |
| 3033 | auto it = this->Parent->AssembledInputs.find(port); |
| 3034 | if (it == this->Parent->AssembledInputs.cend() || it->second.Volume != vol) |
| 3035 | { |
| 3036 | // Create new input structure |
| 3037 | auto texture = vtkSmartPointer<vtkVolumeTexture>::New(); |
| 3038 | |
| 3039 | VolumeInput currentInput(texture, vol); |
| 3040 | this->Parent->AssembledInputs[port] = std::move(currentInput); |
| 3041 | orderChanged = true; |
| 3042 | |
| 3043 | it = this->Parent->AssembledInputs.find(port); |
| 3044 | } |
| 3045 | assert(it != this->Parent->AssembledInputs.cend()); |
| 3046 | |
| 3047 | /// TODO Currently, only input arrays with the same name/id/mode can be |
| 3048 | // (across input objects) can be rendered. This could be addressed by |
| 3049 | // overriding the mapper's settings with array settings defined in the |
| 3050 | // vtkMultiVolume instance. |
| 3051 | vtkDataArray* scalars = vtkOpenGLGPUVolumeRayCastMapper::GetScalars(input, |
| 3052 | this->Parent->ScalarMode, this->Parent->ArrayAccessMode, this->Parent->ArrayId, |
| 3053 | this->Parent->ArrayName, this->Parent->CellFlag); |
| 3054 | |
| 3055 | if (this->NeedToInitializeResources || (input->GetMTime() > it->second.Texture->UploadTime) || |
| 3056 | (scalars != it->second.Texture->GetLoadedScalars()) || |
| 3057 | (scalars != nullptr && scalars->GetMTime() > it->second.Texture->UploadTime)) |
| 3058 | { |
| 3059 | auto& volInput = this->Parent->AssembledInputs[port]; |
| 3060 | auto volumeTex = volInput.Texture.GetPointer(); |
| 3061 | volumeTex->SetPartitions(this->Partitions[0], this->Partitions[1], this->Partitions[2]); |
| 3062 | success &= volumeTex->LoadVolume( |
| 3063 | ren, input, scalars, this->Parent->CellFlag, property->GetInterpolationType()); |
| 3064 | volInput.ComponentMode = this->GetComponentMode(property, scalars); |
| 3065 | } |
| 3066 | else |
| 3067 | { |
| 3068 | // Update vtkVolumeTexture |
| 3069 | it->second.Texture->UpdateVolume(property); |
| 3070 | } |
| 3071 | |
| 3072 | // Volume may have changed, so make sure the helper updates its reference to it. |
| 3073 | it->second.Volume = vol; |
no test coverage detected