Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/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 =========================================================================*/
00108 #ifndef __vtkLightKit_h
00109 #define __vtkLightKit_h
00110 
00111 #include "vtkObject.h"
00112 class vtkLight;
00113 class vtkPiecewiseFunction;
00114 class vtkRenderer;
00115 
00116 class VTK_RENDERING_EXPORT vtkLightKit : public vtkObject
00117 {
00118 public:
00119   static vtkLightKit *New();
00120   vtkTypeRevisionMacro(vtkLightKit, vtkObject);
00121   void PrintSelf(ostream& os, vtkIndent indent);
00122 
00124 
00127   vtkSetMacro(KeyLightIntensity, float);  
00128   vtkGetMacro(KeyLightIntensity, float);
00130 
00132 
00140   vtkSetClampMacro(KeyToFillRatio, float, 0.5, VTK_FLOAT_MAX);
00141   vtkGetMacro(KeyToFillRatio, float);
00143 
00145 
00154   vtkSetClampMacro(KeyToHeadRatio, float, 0.5, VTK_FLOAT_MAX);
00155   vtkGetMacro(KeyToHeadRatio, float);
00157 
00159 
00164   vtkSetClampMacro(KeyToBackRatio, float, 0.5, VTK_FLOAT_MAX);
00165   vtkGetMacro(KeyToBackRatio, float);
00167 
00169 
00178   vtkSetMacro(KeyLightWarmth, float);
00179   vtkGetMacro(KeyLightWarmth, float);
00181 
00182   vtkSetMacro(FillLightWarmth, float);
00183   vtkGetMacro(FillLightWarmth, float);
00184 
00185   vtkSetMacro(HeadlightWarmth, float);
00186   vtkGetMacro(HeadlightWarmth, float);
00187 
00188   vtkSetMacro(BackLightWarmth, float);
00189   vtkGetMacro(BackLightWarmth, float);
00190 
00192 
00193   vtkGetVectorMacro(KeyLightColor,  float, 3);
00194   vtkGetVectorMacro(FillLightColor, float, 3);
00195   vtkGetVectorMacro(HeadlightColor, float, 3);
00196   vtkGetVectorMacro(BackLightColor, float, 3);
00198 
00200 
00203   vtkBooleanMacro(MaintainLuminance, int);
00204   vtkGetMacro(MaintainLuminance, int);
00205   vtkSetMacro(MaintainLuminance, int);
00207 
00209 
00220   void SetKeyLightAngle(float elevation, float azimuth);
00221   void SetKeyLightAngle(float angle[2]) { 
00222     this->SetKeyLightAngle(angle[0], angle[1]); };
00224 
00225   void SetKeyLightElevation(float x) {
00226     this->SetKeyLightAngle(x, this->KeyLightAngle[1]); };
00227 
00228   void SetKeyLightAzimuth(float x) {
00229     this->SetKeyLightAngle(this->KeyLightAngle[0], x); };
00230 
00231   vtkGetVectorMacro(KeyLightAngle, float, 2);
00232   float GetKeyLightElevation() {
00233     float ang[2]; this->GetKeyLightAngle(ang); return ang[0]; };
00234 
00235   float GetKeyLightAzimuth() {
00236     float ang[2]; this->GetKeyLightAngle(ang); return ang[1]; };
00237 
00238   void SetFillLightAngle(float elevation, float azimuth);
00239   void SetFillLightAngle(float angle[2]) { 
00240     this->SetFillLightAngle(angle[0], angle[1]); };
00241 
00242   void SetFillLightElevation(float x) {
00243     this->SetFillLightAngle(x, this->FillLightAngle[1]); };
00244 
00245   void SetFillLightAzimuth(float x) {
00246     this->SetFillLightAngle(this->FillLightAngle[0], x); };
00247 
00248   vtkGetVectorMacro(FillLightAngle, float, 2);
00249   float GetFillLightElevation() {
00250     float ang[2]; this->GetFillLightAngle(ang); return ang[0]; };
00251 
00252   float GetFillLightAzimuth() {
00253     float ang[2]; this->GetFillLightAngle(ang); return ang[1]; };
00254 
00255   void SetBackLightAngle(float elevation, float azimuth);
00256   void SetBackLightAngle(float angle[2]) { 
00257     this->SetBackLightAngle(angle[0], angle[1]); };
00258 
00259   void SetBackLightElevation(float x) {
00260     this->SetBackLightAngle(x, this->BackLightAngle[1]); };
00261 
00262   void SetBackLightAzimuth(float x) {
00263     this->SetBackLightAngle(this->BackLightAngle[0], x); };
00264 
00265   vtkGetVectorMacro(BackLightAngle, float, 2);
00266   float GetBackLightElevation() {
00267     float ang[2]; this->GetBackLightAngle(ang); return ang[0]; };
00268 
00269   float GetBackLightAzimuth() {
00270     float ang[2]; this->GetBackLightAngle(ang); return ang[1]; };
00271 
00273 
00275   void AddLightsToRenderer(vtkRenderer *renderer);
00276   void RemoveLightsFromRenderer(vtkRenderer *renderer);
00278 
00279   void DeepCopy(vtkLightKit *kit);
00280 
00281   void Modified();
00282   void Update();
00283 
00284 protected:
00285   vtkLightKit();
00286   ~vtkLightKit();
00287 
00288   void WarmthToRGBI(float w, float rgb[3], float& i);
00289   void WarmthToRGB(float w, float rgb[3]);
00290   void InitializeWarmthFunctions();
00291   float WarmthToIntensity(float w);
00292 
00293 
00294   float KeyLightIntensity;
00295   float KeyToFillRatio;
00296   float KeyToHeadRatio;
00297   float KeyToBackRatio;
00298   
00299   vtkLight *KeyLight;
00300   float KeyLightWarmth;
00301   float KeyLightAngle[2];
00302   float KeyLightColor[3];
00303 
00304   vtkLight *FillLight;
00305   float FillLightWarmth;
00306   float FillLightAngle[2];
00307   float FillLightColor[3];
00308 
00309   float BackLightWarmth;
00310   float BackLightColor[3];
00311 
00312   vtkLight *BackLight0;
00313   vtkLight *BackLight1;
00314 
00315   float BackLightAngle[2];
00316 
00317   vtkLight *Headlight;
00318   float HeadlightWarmth;
00319   float HeadlightColor[3];
00320 
00321   int MaintainLuminance;
00322 
00323   vtkPiecewiseFunction *WarmthFunction[4]; // r, g, b, perceptual length
00324 private:
00325   vtkLightKit(const vtkLightKit&);  // Not implemented.
00326   void operator=(const vtkLightKit&);  // Not implemented.
00327 };
00328 
00329 #endif