VTK  9.6.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
85
86#ifndef vtkLightKit_h
87#define vtkLightKit_h
88
89#include "vtkObject.h"
90#include "vtkRenderingCoreModule.h" // For export macro
91
92VTK_ABI_NAMESPACE_BEGIN
93class vtkLight;
95class vtkRenderer;
96
97class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
98{
99public:
100 static vtkLightKit* New();
101 vtkTypeMacro(vtkLightKit, vtkObject);
102 void PrintSelf(ostream& os, vtkIndent indent) override;
103
111
122
124
129 vtkSetMacro(KeyLightIntensity, double);
130 vtkGetMacro(KeyLightIntensity, double);
132
134
145 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
146 vtkGetMacro(KeyToFillRatio, double);
148
150
161 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
162 vtkGetMacro(KeyToHeadRatio, double);
164
166
173 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
174 vtkGetMacro(KeyToBackRatio, double);
176
178
190 vtkSetMacro(KeyLightWarmth, double);
191 vtkGetMacro(KeyLightWarmth, double);
193
194 vtkSetMacro(FillLightWarmth, double);
195 vtkGetMacro(FillLightWarmth, double);
196
197 vtkSetMacro(HeadLightWarmth, double);
198 vtkGetMacro(HeadLightWarmth, double);
199
200 vtkSetMacro(BackLightWarmth, double);
201 vtkGetMacro(BackLightWarmth, double);
202
204
207 vtkGetVectorMacro(KeyLightColor, double, 3);
208 vtkGetVectorMacro(FillLightColor, double, 3);
209 vtkGetVectorMacro(HeadLightColor, double, 3);
210 vtkGetVectorMacro(BackLightColor, double, 3);
212
214
223
237 void SetKeyLightAngle(double elevation, double azimuth);
238 void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
239
240 void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
241
242 void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
243
244 vtkGetVectorMacro(KeyLightAngle, double, 2);
246 {
247 double ang[2];
248 this->GetKeyLightAngle(ang);
249 return ang[0];
250 }
251
253 {
254 double ang[2];
255 this->GetKeyLightAngle(ang);
256 return ang[1];
257 }
258
259 void SetFillLightAngle(double elevation, double azimuth);
260 void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
261
262 void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
263
264 void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
265
266 vtkGetVectorMacro(FillLightAngle, double, 2);
268 {
269 double ang[2];
270 this->GetFillLightAngle(ang);
271 return ang[0];
272 }
273
275 {
276 double ang[2];
277 this->GetFillLightAngle(ang);
278 return ang[1];
279 }
280
281 void SetBackLightAngle(double elevation, double azimuth);
282 void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
283
284 void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
285
286 void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
287
288 vtkGetVectorMacro(BackLightAngle, double, 2);
290 {
291 double ang[2];
292 this->GetBackLightAngle(ang);
293 return ang[0];
294 }
295
297 {
298 double ang[2];
299 this->GetBackLightAngle(ang);
300 return ang[1];
301 }
302
304
311
313
314 void Modified() override;
315 void Update();
316
320 static const char* GetStringFromType(int type);
321
325 static const char* GetStringFromSubType(int type);
326
332 static const char* GetShortStringFromSubType(int subtype);
333
339
340protected:
342 ~vtkLightKit() override;
343
344 void WarmthToRGBI(double w, double rgb[3], double& i);
345 void WarmthToRGB(double w, double rgb[3]);
347 double WarmthToIntensity(double w);
348
353
356 double KeyLightAngle[2];
357 double KeyLightColor[3];
358
361 double FillLightAngle[2];
362 double FillLightColor[3];
363
365 double BackLightColor[3];
366
369
370 double BackLightAngle[2];
371
374 double HeadLightColor[3];
375
377
378 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
379
380private:
381 vtkLightKit(const vtkLightKit&) = delete;
382 void operator=(const vtkLightKit&) = delete;
383};
384
385VTK_ABI_NAMESPACE_END
386#endif
a simple class to control print indentation
Definition vtkIndent.h:29
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:50
Defines a 1D piecewise function.
abstract specification for renderers
Definition vtkRenderer.h:64
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DOUBLE_MAX
Definition vtkType.h:207