VTK  9.5.20250901
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
115#ifndef vtkLightKit_h
116#define vtkLightKit_h
117
118#include "vtkObject.h"
119#include "vtkRenderingCoreModule.h" // For export macro
120
121VTK_ABI_NAMESPACE_BEGIN
122class vtkLight;
124class vtkRenderer;
125
126class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
127{
128public:
129 static vtkLightKit* New();
130 vtkTypeMacro(vtkLightKit, vtkObject);
131 void PrintSelf(ostream& os, vtkIndent indent) override;
132
134 {
138 THeadLight
139 };
140
142 {
149 KHRatio
150 };
151
153
158 vtkSetMacro(KeyLightIntensity, double);
159 vtkGetMacro(KeyLightIntensity, double);
161
163
174 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
175 vtkGetMacro(KeyToFillRatio, double);
177
179
190 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
191 vtkGetMacro(KeyToHeadRatio, double);
193
195
202 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
203 vtkGetMacro(KeyToBackRatio, double);
205
207
219 vtkSetMacro(KeyLightWarmth, double);
220 vtkGetMacro(KeyLightWarmth, double);
222
223 vtkSetMacro(FillLightWarmth, double);
224 vtkGetMacro(FillLightWarmth, double);
225
226 vtkSetMacro(HeadLightWarmth, double);
227 vtkGetMacro(HeadLightWarmth, double);
228
229 vtkSetMacro(BackLightWarmth, double);
230 vtkGetMacro(BackLightWarmth, double);
231
233
236 vtkGetVectorMacro(KeyLightColor, double, 3);
237 vtkGetVectorMacro(FillLightColor, double, 3);
238 vtkGetVectorMacro(HeadLightColor, double, 3);
239 vtkGetVectorMacro(BackLightColor, double, 3);
241
243
248 vtkBooleanMacro(MaintainLuminance, vtkTypeBool);
249 vtkGetMacro(MaintainLuminance, vtkTypeBool);
250 vtkSetMacro(MaintainLuminance, vtkTypeBool);
252
266 void SetKeyLightAngle(double elevation, double azimuth);
267 void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
268
269 void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
270
271 void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
272
273 vtkGetVectorMacro(KeyLightAngle, double, 2);
275 {
276 double ang[2];
277 this->GetKeyLightAngle(ang);
278 return ang[0];
279 }
280
282 {
283 double ang[2];
284 this->GetKeyLightAngle(ang);
285 return ang[1];
286 }
287
288 void SetFillLightAngle(double elevation, double azimuth);
289 void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
290
291 void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
292
293 void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
294
295 vtkGetVectorMacro(FillLightAngle, double, 2);
297 {
298 double ang[2];
299 this->GetFillLightAngle(ang);
300 return ang[0];
301 }
302
304 {
305 double ang[2];
306 this->GetFillLightAngle(ang);
307 return ang[1];
308 }
309
310 void SetBackLightAngle(double elevation, double azimuth);
311 void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
312
313 void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
314
315 void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
316
317 vtkGetVectorMacro(BackLightAngle, double, 2);
319 {
320 double ang[2];
321 this->GetBackLightAngle(ang);
322 return ang[0];
323 }
324
326 {
327 double ang[2];
328 this->GetBackLightAngle(ang);
329 return ang[1];
330 }
331
333
340
342
343 void Modified() override;
344 void Update();
345
349 static const char* GetStringFromType(int type);
350
354 static const char* GetStringFromSubType(int type);
355
361 static const char* GetShortStringFromSubType(int subtype);
362
368
369protected:
371 ~vtkLightKit() override;
372
373 void WarmthToRGBI(double w, double rgb[3], double& i);
374 void WarmthToRGB(double w, double rgb[3]);
376 double WarmthToIntensity(double w);
377
382
385 double KeyLightAngle[2];
386 double KeyLightColor[3];
387
390 double FillLightAngle[2];
391 double FillLightColor[3];
392
394 double BackLightColor[3];
395
398
399 double BackLightAngle[2];
400
403 double HeadLightColor[3];
404
406
407 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
408
409private:
410 vtkLightKit(const vtkLightKit&) = delete;
411 void operator=(const vtkLightKit&) = delete;
412};
413
414VTK_ABI_NAMESPACE_END
415#endif
a simple class to control print indentation
Definition vtkIndent.h:108
a simple but quality lighting kit
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)
static const char * GetStringFromSubType(int type)
Helper method to go from a enum subtype to a string subtype.
double FillLightWarmth
double GetBackLightAzimuth()
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)
void SetKeyLightAzimuth(double x)
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
vtkLight * HeadLight
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)
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()
vtkLight * FillLight
double WarmthToIntensity(double w)
a virtual light for 3D rendering
Definition vtkLight.h:159
abstract base class for most VTK objects
Definition vtkObject.h:162
Defines a 1D piecewise function.
abstract specification for renderers
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DOUBLE_MAX
Definition vtkType.h:171