Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/vtkMapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkMapper.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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   //BTX
00303   /*! Get the input as a vtkDataSet.  This method is overridden in the
00304       specialized mapper classes to return more specific data types. */
00305   vtkDataSet *GetInput();
00306   //ETX
00308 
00310   /*! Get the input to this mapper as a vtkDataSet, instead of as a more
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   // for coloring by a component of a field data array
00346   int ArrayId;
00347   char ArrayName[256];
00348   int ArrayComponent;
00349   int ArrayAccessMode;
00350 private:
00351   vtkMapper(const vtkMapper&);  // Not implemented.
00352   void operator=(const vtkMapper&);  // Not implemented.
00353 };
00354 
00355 #endif

Generated on Thu Mar 28 14:19:32 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001