00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00117 #ifndef __vtkLightKit_h
00118 #define __vtkLightKit_h
00119
00120 #include "vtkObject.h"
00121 class vtkLight;
00122 class vtkPiecewiseFunction;
00123 class vtkRenderer;
00124
00125 class VTK_RENDERING_EXPORT vtkLightKit : public vtkObject
00126 {
00127 public:
00128 static vtkLightKit *New();
00129 vtkTypeMacro(vtkLightKit, vtkObject);
00130 void PrintSelf(ostream& os, vtkIndent indent);
00131
00133
00136 vtkSetMacro(KeyLightIntensity, float);
00137 vtkGetMacro(KeyLightIntensity, float);
00139
00141
00149 vtkSetClampMacro(KeyToFillRatio, float, 0.5, VTK_FLOAT_MAX);
00150 vtkGetMacro(KeyToFillRatio, float);
00152
00154
00163 vtkSetClampMacro(KeyToHeadRatio, float, 0.5, VTK_FLOAT_MAX);
00164 vtkGetMacro(KeyToHeadRatio, float);
00166
00168
00177 vtkSetMacro(KeyLightWarmth, float);
00178 vtkGetMacro(KeyLightWarmth, float);
00180
00181 vtkSetMacro(FillLightWarmth, float);
00182 vtkGetMacro(FillLightWarmth, float);
00183
00184 vtkSetMacro(HeadlightWarmth, float);
00185 vtkGetMacro(HeadlightWarmth, float);
00186
00188
00189 vtkGetVectorMacro(KeyLightColor, float, 3);
00190 vtkGetVectorMacro(FillLightColor, float, 3);
00191 vtkGetVectorMacro(HeadlightColor, float, 3);
00193
00195
00198 vtkBooleanMacro(MaintainLuminance, int);
00199 vtkGetMacro(MaintainLuminance, int);
00200 vtkSetMacro(MaintainLuminance, int);
00202
00204
00211 void SetKeyLightAngle(float elevation, float azimuth);
00212 void SetKeyLightAngle(float angle[2]) {
00213 this->SetKeyLightAngle(angle[0], angle[1]); };
00215
00216 void SetKeyLightElevation(float x) {
00217 this->SetKeyLightAngle(x, this->KeyLightAngle[1]); };
00218
00219 void SetKeyLightAzimuth(float x) {
00220 this->SetKeyLightAngle(this->KeyLightAngle[0], x); };
00221
00222 vtkGetVectorMacro(KeyLightAngle, float, 2);
00223 float GetKeyLightElevation() {
00224 float ang[2]; this->GetKeyLightAngle(ang); return ang[0]; };
00225
00226 float GetKeyLightAzimuth() {
00227 float ang[2]; this->GetKeyLightAngle(ang); return ang[1]; };
00228
00229 void SetFillLightAngle(float elevation, float azimuth);
00230 void SetFillLightAngle(float angle[2]) {
00231 this->SetFillLightAngle(angle[0], angle[1]); };
00232
00233 void SetFillLightElevation(float x) {
00234 this->SetFillLightAngle(x, this->FillLightAngle[1]); };
00235
00236 void SetFillLightAzimuth(float x) {
00237 this->SetFillLightAngle(this->FillLightAngle[0], x); };
00238
00239 vtkGetVectorMacro(FillLightAngle, float, 2);
00240 float GetFillLightElevation() {
00241 float ang[2]; this->GetFillLightAngle(ang); return ang[0]; };
00242
00243 float GetFillLightAzimuth() {
00244 float ang[2]; this->GetFillLightAngle(ang); return ang[1]; };
00245
00247
00249 void AddLightsToRenderer(vtkRenderer *renderer);
00250 void RemoveLightsFromRenderer(vtkRenderer *renderer);
00252
00253 void DeepCopy(vtkLightKit *kit);
00254
00255 void Modified();
00256 void Update();
00257
00258 protected:
00259 vtkLightKit();
00260 ~vtkLightKit();
00261
00262 void WarmthToRGBI(float w, float rgb[3], float& i);
00263 void WarmthToRGB(float w, float rgb[3]);
00264 void InitializeWarmthFunctions();
00265 float WarmthToIntensity(float w);
00266
00267
00268 float KeyLightIntensity;
00269 float KeyToFillRatio;
00270 float KeyToHeadRatio;
00271
00272 vtkLight *KeyLight;
00273 float KeyLightWarmth;
00274 float KeyLightAngle[2];
00275 float KeyLightColor[3];
00276
00277 vtkLight *FillLight;
00278 float FillLightWarmth;
00279 float FillLightAngle[2];
00280 float FillLightColor[3];
00281
00282 vtkLight *Headlight;
00283 float HeadlightWarmth;
00284 float HeadlightColor[3];
00285
00286 int MaintainLuminance;
00287
00288 vtkPiecewiseFunction *WarmthFunction[4];
00289 private:
00290 vtkLightKit(const vtkLightKit&);
00291 void operator=(const vtkLightKit&);
00292 };
00293
00294 #endif