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 "vtkRenderingCoreModule.h" // For export macro 00050 #include "vtkObject.h" 00051 00052 /* need for virtual function */ 00053 class vtkRenderer; 00054 class vtkMatrix4x4; 00055 00056 #define VTK_LIGHT_TYPE_HEADLIGHT 1 00057 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2 00058 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3 00059 00060 class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject 00061 { 00062 public: 00063 vtkTypeMacro(vtkLight,vtkObject); 00064 void PrintSelf(ostream& os, vtkIndent indent); 00065 00072 static vtkLight *New(); 00073 00078 virtual vtkLight *ShallowClone(); 00079 00084 virtual void Render(vtkRenderer *, int) {} 00085 00087 00091 vtkSetVector3Macro(AmbientColor,double); 00092 vtkGetVectorMacro(AmbientColor,double,3); 00093 vtkSetVector3Macro(DiffuseColor,double); 00094 vtkGetVectorMacro(DiffuseColor,double,3); 00095 vtkSetVector3Macro(SpecularColor,double); 00096 vtkGetVectorMacro(SpecularColor,double,3); 00097 void SetColor(double, double, double); 00098 void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); } 00100 00102 00106 vtkSetVector3Macro(Position,double); 00107 vtkGetVectorMacro(Position,double,3); 00108 void SetPosition(const float *a) {this->SetPosition(a[0],a[1],a[2]);}; 00110 00112 00117 vtkSetVector3Macro(FocalPoint,double); 00118 vtkGetVectorMacro(FocalPoint,double,3); 00119 void SetFocalPoint(const float *a) {this->SetFocalPoint(a[0],a[1],a[2]);}; 00121 00123 00124 vtkSetMacro(Intensity,double); 00125 vtkGetMacro(Intensity,double); 00127 00129 00130 vtkSetMacro(Switch,int); 00131 vtkGetMacro(Switch,int); 00132 vtkBooleanMacro(Switch,int); 00134 00136 00137 vtkSetMacro(Positional,int); 00138 vtkGetMacro(Positional,int); 00139 vtkBooleanMacro(Positional,int); 00141 00143 00144 vtkSetClampMacro(Exponent,double,0.0,128.0); 00145 vtkGetMacro(Exponent,double); 00147 00149 00153 vtkSetMacro(ConeAngle,double); 00154 vtkGetMacro(ConeAngle,double); 00156 00158 00160 vtkSetVector3Macro(AttenuationValues,double); 00161 vtkGetVectorMacro(AttenuationValues,double,3); 00163 00165 00168 virtual void SetTransformMatrix(vtkMatrix4x4*); 00169 vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4); 00171 00173 00175 void GetTransformedPosition(double &a0, double &a1, double &a2); 00176 void GetTransformedPosition(double a[3]); 00177 double *GetTransformedPosition(); 00179 00181 00183 void GetTransformedFocalPoint(double &a0, double &a1, double &a2); 00184 void GetTransformedFocalPoint(double a[3]); 00185 double *GetTransformedFocalPoint(); 00187 00189 00193 void SetDirectionAngle(double elevation, double azimuth); 00194 void SetDirectionAngle(const double ang[2]) { 00195 this->SetDirectionAngle(ang[0], ang[1]); }; 00197 00199 void DeepCopy(vtkLight *light); 00200 00202 00213 vtkSetMacro(LightType, int); 00214 vtkGetMacro(LightType, int); 00215 void SetLightTypeToHeadlight() 00216 {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);} 00217 void SetLightTypeToSceneLight() 00218 { 00219 this->SetTransformMatrix(NULL); 00220 this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT); 00221 } 00222 void SetLightTypeToCameraLight() 00223 {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);} 00225 00227 00228 int LightTypeIsHeadlight(); 00229 int LightTypeIsSceneLight(); 00230 int LightTypeIsCameraLight(); 00232 00233 void ReadSelf(istream& is); 00234 void WriteSelf(ostream& os); 00235 00236 protected: 00237 vtkLight(); 00238 ~vtkLight(); 00239 00240 double FocalPoint[3]; 00241 double Position[3]; 00242 double Intensity; 00243 double AmbientColor[3]; 00244 double DiffuseColor[3]; 00245 double SpecularColor[3]; 00246 int Switch; 00247 int Positional; 00248 double Exponent; 00249 double ConeAngle; 00250 double AttenuationValues[3]; 00251 vtkMatrix4x4 *TransformMatrix; 00252 double TransformedFocalPointReturn[3]; 00253 double TransformedPositionReturn[3]; 00254 int LightType; 00255 00256 private: 00257 vtkLight(const vtkLight&); // Not implemented. 00258 void operator=(const vtkLight&); // Not implemented. 00259 }; 00260 00261 #endif