VTK  9.0.1
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 "vtkRenderingLICOpenGL2Module.h" // for export macro
97 #include "vtkWeakPointer.h" // for ren context
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  {
165  ENHANCE_CONTRAST_OFF = 0,
166  ENHANCE_CONTRAST_ON = 1
167  };
168  vtkSetClampMacro(EnhanceContrast, int, 0, 2);
169  vtkGetMacro(EnhanceContrast, int);
170  vtkBooleanMacro(EnhanceContrast, int);
172 
174 
191  vtkSetClampMacro(LowContrastEnhancementFactor, double, 0.0, 1.0);
192  vtkGetMacro(LowContrastEnhancementFactor, double);
193  vtkSetClampMacro(HighContrastEnhancementFactor, double, 0.0, 1.0);
194  vtkGetMacro(HighContrastEnhancementFactor, double);
196 
198 
204  vtkSetClampMacro(AntiAlias, int, 0, VTK_INT_MAX);
205  vtkGetMacro(AntiAlias, int);
206  vtkBooleanMacro(AntiAlias, int);
208 
210 
214  vtkSetClampMacro(NumberOfSteps, int, 0, VTK_INT_MAX);
215  vtkGetMacro(NumberOfSteps, int);
217 
219 
226  vtkSetClampMacro(StepSize, double, 0.0, VTK_FLOAT_MAX);
227  vtkGetMacro(StepSize, double);
229 
231 
236  void SetComponentIds(int c0, int c1);
237  void SetComponentIds(int c[2]) { this->SetComponentIds(c[0], c[1]); }
238  vtkGetVector2Macro(ComponentIds, int);
240 
242 
247  vtkSetClampMacro(MaxNoiseValue, double, 0.0, 1.0);
248  vtkGetMacro(MaxNoiseValue, double);
250 
252 
258  void SetTransformVectors(int val);
259  vtkGetMacro(TransformVectors, int);
261 
283  void SetNormalizeVectors(int val);
284  vtkGetMacro(NormalizeVectors, int);
286 
288 
297  vtkSetClampMacro(MaskThreshold, double, -1.0, VTK_FLOAT_MAX);
298  vtkGetMacro(MaskThreshold, double);
300 
304  vtkTextureObject* Execute(vtkTextureObject* vectorTex, vtkTextureObject* noiseTex);
305 
310  vtkTextureObject* Execute(
311  const int extent[4], vtkTextureObject* vectorTex, vtkTextureObject* noiseTex);
312 
324  vtkTextureObject* Execute(const vtkPixelExtent& inputTexExtent,
325  const std::deque<vtkPixelExtent>& vectorExtent, const std::deque<vtkPixelExtent>& licExtent,
326  vtkTextureObject* vectorTex, vtkTextureObject* maskVectorTex, vtkTextureObject* noiseTex);
327 
332  static void SetVectorTexParameters(vtkTextureObject* vectors);
333 
334  static void SetNoiseTexParameters(vtkTextureObject* noise);
335 
344  virtual vtkPainterCommunicator* GetCommunicator();
345 
350  virtual void GetGlobalMinMax(vtkPainterCommunicator*, float&, float&) {}
351 
358  virtual void WriteTimerLog(const char*) {}
359 
360 protected:
362  ~vtkLineIntegralConvolution2D() override;
363 
365 
366  void SetVTShader(vtkShaderProgram* prog);
367  void SetLIC0Shader(vtkShaderProgram* prog);
368  void SetLICIShader(vtkShaderProgram* prog);
369  void SetLICNShader(vtkShaderProgram* prog);
370  void SetEEShader(vtkShaderProgram* prog);
371  void SetCEShader(vtkShaderProgram* prog);
372  void SetAAHShader(vtkShaderProgram* prog);
373  void SetAAVShader(vtkShaderProgram* prog);
374 
375  void BuildShaders();
376 
377  void RenderQuad(float computeBounds[4], vtkPixelExtent computeExtent);
378 
379  vtkTextureObject* AllocateBuffer(unsigned int texSize[2]);
380 
385  void SetNoise2TexParameters(vtkTextureObject* noise);
386 
393  virtual void StartTimerEvent(const char*) {}
394  virtual void EndTimerEvent(const char*) {}
395 
396 protected:
399 
411 
413  double StepSize;
423  int ComponentIds[2];
425 
426 private:
428  void operator=(const vtkLineIntegralConvolution2D&) = delete;
429 };
430 
431 #endif
vtkLineIntegralConvolution2D::LICNShader
vtkOpenGLHelper * LICNShader
Definition: vtkLineIntegralConvolution2D.h:406
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkLineIntegralConvolution2D::FinalBlendProgram
vtkOpenGLHelper * FinalBlendProgram
Definition: vtkLineIntegralConvolution2D.h:401
vtkLineIntegralConvolution2D::LIC0Shader
vtkOpenGLHelper * LIC0Shader
Definition: vtkLineIntegralConvolution2D.h:404
vtkLineIntegralConvolution2D::EndTimerEvent
virtual void EndTimerEvent(const char *)
Definition: vtkLineIntegralConvolution2D.h:394
vtkLineIntegralConvolution2D::FBO
vtkOpenGLFramebufferObject * FBO
Definition: vtkLineIntegralConvolution2D.h:398
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:181
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkLineIntegralConvolution2D::StepSize
double StepSize
Definition: vtkLineIntegralConvolution2D.h:413
vtkLineIntegralConvolution2D::NoiseTextureLookupCompatibilityMode
int NoiseTextureLookupCompatibilityMode
Definition: vtkLineIntegralConvolution2D.h:419
vtkLineIntegralConvolution2D::NormalizeVectors
int NormalizeVectors
Definition: vtkLineIntegralConvolution2D.h:422
vtkLineIntegralConvolution2D::SetComponentIds
void SetComponentIds(int c[2])
Definition: vtkLineIntegralConvolution2D.h:237
vtkLineIntegralConvolution2D::HighContrastEnhancementFactor
double HighContrastEnhancementFactor
Definition: vtkLineIntegralConvolution2D.h:417
vtkLineIntegralConvolution2D::StartTimerEvent
virtual void StartTimerEvent(const char *)
Methods used for parallel benchmarks.
Definition: vtkLineIntegralConvolution2D.h:393
vtkPixelExtent
Definition: vtkPixelExtent.h:38
vtkLineIntegralConvolution2D::Context
vtkWeakPointer< vtkOpenGLRenderWindow > Context
Definition: vtkLineIntegralConvolution2D.h:397
vtkLineIntegralConvolution2D::Comm
vtkPainterCommunicator * Comm
Definition: vtkLineIntegralConvolution2D.h:364
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:44
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:30
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:40
vtkLineIntegralConvolution2D::ShadersNeedBuild
int ShadersNeedBuild
Definition: vtkLineIntegralConvolution2D.h:400
vtkLineIntegralConvolution2D::EnhancedLIC
int EnhancedLIC
Definition: vtkLineIntegralConvolution2D.h:414
vtkLineIntegralConvolution2D::MaskThreshold
double MaskThreshold
Definition: vtkLineIntegralConvolution2D.h:420
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:163
vtkLineIntegralConvolution2D::EnhanceContrast
int EnhanceContrast
Definition: vtkLineIntegralConvolution2D.h:415
vtkLineIntegralConvolution2D::LowContrastEnhancementFactor
double LowContrastEnhancementFactor
Definition: vtkLineIntegralConvolution2D.h:416
vtkObject.h
vtkPainterCommunicator
A communicator that can safely be used inside a painter.
Definition: vtkPainterCommunicator.h:30
vtkLineIntegralConvolution2D::EEShader
vtkOpenGLHelper * EEShader
Definition: vtkLineIntegralConvolution2D.h:407
vtkLineIntegralConvolution2D::AAVShader
vtkOpenGLHelper * AAVShader
Definition: vtkLineIntegralConvolution2D.h:410
vtkLineIntegralConvolution2D
GPU-based implementation of Line Integral Convolution (LIC)
Definition: vtkLineIntegralConvolution2D.h:109
vtkLineIntegralConvolution2D::TransformVectors
int TransformVectors
Definition: vtkLineIntegralConvolution2D.h:421
vtkLineIntegralConvolution2D::IntermediateBlendProgram
vtkOpenGLHelper * IntermediateBlendProgram
Definition: vtkLineIntegralConvolution2D.h:402
vtkLineIntegralConvolution2D::LICIShader
vtkOpenGLHelper * LICIShader
Definition: vtkLineIntegralConvolution2D.h:405
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:51
vtkX3D::extent
@ extent
Definition: vtkX3D.h:351
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:343
vtkLineIntegralConvolution2D::MaxNoiseValue
double MaxNoiseValue
Definition: vtkLineIntegralConvolution2D.h:424
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:93
vtkLineIntegralConvolution2D::CEShader
vtkOpenGLHelper * CEShader
Definition: vtkLineIntegralConvolution2D.h:408
vtkLineIntegralConvolution2D::WriteTimerLog
virtual void WriteTimerLog(const char *)
Methods used for parallel benchmarks.
Definition: vtkLineIntegralConvolution2D.h:358
vtkLineIntegralConvolution2D::GetGlobalMinMax
virtual void GetGlobalMinMax(vtkPainterCommunicator *, float &, float &)
For parallel operation, find global min/max min/max are in/out.
Definition: vtkLineIntegralConvolution2D.h:350
vtkLineIntegralConvolution2D::VTShader
vtkOpenGLHelper * VTShader
Definition: vtkLineIntegralConvolution2D.h:403
vtkWeakPointer< vtkOpenGLRenderWindow >
vtkLineIntegralConvolution2D::AAHShader
vtkOpenGLHelper * AAHShader
Definition: vtkLineIntegralConvolution2D.h:409
vtkLineIntegralConvolution2D::AntiAlias
int AntiAlias
Definition: vtkLineIntegralConvolution2D.h:418
vtkLineIntegralConvolution2D::NumberOfSteps
int NumberOfSteps
Definition: vtkLineIntegralConvolution2D.h:412