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

dox/Rendering/vtkLight.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkLight.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 =========================================================================*/
00050 #ifndef __vtkLight_h
00051 #define __vtkLight_h
00052 
00053 #include "vtkObject.h"
00054 
00055 /* need for virtual function */
00056 class vtkRenderer;
00057 class vtkMatrix4x4;
00058 
00059 #define VTK_LIGHT_TYPE_HEADLIGHT    1
00060 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
00061 #define VTK_LIGHT_TYPE_SCENE_LIGHT  3
00062 
00063 class VTK_RENDERING_EXPORT vtkLight : public vtkObject
00064 {
00065 public:
00066   vtkTypeRevisionMacro(vtkLight,vtkObject);
00067   void PrintSelf(ostream& os, vtkIndent indent);
00068 
00072   static vtkLight *New();
00073 
00078   virtual void Render(vtkRenderer *, int) {};
00079 
00081 
00082   vtkSetVector3Macro(Color,float);
00083   vtkGetVectorMacro(Color,float,3);
00085 
00087 
00091   vtkSetVector3Macro(Position,float);
00092   vtkGetVectorMacro(Position,float,3);
00093   void SetPosition(double *a) {this->SetPosition(
00094     static_cast<float>(a[0]),
00095     static_cast<float>(a[1]),
00096     static_cast<float>(a[2]));};
00098   
00100 
00105   vtkSetVector3Macro(FocalPoint,float);
00106   vtkGetVectorMacro(FocalPoint,float,3);
00107   void SetFocalPoint(double *a) {this->SetFocalPoint(
00108     static_cast<float>(a[0]),
00109     static_cast<float>(a[1]),
00110     static_cast<float>(a[2]));};
00112 
00114 
00115   vtkSetMacro(Intensity,float);
00116   vtkGetMacro(Intensity,float);
00118 
00120 
00121   vtkSetMacro(Switch,int);
00122   vtkGetMacro(Switch,int);
00123   vtkBooleanMacro(Switch,int);
00125 
00127 
00128   vtkSetMacro(Positional,int);
00129   vtkGetMacro(Positional,int);
00130   vtkBooleanMacro(Positional,int);
00132 
00134 
00135   vtkSetMacro(Exponent,float);
00136   vtkGetMacro(Exponent,float);
00138 
00140 
00143   vtkSetMacro(ConeAngle,float);
00144   vtkGetMacro(ConeAngle,float);
00146 
00148 
00150   vtkSetVector3Macro(AttenuationValues,float);
00151   vtkGetVectorMacro(AttenuationValues,float,3);
00153 
00155 
00158   virtual void SetTransformMatrix(vtkMatrix4x4*);
00159   vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
00161 
00163 
00165   void GetTransformedPosition(float &a0, float &a1, float &a2);
00166   void GetTransformedPosition(float a[3]);
00167   float *GetTransformedPosition();
00169 
00171 
00173   void GetTransformedFocalPoint(float &a0, float &a1, float &a2);
00174   void GetTransformedFocalPoint(float a[3]);
00175   float *GetTransformedFocalPoint();
00177 
00179 
00183   void SetDirectionAngle(float elevation, float azimuth);
00184   void SetDirectionAngle(float ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); };
00186 
00188   void DeepCopy(vtkLight *light);
00189 
00191 
00202   vtkSetMacro(LightType, int);
00203   vtkGetMacro(LightType, int);
00204   void SetLightTypeToHeadlight()
00205     {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);}
00206   void SetLightTypeToSceneLight()
00207     {
00208     this->SetTransformMatrix(NULL);
00209     this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT);
00210     }
00211   void SetLightTypeToCameraLight()
00212     {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);}
00214 
00216 
00217   int LightTypeIsHeadlight();
00218   int LightTypeIsSceneLight();
00219   int LightTypeIsCameraLight();
00221 
00222   void ReadSelf(istream& is);
00223   void WriteSelf(ostream& os);
00224   
00225 protected:
00226   vtkLight();
00227   ~vtkLight();
00228 
00229   float FocalPoint[3];
00230   float Position[3];
00231   float Intensity;
00232   float Color[3];
00233   int   Switch;
00234   int   Positional;
00235   float Exponent;
00236   float ConeAngle;
00237   float AttenuationValues[3];
00238   vtkMatrix4x4 *TransformMatrix;
00239   float TransformedFocalPointReturn[3];
00240   float TransformedPositionReturn[3];
00241   int LightType;
00242 private:
00243   vtkLight(const vtkLight&);  // Not implemented.
00244   void operator=(const vtkLight&);  // Not implemented.
00245 };
00246 
00247 #endif