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 "vtkRenderingLICModule.h" // for export macro
98 #include <deque> // for deque
99 
100 class vtkRenderWindow;
101 class vtkTextureObject;
102 class vtkPixelExtent;
103 class vtkShaderProgram2;
106 
107 class VTKRENDERINGLIC_EXPORT vtkLineIntegralConvolution2D : public vtkObject
108 {
109 public:
112  void PrintSelf(ostream & os, vtkIndent indent);
113 
117  static bool IsSupported(vtkRenderWindow * renWin);
118 
120 
124  void SetContext(vtkRenderWindow *context);
125  vtkRenderWindow *GetContext();
127 
129 
134  vtkSetClampMacro(EnhancedLIC, int, 0, 1);
135  vtkGetMacro(EnhancedLIC, int);
136  vtkBooleanMacro(EnhancedLIC, int);
138 
140 
161  enum {
162  ENHANCE_CONTRAST_OFF=0,
163  ENHANCE_CONTRAST_ON=1};
164  vtkSetClampMacro(EnhanceContrast, int, 0, 2);
165  vtkGetMacro(EnhanceContrast, int);
166  vtkBooleanMacro(EnhanceContrast, int);
168 
170 
187  vtkSetClampMacro(LowContrastEnhancementFactor, double, 0.0, 1.0);
188  vtkGetMacro(LowContrastEnhancementFactor, double);
189  vtkSetClampMacro(HighContrastEnhancementFactor, double, 0.0, 1.0);
190  vtkGetMacro(HighContrastEnhancementFactor, double);
192 
194 
200  vtkSetClampMacro(AntiAlias, int, 0, VTK_INT_MAX);
201  vtkGetMacro(AntiAlias, int);
202  vtkBooleanMacro(AntiAlias, int);
204 
206 
210  vtkSetClampMacro(NumberOfSteps, int, 0, VTK_INT_MAX);
211  vtkGetMacro(NumberOfSteps, int);
213 
215 
222  vtkSetClampMacro(StepSize, double, 0.0, VTK_FLOAT_MAX);
223  vtkGetMacro(StepSize, double);
225 
227 
232  void SetComponentIds(int c0, int c1);
233  void SetComponentIds(int c[2]){ this->SetComponentIds(c[0], c[1]); }
234  vtkGetVector2Macro(ComponentIds, int);
236 
238 
243  vtkSetClampMacro(MaxNoiseValue, double, 0.0, 1.0);
244  vtkGetMacro(MaxNoiseValue, double);
246 
248 
254  void SetTransformVectors(int val);
255  vtkGetMacro(TransformVectors, int);
257 
279  void SetNormalizeVectors(int val);
280  vtkGetMacro(NormalizeVectors, int);
282 
284 
293  vtkSetClampMacro(MaskThreshold, double, -1.0, VTK_FLOAT_MAX);
294  vtkGetMacro(MaskThreshold, double);
296 
297 
301  vtkTextureObject *Execute(
302  vtkTextureObject *vectorTex,
303  vtkTextureObject *noiseTex);
304 
309  vtkTextureObject *Execute(
310  const int extent[4],
311  vtkTextureObject *vectorTex,
312  vtkTextureObject *noiseTex);
313 
325  vtkTextureObject *Execute(
326  const vtkPixelExtent &inputTexExtent,
327  const std::deque<vtkPixelExtent> &vectorExtent,
328  const std::deque<vtkPixelExtent> &licExtent,
329  vtkTextureObject *vectorTex,
330  vtkTextureObject *maskVectorTex,
331  vtkTextureObject *noiseTex);
332 
337  static
338  void SetVectorTexParameters(vtkTextureObject *vectors);
339 
340  static
341  void SetNoiseTexParameters(vtkTextureObject *noise);
342 
351  virtual vtkPainterCommunicator *GetCommunicator();
352 
357  virtual void GetGlobalMinMax(
359  float&,
360  float&) {}
361 
368  virtual void WriteTimerLog(const char *){}
369 
370 protected:
372  virtual ~vtkLineIntegralConvolution2D();
373 
374  void SetVTShader(vtkShaderProgram2 *prog);
375  void SetLIC0Shader(vtkShaderProgram2 *prog);
376  void SetLICIShader(vtkShaderProgram2 *prog);
377  void SetLICNShader(vtkShaderProgram2 *prog);
378  void SetEEShader(vtkShaderProgram2 *prog);
379  void SetCEShader(vtkShaderProgram2 *prog);
380  void SetAAHShader(vtkShaderProgram2 *prog);
381  void SetAAVShader(vtkShaderProgram2 *prog);
382 
383  void BuildShaders();
384 
385  void RenderQuad(
386  float computeBounds[4],
387  vtkPixelExtent computeExtent);
388 
389  vtkTextureObject *AllocateBuffer(unsigned int texSize[2]);
390 
395  void SetNoise2TexParameters(vtkTextureObject *noise);
396 
403  virtual void StartTimerEvent(const char *){}
404  virtual void EndTimerEvent(const char *){}
405 
406 protected:
408 
411 
421 
423  double StepSize;
433  int ComponentIds[2];
435 
436 private:
437  vtkLineIntegralConvolution2D(const vtkLineIntegralConvolution2D &) VTK_DELETE_FUNCTION;
438  void operator = (const vtkLineIntegralConvolution2D &) VTK_DELETE_FUNCTION;
439 };
440 
441 #endif
vtkWeakPointer< vtkRenderWindow > Context
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:153
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:161
GLSL Program.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void StartTimerEvent(const char *)
Methods used for parallel benchmarks.
abstracts an OpenGL texture object.
create a window for renderers to draw into
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 *)
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Interface to OpenGL framebuffer object.