VTK  9.3.20240418
vtkVolumeInputHelper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkVolumeInputHelper_h
19 #define vtkVolumeInputHelper_h
20 #include <map>
21 
23 #include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
24 #include "vtkSmartPointer.h" // For SmartPointer
25 #include "vtkTimeStamp.h" // For TimeStamp
26 
27 VTK_ABI_NAMESPACE_BEGIN
32 class vtkRenderer;
33 class vtkShaderProgram;
34 class vtkVolume;
35 class vtkVolumeTexture;
36 class vtkWindow;
37 
38 class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkVolumeInputHelper
39 {
40 public:
41  vtkVolumeInputHelper() = default;
43 
45  vtkRenderer* ren, int uniformIndex, int blendMode, float samplingDist);
47 
48  void ActivateTransferFunction(vtkShaderProgram* prog, int blendMode);
49  void DeactivateTransferFunction(int blendMode);
50 
52 
54  vtkVolume* Volume = nullptr;
55 
61  {
62  INVALID = 0,
63  INDEPENDENT = 1,
64  LA = 2,
65  RGBA = 4
66  };
67  int ComponentMode = INDEPENDENT;
68 
78 
82  std::map<int, std::string> RGBTablesMap;
83  std::map<int, std::string> OpacityTablesMap;
84  std::map<int, std::string> GradientOpacityTablesMap;
85  std::map<int, std::string> TransferFunctions2DMap;
86 
92  int ColorRangeType = 0; // vtkGPUVolumeRayCastMapper::SCALAR
93  int ScalarOpacityRangeType = 0; // vtkGPUVolumeRayCastMapper::SCALAR
94  int GradientOpacityRangeType = 0; // vtkGPUVolumeRayCastMapper::SCALAR
95 
101 
102 protected:
104 
107 
108  void UpdateTransferFunctions(vtkRenderer* ren, int blendMode, float samplingDist);
110  vtkRenderer* ren, vtkVolume* vol, unsigned int component, int blendMode, float samplingDist);
113  vtkRenderer* ren, vtkVolume* vol, unsigned int component, float samplingDist);
115 
118 
120  bool InitializeTransfer = true;
121 };
122 
123 VTK_ABI_NAMESPACE_END
124 #endif // vtkVolumeInputHelper_h
125 // VTK-HeaderTest-Exclude: vtkVolumeInputHelper.h
abstract specification for renderers
Definition: vtkRenderer.h:172
The ShaderProgram uses one or more Shader objects.
record modification and/or execution time
Definition: vtkTimeStamp.h:44
Convenience container for internal structures specific to a volume input.
void ReleaseGraphicsResources(vtkWindow *window)
vtkSmartPointer< vtkOpenGLVolumeLookupTables< vtkOpenGLVolumeOpacityTable > > OpacityTables
int UpdateGradientOpacityTransferFunction(vtkRenderer *ren, vtkVolume *vol, unsigned int component, float samplingDist)
std::map< int, std::string > TransferFunctions2DMap
int UpdateOpacityTransferFunction(vtkRenderer *ren, vtkVolume *vol, unsigned int component, int blendMode, float samplingDist)
std::string GradientCacheName
Stores the uniform variable name where the gradient will be stored for this input in the fragment sha...
std::map< int, std::string > GradientOpacityTablesMap
void UpdateTransferFunctions(vtkRenderer *ren, int blendMode, float samplingDist)
vtkSmartPointer< vtkVolumeTexture > Texture
std::map< int, std::string > RGBTablesMap
Maps uniform texture variable names to its corresponding texture unit.
ComponentMode
Defines the various component modes supported by vtkGPUVolumeRayCastMapper.
void UpdateTransferFunction2D(vtkRenderer *ren, unsigned int component)
vtkVolumeInputHelper(vtkSmartPointer< vtkVolumeTexture > tex, vtkVolume *vol)
std::map< int, std::string > OpacityTablesMap
void DeactivateTransferFunction(int blendMode)
void CreateTransferFunction1D(vtkRenderer *ren, int index)
vtkVolumeInputHelper()=default
vtkSmartPointer< vtkOpenGLVolumeLookupTables< vtkOpenGLVolumeTransferFunction2D > > TransferFunctions2D
vtkSmartPointer< vtkOpenGLVolumeLookupTables< vtkOpenGLVolumeGradientOpacityTable > > GradientOpacityTables
Transfer function internal structures and helpers.
void ReleaseGraphicsTransfer1D(vtkWindow *window)
void InitializeTransferFunction(vtkRenderer *ren, int index)
void RefreshTransferFunction(vtkRenderer *ren, int uniformIndex, int blendMode, float samplingDist)
void CreateTransferFunction2D(vtkRenderer *ren, int index)
vtkSmartPointer< vtkOpenGLVolumeLookupTables< vtkOpenGLVolumeRGBTable > > RGBTables
int UpdateColorTransferFunction(vtkRenderer *ren, vtkVolume *vol, unsigned int component)
void ActivateTransferFunction(vtkShaderProgram *prog, int blendMode)
void ReleaseGraphicsTransfer2D(vtkWindow *window)
Creates and manages the volume texture rendered by vtkOpenGLGPUVolumeRayCastMapper.
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:120
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ component
Definition: vtkX3D.h:175
@ index
Definition: vtkX3D.h:246
@ string
Definition: vtkX3D.h:490