VTK
|
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 =========================================================================*/ 00043 #ifndef __vtkLight_h 00044 #define __vtkLight_h 00045 00046 #include "vtkObject.h" 00047 00048 /* need for virtual function */ 00049 class vtkRenderer; 00050 class vtkMatrix4x4; 00051 00052 #define VTK_LIGHT_TYPE_HEADLIGHT 1 00053 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2 00054 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3 00055 00056 class VTK_RENDERING_EXPORT vtkLight : public vtkObject 00057 { 00058 public: 00059 vtkTypeRevisionMacro(vtkLight,vtkObject); 00060 void PrintSelf(ostream& os, vtkIndent indent); 00061 00068 static vtkLight *New(); 00069 00074 virtual void Render(vtkRenderer *, int) {}; 00075 00077 00081 vtkSetVector3Macro(AmbientColor,double); 00082 vtkGetVectorMacro(AmbientColor,double,3); 00083 vtkSetVector3Macro(DiffuseColor,double); 00084 vtkGetVectorMacro(DiffuseColor,double,3); 00085 vtkSetVector3Macro(SpecularColor,double); 00086 vtkGetVectorMacro(SpecularColor,double,3); 00087 void SetColor(double, double, double); 00088 void SetColor(double a[3]) { this->SetColor(a[0], a[1], a[2]); } 00089 void GetColor(double rgb[3]); 00090 double *GetColor(); 00092 00094 00098 vtkSetVector3Macro(Position,double); 00099 vtkGetVectorMacro(Position,double,3); 00100 void SetPosition(float *a) {this->SetPosition(a[0],a[1],a[2]);}; 00102 00104 00109 vtkSetVector3Macro(FocalPoint,double); 00110 vtkGetVectorMacro(FocalPoint,double,3); 00111 void SetFocalPoint(float *a) {this->SetFocalPoint(a[0],a[1],a[2]);}; 00113 00115 00116 vtkSetMacro(Intensity,double); 00117 vtkGetMacro(Intensity,double); 00119 00121 00122 vtkSetMacro(Switch,int); 00123 vtkGetMacro(Switch,int); 00124 vtkBooleanMacro(Switch,int); 00126 00128 00129 vtkSetMacro(Positional,int); 00130 vtkGetMacro(Positional,int); 00131 vtkBooleanMacro(Positional,int); 00133 00135 00136 vtkSetClampMacro(Exponent,double,0.0,128.0); 00137 vtkGetMacro(Exponent,double); 00139 00141 00145 vtkSetMacro(ConeAngle,double); 00146 vtkGetMacro(ConeAngle,double); 00148 00150 00152 vtkSetVector3Macro(AttenuationValues,double); 00153 vtkGetVectorMacro(AttenuationValues,double,3); 00155 00157 00160 virtual void SetTransformMatrix(vtkMatrix4x4*); 00161 vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4); 00163 00165 00167 void GetTransformedPosition(double &a0, double &a1, double &a2); 00168 void GetTransformedPosition(double a[3]); 00169 double *GetTransformedPosition(); 00171 00173 00175 void GetTransformedFocalPoint(double &a0, double &a1, double &a2); 00176 void GetTransformedFocalPoint(double a[3]); 00177 double *GetTransformedFocalPoint(); 00179 00181 00185 void SetDirectionAngle(double elevation, double azimuth); 00186 void SetDirectionAngle(double ang[2]) { 00187 this->SetDirectionAngle(ang[0], ang[1]); }; 00189 00191 void DeepCopy(vtkLight *light); 00192 00194 00205 vtkSetMacro(LightType, int); 00206 vtkGetMacro(LightType, int); 00207 void SetLightTypeToHeadlight() 00208 {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);} 00209 void SetLightTypeToSceneLight() 00210 { 00211 this->SetTransformMatrix(NULL); 00212 this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT); 00213 } 00214 void SetLightTypeToCameraLight() 00215 {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);} 00217 00219 00220 int LightTypeIsHeadlight(); 00221 int LightTypeIsSceneLight(); 00222 int LightTypeIsCameraLight(); 00224 00225 void ReadSelf(istream& is); 00226 void WriteSelf(ostream& os); 00227 00228 protected: 00229 vtkLight(); 00230 ~vtkLight(); 00231 00232 double FocalPoint[3]; 00233 double Position[3]; 00234 double Intensity; 00235 double AmbientColor[3]; 00236 double DiffuseColor[3]; 00237 double SpecularColor[3]; 00238 int Switch; 00239 int Positional; 00240 double Exponent; 00241 double ConeAngle; 00242 double AttenuationValues[3]; 00243 vtkMatrix4x4 *TransformMatrix; 00244 double TransformedFocalPointReturn[3]; 00245 double TransformedPositionReturn[3]; 00246 int LightType; 00247 00248 private: 00249 vtkLight(const vtkLight&); // Not implemented. 00250 void operator=(const vtkLight&); // Not implemented. 00251 }; 00252 00253 #endif