VTK  9.7.20261002
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
114
115#ifndef vtkLightKit_h
116#define vtkLightKit_h
117
118#include "vtkObject.h"
119#include "vtkRenderingCoreModule.h" // For export macro
120#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
121
122VTK_ABI_NAMESPACE_BEGIN
123class vtkLight;
125class vtkRenderer;
126
127class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkLightKit : public vtkObject
128{
129public:
130 static vtkLightKit* New();
131 vtkTypeMacro(vtkLightKit, vtkObject);
132 void PrintSelf(ostream& os, vtkIndent indent) override;
133
141
152
154
159 vtkSetMacro(KeyLightIntensity, double);
160 vtkGetMacro(KeyLightIntensity, double);
162
164
175 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
176 vtkGetMacro(KeyToFillRatio, double);
178
180
191 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
192 vtkGetMacro(KeyToHeadRatio, double);
194
196
203 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
204 vtkGetMacro(KeyToBackRatio, double);
206
208
220 vtkSetMacro(KeyLightWarmth, double);
221 vtkGetMacro(KeyLightWarmth, double);
223
224 vtkSetMacro(FillLightWarmth, double);
225 vtkGetMacro(FillLightWarmth, double);
226
227 vtkSetMacro(HeadLightWarmth, double);
228 vtkGetMacro(HeadLightWarmth, double);
229
230 vtkSetMacro(BackLightWarmth, double);
231 vtkGetMacro(BackLightWarmth, double);
232
234
237 vtkGetVectorMacro(KeyLightColor, double, 3);
238 vtkGetVectorMacro(FillLightColor, double, 3);
239 vtkGetVectorMacro(HeadLightColor, double, 3);
240 vtkGetVectorMacro(BackLightColor, double, 3);
242
244
253
267 void SetKeyLightAngle(double elevation, double azimuth);
268 void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
269
270 void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
271
272 void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
273
274 vtkGetVectorMacro(KeyLightAngle, double, 2);
276 {
277 double ang[2];
278 this->GetKeyLightAngle(ang);
279 return ang[0];
280 }
281
283 {
284 double ang[2];
285 this->GetKeyLightAngle(ang);
286 return ang[1];
287 }
288
289 void SetFillLightAngle(double elevation, double azimuth);
290 void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
291
292 void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
293
294 void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
295
296 vtkGetVectorMacro(FillLightAngle, double, 2);
298 {
299 double ang[2];
300 this->GetFillLightAngle(ang);
301 return ang[0];
302 }
303
305 {
306 double ang[2];
307 this->GetFillLightAngle(ang);
308 return ang[1];
309 }
310
311 void SetBackLightAngle(double elevation, double azimuth);
312 void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
313
314 void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
315
316 void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
317
318 vtkGetVectorMacro(BackLightAngle, double, 2);
320 {
321 double ang[2];
322 this->GetBackLightAngle(ang);
323 return ang[0];
324 }
325
327 {
328 double ang[2];
329 this->GetBackLightAngle(ang);
330 return ang[1];
331 }
332
334
341
343
344 void Modified() override;
345 void Update();
346
350 static const char* GetStringFromType(int type);
351
355 static const char* GetStringFromSubType(int type);
356
362 static const char* GetShortStringFromSubType(int subtype);
363
369
370protected:
372 ~vtkLightKit() override;
373
374 void WarmthToRGBI(double w, double rgb[3], double& i);
375 void WarmthToRGB(double w, double rgb[3]);
377 double WarmthToIntensity(double w);
378
383
386 double KeyLightAngle[2];
387 double KeyLightColor[3];
388
391 double FillLightAngle[2];
392 double FillLightColor[3];
393
395 double BackLightColor[3];
396
399
400 double BackLightAngle[2];
401
404 double HeadLightColor[3];
405
407
408 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
409
410private:
411 vtkLightKit(const vtkLightKit&) = delete;
412 void operator=(const vtkLightKit&) = delete;
413};
414
415VTK_ABI_NAMESPACE_END
416#endif
a simple class to control print indentation
Definition vtkIndent.h:108
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
void SetBackLightAngle(double elevation, double azimuth)
vtkLight * BackLight0
void SetBackLightElevation(double x)
void AddLightsToRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
void SetBackLightAzimuth(double x)
virtual double * GetFillLightAngle()
static const char * GetStringFromSubType(int type)
Helper method to go from a enum subtype to a string subtype.
double FillLightWarmth
double BackLightColor[3]
double GetBackLightAzimuth()
double FillLightColor[3]
double FillLightAngle[2]
double KeyLightWarmth
void Update()
void SetFillLightAngle(double angle[2])
double KeyToHeadRatio
void SetBackLightAngle(double angle[2])
vtkLight * KeyLight
void DeepCopy(vtkLightKit *kit)
double GetKeyLightElevation()
void SetKeyLightAngle(double angle[2])
void InitializeWarmthFunctions()
double HeadLightWarmth
void SetKeyLightElevation(double x)
virtual double * GetBackLightAngle()
void SetKeyLightAzimuth(double x)
double KeyLightAngle[2]
double KeyToFillRatio
static vtkLightKit * New()
void WarmthToRGBI(double w, double rgb[3], double &i)
double GetFillLightElevation()
double GetKeyLightAzimuth()
double KeyToBackRatio
void RemoveLightsFromRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
double GetFillLightAzimuth()
void SetFillLightAzimuth(double x)
void Modified() override
Update the modification time for this object.
double BackLightWarmth
vtkTypeBool MaintainLuminance
double HeadLightColor[3]
vtkLight * HeadLight
vtkPiecewiseFunction * WarmthFunction[4]
static const char * GetStringFromType(int type)
Helper method to go from a enum type to a string type.
vtkLight * BackLight1
void SetFillLightAngle(double elevation, double azimuth)
double BackLightAngle[2]
virtual double * GetKeyLightAngle()
static LightKitSubType GetSubType(LightKitType type, int i)
Return the possible subtype from a given type.
static const char * GetShortStringFromSubType(int subtype)
Helper method to go from a enum subtype to a string subtype The difference from GetStringFromSubType ...
void SetFillLightElevation(double x)
double KeyLightIntensity
void WarmthToRGB(double w, double rgb[3])
double GetBackLightElevation()
double KeyLightColor[3]
vtkLight * FillLight
double WarmthToIntensity(double w)
a virtual light for 3D rendering
Definition vtkLight.h:159
Defines a 1D piecewise function.
abstract specification for renderers
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DOUBLE_MAX
Definition vtkType.h:202
#define VTK_MARSHALAUTO