VTK
vtkLineIntegralConvolution2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLineIntegralConvolution2D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
92 #ifndef vtkLineIntegralConvolution2D_h
93 #define vtkLineIntegralConvolution2D_h
94 
95 #include "vtkObject.h"
96 #include "vtkWeakPointer.h" // for ren context
97 #include "vtkRenderingLICOpenGL2Module.h" // for export macro
98 #include <deque> // for deque
99 
101 class vtkOpenGLHelper;
104 class vtkPixelExtent;
105 class vtkRenderWindow;
106 class vtkShaderProgram;
107 class vtkTextureObject;
108 
109 class VTKRENDERINGLICOPENGL2_EXPORT vtkLineIntegralConvolution2D : public vtkObject
110 {
111 public:
114  void PrintSelf(ostream & os, vtkIndent indent) override;
115 
119  static bool IsSupported(vtkRenderWindow * renWin);
120 
122 
126  void SetContext(vtkOpenGLRenderWindow *context);
127  vtkOpenGLRenderWindow *GetContext();
129 
131 
136  vtkSetClampMacro(EnhancedLIC, int, 0, 1);
137  vtkGetMacro(EnhancedLIC, int);
138  vtkBooleanMacro(EnhancedLIC, int);
140 
142 
163  enum {
164  ENHANCE_CONTRAST_OFF=0,
165  ENHANCE_CONTRAST_ON=1};
166  vtkSetClampMacro(EnhanceContrast, int, 0, 2);
167  vtkGetMacro(EnhanceContrast, int);
168  vtkBooleanMacro(EnhanceContrast, int);
170 
172 
189  vtkSetClampMacro(LowContrastEnhancementFactor, double, 0.0, 1.0);
190  vtkGetMacro(LowContrastEnhancementFactor, double);
191  vtkSetClampMacro(HighContrastEnhancementFactor, double, 0.0, 1.0);
192  vtkGetMacro(HighContrastEnhancementFactor, double);
194 
196 
202  vtkSetClampMacro(AntiAlias, int, 0, VTK_INT_MAX);
203  vtkGetMacro(AntiAlias, int);
204  vtkBooleanMacro(AntiAlias, int);
206 
208 
212  vtkSetClampMacro(NumberOfSteps, int, 0, VTK_INT_MAX);
213  vtkGetMacro(NumberOfSteps, int);
215 
217 
224  vtkSetClampMacro(StepSize, double, 0.0, VTK_FLOAT_MAX);
225  vtkGetMacro(StepSize, double);
227 
229 
234  void SetComponentIds(int c0, int c1);
235  void SetComponentIds(int c[2]){ this->SetComponentIds(c[0], c[1]); }
236  vtkGetVector2Macro(ComponentIds, int);
238 
240 
245  vtkSetClampMacro(MaxNoiseValue, double, 0.0, 1.0);
246  vtkGetMacro(MaxNoiseValue, double);
248 
250 
256  void SetTransformVectors(int val);
257  vtkGetMacro(TransformVectors, int);
259 
281  void SetNormalizeVectors(int val);
282  vtkGetMacro(NormalizeVectors, int);
284 
286 
295  vtkSetClampMacro(MaskThreshold, double, -1.0, VTK_FLOAT_MAX);
296  vtkGetMacro(MaskThreshold, double);
298 
299 
303  vtkTextureObject *Execute(
304  vtkTextureObject *vectorTex,
305  vtkTextureObject *noiseTex);
306 
311  vtkTextureObject *Execute(
312  const int extent[4],
313  vtkTextureObject *vectorTex,
314  vtkTextureObject *noiseTex);
315 
327  vtkTextureObject *Execute(
328  const vtkPixelExtent &inputTexExtent,
329  const std::deque<vtkPixelExtent> &vectorExtent,
330  const std::deque<vtkPixelExtent> &licExtent,
331  vtkTextureObject *vectorTex,
332  vtkTextureObject *maskVectorTex,
333  vtkTextureObject *noiseTex);
334 
339  static
340  void SetVectorTexParameters(vtkTextureObject *vectors);
341 
342  static
343  void SetNoiseTexParameters(vtkTextureObject *noise);
344 
353  virtual vtkPainterCommunicator *GetCommunicator();
354 
359  virtual void GetGlobalMinMax(
361  float&,
362  float&) {}
363 
370  virtual void WriteTimerLog(const char *){}
371 
372 protected:
374  ~vtkLineIntegralConvolution2D() override;
375 
377 
378  void SetVTShader(vtkShaderProgram *prog);
379  void SetLIC0Shader(vtkShaderProgram *prog);
380  void SetLICIShader(vtkShaderProgram *prog);
381  void SetLICNShader(vtkShaderProgram *prog);
382  void SetEEShader(vtkShaderProgram *prog);
383  void SetCEShader(vtkShaderProgram *prog);
384  void SetAAHShader(vtkShaderProgram *prog);
385  void SetAAVShader(vtkShaderProgram *prog);
386 
387  void BuildShaders();
388 
389  void RenderQuad(
390  float computeBounds[4],
391  vtkPixelExtent computeExtent);
392 
393  vtkTextureObject *AllocateBuffer(unsigned int texSize[2]);
394 
399  void SetNoise2TexParameters(vtkTextureObject *noise);
400 
407  virtual void StartTimerEvent(const char *){}
408  virtual void EndTimerEvent(const char *){}
409 
410 protected:
413 
425 
427  double StepSize;
437  int ComponentIds[2];
439 
440 private:
442  void operator = (const vtkLineIntegralConvolution2D &) = delete;
443 };
444 
445 #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:59
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:159
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:167
a simple class to control print indentation
Definition: vtkIndent.h:39
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.