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
vtkLineIntegralConvolution2D::LICNShader
vtkOpenGLHelper * LICNShader
Definition: vtkLineIntegralConvolution2D.h:420
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:159
vtkLineIntegralConvolution2D::FinalBlendProgram
vtkOpenGLHelper * FinalBlendProgram
Definition: vtkLineIntegralConvolution2D.h:415
vtkLineIntegralConvolution2D::LIC0Shader
vtkOpenGLHelper * LIC0Shader
Definition: vtkLineIntegralConvolution2D.h:418
vtkLineIntegralConvolution2D::EndTimerEvent
virtual void EndTimerEvent(const char *)
Definition: vtkLineIntegralConvolution2D.h:408
vtkLineIntegralConvolution2D::FBO
vtkOpenGLFramebufferObject * FBO
Definition: vtkLineIntegralConvolution2D.h:412
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkOpenGLFramebufferObject
Internal class which encapsulates OpenGL FramebufferObject.
Definition: vtkOpenGLFramebufferObject.h:182
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkLineIntegralConvolution2D::StepSize
double StepSize
Definition: vtkLineIntegralConvolution2D.h:427
vtkLineIntegralConvolution2D::NoiseTextureLookupCompatibilityMode
int NoiseTextureLookupCompatibilityMode
Definition: vtkLineIntegralConvolution2D.h:433
vtkLineIntegralConvolution2D::NormalizeVectors
int NormalizeVectors
Definition: vtkLineIntegralConvolution2D.h:436
vtkLineIntegralConvolution2D::SetComponentIds
void SetComponentIds(int c[2])
Definition: vtkLineIntegralConvolution2D.h:235
vtkLineIntegralConvolution2D::HighContrastEnhancementFactor
double HighContrastEnhancementFactor
Definition: vtkLineIntegralConvolution2D.h:431
vtkLineIntegralConvolution2D::StartTimerEvent
virtual void StartTimerEvent(const char *)
Methods used for parallel benchmarks.
Definition: vtkLineIntegralConvolution2D.h:407
vtkPixelExtent
Definition: vtkPixelExtent.h:41
vtkLineIntegralConvolution2D::Context
vtkWeakPointer< vtkOpenGLRenderWindow > Context
Definition: vtkLineIntegralConvolution2D.h:411
vtkLineIntegralConvolution2D::Comm
vtkPainterCommunicator * Comm
Definition: vtkLineIntegralConvolution2D.h:376
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:47
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:30
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:44
vtkLineIntegralConvolution2D::ShadersNeedBuild
int ShadersNeedBuild
Definition: vtkLineIntegralConvolution2D.h:414
vtkLineIntegralConvolution2D::EnhancedLIC
int EnhancedLIC
Definition: vtkLineIntegralConvolution2D.h:428
vtkLineIntegralConvolution2D::MaskThreshold
double MaskThreshold
Definition: vtkLineIntegralConvolution2D.h:434
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWeakPointer.h
VTK_FLOAT_MAX
#define VTK_FLOAT_MAX
Definition: vtkType.h:167
vtkLineIntegralConvolution2D::EnhanceContrast
int EnhanceContrast
Definition: vtkLineIntegralConvolution2D.h:429
vtkLineIntegralConvolution2D::LowContrastEnhancementFactor
double LowContrastEnhancementFactor
Definition: vtkLineIntegralConvolution2D.h:430
vtkObject.h
vtkPainterCommunicator
A communicator that can safely be used inside a painter.
Definition: vtkPainterCommunicator.h:30
vtkLineIntegralConvolution2D::EEShader
vtkOpenGLHelper * EEShader
Definition: vtkLineIntegralConvolution2D.h:421
vtkLineIntegralConvolution2D::AAVShader
vtkOpenGLHelper * AAVShader
Definition: vtkLineIntegralConvolution2D.h:424
vtkLineIntegralConvolution2D
GPU-based implementation of Line Integral Convolution (LIC)
Definition: vtkLineIntegralConvolution2D.h:109
vtkLineIntegralConvolution2D::TransformVectors
int TransformVectors
Definition: vtkLineIntegralConvolution2D.h:435
vtkLineIntegralConvolution2D::IntermediateBlendProgram
vtkOpenGLHelper * IntermediateBlendProgram
Definition: vtkLineIntegralConvolution2D.h:416
vtkLineIntegralConvolution2D::LICIShader
vtkOpenGLHelper * LICIShader
Definition: vtkLineIntegralConvolution2D.h:419
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:53
vtkX3D::extent
Definition: vtkX3D.h:345
vtkLineIntegralConvolution2D::SetCommunicator
virtual void SetCommunicator(vtkPainterCommunicator *)
Set the communicator to use during parallel operation The communicator will not be duplicated or refe...
Definition: vtkLineIntegralConvolution2D.h:352
vtkLineIntegralConvolution2D::MaxNoiseValue
double MaxNoiseValue
Definition: vtkLineIntegralConvolution2D.h:438
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:87
vtkLineIntegralConvolution2D::CEShader
vtkOpenGLHelper * CEShader
Definition: vtkLineIntegralConvolution2D.h:422
vtkLineIntegralConvolution2D::WriteTimerLog
virtual void WriteTimerLog(const char *)
Methods used for parallel benchmarks.
Definition: vtkLineIntegralConvolution2D.h:370
vtkLineIntegralConvolution2D::GetGlobalMinMax
virtual void GetGlobalMinMax(vtkPainterCommunicator *, float &, float &)
For parallel operation, find global min/max min/max are in/out.
Definition: vtkLineIntegralConvolution2D.h:359
vtkLineIntegralConvolution2D::VTShader
vtkOpenGLHelper * VTShader
Definition: vtkLineIntegralConvolution2D.h:417
vtkWeakPointer< vtkOpenGLRenderWindow >
vtkLineIntegralConvolution2D::AAHShader
vtkOpenGLHelper * AAHShader
Definition: vtkLineIntegralConvolution2D.h:423
vtkLineIntegralConvolution2D::AntiAlias
int AntiAlias
Definition: vtkLineIntegralConvolution2D.h:432
vtkLineIntegralConvolution2D::NumberOfSteps
int NumberOfSteps
Definition: vtkLineIntegralConvolution2D.h:426