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

contrib/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-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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]; // r, g, b, perceptual length
00278 };
00279 
00280 #endif

Generated on Wed Nov 21 12:26:55 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001