VTK  9.4.20241219
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
48#ifndef vtkOpenGLSurfaceProbeVolumeMapper_h
49#define vtkOpenGLSurfaceProbeVolumeMapper_h
50
51#include "vtkNew.h" // For vtkNew
53#include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
54
55VTK_ABI_NAMESPACE_BEGIN
60
61class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkOpenGLSurfaceProbeVolumeMapper
63{
64public:
67
69
77
79
86
88
91 vtkGetMacro(Window, double);
92 vtkSetMacro(Window, double);
93
94 vtkGetMacro(Level, double);
95 vtkSetMacro(Level, double);
97
99
105 enum class BlendModes : unsigned int
106 {
107 NONE = 0,
108 MAX,
109 MIN,
110 AVERAGE
111 };
112
115 void SetBlendModeToNone() { this->SetBlendMode(BlendModes::NONE); }
116 void SetBlendModeToMaximumIntensity() { this->SetBlendMode(BlendModes::MAX); }
117 void SetBlendModeToMinimumIntensity() { this->SetBlendMode(BlendModes::MIN); }
118 void SetBlendModeToAverageIntensity() { this->SetBlendMode(BlendModes::AVERAGE); }
120
122
125 vtkGetMacro(BlendWidth, double);
126 vtkSetMacro(BlendWidth, double);
128
129 void RenderPiece(vtkRenderer* ren, vtkActor* act) override;
130
131 void UpdateShaders(vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* act) override;
132
133protected:
134 int FillInputPortInformation(int port, vtkInformation* info) override;
135
139
140private:
142 ~vtkOpenGLSurfaceProbeVolumeMapper() override = default;
143
144 void CreateTexture(vtkTextureObject*, vtkOpenGLRenderWindow*);
145 void ReplaceActiveFBO(vtkRenderer*);
146 void RestoreActiveFBO(vtkRenderer*);
147
149
150 vtkNew<vtkTextureObject> PositionsTextureObject;
151 vtkNew<vtkTextureObject> NormalsTextureObject;
152 vtkNew<vtkVolumeTexture> VolumeTexture;
153
154 vtkNew<vtkImageData> TransformedSource;
155
156 // Internal pass type used for shader updates
157 enum class PassTypes : unsigned int
158 {
159 DEFAULT = 0,
160 POSITION_TEXTURE,
161 PROBE
162 };
163 PassTypes CurrentPass = PassTypes::DEFAULT;
164
165 // Window / level
166 double Window = 1.0;
167 double Level = 0.0;
168
169 // Blend mode
170 BlendModes BlendMode = BlendModes::NONE;
171 double BlendWidth = 1.0;
172
173 // Saved state
174 bool SavedScissorTestState = false;
175 bool SavedBlendState = false;
176 int SavedViewport[4] = {};
177};
178
179VTK_ABI_NAMESPACE_END
180#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
Proxy object to connect input/output ports.
topologically and geometrically regular array of data
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:167
Internal class which encapsulates OpenGL FramebufferObject.
PolyDataMapper using OpenGL to render.
OpenGL rendering window.
PolyDataMapper colored with probed volume data.
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.
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.
virtual void ReplaceShaderProbePass(vtkActor *act)
void SetProbeInputConnection(vtkAlgorithmOutput *algOutput)
Specify the input data used for probing (optional).
void RenderPiece(vtkRenderer *ren, vtkActor *act) override
Implemented by sub classes.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
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
abstract specification for renderers
abstracts an OpenGL texture object.
Creates and manages the volume texture rendered by vtkOpenGLGPUVolumeRayCastMapper.