• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Rendering/vtkMapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMapper.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00057 #ifndef __vtkMapper_h
00058 #define __vtkMapper_h
00059 
00060 #include "vtkAbstractMapper3D.h"
00061 #include "vtkScalarsToColors.h" // For VTK_COLOR_MODE_DEFAULT and _MAP_SCALARS
00062 
00063 #define VTK_RESOLVE_OFF 0
00064 #define VTK_RESOLVE_POLYGON_OFFSET 1
00065 #define VTK_RESOLVE_SHIFT_ZBUFFER 2
00066 
00067 #define VTK_GET_ARRAY_BY_ID 0
00068 #define VTK_GET_ARRAY_BY_NAME 1
00069 
00070 #define VTK_MATERIALMODE_DEFAULT  0
00071 #define VTK_MATERIALMODE_AMBIENT  1
00072 #define VTK_MATERIALMODE_DIFFUSE  2
00073 #define VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE  3
00074 
00075 class vtkWindow;
00076 class vtkRenderer;
00077 class vtkActor;
00078 class vtkDataSet;
00079 class vtkFloatArray;
00080 class vtkImageData;
00081 
00082 class VTK_RENDERING_EXPORT vtkMapper : public vtkAbstractMapper3D
00083 {
00084 public:
00085   vtkTypeRevisionMacro(vtkMapper,vtkAbstractMapper3D);
00086   void PrintSelf(ostream& os, vtkIndent indent);
00087 
00089   void ShallowCopy(vtkAbstractMapper *m);
00090 
00093   unsigned long GetMTime();
00094 
00097   virtual void Render(vtkRenderer *ren, vtkActor *a) = 0;
00098 
00102   virtual void ReleaseGraphicsResources(vtkWindow *) {};
00103 
00105 
00106   void SetLookupTable(vtkScalarsToColors *lut);
00107   vtkScalarsToColors *GetLookupTable();
00109 
00112   virtual void CreateDefaultLookupTable();
00113 
00115 
00117   vtkSetMacro(ScalarVisibility,int);
00118   vtkGetMacro(ScalarVisibility,int);
00119   vtkBooleanMacro(ScalarVisibility,int);
00121 
00123 
00127   vtkSetMacro(Static,int);
00128   vtkGetMacro(Static,int);
00129   vtkBooleanMacro(Static,int);
00131 
00133 
00140   vtkSetMacro(ColorMode,int);
00141   vtkGetMacro(ColorMode,int);
00142   void SetColorModeToDefault() 
00143     {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);};
00144   void SetColorModeToMapScalars() 
00145     {this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS);};
00147 
00149   const char *GetColorModeAsString();
00150 
00152 
00155   vtkSetMacro(InterpolateScalarsBeforeMapping,int);
00156   vtkGetMacro(InterpolateScalarsBeforeMapping,int);
00157   vtkBooleanMacro(InterpolateScalarsBeforeMapping,int);
00159 
00161 
00167   vtkSetMacro(UseLookupTableScalarRange,int);
00168   vtkGetMacro(UseLookupTableScalarRange,int);
00169   vtkBooleanMacro(UseLookupTableScalarRange,int);
00171 
00173 
00176   vtkSetVector2Macro(ScalarRange,double);
00177   vtkGetVectorMacro(ScalarRange,double,2);
00179 
00181 
00186   vtkSetMacro(ImmediateModeRendering,int);
00187   vtkGetMacro(ImmediateModeRendering,int);
00188   vtkBooleanMacro(ImmediateModeRendering,int);
00190 
00192 
00197   static void SetGlobalImmediateModeRendering(int val);
00198   static void GlobalImmediateModeRenderingOn() 
00199     {vtkMapper::SetGlobalImmediateModeRendering(1);};
00200   static void GlobalImmediateModeRenderingOff() 
00201     {vtkMapper::SetGlobalImmediateModeRendering(0);};
00202   static int  GetGlobalImmediateModeRendering();
00204 
00205   //BTX
00207 
00214   vtkGetMacro(ForceCompileOnly,int);
00215   void SetForceCompileOnly(int value);
00216   //ETX
00218 
00220 
00235   vtkSetMacro(ScalarMode,int);
00236   vtkGetMacro(ScalarMode,int);
00237   void SetScalarModeToDefault() {
00238     this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT);};
00239   void SetScalarModeToUsePointData() {
00240     this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA);};
00241   void SetScalarModeToUseCellData() {
00242     this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA);};
00243   void SetScalarModeToUsePointFieldData() {
00244     this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);};
00245   void SetScalarModeToUseCellFieldData() {
00246     this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA);};
00247   void SetScalarModeToUseFieldData() {
00248     this->SetScalarMode(VTK_SCALAR_MODE_USE_FIELD_DATA); }
00250   
00252 
00255   void SelectColorArray(int arrayNum); 
00256   void SelectColorArray(const char* arrayName); 
00258 
00260 
00262   void ColorByArrayComponent(int arrayNum, int component);
00263   void ColorByArrayComponent(const char* arrayName, int component);
00265   
00267 
00268   char* GetArrayName() { return this->ArrayName; }
00269   int GetArrayId() { return this->ArrayId; }
00270   int GetArrayAccessMode() { return this->ArrayAccessMode; }
00271   int GetArrayComponent() { return this->ArrayComponent; }
00273 
00275   const char *GetScalarModeAsString();
00276 
00278 
00288   static void SetResolveCoincidentTopology(int val);
00289   static int  GetResolveCoincidentTopology();
00290   static void SetResolveCoincidentTopologyToDefault();
00291   static void SetResolveCoincidentTopologyToOff() 
00292     {SetResolveCoincidentTopology(VTK_RESOLVE_OFF);}
00293   static void SetResolveCoincidentTopologyToPolygonOffset() 
00294     {SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET);}
00295   static void SetResolveCoincidentTopologyToShiftZBuffer() 
00296     {SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER);}
00298 
00300 
00303   static void SetResolveCoincidentTopologyPolygonOffsetParameters(
00304     double factor, double units);
00305   static void GetResolveCoincidentTopologyPolygonOffsetParameters(
00306     double& factor, double& units);
00308 
00310 
00315   static void SetResolveCoincidentTopologyPolygonOffsetFaces(int faces);
00316   static int GetResolveCoincidentTopologyPolygonOffsetFaces();
00318 
00320 
00322   static void SetResolveCoincidentTopologyZShift(double val);
00323   static double GetResolveCoincidentTopologyZShift();
00325 
00327 
00329   virtual double *GetBounds();
00330   virtual void GetBounds(double bounds[6]) 
00331     {this->vtkAbstractMapper3D::GetBounds(bounds);};
00333 
00335 
00338   void SetRenderTime(double time) {this->RenderTime = time;}
00339   vtkGetMacro(RenderTime, double);
00341 
00342   //BTX
00344 
00346   vtkDataSet *GetInput();
00347   //ETX
00349 
00351 
00355   vtkDataSet *GetInputAsDataSet() 
00356     {return this->GetInput();}
00358 
00364   vtkUnsignedCharArray *MapScalars(double alpha);
00365   
00367 
00368   vtkSetMacro(ScalarMaterialMode,int);
00369   vtkGetMacro(ScalarMaterialMode,int);
00370   void SetScalarMaterialModeToDefault() 
00371     {this->SetScalarMaterialMode(VTK_MATERIALMODE_DEFAULT);};
00372   void SetScalarMaterialModeToAmbient() 
00373     {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT);};
00374   void SetScalarMaterialModeToDiffuse() 
00375     {this->SetScalarMaterialMode(VTK_MATERIALMODE_DIFFUSE);};
00376   void SetScalarMaterialModeToAmbientAndDiffuse() 
00377     {this->SetScalarMaterialMode(VTK_MATERIALMODE_AMBIENT_AND_DIFFUSE);};
00379 
00381   const char *GetScalarMaterialModeAsString();
00382 
00384 
00388   virtual bool GetSupportsSelection()
00389     { return false; }
00391 protected:
00392   vtkMapper();
00393   ~vtkMapper();
00394 
00395   vtkUnsignedCharArray *Colors;
00396 
00397   // Use texture coordinates for coloring.
00398   int InterpolateScalarsBeforeMapping;
00399   // Coordinate for each point.
00400   vtkFloatArray *ColorCoordinates;
00401   // 1D ColorMap used for the texture image.
00402   vtkImageData* ColorTextureMap;
00403   void MapScalarsToTexture(vtkDataArray* scalars, double alpha);
00404 
00405   vtkScalarsToColors *LookupTable;
00406   int ScalarVisibility;
00407   vtkTimeStamp BuildTime;
00408   double ScalarRange[2];
00409   int UseLookupTableScalarRange;
00410   int ImmediateModeRendering;
00411   int ColorMode;
00412   int ScalarMode;
00413   int ScalarMaterialMode;
00414 
00415   double RenderTime;
00416 
00417   // for coloring by a component of a field data array
00418   int ArrayId;
00419   char ArrayName[256];
00420   int ArrayComponent;
00421   int ArrayAccessMode;
00422 
00423   int Static;
00424 
00425   int ForceCompileOnly;
00426   
00427 private:
00428   vtkMapper(const vtkMapper&);  // Not implemented.
00429   void operator=(const vtkMapper&);  // Not implemented.
00430 };
00431 
00432 #endif

Generated by  doxygen 1.7.1