VTK  9.3.0
vtkLightKit.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
83 #ifndef vtkLightKit_h
84 #define vtkLightKit_h
85 
86 #include "vtkObject.h"
87 #include "vtkRenderingCoreModule.h" // For export macro
88 
89 VTK_ABI_NAMESPACE_BEGIN
90 class vtkLight;
92 class vtkRenderer;
93 
94 class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
95 {
96 public:
97  static vtkLightKit* New();
98  vtkTypeMacro(vtkLightKit, vtkObject);
99  void PrintSelf(ostream& os, vtkIndent indent) override;
100 
102  {
106  THeadLight
107  };
108 
110  {
117  KHRatio
118  };
119 
121 
126  vtkSetMacro(KeyLightIntensity, double);
127  vtkGetMacro(KeyLightIntensity, double);
129 
131 
142  vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
143  vtkGetMacro(KeyToFillRatio, double);
145 
147 
158  vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
159  vtkGetMacro(KeyToHeadRatio, double);
161 
163 
170  vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
171  vtkGetMacro(KeyToBackRatio, double);
173 
175 
187  vtkSetMacro(KeyLightWarmth, double);
188  vtkGetMacro(KeyLightWarmth, double);
190 
191  vtkSetMacro(FillLightWarmth, double);
192  vtkGetMacro(FillLightWarmth, double);
193 
194  vtkSetMacro(HeadLightWarmth, double);
195  vtkGetMacro(HeadLightWarmth, double);
196 
197  vtkSetMacro(BackLightWarmth, double);
198  vtkGetMacro(BackLightWarmth, double);
199 
201 
204  vtkGetVectorMacro(KeyLightColor, double, 3);
205  vtkGetVectorMacro(FillLightColor, double, 3);
206  vtkGetVectorMacro(HeadLightColor, double, 3);
207  vtkGetVectorMacro(BackLightColor, double, 3);
209 
211 
216  vtkBooleanMacro(MaintainLuminance, vtkTypeBool);
217  vtkGetMacro(MaintainLuminance, vtkTypeBool);
218  vtkSetMacro(MaintainLuminance, vtkTypeBool);
220 
234  void SetKeyLightAngle(double elevation, double azimuth);
235  void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
236 
237  void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
238 
239  void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
240 
241  vtkGetVectorMacro(KeyLightAngle, double, 2);
243  {
244  double ang[2];
245  this->GetKeyLightAngle(ang);
246  return ang[0];
247  }
248 
250  {
251  double ang[2];
252  this->GetKeyLightAngle(ang);
253  return ang[1];
254  }
255 
256  void SetFillLightAngle(double elevation, double azimuth);
257  void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
258 
259  void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
260 
261  void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
262 
263  vtkGetVectorMacro(FillLightAngle, double, 2);
265  {
266  double ang[2];
267  this->GetFillLightAngle(ang);
268  return ang[0];
269  }
270 
272  {
273  double ang[2];
274  this->GetFillLightAngle(ang);
275  return ang[1];
276  }
277 
278  void SetBackLightAngle(double elevation, double azimuth);
279  void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
280 
281  void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
282 
283  void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
284 
285  vtkGetVectorMacro(BackLightAngle, double, 2);
287  {
288  double ang[2];
289  this->GetBackLightAngle(ang);
290  return ang[0];
291  }
292 
294  {
295  double ang[2];
296  this->GetBackLightAngle(ang);
297  return ang[1];
298  }
299 
301 
308 
309  void DeepCopy(vtkLightKit* kit);
310 
311  void Modified() override;
312  void Update();
313 
317  static const char* GetStringFromType(int type);
318 
322  static const char* GetStringFromSubType(int type);
323 
329  static const char* GetShortStringFromSubType(int subtype);
330 
336 
337 protected:
339  ~vtkLightKit() override;
340 
341  void WarmthToRGBI(double w, double rgb[3], double& i);
342  void WarmthToRGB(double w, double rgb[3]);
344  double WarmthToIntensity(double w);
345 
350 
353  double KeyLightAngle[2];
354  double KeyLightColor[3];
355 
358  double FillLightAngle[2];
359  double FillLightColor[3];
360 
362  double BackLightColor[3];
363 
366 
367  double BackLightAngle[2];
368 
371  double HeadLightColor[3];
372 
374 
375  vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
376 
377 private:
378  vtkLightKit(const vtkLightKit&) = delete;
379  void operator=(const vtkLightKit&) = delete;
380 };
381 
382 VTK_ABI_NAMESPACE_END
383 #endif
a simple class to control print indentation
Definition: vtkIndent.h:29
a simple but quality lighting kit
Definition: vtkLightKit.h:95
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:364
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:281
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:283
double FillLightWarmth
Definition: vtkLightKit.h:357
double GetBackLightAzimuth()
Definition: vtkLightKit.h:293
double KeyLightWarmth
Definition: vtkLightKit.h:352
void Update()
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:257
double KeyToHeadRatio
Definition: vtkLightKit.h:348
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:279
vtkLight * KeyLight
Definition: vtkLightKit.h:351
void DeepCopy(vtkLightKit *kit)
double GetKeyLightElevation()
Definition: vtkLightKit.h:242
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:235
void InitializeWarmthFunctions()
double HeadLightWarmth
Definition: vtkLightKit.h:370
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:237
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:239
double KeyToFillRatio
Definition: vtkLightKit.h:347
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:264
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:249
double KeyToBackRatio
Definition: vtkLightKit.h:349
void RemoveLightsFromRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
double GetFillLightAzimuth()
Definition: vtkLightKit.h:271
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:261
void Modified() override
Update the modification time for this object.
double BackLightWarmth
Definition: vtkLightKit.h:361
vtkTypeBool MaintainLuminance
Definition: vtkLightKit.h:373
vtkLight * HeadLight
Definition: vtkLightKit.h:369
vtkLight * BackLight1
Definition: vtkLightKit.h:365
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:259
double KeyLightIntensity
Definition: vtkLightKit.h:346
void WarmthToRGB(double w, double rgb[3])
double GetBackLightElevation()
Definition: vtkLightKit.h:286
vtkLight * FillLight
Definition: vtkLightKit.h:356
double WarmthToIntensity(double w)
a virtual light for 3D rendering
Definition: vtkLight.h:49
abstract base class for most VTK objects
Definition: vtkObject.h:52
Defines a 1D piecewise function.
abstract specification for renderers
Definition: vtkRenderer.h:62
@ type
Definition: vtkX3D.h:516
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154