VTK  9.6.2
vtkOpenGLSurfaceProbeVolumeMapper.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
51
52#ifndef vtkOpenGLSurfaceProbeVolumeMapper_h
53#define vtkOpenGLSurfaceProbeVolumeMapper_h
54
55#include "vtkNew.h" // For vtkNew
57#include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
58#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
59
60VTK_ABI_NAMESPACE_BEGIN
65
66class VTKRENDERINGVOLUMEOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLSurfaceProbeVolumeMapper
68{
69public:
70 static vtkOpenGLSurfaceProbeVolumeMapper* New();
71 vtkTypeMacro(vtkOpenGLSurfaceProbeVolumeMapper, vtkOpenGLPolyDataMapper);
72
74
82
84
91
93
99 double GetWindow() { return this->ScalarRange[1] - this->ScalarRange[0]; }
100 void SetWindow(double window)
101 {
102 double level = this->GetLevel();
103 this->SetScalarRange(level - 0.5 * window, level + 0.5 * window);
104 }
105
106 double GetLevel() { return 0.5 * (this->ScalarRange[0] + this->ScalarRange[1]); }
107 void SetLevel(double level)
108 {
109 double window = this->GetWindow();
110 this->SetScalarRange(level - 0.5 * window, level + 0.5 * window);
111 }
112
113
115
121 enum class BlendModes : unsigned int
122 {
123 NONE = 0,
124 MAX,
125 MIN,
126 AVERAGE
127 };
128
131 void SetBlendModeToNone() { this->SetBlendMode(BlendModes::NONE); }
132 void SetBlendModeToMaximumIntensity() { this->SetBlendMode(BlendModes::MAX); }
133 void SetBlendModeToMinimumIntensity() { this->SetBlendMode(BlendModes::MIN); }
136
138
141 vtkGetMacro(BlendWidth, double);
142 vtkSetMacro(BlendWidth, double);
144
145 void RenderPiece(vtkRenderer* ren, vtkActor* act) override;
146
147 void UpdateShaders(vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* act) override;
148
155 vtkUnsignedCharArray* MapScalars(vtkDataSet* input, double alpha, int& cellFlag) override;
156
164
169 void CreateDefaultLookupTable() override{};
170
171protected:
172 int FillInputPortInformation(int port, vtkInformation* info) override;
173
177
178private:
179 vtkOpenGLSurfaceProbeVolumeMapper();
180 ~vtkOpenGLSurfaceProbeVolumeMapper() override;
181
183 void ReplaceActiveFBO(vtkRenderer*);
184 void RestoreActiveFBO(vtkRenderer*);
185
187
188 vtkNew<vtkTextureObject> PositionsTextureObject;
189 vtkNew<vtkTextureObject> NormalsTextureObject;
190 vtkNew<vtkVolumeTexture> VolumeTexture;
191
192 vtkNew<vtkImageData> TransformedSource;
193
194 // Internal pass type used for shader updates
195 enum class PassTypes : unsigned int
196 {
197 DEFAULT = 0,
198 POSITION_TEXTURE,
199 PROBE
200 };
201 PassTypes CurrentPass = PassTypes::DEFAULT;
202
203 // Blend mode
204 BlendModes BlendMode = BlendModes::NONE;
205 double BlendWidth = 1.0;
206
207 // Saved state
208 bool SavedScissorTestState = false;
209 bool SavedBlendState = false;
210 int SavedViewport[4] = {};
211};
212
213VTK_ABI_NAMESPACE_END
214#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:42
Proxy object to connect input/output ports.
abstract class to specify dataset behavior
Definition vtkDataSet.h:57
topologically and geometrically regular array of data
Store vtkAlgorithm input/output information.
virtual vtkUnsignedCharArray * MapScalars(double alpha)
Map the scalars (if there are any scalars and ScalarVisibility is on) through the lookup table,...
virtual void SetScalarRange(double, double)
Specify range in terms of scalar minimum and maximum (smin,smax).
double ScalarRange[2]
Definition vtkMapper.h:541
Allocate and hold a VTK object.
Definition vtkNew.h:58
Internal class which encapsulates OpenGL FramebufferObject.
OpenGL rendering window.
void SetBlendModeToMaximumIntensity()
Set/Get the blend mode.
void UpdateShaders(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act) override
Make sure appropriate shaders are defined, compiled and bound.
vtkImageData * GetSource()
Specify the input data to be probed.
vtkPolyData * GetProbeInput()
Specify the input data used for probing (optional).
void SetSourceData(vtkImageData *in)
Specify the input data to be probed.
void SetSourceConnection(vtkAlgorithmOutput *algOutput)
Specify the input data to be probed.
bool HasTranslucentPolygonalGeometry() override
Determine whether this mapper should be invoked on a specific rendering pass.
virtual void UpdateShadersProbePass(vtkOpenGLHelper &cellBO, vtkRenderer *ren)
virtual void ReplaceShaderPositionPass(vtkActor *act)
void SetBlendModeToAverageIntensity()
Set/Get the blend mode.
vtkSetEnumMacro(BlendMode, BlendModes)
Set/Get the blend mode.
vtkUnsignedCharArray * MapScalars(vtkDataSet *input, double alpha, int &cellFlag) override
Map the scalars of the source through the lookup table if any.
virtual void ReplaceShaderProbePass(vtkActor *act)
void SetWindow(double window)
Convienence methods to set the window and level values used for scalar coloring, which ultimately set...
void SetLevel(double level)
Convienence methods to set the window and level values used for scalar coloring, which ultimately set...
void CreateDefaultLookupTable() override
Defined as no-op to prevent the creation of a default lookup table in GetLookupTable.
double GetWindow()
Convienence methods to set the window and level values used for scalar coloring, which ultimately set...
void SetProbeInputConnection(vtkAlgorithmOutput *algOutput)
Specify the input data used for probing (optional).
void RenderPiece(vtkRenderer *ren, vtkActor *act) override
Implemented by sub classes.
double GetLevel()
Convienence methods to set the window and level values used for scalar coloring, which ultimately set...
int FillInputPortInformation(int port, vtkInformation *info) override
void SetBlendModeToMinimumIntensity()
Set/Get the blend mode.
void SetProbeInputData(vtkPolyData *in)
Specify the input data used for probing (optional).
static vtkOpenGLSurfaceProbeVolumeMapper * New()
vtkGetEnumMacro(BlendMode, BlendModes)
Set/Get the blend mode.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
abstract specification for renderers
Definition vtkRenderer.h:61
In case DepthTextureCompare is true, specify the comparison function in use.
dynamic, self-adjusting array of unsigned char
Creates and manages the volume texture rendered by vtkOpenGLGPUVolumeRayCastMapper.
virtual int GetLevel()
Level of subdivision of the faces.
void CreateTexture()
Creates a texture handle if not already created.
#define VTK_MARSHALAUTO