00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00040 #ifndef __vtkProperty_h
00041 #define __vtkProperty_h
00042
00043 #include "vtkObject.h"
00044
00045
00046 #define VTK_FLAT 0
00047 #define VTK_GOURAUD 1
00048 #define VTK_PHONG 2
00049
00050
00051 #define VTK_POINTS 0
00052 #define VTK_WIREFRAME 1
00053 #define VTK_SURFACE 2
00054
00055 class vtkRenderer;
00056 class vtkActor;
00057
00058 class VTK_RENDERING_EXPORT vtkProperty : public vtkObject
00059 {
00060 public:
00061 vtkTypeRevisionMacro(vtkProperty,vtkObject);
00062 void PrintSelf(ostream& os, vtkIndent indent);
00063
00069 static vtkProperty *New();
00070
00072 void DeepCopy(vtkProperty *p);
00073
00079 virtual void Render(vtkActor *,vtkRenderer *) {};
00080
00086 virtual void BackfaceRender(vtkActor *,vtkRenderer *) {};
00087
00089
00090 vtkSetClampMacro(Interpolation,int,VTK_FLAT,VTK_PHONG);
00091 vtkGetMacro(Interpolation,int);
00092 void SetInterpolationToFlat() {this->SetInterpolation(VTK_FLAT);};
00093 void SetInterpolationToGouraud() {this->SetInterpolation(VTK_GOURAUD);};
00094 void SetInterpolationToPhong() {this->SetInterpolation(VTK_PHONG);};
00095 char *GetInterpolationAsString();
00097
00099
00100 vtkSetClampMacro(Representation,int,VTK_POINTS,VTK_SURFACE);
00101 vtkGetMacro(Representation,int);
00102 void SetRepresentationToPoints() {this->SetRepresentation(VTK_POINTS);};
00103 void SetRepresentationToWireframe() {
00104 this->SetRepresentation(VTK_WIREFRAME);};
00105 void SetRepresentationToSurface() {this->SetRepresentation(VTK_SURFACE);};
00106 char *GetRepresentationAsString();
00108
00110
00113 void SetColor(float r,float g,float b);
00114 void SetColor(float a[3]) { this->SetColor(a[0], a[1], a[2]); };
00115 float *GetColor();
00116 void GetColor(float rgb[3]);
00118
00120
00121 vtkSetClampMacro(Ambient,float,0.0f,1.0f);
00122 vtkGetMacro(Ambient,float);
00124
00126
00127 vtkSetClampMacro(Diffuse,float,0.0f,1.0f);
00128 vtkGetMacro(Diffuse,float);
00130
00132
00133 vtkSetClampMacro(Specular,float,0.0f,1.0f);
00134 vtkGetMacro(Specular,float);
00136
00138
00139 vtkSetClampMacro(SpecularPower,float,0.0f,100.0f);
00140 vtkGetMacro(SpecularPower,float);
00142
00144
00146 vtkSetClampMacro(Opacity,float,0.0f,1.0f);
00147 vtkGetMacro(Opacity,float);
00149
00151
00155 vtkSetVector3Macro(AmbientColor,float);
00156 vtkGetVectorMacro(AmbientColor,float,3);
00158
00160
00161 vtkSetVector3Macro(DiffuseColor,float);
00162 vtkGetVectorMacro(DiffuseColor,float,3);
00164
00166
00167 vtkSetVector3Macro(SpecularColor,float);
00168 vtkGetVectorMacro(SpecularColor,float,3);
00170
00172
00175 vtkGetMacro(EdgeVisibility,int);
00176 vtkSetMacro(EdgeVisibility,int);
00177 vtkBooleanMacro(EdgeVisibility,int);
00179
00181
00182 vtkSetVector3Macro(EdgeColor,float);
00183 vtkGetVectorMacro(EdgeColor,float,3);
00185
00187
00189 vtkSetClampMacro(LineWidth,float,0,VTK_LARGE_FLOAT);
00190 vtkGetMacro(LineWidth,float);
00192
00194
00197 vtkSetMacro(LineStipplePattern,int);
00198 vtkGetMacro(LineStipplePattern,int);
00200
00202
00205 vtkSetClampMacro(LineStippleRepeatFactor,int,1,VTK_LARGE_INTEGER);
00206 vtkGetMacro(LineStippleRepeatFactor,int);
00208
00210
00212 vtkSetClampMacro(PointSize,float,0,VTK_LARGE_FLOAT);
00213 vtkGetMacro(PointSize,float);
00215
00217
00220 vtkGetMacro(BackfaceCulling,int);
00221 vtkSetMacro(BackfaceCulling,int);
00222 vtkBooleanMacro(BackfaceCulling,int);
00224
00226
00229 vtkGetMacro(FrontfaceCulling,int);
00230 vtkSetMacro(FrontfaceCulling,int);
00231 vtkBooleanMacro(FrontfaceCulling,int);
00233
00234 protected:
00235 vtkProperty();
00236 ~vtkProperty() {};
00237
00238 float Color[3];
00239 float AmbientColor[3];
00240 float DiffuseColor[3];
00241 float SpecularColor[3];
00242 float EdgeColor[3];
00243 float Ambient;
00244 float Diffuse;
00245 float Specular;
00246 float SpecularPower;
00247 float Opacity;
00248 float PointSize;
00249 float LineWidth;
00250 int LineStipplePattern;
00251 int LineStippleRepeatFactor;
00252 int Interpolation;
00253 int Representation;
00254 int EdgeVisibility;
00255 int BackfaceCulling;
00256 int FrontfaceCulling;
00257 private:
00258 vtkProperty(const vtkProperty&);
00259 void operator=(const vtkProperty&);
00260 };
00261
00263 inline char *vtkProperty::GetInterpolationAsString(void)
00264 {
00265 if ( this->Interpolation == VTK_FLAT )
00266 {
00267 return (char *)"Flat";
00268 }
00269 else if ( this->Interpolation == VTK_GOURAUD )
00270 {
00271 return (char *)"Gouraud";
00272 }
00273 else
00274 {
00275 return (char *)"Phong";
00276 }
00277 }
00278
00279
00281 inline char *vtkProperty::GetRepresentationAsString(void)
00282 {
00283 if ( this->Representation == VTK_POINTS )
00284 {
00285 return (char *)"Points";
00286 }
00287 else if ( this->Representation == VTK_WIREFRAME )
00288 {
00289 return (char *)"Wireframe";
00290 }
00291 else
00292 {
00293 return (char *)"Surface";
00294 }
00295 }
00296
00297
00298
00299 #endif