VTK
vtkLightKit.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLightKit.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
98 #ifndef vtkLightKit_h
99 #define vtkLightKit_h
100 
101 #include "vtkRenderingCoreModule.h" // For export macro
102 #include "vtkObject.h"
103 
104 class vtkLight;
106 class vtkRenderer;
107 
108 class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
109 {
110 public:
111  static vtkLightKit *New();
112  vtkTypeMacro(vtkLightKit, vtkObject);
113  void PrintSelf(ostream& os, vtkIndent indent);
114 
119  THeadLight
120  };
121 
129  KHRatio
130  };
131 
133 
138  vtkSetMacro(KeyLightIntensity, double);
139  vtkGetMacro(KeyLightIntensity, double);
141 
143 
154  vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
155  vtkGetMacro(KeyToFillRatio, double);
157 
159 
170  vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
171  vtkGetMacro(KeyToHeadRatio, double);
173 
175 
182  vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
183  vtkGetMacro(KeyToBackRatio, double);
185 
187 
199  vtkSetMacro(KeyLightWarmth, double);
200  vtkGetMacro(KeyLightWarmth, double);
202 
203  vtkSetMacro(FillLightWarmth, double);
204  vtkGetMacro(FillLightWarmth, double);
205 
206  vtkSetMacro(HeadLightWarmth, double);
207  vtkGetMacro(HeadLightWarmth, double);
208 
209  vtkSetMacro(BackLightWarmth, double);
210  vtkGetMacro(BackLightWarmth, double);
211 
213 
216  vtkGetVectorMacro(KeyLightColor, double, 3);
217  vtkGetVectorMacro(FillLightColor, double, 3);
218  vtkGetVectorMacro(HeadLightColor, double, 3);
219  vtkGetVectorMacro(BackLightColor, double, 3);
221 
223 
228  vtkBooleanMacro(MaintainLuminance, int);
229  vtkGetMacro(MaintainLuminance, int);
230  vtkSetMacro(MaintainLuminance, int);
232 
246  void SetKeyLightAngle(double elevation, double azimuth);
247  void SetKeyLightAngle(double angle[2])
248  { this->SetKeyLightAngle(angle[0], angle[1]); }
249 
250  void SetKeyLightElevation(double x)
251  { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
252 
253  void SetKeyLightAzimuth(double x)
254  { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
255 
256  vtkGetVectorMacro(KeyLightAngle, double, 2);
258  { double ang[2]; this->GetKeyLightAngle(ang); return ang[0]; }
259 
261  { double ang[2]; this->GetKeyLightAngle(ang); return ang[1]; }
262 
263  void SetFillLightAngle(double elevation, double azimuth);
264  void SetFillLightAngle(double angle[2])
265  { this->SetFillLightAngle(angle[0], angle[1]); }
266 
267  void SetFillLightElevation(double x)
268  { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
269 
270  void SetFillLightAzimuth(double x)
271  { this->SetFillLightAngle(this->FillLightAngle[0], x); }
272 
273  vtkGetVectorMacro(FillLightAngle, double, 2);
275  double ang[2]; this->GetFillLightAngle(ang); return ang[0]; }
276 
278  { double ang[2]; this->GetFillLightAngle(ang); return ang[1]; }
279 
280  void SetBackLightAngle(double elevation, double azimuth);
281  void SetBackLightAngle(double angle[2])
282  { this->SetBackLightAngle(angle[0], angle[1]); }
283 
284  void SetBackLightElevation(double x)
285  { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
286 
287  void SetBackLightAzimuth(double x)
288  { this->SetBackLightAngle(this->BackLightAngle[0], x); }
289 
290  vtkGetVectorMacro(BackLightAngle, double, 2);
292  { double ang[2]; this->GetBackLightAngle(ang); return ang[0]; }
293 
295  { double ang[2]; this->GetBackLightAngle(ang); return ang[1]; }
296 
298 
305 
306  void DeepCopy(vtkLightKit *kit);
307 
308  void Modified();
309  void Update();
310 
314  static const char *GetStringFromType(int type);
315 
319  static const char *GetStringFromSubType(int type);
320 
326  static const char *GetShortStringFromSubType(int subtype);
327 
333 
334 protected:
337 
338  void WarmthToRGBI(double w, double rgb[3], double& i);
339  void WarmthToRGB(double w, double rgb[3]);
341  double WarmthToIntensity(double w);
342 
343 
348 
351  double KeyLightAngle[2];
352  double KeyLightColor[3];
353 
356  double FillLightAngle[2];
357  double FillLightColor[3];
358 
360  double BackLightColor[3];
361 
364 
365  double BackLightAngle[2];
366 
369  double HeadLightColor[3];
370 
372 
373  vtkPiecewiseFunction *WarmthFunction[4]; // r, g, b, perceptual length
374 
375 private:
376  vtkLightKit(const vtkLightKit&) VTK_DELETE_FUNCTION;
377  void operator=(const vtkLightKit&) VTK_DELETE_FUNCTION;
378 };
379 
380 #endif
a simple class to control print indentation
Definition: vtkIndent.h:40
a simple but quality lighting kit
Definition: vtkLightKit.h:109
void SetKeyLightAngle(double elevation, double azimuth)
Get/Set the position of the key, fill, and back lights using angular methods.
void Modified()
Update the modification time for this object.
static vtkLightKit * New()
void SetBackLightAngle(double elevation, double azimuth)
vtkLight * BackLight0
Definition: vtkLightKit.h:362
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:284
static const char * GetShortStringFromSubType(int subtype)
Helper method to go from a enum subtype to a string subtype The difference from GetStringFromSubType ...
void AddLightsToRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
void SetBackLightAzimuth(double x)
Definition: vtkLightKit.h:287
double FillLightWarmth
Definition: vtkLightKit.h:355
double GetBackLightAzimuth()
Definition: vtkLightKit.h:294
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
double KeyLightWarmth
Definition: vtkLightKit.h:350
void Update()
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:264
double KeyToHeadRatio
Definition: vtkLightKit.h:346
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:281
vtkLight * KeyLight
Definition: vtkLightKit.h:349
void DeepCopy(vtkLightKit *kit)
double GetKeyLightElevation()
Definition: vtkLightKit.h:257
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:247
void InitializeWarmthFunctions()
double HeadLightWarmth
Definition: vtkLightKit.h:368
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:250
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:253
double KeyToFillRatio
Definition: vtkLightKit.h:345
void WarmthToRGBI(double w, double rgb[3], double &i)
static const char * GetStringFromType(int type)
Helper method to go from a enum type to a string type.
static const char * GetStringFromSubType(int type)
Helper method to go from a enum subtype to a string subtype.
double GetFillLightElevation()
Definition: vtkLightKit.h:274
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:260
double KeyToBackRatio
Definition: vtkLightKit.h:347
void RemoveLightsFromRenderer(vtkRenderer *renderer)
double GetFillLightAzimuth()
Definition: vtkLightKit.h:277
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:270
double BackLightWarmth
Definition: vtkLightKit.h:359
vtkLight * HeadLight
Definition: vtkLightKit.h:367
vtkLight * BackLight1
Definition: vtkLightKit.h:363
void SetFillLightAngle(double elevation, double azimuth)
int MaintainLuminance
Definition: vtkLightKit.h:371
static LightKitSubType GetSubType(LightKitType type, int i)
Return the possible subtype from a given type.
void SetFillLightElevation(double x)
Definition: vtkLightKit.h:267
double KeyLightIntensity
Definition: vtkLightKit.h:344
void WarmthToRGB(double w, double rgb[3])
double GetBackLightElevation()
Definition: vtkLightKit.h:291
vtkLight * FillLight
Definition: vtkLightKit.h:354
double WarmthToIntensity(double w)
a virtual light for 3D rendering
Definition: vtkLight.h:62
abstract base class for most VTK objects
Definition: vtkObject.h:60
Defines a 1D piecewise function.
abstract specification for renderers
Definition: vtkRenderer.h:64
@ type
Definition: vtkX3D.h:516
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_DOUBLE_MAX
Definition: vtkType.h:163