VTK  9.3.0
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
89VTK_ABI_NAMESPACE_BEGIN
90class vtkLight;
92class vtkRenderer;
93
94class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
95{
96public:
97 static vtkLightKit* New();
98 vtkTypeMacro(vtkLightKit, vtkObject);
99 void PrintSelf(ostream& os, vtkIndent indent) override;
100
102 {
106 THeadLight
107 };
108
110 {
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);
243 {
244 double ang[2];
245 this->GetKeyLightAngle(ang);
246 return ang[0];
247 }
248
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);
265 {
266 double ang[2];
267 this->GetFillLightAngle(ang);
268 return ang[0];
269 }
270
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);
287 {
288 double ang[2];
289 this->GetBackLightAngle(ang);
290 return ang[0];
291 }
292
294 {
295 double ang[2];
296 this->GetBackLightAngle(ang);
297 return ang[1];
298 }
299
301
308
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
336
337protected:
339 ~vtkLightKit() override;
340
341 void WarmthToRGBI(double w, double rgb[3], double& i);
342 void WarmthToRGB(double w, double rgb[3]);
344 double WarmthToIntensity(double w);
345
350
353 double KeyLightAngle[2];
354 double KeyLightColor[3];
355
358 double FillLightAngle[2];
359 double FillLightColor[3];
360
362 double BackLightColor[3];
363
366
367 double BackLightAngle[2];
368
371 double HeadLightColor[3];
372
374
375 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
376
377private:
378 vtkLightKit(const vtkLightKit&) = delete;
379 void operator=(const vtkLightKit&) = delete;
380};
381
382VTK_ABI_NAMESPACE_END
383#endif
a simple class to control print indentation
Definition vtkIndent.h:29
a simple but quality lighting kit
Definition vtkLightKit.h:95
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:49
abstract base class for most VTK objects
Definition vtkObject.h:49
Defines a 1D piecewise function.
abstract specification for renderers
Definition vtkRenderer.h:59
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DOUBLE_MAX
Definition vtkType.h:154