00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00082 #ifndef __vtkMapper_h
00083 #define __vtkMapper_h
00084
00085 #include "vtkAbstractMapper3D.h"
00086 #include "vtkScalarsToColors.h"
00087 #include "vtkDataSet.h"
00088
00089 #define VTK_RESOLVE_OFF 0
00090 #define VTK_RESOLVE_POLYGON_OFFSET 1
00091 #define VTK_RESOLVE_SHIFT_ZBUFFER 2
00092
00093 #define VTK_GET_ARRAY_BY_ID 0
00094 #define VTK_GET_ARRAY_BY_NAME 1
00095
00096 class vtkWindow;
00097 class vtkRenderer;
00098 class vtkActor;
00099
00100 class VTK_RENDERING_EXPORT vtkMapper : public vtkAbstractMapper3D
00101 {
00102 public:
00103 vtkTypeMacro(vtkMapper,vtkAbstractMapper3D);
00104 void PrintSelf(ostream& os, vtkIndent indent);
00105
00107 void ShallowCopy(vtkAbstractMapper *m);
00108
00111 unsigned long GetMTime();
00112
00115 virtual void Render(vtkRenderer *ren, vtkActor *a) = 0;
00116
00120 virtual void ReleaseGraphicsResources(vtkWindow *) {};
00121
00123
00124 void SetLookupTable(vtkScalarsToColors *lut);
00125 vtkScalarsToColors *GetLookupTable();
00127
00130 virtual void CreateDefaultLookupTable();
00131
00133
00135 vtkSetMacro(ScalarVisibility,int);
00136 vtkGetMacro(ScalarVisibility,int);
00137 vtkBooleanMacro(ScalarVisibility,int);
00139
00141
00148 vtkSetMacro(ColorMode,int);
00149 vtkGetMacro(ColorMode,int);
00150 void SetColorModeToDefault()
00151 {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);};
00152 void SetColorModeToMapScalars()
00153 {this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS);};
00155
00157 const char *GetColorModeAsString();
00158
00160
00166 vtkSetMacro(UseLookupTableScalarRange,int);
00167 vtkGetMacro(UseLookupTableScalarRange,int);
00168 vtkBooleanMacro(UseLookupTableScalarRange,int);
00170
00172
00175 vtkSetVector2Macro(ScalarRange,float);
00176 vtkGetVectorMacro(ScalarRange,float,2);
00178
00180
00185 vtkSetMacro(ImmediateModeRendering,int);
00186 vtkGetMacro(ImmediateModeRendering,int);
00187 vtkBooleanMacro(ImmediateModeRendering,int);
00189
00191
00196 static void SetGlobalImmediateModeRendering(int val);
00197 static void GlobalImmediateModeRenderingOn()
00198 {vtkMapper::SetGlobalImmediateModeRendering(1);};
00199 static void GlobalImmediateModeRenderingOff()
00200 {vtkMapper::SetGlobalImmediateModeRendering(0);};
00201 static int GetGlobalImmediateModeRendering();
00203
00205
00215 vtkSetMacro(ScalarMode,int);
00216 vtkGetMacro(ScalarMode,int);
00217 void SetScalarModeToDefault() {
00218 this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT);};
00219 void SetScalarModeToUsePointData() {
00220 this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA);};
00221 void SetScalarModeToUseCellData() {
00222 this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA);};
00223 void SetScalarModeToUsePointFieldData() {
00224 this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);};
00225 void SetScalarModeToUseCellFieldData() {
00226 this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA);};
00228
00230
00231 void ColorByArrayComponent(int arrayNum, int component);
00232 void ColorByArrayComponent(char* arrayName, int component);
00234
00236
00237 char* GetArrayName() { return this->ArrayName; }
00238 int GetArrayId() { return this->ArrayId; }
00239 int GetArrayAccessMode() { return this->ArrayAccessMode; }
00240 int GetArrayComponent() { return this->ArrayComponent; }
00242
00244 const char *GetScalarModeAsString();
00245
00247
00257 static void SetResolveCoincidentTopology(int val);
00258 static int GetResolveCoincidentTopology();
00259 static void SetResolveCoincidentTopologyToDefault();
00260 static void SetResolveCoincidentTopologyToOff()
00261 {SetResolveCoincidentTopology(VTK_RESOLVE_OFF);}
00262 static void SetResolveCoincidentTopologyToPolygonOffset()
00263 {SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET);}
00264 static void SetResolveCoincidentTopologyToShiftZBuffer()
00265 {SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER);}
00267
00269
00272 static void SetResolveCoincidentTopologyPolygonOffsetParameters(float factor,
00273 float units);
00274 static void GetResolveCoincidentTopologyPolygonOffsetParameters(float& factor,
00275 float& units);
00277
00279
00281 static void SetResolveCoincidentTopologyZShift(double val);
00282 static double GetResolveCoincidentTopologyZShift();
00284
00286
00288 virtual float *GetBounds();
00289 virtual void GetBounds(float bounds[6])
00290 {this->vtkAbstractMapper3D::GetBounds(bounds);};
00292
00294
00297 void SetRenderTime(float time) {this->RenderTime = time;}
00298 vtkGetMacro(RenderTime, float);
00300
00301
00303
00304 specialized mapper classes to return more specific data types. */
00305 vtkDataSet *GetInput();
00306
00308
00310
00311 specialized data type that the subclass may return from GetInput().
00312 This method is provided for use in the wrapper languages, C++
00313 programmers should use GetInput() instead. */
00314 vtkDataSet *GetInputAsDataSet()
00315 {return this->GetInput();}
00317
00323 vtkUnsignedCharArray *MapScalars(float alpha);
00324
00326 virtual void Update();
00327
00328 protected:
00329 vtkMapper();
00330 ~vtkMapper();
00331
00332 vtkUnsignedCharArray *Colors;
00333
00334 vtkScalarsToColors *LookupTable;
00335 int ScalarVisibility;
00336 vtkTimeStamp BuildTime;
00337 float ScalarRange[2];
00338 int UseLookupTableScalarRange;
00339 int ImmediateModeRendering;
00340 int ColorMode;
00341 int ScalarMode;
00342
00343 float RenderTime;
00344
00345
00346 int ArrayId;
00347 char ArrayName[256];
00348 int ArrayComponent;
00349 int ArrayAccessMode;
00350 private:
00351 vtkMapper(const vtkMapper&);
00352 void operator=(const vtkMapper&);
00353 };
00354
00355 #endif