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-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 =========================================================================*/
00117 #ifndef __vtkLightKit_h
00118 #define __vtkLightKit_h
00119 
00120 #include "vtkObject.h"
00121 class vtkLight;
00122 class vtkPiecewiseFunction;
00123 class vtkRenderer;
00124 
00125 class VTK_RENDERING_EXPORT vtkLightKit : public vtkObject
00126 {
00127 public:
00128   static vtkLightKit *New();
00129   vtkTypeMacro(vtkLightKit, vtkObject);
00130   void PrintSelf(ostream& os, vtkIndent indent);
00131 
00133 
00136   vtkSetMacro(KeyLightIntensity, float);  
00137   vtkGetMacro(KeyLightIntensity, float);
00139 
00141 
00149   vtkSetClampMacro(KeyToFillRatio, float, 0.5, VTK_FLOAT_MAX);
00150   vtkGetMacro(KeyToFillRatio, float);
00152 
00154 
00163   vtkSetClampMacro(KeyToHeadRatio, float, 0.5, VTK_FLOAT_MAX);
00164   vtkGetMacro(KeyToHeadRatio, float);
00166 
00168 
00177   vtkSetMacro(KeyLightWarmth, float);
00178   vtkGetMacro(KeyLightWarmth, float);
00180 
00181   vtkSetMacro(FillLightWarmth, float);
00182   vtkGetMacro(FillLightWarmth, float);
00183 
00184   vtkSetMacro(HeadlightWarmth, float);
00185   vtkGetMacro(HeadlightWarmth, float);
00186 
00188 
00189   vtkGetVectorMacro(KeyLightColor,  float, 3);
00190   vtkGetVectorMacro(FillLightColor, float, 3);
00191   vtkGetVectorMacro(HeadlightColor, float, 3);
00193 
00195 
00198   vtkBooleanMacro(MaintainLuminance, int);
00199   vtkGetMacro(MaintainLuminance, int);
00200   vtkSetMacro(MaintainLuminance, int);
00202 
00204 
00211   void SetKeyLightAngle(float elevation, float azimuth);
00212   void SetKeyLightAngle(float angle[2]) { 
00213     this->SetKeyLightAngle(angle[0], angle[1]); };
00215 
00216   void SetKeyLightElevation(float x) {
00217     this->SetKeyLightAngle(x, this->KeyLightAngle[1]); };
00218 
00219   void SetKeyLightAzimuth(float x) {
00220     this->SetKeyLightAngle(this->KeyLightAngle[0], x); };
00221 
00222   vtkGetVectorMacro(KeyLightAngle, float, 2);
00223   float GetKeyLightElevation() {
00224     float ang[2]; this->GetKeyLightAngle(ang); return ang[0]; };
00225 
00226   float GetKeyLightAzimuth() {
00227     float ang[2]; this->GetKeyLightAngle(ang); return ang[1]; };
00228 
00229   void SetFillLightAngle(float elevation, float azimuth);
00230   void SetFillLightAngle(float angle[2]) { 
00231     this->SetFillLightAngle(angle[0], angle[1]); };
00232 
00233   void SetFillLightElevation(float x) {
00234     this->SetFillLightAngle(x, this->FillLightAngle[1]); };
00235 
00236   void SetFillLightAzimuth(float x) {
00237     this->SetFillLightAngle(this->FillLightAngle[0], x); };
00238 
00239   vtkGetVectorMacro(FillLightAngle, float, 2);
00240   float GetFillLightElevation() {
00241     float ang[2]; this->GetFillLightAngle(ang); return ang[0]; };
00242 
00243   float GetFillLightAzimuth() {
00244     float ang[2]; this->GetFillLightAngle(ang); return ang[1]; };
00245 
00247 
00249   void AddLightsToRenderer(vtkRenderer *renderer);
00250   void RemoveLightsFromRenderer(vtkRenderer *renderer);
00252 
00253   void DeepCopy(vtkLightKit *kit);
00254 
00255   void Modified();
00256   void Update();
00257 
00258 protected:
00259   vtkLightKit();
00260   ~vtkLightKit();
00261 
00262   void WarmthToRGBI(float w, float rgb[3], float& i);
00263   void WarmthToRGB(float w, float rgb[3]);
00264   void InitializeWarmthFunctions();
00265   float WarmthToIntensity(float w);
00266 
00267 
00268   float KeyLightIntensity;
00269   float KeyToFillRatio;
00270   float KeyToHeadRatio;
00271   
00272   vtkLight *KeyLight;
00273   float KeyLightWarmth;
00274   float KeyLightAngle[2];
00275   float KeyLightColor[3];
00276 
00277   vtkLight *FillLight;
00278   float FillLightWarmth;
00279   float FillLightAngle[2];
00280   float FillLightColor[3];
00281 
00282   vtkLight *Headlight;
00283   float HeadlightWarmth;
00284   float HeadlightColor[3];
00285 
00286   int MaintainLuminance;
00287 
00288   vtkPiecewiseFunction *WarmthFunction[4]; // r, g, b, perceptual length
00289 private:
00290   vtkLightKit(const vtkLightKit&);  // Not implemented.
00291   void operator=(const vtkLightKit&);  // Not implemented.
00292 };
00293 
00294 #endif

Generated on Thu Mar 28 14:19:32 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001