00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00060 #ifndef __vtkMapper_h
00061 #define __vtkMapper_h
00062
00063 #include "vtkAbstractMapper3D.h"
00064 #include "vtkScalarsToColors.h"
00065
00066 #define VTK_RESOLVE_OFF 0
00067 #define VTK_RESOLVE_POLYGON_OFFSET 1
00068 #define VTK_RESOLVE_SHIFT_ZBUFFER 2
00069
00070 #define VTK_GET_ARRAY_BY_ID 0
00071 #define VTK_GET_ARRAY_BY_NAME 1
00072
00073 #define VTK_MATERIALMODE_DEFAULT 0
00074 #define VTK_MATERIALMODE_AMBIENT 1
00075 #define VTK_MATERIALMODE_DIFFUSE 2
00076 #define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE 3
00077
00078 class vtkWindow;
00079 class vtkRenderer;
00080 class vtkActor;
00081 class vtkDataSet;
00082 class vtkFloatArray;
00083 class vtkImageData;
00084
00085 class VTK_RENDERING_EXPORT vtkMapper : public vtkAbstractMapper3D
00086 {
00087 public:
00088 vtkTypeRevisionMacro(vtkMapper,vtkAbstractMapper3D);
00089 void PrintSelf(ostream& os, vtkIndent indent);
00090
00092 void ShallowCopy(vtkAbstractMapper *m);
00093
00096 unsigned long GetMTime();
00097
00100 virtual void Render(vtkRenderer *ren, vtkActor *a) = 0;
00101
00105 virtual void ReleaseGraphicsResources(vtkWindow *) {};
00106
00108
00109 void SetLookupTable(vtkScalarsToColors *lut);
00110 vtkScalarsToColors *GetLookupTable();
00112
00115 virtual void CreateDefaultLookupTable();
00116
00118
00120 vtkSetMacro(ScalarVisibility,int);
00121 vtkGetMacro(ScalarVisibility,int);
00122 vtkBooleanMacro(ScalarVisibility,int);
00124
00126
00130 vtkSetMacro(Static,int);
00131 vtkGetMacro(Static,int);
00132 vtkBooleanMacro(Static,int);
00134
00136
00143 vtkSetMacro(ColorMode,int);
00144 vtkGetMacro(ColorMode,int);
00145 void SetColorModeToDefault()
00146 {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);};
00147 void SetColorModeToMapScalars()
00148 {this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS);};
00150
00152 const char *GetColorModeAsString();
00153
00155
00158 vtkSetMacro(InterpolateScalarsBeforeMapping,int);
00159 vtkGetMacro(InterpolateScalarsBeforeMapping,int);
00160 vtkBooleanMacro(InterpolateScalarsBeforeMapping,int);
00162
00164
00170 vtkSetMacro(UseLookupTableScalarRange,int);
00171 vtkGetMacro(UseLookupTableScalarRange,int);
00172 vtkBooleanMacro(UseLookupTableScalarRange,int);
00174
00176
00179 vtkSetVector2Macro(ScalarRange,double);
00180 vtkGetVectorMacro(ScalarRange,double,2);
00182
00184
00189 vtkSetMacro(ImmediateModeRendering,int);
00190 vtkGetMacro(ImmediateModeRendering,int);
00191 vtkBooleanMacro(ImmediateModeRendering,int);
00193
00195
00200 static void SetGlobalImmediateModeRendering(int val);
00201 static void GlobalImmediateModeRenderingOn()
00202 {vtkMapper::SetGlobalImmediateModeRendering(1);};
00203 static void GlobalImmediateModeRenderingOff()
00204 {vtkMapper::SetGlobalImmediateModeRendering(0);};
00205 static int GetGlobalImmediateModeRendering();
00207
00209
00224 vtkSetMacro(ScalarMode,int);
00225 vtkGetMacro(ScalarMode,int);
00226 void SetScalarModeToDefault() {
00227 this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT);};
00228 void SetScalarModeToUsePointData() {
00229 this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA);};
00230 void SetScalarModeToUseCellData() {
00231 this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA);};
00232 void SetScalarModeToUsePointFieldData() {
00233 this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);};
00234 void SetScalarModeToUseCellFieldData() {
00235 this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA);};
00236 void SetScalarModeToUseFieldData() {
00237 this->SetScalarMode(VTK_SCALAR_MODE_USE_FIELD_DATA); }
00239
00241
00244 void SelectColorArray(int arrayNum);
00245 void SelectColorArray(const char* arrayName);
00247
00249
00251 void ColorByArrayComponent(int arrayNum, int component);
00252 void ColorByArrayComponent(const char* arrayName, int component);
00254
00256
00257 char* GetArrayName() { return this->ArrayName; }
00258 int GetArrayId() { return this->ArrayId; }
00259 int GetArrayAccessMode() { return this->ArrayAccessMode; }
00260 int GetArrayComponent() { return this->ArrayComponent; }
00262
00264 const char *GetScalarModeAsString();
00265
00267
00277 static void SetResolveCoincidentTopology(int val);
00278 static int GetResolveCoincidentTopology();
00279 static void SetResolveCoincidentTopologyToDefault();
00280 static void SetResolveCoincidentTopologyToOff()
00281 {SetResolveCoincidentTopology(VTK_RESOLVE_OFF);}
00282 static void SetResolveCoincidentTopologyToPolygonOffset()
00283 {SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET);}
00284 static void SetResolveCoincidentTopologyToShiftZBuffer()
00285 {SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER);}
00287
00289
00292 static void SetResolveCoincidentTopologyPolygonOffsetParameters(
00293 double factor, double units);
00294 static void GetResolveCoincidentTopologyPolygonOffsetParameters(
00295 double& factor, double& units);
00297
00299
00304 static void SetResolveCoincidentTopologyPolygonOffsetFaces(int faces);
00305 static int GetResolveCoincidentTopologyPolygonOffsetFaces();
00307
00309
00311 static void SetResolveCoincidentTopologyZShift(double val);
00312 static double GetResolveCoincidentTopologyZShift();
00314
00316
00318 virtual double *GetBounds();
00319 virtual void GetBounds(double bounds[6])
00320 {this->vtkAbstractMapper3D::GetBounds(bounds);};
00322
00324
00327 void SetRenderTime(double time) {this->RenderTime = time;}
00328 vtkGetMacro(RenderTime, double);
00330
00331
00333
00335 vtkDataSet *GetInput();
00336
00338
00340
00344 vtkDataSet *GetInputAsDataSet()
00345 {return this->GetInput();}
00347
00353 vtkUnsignedCharArray *MapScalars(double alpha);
00354
00356
00357 vtkSetMacro(ScalarMaterialMode,int);
00358 vtkGetMacro(ScalarMaterialMode,int);
00359 void SetScalarMaterialModeToDefault()
00360 {this->SetScalarMaterialMode(VTK_MATERIALMODE_DEFAULT);};
00361 void SetScalarMaterialModeToAmbient()
00362 {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT);};
00363 void SetScalarMaterialModeToDiffuse()
00364 {this->SetScalarMaterialMode(VTK_MATERIALMODE_DIFFUSE);};
00365 void SetScalarMaterialModeToAmbientAndDiffuse()
00366 {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE);};
00368
00370 const char *GetScalarMaterialModeAsString();
00371
00372 protected:
00373 vtkMapper();
00374 ~vtkMapper();
00375
00376 vtkUnsignedCharArray *Colors;
00377
00378
00379 int InterpolateScalarsBeforeMapping;
00380
00381 vtkFloatArray *ColorCoordinates;
00382
00383 vtkImageData* ColorTextureMap;
00384 void MapScalarsToTexture(vtkDataArray* scalars, double alpha);
00385
00386 vtkScalarsToColors *LookupTable;
00387 int ScalarVisibility;
00388 vtkTimeStamp BuildTime;
00389 double ScalarRange[2];
00390 int UseLookupTableScalarRange;
00391 int ImmediateModeRendering;
00392 int ColorMode;
00393 int ScalarMode;
00394 int ScalarMaterialMode;
00395
00396 double RenderTime;
00397
00398
00399 int ArrayId;
00400 char ArrayName[256];
00401 int ArrayComponent;
00402 int ArrayAccessMode;
00403
00404 int Static;
00405
00406 private:
00407 vtkMapper(const vtkMapper&);
00408 void operator=(const vtkMapper&);
00409 };
00410
00411 #endif