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

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 =========================================================================*/
00062 #ifndef __vtkLight_h
00063 #define __vtkLight_h
00064 
00065 #include "vtkObject.h"
00066 
00067 /* need for virtual function */
00068 class vtkRenderer;
00069 class vtkMatrix4x4;
00070 
00071 #define VTK_LIGHT_TYPE_HEADLIGHT    1
00072 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
00073 #define VTK_LIGHT_TYPE_SCENE_LIGHT  3
00074 
00075 class VTK_RENDERING_EXPORT vtkLight : public vtkObject
00076 {
00077 public:
00078   vtkTypeRevisionMacro(vtkLight,vtkObject);
00079   void PrintSelf(ostream& os, vtkIndent indent);
00080 
00084   static vtkLight *New();
00085 
00090   virtual void Render(vtkRenderer *, int) {};
00091 
00093 
00094   vtkSetVector3Macro(Color,float);
00095   vtkGetVectorMacro(Color,float,3);
00097 
00099 
00103   vtkSetVector3Macro(Position,float);
00104   vtkGetVectorMacro(Position,float,3);
00105   void SetPosition(double *a) {this->SetPosition(
00106     static_cast<float>(a[0]),
00107     static_cast<float>(a[1]),
00108     static_cast<float>(a[2]));};
00110   
00112 
00117   vtkSetVector3Macro(FocalPoint,float);
00118   vtkGetVectorMacro(FocalPoint,float,3);
00119   void SetFocalPoint(double *a) {this->SetFocalPoint(
00120     static_cast<float>(a[0]),
00121     static_cast<float>(a[1]),
00122     static_cast<float>(a[2]));};
00124 
00126 
00127   vtkSetMacro(Intensity,float);
00128   vtkGetMacro(Intensity,float);
00130 
00132 
00133   vtkSetMacro(Switch,int);
00134   vtkGetMacro(Switch,int);
00135   vtkBooleanMacro(Switch,int);
00137 
00139 
00140   vtkSetMacro(Positional,int);
00141   vtkGetMacro(Positional,int);
00142   vtkBooleanMacro(Positional,int);
00144 
00146 
00147   vtkSetMacro(Exponent,float);
00148   vtkGetMacro(Exponent,float);
00150 
00152 
00155   vtkSetMacro(ConeAngle,float);
00156   vtkGetMacro(ConeAngle,float);
00158 
00160 
00162   vtkSetVector3Macro(AttenuationValues,float);
00163   vtkGetVectorMacro(AttenuationValues,float,3);
00165 
00167 
00170   virtual void SetTransformMatrix(vtkMatrix4x4*);
00171   vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
00173 
00175 
00177   void GetTransformedPosition(float &a0, float &a1, float &a2);
00178   void GetTransformedPosition(float a[3]);
00179   float *GetTransformedPosition();
00181 
00183 
00185   void GetTransformedFocalPoint(float &a0, float &a1, float &a2);
00186   void GetTransformedFocalPoint(float a[3]);
00187   float *GetTransformedFocalPoint();
00189 
00191 
00195   void SetDirectionAngle(float elevation, float azimuth);
00196   void SetDirectionAngle(float ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); };
00198 
00200   void DeepCopy(vtkLight *light);
00201 
00203 
00214   vtkSetMacro(LightType, int);
00215   vtkGetMacro(LightType, int);
00216   void SetLightTypeToHeadlight()
00217     {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);}
00218   void SetLightTypeToSceneLight()
00219     {
00220     this->SetTransformMatrix(NULL);
00221     this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT);
00222     }
00223   void SetLightTypeToCameraLight()
00224     {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);}
00226 
00228 
00229   int LightTypeIsHeadlight();
00230   int LightTypeIsSceneLight();
00231   int LightTypeIsCameraLight();
00233 
00234   void ReadSelf(istream& is);
00235   void WriteSelf(ostream& os);
00236   
00237 protected:
00238   vtkLight();
00239   ~vtkLight();
00240 
00241   float FocalPoint[3];
00242   float Position[3];
00243   float Intensity;
00244   float Color[3];
00245   int   Switch;
00246   int   Positional;
00247   float Exponent;
00248   float ConeAngle;
00249   float AttenuationValues[3];
00250   vtkMatrix4x4 *TransformMatrix;
00251   float TransformedFocalPointReturn[3];
00252   float TransformedPositionReturn[3];
00253   int LightType;
00254 private:
00255   vtkLight(const vtkLight&);  // Not implemented.
00256   void operator=(const vtkLight&);  // Not implemented.
00257 };
00258 
00259 #endif