Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkProperty.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkProperty.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 =========================================================================*/
00036 #ifndef __vtkProperty_h
00037 #define __vtkProperty_h
00038 
00039 #include "vtkObject.h"
00040 
00041 // shading models
00042 #define VTK_FLAT    0
00043 #define VTK_GOURAUD 1
00044 #define VTK_PHONG   2
00045 
00046 // representation models
00047 #define VTK_POINTS    0
00048 #define VTK_WIREFRAME 1
00049 #define VTK_SURFACE   2
00050 
00051 class vtkRenderer;
00052 class vtkActor;
00053 
00054 class VTK_RENDERING_EXPORT vtkProperty : public vtkObject
00055 {
00056 public:
00057   vtkTypeRevisionMacro(vtkProperty,vtkObject);
00058   void PrintSelf(ostream& os, vtkIndent indent);
00059 
00065   static vtkProperty *New();
00066 
00068   void DeepCopy(vtkProperty *p);
00069 
00075   virtual void Render(vtkActor *,vtkRenderer *) {};
00076 
00082   virtual void BackfaceRender(vtkActor *,vtkRenderer *) {};
00083 
00085 
00086   vtkSetClampMacro(Interpolation,int,VTK_FLAT,VTK_PHONG);
00087   vtkGetMacro(Interpolation,int);
00088   void SetInterpolationToFlat() {this->SetInterpolation(VTK_FLAT);};
00089   void SetInterpolationToGouraud() {this->SetInterpolation(VTK_GOURAUD);};
00090   void SetInterpolationToPhong() {this->SetInterpolation(VTK_PHONG);};
00091   char *GetInterpolationAsString();
00093 
00095 
00096   vtkSetClampMacro(Representation,int,VTK_POINTS,VTK_SURFACE);
00097   vtkGetMacro(Representation,int);
00098   void SetRepresentationToPoints() {this->SetRepresentation(VTK_POINTS);};
00099   void SetRepresentationToWireframe() {
00100     this->SetRepresentation(VTK_WIREFRAME);};
00101   void SetRepresentationToSurface() {this->SetRepresentation(VTK_SURFACE);};
00102   char *GetRepresentationAsString();
00104 
00106 
00109   void SetColor(double r,double g,double b);
00110   void SetColor(double a[3]) { this->SetColor(a[0], a[1], a[2]); };
00111   double *GetColor();
00112   void GetColor(double rgb[3]);
00114 
00116 
00117   vtkSetClampMacro(Ambient,double,0.0,1.0);
00118   vtkGetMacro(Ambient,double);
00120 
00122 
00123   vtkSetClampMacro(Diffuse,double,0.0,1.0);
00124   vtkGetMacro(Diffuse,double);
00126 
00128 
00129   vtkSetClampMacro(Specular,double,0.0,1.0);
00130   vtkGetMacro(Specular,double);
00132 
00134 
00135   vtkSetClampMacro(SpecularPower,double,0.0,100.0);
00136   vtkGetMacro(SpecularPower,double);
00138 
00140 
00142   vtkSetClampMacro(Opacity,double,0.0,1.0);
00143   vtkGetMacro(Opacity,double);
00145 
00147 
00151   vtkSetVector3Macro(AmbientColor,double);
00152   vtkGetVectorMacro(AmbientColor,double,3);
00154 
00156 
00157   vtkSetVector3Macro(DiffuseColor,double);
00158   vtkGetVectorMacro(DiffuseColor,double,3);
00160 
00162 
00163   vtkSetVector3Macro(SpecularColor,double);
00164   vtkGetVectorMacro(SpecularColor,double,3);
00166 
00168 
00171   vtkGetMacro(EdgeVisibility,int);
00172   vtkSetMacro(EdgeVisibility,int);
00173   vtkBooleanMacro(EdgeVisibility,int);
00175 
00177 
00178   vtkSetVector3Macro(EdgeColor,double);
00179   vtkGetVectorMacro(EdgeColor,double,3);
00181 
00183 
00185   vtkSetClampMacro(LineWidth,float,0,VTK_LARGE_FLOAT);
00186   vtkGetMacro(LineWidth,float);
00188 
00190 
00193   vtkSetMacro(LineStipplePattern,int);
00194   vtkGetMacro(LineStipplePattern,int);
00196 
00198 
00201   vtkSetClampMacro(LineStippleRepeatFactor,int,1,VTK_LARGE_INTEGER);
00202   vtkGetMacro(LineStippleRepeatFactor,int);
00204 
00206 
00208   vtkSetClampMacro(PointSize,float,0,VTK_LARGE_FLOAT);
00209   vtkGetMacro(PointSize,float);
00211 
00213 
00216   vtkGetMacro(BackfaceCulling,int);
00217   vtkSetMacro(BackfaceCulling,int);
00218   vtkBooleanMacro(BackfaceCulling,int);
00220 
00222 
00225   vtkGetMacro(FrontfaceCulling,int);
00226   vtkSetMacro(FrontfaceCulling,int);
00227   vtkBooleanMacro(FrontfaceCulling,int);
00229 
00230 protected:
00231   vtkProperty();
00232   ~vtkProperty() {};
00233 
00234   double Color[3];
00235   double AmbientColor[3];
00236   double DiffuseColor[3];
00237   double SpecularColor[3];
00238   double EdgeColor[3];
00239   double Ambient;
00240   double Diffuse;
00241   double Specular;
00242   double SpecularPower;
00243   double Opacity;
00244   float PointSize;
00245   float LineWidth;
00246   int   LineStipplePattern;
00247   int   LineStippleRepeatFactor;
00248   int   Interpolation; 
00249   int   Representation;
00250   int   EdgeVisibility;
00251   int   BackfaceCulling;
00252   int   FrontfaceCulling;
00253 private:
00254   vtkProperty(const vtkProperty&);  // Not implemented.
00255   void operator=(const vtkProperty&);  // Not implemented.
00256 };
00257 
00259 inline char *vtkProperty::GetInterpolationAsString(void)
00260 {
00261   if ( this->Interpolation == VTK_FLAT )
00262     {
00263     return (char *)"Flat";
00264     }
00265   else if ( this->Interpolation == VTK_GOURAUD ) 
00266     {
00267     return (char *)"Gouraud";
00268     }
00269   else 
00270     {
00271     return (char *)"Phong";
00272     }
00273 }
00274 
00275 
00277 inline char *vtkProperty::GetRepresentationAsString(void)
00278 {
00279   if ( this->Representation == VTK_POINTS )
00280     {
00281     return (char *)"Points";
00282     }
00283   else if ( this->Representation == VTK_WIREFRAME ) 
00284     {
00285     return (char *)"Wireframe";
00286     }
00287   else 
00288     {
00289     return (char *)"Surface";
00290     }
00291 }
00292 
00293 
00294 
00295 #endif

Generated on Mon Jan 21 23:07:36 2008 for VTK by  doxygen 1.4.3-20050530