VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "vtkRenderingCoreModule.h" // For export macro
64 #include "vtkAbstractMapper3D.h"
65 #include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
66 
67 #define VTK_RESOLVE_OFF 0
68 #define VTK_RESOLVE_POLYGON_OFFSET 1
69 #define VTK_RESOLVE_SHIFT_ZBUFFER 2
70 
71 #define VTK_GET_ARRAY_BY_ID 0
72 #define VTK_GET_ARRAY_BY_NAME 1
73 
74 #define VTK_MATERIALMODE_DEFAULT 0
75 #define VTK_MATERIALMODE_AMBIENT 1
76 #define VTK_MATERIALMODE_DIFFUSE 2
77 #define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE 3
78 
79 class vtkWindow;
80 class vtkRenderer;
81 class vtkActor;
82 class vtkDataSet;
83 class vtkFloatArray;
84 class vtkImageData;
85 
87 {
88 public:
90  void PrintSelf(ostream& os, vtkIndent indent);
91 
94 
97  unsigned long GetMTime();
98 
101  virtual void Render(vtkRenderer *ren, vtkActor *a) = 0;
102 
107 
109 
110  void SetLookupTable(vtkScalarsToColors *lut);
111  vtkScalarsToColors *GetLookupTable();
113 
116  virtual void CreateDefaultLookupTable();
117 
119 
121  vtkSetMacro(ScalarVisibility, int);
122  vtkGetMacro(ScalarVisibility, int);
123  vtkBooleanMacro(ScalarVisibility, int);
125 
127 
131  vtkSetMacro(Static, int);
132  vtkGetMacro(Static, int);
133  vtkBooleanMacro(Static, int);
135 
137 
144  vtkSetMacro(ColorMode, int);
145  vtkGetMacro(ColorMode, int);
147  { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
149  { this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS); }
151 
153  const char *GetColorModeAsString();
154 
156 
159  vtkSetMacro(InterpolateScalarsBeforeMapping, int);
160  vtkGetMacro(InterpolateScalarsBeforeMapping, int);
161  vtkBooleanMacro(InterpolateScalarsBeforeMapping, int);
163 
165 
171  vtkSetMacro(UseLookupTableScalarRange, int);
172  vtkGetMacro(UseLookupTableScalarRange, int);
173  vtkBooleanMacro(UseLookupTableScalarRange, int);
175 
177 
180  vtkSetVector2Macro(ScalarRange, double);
181  vtkGetVectorMacro(ScalarRange, double, 2);
183 
185 
190  vtkSetMacro(ImmediateModeRendering, int);
191  vtkGetMacro(ImmediateModeRendering, int);
192  vtkBooleanMacro(ImmediateModeRendering, int);
194 
196 
201  static void SetGlobalImmediateModeRendering(int val);
206  static int GetGlobalImmediateModeRendering();
208 
209  //BTX
211 
218  vtkGetMacro(ForceCompileOnly, int);
219  void SetForceCompileOnly(int value);
220  //ETX
222 
224 
239  vtkSetMacro(ScalarMode, int);
240  vtkGetMacro(ScalarMode, int);
242  { this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT); }
244  { this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA); }
246  { this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA); }
248  { this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA); }
250  { this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA); }
252  { this->SetScalarMode(VTK_SCALAR_MODE_USE_FIELD_DATA); }
254 
256 
259  void SelectColorArray(int arrayNum);
260  void SelectColorArray(const char* arrayName);
262 
264 
266  void ColorByArrayComponent(int arrayNum, int component);
267  void ColorByArrayComponent(const char* arrayName, int component);
269 
271 
272  char* GetArrayName() { return this->ArrayName; }
273  int GetArrayId() { return this->ArrayId; }
274  int GetArrayAccessMode() { return this->ArrayAccessMode; }
275  int GetArrayComponent() { return this->ArrayComponent; }
277 
279  const char *GetScalarModeAsString();
280 
282 
292  static void SetResolveCoincidentTopology(int val);
293  static int GetResolveCoincidentTopology();
294  static void SetResolveCoincidentTopologyToDefault();
296  { SetResolveCoincidentTopology(VTK_RESOLVE_OFF) ;}
298  { SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET); }
300  { SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER); }
302 
304 
307  static void SetResolveCoincidentTopologyPolygonOffsetParameters(
308  double factor, double units);
309  static void GetResolveCoincidentTopologyPolygonOffsetParameters(
310  double& factor, double& units);
312 
314 
319  static void SetResolveCoincidentTopologyPolygonOffsetFaces(int faces);
320  static int GetResolveCoincidentTopologyPolygonOffsetFaces();
322 
324 
326  static void SetResolveCoincidentTopologyZShift(double val);
327  static double GetResolveCoincidentTopologyZShift();
329 
331 
333  virtual double *GetBounds();
334  virtual void GetBounds(double bounds[6])
335  { this->vtkAbstractMapper3D::GetBounds(bounds); }
337 
339 
342  void SetRenderTime(double time) {this->RenderTime = time;}
343  vtkGetMacro(RenderTime, double);
345 
346  //BTX
348 
350  vtkDataSet *GetInput();
351  //ETX
353 
355 
360  { return this->GetInput(); }
362 
368  vtkUnsignedCharArray *MapScalars(double alpha);
369 
371 
372  vtkSetMacro(ScalarMaterialMode,int);
373  vtkGetMacro(ScalarMaterialMode,int);
375  { this->SetScalarMaterialMode(VTK_MATERIALMODE_DEFAULT); }
377  { this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT); }
379  { this->SetScalarMaterialMode(VTK_MATERIALMODE_DIFFUSE); }
381  { this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE); }
383 
385  const char *GetScalarMaterialModeAsString();
386 
388 
395  virtual bool GetIsOpaque()
396  { return true; }
398 
400 
404  virtual bool GetSupportsSelection()
405  { return false; }
406 protected:
407  vtkMapper();
408  ~vtkMapper();
410 
412 
413  // Use texture coordinates for coloring.
415  // Coordinate for each point.
417  // 1D ColorMap used for the texture image.
419  void MapScalarsToTexture(vtkDataArray* scalars, double alpha);
420 
424  double ScalarRange[2];
430 
431  double RenderTime;
432 
433  // for coloring by a component of a field data array
434  int ArrayId;
435  char ArrayName[256];
438 
439  int Static;
440 
442 
443 private:
444  vtkMapper(const vtkMapper&); // Not implemented.
445  void operator=(const vtkMapper&); // Not implemented.
446 };
447 
448 #endif
int ForceCompileOnly
Definition: vtkMapper.h:441
virtual unsigned long GetMTime()
void SetScalarModeToUsePointData()
Definition: vtkMapper.h:243
int ScalarVisibility
Definition: vtkMapper.h:422
void SetScalarModeToDefault()
Definition: vtkMapper.h:241
static void SetResolveCoincidentTopologyToShiftZBuffer()
Definition: vtkMapper.h:299
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
#define VTK_SCALAR_MODE_USE_CELL_FIELD_DATA
void SetScalarMaterialModeToAmbientAndDiffuse()
Definition: vtkMapper.h:380
virtual void ReleaseGraphicsResources(vtkWindow *)
Definition: vtkMapper.h:106
vtkDataSet * GetInputAsDataSet()
Definition: vtkMapper.h:359
int ScalarMaterialMode
Definition: vtkMapper.h:429
abstract class to specify dataset behavior
Definition: vtkDataSet.h:60
static void SetResolveCoincidentTopologyToOff()
Definition: vtkMapper.h:295
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
record modification and/or execution time
Definition: vtkTimeStamp.h:34
void SetScalarModeToUseCellData()
Definition: vtkMapper.h:245
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
vtkImageData * ColorTextureMap
Definition: vtkMapper.h:418
#define VTK_RESOLVE_SHIFT_ZBUFFER
Definition: vtkMapper.h:69
void SetScalarMaterialModeToDiffuse()
Definition: vtkMapper.h:378
static void GlobalImmediateModeRenderingOff()
Definition: vtkMapper.h:204
vtkTimeStamp BuildTime
Definition: vtkMapper.h:423
void SetColorModeToDefault()
Definition: vtkMapper.h:146
abstract specification for renderers
Definition: vtkRenderer.h:63
int ArrayAccessMode
Definition: vtkMapper.h:437
static void SetResolveCoincidentTopologyToPolygonOffset()
Definition: vtkMapper.h:297
void SetScalarModeToUseFieldData()
Definition: vtkMapper.h:251
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
virtual bool GetIsOpaque()
Definition: vtkMapper.h:395
vtkUnsignedCharArray * Colors
Definition: vtkMapper.h:411
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
int ScalarMode
Definition: vtkMapper.h:428
#define VTK_MATERIALMODE_DIFFUSE
Definition: vtkMapper.h:76
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
void SetScalarMaterialModeToAmbient()
Definition: vtkMapper.h:376
void SetRenderTime(double time)
Definition: vtkMapper.h:342
#define VTK_COLOR_MODE_MAP_SCALARS
#define VTK_SCALAR_MODE_USE_POINT_DATA
a simple class to control print indentation
Definition: vtkIndent.h:38
void SetScalarModeToUsePointFieldData()
Definition: vtkMapper.h:247
const GLfloat * m
Definition: vtkgl.h:18169
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
#define VTK_SCALAR_MODE_USE_POINT_FIELD_DATA
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
#define VTK_MATERIALMODE_AMBIENT
Definition: vtkMapper.h:75
static void SetGlobalImmediateModeRendering(int val)
int ImmediateModeRendering
Definition: vtkMapper.h:426
virtual double * GetBounds()=0
abstract class specifies interface to map 3D data
int InterpolateScalarsBeforeMapping
Definition: vtkMapper.h:414
#define VTK_COLOR_MODE_DEFAULT
#define VTK_SCALAR_MODE_USE_FIELD_DATA
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:86
dynamic, self-adjusting array of unsigned char
virtual void GetBounds(double bounds[6])
Definition: vtkMapper.h:334
abstract class specifies interface to map data
int ArrayId
Definition: vtkMapper.h:434
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
int GetArrayAccessMode()
Definition: vtkMapper.h:274
void SetColorModeToMapScalars()
Definition: vtkMapper.h:148
#define VTK_MATERIALMODE_DEFAULT
Definition: vtkMapper.h:74
int Static
Definition: vtkMapper.h:439
int ArrayComponent
Definition: vtkMapper.h:436
#define VTKRENDERINGCORE_EXPORT
void PrintSelf(ostream &os, vtkIndent indent)
int GetArrayId()
Definition: vtkMapper.h:273
void ShallowCopy(vtkAbstractMapper *m)
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
vtkFloatArray * ColorCoordinates
Definition: vtkMapper.h:416
int UseLookupTableScalarRange
Definition: vtkMapper.h:425
virtual bool GetSupportsSelection()
Definition: vtkMapper.h:404
GLclampf GLclampf GLclampf alpha
Definition: vtkgl.h:11313
void SetScalarMaterialModeToDefault()
Definition: vtkMapper.h:374
#define VTK_SCALAR_MODE_USE_CELL_DATA
#define VTK_RESOLVE_POLYGON_OFFSET
Definition: vtkMapper.h:68
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:414
void SetScalarModeToUseCellFieldData()
Definition: vtkMapper.h:249
#define vtkSetVector2Macro(name, type)
Definition: vtkSetGet.h:244
vtkScalarsToColors * LookupTable
Definition: vtkMapper.h:421
int GetArrayComponent()
Definition: vtkMapper.h:275
static void GlobalImmediateModeRenderingOn()
Definition: vtkMapper.h:202
double RenderTime
Definition: vtkMapper.h:431
#define VTK_SCALAR_MODE_DEFAULT
#define VTK_RESOLVE_OFF
Definition: vtkMapper.h:67
GLuint GLfloat * val
Definition: vtkgl.h:13789
#define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE
Definition: vtkMapper.h:77
char * GetArrayName()
Definition: vtkMapper.h:272
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69
int ColorMode
Definition: vtkMapper.h:427