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 =========================================================================*/
92 #ifndef vtkLightKit_h
93 #define vtkLightKit_h
94 
95 #include "vtkRenderingCoreModule.h" // For export macro
96 #include "vtkObject.h"
97 
98 class vtkLight;
100 class vtkRenderer;
101 
102 class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
103 {
104 public:
105  static vtkLightKit *New();
106  vtkTypeMacro(vtkLightKit, vtkObject);
107  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
108 
113  THeadLight
114  };
115 
123  KHRatio
124  };
125 
127 
132  vtkSetMacro(KeyLightIntensity, double);
133  vtkGetMacro(KeyLightIntensity, double);
135 
137 
148  vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
149  vtkGetMacro(KeyToFillRatio, double);
151 
153 
164  vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
165  vtkGetMacro(KeyToHeadRatio, double);
167 
169 
176  vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
177  vtkGetMacro(KeyToBackRatio, double);
179 
181 
193  vtkSetMacro(KeyLightWarmth, double);
194  vtkGetMacro(KeyLightWarmth, double);
196 
197  vtkSetMacro(FillLightWarmth, double);
198  vtkGetMacro(FillLightWarmth, double);
199 
200  vtkSetMacro(HeadLightWarmth, double);
201  vtkGetMacro(HeadLightWarmth, double);
202 
203  vtkSetMacro(BackLightWarmth, double);
204  vtkGetMacro(BackLightWarmth, double);
205 
207 
210  vtkGetVectorMacro(KeyLightColor, double, 3);
211  vtkGetVectorMacro(FillLightColor, double, 3);
212  vtkGetVectorMacro(HeadLightColor, double, 3);
213  vtkGetVectorMacro(BackLightColor, double, 3);
215 
217 
222  vtkBooleanMacro(MaintainLuminance, int);
223  vtkGetMacro(MaintainLuminance, int);
224  vtkSetMacro(MaintainLuminance, int);
226 
240  void SetKeyLightAngle(double elevation, double azimuth);
241  void SetKeyLightAngle(double angle[2])
242  { this->SetKeyLightAngle(angle[0], angle[1]); }
243 
244  void SetKeyLightElevation(double x)
245  { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
246 
247  void SetKeyLightAzimuth(double x)
248  { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
249 
250  vtkGetVectorMacro(KeyLightAngle, double, 2);
252  { double ang[2]; this->GetKeyLightAngle(ang); return ang[0]; }
253 
255  { double ang[2]; this->GetKeyLightAngle(ang); return ang[1]; }
256 
257  void SetFillLightAngle(double elevation, double azimuth);
258  void SetFillLightAngle(double angle[2])
259  { this->SetFillLightAngle(angle[0], angle[1]); }
260 
261  void SetFillLightElevation(double x)
262  { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
263 
264  void SetFillLightAzimuth(double x)
265  { this->SetFillLightAngle(this->FillLightAngle[0], x); }
266 
267  vtkGetVectorMacro(FillLightAngle, double, 2);
269  double ang[2]; this->GetFillLightAngle(ang); return ang[0]; }
270 
272  { double ang[2]; this->GetFillLightAngle(ang); return ang[1]; }
273 
274  void SetBackLightAngle(double elevation, double azimuth);
275  void SetBackLightAngle(double angle[2])
276  { this->SetBackLightAngle(angle[0], angle[1]); }
277 
278  void SetBackLightElevation(double x)
279  { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
280 
281  void SetBackLightAzimuth(double x)
282  { this->SetBackLightAngle(this->BackLightAngle[0], x); }
283 
284  vtkGetVectorMacro(BackLightAngle, double, 2);
286  { double ang[2]; this->GetBackLightAngle(ang); return ang[0]; }
287 
289  { double ang[2]; this->GetBackLightAngle(ang); return ang[1]; }
290 
292 
296  void AddLightsToRenderer(vtkRenderer *renderer);
297  void RemoveLightsFromRenderer(vtkRenderer *renderer);
299 
300  void DeepCopy(vtkLightKit *kit);
301 
302  void Modified() VTK_OVERRIDE;
303  void Update();
304 
308  static const char *GetStringFromType(int type);
309 
313  static const char *GetStringFromSubType(int type);
314 
320  static const char *GetShortStringFromSubType(int subtype);
321 
326  static LightKitSubType GetSubType(LightKitType type, int i);
327 
328 protected:
329  vtkLightKit();
330  ~vtkLightKit() VTK_OVERRIDE;
331 
332  void WarmthToRGBI(double w, double rgb[3], double& i);
333  void WarmthToRGB(double w, double rgb[3]);
334  void InitializeWarmthFunctions();
335  double WarmthToIntensity(double w);
336 
337 
338  double KeyLightIntensity;
339  double KeyToFillRatio;
340  double KeyToHeadRatio;
341  double KeyToBackRatio;
342 
343  vtkLight *KeyLight;
344  double KeyLightWarmth;
345  double KeyLightAngle[2];
346  double KeyLightColor[3];
347 
348  vtkLight *FillLight;
349  double FillLightWarmth;
350  double FillLightAngle[2];
351  double FillLightColor[3];
352 
353  double BackLightWarmth;
354  double BackLightColor[3];
355 
356  vtkLight *BackLight0;
357  vtkLight *BackLight1;
358 
359  double BackLightAngle[2];
360 
361  vtkLight *HeadLight;
362  double HeadLightWarmth;
363  double HeadLightColor[3];
364 
365  int MaintainLuminance;
366 
367  vtkPiecewiseFunction *WarmthFunction[4]; // r, g, b, perceptual length
368 
369 private:
370  vtkLightKit(const vtkLightKit&) VTK_DELETE_FUNCTION;
371  void operator=(const vtkLightKit&) VTK_DELETE_FUNCTION;
372 };
373 
374 #endif
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:258
abstract base class for most VTK objects
Definition: vtkObject.h:53
double GetFillLightAzimuth()
Definition: vtkLightKit.h:271
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_DOUBLE_MAX
Definition: vtkType.h:167
Defines a 1D piecewise function.
double GetBackLightAzimuth()
Definition: vtkLightKit.h:288
void SetBackLightAzimuth(double x)
Definition: vtkLightKit.h:281
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:278
abstract specification for renderers
Definition: vtkRenderer.h:57
virtual void Update()
Updates the extensions string.
a simple but quality lighting kit
Definition: vtkLightKit.h:102
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:241
a simple class to control print indentation
Definition: vtkIndent.h:33
double GetKeyLightElevation()
Definition: vtkLightKit.h:251
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:244
a virtual light for 3D rendering
Definition: vtkLight.h:55
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:247
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:254
double GetBackLightElevation()
Definition: vtkLightKit.h:285
virtual void Modified()
Update the modification time for this object.
void SetFillLightElevation(double x)
Definition: vtkLightKit.h:261
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:275
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
double GetFillLightElevation()
Definition: vtkLightKit.h:268
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:264