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=========================================================================*/
61#ifndef vtkMapper_h
62#define vtkMapper_h
63
64#include "vtkRenderingCoreModule.h" // For export macro
65#include "vtkAbstractMapper3D.h"
66#include "vtkSystemIncludes.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
67#include "vtkSmartPointer.h" // needed for vtkSmartPointer.
68
69#define VTK_RESOLVE_OFF 0
70#define VTK_RESOLVE_POLYGON_OFFSET 1
71#define VTK_RESOLVE_SHIFT_ZBUFFER 2
72
73#define VTK_GET_ARRAY_BY_ID 0
74#define VTK_GET_ARRAY_BY_NAME 1
75
76#define VTK_MATERIALMODE_DEFAULT 0
77#define VTK_MATERIALMODE_AMBIENT 1
78#define VTK_MATERIALMODE_DIFFUSE 2
79#define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE 3
80
81class vtkWindow;
82class vtkRenderer;
83class vtkActor;
84class vtkDataSet;
85class vtkDataObject;
86class vtkFloatArray;
87class vtkImageData;
90
91class VTKRENDERINGCORE_EXPORT vtkMapper : public vtkAbstractMapper3D
92{
93public:
95 void PrintSelf(ostream& os, vtkIndent indent);
96
101
107
112 virtual void Render(vtkRenderer *ren, vtkActor *a) = 0;
113
120
122
128
134
136
139 vtkSetMacro(ScalarVisibility, int);
140 vtkGetMacro(ScalarVisibility, int);
141 vtkBooleanMacro(ScalarVisibility, int);
143
145
151 vtkSetMacro(Static, int);
152 vtkGetMacro(Static, int);
153 vtkBooleanMacro(Static, int);
155
157
169 vtkSetMacro(ColorMode, int);
170 vtkGetMacro(ColorMode, int);
172 { this->SetColorMode(VTK_COLOR_MODE_DEFAULT); }
174 { this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS); }
176 { this->SetColorMode(VTK_COLOR_MODE_DIRECT_SCALARS); }
178
182 const char *GetColorModeAsString();
183
185
191 vtkSetMacro(InterpolateScalarsBeforeMapping, int);
192 vtkGetMacro(InterpolateScalarsBeforeMapping, int);
193 vtkBooleanMacro(InterpolateScalarsBeforeMapping, int);
195
197
205 vtkSetMacro(UseLookupTableScalarRange, int);
206 vtkGetMacro(UseLookupTableScalarRange, int);
207 vtkBooleanMacro(UseLookupTableScalarRange, int);
209
211
216 vtkSetVector2Macro(ScalarRange, double);
217 vtkGetVectorMacro(ScalarRange, double, 2);
219
221
229 vtkSetMacro(ImmediateModeRendering, int);
230 vtkGetMacro(ImmediateModeRendering, int);
231 vtkBooleanMacro(ImmediateModeRendering, int);
233
235
250
252
261 vtkGetMacro(ForceCompileOnly, int);
264
278 // When ScalarMode is set to use Field Data (ScalarModeToFieldData),
279 // you must call SelectColorArray to choose the field data array to
280 // be used to color cells. In this mode, the default behavior is to
281 // treat the field data tuples as being associated with cells. If
282 // the poly data contains triangle strips, the array is expected to
283 // contain the cell data for each mini-cell formed by any triangle
284 // strips in the poly data as opposed to treating them as a single
285 // tuple that applies to the entire strip. This mode can also be
286 // used to color the entire poly data by a single color obtained by
287 // mapping the tuple at a given index in the field data array
288 // through the color map. Use SetFieldDataTupleId() to specify
289 // the tuple index.
290 vtkSetMacro(ScalarMode, int);
291 vtkGetMacro(ScalarMode, int);
293 { this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT); }
295 { this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA); }
297 { this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA); }
299 { this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA); }
301 { this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA); }
303 { this->SetScalarMode(VTK_SCALAR_MODE_USE_FIELD_DATA); }
304
306
311 void SelectColorArray(int arrayNum);
312 void SelectColorArray(const char* arrayName);
314
315
316 // When ScalarMode is set to UseFieldData, set the index of the
317 // tuple by which to color the entire data set. By default, the
318 // index is -1, which means to treat the field data array selected
319 // with SelectColorArray as having a scalar value for each cell.
320 // Indices of 0 or higher mean to use the tuple at the given index
321 // for coloring the entire data set.
322 vtkSetMacro(FieldDataTupleId, vtkIdType);
323 vtkGetMacro(FieldDataTupleId, vtkIdType);
324
326
331 void ColorByArrayComponent(int arrayNum, int component);
332 void ColorByArrayComponent(const char* arrayName, int component);
334
338 char* GetArrayName() { return this->ArrayName; }
339 int GetArrayId() { return this->ArrayId; }
340 int GetArrayAccessMode() { return this->ArrayAccessMode; }
341 int GetArrayComponent() { return this->ArrayComponent; }
342
347
349
361 static void SetResolveCoincidentTopology(int val);
365 { SetResolveCoincidentTopology(VTK_RESOLVE_OFF) ;}
367 { SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET); }
369 { SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER); }
371
373
379 double factor, double units);
381 double& factor, double& units);
383
385
390 double factor, double units);
392 double& factor, double& units);
394
396
402 double factor, double units);
404 double& factor, double& units);
406
408
413 double factor, double units);
415 double& factor, double& units);
417
419
425 double units);
427 double& units);
429
431
438
440
445 double& factor, double& units);
447 double& factor, double& units);
450
452
462
464
468 static void SetResolveCoincidentTopologyZShift(double val);
471
476 virtual double *GetBounds();
477 virtual void GetBounds(double bounds[6])
478 { this->vtkAbstractMapper3D::GetBounds(bounds); }
479
485 void SetRenderTime(double time) {this->RenderTime = time;}
486 vtkGetMacro(RenderTime, double);
487
493
501 { return this->GetInput(); }
502
504
513 int &cellFlag);
515 double alpha);
517 double alpha,
518 int &cellFlag);
520
522
525 vtkSetMacro(ScalarMaterialMode,int);
526 vtkGetMacro(ScalarMaterialMode,int);
528 { this->SetScalarMaterialMode(VTK_MATERIALMODE_DEFAULT); }
530 { this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT); }
532 { this->SetScalarMaterialMode(VTK_MATERIALMODE_DIFFUSE); }
534 { this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE); }
536
541
550 virtual bool GetIsOpaque();
551
558 virtual bool GetSupportsSelection()
559 { return false; }
560
570
572
576 int scalarMode,
577 int arrayAccessMode,
578 int arrayId,
579 const char *arrayName,
580 int arrayComponent,
581 double *scalarRange);
582 void UseInvertibleColorFor(int scalarMode,
583 int arrayAccessMode,
584 int arrayId,
585 const char *arrayName,
586 int arrayComponent,
587 double *scalarRange);
589
594
598 static void ValueToColor(double value, double min, double scale,
599 unsigned char *color);
600
604 static void ColorToValue(unsigned char *color, double min, double scale,
605 double &value);
606
612
617
622
627
628protected:
631
632 // color mapped colors
634
635 // Use texture coordinates for coloring.
637 // Coordinate for each point.
639 // 1D ColorMap used for the texture image.
642
643 // Makes a lookup table that can be used for deferred colormaps
647
651 double ScalarRange[2];
657
659
660 // for coloring by a component of a field data array
662 char ArrayName[256];
665
666 // If coloring by field data, which tuple to use to color the entire
667 // data set. If -1, treat array values as cell data.
669
671
673
675
681
682private:
683 vtkMapper(const vtkMapper&) VTK_DELETE_FUNCTION;
684 void operator=(const vtkMapper&) VTK_DELETE_FUNCTION;
685};
686
687#endif
Abstract superclass for all arrays.
abstract class specifies interface to map 3D data
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
abstract class specifies interface to map data
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
general representation of visualization data
Definition: vtkDataObject.h:65
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:92
const char * GetScalarModeAsString()
Return the method for obtaining scalar data.
virtual int CanUseTextureMapForColoring(vtkDataObject *input)
Returns if we can use texture maps for scalar coloring.
void GetCoincidentTopologyLineOffsetParameters(double &factor, double &units)
static int GetResolveCoincidentTopology()
void SelectColorArray(const char *arrayName)
int ImmediateModeRendering
Definition: vtkMapper.h:653
void SetScalarModeToUsePointFieldData()
Definition: vtkMapper.h:298
vtkScalarsToColors * LookupTable
Definition: vtkMapper.h:648
virtual bool GetIsOpaque()
Returns if the mapper does not expect to have translucent geometry.
double CoincidentPolygonFactor
Definition: vtkMapper.h:676
int ForceCompileOnly
Definition: vtkMapper.h:672
void AcquireInvertibleLookupTable()
void SetColorModeToMapScalars()
Definition: vtkMapper.h:173
int ColorMode
Definition: vtkMapper.h:654
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetScalarModeToUseCellData()
Definition: vtkMapper.h:296
void SetLookupTable(vtkScalarsToColors *lut)
Specify a lookup table for the mapper to use.
virtual vtkUnsignedCharArray * MapScalars(double alpha)
Map the scalars (if there are any scalars and ScalarVisibility is on) through the lookup table,...
virtual void GetBounds(double bounds[6])
Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkMapper.h:477
void SetColorModeToDefault()
Definition: vtkMapper.h:171
void SelectColorArray(int arrayNum)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which array to use f...
void SetScalarModeToDefault()
Definition: vtkMapper.h:292
int ScalarMode
Definition: vtkMapper.h:655
virtual bool GetSupportsSelection()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkMapper.h:558
static void GetResolveCoincidentTopologyLineOffsetParameters(double &factor, double &units)
void SetScalarMaterialModeToAmbientAndDiffuse()
Definition: vtkMapper.h:533
void GetCoincidentTopologyPolygonOffsetParameters(double &factor, double &units)
Get the net paramters for handlig coincident topology obtained by summing the global values with the ...
const char * GetScalarMaterialModeAsString()
Return the light-model color mode.
void SetScalarMaterialModeToDiffuse()
Definition: vtkMapper.h:531
virtual void CreateDefaultLookupTable()
Create default lookup table.
double RenderTime
Definition: vtkMapper.h:658
void SetScalarModeToUseCellFieldData()
Definition: vtkMapper.h:300
void MapScalarsToTexture(vtkAbstractArray *scalars, double alpha)
char * GetArrayName()
Get the array name or number and component to color by.
Definition: vtkMapper.h:338
static vtkScalarsToColors * InvertibleLookupTable
Definition: vtkMapper.h:646
vtkImageData * GetColorTextureMap()
Provide read access to the color texture array.
static void GetResolveCoincidentTopologyPointOffsetParameter(double &units)
static void SetResolveCoincidentTopologyToDefault()
static int GetGlobalImmediateModeRendering()
vtkImageData * ColorTextureMap
Definition: vtkMapper.h:640
int InterpolateScalarsBeforeMapping
Definition: vtkMapper.h:636
static void GlobalImmediateModeRenderingOff()
Definition: vtkMapper.h:246
vtkTimeStamp BuildTime
Definition: vtkMapper.h:650
void ColorByArrayComponent(int arrayNum, int component)
Legacy: These methods used to be used to specify the array component.
int GetArrayId()
Definition: vtkMapper.h:339
void GetRelativeCoincidentTopologyPointOffsetParameter(double &units)
void SetColorModeToDirectScalars()
Definition: vtkMapper.h:175
int GetArrayComponent()
Definition: vtkMapper.h:341
void SetScalarMaterialModeToDefault()
Definition: vtkMapper.h:527
virtual vtkUnsignedCharArray * MapScalars(double alpha, int &cellFlag)
int ScalarMaterialMode
Definition: vtkMapper.h:656
void SetScalarModeToUseFieldData()
Definition: vtkMapper.h:302
void UseInvertibleColorFor(vtkDataObject *input, int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, int arrayComponent, double *scalarRange)
Used internally by vtkValuePass.
static double GetResolveCoincidentTopologyZShift()
static void SetResolveCoincidentTopologyPolygonOffsetParameters(double factor, double units)
Used to set the polygon offset scale factor and units.
int ArrayAccessMode
Definition: vtkMapper.h:664
void SetRelativeCoincidentTopologyLineOffsetParameters(double factor, double units)
Used to set the line offset values relative to the global Used when ResolveCoincidentTopology is set ...
int ArrayId
Definition: vtkMapper.h:661
static void GlobalImmediateModeRenderingOn()
Definition: vtkMapper.h:244
int ArrayComponent
Definition: vtkMapper.h:663
void SetRenderTime(double time)
This instance variable is used by vtkLODActor to determine which mapper to use.
Definition: vtkMapper.h:485
int GetArrayAccessMode()
Definition: vtkMapper.h:340
vtkAbstractArray * InvertibleScalars
Definition: vtkMapper.h:674
void UseInvertibleColorFor(int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, int arrayComponent, double *scalarRange)
int UseLookupTableScalarRange
Definition: vtkMapper.h:652
static void SetResolveCoincidentTopology(int val)
Set/Get a global flag that controls whether coincident topology (e.g., a line on top of a polygon) is...
void GetRelativeCoincidentTopologyLineOffsetParameters(double &factor, double &units)
virtual double * GetBounds()
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
vtkUnsignedCharArray * Colors
Definition: vtkMapper.h:633
static void SetResolveCoincidentTopologyToOff()
Definition: vtkMapper.h:364
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
vtkDataSet * GetInputAsDataSet()
Get the input to this mapper as a vtkDataSet, instead of as a more specialized data type that the sub...
Definition: vtkMapper.h:500
vtkScalarsToColors * GetLookupTable()
virtual vtkUnsignedCharArray * MapScalars(vtkDataSet *input, double alpha, int &cellFlag)
vtkMTimeType GetMTime()
Overload standard modified time function.
vtkIdType FieldDataTupleId
Definition: vtkMapper.h:668
double CoincidentPointOffset
Definition: vtkMapper.h:680
static void SetResolveCoincidentTopologyToPolygonOffset()
Definition: vtkMapper.h:366
static void SetResolveCoincidentTopologyToShiftZBuffer()
Definition: vtkMapper.h:368
void ColorByArrayComponent(const char *arrayName, int component)
void GetRelativeCoincidentTopologyPolygonOffsetParameters(double &factor, double &units)
static int GetResolveCoincidentTopologyPolygonOffsetFaces()
void SetForceCompileOnly(int value)
vtkFloatArray * GetColorCoordinates()
Provide read access to the color texture coordinate array.
static void ColorToValue(unsigned char *color, double min, double scale, double &value)
Convert an RGB triplet to a floating point value.
double CoincidentLineOffset
Definition: vtkMapper.h:679
void SetRelativeCoincidentTopologyPointOffsetParameter(double units)
Used to set the point offset value relative to the global Used when ResolveCoincidentTopology is set ...
static void SetResolveCoincidentTopologyPointOffsetParameter(double units)
Used to set the point offset value Used when ResolveCoincidentTopology is set to PolygonOffset.
int Static
Definition: vtkMapper.h:670
vtkFloatArray * ColorCoordinates
Definition: vtkMapper.h:638
void SetRelativeCoincidentTopologyPolygonOffsetParameters(double factor, double units)
Used to set the polygon offset values relative to the global Used when ResolveCoincidentTopology is s...
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Definition: vtkMapper.h:119
void SetScalarModeToUsePointData()
Definition: vtkMapper.h:294
vtkUnsignedCharArray * GetColorMapColors()
Provide read access to the color array.
static void SetResolveCoincidentTopologyLineOffsetParameters(double factor, double units)
Used to set the line offset scale factor and units.
vtkDataSet * GetInput()
Get the input as a vtkDataSet.
int ScalarVisibility
Definition: vtkMapper.h:649
void ClearInvertibleColor()
Used internally by vtkValuePass.
static void SetResolveCoincidentTopologyPolygonOffsetFaces(int faces)
Used when ResolveCoincidentTopology is set to PolygonOffset.
static void GetResolveCoincidentTopologyPolygonOffsetParameters(double &factor, double &units)
void GetCoincidentTopologyPointOffsetParameter(double &units)
double CoincidentLineFactor
Definition: vtkMapper.h:678
const char * GetColorModeAsString()
Return the method of coloring scalar data.
static void SetResolveCoincidentTopologyZShift(double val)
Used to set the z-shift if ResolveCoincidentTopology is set to ShiftZBuffer.
virtual vtkUnsignedCharArray * MapScalars(vtkDataSet *input, double alpha)
double CoincidentPolygonOffset
Definition: vtkMapper.h:677
void ShallowCopy(vtkAbstractMapper *m)
Make a shallow copy of this mapper.
static void SetGlobalImmediateModeRendering(int val)
Turn on/off flag to control whether data is rendered using immediate mode or note.
static void ValueToColor(double value, double min, double scale, unsigned char *color)
Convert a floating point value to an RGB triplet.
void ClearColorArrays()
Call to force a rebuild of color result arrays on next MapScalars.
bool UseInvertibleColors
Definition: vtkMapper.h:645
void SetScalarMaterialModeToAmbient()
Definition: vtkMapper.h:529
abstract specification for renderers
Definition: vtkRenderer.h:64
Superclass for mapping scalar values to colors.
record modification and/or execution time
Definition: vtkTimeStamp.h:36
dynamic, self-adjusting array of unsigned char
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ component
Definition: vtkX3D.h:175
@ value
Definition: vtkX3D.h:220
@ scale
Definition: vtkX3D.h:229
@ time
Definition: vtkX3D.h:497
@ alpha
Definition: vtkX3D.h:250
@ color
Definition: vtkX3D.h:221
#define VTK_SCALAR_MODE_DEFAULT
#define VTK_SCALAR_MODE_USE_POINT_DATA
#define VTK_SCALAR_MODE_USE_FIELD_DATA
#define VTK_SCALAR_MODE_USE_CELL_DATA
#define VTK_SCALAR_MODE_USE_CELL_FIELD_DATA
#define VTK_SCALAR_MODE_USE_POINT_FIELD_DATA
#define VTK_RESOLVE_POLYGON_OFFSET
Definition: vtkMapper.h:70
#define VTK_MATERIALMODE_DIFFUSE
Definition: vtkMapper.h:78
#define VTK_MATERIALMODE_DEFAULT
Definition: vtkMapper.h:76
#define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE
Definition: vtkMapper.h:79
#define VTK_RESOLVE_OFF
Definition: vtkMapper.h:69
#define VTK_RESOLVE_SHIFT_ZBUFFER
Definition: vtkMapper.h:71
#define VTK_MATERIALMODE_AMBIENT
Definition: vtkMapper.h:77
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_COLOR_MODE_MAP_SCALARS
#define VTK_COLOR_MODE_DEFAULT
#define VTK_COLOR_MODE_DIRECT_SCALARS
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248