Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | 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 =========================================================================*/
00048 #ifndef __vtkProperty_h
00049 #define __vtkProperty_h
00050 
00051 #include "vtkObject.h"
00052 
00053 // shading models
00054 #define VTK_FLAT    0
00055 #define VTK_GOURAUD 1
00056 #define VTK_PHONG   2
00057 
00058 // representation models
00059 #define VTK_POINTS    0
00060 #define VTK_WIREFRAME 1
00061 #define VTK_SURFACE   2
00062 
00063 class vtkRenderer;
00064 class vtkActor;
00065 
00066 class VTK_RENDERING_EXPORT vtkProperty : public vtkObject
00067 {
00068 public:
00069   vtkTypeRevisionMacro(vtkProperty,vtkObject);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071 
00077   static vtkProperty *New();
00078 
00080   void DeepCopy(vtkProperty *p);
00081 
00087   virtual void Render(vtkActor *,vtkRenderer *) {};
00088 
00094   virtual void BackfaceRender(vtkActor *,vtkRenderer *) {};
00095 
00097 
00098   vtkSetClampMacro(Interpolation,int,VTK_FLAT,VTK_PHONG);
00099   vtkGetMacro(Interpolation,int);
00100   void SetInterpolationToFlat() {this->SetInterpolation(VTK_FLAT);};
00101   void SetInterpolationToGouraud() {this->SetInterpolation(VTK_GOURAUD);};
00102   void SetInterpolationToPhong() {this->SetInterpolation(VTK_PHONG);};
00103   char *GetInterpolationAsString();
00105 
00107 
00108   vtkSetClampMacro(Representation,int,VTK_POINTS,VTK_SURFACE);
00109   vtkGetMacro(Representation,int);
00110   void SetRepresentationToPoints() {this->SetRepresentation(VTK_POINTS);};
00111   void SetRepresentationToWireframe() {
00112     this->SetRepresentation(VTK_WIREFRAME);};
00113   void SetRepresentationToSurface() {this->SetRepresentation(VTK_SURFACE);};
00114   char *GetRepresentationAsString();
00116 
00118 
00121   void SetColor(double r,double g,double b);
00122   void SetColor(double a[3]) { this->SetColor(a[0], a[1], a[2]); };
00123   double *GetColor();
00124   void GetColor(double rgb[3]);
00126 
00128 
00129   vtkSetClampMacro(Ambient,double,0.0,1.0);
00130   vtkGetMacro(Ambient,double);
00132 
00134 
00135   vtkSetClampMacro(Diffuse,double,0.0,1.0);
00136   vtkGetMacro(Diffuse,double);
00138 
00140 
00141   vtkSetClampMacro(Specular,double,0.0,1.0);
00142   vtkGetMacro(Specular,double);
00144 
00146 
00147   vtkSetClampMacro(SpecularPower,double,0.0,100.0);
00148   vtkGetMacro(SpecularPower,double);
00150 
00152 
00154   vtkSetClampMacro(Opacity,double,0.0,1.0);
00155   vtkGetMacro(Opacity,double);
00157 
00159 
00163   vtkSetVector3Macro(AmbientColor,double);
00164   vtkGetVectorMacro(AmbientColor,double,3);
00166 
00168 
00169   vtkSetVector3Macro(DiffuseColor,double);
00170   vtkGetVectorMacro(DiffuseColor,double,3);
00172 
00174 
00175   vtkSetVector3Macro(SpecularColor,double);
00176   vtkGetVectorMacro(SpecularColor,double,3);
00178 
00180 
00183   vtkGetMacro(EdgeVisibility,int);
00184   vtkSetMacro(EdgeVisibility,int);
00185   vtkBooleanMacro(EdgeVisibility,int);
00187 
00189 
00190   vtkSetVector3Macro(EdgeColor,double);
00191   vtkGetVectorMacro(EdgeColor,double,3);
00193 
00195 
00197   vtkSetClampMacro(LineWidth,float,0,VTK_LARGE_FLOAT);
00198   vtkGetMacro(LineWidth,float);
00200 
00202 
00205   vtkSetMacro(LineStipplePattern,int);
00206   vtkGetMacro(LineStipplePattern,int);
00208 
00210 
00213   vtkSetClampMacro(LineStippleRepeatFactor,int,1,VTK_LARGE_INTEGER);
00214   vtkGetMacro(LineStippleRepeatFactor,int);
00216 
00218 
00220   vtkSetClampMacro(PointSize,float,0,VTK_LARGE_FLOAT);
00221   vtkGetMacro(PointSize,float);
00223 
00225 
00228   vtkGetMacro(BackfaceCulling,int);
00229   vtkSetMacro(BackfaceCulling,int);
00230   vtkBooleanMacro(BackfaceCulling,int);
00232 
00234 
00237   vtkGetMacro(FrontfaceCulling,int);
00238   vtkSetMacro(FrontfaceCulling,int);
00239   vtkBooleanMacro(FrontfaceCulling,int);
00241 
00242 protected:
00243   vtkProperty();
00244   ~vtkProperty() {};
00245 
00246   double Color[3];
00247   double AmbientColor[3];
00248   double DiffuseColor[3];
00249   double SpecularColor[3];
00250   double EdgeColor[3];
00251   double Ambient;
00252   double Diffuse;
00253   double Specular;
00254   double SpecularPower;
00255   double Opacity;
00256   float PointSize;
00257   float LineWidth;
00258   int   LineStipplePattern;
00259   int   LineStippleRepeatFactor;
00260   int   Interpolation; 
00261   int   Representation;
00262   int   EdgeVisibility;
00263   int   BackfaceCulling;
00264   int   FrontfaceCulling;
00265 private:
00266   vtkProperty(const vtkProperty&);  // Not implemented.
00267   void operator=(const vtkProperty&);  // Not implemented.
00268 };
00269 
00271 inline char *vtkProperty::GetInterpolationAsString(void)
00272 {
00273   if ( this->Interpolation == VTK_FLAT )
00274     {
00275     return (char *)"Flat";
00276     }
00277   else if ( this->Interpolation == VTK_GOURAUD ) 
00278     {
00279     return (char *)"Gouraud";
00280     }
00281   else 
00282     {
00283     return (char *)"Phong";
00284     }
00285 }
00286 
00287 
00289 inline char *vtkProperty::GetRepresentationAsString(void)
00290 {
00291   if ( this->Representation == VTK_POINTS )
00292     {
00293     return (char *)"Points";
00294     }
00295   else if ( this->Representation == VTK_WIREFRAME ) 
00296     {
00297     return (char *)"Wireframe";
00298     }
00299   else 
00300     {
00301     return (char *)"Surface";
00302     }
00303 }
00304 
00305 
00306 
00307 #endif