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
00301 static void SetResolveCoincidentTopologyZShift(double val);
00302 static double GetResolveCoincidentTopologyZShift();
00304
00306
00308 virtual double *GetBounds();
00309 virtual void GetBounds(double bounds[6])
00310 {this->vtkAbstractMapper3D::GetBounds(bounds);};
00312
00314
00317 void SetRenderTime(double time) {this->RenderTime = time;}
00318 vtkGetMacro(RenderTime, double);
00320
00321
00323
00325 vtkDataSet *GetInput();
00326
00328
00330
00334 vtkDataSet *GetInputAsDataSet()
00335 {return this->GetInput();}
00337
00343 vtkUnsignedCharArray *MapScalars(double alpha);
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, double alpha);
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 int Static;
00395
00396 private:
00397 vtkMapper(const vtkMapper&);
00398 void operator=(const vtkMapper&);
00399 };
00400
00401 #endif