Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkLight.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkLight.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 =========================================================================*/
00058 #ifndef __vtkLight_h
00059 #define __vtkLight_h
00060 
00061 #include "vtkObject.h"
00062 
00063 /* need for virtual function */
00064 class vtkRenderer;
00065 class vtkMatrix4x4;
00066 
00067 #define VTK_LIGHT_TYPE_HEADLIGHT    1
00068 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
00069 #define VTK_LIGHT_TYPE_SCENE_LIGHT  3
00070 
00071 class VTK_RENDERING_EXPORT vtkLight : public vtkObject
00072 {
00073 public:
00074   vtkTypeRevisionMacro(vtkLight,vtkObject);
00075   void PrintSelf(ostream& os, vtkIndent indent);
00076 
00080   static vtkLight *New();
00081 
00086   virtual void Render(vtkRenderer *, int) {};
00087 
00089 
00093   vtkSetVector3Macro(AmbientColor,double);
00094   vtkGetVectorMacro(AmbientColor,double,3);
00095   vtkSetVector3Macro(DiffuseColor,double);
00096   vtkGetVectorMacro(DiffuseColor,double,3);
00097   vtkSetVector3Macro(SpecularColor,double);
00098   vtkGetVectorMacro(SpecularColor,double,3);
00099   void SetColor(double, double, double); 
00100   void SetColor(double a[3]) { this->SetColor(a[0], a[1], a[2]); }
00101   void GetColor(double rgb[3]);
00102   double *GetColor();
00104 
00106 
00110   vtkSetVector3Macro(Position,double);
00111   vtkGetVectorMacro(Position,double,3);
00112   void SetPosition(float *a) {this->SetPosition(a[0],a[1],a[2]);};
00114   
00116 
00121   vtkSetVector3Macro(FocalPoint,double);
00122   vtkGetVectorMacro(FocalPoint,double,3);
00123   void SetFocalPoint(float *a) {this->SetFocalPoint(a[0],a[1],a[2]);};
00125 
00127 
00128   vtkSetMacro(Intensity,double);
00129   vtkGetMacro(Intensity,double);
00131 
00133 
00134   vtkSetMacro(Switch,int);
00135   vtkGetMacro(Switch,int);
00136   vtkBooleanMacro(Switch,int);
00138 
00140 
00141   vtkSetMacro(Positional,int);
00142   vtkGetMacro(Positional,int);
00143   vtkBooleanMacro(Positional,int);
00145 
00147 
00148   vtkSetMacro(Exponent,double);
00149   vtkGetMacro(Exponent,double);
00151 
00153 
00156   vtkSetMacro(ConeAngle,double);
00157   vtkGetMacro(ConeAngle,double);
00159 
00161 
00163   vtkSetVector3Macro(AttenuationValues,double);
00164   vtkGetVectorMacro(AttenuationValues,double,3);
00166 
00168 
00171   virtual void SetTransformMatrix(vtkMatrix4x4*);
00172   vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
00174 
00176 
00178   void GetTransformedPosition(double &a0, double &a1, double &a2);
00179   void GetTransformedPosition(double a[3]);
00180   double *GetTransformedPosition();
00182 
00184 
00186   void GetTransformedFocalPoint(double &a0, double &a1, double &a2);
00187   void GetTransformedFocalPoint(double a[3]);
00188   double *GetTransformedFocalPoint();
00190 
00192 
00196   void SetDirectionAngle(double elevation, double azimuth);
00197   void SetDirectionAngle(double ang[2]) { 
00198     this->SetDirectionAngle(ang[0], ang[1]); };
00200 
00202   void DeepCopy(vtkLight *light);
00203 
00205 
00216   vtkSetMacro(LightType, int);
00217   vtkGetMacro(LightType, int);
00218   void SetLightTypeToHeadlight()
00219     {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);}
00220   void SetLightTypeToSceneLight()
00221     {
00222     this->SetTransformMatrix(NULL);
00223     this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT);
00224     }
00225   void SetLightTypeToCameraLight()
00226     {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);}
00228 
00230 
00231   int LightTypeIsHeadlight();
00232   int LightTypeIsSceneLight();
00233   int LightTypeIsCameraLight();
00235 
00236   void ReadSelf(istream& is);
00237   void WriteSelf(ostream& os);
00238   
00239 protected:
00240   vtkLight();
00241   ~vtkLight();
00242 
00243   double FocalPoint[3];
00244   double Position[3];
00245   double Intensity;
00246   double AmbientColor[3];
00247   double DiffuseColor[3];
00248   double SpecularColor[3];
00249   int   Switch;
00250   int   Positional;
00251   double Exponent;
00252   double ConeAngle;
00253   double AttenuationValues[3];
00254   vtkMatrix4x4 *TransformMatrix;
00255   double TransformedFocalPointReturn[3];
00256   double TransformedPositionReturn[3];
00257   int LightType;
00258 
00259 private:
00260   vtkLight(const vtkLight&);  // Not implemented.
00261   void operator=(const vtkLight&);  // Not implemented.
00262 };
00263 
00264 #endif