VTK  9.2.6
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 =========================================================================*/
104 #ifndef vtkLightKit_h
105 #define vtkLightKit_h
106 
107 #include "vtkObject.h"
108 #include "vtkRenderingCoreModule.h" // For export macro
109 
110 class vtkLight;
112 class vtkRenderer;
113 
114 class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
115 {
116 public:
117  static vtkLightKit* New();
118  vtkTypeMacro(vtkLightKit, vtkObject);
119  void PrintSelf(ostream& os, vtkIndent indent) override;
120 
122  {
126  THeadLight
127  };
128 
130  {
137  KHRatio
138  };
139 
141 
146  vtkSetMacro(KeyLightIntensity, double);
147  vtkGetMacro(KeyLightIntensity, double);
149 
151 
162  vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
163  vtkGetMacro(KeyToFillRatio, double);
165 
167 
178  vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
179  vtkGetMacro(KeyToHeadRatio, double);
181 
183 
190  vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
191  vtkGetMacro(KeyToBackRatio, double);
193 
195 
207  vtkSetMacro(KeyLightWarmth, double);
208  vtkGetMacro(KeyLightWarmth, double);
210 
211  vtkSetMacro(FillLightWarmth, double);
212  vtkGetMacro(FillLightWarmth, double);
213 
214  vtkSetMacro(HeadLightWarmth, double);
215  vtkGetMacro(HeadLightWarmth, double);
216 
217  vtkSetMacro(BackLightWarmth, double);
218  vtkGetMacro(BackLightWarmth, double);
219 
221 
224  vtkGetVectorMacro(KeyLightColor, double, 3);
225  vtkGetVectorMacro(FillLightColor, double, 3);
226  vtkGetVectorMacro(HeadLightColor, double, 3);
227  vtkGetVectorMacro(BackLightColor, double, 3);
229 
231 
236  vtkBooleanMacro(MaintainLuminance, vtkTypeBool);
237  vtkGetMacro(MaintainLuminance, vtkTypeBool);
238  vtkSetMacro(MaintainLuminance, vtkTypeBool);
240 
254  void SetKeyLightAngle(double elevation, double azimuth);
255  void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
256 
257  void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
258 
259  void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
260 
261  vtkGetVectorMacro(KeyLightAngle, double, 2);
263  {
264  double ang[2];
265  this->GetKeyLightAngle(ang);
266  return ang[0];
267  }
268 
270  {
271  double ang[2];
272  this->GetKeyLightAngle(ang);
273  return ang[1];
274  }
275 
276  void SetFillLightAngle(double elevation, double azimuth);
277  void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
278 
279  void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
280 
281  void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
282 
283  vtkGetVectorMacro(FillLightAngle, double, 2);
285  {
286  double ang[2];
287  this->GetFillLightAngle(ang);
288  return ang[0];
289  }
290 
292  {
293  double ang[2];
294  this->GetFillLightAngle(ang);
295  return ang[1];
296  }
297 
298  void SetBackLightAngle(double elevation, double azimuth);
299  void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
300 
301  void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
302 
303  void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
304 
305  vtkGetVectorMacro(BackLightAngle, double, 2);
307  {
308  double ang[2];
309  this->GetBackLightAngle(ang);
310  return ang[0];
311  }
312 
314  {
315  double ang[2];
316  this->GetBackLightAngle(ang);
317  return ang[1];
318  }
319 
321 
328 
329  void DeepCopy(vtkLightKit* kit);
330 
331  void Modified() override;
332  void Update();
333 
337  static const char* GetStringFromType(int type);
338 
342  static const char* GetStringFromSubType(int type);
343 
349  static const char* GetShortStringFromSubType(int subtype);
350 
356 
357 protected:
359  ~vtkLightKit() override;
360 
361  void WarmthToRGBI(double w, double rgb[3], double& i);
362  void WarmthToRGB(double w, double rgb[3]);
364  double WarmthToIntensity(double w);
365 
370 
373  double KeyLightAngle[2];
374  double KeyLightColor[3];
375 
378  double FillLightAngle[2];
379  double FillLightColor[3];
380 
382  double BackLightColor[3];
383 
386 
387  double BackLightAngle[2];
388 
391  double HeadLightColor[3];
392 
394 
395  vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
396 
397 private:
398  vtkLightKit(const vtkLightKit&) = delete;
399  void operator=(const vtkLightKit&) = delete;
400 };
401 
402 #endif
a simple class to control print indentation
Definition: vtkIndent.h:49
a simple but quality lighting kit
Definition: vtkLightKit.h:115
void SetKeyLightAngle(double elevation, double azimuth)
Get/Set the position of the key, fill, and back lights using angular methods.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkLightKit() override
static vtkLightKit * New()
void SetBackLightAngle(double elevation, double azimuth)
vtkLight * BackLight0
Definition: vtkLightKit.h:384
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:301
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:303
double FillLightWarmth
Definition: vtkLightKit.h:377
double GetBackLightAzimuth()
Definition: vtkLightKit.h:313
double KeyLightWarmth
Definition: vtkLightKit.h:372
void Update()
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:277
double KeyToHeadRatio
Definition: vtkLightKit.h:368
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:299
vtkLight * KeyLight
Definition: vtkLightKit.h:371
void DeepCopy(vtkLightKit *kit)
double GetKeyLightElevation()
Definition: vtkLightKit.h:262
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:255
void InitializeWarmthFunctions()
double HeadLightWarmth
Definition: vtkLightKit.h:390
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:257
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:259
double KeyToFillRatio
Definition: vtkLightKit.h:367
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:284
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:269
double KeyToBackRatio
Definition: vtkLightKit.h:369
void RemoveLightsFromRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
double GetFillLightAzimuth()
Definition: vtkLightKit.h:291
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:281
void Modified() override
Update the modification time for this object.
double BackLightWarmth
Definition: vtkLightKit.h:381
vtkTypeBool MaintainLuminance
Definition: vtkLightKit.h:393
vtkLight * HeadLight
Definition: vtkLightKit.h:389
vtkLight * BackLight1
Definition: vtkLightKit.h:385
void SetFillLightAngle(double elevation, double azimuth)
static LightKitSubType GetSubType(LightKitType type, int i)
Return the possible subtype from a given type.
void SetFillLightElevation(double x)
Definition: vtkLightKit.h:279
double KeyLightIntensity
Definition: vtkLightKit.h:366
void WarmthToRGB(double w, double rgb[3])
double GetBackLightElevation()
Definition: vtkLightKit.h:306
vtkLight * FillLight
Definition: vtkLightKit.h:376
double WarmthToIntensity(double w)
a virtual light for 3D rendering
Definition: vtkLight.h:69
abstract base class for most VTK objects
Definition: vtkObject.h:72
Defines a 1D piecewise function.
abstract specification for renderers
Definition: vtkRenderer.h:82
@ type
Definition: vtkX3D.h:522
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165