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

# Rendering/vtkProperty.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkProperty.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00052 #ifndef __vtkProperty_h
    00053 #define __vtkProperty_h
    00054
    00055 #include "vtkObject.h"
    00056
    00057 // shading models
    00058 #define VTK_FLAT    0
    00059 #define VTK_GOURAUD 1
    00060 #define VTK_PHONG   2
    00061
    00062 // representation models
    00063 #define VTK_POINTS    0
    00064 #define VTK_WIREFRAME 1
    00065 #define VTK_SURFACE   2
    00066
    00067 class vtkRenderer;
    00068 class vtkActor;
    00069
    00070 class VTK_RENDERING_EXPORT vtkProperty : public vtkObject
    00071 {
    00072 public:
    00073   vtkTypeRevisionMacro(vtkProperty,vtkObject);
    00074   void PrintSelf(ostream& os, vtkIndent indent);
    00075
    00081   static vtkProperty *New();
    00082
    00084   void DeepCopy(vtkProperty *p);
    00085
    00091   virtual void Render(vtkActor *,vtkRenderer *) {};
    00092
    00098   virtual void BackfaceRender(vtkActor *,vtkRenderer *) {};
    00099
    00101
    00102   vtkSetClampMacro(Interpolation,int,VTK_FLAT,VTK_PHONG);
    00103   vtkGetMacro(Interpolation,int);
    00104   void SetInterpolationToFlat() {this->SetInterpolation(VTK_FLAT);};
    00105   void SetInterpolationToGouraud() {this->SetInterpolation(VTK_GOURAUD);};
    00106   void SetInterpolationToPhong() {this->SetInterpolation(VTK_PHONG);};
    00107   char *GetInterpolationAsString();
    00109
    00111
    00112   vtkSetClampMacro(Representation,int,VTK_POINTS,VTK_SURFACE);
    00113   vtkGetMacro(Representation,int);
    00114   void SetRepresentationToPoints() {this->SetRepresentation(VTK_POINTS);};
    00115   void SetRepresentationToWireframe() {
    00116     this->SetRepresentation(VTK_WIREFRAME);};
    00117   void SetRepresentationToSurface() {this->SetRepresentation(VTK_SURFACE);};
    00118   char *GetRepresentationAsString();
    00120
    00122
    00125   void SetColor(float r,float g,float b);
    00126   void SetColor(float a[3]) { this->SetColor(a[0], a[1], a[2]); };
    00127   float *GetColor();
    00128   void GetColor(float rgb[3]);
    00130
    00132
    00133   vtkSetClampMacro(Ambient,float,0.0f,1.0f);
    00134   vtkGetMacro(Ambient,float);
    00136
    00138
    00139   vtkSetClampMacro(Diffuse,float,0.0f,1.0f);
    00140   vtkGetMacro(Diffuse,float);
    00142
    00144
    00145   vtkSetClampMacro(Specular,float,0.0f,1.0f);
    00146   vtkGetMacro(Specular,float);
    00148
    00150
    00151   vtkSetClampMacro(SpecularPower,float,0.0f,100.0f);
    00152   vtkGetMacro(SpecularPower,float);
    00154
    00156
    00158   vtkSetClampMacro(Opacity,float,0.0f,1.0f);
    00159   vtkGetMacro(Opacity,float);
    00161
    00163
    00167   vtkSetVector3Macro(AmbientColor,float);
    00168   vtkGetVectorMacro(AmbientColor,float,3);
    00170
    00172
    00173   vtkSetVector3Macro(DiffuseColor,float);
    00174   vtkGetVectorMacro(DiffuseColor,float,3);
    00176
    00178
    00179   vtkSetVector3Macro(SpecularColor,float);
    00180   vtkGetVectorMacro(SpecularColor,float,3);
    00182
    00184
    00187   vtkGetMacro(EdgeVisibility,int);
    00188   vtkSetMacro(EdgeVisibility,int);
    00189   vtkBooleanMacro(EdgeVisibility,int);
    00191
    00193
    00194   vtkSetVector3Macro(EdgeColor,float);
    00195   vtkGetVectorMacro(EdgeColor,float,3);
    00197
    00199
    00201   vtkSetClampMacro(LineWidth,float,0,VTK_LARGE_FLOAT);
    00202   vtkGetMacro(LineWidth,float);
    00204
    00206
    00209   vtkSetMacro(LineStipplePattern,int);
    00210   vtkGetMacro(LineStipplePattern,int);
    00212
    00214
    00217   vtkSetClampMacro(LineStippleRepeatFactor,int,1,VTK_LARGE_INTEGER);
    00218   vtkGetMacro(LineStippleRepeatFactor,int);
    00220
    00222
    00224   vtkSetClampMacro(PointSize,float,0,VTK_LARGE_FLOAT);
    00225   vtkGetMacro(PointSize,float);
    00227
    00229
    00232   vtkGetMacro(BackfaceCulling,int);
    00233   vtkSetMacro(BackfaceCulling,int);
    00234   vtkBooleanMacro(BackfaceCulling,int);
    00236
    00238
    00241   vtkGetMacro(FrontfaceCulling,int);
    00242   vtkSetMacro(FrontfaceCulling,int);
    00243   vtkBooleanMacro(FrontfaceCulling,int);
    00245
    00246 protected:
    00247   vtkProperty();
    00248   ~vtkProperty() {};
    00249
    00250   float Color[3];
    00251   float AmbientColor[3];
    00252   float DiffuseColor[3];
    00253   float SpecularColor[3];
    00254   float EdgeColor[3];
    00255   float Ambient;
    00256   float Diffuse;
    00257   float Specular;
    00258   float SpecularPower;
    00259   float Opacity;
    00260   float PointSize;
    00261   float LineWidth;
    00262   int   LineStipplePattern;
    00263   int   LineStippleRepeatFactor;
    00264   int   Interpolation;
    00265   int   Representation;
    00266   int   EdgeVisibility;
    00267   int   BackfaceCulling;
    00268   int   FrontfaceCulling;
    00269 private:
    00270   vtkProperty(const vtkProperty&);  // Not implemented.
    00271   void operator=(const vtkProperty&);  // Not implemented.
    00272 };
    00273
    00275 inline char *vtkProperty::GetInterpolationAsString(void)
    00276 {
    00277   if ( this->Interpolation == VTK_FLAT )
    00278     {
    00279     return (char *)"Flat";
    00280     }
    00281   else if ( this->Interpolation == VTK_GOURAUD )
    00282     {
    00283     return (char *)"Gouraud";
    00284     }
    00285   else
    00286     {
    00287     return (char *)"Phong";
    00288     }
    00289 }
    00290
    00291
    00293 inline char *vtkProperty::GetRepresentationAsString(void)
    00294 {
    00295   if ( this->Representation == VTK_POINTS )
    00296     {
    00297     return (char *)"Points";
    00298     }
    00299   else if ( this->Representation == VTK_WIREFRAME )
    00300     {
    00301     return (char *)"Wireframe";
    00302     }
    00303   else
    00304     {
    00305     return (char *)"Surface";
    00306     }
    00307 }
    00308
    00309
    00310
    00311 #endif