VTK  9.5.2
vtkOpenGLFluidMapper.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
14
15#ifndef vtkOpenGLFluidMapper_h
16#define vtkOpenGLFluidMapper_h
17
19
20#include "vtkOpenGLHelper.h" // used for ivars
21#include "vtkRenderingOpenGL2Module.h" // For export macro
22#include "vtkShader.h" // for methods
23#include "vtkSmartPointer.h" // for ivars
24#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25
26#include <map> //for methods
27
28VTK_ABI_NAMESPACE_BEGIN
29class vtkMatrix3x3;
30class vtkMatrix4x4;
33class vtkOpenGLState;
36class vtkPolyData;
38
39class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLFluidMapper
41{
42public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48
54
56
59 vtkSetMacro(ScalarVisibility, bool);
60 vtkGetMacro(ScalarVisibility, bool);
61 vtkBooleanMacro(ScalarVisibility, bool);
63
65
72 vtkSetMacro(ParticleRadius, float);
73 vtkGetMacro(ParticleRadius, float);
75
77
83 vtkSetMacro(SurfaceFilterIterations, vtkTypeUInt32);
84 vtkGetMacro(SurfaceFilterIterations, vtkTypeUInt32);
86
88
92 vtkSetMacro(ThicknessAndVolumeColorFilterIterations, vtkTypeUInt32);
93 vtkGetMacro(ThicknessAndVolumeColorFilterIterations, vtkTypeUInt32);
95
97
104 vtkSetMacro(SurfaceFilterRadius, vtkTypeUInt32);
105 vtkGetMacro(SurfaceFilterRadius, vtkTypeUInt32);
107
109
116
121 {
124 // New filter method can be added here,
126 };
127
129
135
141 void SetNarrowRangeFilterParameters(float lambda, float mu)
142 {
143 this->NRFilterLambda = lambda;
144 this->NRFilterMu = mu;
145 }
146
152 {
153 this->BiGaussFilterSigmaDepth = sigmaDepth;
154 }
155
168
170
176
178
183 vtkSetVector3Macro(AttenuationColor, float);
184 vtkGetVector3Macro(AttenuationColor, float);
186
188
192 vtkSetVector3Macro(OpaqueColor, float);
193 vtkGetVector3Macro(OpaqueColor, float);
195
197
203 vtkSetMacro(ParticleColorPower, float);
204 vtkGetMacro(ParticleColorPower, float);
206
208
214 vtkSetMacro(ParticleColorScale, float);
215 vtkGetMacro(ParticleColorScale, float);
217
219
225 vtkSetMacro(AttenuationScale, float);
226 vtkGetMacro(AttenuationScale, float);
228
230
236 vtkSetMacro(AdditionalReflection, float);
237 vtkGetMacro(AdditionalReflection, float);
239
241
247 vtkSetMacro(RefractionScale, float);
248 vtkGetMacro(RefractionScale, float);
250
252
255 vtkSetMacro(RefractiveIndex, float);
256 vtkGetMacro(RefractiveIndex, float);
258
262 void Render(vtkRenderer* ren, vtkVolume* vol) override;
263
270
271protected:
274
279 vtkOpenGLHelper& glHelper, vtkRenderer* renderer, vtkVolume* vol);
280
285 vtkOpenGLHelper& glHelper, vtkRenderer* renderer, vtkVolume* vol);
286
291
295 void RenderParticles(vtkRenderer* renderer, vtkVolume* vol);
296
297 // Public parameters, their usage are stated at their Get/Set functions
298 // ======>>>>>
299 float ParticleRadius = 1.0f;
300
302 vtkTypeUInt32 SurfaceFilterIterations = 3u;
303 vtkTypeUInt32 SurfaceFilterRadius = 5u;
304 float NRFilterLambda = 10.0f;
305 float NRFilterMu = 1.0f;
307
310
312
313 float OpaqueColor[3]{ 0.0f, 0.0f, 0.95f };
314 float AttenuationColor[3]{ 0.5f, 0.2f, 0.05f };
315 float ParticleColorPower = 0.1f;
316 float ParticleColorScale = 1.0f;
317 float AttenuationScale = 1.0f;
319 float RefractionScale = 1.0f;
320 float RefractiveIndex = 1.33f;
321
322 bool ScalarVisibility = false;
323 bool InDepthPass = true;
324
325 // Private parameters ======>>>>>
326
327 // Indicate that the input data has a color buffer
328 bool HasVertexColor = false;
329
330 // Cache viewport dimensions
335
336 // Cache camera parameters
343
344 // Frame buffers
350
351 // Screen quad render
356
357 // The VBO and its layout for rendering particles
359 vtkTimeStamp VBOBuildTime; // When was the OpenGL VBO updated?
361
362 // Texture buffers
375
376 // These are optional texture buffers
383
387
388private:
390 void operator=(const vtkOpenGLFluidMapper&) = delete;
391};
392
393VTK_ABI_NAMESPACE_END
394#endif
a simple class to control print indentation
Definition vtkIndent.h:29
represent and manipulate 3x3 transformation matrices
represent and manipulate 4x4 transformation matrices
vtkOpenGLQuadHelper * QuadFluidDepthFilter[NumFilterMethods]
void SetInputData(vtkPolyData *in)
Specify the input data to map.
vtkOpenGLQuadHelper * QuadFinalBlend
vtkSmartPointer< vtkOpenGLFramebufferObject > FBThickness
FluidDisplayMode
Display mode for the fluid, default value is TransparentFluidVolume.
void ReleaseGraphicsResources(vtkWindow *w) override
Release graphics resources and ask components to release their own resources.
vtkSmartPointer< vtkOpenGLVertexBufferObjectGroup > VBOs
void SetNarrowRangeFilterParameters(float lambda, float mu)
Optional parameters, exclusively for narrow range filter The first parameter is to control smoothing ...
vtkTypeUInt32 SurfaceFilterIterations
vtkTextureObject * TexBuffer[NumTexBuffers]
void Render(vtkRenderer *ren, vtkVolume *vol) override
This calls RenderPiece.
vtkSmartPointer< vtkOpenGLFramebufferObject > FBCompNormal
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPolyData * GetInput()
Specify the input data to map.
vtkSmartPointer< vtkOpenGLFramebufferObject > FBFluidEyeZ
vtkSmartPointer< vtkOpenGLFramebufferObject > FBFilterThickness
vtkOpenGLQuadHelper * QuadThicknessFilter
FluidSurfaceFilterMethod
Filter method to filter the depth buffer.
vtkTypeUInt32 ThicknessAndVolumeColorFilterRadius
FluidSurfaceFilterMethod SurfaceFilterMethod
~vtkOpenGLFluidMapper() override
vtkTextureObject * OptionalTexBuffer[NumOptionalTexBuffers]
vtkTypeUInt32 ThicknessAndVolumeColorFilterIterations
void SetupBuffers(vtkOpenGLRenderWindow *renderWindow)
Setup the texture buffers.
vtkOpenGLQuadHelper * QuadFluidNormal
void UpdateDepthThicknessColorShaders(vtkOpenGLHelper &glHelper, vtkRenderer *renderer, vtkVolume *vol)
Perform string replacements on the shader templates.
static vtkOpenGLFluidMapper * New()
void RenderParticles(vtkRenderer *renderer, vtkVolume *vol)
Render the fluid particles.
vtkSmartPointer< vtkOpenGLFramebufferObject > FBFilterDepth
void SetBilateralGaussianFilterParameter(float sigmaDepth)
Optional parameters, exclusively for bilateral gaussian filter The parameter is for controlling smoot...
vtkOpenGLHelper GLHelperDepthThickness
void SetDepthThicknessColorShaderParameters(vtkOpenGLHelper &glHelper, vtkRenderer *renderer, vtkVolume *vol)
Set the shader parameters related to the actor/mapper/camera.
Internal class which encapsulates OpenGL FramebufferObject.
Class to make rendering a full screen quad easier.
OpenGL rendering window.
OpenGL state storage.
manage vertex buffer objects shared within a mapper
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
abstract specification for renderers
Definition vtkRenderer.h:60
Hold a reference to a vtkObjectBase instance.
In case DepthTextureCompare is true, specify the comparison function in use.
record modification and/or execution time
represents a volume (data & properties) in a rendered scene
Definition vtkVolume.h:41
window superclass for vtkRenderWindow
Definition vtkWindow.h:26
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_MARSHALAUTO