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 vtkTypeMacro(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
00208
00210
00217 vtkGetMacro(ForceCompileOnly,int);
00218 void SetForceCompileOnly(int value);
00219
00221
00223
00238 vtkSetMacro(ScalarMode,int);
00239 vtkGetMacro(ScalarMode,int);
00240 void SetScalarModeToDefault() {
00241 this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT);};
00242 void SetScalarModeToUsePointData() {
00243 this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA);};
00244 void SetScalarModeToUseCellData() {
00245 this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA);};
00246 void SetScalarModeToUsePointFieldData() {
00247 this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);};
00248 void SetScalarModeToUseCellFieldData() {
00249 this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA);};
00250 void SetScalarModeToUseFieldData() {
00251 this->SetScalarMode(VTK_SCALAR_MODE_USE_FIELD_DATA); }
00253
00255
00258 void SelectColorArray(int arrayNum);
00259 void SelectColorArray(const char* arrayName);
00261
00263
00265 void ColorByArrayComponent(int arrayNum, int component);
00266 void ColorByArrayComponent(const char* arrayName, int component);
00268
00270
00271 char* GetArrayName() { return this->ArrayName; }
00272 int GetArrayId() { return this->ArrayId; }
00273 int GetArrayAccessMode() { return this->ArrayAccessMode; }
00274 int GetArrayComponent() { return this->ArrayComponent; }
00276
00278 const char *GetScalarModeAsString();
00279
00281
00291 static void SetResolveCoincidentTopology(int val);
00292 static int GetResolveCoincidentTopology();
00293 static void SetResolveCoincidentTopologyToDefault();
00294 static void SetResolveCoincidentTopologyToOff()
00295 {SetResolveCoincidentTopology(VTK_RESOLVE_OFF);}
00296 static void SetResolveCoincidentTopologyToPolygonOffset()
00297 {SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET);}
00298 static void SetResolveCoincidentTopologyToShiftZBuffer()
00299 {SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER);}
00301
00303
00306 static void SetResolveCoincidentTopologyPolygonOffsetParameters(
00307 double factor, double units);
00308 static void GetResolveCoincidentTopologyPolygonOffsetParameters(
00309 double& factor, double& units);
00311
00313
00318 static void SetResolveCoincidentTopologyPolygonOffsetFaces(int faces);
00319 static int GetResolveCoincidentTopologyPolygonOffsetFaces();
00321
00323
00325 static void SetResolveCoincidentTopologyZShift(double val);
00326 static double GetResolveCoincidentTopologyZShift();
00328
00330
00332 virtual double *GetBounds();
00333 virtual void GetBounds(double bounds[6])
00334 {this->vtkAbstractMapper3D::GetBounds(bounds);};
00336
00338
00341 void SetRenderTime(double time) {this->RenderTime = time;}
00342 vtkGetMacro(RenderTime, double);
00344
00345
00347
00349 vtkDataSet *GetInput();
00350
00352
00354
00358 vtkDataSet *GetInputAsDataSet()
00359 {return this->GetInput();}
00361
00367 vtkUnsignedCharArray *MapScalars(double alpha);
00368
00370
00371 vtkSetMacro(ScalarMaterialMode,int);
00372 vtkGetMacro(ScalarMaterialMode,int);
00373 void SetScalarMaterialModeToDefault()
00374 {this->SetScalarMaterialMode(VTK_MATERIALMODE_DEFAULT);};
00375 void SetScalarMaterialModeToAmbient()
00376 {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT);};
00377 void SetScalarMaterialModeToDiffuse()
00378 {this->SetScalarMaterialMode(VTK_MATERIALMODE_DIFFUSE);};
00379 void SetScalarMaterialModeToAmbientAndDiffuse()
00380 {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE);};
00382
00384 const char *GetScalarMaterialModeAsString();
00385
00387
00391 virtual bool GetSupportsSelection()
00392 { return false; }
00393 protected:
00394 vtkMapper();
00395 ~vtkMapper();
00397
00398 vtkUnsignedCharArray *Colors;
00399
00400
00401 int InterpolateScalarsBeforeMapping;
00402
00403 vtkFloatArray *ColorCoordinates;
00404
00405 vtkImageData* ColorTextureMap;
00406 void MapScalarsToTexture(vtkDataArray* scalars, double alpha);
00407
00408 vtkScalarsToColors *LookupTable;
00409 int ScalarVisibility;
00410 vtkTimeStamp BuildTime;
00411 double ScalarRange[2];
00412 int UseLookupTableScalarRange;
00413 int ImmediateModeRendering;
00414 int ColorMode;
00415 int ScalarMode;
00416 int ScalarMaterialMode;
00417
00418 double RenderTime;
00419
00420
00421 int ArrayId;
00422 char ArrayName[256];
00423 int ArrayComponent;
00424 int ArrayAccessMode;
00425
00426 int Static;
00427
00428 int ForceCompileOnly;
00429
00430 private:
00431 vtkMapper(const vtkMapper&);
00432 void operator=(const vtkMapper&);
00433 };
00434
00435 #endif