00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00109 #ifndef __vtkLightKit_h
00110 #define __vtkLightKit_h
00111
00112 #include "vtkObject.h"
00113 class vtkLight;
00114 class vtkPiecewiseFunction;
00115 class vtkRenderer;
00116
00117 class VTK_RENDERING_EXPORT vtkLightKit : public vtkObject
00118 {
00119 public:
00120 static vtkLightKit *New();
00121 vtkTypeRevisionMacro(vtkLightKit, vtkObject);
00122 void PrintSelf(ostream& os, vtkIndent indent);
00123
00125
00128 vtkSetMacro(KeyLightIntensity, float);
00129 vtkGetMacro(KeyLightIntensity, float);
00131
00133
00141 vtkSetClampMacro(KeyToFillRatio, float, 0.5, VTK_FLOAT_MAX);
00142 vtkGetMacro(KeyToFillRatio, float);
00144
00146
00155 vtkSetClampMacro(KeyToHeadRatio, float, 0.5, VTK_FLOAT_MAX);
00156 vtkGetMacro(KeyToHeadRatio, float);
00158
00160
00165 vtkSetClampMacro(KeyToBackRatio, float, 0.5, VTK_FLOAT_MAX);
00166 vtkGetMacro(KeyToBackRatio, float);
00168
00170
00179 vtkSetMacro(KeyLightWarmth, float);
00180 vtkGetMacro(KeyLightWarmth, float);
00182
00183 vtkSetMacro(FillLightWarmth, float);
00184 vtkGetMacro(FillLightWarmth, float);
00185
00186 vtkSetMacro(HeadlightWarmth, float);
00187 vtkGetMacro(HeadlightWarmth, float);
00188
00189 vtkSetMacro(BackLightWarmth, float);
00190 vtkGetMacro(BackLightWarmth, float);
00191
00193
00194 vtkGetVectorMacro(KeyLightColor, float, 3);
00195 vtkGetVectorMacro(FillLightColor, float, 3);
00196 vtkGetVectorMacro(HeadlightColor, float, 3);
00197 vtkGetVectorMacro(BackLightColor, float, 3);
00199
00201
00204 vtkBooleanMacro(MaintainLuminance, int);
00205 vtkGetMacro(MaintainLuminance, int);
00206 vtkSetMacro(MaintainLuminance, int);
00208
00210
00221 void SetKeyLightAngle(float elevation, float azimuth);
00222 void SetKeyLightAngle(float angle[2]) {
00223 this->SetKeyLightAngle(angle[0], angle[1]); };
00225
00226 void SetKeyLightElevation(float x) {
00227 this->SetKeyLightAngle(x, this->KeyLightAngle[1]); };
00228
00229 void SetKeyLightAzimuth(float x) {
00230 this->SetKeyLightAngle(this->KeyLightAngle[0], x); };
00231
00232 vtkGetVectorMacro(KeyLightAngle, float, 2);
00233 float GetKeyLightElevation() {
00234 float ang[2]; this->GetKeyLightAngle(ang); return ang[0]; };
00235
00236 float GetKeyLightAzimuth() {
00237 float ang[2]; this->GetKeyLightAngle(ang); return ang[1]; };
00238
00239 void SetFillLightAngle(float elevation, float azimuth);
00240 void SetFillLightAngle(float angle[2]) {
00241 this->SetFillLightAngle(angle[0], angle[1]); };
00242
00243 void SetFillLightElevation(float x) {
00244 this->SetFillLightAngle(x, this->FillLightAngle[1]); };
00245
00246 void SetFillLightAzimuth(float x) {
00247 this->SetFillLightAngle(this->FillLightAngle[0], x); };
00248
00249 vtkGetVectorMacro(FillLightAngle, float, 2);
00250 float GetFillLightElevation() {
00251 float ang[2]; this->GetFillLightAngle(ang); return ang[0]; };
00252
00253 float GetFillLightAzimuth() {
00254 float ang[2]; this->GetFillLightAngle(ang); return ang[1]; };
00255
00256 void SetBackLightAngle(float elevation, float azimuth);
00257 void SetBackLightAngle(float angle[2]) {
00258 this->SetBackLightAngle(angle[0], angle[1]); };
00259
00260 void SetBackLightElevation(float x) {
00261 this->SetBackLightAngle(x, this->BackLightAngle[1]); };
00262
00263 void SetBackLightAzimuth(float x) {
00264 this->SetBackLightAngle(this->BackLightAngle[0], x); };
00265
00266 vtkGetVectorMacro(BackLightAngle, float, 2);
00267 float GetBackLightElevation() {
00268 float ang[2]; this->GetBackLightAngle(ang); return ang[0]; };
00269
00270 float GetBackLightAzimuth() {
00271 float ang[2]; this->GetBackLightAngle(ang); return ang[1]; };
00272
00274
00276 void AddLightsToRenderer(vtkRenderer *renderer);
00277 void RemoveLightsFromRenderer(vtkRenderer *renderer);
00279
00280 void DeepCopy(vtkLightKit *kit);
00281
00282 void Modified();
00283 void Update();
00284
00285 protected:
00286 vtkLightKit();
00287 ~vtkLightKit();
00288
00289 void WarmthToRGBI(float w, float rgb[3], float& i);
00290 void WarmthToRGB(float w, float rgb[3]);
00291 void InitializeWarmthFunctions();
00292 float WarmthToIntensity(float w);
00293
00294
00295 float KeyLightIntensity;
00296 float KeyToFillRatio;
00297 float KeyToHeadRatio;
00298 float KeyToBackRatio;
00299
00300 vtkLight *KeyLight;
00301 float KeyLightWarmth;
00302 float KeyLightAngle[2];
00303 float KeyLightColor[3];
00304
00305 vtkLight *FillLight;
00306 float FillLightWarmth;
00307 float FillLightAngle[2];
00308 float FillLightColor[3];
00309
00310 float BackLightWarmth;
00311 float BackLightColor[3];
00312
00313 vtkLight *BackLight0;
00314 vtkLight *BackLight1;
00315
00316 float BackLightAngle[2];
00317
00318 vtkLight *Headlight;
00319 float HeadlightWarmth;
00320 float HeadlightColor[3];
00321
00322 int MaintainLuminance;
00323
00324 vtkPiecewiseFunction *WarmthFunction[4];
00325 private:
00326 vtkLightKit(const vtkLightKit&);
00327 void operator=(const vtkLightKit&);
00328 };
00329
00330 #endif