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
00120 #ifndef __vtkLightKit_h
00121 #define __vtkLightKit_h
00122
00123 #include "vtkObject.h"
00124 class vtkLight;
00125 class vtkPiecewiseFunction;
00126 class vtkRenderer;
00127
00128 class VTK_EXPORT vtkLightKit : public vtkObject
00129 {
00130 public:
00131 static vtkLightKit *New();
00132 vtkTypeMacro(vtkLightKit, vtkObject);
00133 void PrintSelf(ostream& os, vtkIndent indent);
00134
00138 vtkSetMacro(KeyLightIntensity, float);
00139 vtkGetMacro(KeyLightIntensity, float);
00140
00149 vtkSetClampMacro(KeyToFillRatio, float, 0.5, VTK_FLOAT_MAX);
00150 vtkGetMacro(KeyToFillRatio, float);
00151
00161 vtkSetClampMacro(KeyToHeadRatio, float, 0.5, VTK_FLOAT_MAX);
00162 vtkGetMacro(KeyToHeadRatio, float);
00163
00173 vtkSetMacro(KeyLightWarmth, float);
00174 vtkGetMacro(KeyLightWarmth, float);
00175
00176 vtkSetMacro(FillLightWarmth, float);
00177 vtkGetMacro(FillLightWarmth, float);
00178
00179 vtkSetMacro(HeadlightWarmth, float);
00180 vtkGetMacro(HeadlightWarmth, float);
00181
00183 vtkGetVectorMacro(KeyLightColor, float, 3);
00184 vtkGetVectorMacro(FillLightColor, float, 3);
00185 vtkGetVectorMacro(HeadlightColor, float, 3);
00186
00190 vtkBooleanMacro(MaintainLuminance, int);
00191 vtkGetMacro(MaintainLuminance, int);
00192 vtkSetMacro(MaintainLuminance, int);
00193
00201 void SetKeyLightAngle(float elevation, float azimuth);
00202 void SetKeyLightAngle(float angle[2]) {
00203 this->SetKeyLightAngle(angle[0], angle[1]); };
00204
00205 void SetKeyLightElevation(float x) {
00206 this->SetKeyLightAngle(x, this->KeyLightAngle[1]); };
00207
00208 void SetKeyLightAzimuth(float x) {
00209 this->SetKeyLightAngle(this->KeyLightAngle[0], x); };
00210
00211 vtkGetVectorMacro(KeyLightAngle, float, 2);
00212 float GetKeyLightElevation() {
00213 float ang[2]; this->GetKeyLightAngle(ang); return ang[0]; };
00214
00215 float GetKeyLightAzimuth() {
00216 float ang[2]; this->GetKeyLightAngle(ang); return ang[1]; };
00217
00218 void SetFillLightAngle(float elevation, float azimuth);
00219 void SetFillLightAngle(float angle[2]) {
00220 this->SetFillLightAngle(angle[0], angle[1]); };
00221
00222 void SetFillLightElevation(float x) {
00223 this->SetFillLightAngle(x, this->FillLightAngle[1]); };
00224
00225 void SetFillLightAzimuth(float x) {
00226 this->SetFillLightAngle(this->FillLightAngle[0], x); };
00227
00228 vtkGetVectorMacro(FillLightAngle, float, 2);
00229 float GetFillLightElevation() {
00230 float ang[2]; this->GetFillLightAngle(ang); return ang[0]; };
00231
00232 float GetFillLightAzimuth() {
00233 float ang[2]; this->GetFillLightAngle(ang); return ang[1]; };
00234
00237 void AddLightsToRenderer(vtkRenderer *renderer);
00238 void RemoveLightsFromRenderer(vtkRenderer *renderer);
00239
00240 void DeepCopy(vtkLightKit *kit);
00241
00242 void Modified();
00243 void Update();
00244
00245 protected:
00246 vtkLightKit();
00247 ~vtkLightKit();
00248
00249 void WarmthToRGBI(float w, float rgb[3], float& i);
00250 void WarmthToRGB(float w, float rgb[3]);
00251 void InitializeWarmthFunctions();
00252 float WarmthToIntensity(float w);
00253
00254 vtkLightKit(const vtkLightKit&) {};
00255 void operator=(const vtkLightKit&) {};
00256
00257 float KeyLightIntensity;
00258 float KeyToFillRatio;
00259 float KeyToHeadRatio;
00260
00261 vtkLight *KeyLight;
00262 float KeyLightWarmth;
00263 float KeyLightAngle[2];
00264 float KeyLightColor[3];
00265
00266 vtkLight *FillLight;
00267 float FillLightWarmth;
00268 float FillLightAngle[2];
00269 float FillLightColor[3];
00270
00271 vtkLight *Headlight;
00272 float HeadlightWarmth;
00273 float HeadlightColor[3];
00274
00275 int MaintainLuminance;
00276
00277 vtkPiecewiseFunction *WarmthFunction[4];
00278 };
00279
00280 #endif