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 
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 =========================================================================*/
00064 #ifndef __vtkProperty_h
00065 #define __vtkProperty_h
00066 
00067 #include "vtkRender.h"
00068 #include "vtkObject.h"
00069 #include "vtkStructuredPoints.h"
00070 
00071 class vtkRenderer;
00072 class vtkActor;
00073 
00074 class VTK_RENDERING_EXPORT vtkProperty : public vtkObject
00075 {
00076 public:
00077   vtkTypeMacro(vtkProperty,vtkObject);
00078   void PrintSelf(ostream& os, vtkIndent indent);
00079 
00085   static vtkProperty *New();
00086 
00088   void DeepCopy(vtkProperty *p);
00089 
00095   virtual void Render(vtkActor *,vtkRenderer *) {};
00096 
00102   virtual void BackfaceRender(vtkActor *,vtkRenderer *) {};
00103 
00105 
00106   vtkSetClampMacro(Interpolation,int,VTK_FLAT,VTK_PHONG);
00107   vtkGetMacro(Interpolation,int);
00108   void SetInterpolationToFlat() {this->SetInterpolation(VTK_FLAT);};
00109   void SetInterpolationToGouraud() {this->SetInterpolation(VTK_GOURAUD);};
00110   void SetInterpolationToPhong() {this->SetInterpolation(VTK_PHONG);};
00111   char *GetInterpolationAsString();
00113 
00115 
00116   vtkSetClampMacro(Representation,int,VTK_POINTS,VTK_SURFACE);
00117   vtkGetMacro(Representation,int);
00118   void SetRepresentationToPoints() {this->SetRepresentation(VTK_POINTS);};
00119   void SetRepresentationToWireframe() {
00120     this->SetRepresentation(VTK_WIREFRAME);};
00121   void SetRepresentationToSurface() {this->SetRepresentation(VTK_SURFACE);};
00122   char *GetRepresentationAsString();
00124 
00126 
00129   void SetColor(float r,float g,float b);
00130   void SetColor(float a[3]) { this->SetColor(a[0], a[1], a[2]); };
00131   float *GetColor();
00132   void GetColor(float rgb[3]);
00134 
00136 
00137   vtkSetClampMacro(Ambient,float,0.0,1.0);
00138   vtkGetMacro(Ambient,float);
00140 
00142 
00143   vtkSetClampMacro(Diffuse,float,0.0,1.0);
00144   vtkGetMacro(Diffuse,float);
00146 
00148 
00149   vtkSetClampMacro(Specular,float,0.0,1.0);
00150   vtkGetMacro(Specular,float);
00152 
00154 
00155   vtkSetClampMacro(SpecularPower,float,0.0,100.0);
00156   vtkGetMacro(SpecularPower,float);
00158 
00160 
00162   vtkSetClampMacro(Opacity,float,0.0,1.0);
00163   vtkGetMacro(Opacity,float);
00165 
00167 
00171   vtkSetVector3Macro(AmbientColor,float);
00172   vtkGetVectorMacro(AmbientColor,float,3);
00174 
00176 
00177   vtkSetVector3Macro(DiffuseColor,float);
00178   vtkGetVectorMacro(DiffuseColor,float,3);
00180 
00182 
00183   vtkSetVector3Macro(SpecularColor,float);
00184   vtkGetVectorMacro(SpecularColor,float,3);
00186 
00188 
00191   vtkGetMacro(EdgeVisibility,int);
00192   vtkSetMacro(EdgeVisibility,int);
00193   vtkBooleanMacro(EdgeVisibility,int);
00195 
00197 
00198   vtkSetVector3Macro(EdgeColor,float);
00199   vtkGetVectorMacro(EdgeColor,float,3);
00201 
00203 
00205   vtkSetClampMacro(LineWidth,float,0,VTK_LARGE_FLOAT);
00206   vtkGetMacro(LineWidth,float);
00208 
00210 
00213   vtkSetMacro(LineStipplePattern,int);
00214   vtkGetMacro(LineStipplePattern,int);
00216 
00218 
00221   vtkSetClampMacro(LineStippleRepeatFactor,int,1,VTK_LARGE_INTEGER);
00222   vtkGetMacro(LineStippleRepeatFactor,int);
00224 
00226 
00228   vtkSetClampMacro(PointSize,float,0,VTK_LARGE_FLOAT);
00229   vtkGetMacro(PointSize,float);
00231 
00233 
00236   vtkGetMacro(BackfaceCulling,int);
00237   vtkSetMacro(BackfaceCulling,int);
00238   vtkBooleanMacro(BackfaceCulling,int);
00240 
00242 
00245   vtkGetMacro(FrontfaceCulling,int);
00246   vtkSetMacro(FrontfaceCulling,int);
00247   vtkBooleanMacro(FrontfaceCulling,int);
00249 
00250 protected:
00251   vtkProperty();
00252   ~vtkProperty() {};
00253 
00254   float Color[3];
00255   float AmbientColor[3];
00256   float DiffuseColor[3];
00257   float SpecularColor[3];
00258   float EdgeColor[3];
00259   float Ambient;
00260   float Diffuse;
00261   float Specular;
00262   float SpecularPower;
00263   float Opacity;
00264   float PointSize;
00265   float LineWidth;
00266   int   LineStipplePattern;
00267   int   LineStippleRepeatFactor;
00268   int   Interpolation; 
00269   int   Representation;
00270   int   EdgeVisibility;
00271   int   BackfaceCulling;
00272   int   FrontfaceCulling;
00273 private:
00274   vtkProperty(const vtkProperty&);  // Not implemented.
00275   void operator=(const vtkProperty&);  // Not implemented.
00276 };
00277 
00279 inline char *vtkProperty::GetInterpolationAsString(void)
00280 {
00281   if ( this->Interpolation == VTK_FLAT )
00282     {
00283     return (char *)"Flat";
00284     }
00285   else if ( this->Interpolation == VTK_GOURAUD ) 
00286     {
00287     return (char *)"Gouraud";
00288     }
00289   else 
00290     {
00291     return (char *)"Phong";
00292     }
00293 }
00294 
00295 
00297 inline char *vtkProperty::GetRepresentationAsString(void)
00298 {
00299   if ( this->Representation == VTK_POINTS )
00300     {
00301     return (char *)"Points";
00302     }
00303   else if ( this->Representation == VTK_WIREFRAME ) 
00304     {
00305     return (char *)"Wireframe";
00306     }
00307   else 
00308     {
00309     return (char *)"Surface";
00310     }
00311 }
00312 
00313 
00314 
00315 #endif

Generated on Thu Mar 28 14:19:33 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001