| 97 | } |
| 98 | |
| 99 | int vtkVolumeInputHelper::UpdateOpacityTransferFunction( |
| 100 | vtkRenderer* ren, vtkVolume* vol, unsigned int component, int blendMode, float samplingDist) |
| 101 | { |
| 102 | vtkVolumeProperty* volumeProperty = vol->GetProperty(); |
| 103 | |
| 104 | // Use the first LUT when using dependent components |
| 105 | unsigned int lookupTableIndex = volumeProperty->GetIndependentComponents() ? component : 0; |
| 106 | vtkPiecewiseFunction* scalarOpacity = volumeProperty->GetScalarOpacity(lookupTableIndex); |
| 107 | |
| 108 | auto volumeTex = this->Texture.GetPointer(); |
| 109 | double componentRange[2]; |
| 110 | if (scalarOpacity->GetSize() < 1 || |
| 111 | this->ScalarOpacityRangeType == vtkGPUVolumeRayCastMapper::SCALAR) |
| 112 | { |
| 113 | for (int i = 0; i < 2; ++i) |
| 114 | { |
| 115 | componentRange[i] = volumeTex->ScalarRange[component][i]; |
| 116 | } |
| 117 | } |
| 118 | else |
| 119 | { |
| 120 | scalarOpacity->GetRange(componentRange); |
| 121 | } |
| 122 | |
| 123 | if (scalarOpacity->GetSize() < 1) |
| 124 | { |
| 125 | scalarOpacity->AddPoint(componentRange[0], 0.0); |
| 126 | scalarOpacity->AddPoint(componentRange[1], 0.5); |
| 127 | } |
| 128 | |
| 129 | int filterVal = volumeProperty->GetInterpolationType() == VTK_LINEAR_INTERPOLATION |
| 130 | ? vtkTextureObject::Linear |
| 131 | : vtkTextureObject::Nearest; |
| 132 | |
| 133 | this->OpacityTables->GetTable(lookupTableIndex) |
| 134 | ->Update(scalarOpacity, componentRange, blendMode, samplingDist, |
| 135 | volumeProperty->GetScalarOpacityUnitDistance(component), |
| 136 | #ifndef GL_ES_VERSION_3_0 |
| 137 | filterVal, |
| 138 | #else |
| 139 | vtkTextureObject::Nearest, |
| 140 | #endif |
| 141 | vtkOpenGLRenderWindow::SafeDownCast(ren->GetRenderWindow())); |
| 142 | |
| 143 | return 0; |
| 144 | } |
| 145 | |
| 146 | int vtkVolumeInputHelper::UpdateColorTransferFunction( |
| 147 | vtkRenderer* ren, vtkVolume* vol, unsigned int component) |
no test coverage detected