VTK
vtkSurfaceLICMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSurfaceLICMapper.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 =========================================================================*/
58 #ifndef vtkSurfaceLICMapper_h
59 #define vtkSurfaceLICMapper_h
60 
61 #include "vtkRenderingLICOpenGL2Module.h" // For export macro
62 #include "vtkOpenGLPolyDataMapper.h"
63 
64 class vtkRenderWindow;
65 class vtkRenderer;
66 class vtkActor;
67 class vtkImageData;
68 class vtkDataObject;
69 class vtkDataArray;
71 
72 class VTKRENDERINGLICOPENGL2_EXPORT vtkSurfaceLICMapper : public vtkOpenGLPolyDataMapper
73 {
74 public:
75  static vtkSurfaceLICMapper* New();
77  void PrintSelf(ostream& os, vtkIndent indent);
78 
82  virtual void ReleaseGraphicsResources(vtkWindow * win);
83 
88  virtual vtkDataObject* GetOutput();
89 
91 
92  void SetEnable(int val);
93  vtkGetMacro(Enable, int);
94  void SetEnableOn(){ this->SetEnable(1); }
95  void SetEnableOff(){ this->SetEnable(0); }
97 
99 
100  void SetNumberOfSteps(int val);
101  vtkGetMacro(NumberOfSteps, int);
103 
105 
106  void SetStepSize(double val);
107  vtkGetMacro(StepSize, double);
109 
111 
120  void SetNormalizeVectors(int val);
121  vtkBooleanMacro(NormalizeVectors, int);
122  vtkGetMacro(NormalizeVectors, int);
124 
126 
129  void SetMaskOnSurface(int val);
130  vtkBooleanMacro(MaskOnSurface, int);
131  vtkGetMacro(MaskOnSurface, int);
133 
135 
148  void SetMaskThreshold(double val);
149  vtkGetMacro(MaskThreshold, double);
151 
153 
156  void SetMaskColor(double *val);
157  void SetMaskColor(double r, double g, double b)
158  { double rgb[3]={r,g,b}; this->SetMaskColor(rgb); }
159  vtkGetVector3Macro(MaskColor, double);
161 
163 
167  void SetMaskIntensity(double val);
168  vtkGetMacro(MaskIntensity, double);
170 
172 
175  void SetEnhancedLIC(int val);
176  vtkGetMacro(EnhancedLIC, int);
177  vtkBooleanMacro(EnhancedLIC, int);
179 
181 
202  enum {
203  ENHANCE_CONTRAST_OFF=0,
204  ENHANCE_CONTRAST_LIC=1,
205  ENHANCE_CONTRAST_COLOR=3,
206  ENHANCE_CONTRAST_BOTH=4
207  };
208  void SetEnhanceContrast(int val);
209  vtkGetMacro(EnhanceContrast, int);
211 
213 
225  vtkGetMacro(LowLICContrastEnhancementFactor, double);
226  vtkGetMacro(HighLICContrastEnhancementFactor, double);
227  void SetLowLICContrastEnhancementFactor(double val);
228  void SetHighLICContrastEnhancementFactor(double val);
229  //
230  vtkGetMacro(LowColorContrastEnhancementFactor, double);
231  vtkGetMacro(HighColorContrastEnhancementFactor, double);
232  void SetLowColorContrastEnhancementFactor(double val);
233  void SetHighColorContrastEnhancementFactor(double val);
235 
237 
241  void SetAntiAlias(int val);
242  vtkBooleanMacro(AntiAlias, int);
243  vtkGetMacro(AntiAlias, int);
245 
247 
253  enum {
254  COLOR_MODE_BLEND=0,
255  COLOR_MODE_MAP
256  };
257  void SetColorMode(int val);
258  vtkGetMacro(ColorMode, int);
260 
262 
267  void SetLICIntensity(double val);
268  vtkGetMacro(LICIntensity, double);
270 
272 
277  void SetMapModeBias(double val);
278  vtkGetMacro(MapModeBias, double);
280 
282 
285  void SetNoiseDataSet(vtkImageData *data);
286  vtkImageData *GetNoiseDataSet();
288 
290 
306  void SetGenerateNoiseTexture(int shouldGenerate);
307  vtkGetMacro(GenerateNoiseTexture, int);
309 
311 
314  enum {
315  NOISE_TYPE_UNIFORM=0,
316  NOISE_TYPE_GAUSSIAN=1,
317  NOISE_TYPE_PERLIN=2
318  };
319  void SetNoiseType(int type);
320  vtkGetMacro(NoiseType, int);
322 
324 
326  void SetNoiseTextureSize(int length);
327  vtkGetMacro(NoiseTextureSize, int);
329 
331 
332  void SetNoiseGrainSize(int val);
333  vtkGetMacro(NoiseGrainSize, int);
335 
337 
341  void SetMinNoiseValue(double val);
342  void SetMaxNoiseValue(double val);
343  vtkGetMacro(MinNoiseValue, double);
344  vtkGetMacro(MaxNoiseValue, double);
346 
348 
350  void SetNumberOfNoiseLevels(int val);
351  vtkGetMacro(NumberOfNoiseLevels, int);
353 
355 
358  void SetImpulseNoiseProbability(double val);
359  vtkGetMacro(ImpulseNoiseProbability, double);
361 
363 
365  void SetImpulseNoiseBackgroundValue(double val);
366  vtkGetMacro(ImpulseNoiseBackgroundValue, double);
368 
370 
371  void SetNoiseGeneratorSeed(int val);
372  vtkGetMacro(NoiseGeneratorSeed, int);
374 
376 
377  enum {
378  COMPOSITE_INPLACE=0,
379  COMPOSITE_INPLACE_DISJOINT=1,
380  COMPOSITE_BALANCED=2,
381  COMPOSITE_AUTO=3
382  };
383  void SetCompositeStrategy(int val);
384  vtkGetMacro(CompositeStrategy, int);
386 
389  static bool IsSupported(vtkRenderWindow *context);
390 
395  virtual void WriteTimerLog(const char *){}
396 
398  virtual void RenderPiece(vtkRenderer *ren, vtkActor *act);
399 
402 
403 protected:
406 
410  virtual void ProcessInformation(vtkInformation* info);
411 
415  virtual void GetGlobalMinMax(vtkPainterCommunicator*, float&, float&){}
416 
418 
422  virtual void StartTimerEvent(const char *){}
423  virtual void EndTimerEvent(const char *){}
425 
430  virtual vtkPainterCommunicator *CreateCommunicator(int);
431 
434  void CreateCommunicator(vtkRenderer *, vtkActor *);
435 
437  virtual void ReportReferences(vtkGarbageCollector *collector);
438 
440  void UpdateNoiseImage(vtkRenderWindow *renWin);
441 
443  void ValidateContext(vtkRenderer *renderer);
444 
446 
447  bool NeedToUpdateOutputData();
448  virtual bool NeedToUpdateCommunicator();
449  bool NeedToRenderGeometry(vtkRenderer *renderer, vtkActor *actor);
450  bool NeedToGatherVectors();
451  bool NeedToComputeLIC();
452  bool NeedToColorLIC();
453  void SetUpdateAll();
455 
457 
458  bool PrepareOutput();
459  void InitializeResources();
461 
463 
464  bool VectorsToTCoords(vtkDataObject *dataObj);
465  bool VectorsToTCoords(vtkDataSet *dataObj);
466  void ClearTCoords(vtkDataSet *data);
468 
470  bool CanRenderSurfaceLIC(vtkActor *actor);
471 
472 protected:
473  // Unit is a pixel length.
475  double StepSize;
477 
485 
489  double MaskColor[3];
490 
492  double LICIntensity;
493  double MapModeBias;
494 
505 
507  int Enable;
509 
511  class vtkInternals;
512  vtkInternals* Internals;
513 
516  virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act);
517 
519 
520  virtual void ReplaceShaderValues(
521  std::map<vtkShader::Type, vtkShader *> shaders,
522  vtkRenderer *ren, vtkActor *act);
524 
525 private:
526  vtkSurfaceLICMapper(const vtkSurfaceLICMapper&); // Not implemented.
527  void operator=(const vtkSurfaceLICMapper&); // Not implemented.
528 };
529 
530 #endif
a PolyDataMapper for the OpenGL library
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
static vtkOpenGLPolyDataMapper * New()
mapper that performs LIC on the surface of arbitrary geometry.
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
void SetMaskColor(double r, double g, double b)
abstract specification for renderers
Definition: vtkRenderer.h:62
virtual void SetColorMode(int)
Detect and break reference loops.
virtual void ReportReferences(vtkGarbageCollector *)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
virtual void StartTimerEvent(const char *)
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual void WriteTimerLog(const char *)
virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkRenderer *ren, vtkActor *act)
abstract class specifies interface to map data
void ShallowCopy(vtkAbstractMapper *m)
create a window for renderers to draw into
virtual void EndTimerEvent(const char *)
virtual void RenderPiece(vtkRenderer *ren, vtkActor *a)
void ReleaseGraphicsResources(vtkWindow *)
general representation of visualization data
Definition: vtkDataObject.h:64
virtual void PrintSelf(ostream &os, vtkIndent indent)
virtual void ReplaceShaderValues(std::map< vtkShader::Type, vtkShader * > shaders, vtkRenderer *ren, vtkActor *act)
virtual void GetGlobalMinMax(vtkPainterCommunicator *, float &, float &)