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 class vtkLight;
00099 class vtkPiecewiseFunction;
00100 class vtkRenderer;
00101
00102 class VTK_RENDERING_EXPORT vtkLightKit : public vtkObject
00103 {
00104 public:
00105 static vtkLightKit *New();
00106 vtkTypeRevisionMacro(vtkLightKit, vtkObject);
00107 void PrintSelf(ostream& os, vtkIndent indent);
00108
00110
00113 vtkSetMacro(KeyLightIntensity, double);
00114 vtkGetMacro(KeyLightIntensity, double);
00116
00118
00126 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_FLOAT_MAX);
00127 vtkGetMacro(KeyToFillRatio, double);
00129
00131
00140 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_FLOAT_MAX);
00141 vtkGetMacro(KeyToHeadRatio, double);
00143
00145
00150 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_FLOAT_MAX);
00151 vtkGetMacro(KeyToBackRatio, double);
00153
00155
00164 vtkSetMacro(KeyLightWarmth, double);
00165 vtkGetMacro(KeyLightWarmth, double);
00167
00168 vtkSetMacro(FillLightWarmth, double);
00169 vtkGetMacro(FillLightWarmth, double);
00170
00171 vtkSetMacro(HeadlightWarmth, double);
00172 vtkGetMacro(HeadlightWarmth, double);
00173
00174 vtkSetMacro(BackLightWarmth, double);
00175 vtkGetMacro(BackLightWarmth, double);
00176
00178
00179 vtkGetVectorMacro(KeyLightColor, double, 3);
00180 vtkGetVectorMacro(FillLightColor, double, 3);
00181 vtkGetVectorMacro(HeadlightColor, double, 3);
00182 vtkGetVectorMacro(BackLightColor, double, 3);
00184
00186
00189 vtkBooleanMacro(MaintainLuminance, int);
00190 vtkGetMacro(MaintainLuminance, int);
00191 vtkSetMacro(MaintainLuminance, int);
00193
00195
00206 void SetKeyLightAngle(double elevation, double azimuth);
00207 void SetKeyLightAngle(double angle[2]) {
00208 this->SetKeyLightAngle(angle[0], angle[1]); };
00210
00211 void SetKeyLightElevation(double x) {
00212 this->SetKeyLightAngle(x, this->KeyLightAngle[1]); };
00213
00214 void SetKeyLightAzimuth(double x) {
00215 this->SetKeyLightAngle(this->KeyLightAngle[0], x); };
00216
00217 vtkGetVectorMacro(KeyLightAngle, double, 2);
00218 double GetKeyLightElevation() {
00219 double ang[2]; this->GetKeyLightAngle(ang); return ang[0]; };
00220
00221 double GetKeyLightAzimuth() {
00222 double ang[2]; this->GetKeyLightAngle(ang); return ang[1]; };
00223
00224 void SetFillLightAngle(double elevation, double azimuth);
00225 void SetFillLightAngle(double angle[2]) {
00226 this->SetFillLightAngle(angle[0], angle[1]); };
00227
00228 void SetFillLightElevation(double x) {
00229 this->SetFillLightAngle(x, this->FillLightAngle[1]); };
00230
00231 void SetFillLightAzimuth(double x) {
00232 this->SetFillLightAngle(this->FillLightAngle[0], x); };
00233
00234 vtkGetVectorMacro(FillLightAngle, double, 2);
00235 double GetFillLightElevation() {
00236 double ang[2]; this->GetFillLightAngle(ang); return ang[0]; };
00237
00238 double GetFillLightAzimuth() {
00239 double ang[2]; this->GetFillLightAngle(ang); return ang[1]; };
00240
00241 void SetBackLightAngle(double elevation, double azimuth);
00242 void SetBackLightAngle(double angle[2]) {
00243 this->SetBackLightAngle(angle[0], angle[1]); };
00244
00245 void SetBackLightElevation(double x) {
00246 this->SetBackLightAngle(x, this->BackLightAngle[1]); };
00247
00248 void SetBackLightAzimuth(double x) {
00249 this->SetBackLightAngle(this->BackLightAngle[0], x); };
00250
00251 vtkGetVectorMacro(BackLightAngle, double, 2);
00252 double GetBackLightElevation() {
00253 double ang[2]; this->GetBackLightAngle(ang); return ang[0]; };
00254
00255 double GetBackLightAzimuth() {
00256 double ang[2]; this->GetBackLightAngle(ang); return ang[1]; };
00257
00259
00261 void AddLightsToRenderer(vtkRenderer *renderer);
00262 void RemoveLightsFromRenderer(vtkRenderer *renderer);
00264
00265 void DeepCopy(vtkLightKit *kit);
00266
00267 void Modified();
00268 void Update();
00269
00270 protected:
00271 vtkLightKit();
00272 ~vtkLightKit();
00273
00274 void WarmthToRGBI(double w, double rgb[3], double& i);
00275 void WarmthToRGB(double w, double rgb[3]);
00276 void InitializeWarmthFunctions();
00277 double WarmthToIntensity(double w);
00278
00279
00280 double KeyLightIntensity;
00281 double KeyToFillRatio;
00282 double KeyToHeadRatio;
00283 double KeyToBackRatio;
00284
00285 vtkLight *KeyLight;
00286 double KeyLightWarmth;
00287 double KeyLightAngle[2];
00288 double KeyLightColor[3];
00289
00290 vtkLight *FillLight;
00291 double FillLightWarmth;
00292 double FillLightAngle[2];
00293 double FillLightColor[3];
00294
00295 double BackLightWarmth;
00296 double BackLightColor[3];
00297
00298 vtkLight *BackLight0;
00299 vtkLight *BackLight1;
00300
00301 double BackLightAngle[2];
00302
00303 vtkLight *Headlight;
00304 double HeadlightWarmth;
00305 double HeadlightColor[3];
00306
00307 int MaintainLuminance;
00308
00309 vtkPiecewiseFunction *WarmthFunction[4];
00310 private:
00311 vtkLightKit(const vtkLightKit&);
00312 void operator=(const vtkLightKit&);
00313 };
00314
00315 #endif