VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkLight.h 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 =========================================================================*/ 00046 #ifndef __vtkLight_h 00047 #define __vtkLight_h 00048 00049 #include "vtkObject.h" 00050 00051 /* need for virtual function */ 00052 class vtkRenderer; 00053 class vtkMatrix4x4; 00054 00055 #define VTK_LIGHT_TYPE_HEADLIGHT 1 00056 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2 00057 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3 00058 00059 class VTK_RENDERING_EXPORT vtkLight : public vtkObject 00060 { 00061 public: 00062 vtkTypeMacro(vtkLight,vtkObject); 00063 void PrintSelf(ostream& os, vtkIndent indent); 00064 00071 static vtkLight *New(); 00072 00077 virtual vtkLight *ShallowClone(); 00078 00083 virtual void Render(vtkRenderer *, int) {}; 00084 00086 00090 vtkSetVector3Macro(AmbientColor,double); 00091 vtkGetVectorMacro(AmbientColor,double,3); 00092 vtkSetVector3Macro(DiffuseColor,double); 00093 vtkGetVectorMacro(DiffuseColor,double,3); 00094 vtkSetVector3Macro(SpecularColor,double); 00095 vtkGetVectorMacro(SpecularColor,double,3); 00096 void SetColor(double, double, double); 00097 void SetColor(double a[3]) { this->SetColor(a[0], a[1], a[2]); } 00099 00101 00102 VTK_LEGACY(void GetColor(double rgb[3])); 00103 VTK_LEGACY(double *GetColor()); 00105 00107 00111 vtkSetVector3Macro(Position,double); 00112 vtkGetVectorMacro(Position,double,3); 00113 void SetPosition(float *a) {this->SetPosition(a[0],a[1],a[2]);}; 00115 00117 00122 vtkSetVector3Macro(FocalPoint,double); 00123 vtkGetVectorMacro(FocalPoint,double,3); 00124 void SetFocalPoint(float *a) {this->SetFocalPoint(a[0],a[1],a[2]);}; 00126 00128 00129 vtkSetMacro(Intensity,double); 00130 vtkGetMacro(Intensity,double); 00132 00134 00135 vtkSetMacro(Switch,int); 00136 vtkGetMacro(Switch,int); 00137 vtkBooleanMacro(Switch,int); 00139 00141 00142 vtkSetMacro(Positional,int); 00143 vtkGetMacro(Positional,int); 00144 vtkBooleanMacro(Positional,int); 00146 00148 00149 vtkSetClampMacro(Exponent,double,0.0,128.0); 00150 vtkGetMacro(Exponent,double); 00152 00154 00158 vtkSetMacro(ConeAngle,double); 00159 vtkGetMacro(ConeAngle,double); 00161 00163 00165 vtkSetVector3Macro(AttenuationValues,double); 00166 vtkGetVectorMacro(AttenuationValues,double,3); 00168 00170 00173 virtual void SetTransformMatrix(vtkMatrix4x4*); 00174 vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4); 00176 00178 00180 void GetTransformedPosition(double &a0, double &a1, double &a2); 00181 void GetTransformedPosition(double a[3]); 00182 double *GetTransformedPosition(); 00184 00186 00188 void GetTransformedFocalPoint(double &a0, double &a1, double &a2); 00189 void GetTransformedFocalPoint(double a[3]); 00190 double *GetTransformedFocalPoint(); 00192 00194 00198 void SetDirectionAngle(double elevation, double azimuth); 00199 void SetDirectionAngle(double ang[2]) { 00200 this->SetDirectionAngle(ang[0], ang[1]); }; 00202 00204 void DeepCopy(vtkLight *light); 00205 00207 00218 vtkSetMacro(LightType, int); 00219 vtkGetMacro(LightType, int); 00220 void SetLightTypeToHeadlight() 00221 {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);} 00222 void SetLightTypeToSceneLight() 00223 { 00224 this->SetTransformMatrix(NULL); 00225 this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT); 00226 } 00227 void SetLightTypeToCameraLight() 00228 {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);} 00230 00232 00233 int LightTypeIsHeadlight(); 00234 int LightTypeIsSceneLight(); 00235 int LightTypeIsCameraLight(); 00237 00238 void ReadSelf(istream& is); 00239 void WriteSelf(ostream& os); 00240 00241 protected: 00242 vtkLight(); 00243 ~vtkLight(); 00244 00245 double FocalPoint[3]; 00246 double Position[3]; 00247 double Intensity; 00248 double AmbientColor[3]; 00249 double DiffuseColor[3]; 00250 double SpecularColor[3]; 00251 int Switch; 00252 int Positional; 00253 double Exponent; 00254 double ConeAngle; 00255 double AttenuationValues[3]; 00256 vtkMatrix4x4 *TransformMatrix; 00257 double TransformedFocalPointReturn[3]; 00258 double TransformedPositionReturn[3]; 00259 int LightType; 00260 00261 private: 00262 vtkLight(const vtkLight&); // Not implemented. 00263 void operator=(const vtkLight&); // Not implemented. 00264 }; 00265 00266 #endif