00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00094 #ifndef __vtkLightKit_h
00095 #define __vtkLightKit_h
00096
00097 #include "vtkObject.h"
00098
00099 class vtkLight;
00100 class vtkPiecewiseFunction;
00101 class vtkRenderer;
00102
00103 class VTK_RENDERING_EXPORT vtkLightKit : public vtkObject
00104 {
00105 public:
00106 static vtkLightKit *New();
00107 vtkTypeRevisionMacro(vtkLightKit, vtkObject);
00108 void PrintSelf(ostream& os, vtkIndent indent);
00109
00110
00111 enum LightKitType {
00112 TKeyLight,
00113 TFillLight,
00114 TBackLight,
00115 THeadLight
00116 };
00117
00118 enum LightKitSubType {
00119 Warmth,
00120 Intensity,
00121 Elevation,
00122 Azimuth,
00123 KFRatio,
00124 KBRatio,
00125 KHRatio
00126 };
00127
00128
00129
00131
00134 vtkSetMacro(KeyLightIntensity, double);
00135 vtkGetMacro(KeyLightIntensity, double);
00137
00139
00147 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_FLOAT_MAX);
00148 vtkGetMacro(KeyToFillRatio, double);
00150
00152
00161 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_FLOAT_MAX);
00162 vtkGetMacro(KeyToHeadRatio, double);
00164
00166
00171 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_FLOAT_MAX);
00172 vtkGetMacro(KeyToBackRatio, double);
00174
00176
00185 vtkSetMacro(KeyLightWarmth, double);
00186 vtkGetMacro(KeyLightWarmth, double);
00188
00189 vtkSetMacro(FillLightWarmth, double);
00190 vtkGetMacro(FillLightWarmth, double);
00191
00192 vtkSetMacro(HeadLightWarmth, double);
00193 vtkGetMacro(HeadLightWarmth, double);
00194
00195 vtkSetMacro(BackLightWarmth, double);
00196 vtkGetMacro(BackLightWarmth, double);
00197
00199
00200 vtkGetVectorMacro(KeyLightColor, double, 3);
00201 vtkGetVectorMacro(FillLightColor, double, 3);
00202 vtkGetVectorMacro(HeadLightColor, double, 3);
00203 vtkGetVectorMacro(BackLightColor, double, 3);
00205
00207
00208 VTK_LEGACY(void SetHeadlightWarmth(double v));
00209 VTK_LEGACY(double GetHeadlightWarmth());
00210 VTK_LEGACY(void GetHeadlightColor(double *color));
00212
00214
00217 vtkBooleanMacro(MaintainLuminance, int);
00218 vtkGetMacro(MaintainLuminance, int);
00219 vtkSetMacro(MaintainLuminance, int);
00221
00223
00234 void SetKeyLightAngle(double elevation, double azimuth);
00235 void SetKeyLightAngle(double angle[2]) {
00236 this->SetKeyLightAngle(angle[0], angle[1]); };
00238
00239 void SetKeyLightElevation(double x) {
00240 this->SetKeyLightAngle(x, this->KeyLightAngle[1]); };
00241
00242 void SetKeyLightAzimuth(double x) {
00243 this->SetKeyLightAngle(this->KeyLightAngle[0], x); };
00244
00245 vtkGetVectorMacro(KeyLightAngle, double, 2);
00246 double GetKeyLightElevation() {
00247 double ang[2]; this->GetKeyLightAngle(ang); return ang[0]; };
00248
00249 double GetKeyLightAzimuth() {
00250 double ang[2]; this->GetKeyLightAngle(ang); return ang[1]; };
00251
00252 void SetFillLightAngle(double elevation, double azimuth);
00253 void SetFillLightAngle(double angle[2]) {
00254 this->SetFillLightAngle(angle[0], angle[1]); };
00255
00256 void SetFillLightElevation(double x) {
00257 this->SetFillLightAngle(x, this->FillLightAngle[1]); };
00258
00259 void SetFillLightAzimuth(double x) {
00260 this->SetFillLightAngle(this->FillLightAngle[0], x); };
00261
00262 vtkGetVectorMacro(FillLightAngle, double, 2);
00263 double GetFillLightElevation() {
00264 double ang[2]; this->GetFillLightAngle(ang); return ang[0]; };
00265
00266 double GetFillLightAzimuth() {
00267 double ang[2]; this->GetFillLightAngle(ang); return ang[1]; };
00268
00269 void SetBackLightAngle(double elevation, double azimuth);
00270 void SetBackLightAngle(double angle[2]) {
00271 this->SetBackLightAngle(angle[0], angle[1]); };
00272
00273 void SetBackLightElevation(double x) {
00274 this->SetBackLightAngle(x, this->BackLightAngle[1]); };
00275
00276 void SetBackLightAzimuth(double x) {
00277 this->SetBackLightAngle(this->BackLightAngle[0], x); };
00278
00279 vtkGetVectorMacro(BackLightAngle, double, 2);
00280 double GetBackLightElevation() {
00281 double ang[2]; this->GetBackLightAngle(ang); return ang[0]; };
00282
00283 double GetBackLightAzimuth() {
00284 double ang[2]; this->GetBackLightAngle(ang); return ang[1]; };
00285
00287
00289 void AddLightsToRenderer(vtkRenderer *renderer);
00290 void RemoveLightsFromRenderer(vtkRenderer *renderer);
00292
00293 void DeepCopy(vtkLightKit *kit);
00294
00295 void Modified();
00296 void Update();
00297
00299 static const char *GetStringFromType(int type);
00300
00302 static const char *GetStringFromSubType(int type);
00303
00307 static const char *GetShortStringFromSubType(int subtype);
00308
00311 static LightKitSubType GetSubType(LightKitType type, int i);
00312
00313 protected:
00314 vtkLightKit();
00315 ~vtkLightKit();
00316
00317 void WarmthToRGBI(double w, double rgb[3], double& i);
00318 void WarmthToRGB(double w, double rgb[3]);
00319 void InitializeWarmthFunctions();
00320 double WarmthToIntensity(double w);
00321
00322
00323 double KeyLightIntensity;
00324 double KeyToFillRatio;
00325 double KeyToHeadRatio;
00326 double KeyToBackRatio;
00327
00328 vtkLight *KeyLight;
00329 double KeyLightWarmth;
00330 double KeyLightAngle[2];
00331 double KeyLightColor[3];
00332
00333 vtkLight *FillLight;
00334 double FillLightWarmth;
00335 double FillLightAngle[2];
00336 double FillLightColor[3];
00337
00338 double BackLightWarmth;
00339 double BackLightColor[3];
00340
00341 vtkLight *BackLight0;
00342 vtkLight *BackLight1;
00343
00344 double BackLightAngle[2];
00345
00346 vtkLight *HeadLight;
00347 double HeadLightWarmth;
00348 double HeadLightColor[3];
00349
00350 int MaintainLuminance;
00351
00352 vtkPiecewiseFunction *WarmthFunction[4];
00353
00354 private:
00355 vtkLightKit(const vtkLightKit&);
00356 void operator=(const vtkLightKit&);
00357 };
00358
00359 #endif