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

graphics/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 
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 =========================================================================*/
00060 #ifndef __vtkProperty_h
00061 #define __vtkProperty_h
00062 
00063 #include "vtkRender.h"
00064 #include "vtkObject.h"
00065 #include "vtkStructuredPoints.h"
00066 
00067 class vtkRenderer;
00068 class vtkActor;
00069 
00070 class VTK_EXPORT vtkProperty : public vtkObject
00071 {
00072 public:
00073   vtkTypeMacro(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   vtkSetClampMacro(Interpolation,int,VTK_FLAT,VTK_PHONG);
00102   vtkGetMacro(Interpolation,int);
00103   void SetInterpolationToFlat() {this->SetInterpolation(VTK_FLAT);};
00104   void SetInterpolationToGouraud() {this->SetInterpolation(VTK_GOURAUD);};
00105   void SetInterpolationToPhong() {this->SetInterpolation(VTK_PHONG);};
00106   char *GetInterpolationAsString();
00107 
00109   vtkSetClampMacro(Representation,int,VTK_POINTS,VTK_SURFACE);
00110   vtkGetMacro(Representation,int);
00111   void SetRepresentationToPoints() {this->SetRepresentation(VTK_POINTS);};
00112   void SetRepresentationToWireframe() {
00113     this->SetRepresentation(VTK_WIREFRAME);};
00114   void SetRepresentationToSurface() {this->SetRepresentation(VTK_SURFACE);};
00115   char *GetRepresentationAsString();
00116 
00120   void SetColor(float r,float g,float b);
00121   void SetColor(float a[3]) { this->SetColor(a[0], a[1], a[2]); };
00122   float *GetColor();
00123   void GetColor(float rgb[3]);
00124 
00126   vtkSetClampMacro(Ambient,float,0.0,1.0);
00127   vtkGetMacro(Ambient,float);
00128 
00130   vtkSetClampMacro(Diffuse,float,0.0,1.0);
00131   vtkGetMacro(Diffuse,float);
00132 
00134   vtkSetClampMacro(Specular,float,0.0,1.0);
00135   vtkGetMacro(Specular,float);
00136 
00138   vtkSetClampMacro(SpecularPower,float,0.0,100.0);
00139   vtkGetMacro(SpecularPower,float);
00140 
00143   vtkSetClampMacro(Opacity,float,0.0,1.0);
00144   vtkGetMacro(Opacity,float);
00145 
00150   vtkSetVector3Macro(AmbientColor,float);
00151   vtkGetVectorMacro(AmbientColor,float,3);
00152 
00154   vtkSetVector3Macro(DiffuseColor,float);
00155   vtkGetVectorMacro(DiffuseColor,float,3);
00156 
00158   vtkSetVector3Macro(SpecularColor,float);
00159   vtkGetVectorMacro(SpecularColor,float,3);
00160 
00164   vtkGetMacro(EdgeVisibility,int);
00165   vtkSetMacro(EdgeVisibility,int);
00166   vtkBooleanMacro(EdgeVisibility,int);
00167 
00169   vtkSetVector3Macro(EdgeColor,float);
00170   vtkGetVectorMacro(EdgeColor,float,3);
00171 
00174   vtkSetClampMacro(LineWidth,float,0,VTK_LARGE_FLOAT);
00175   vtkGetMacro(LineWidth,float);
00176 
00179   vtkSetClampMacro(PointSize,float,0,VTK_LARGE_FLOAT);
00180   vtkGetMacro(PointSize,float);
00181 
00185   vtkGetMacro(BackfaceCulling,int);
00186   vtkSetMacro(BackfaceCulling,int);
00187   vtkBooleanMacro(BackfaceCulling,int);
00188 
00192   vtkGetMacro(FrontfaceCulling,int);
00193   vtkSetMacro(FrontfaceCulling,int);
00194   vtkBooleanMacro(FrontfaceCulling,int);
00195 
00196 protected:
00197   vtkProperty();
00198   ~vtkProperty() {};
00199   vtkProperty(const vtkProperty&) {};
00200   void operator=(const vtkProperty&) {};
00201 
00202   float Color[3];
00203   float AmbientColor[3];
00204   float DiffuseColor[3];
00205   float SpecularColor[3];
00206   float EdgeColor[3];
00207   float Ambient;
00208   float Diffuse;
00209   float Specular;
00210   float SpecularPower;
00211   float Opacity;
00212   float PointSize;
00213   float LineWidth;
00214   int   Interpolation; 
00215   int   Representation;
00216   int   EdgeVisibility;
00217   int   BackfaceCulling;
00218   int   FrontfaceCulling;
00219 };
00220 
00222 inline char *vtkProperty::GetInterpolationAsString(void)
00223 {
00224   if ( this->Interpolation == VTK_FLAT )
00225     {
00226     return (char *)"Flat";
00227     }
00228   else if ( this->Interpolation == VTK_GOURAUD ) 
00229     {
00230     return (char *)"Gouraud";
00231     }
00232   else 
00233     {
00234     return (char *)"Phong";
00235     }
00236 }
00237 
00238 
00240 inline char *vtkProperty::GetRepresentationAsString(void)
00241 {
00242   if ( this->Representation == VTK_POINTS )
00243     {
00244     return (char *)"Points";
00245     }
00246   else if ( this->Representation == VTK_WIREFRAME ) 
00247     {
00248     return (char *)"Wireframe";
00249     }
00250   else 
00251     {
00252     return (char *)"Surface";
00253     }
00254 }
00255 
00256 
00257 
00258 #endif

Generated on Wed Nov 21 12:27:02 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001