VTK  9.5.20250809
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
55
56VTK_ABI_NAMESPACE_BEGIN
61
62class VTKRENDERINGVOLUMEOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLSurfaceProbeVolumeMapper
64{
65public:
68
70
78
80
87
89
92 vtkGetMacro(Window, double);
93 vtkSetMacro(Window, double);
94
95 vtkGetMacro(Level, double);
96 vtkSetMacro(Level, double);
98
100
106 enum class BlendModes : unsigned int
107 {
108 NONE = 0,
109 MAX,
110 MIN,
111 AVERAGE
112 };
113
116 void SetBlendModeToNone() { this->SetBlendMode(BlendModes::NONE); }
117 void SetBlendModeToMaximumIntensity() { this->SetBlendMode(BlendModes::MAX); }
118 void SetBlendModeToMinimumIntensity() { this->SetBlendMode(BlendModes::MIN); }
119 void SetBlendModeToAverageIntensity() { this->SetBlendMode(BlendModes::AVERAGE); }
121
123
126 vtkGetMacro(BlendWidth, double);
127 vtkSetMacro(BlendWidth, double);
129
130 void RenderPiece(vtkRenderer* ren, vtkActor* act) override;
131
132 void UpdateShaders(vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* act) override;
133
134protected:
135 int FillInputPortInformation(int port, vtkInformation* info) override;
136
140
141private:
144
145 void CreateTexture(vtkTextureObject*, vtkOpenGLRenderWindow*);
146 void ReplaceActiveFBO(vtkRenderer*);
147 void RestoreActiveFBO(vtkRenderer*);
148
150
151 vtkNew<vtkTextureObject> PositionsTextureObject;
152 vtkNew<vtkTextureObject> NormalsTextureObject;
153 vtkNew<vtkVolumeTexture> VolumeTexture;
154
155 vtkNew<vtkImageData> TransformedSource;
156
157 // Internal pass type used for shader updates
158 enum class PassTypes : unsigned int
159 {
160 DEFAULT = 0,
161 POSITION_TEXTURE,
162 PROBE
163 };
164 PassTypes CurrentPass = PassTypes::DEFAULT;
165
166 // Window / level
167 double Window = 1.0;
168 double Level = 0.0;
169
170 // Blend mode
171 BlendModes BlendMode = BlendModes::NONE;
172 double BlendWidth = 1.0;
173
174 // Saved state
175 bool SavedScissorTestState = false;
176 bool SavedBlendState = false;
177 int SavedViewport[4] = {};
178};
179
180VTK_ABI_NAMESPACE_END
181#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.
#define VTK_MARSHALAUTO