VTK
vtkMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMapper.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 =========================================================================*/
60 #ifndef __vtkMapper_h
61 #define __vtkMapper_h
62 
63 #include "vtkAbstractMapper3D.h"
64 #include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
65 
66 #define VTK_RESOLVE_OFF 0
67 #define VTK_RESOLVE_POLYGON_OFFSET 1
68 #define VTK_RESOLVE_SHIFT_ZBUFFER 2
69 
70 #define VTK_GET_ARRAY_BY_ID 0
71 #define VTK_GET_ARRAY_BY_NAME 1
72 
73 #define VTK_MATERIALMODE_DEFAULT 0
74 #define VTK_MATERIALMODE_AMBIENT 1
75 #define VTK_MATERIALMODE_DIFFUSE 2
76 #define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE 3
77 
78 class vtkWindow;
79 class vtkRenderer;
80 class vtkActor;
81 class vtkDataSet;
82 class vtkFloatArray;
83 class vtkImageData;
84 
86 {
87 public:
89  void PrintSelf(ostream& os, vtkIndent indent);
90 
93 
96  unsigned long GetMTime();
97 
100  virtual void Render(vtkRenderer *ren, vtkActor *a) = 0;
101 
106 
108 
109  void SetLookupTable(vtkScalarsToColors *lut);
110  vtkScalarsToColors *GetLookupTable();
112 
115  virtual void CreateDefaultLookupTable();
116 
118 
120  vtkSetMacro(ScalarVisibility,int);
121  vtkGetMacro(ScalarVisibility,int);
122  vtkBooleanMacro(ScalarVisibility,int);
124 
126 
130  vtkSetMacro(Static,int);
131  vtkGetMacro(Static,int);
132  vtkBooleanMacro(Static,int);
134 
136 
143  vtkSetMacro(ColorMode,int);
144  vtkGetMacro(ColorMode,int);
146  {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);};
148  {this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS);};
150 
152  const char *GetColorModeAsString();
153 
155 
158  vtkSetMacro(InterpolateScalarsBeforeMapping,int);
159  vtkGetMacro(InterpolateScalarsBeforeMapping,int);
160  vtkBooleanMacro(InterpolateScalarsBeforeMapping,int);
162 
164 
170  vtkSetMacro(UseLookupTableScalarRange,int);
171  vtkGetMacro(UseLookupTableScalarRange,int);
172  vtkBooleanMacro(UseLookupTableScalarRange,int);
174 
176 
179  vtkSetVector2Macro(ScalarRange,double);
180  vtkGetVectorMacro(ScalarRange,double,2);
182 
184 
189  vtkSetMacro(ImmediateModeRendering,int);
190  vtkGetMacro(ImmediateModeRendering,int);
191  vtkBooleanMacro(ImmediateModeRendering,int);
193 
195 
200  static void SetGlobalImmediateModeRendering(int val);
205  static int GetGlobalImmediateModeRendering();
207 
208  //BTX
210 
217  vtkGetMacro(ForceCompileOnly,int);
218  void SetForceCompileOnly(int value);
219  //ETX
221 
223 
238  vtkSetMacro(ScalarMode,int);
239  vtkGetMacro(ScalarMode,int);
241  this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT);};
243  this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA);};
245  this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA);};
247  this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);};
249  this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA);};
251  this->SetScalarMode(VTK_SCALAR_MODE_USE_FIELD_DATA); }
253 
255 
258  void SelectColorArray(int arrayNum);
259  void SelectColorArray(const char* arrayName);
261 
263 
265  void ColorByArrayComponent(int arrayNum, int component);
266  void ColorByArrayComponent(const char* arrayName, int component);
268 
270 
271  char* GetArrayName() { return this->ArrayName; }
272  int GetArrayId() { return this->ArrayId; }
273  int GetArrayAccessMode() { return this->ArrayAccessMode; }
274  int GetArrayComponent() { return this->ArrayComponent; }
276 
278  const char *GetScalarModeAsString();
279 
281 
291  static void SetResolveCoincidentTopology(int val);
292  static int GetResolveCoincidentTopology();
293  static void SetResolveCoincidentTopologyToDefault();
295  {SetResolveCoincidentTopology(VTK_RESOLVE_OFF);}
297  {SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET);}
299  {SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER);}
301 
303 
306  static void SetResolveCoincidentTopologyPolygonOffsetParameters(
307  double factor, double units);
308  static void GetResolveCoincidentTopologyPolygonOffsetParameters(
309  double& factor, double& units);
311 
313 
318  static void SetResolveCoincidentTopologyPolygonOffsetFaces(int faces);
319  static int GetResolveCoincidentTopologyPolygonOffsetFaces();
321 
323 
325  static void SetResolveCoincidentTopologyZShift(double val);
326  static double GetResolveCoincidentTopologyZShift();
328 
330 
332  virtual double *GetBounds();
333  virtual void GetBounds(double bounds[6])
334  {this->vtkAbstractMapper3D::GetBounds(bounds);};
336 
338 
341  void SetRenderTime(double time) {this->RenderTime = time;}
342  vtkGetMacro(RenderTime, double);
344 
345  //BTX
347 
349  vtkDataSet *GetInput();
350  //ETX
352 
354 
359  {return this->GetInput();}
361 
367  vtkUnsignedCharArray *MapScalars(double alpha);
368 
370 
371  vtkSetMacro(ScalarMaterialMode,int);
372  vtkGetMacro(ScalarMaterialMode,int);
374  {this->SetScalarMaterialMode(VTK_MATERIALMODE_DEFAULT);};
376  {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT);};
378  {this->SetScalarMaterialMode(VTK_MATERIALMODE_DIFFUSE);};
380  {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE);};
382 
384  const char *GetScalarMaterialModeAsString();
385 
387 
391  virtual bool GetSupportsSelection()
392  { return false; }
393 protected:
394  vtkMapper();
395  ~vtkMapper();
397 
399 
400  // Use texture coordinates for coloring.
402  // Coordinate for each point.
404  // 1D ColorMap used for the texture image.
406  void MapScalarsToTexture(vtkDataArray* scalars, double alpha);
407 
411  double ScalarRange[2];
417 
418  double RenderTime;
419 
420  // for coloring by a component of a field data array
421  int ArrayId;
422  char ArrayName[256];
425 
426  int Static;
427 
429 
430 private:
431  vtkMapper(const vtkMapper&); // Not implemented.
432  void operator=(const vtkMapper&); // Not implemented.
433 };
434 
435 #endif