VTK  9.4.20241226
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
112#ifndef vtkLightKit_h
113#define vtkLightKit_h
114
115#include "vtkObject.h"
116#include "vtkRenderingCoreModule.h" // For export macro
117
118VTK_ABI_NAMESPACE_BEGIN
119class vtkLight;
121class vtkRenderer;
122
123class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
124{
125public:
126 static vtkLightKit* New();
127 vtkTypeMacro(vtkLightKit, vtkObject);
128 void PrintSelf(ostream& os, vtkIndent indent) override;
129
131 {
135 THeadLight
136 };
137
139 {
146 KHRatio
147 };
148
150
155 vtkSetMacro(KeyLightIntensity, double);
156 vtkGetMacro(KeyLightIntensity, double);
158
160
171 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
172 vtkGetMacro(KeyToFillRatio, double);
174
176
187 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
188 vtkGetMacro(KeyToHeadRatio, double);
190
192
199 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
200 vtkGetMacro(KeyToBackRatio, double);
202
204
216 vtkSetMacro(KeyLightWarmth, double);
217 vtkGetMacro(KeyLightWarmth, double);
219
220 vtkSetMacro(FillLightWarmth, double);
221 vtkGetMacro(FillLightWarmth, double);
222
223 vtkSetMacro(HeadLightWarmth, double);
224 vtkGetMacro(HeadLightWarmth, double);
225
226 vtkSetMacro(BackLightWarmth, double);
227 vtkGetMacro(BackLightWarmth, double);
228
230
233 vtkGetVectorMacro(KeyLightColor, double, 3);
234 vtkGetVectorMacro(FillLightColor, double, 3);
235 vtkGetVectorMacro(HeadLightColor, double, 3);
236 vtkGetVectorMacro(BackLightColor, double, 3);
238
240
245 vtkBooleanMacro(MaintainLuminance, vtkTypeBool);
246 vtkGetMacro(MaintainLuminance, vtkTypeBool);
247 vtkSetMacro(MaintainLuminance, vtkTypeBool);
249
263 void SetKeyLightAngle(double elevation, double azimuth);
264 void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
265
266 void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
267
268 void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
269
270 vtkGetVectorMacro(KeyLightAngle, double, 2);
272 {
273 double ang[2];
274 this->GetKeyLightAngle(ang);
275 return ang[0];
276 }
277
279 {
280 double ang[2];
281 this->GetKeyLightAngle(ang);
282 return ang[1];
283 }
284
285 void SetFillLightAngle(double elevation, double azimuth);
286 void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
287
288 void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
289
290 void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
291
292 vtkGetVectorMacro(FillLightAngle, double, 2);
294 {
295 double ang[2];
296 this->GetFillLightAngle(ang);
297 return ang[0];
298 }
299
301 {
302 double ang[2];
303 this->GetFillLightAngle(ang);
304 return ang[1];
305 }
306
307 void SetBackLightAngle(double elevation, double azimuth);
308 void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
309
310 void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
311
312 void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
313
314 vtkGetVectorMacro(BackLightAngle, double, 2);
316 {
317 double ang[2];
318 this->GetBackLightAngle(ang);
319 return ang[0];
320 }
321
323 {
324 double ang[2];
325 this->GetBackLightAngle(ang);
326 return ang[1];
327 }
328
330
337
339
340 void Modified() override;
341 void Update();
342
346 static const char* GetStringFromType(int type);
347
351 static const char* GetStringFromSubType(int type);
352
358 static const char* GetShortStringFromSubType(int subtype);
359
365
366protected:
368 ~vtkLightKit() override;
369
370 void WarmthToRGBI(double w, double rgb[3], double& i);
371 void WarmthToRGB(double w, double rgb[3]);
373 double WarmthToIntensity(double w);
374
379
382 double KeyLightAngle[2];
383 double KeyLightColor[3];
384
387 double FillLightAngle[2];
388 double FillLightColor[3];
389
391 double BackLightColor[3];
392
395
396 double BackLightAngle[2];
397
400 double HeadLightColor[3];
401
403
404 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
405
406private:
407 vtkLightKit(const vtkLightKit&) = delete;
408 void operator=(const vtkLightKit&) = delete;
409};
410
411VTK_ABI_NAMESPACE_END
412#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:154