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 =========================================================================*/
91 #ifndef vtkLineIntegralConvolution2D_h
92 #define vtkLineIntegralConvolution2D_h
93 
94 #include "vtkObject.h"
95 #include "vtkWeakPointer.h" // for ren context
96 #include "vtkRenderingLICModule.h" // for export macro
97 #include <deque> // for deque
98 
99 class vtkRenderWindow;
100 class vtkTextureObject;
101 class vtkPixelExtent;
102 class vtkShaderProgram2;
105 
107 {
108 public:
111  void PrintSelf(ostream & os, vtkIndent indent);
112 
114  static bool IsSupported(vtkRenderWindow * renWin);
115 
117 
119  void SetContext(vtkRenderWindow *context);
120  vtkRenderWindow *GetContext();
122 
124 
127  vtkSetClampMacro(EnhancedLIC, int, 0, 1);
128  vtkGetMacro(EnhancedLIC, int);
129  vtkBooleanMacro(EnhancedLIC, int);
131 
133 
146  enum {
147  ENHANCE_CONTRAST_OFF=0,
148  ENHANCE_CONTRAST_ON=1};
149  vtkSetClampMacro(EnhanceContrast, int, 0, 2);
150  vtkGetMacro(EnhanceContrast, int);
151  vtkBooleanMacro(EnhanceContrast, int);
153 
155 
168  vtkSetClampMacro(LowContrastEnhancementFactor, double, 0.0, 1.0);
169  vtkGetMacro(LowContrastEnhancementFactor, double);
170  vtkSetClampMacro(HighContrastEnhancementFactor, double, 0.0, 1.0);
171  vtkGetMacro(HighContrastEnhancementFactor, double);
173 
175 
179  vtkSetClampMacro(AntiAlias, int, 0, VTK_INT_MAX);
180  vtkGetMacro(AntiAlias, int);
181  vtkBooleanMacro(AntiAlias, int);
183 
185 
187  vtkSetClampMacro(NumberOfSteps, int, 0, VTK_INT_MAX);
188  vtkGetMacro(NumberOfSteps, int);
190 
192 
198  vtkSetClampMacro(StepSize, double, 0.0, VTK_FLOAT_MAX);
199  vtkGetMacro(StepSize, double);
201 
203 
206  void SetComponentIds(int c0, int c1);
207  void SetComponentIds(int c[2]){ this->SetComponentIds(c[0], c[1]); }
208  vtkGetVector2Macro(ComponentIds, int);
210 
212 
215  vtkSetClampMacro(MaxNoiseValue, double, 0.0, 1.0);
216  vtkGetMacro(MaxNoiseValue, double);
218 
220 
224  void SetTransformVectors(int val);
225  vtkGetMacro(TransformVectors, int);
227 
247  void SetNormalizeVectors(int val);
248  vtkGetMacro(NormalizeVectors, int);
250 
252 
258  vtkSetClampMacro(MaskThreshold, double, -1.0, VTK_FLOAT_MAX);
259  vtkGetMacro(MaskThreshold, double);
261 
262 
264 
265  vtkTextureObject *Execute(
266  vtkTextureObject *vectorTex,
267  vtkTextureObject *noiseTex);
269 
271 
272  vtkTextureObject *Execute(
273  const int extent[4],
274  vtkTextureObject *vectorTex,
275  vtkTextureObject *noiseTex);
277 
278  //BTX
280 
287  vtkTextureObject *Execute(
288  const vtkPixelExtent &inputTexExtent,
289  const std::deque<vtkPixelExtent> &vectorExtent,
290  const std::deque<vtkPixelExtent> &licExtent,
291  vtkTextureObject *vectorTex,
292  vtkTextureObject *maskVectorTex,
293  vtkTextureObject *noiseTex);
294  //ETX
296 
298 
300  static
301  void SetVectorTexParameters(vtkTextureObject *vectors);
303 
304  static
305  void SetNoiseTexParameters(vtkTextureObject *noise);
306 
307  //BTX
309 
314  virtual vtkPainterCommunicator *GetCommunicator();
316 
318 
319  virtual void GetGlobalMinMax(
321  float&,
322  float&) {}
323  //ETX
325 
330  virtual void WriteTimerLog(const char *){}
331 
332 protected:
334  virtual ~vtkLineIntegralConvolution2D();
335 
336  void SetVTShader(vtkShaderProgram2 *prog);
337  void SetLIC0Shader(vtkShaderProgram2 *prog);
338  void SetLICIShader(vtkShaderProgram2 *prog);
339  void SetLICNShader(vtkShaderProgram2 *prog);
340  void SetEEShader(vtkShaderProgram2 *prog);
341  void SetCEShader(vtkShaderProgram2 *prog);
342  void SetAAHShader(vtkShaderProgram2 *prog);
343  void SetAAVShader(vtkShaderProgram2 *prog);
344 
345  void BuildShaders();
346 
347  void RenderQuad(
348  float computeBounds[4],
349  vtkPixelExtent computeExtent);
350 
351  vtkTextureObject *AllocateBuffer(unsigned int texSize[2]);
352 
355  void SetNoise2TexParameters(vtkTextureObject *noise);
356 
358 
362  virtual void StartTimerEvent(const char *){}
363  virtual void EndTimerEvent(const char *){}
365 
366 protected:
368 
371 
381 
383  double StepSize;
393  int ComponentIds[2];
395 
396 private:
397  vtkLineIntegralConvolution2D(const vtkLineIntegralConvolution2D &); // Not implemented.
398  void operator = (const vtkLineIntegralConvolution2D &); // Not implemented.
399 };
400 
401 #endif
vtkWeakPointer< vtkRenderWindow > Context
abstract base class for most VTK objects
Definition: vtkObject.h:61
virtual void SetCommunicator(vtkPainterCommunicator *)
#define VTK_INT_MAX
Definition: vtkType.h:132
GPU-based implementation of Line Integral Convolution (LIC)
virtual void GetGlobalMinMax(vtkPainterCommunicator *, float &, float &)
virtual void WriteTimerLog(const char *)
#define VTK_FLOAT_MAX
Definition: vtkType.h:140
GLSL Program.
virtual void PrintSelf(ostream &os, vtkIndent indent)
#define VTKRENDERINGLIC_EXPORT
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void StartTimerEvent(const char *)
abstracts an OpenGL texture object.
create a window for renderers to draw into
virtual void EndTimerEvent(const char *)
static vtkObject * New()
Interface to OpenGL framebuffer object.