VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkLineIntegralConvolution2D.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00091 #ifndef __vtkLineIntegralConvolution2D_h 00092 #define __vtkLineIntegralConvolution2D_h 00093 00094 #include "vtkObject.h" 00095 #include "vtkWeakPointer.h" // for ren context 00096 #include "vtkRenderingLICModule.h" // for export macro 00097 #include <deque> // for deque 00098 00099 class vtkRenderWindow; 00100 class vtkTextureObject; 00101 class vtkPixelExtent; 00102 class vtkShaderProgram2; 00103 class vtkFrameBufferObject2; 00104 class vtkPainterCommunicator; 00105 00106 class VTKRENDERINGLIC_EXPORT vtkLineIntegralConvolution2D : public vtkObject 00107 { 00108 public: 00109 static vtkLineIntegralConvolution2D *New(); 00110 vtkTypeMacro(vtkLineIntegralConvolution2D, vtkObject); 00111 void PrintSelf(ostream & os, vtkIndent indent); 00112 00114 static bool IsSupported(vtkRenderWindow * renWin); 00115 00117 00119 void SetContext(vtkRenderWindow *context); 00120 vtkRenderWindow *GetContext(); 00122 00124 00127 vtkSetClampMacro(EnhancedLIC, int, 0, 1); 00128 vtkGetMacro(EnhancedLIC, int); 00129 vtkBooleanMacro(EnhancedLIC, int); 00131 00133 00146 enum { 00147 ENHANCE_CONTRAST_OFF=0, 00148 ENHANCE_CONTRAST_ON=1}; 00149 vtkSetClampMacro(EnhanceContrast, int, 0, 2); 00150 vtkGetMacro(EnhanceContrast, int); 00151 vtkBooleanMacro(EnhanceContrast, int); 00153 00155 00168 vtkSetClampMacro(LowContrastEnhancementFactor, double, 0.0, 1.0); 00169 vtkGetMacro(LowContrastEnhancementFactor, double); 00170 vtkSetClampMacro(HighContrastEnhancementFactor, double, 0.0, 1.0); 00171 vtkGetMacro(HighContrastEnhancementFactor, double); 00173 00175 00179 vtkSetClampMacro(AntiAlias, int, 0, VTK_INT_MAX); 00180 vtkGetMacro(AntiAlias, int); 00181 vtkBooleanMacro(AntiAlias, int); 00183 00185 00187 vtkSetClampMacro(NumberOfSteps, int, 0, VTK_INT_MAX); 00188 vtkGetMacro(NumberOfSteps, int); 00190 00192 00198 vtkSetClampMacro(StepSize, double, 0.0, VTK_FLOAT_MAX); 00199 vtkGetMacro(StepSize, double); 00201 00203 00206 void SetComponentIds(int c0, int c1); 00207 void SetComponentIds(int c[2]){ this->SetComponentIds(c[0], c[1]); } 00208 vtkGetVector2Macro(ComponentIds, int); 00210 00212 00215 vtkSetClampMacro(MaxNoiseValue, double, 0.0, 1.0); 00216 vtkGetMacro(MaxNoiseValue, double); 00218 00220 00224 void SetTransformVectors(int val); 00225 vtkGetMacro(TransformVectors, int); 00227 00247 void SetNormalizeVectors(int val); 00248 vtkGetMacro(NormalizeVectors, int); 00250 00252 00258 vtkSetClampMacro(MaskThreshold, double, -1.0, VTK_FLOAT_MAX); 00259 vtkGetMacro(MaskThreshold, double); 00261 00262 00264 00265 vtkTextureObject *Execute( 00266 vtkTextureObject *vectorTex, 00267 vtkTextureObject *noiseTex); 00269 00271 00272 vtkTextureObject *Execute( 00273 const int extent[4], 00274 vtkTextureObject *vectorTex, 00275 vtkTextureObject *noiseTex); 00277 00278 //BTX 00280 00287 vtkTextureObject *Execute( 00288 const vtkPixelExtent &inputTexExtent, 00289 const std::deque<vtkPixelExtent> &vectorExtent, 00290 const std::deque<vtkPixelExtent> &licExtent, 00291 vtkTextureObject *vectorTex, 00292 vtkTextureObject *maskVectorTex, 00293 vtkTextureObject *noiseTex); 00294 //ETX 00296 00298 00300 static 00301 void SetVectorTexParameters(vtkTextureObject *vectors); 00303 00304 static 00305 void SetNoiseTexParameters(vtkTextureObject *noise); 00306 00307 //BTX 00309 00313 virtual void SetCommunicator(vtkPainterCommunicator *){} 00314 virtual vtkPainterCommunicator *GetCommunicator(); 00316 00318 00319 virtual void GetGlobalMinMax( 00320 vtkPainterCommunicator*, 00321 float&, 00322 float&) {} 00323 //ETX 00325 00330 virtual void WriteTimerLog(const char *){} 00331 00332 protected: 00333 vtkLineIntegralConvolution2D(); 00334 virtual ~vtkLineIntegralConvolution2D(); 00335 00336 void SetVTShader(vtkShaderProgram2 *prog); 00337 void SetLIC0Shader(vtkShaderProgram2 *prog); 00338 void SetLICIShader(vtkShaderProgram2 *prog); 00339 void SetLICNShader(vtkShaderProgram2 *prog); 00340 void SetEEShader(vtkShaderProgram2 *prog); 00341 void SetCEShader(vtkShaderProgram2 *prog); 00342 void SetAAHShader(vtkShaderProgram2 *prog); 00343 void SetAAVShader(vtkShaderProgram2 *prog); 00344 00345 void BuildShaders(); 00346 00347 void RenderQuad( 00348 float computeBounds[4], 00349 vtkPixelExtent computeExtent); 00350 00351 vtkTextureObject *AllocateBuffer(unsigned int texSize[2]); 00352 00355 void SetNoise2TexParameters(vtkTextureObject *noise); 00356 00358 00362 virtual void StartTimerEvent(const char *){} 00363 virtual void EndTimerEvent(const char *){} 00365 00366 protected: 00367 vtkPainterCommunicator *Comm; 00368 00369 vtkWeakPointer<vtkRenderWindow> Context; 00370 vtkFrameBufferObject2 *FBO; 00371 00372 int ShadersNeedBuild; 00373 vtkShaderProgram2 *VTShader; 00374 vtkShaderProgram2 *LIC0Shader; 00375 vtkShaderProgram2 *LICIShader; 00376 vtkShaderProgram2 *LICNShader; 00377 vtkShaderProgram2 *EEShader; 00378 vtkShaderProgram2 *CEShader; 00379 vtkShaderProgram2 *AAHShader; 00380 vtkShaderProgram2 *AAVShader; 00381 00382 int NumberOfSteps; 00383 double StepSize; 00384 int EnhancedLIC; 00385 int EnhanceContrast; 00386 double LowContrastEnhancementFactor; 00387 double HighContrastEnhancementFactor; 00388 int AntiAlias; 00389 int NoiseTextureLookupCompatibilityMode; 00390 double MaskThreshold; 00391 int TransformVectors; 00392 int NormalizeVectors; 00393 int ComponentIds[2]; 00394 double MaxNoiseValue; 00395 00396 private: 00397 vtkLineIntegralConvolution2D(const vtkLineIntegralConvolution2D &); // Not implemented. 00398 void operator = (const vtkLineIntegralConvolution2D &); // Not implemented. 00399 }; 00400 00401 #endif