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 "vtkRenderingLICOpenGL2Module.h" // for export macro
97 #include <deque> // for deque
98 
100 class vtkOpenGLHelper;
103 class vtkPixelExtent;
104 class vtkRenderWindow;
105 class vtkShaderProgram;
106 class vtkTextureObject;
107 
108 class VTKRENDERINGLICOPENGL2_EXPORT vtkLineIntegralConvolution2D : public vtkObject
109 {
110 public:
113  void PrintSelf(ostream & os, vtkIndent indent);
114 
116  static bool IsSupported(vtkRenderWindow * renWin);
117 
119 
121  void SetContext(vtkOpenGLRenderWindow *context);
122  vtkOpenGLRenderWindow *GetContext();
124 
126 
129  vtkSetClampMacro(EnhancedLIC, int, 0, 1);
130  vtkGetMacro(EnhancedLIC, int);
131  vtkBooleanMacro(EnhancedLIC, int);
133 
135 
148  enum {
149  ENHANCE_CONTRAST_OFF=0,
150  ENHANCE_CONTRAST_ON=1};
151  vtkSetClampMacro(EnhanceContrast, int, 0, 2);
152  vtkGetMacro(EnhanceContrast, int);
153  vtkBooleanMacro(EnhanceContrast, int);
155 
157 
170  vtkSetClampMacro(LowContrastEnhancementFactor, double, 0.0, 1.0);
171  vtkGetMacro(LowContrastEnhancementFactor, double);
172  vtkSetClampMacro(HighContrastEnhancementFactor, double, 0.0, 1.0);
173  vtkGetMacro(HighContrastEnhancementFactor, double);
175 
177 
181  vtkSetClampMacro(AntiAlias, int, 0, VTK_INT_MAX);
182  vtkGetMacro(AntiAlias, int);
183  vtkBooleanMacro(AntiAlias, int);
185 
187 
189  vtkSetClampMacro(NumberOfSteps, int, 0, VTK_INT_MAX);
190  vtkGetMacro(NumberOfSteps, int);
192 
194 
200  vtkSetClampMacro(StepSize, double, 0.0, VTK_FLOAT_MAX);
201  vtkGetMacro(StepSize, double);
203 
205 
208  void SetComponentIds(int c0, int c1);
209  void SetComponentIds(int c[2]){ this->SetComponentIds(c[0], c[1]); }
210  vtkGetVector2Macro(ComponentIds, int);
212 
214 
217  vtkSetClampMacro(MaxNoiseValue, double, 0.0, 1.0);
218  vtkGetMacro(MaxNoiseValue, double);
220 
222 
226  void SetTransformVectors(int val);
227  vtkGetMacro(TransformVectors, int);
229 
249  void SetNormalizeVectors(int val);
250  vtkGetMacro(NormalizeVectors, int);
252 
254 
260  vtkSetClampMacro(MaskThreshold, double, -1.0, VTK_FLOAT_MAX);
261  vtkGetMacro(MaskThreshold, double);
263 
264 
266 
267  vtkTextureObject *Execute(
268  vtkTextureObject *vectorTex,
269  vtkTextureObject *noiseTex);
271 
273 
274  vtkTextureObject *Execute(
275  const int extent[4],
276  vtkTextureObject *vectorTex,
277  vtkTextureObject *noiseTex);
279 
280  //BTX
282 
289  vtkTextureObject *Execute(
290  const vtkPixelExtent &inputTexExtent,
291  const std::deque<vtkPixelExtent> &vectorExtent,
292  const std::deque<vtkPixelExtent> &licExtent,
293  vtkTextureObject *vectorTex,
294  vtkTextureObject *maskVectorTex,
295  vtkTextureObject *noiseTex);
296  //ETX
298 
300 
302  static
303  void SetVectorTexParameters(vtkTextureObject *vectors);
305 
306  static
307  void SetNoiseTexParameters(vtkTextureObject *noise);
308 
309  //BTX
311 
316  virtual vtkPainterCommunicator *GetCommunicator();
318 
320 
321  virtual void GetGlobalMinMax(
323  float&,
324  float&) {}
325  //ETX
327 
332  virtual void WriteTimerLog(const char *){}
333 
334 protected:
336  virtual ~vtkLineIntegralConvolution2D();
337 
339 
340  void SetVTShader(vtkShaderProgram *prog);
341  void SetLIC0Shader(vtkShaderProgram *prog);
342  void SetLICIShader(vtkShaderProgram *prog);
343  void SetLICNShader(vtkShaderProgram *prog);
344  void SetEEShader(vtkShaderProgram *prog);
345  void SetCEShader(vtkShaderProgram *prog);
346  void SetAAHShader(vtkShaderProgram *prog);
347  void SetAAVShader(vtkShaderProgram *prog);
348 
349  void BuildShaders();
350 
351  void RenderQuad(
352  float computeBounds[4],
353  vtkPixelExtent computeExtent);
354 
355  vtkTextureObject *AllocateBuffer(unsigned int texSize[2]);
356 
359  void SetNoise2TexParameters(vtkTextureObject *noise);
360 
362 
366  virtual void StartTimerEvent(const char *){}
367  virtual void EndTimerEvent(const char *){}
369 
370 protected:
373 
374  int ShadersNeedBuild;
385 
386  int NumberOfSteps;
387  double StepSize;
388  int EnhancedLIC;
389  int EnhanceContrast;
390  double LowContrastEnhancementFactor;
391  double HighContrastEnhancementFactor;
392  int AntiAlias;
393  int NoiseTextureLookupCompatibilityMode;
394  double MaskThreshold;
395  int TransformVectors;
396  int NormalizeVectors;
397  int ComponentIds[2];
398  double MaxNoiseValue;
399 
400 private:
401  vtkLineIntegralConvolution2D(const vtkLineIntegralConvolution2D &); // Not implemented.
402  void operator = (const vtkLineIntegralConvolution2D &); // Not implemented.
403 };
404 
405 #endif
OpenGL rendering window.
abstract base class for most VTK objects
Definition: vtkObject.h:61
virtual void SetCommunicator(vtkPainterCommunicator *)
#define VTK_INT_MAX
Definition: vtkType.h:130
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:138
virtual void PrintSelf(ostream &os, vtkIndent indent)
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
vtkWeakPointer< vtkOpenGLRenderWindow > Context
virtual void EndTimerEvent(const char *)
static vtkObject * New()
Interface to OpenGL framebuffer object.
The ShaderProgram uses one or more Shader objects.