VTK: Rendering/Core/vtkLightKit.h Source File

| VTK 9.3.1

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;
91 class vtkPiecewiseFunction;
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
101 enum LightKitType
102 {
103 TKeyLight,
104 TFillLight,
105 TBackLight,
106 THeadLight
107 };
108
109 enum LightKitSubType
110 {
111 Warmth,
112 Intensity,
113 Elevation,
114 Azimuth,
115 KFRatio,
116 KBRatio,
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);
242 double GetKeyLightElevation()
243 {
244 double ang[2];
245 this->GetKeyLightAngle(ang);
246 return ang[0];
247 }
248
249 double GetKeyLightAzimuth()
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);
264 double GetFillLightElevation()
265 {
266 double ang[2];
267 this->GetFillLightAngle(ang);
268 return ang[0];
269 }
270
271 double GetFillLightAzimuth()
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);
286 double GetBackLightElevation()
287 {
288 double ang[2];
289 this->GetBackLightAngle(ang);
290 return ang[0];
291 }
292
293 double GetBackLightAzimuth()
294 {
295 double ang[2];
296 this->GetBackLightAngle(ang);
297 return ang[1];
298 }
299
301
305 void AddLightsToRenderer(vtkRenderer* renderer);
306 void RemoveLightsFromRenderer(vtkRenderer* renderer);
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
335 static LightKitSubType GetSubType(LightKitType type, int i);
336
337 protected:
338 vtkLightKit();
339 ~vtkLightKit() override;
340
341 void WarmthToRGBI(double w, double rgb[3], double& i);
342 void WarmthToRGB(double w, double rgb[3]);
343 void InitializeWarmthFunctions();
344 double WarmthToIntensity(double w);
345
346 double KeyLightIntensity;
347 double KeyToFillRatio;
348 double KeyToHeadRatio;
349 double KeyToBackRatio;
350
351 vtkLight* KeyLight;
352 double KeyLightWarmth;
353 double KeyLightAngle[2];
354 double KeyLightColor[3];
355
356 vtkLight* FillLight;
357 double FillLightWarmth;
358 double FillLightAngle[2];
359 double FillLightColor[3];
360
361 double BackLightWarmth;
362 double BackLightColor[3];
363
364 vtkLight* BackLight0;
365 vtkLight* BackLight1;
366
367 double BackLightAngle[2];
368
369 vtkLight* HeadLight;
370 double HeadLightWarmth;
371 double HeadLightColor[3];
372
373 vtkTypeBool MaintainLuminance;
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
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkLightKit
a simple but quality lighting kit
Definition: vtkLightKit.h:95
vtkLightKit::SetKeyLightAngle
void SetKeyLightAngle(double elevation, double azimuth)
Get/Set the position of the key, fill, and back lights using angular methods.
vtkLightKit::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLightKit::~vtkLightKit
~vtkLightKit() override
vtkLightKit::New
static vtkLightKit * New()
vtkLightKit::SetBackLightAngle
void SetBackLightAngle(double elevation, double azimuth)
vtkLightKit::LightKitType
LightKitType
Definition: vtkLightKit.h:102
vtkLightKit::TFillLight
@ TFillLight
Definition: vtkLightKit.h:104
vtkLightKit::TKeyLight
@ TKeyLight
Definition: vtkLightKit.h:103
vtkLightKit::TBackLight
@ TBackLight
Definition: vtkLightKit.h:105
vtkLightKit::BackLight0
vtkLight * BackLight0
Definition: vtkLightKit.h:364
vtkLightKit::SetBackLightElevation
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:281
vtkLightKit::GetShortStringFromSubType
static const char * GetShortStringFromSubType(int subtype)
Helper method to go from a enum subtype to a string subtype The difference from GetStringFromSubType ...
vtkLightKit::AddLightsToRenderer
void AddLightsToRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
vtkLightKit::SetBackLightAzimuth
void SetBackLightAzimuth(double x)
Definition: vtkLightKit.h:283
vtkLightKit::FillLightWarmth
double FillLightWarmth
Definition: vtkLightKit.h:357
vtkLightKit::GetBackLightAzimuth
double GetBackLightAzimuth()
Definition: vtkLightKit.h:293
vtkLightKit::KeyLightWarmth
double KeyLightWarmth
Definition: vtkLightKit.h:352
vtkLightKit::Update
void Update()
vtkLightKit::SetFillLightAngle
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:257
vtkLightKit::KeyToHeadRatio
double KeyToHeadRatio
Definition: vtkLightKit.h:348
vtkLightKit::SetBackLightAngle
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:279
vtkLightKit::KeyLight
vtkLight * KeyLight
Definition: vtkLightKit.h:351
vtkLightKit::DeepCopy
void DeepCopy(vtkLightKit *kit)
vtkLightKit::GetKeyLightElevation
double GetKeyLightElevation()
Definition: vtkLightKit.h:242
vtkLightKit::SetKeyLightAngle
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:235
vtkLightKit::LightKitSubType
LightKitSubType
Definition: vtkLightKit.h:110
vtkLightKit::Warmth
@ Warmth
Definition: vtkLightKit.h:111
vtkLightKit::Elevation
@ Elevation
Definition: vtkLightKit.h:113
vtkLightKit::KFRatio
@ KFRatio
Definition: vtkLightKit.h:115
vtkLightKit::KBRatio
@ KBRatio
Definition: vtkLightKit.h:116
vtkLightKit::Azimuth
@ Azimuth
Definition: vtkLightKit.h:114
vtkLightKit::Intensity
@ Intensity
Definition: vtkLightKit.h:112
vtkLightKit::InitializeWarmthFunctions
void InitializeWarmthFunctions()
vtkLightKit::HeadLightWarmth
double HeadLightWarmth
Definition: vtkLightKit.h:370
vtkLightKit::SetKeyLightElevation
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:237
vtkLightKit::SetKeyLightAzimuth
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:239
vtkLightKit::KeyToFillRatio
double KeyToFillRatio
Definition: vtkLightKit.h:347
vtkLightKit::vtkLightKit
vtkLightKit()
vtkLightKit::WarmthToRGBI
void WarmthToRGBI(double w, double rgb[3], double &i)
vtkLightKit::GetStringFromType
static const char * GetStringFromType(int type)
Helper method to go from a enum type to a string type.
vtkLightKit::GetStringFromSubType
static const char * GetStringFromSubType(int type)
Helper method to go from a enum subtype to a string subtype.
vtkLightKit::GetFillLightElevation
double GetFillLightElevation()
Definition: vtkLightKit.h:264
vtkLightKit::GetKeyLightAzimuth
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:249
vtkLightKit::KeyToBackRatio
double KeyToBackRatio
Definition: vtkLightKit.h:349
vtkLightKit::RemoveLightsFromRenderer
void RemoveLightsFromRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
vtkLightKit::GetFillLightAzimuth
double GetFillLightAzimuth()
Definition: vtkLightKit.h:271
vtkLightKit::SetFillLightAzimuth
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:261
vtkLightKit::Modified
void Modified() override
Update the modification time for this object.
vtkLightKit::BackLightWarmth
double BackLightWarmth
Definition: vtkLightKit.h:361
vtkLightKit::MaintainLuminance
vtkTypeBool MaintainLuminance
Definition: vtkLightKit.h:373
vtkLightKit::HeadLight
vtkLight * HeadLight
Definition: vtkLightKit.h:369
vtkLightKit::BackLight1
vtkLight * BackLight1
Definition: vtkLightKit.h:365
vtkLightKit::SetFillLightAngle
void SetFillLightAngle(double elevation, double azimuth)
vtkLightKit::GetSubType
static LightKitSubType GetSubType(LightKitType type, int i)
Return the possible subtype from a given type.
vtkLightKit::SetFillLightElevation
void SetFillLightElevation(double x)
Definition: vtkLightKit.h:259
vtkLightKit::KeyLightIntensity
double KeyLightIntensity
Definition: vtkLightKit.h:346
vtkLightKit::WarmthToRGB
void WarmthToRGB(double w, double rgb[3])
vtkLightKit::GetBackLightElevation
double GetBackLightElevation()
Definition: vtkLightKit.h:286
vtkLightKit::FillLight
vtkLight * FillLight
Definition: vtkLightKit.h:356
vtkLightKit::WarmthToIntensity
double WarmthToIntensity(double w)
vtkLight
a virtual light for 3D rendering
Definition: vtkLight.h:58
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:50
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:71
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkObject.h
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154