| 335 | } |
| 336 | |
| 337 | void vtkVolumeInputHelper::CreateTransferFunction1D(vtkRenderer* ren, int index) |
| 338 | { |
| 339 | this->ReleaseGraphicsTransfer1D(ren->GetRenderWindow()); |
| 340 | |
| 341 | int const numActiveLuts = |
| 342 | this->ComponentMode == INDEPENDENT ? Texture->GetLoadedScalars()->GetNumberOfComponents() : 1; |
| 343 | |
| 344 | // Create RGB and opacity (scalar and gradient) lookup tables. Up to four |
| 345 | // components are supported in single-input independentComponents mode. |
| 346 | this->RGBTables = vtkSmartPointer<vtkOpenGLVolumeLookupTables<vtkOpenGLVolumeRGBTable>>::New(); |
| 347 | this->RGBTables->Create(numActiveLuts); |
| 348 | this->OpacityTables = |
| 349 | vtkSmartPointer<vtkOpenGLVolumeLookupTables<vtkOpenGLVolumeOpacityTable>>::New(); |
| 350 | this->OpacityTables->Create(numActiveLuts); |
| 351 | this->GradientOpacityTables = |
| 352 | vtkSmartPointer<vtkOpenGLVolumeLookupTables<vtkOpenGLVolumeGradientOpacityTable>>::New(); |
| 353 | this->GradientOpacityTables->Create(numActiveLuts); |
| 354 | |
| 355 | this->OpacityTablesMap.clear(); |
| 356 | this->RGBTablesMap.clear(); |
| 357 | this->GradientOpacityTablesMap.clear(); |
| 358 | |
| 359 | std::ostringstream idx; |
| 360 | idx << index; |
| 361 | |
| 362 | this->GradientCacheName = "g_gradients_" + idx.str(); |
| 363 | |
| 364 | for (int i = 0; i < numActiveLuts; ++i) |
| 365 | { |
| 366 | std::ostringstream comp; |
| 367 | comp << "[" << i << "]"; |
| 368 | |
| 369 | this->OpacityTablesMap[i] = "in_opacityTransferFunc_" + idx.str() + comp.str(); |
| 370 | this->RGBTablesMap[i] = "in_colorTransferFunc_" + idx.str() + comp.str(); |
| 371 | |
| 372 | // Unlike color and scalar-op, graident-op is optional (some inputs may |
| 373 | // or may not have gradient-op active). |
| 374 | if (this->Volume->GetProperty()->HasGradientOpacity()) |
| 375 | { |
| 376 | this->GradientOpacityTablesMap[i] = "in_gradientTransferFunc_" + idx.str() + comp.str(); |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | this->LutInit.Modified(); |
| 381 | } |
| 382 | |
| 383 | void vtkVolumeInputHelper::CreateTransferFunction2D(vtkRenderer* ren, int index) |
| 384 | { |
no test coverage detected