| 144 | } |
| 145 | |
| 146 | int vtkVolumeInputHelper::UpdateColorTransferFunction( |
| 147 | vtkRenderer* ren, vtkVolume* vol, unsigned int component) |
| 148 | { |
| 149 | vtkVolumeProperty* volumeProperty = vol->GetProperty(); |
| 150 | |
| 151 | // Build the colormap in a 1D texture. 1D RGB-texture-mapping from scalar |
| 152 | // values to color values build the table. |
| 153 | vtkColorTransferFunction* colorTransferFunction = |
| 154 | volumeProperty->GetRGBTransferFunction(component); |
| 155 | |
| 156 | auto volumeTex = this->Texture.GetPointer(); |
| 157 | double componentRange[2]; |
| 158 | if (colorTransferFunction->GetSize() < 1 || |
| 159 | this->ColorRangeType == vtkGPUVolumeRayCastMapper::SCALAR) |
| 160 | { |
| 161 | for (int i = 0; i < 2; ++i) |
| 162 | { |
| 163 | componentRange[i] = volumeTex->ScalarRange[component][i]; |
| 164 | } |
| 165 | } |
| 166 | else |
| 167 | { |
| 168 | colorTransferFunction->GetRange(componentRange); |
| 169 | } |
| 170 | |
| 171 | // Add points only if its not being added before |
| 172 | if (colorTransferFunction->GetSize() < 1) |
| 173 | { |
| 174 | colorTransferFunction->AddRGBPoint(componentRange[0], 0.0, 0.0, 0.0); |
| 175 | colorTransferFunction->AddRGBPoint(componentRange[1], 1.0, 1.0, 1.0); |
| 176 | } |
| 177 | |
| 178 | int filterVal = volumeProperty->GetInterpolationType() == VTK_LINEAR_INTERPOLATION |
| 179 | ? vtkTextureObject::Linear |
| 180 | : vtkTextureObject::Nearest; |
| 181 | |
| 182 | this->RGBTables->GetTable(component)->Update(volumeProperty->GetRGBTransferFunction(component), |
| 183 | componentRange, 0, 0, 0, |
| 184 | #ifndef GL_ES_VERSION_3_0 |
| 185 | filterVal, |
| 186 | #else |
| 187 | vtkTextureObject::Nearest, |
| 188 | #endif |
| 189 | vtkOpenGLRenderWindow::SafeDownCast(ren->GetRenderWindow())); |
| 190 | |
| 191 | return 0; |
| 192 | } |
| 193 | |
| 194 | int vtkVolumeInputHelper::UpdateGradientOpacityTransferFunction( |
| 195 | vtkRenderer* ren, vtkVolume* vol, unsigned int component, float samplingDist) |
no test coverage detected