Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkLightKit.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkLightKit.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00098 #ifndef __vtkLightKit_h
00099 #define __vtkLightKit_h
00100 
00101 #include "vtkObject.h"
00102 class vtkLight;
00103 class vtkPiecewiseFunction;
00104 class vtkRenderer;
00105 
00106 class VTK_RENDERING_EXPORT vtkLightKit : public vtkObject
00107 {
00108 public:
00109   static vtkLightKit *New();
00110   vtkTypeRevisionMacro(vtkLightKit, vtkObject);
00111   void PrintSelf(ostream& os, vtkIndent indent);
00112 
00114 
00117   vtkSetMacro(KeyLightIntensity, float);  
00118   vtkGetMacro(KeyLightIntensity, float);
00120 
00122 
00130   vtkSetClampMacro(KeyToFillRatio, float, 0.5, VTK_FLOAT_MAX);
00131   vtkGetMacro(KeyToFillRatio, float);
00133 
00135 
00144   vtkSetClampMacro(KeyToHeadRatio, float, 0.5, VTK_FLOAT_MAX);
00145   vtkGetMacro(KeyToHeadRatio, float);
00147 
00149 
00154   vtkSetClampMacro(KeyToBackRatio, float, 0.5, VTK_FLOAT_MAX);
00155   vtkGetMacro(KeyToBackRatio, float);
00157 
00159 
00168   vtkSetMacro(KeyLightWarmth, float);
00169   vtkGetMacro(KeyLightWarmth, float);
00171 
00172   vtkSetMacro(FillLightWarmth, float);
00173   vtkGetMacro(FillLightWarmth, float);
00174 
00175   vtkSetMacro(HeadlightWarmth, float);
00176   vtkGetMacro(HeadlightWarmth, float);
00177 
00178   vtkSetMacro(BackLightWarmth, float);
00179   vtkGetMacro(BackLightWarmth, float);
00180 
00182 
00183   vtkGetVectorMacro(KeyLightColor,  float, 3);
00184   vtkGetVectorMacro(FillLightColor, float, 3);
00185   vtkGetVectorMacro(HeadlightColor, float, 3);
00186   vtkGetVectorMacro(BackLightColor, float, 3);
00188 
00190 
00193   vtkBooleanMacro(MaintainLuminance, int);
00194   vtkGetMacro(MaintainLuminance, int);
00195   vtkSetMacro(MaintainLuminance, int);
00197 
00199 
00210   void SetKeyLightAngle(float elevation, float azimuth);
00211   void SetKeyLightAngle(float angle[2]) { 
00212     this->SetKeyLightAngle(angle[0], angle[1]); };
00214 
00215   void SetKeyLightElevation(float x) {
00216     this->SetKeyLightAngle(x, this->KeyLightAngle[1]); };
00217 
00218   void SetKeyLightAzimuth(float x) {
00219     this->SetKeyLightAngle(this->KeyLightAngle[0], x); };
00220 
00221   vtkGetVectorMacro(KeyLightAngle, float, 2);
00222   float GetKeyLightElevation() {
00223     float ang[2]; this->GetKeyLightAngle(ang); return ang[0]; };
00224 
00225   float GetKeyLightAzimuth() {
00226     float ang[2]; this->GetKeyLightAngle(ang); return ang[1]; };
00227 
00228   void SetFillLightAngle(float elevation, float azimuth);
00229   void SetFillLightAngle(float angle[2]) { 
00230     this->SetFillLightAngle(angle[0], angle[1]); };
00231 
00232   void SetFillLightElevation(float x) {
00233     this->SetFillLightAngle(x, this->FillLightAngle[1]); };
00234 
00235   void SetFillLightAzimuth(float x) {
00236     this->SetFillLightAngle(this->FillLightAngle[0], x); };
00237 
00238   vtkGetVectorMacro(FillLightAngle, float, 2);
00239   float GetFillLightElevation() {
00240     float ang[2]; this->GetFillLightAngle(ang); return ang[0]; };
00241 
00242   float GetFillLightAzimuth() {
00243     float ang[2]; this->GetFillLightAngle(ang); return ang[1]; };
00244 
00245   void SetBackLightAngle(float elevation, float azimuth);
00246   void SetBackLightAngle(float angle[2]) { 
00247     this->SetBackLightAngle(angle[0], angle[1]); };
00248 
00249   void SetBackLightElevation(float x) {
00250     this->SetBackLightAngle(x, this->BackLightAngle[1]); };
00251 
00252   void SetBackLightAzimuth(float x) {
00253     this->SetBackLightAngle(this->BackLightAngle[0], x); };
00254 
00255   vtkGetVectorMacro(BackLightAngle, float, 2);
00256   float GetBackLightElevation() {
00257     float ang[2]; this->GetBackLightAngle(ang); return ang[0]; };
00258 
00259   float GetBackLightAzimuth() {
00260     float ang[2]; this->GetBackLightAngle(ang); return ang[1]; };
00261 
00263 
00265   void AddLightsToRenderer(vtkRenderer *renderer);
00266   void RemoveLightsFromRenderer(vtkRenderer *renderer);
00268 
00269   void DeepCopy(vtkLightKit *kit);
00270 
00271   void Modified();
00272   void Update();
00273 
00274 protected:
00275   vtkLightKit();
00276   ~vtkLightKit();
00277 
00278   void WarmthToRGBI(float w, float rgb[3], float& i);
00279   void WarmthToRGB(float w, float rgb[3]);
00280   void InitializeWarmthFunctions();
00281   float WarmthToIntensity(float w);
00282 
00283 
00284   float KeyLightIntensity;
00285   float KeyToFillRatio;
00286   float KeyToHeadRatio;
00287   float KeyToBackRatio;
00288   
00289   vtkLight *KeyLight;
00290   float KeyLightWarmth;
00291   float KeyLightAngle[2];
00292   float KeyLightColor[3];
00293 
00294   vtkLight *FillLight;
00295   float FillLightWarmth;
00296   float FillLightAngle[2];
00297   float FillLightColor[3];
00298 
00299   float BackLightWarmth;
00300   float BackLightColor[3];
00301 
00302   vtkLight *BackLight0;
00303   vtkLight *BackLight1;
00304 
00305   float BackLightAngle[2];
00306 
00307   vtkLight *Headlight;
00308   float HeadlightWarmth;
00309   float HeadlightColor[3];
00310 
00311   int MaintainLuminance;
00312 
00313   vtkPiecewiseFunction *WarmthFunction[4]; // r, g, b, perceptual length
00314 private:
00315   vtkLightKit(const vtkLightKit&);  // Not implemented.
00316   void operator=(const vtkLightKit&);  // Not implemented.
00317 };
00318 
00319 #endif