vtkMapper.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00074 #ifndef __vtkMapper_h
00075 #define __vtkMapper_h
00076
00077 #include "vtkAbstractMapper3D.h"
00078 #include "vtkScalarsToColors.h"
00079
00080 #define VTK_RESOLVE_OFF 0
00081 #define VTK_RESOLVE_POLYGON_OFFSET 1
00082 #define VTK_RESOLVE_SHIFT_ZBUFFER 2
00083
00084 #define VTK_GET_ARRAY_BY_ID 0
00085 #define VTK_GET_ARRAY_BY_NAME 1
00086
00087 #define VTK_MATERIALMODE_DEFAULT 0
00088 #define VTK_MATERIALMODE_AMBIENT 1
00089 #define VTK_MATERIALMODE_DIFFUSE 2
00090 #define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE 3
00091
00092 class vtkWindow;
00093 class vtkRenderer;
00094 class vtkActor;
00095 class vtkDataSet;
00096 class vtkFloatArray;
00097 class vtkImageData;
00098
00099 class VTK_RENDERING_EXPORT vtkMapper : public vtkAbstractMapper3D
00100 {
00101 public:
00102 vtkTypeRevisionMacro(vtkMapper,vtkAbstractMapper3D);
00103 void PrintSelf(ostream& os, vtkIndent indent);
00104
00106 void ShallowCopy(vtkAbstractMapper *m);
00107
00110 unsigned long GetMTime();
00111
00114 virtual void Render(vtkRenderer *ren, vtkActor *a) = 0;
00115
00119 virtual void ReleaseGraphicsResources(vtkWindow *) {};
00120
00122
00123 void SetLookupTable(vtkScalarsToColors *lut);
00124 vtkScalarsToColors *GetLookupTable();
00126
00129 virtual void CreateDefaultLookupTable();
00130
00132
00134 vtkSetMacro(ScalarVisibility,int);
00135 vtkGetMacro(ScalarVisibility,int);
00136 vtkBooleanMacro(ScalarVisibility,int);
00138
00140
00147 vtkSetMacro(ColorMode,int);
00148 vtkGetMacro(ColorMode,int);
00149 void SetColorModeToDefault()
00150 {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);};
00151 void SetColorModeToMapScalars()
00152 {this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS);};
00154
00156 const char *GetColorModeAsString();
00157
00159
00162 vtkSetMacro(InterpolateScalarsBeforeMapping,int);
00163 vtkGetMacro(InterpolateScalarsBeforeMapping,int);
00164 vtkBooleanMacro(InterpolateScalarsBeforeMapping,int);
00166
00168
00174 vtkSetMacro(UseLookupTableScalarRange,int);
00175 vtkGetMacro(UseLookupTableScalarRange,int);
00176 vtkBooleanMacro(UseLookupTableScalarRange,int);
00178
00180
00183 vtkSetVector2Macro(ScalarRange,double);
00184 vtkGetVectorMacro(ScalarRange,double,2);
00186
00188
00193 vtkSetMacro(ImmediateModeRendering,int);
00194 vtkGetMacro(ImmediateModeRendering,int);
00195 vtkBooleanMacro(ImmediateModeRendering,int);
00197
00199
00204 static void SetGlobalImmediateModeRendering(int val);
00205 static void GlobalImmediateModeRenderingOn()
00206 {vtkMapper::SetGlobalImmediateModeRendering(1);};
00207 static void GlobalImmediateModeRenderingOff()
00208 {vtkMapper::SetGlobalImmediateModeRendering(0);};
00209 static int GetGlobalImmediateModeRendering();
00211
00213
00223 vtkSetMacro(ScalarMode,int);
00224 vtkGetMacro(ScalarMode,int);
00225 void SetScalarModeToDefault() {
00226 this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT);};
00227 void SetScalarModeToUsePointData() {
00228 this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA);};
00229 void SetScalarModeToUseCellData() {
00230 this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA);};
00231 void SetScalarModeToUsePointFieldData() {
00232 this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);};
00233 void SetScalarModeToUseCellFieldData() {
00234 this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA);};
00236
00238
00241 void SelectColorArray(int arrayNum);
00242 void SelectColorArray(const char* arrayName);
00244
00246
00248 void ColorByArrayComponent(int arrayNum, int component);
00249 void ColorByArrayComponent(const char* arrayName, int component);
00251
00253
00254 char* GetArrayName() { return this->ArrayName; }
00255 int GetArrayId() { return this->ArrayId; }
00256 int GetArrayAccessMode() { return this->ArrayAccessMode; }
00257 int GetArrayComponent() { return this->ArrayComponent; }
00259
00261 const char *GetScalarModeAsString();
00262
00264
00274 static void SetResolveCoincidentTopology(int val);
00275 static int GetResolveCoincidentTopology();
00276 static void SetResolveCoincidentTopologyToDefault();
00277 static void SetResolveCoincidentTopologyToOff()
00278 {SetResolveCoincidentTopology(VTK_RESOLVE_OFF);}
00279 static void SetResolveCoincidentTopologyToPolygonOffset()
00280 {SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET);}
00281 static void SetResolveCoincidentTopologyToShiftZBuffer()
00282 {SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER);}
00284
00286
00289 static void SetResolveCoincidentTopologyPolygonOffsetParameters(
00290 double factor, double units);
00291 static void GetResolveCoincidentTopologyPolygonOffsetParameters(
00292 double& factor, double& units);
00294
00296
00298 static void SetResolveCoincidentTopologyZShift(double val);
00299 static double GetResolveCoincidentTopologyZShift();
00301
00303
00305 virtual double *GetBounds();
00306 virtual void GetBounds(double bounds[6])
00307 {this->vtkAbstractMapper3D::GetBounds(bounds);};
00309
00311
00314 void SetRenderTime(double time) {this->RenderTime = time;}
00315 vtkGetMacro(RenderTime, double);
00317
00318
00320
00322 vtkDataSet *GetInput();
00323
00325
00327
00331 vtkDataSet *GetInputAsDataSet()
00332 {return this->GetInput();}
00334
00340 vtkUnsignedCharArray *MapScalars(double alpha);
00341
00343 virtual void Update();
00344
00346
00347 vtkSetMacro(ScalarMaterialMode,int);
00348 vtkGetMacro(ScalarMaterialMode,int);
00349 void SetScalarMaterialModeToDefault()
00350 {this->SetScalarMaterialMode(VTK_MATERIALMODE_DEFAULT);};
00351 void SetScalarMaterialModeToAmbient()
00352 {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT);};
00353 void SetScalarMaterialModeToDiffuse()
00354 {this->SetScalarMaterialMode(VTK_MATERIALMODE_DIFFUSE);};
00355 void SetScalarMaterialModeToAmbientAndDiffuse()
00356 {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE);};
00358
00360 const char *GetScalarMaterialModeAsString();
00361
00362 protected:
00363 vtkMapper();
00364 ~vtkMapper();
00365
00366 vtkUnsignedCharArray *Colors;
00367
00368
00369 int InterpolateScalarsBeforeMapping;
00370
00371 vtkFloatArray *ColorCoordinates;
00372
00373 vtkImageData* ColorTextureMap;
00374 void MapScalarsToTexture(vtkDataArray* scalars);
00375
00376 vtkScalarsToColors *LookupTable;
00377 int ScalarVisibility;
00378 vtkTimeStamp BuildTime;
00379 double ScalarRange[2];
00380 int UseLookupTableScalarRange;
00381 int ImmediateModeRendering;
00382 int ColorMode;
00383 int ScalarMode;
00384 int ScalarMaterialMode;
00385
00386 double RenderTime;
00387
00388
00389 int ArrayId;
00390 char ArrayName[256];
00391 int ArrayComponent;
00392 int ArrayAccessMode;
00393
00394 private:
00395 vtkMapper(const vtkMapper&);
00396 void operator=(const vtkMapper&);
00397 };
00398
00399 #endif