VTK  9.3.1
vtkLineIntegralConvolution2D.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
80 #ifndef vtkLineIntegralConvolution2D_h
81 #define vtkLineIntegralConvolution2D_h
82 
83 #include "vtkObject.h"
84 #include "vtkRenderingLICOpenGL2Module.h" // for export macro
85 #include "vtkWeakPointer.h" // for ren context
86 #include <deque> // for deque
87 
88 VTK_ABI_NAMESPACE_BEGIN
90 class vtkOpenGLHelper;
93 class vtkPixelExtent;
94 class vtkRenderWindow;
95 class vtkShaderProgram;
96 class vtkTextureObject;
97 
98 class VTKRENDERINGLICOPENGL2_EXPORT vtkLineIntegralConvolution2D : public vtkObject
99 {
100 public:
103  void PrintSelf(ostream& os, vtkIndent indent) override;
104 
108  static bool IsSupported(vtkRenderWindow* renWin);
109 
111 
115  void SetContext(vtkOpenGLRenderWindow* context);
116  vtkOpenGLRenderWindow* GetContext();
118 
120 
125  vtkSetClampMacro(EnhancedLIC, int, 0, 1);
126  vtkGetMacro(EnhancedLIC, int);
127  vtkBooleanMacro(EnhancedLIC, int);
129 
131 
152  enum
153  {
154  ENHANCE_CONTRAST_OFF = 0,
155  ENHANCE_CONTRAST_ON = 1
156  };
157  vtkSetClampMacro(EnhanceContrast, int, 0, 2);
158  vtkGetMacro(EnhanceContrast, int);
159  vtkBooleanMacro(EnhanceContrast, int);
161 
163 
180  vtkSetClampMacro(LowContrastEnhancementFactor, double, 0.0, 1.0);
181  vtkGetMacro(LowContrastEnhancementFactor, double);
182  vtkSetClampMacro(HighContrastEnhancementFactor, double, 0.0, 1.0);
183  vtkGetMacro(HighContrastEnhancementFactor, double);
185 
187 
193  vtkSetClampMacro(AntiAlias, int, 0, VTK_INT_MAX);
194  vtkGetMacro(AntiAlias, int);
195  vtkBooleanMacro(AntiAlias, int);
197 
199 
203  vtkSetClampMacro(NumberOfSteps, int, 0, VTK_INT_MAX);
204  vtkGetMacro(NumberOfSteps, int);
206 
208 
215  vtkSetClampMacro(StepSize, double, 0.0, VTK_FLOAT_MAX);
216  vtkGetMacro(StepSize, double);
218 
220 
225  void SetComponentIds(int c0, int c1);
226  void SetComponentIds(int c[2]) { this->SetComponentIds(c[0], c[1]); }
227  vtkGetVector2Macro(ComponentIds, int);
229 
231 
236  vtkSetClampMacro(MaxNoiseValue, double, 0.0, 1.0);
237  vtkGetMacro(MaxNoiseValue, double);
239 
241 
247  void SetTransformVectors(int val);
248  vtkGetMacro(TransformVectors, int);
250 
262 
272  void SetNormalizeVectors(int val);
273  vtkGetMacro(NormalizeVectors, int);
275 
277 
286  vtkSetClampMacro(MaskThreshold, double, -1.0, VTK_FLOAT_MAX);
287  vtkGetMacro(MaskThreshold, double);
289 
293  vtkTextureObject* Execute(vtkTextureObject* vectorTex, vtkTextureObject* noiseTex);
294 
299  vtkTextureObject* Execute(
300  const int extent[4], vtkTextureObject* vectorTex, vtkTextureObject* noiseTex);
301 
313  vtkTextureObject* Execute(const vtkPixelExtent& inputTexExtent,
314  const std::deque<vtkPixelExtent>& vectorExtent, const std::deque<vtkPixelExtent>& licExtent,
315  vtkTextureObject* vectorTex, vtkTextureObject* maskVectorTex, vtkTextureObject* noiseTex);
316 
321  static void SetVectorTexParameters(vtkTextureObject* vectors);
322 
323  static void SetNoiseTexParameters(vtkTextureObject* noise);
324 
333  virtual vtkPainterCommunicator* GetCommunicator();
334 
339  virtual void GetGlobalMinMax(vtkPainterCommunicator*, float&, float&) {}
340 
347  virtual void WriteTimerLog(const char*) {}
348 
349 protected:
351  ~vtkLineIntegralConvolution2D() override;
352 
354 
355  void SetVTShader(vtkShaderProgram* prog);
356  void SetLIC0Shader(vtkShaderProgram* prog);
357  void SetLICIShader(vtkShaderProgram* prog);
358  void SetLICNShader(vtkShaderProgram* prog);
359  void SetEEShader(vtkShaderProgram* prog);
360  void SetCEShader(vtkShaderProgram* prog);
361  void SetAAHShader(vtkShaderProgram* prog);
362  void SetAAVShader(vtkShaderProgram* prog);
363 
364  void BuildShaders();
365 
366  void RenderQuad(float computeBounds[4], vtkPixelExtent computeExtent);
367 
368  vtkTextureObject* AllocateBuffer(unsigned int texSize[2]);
369 
374  void SetNoise2TexParameters(vtkTextureObject* noise);
375 
382  virtual void StartTimerEvent(const char*) {}
383  virtual void EndTimerEvent(const char*) {}
384 
387 
399 
401  double StepSize;
411  int ComponentIds[2];
413 
414 private:
416  void operator=(const vtkLineIntegralConvolution2D&) = delete;
417 };
418 
419 VTK_ABI_NAMESPACE_END
420 #endif
OpenGL rendering window.
void SetComponentIds(int c[2])
If VectorField has >= 3 components, we must choose which 2 components form the (X, Y) components for the vector field.
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetCommunicator(vtkPainterCommunicator *)
Set the communicator to use during parallel operation The communicator will not be duplicated or refe...
#define VTK_INT_MAX
Definition: vtkType.h:144
GPU-based implementation of Line Integral Convolution (LIC)
virtual void GetGlobalMinMax(vtkPainterCommunicator *, float &, float &)
For parallel operation, find global min/max min/max are in/out.
virtual void WriteTimerLog(const char *)
Methods used for parallel benchmarks.
#define VTK_FLOAT_MAX
Definition: vtkType.h:152
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void StartTimerEvent(const char *)
Methods used for parallel benchmarks.
Internal class which encapsulates OpenGL FramebufferObject.
abstracts an OpenGL texture object.
create a window for renderers to draw into
vtkWeakPointer< vtkOpenGLRenderWindow > Context
Representation of a cartesian pixel plane and common operations on it.
A communicator that can safely be used inside a painter.
virtual void EndTimerEvent(const char *)
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
The ShaderProgram uses one or more Shader objects.