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
92#ifndef vtkLightKit_h
93#define vtkLightKit_h
94
95#include "vtkObject.h"
96#include "vtkRenderingCoreModule.h" // For export macro
97
98VTK_ABI_NAMESPACE_BEGIN
99class vtkLight;
101class vtkRenderer;
102
103class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
104{
105public:
106 static vtkLightKit* New();
107 vtkTypeMacro(vtkLightKit, vtkObject);
108 void PrintSelf(ostream& os, vtkIndent indent) override;
109
111 {
115 THeadLight
116 };
117
119 {
126 KHRatio
127 };
128
130
135 vtkSetMacro(KeyLightIntensity, double);
136 vtkGetMacro(KeyLightIntensity, double);
138
140
151 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
152 vtkGetMacro(KeyToFillRatio, double);
154
156
167 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
168 vtkGetMacro(KeyToHeadRatio, double);
170
172
179 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
180 vtkGetMacro(KeyToBackRatio, double);
182
184
196 vtkSetMacro(KeyLightWarmth, double);
197 vtkGetMacro(KeyLightWarmth, double);
199
200 vtkSetMacro(FillLightWarmth, double);
201 vtkGetMacro(FillLightWarmth, double);
202
203 vtkSetMacro(HeadLightWarmth, double);
204 vtkGetMacro(HeadLightWarmth, double);
205
206 vtkSetMacro(BackLightWarmth, double);
207 vtkGetMacro(BackLightWarmth, double);
208
210
213 vtkGetVectorMacro(KeyLightColor, double, 3);
214 vtkGetVectorMacro(FillLightColor, double, 3);
215 vtkGetVectorMacro(HeadLightColor, double, 3);
216 vtkGetVectorMacro(BackLightColor, double, 3);
218
220
225 vtkBooleanMacro(MaintainLuminance, vtkTypeBool);
226 vtkGetMacro(MaintainLuminance, vtkTypeBool);
227 vtkSetMacro(MaintainLuminance, vtkTypeBool);
229
243 void SetKeyLightAngle(double elevation, double azimuth);
244 void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
245
246 void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
247
248 void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
249
250 vtkGetVectorMacro(KeyLightAngle, double, 2);
252 {
253 double ang[2];
254 this->GetKeyLightAngle(ang);
255 return ang[0];
256 }
257
259 {
260 double ang[2];
261 this->GetKeyLightAngle(ang);
262 return ang[1];
263 }
264
265 void SetFillLightAngle(double elevation, double azimuth);
266 void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
267
268 void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
269
270 void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
271
272 vtkGetVectorMacro(FillLightAngle, double, 2);
274 {
275 double ang[2];
276 this->GetFillLightAngle(ang);
277 return ang[0];
278 }
279
281 {
282 double ang[2];
283 this->GetFillLightAngle(ang);
284 return ang[1];
285 }
286
287 void SetBackLightAngle(double elevation, double azimuth);
288 void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
289
290 void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
291
292 void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
293
294 vtkGetVectorMacro(BackLightAngle, double, 2);
296 {
297 double ang[2];
298 this->GetBackLightAngle(ang);
299 return ang[0];
300 }
301
303 {
304 double ang[2];
305 this->GetBackLightAngle(ang);
306 return ang[1];
307 }
308
310
317
319
320 void Modified() override;
321 void Update();
322
326 static const char* GetStringFromType(int type);
327
331 static const char* GetStringFromSubType(int type);
332
338 static const char* GetShortStringFromSubType(int subtype);
339
345
346protected:
348 ~vtkLightKit() override;
349
350 void WarmthToRGBI(double w, double rgb[3], double& i);
351 void WarmthToRGB(double w, double rgb[3]);
353 double WarmthToIntensity(double w);
354
359
362 double KeyLightAngle[2];
363 double KeyLightColor[3];
364
367 double FillLightAngle[2];
368 double FillLightColor[3];
369
371 double BackLightColor[3];
372
375
376 double BackLightAngle[2];
377
380 double HeadLightColor[3];
381
383
384 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
385
386private:
387 vtkLightKit(const vtkLightKit&) = delete;
388 void operator=(const vtkLightKit&) = delete;
389};
390
391VTK_ABI_NAMESPACE_END
392#endif
a simple class to control print indentation
Definition vtkIndent.h:38
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:58
abstract base class for most VTK objects
Definition vtkObject.h:58
Defines a 1D piecewise function.
abstract specification for renderers
Definition vtkRenderer.h:68
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DOUBLE_MAX
Definition vtkType.h:154