VTK  9.2.5
vtkLightKit.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkLightKit.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
95#ifndef vtkLightKit_h
96#define vtkLightKit_h
97
98#include "vtkObject.h"
99#include "vtkRenderingCoreModule.h" // For export macro
100
101class vtkLight;
103class vtkRenderer;
104
105class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
106{
107public:
108 static vtkLightKit* New();
109 vtkTypeMacro(vtkLightKit, vtkObject);
110 void PrintSelf(ostream& os, vtkIndent indent) override;
111
113 {
117 THeadLight
118 };
119
121 {
128 KHRatio
129 };
130
132
137 vtkSetMacro(KeyLightIntensity, double);
138 vtkGetMacro(KeyLightIntensity, double);
140
142
153 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
154 vtkGetMacro(KeyToFillRatio, double);
156
158
169 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
170 vtkGetMacro(KeyToHeadRatio, double);
172
174
181 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
182 vtkGetMacro(KeyToBackRatio, double);
184
186
198 vtkSetMacro(KeyLightWarmth, double);
199 vtkGetMacro(KeyLightWarmth, double);
201
202 vtkSetMacro(FillLightWarmth, double);
203 vtkGetMacro(FillLightWarmth, double);
204
205 vtkSetMacro(HeadLightWarmth, double);
206 vtkGetMacro(HeadLightWarmth, double);
207
208 vtkSetMacro(BackLightWarmth, double);
209 vtkGetMacro(BackLightWarmth, double);
210
212
215 vtkGetVectorMacro(KeyLightColor, double, 3);
216 vtkGetVectorMacro(FillLightColor, double, 3);
217 vtkGetVectorMacro(HeadLightColor, double, 3);
218 vtkGetVectorMacro(BackLightColor, double, 3);
220
222
227 vtkBooleanMacro(MaintainLuminance, vtkTypeBool);
228 vtkGetMacro(MaintainLuminance, vtkTypeBool);
229 vtkSetMacro(MaintainLuminance, vtkTypeBool);
231
245 void SetKeyLightAngle(double elevation, double azimuth);
246 void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
247
248 void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
249
250 void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
251
252 vtkGetVectorMacro(KeyLightAngle, double, 2);
254 {
255 double ang[2];
256 this->GetKeyLightAngle(ang);
257 return ang[0];
258 }
259
261 {
262 double ang[2];
263 this->GetKeyLightAngle(ang);
264 return ang[1];
265 }
266
267 void SetFillLightAngle(double elevation, double azimuth);
268 void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
269
270 void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
271
272 void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
273
274 vtkGetVectorMacro(FillLightAngle, double, 2);
276 {
277 double ang[2];
278 this->GetFillLightAngle(ang);
279 return ang[0];
280 }
281
283 {
284 double ang[2];
285 this->GetFillLightAngle(ang);
286 return ang[1];
287 }
288
289 void SetBackLightAngle(double elevation, double azimuth);
290 void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
291
292 void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
293
294 void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
295
296 vtkGetVectorMacro(BackLightAngle, double, 2);
298 {
299 double ang[2];
300 this->GetBackLightAngle(ang);
301 return ang[0];
302 }
303
305 {
306 double ang[2];
307 this->GetBackLightAngle(ang);
308 return ang[1];
309 }
310
312
319
321
322 void Modified() override;
323 void Update();
324
328 static const char* GetStringFromType(int type);
329
333 static const char* GetStringFromSubType(int type);
334
340 static const char* GetShortStringFromSubType(int subtype);
341
347
348protected:
350 ~vtkLightKit() override;
351
352 void WarmthToRGBI(double w, double rgb[3], double& i);
353 void WarmthToRGB(double w, double rgb[3]);
355 double WarmthToIntensity(double w);
356
361
364 double KeyLightAngle[2];
365 double KeyLightColor[3];
366
369 double FillLightAngle[2];
370 double FillLightColor[3];
371
373 double BackLightColor[3];
374
377
378 double BackLightAngle[2];
379
382 double HeadLightColor[3];
383
385
386 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
387
388private:
389 vtkLightKit(const vtkLightKit&) = delete;
390 void operator=(const vtkLightKit&) = delete;
391};
392
393#endif
a simple class to control print indentation
Definition: vtkIndent.h:40
a simple but quality lighting kit
Definition: vtkLightKit.h:106
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
Definition: vtkLightKit.h:375
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:292
void AddLightsToRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
void SetBackLightAzimuth(double x)
Definition: vtkLightKit.h:294
static const char * GetStringFromSubType(int type)
Helper method to go from a enum subtype to a string subtype.
double FillLightWarmth
Definition: vtkLightKit.h:368
double GetBackLightAzimuth()
Definition: vtkLightKit.h:304
double KeyLightWarmth
Definition: vtkLightKit.h:363
void Update()
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:268
double KeyToHeadRatio
Definition: vtkLightKit.h:359
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:290
vtkLight * KeyLight
Definition: vtkLightKit.h:362
void DeepCopy(vtkLightKit *kit)
double GetKeyLightElevation()
Definition: vtkLightKit.h:253
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:246
void InitializeWarmthFunctions()
double HeadLightWarmth
Definition: vtkLightKit.h:381
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:248
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:250
double KeyToFillRatio
Definition: vtkLightKit.h:358
static vtkLightKit * New()
void WarmthToRGBI(double w, double rgb[3], double &i)
double GetFillLightElevation()
Definition: vtkLightKit.h:275
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:260
double KeyToBackRatio
Definition: vtkLightKit.h:360
void RemoveLightsFromRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
double GetFillLightAzimuth()
Definition: vtkLightKit.h:282
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:272
void Modified() override
Update the modification time for this object.
double BackLightWarmth
Definition: vtkLightKit.h:372
vtkTypeBool MaintainLuminance
Definition: vtkLightKit.h:384
vtkLight * HeadLight
Definition: vtkLightKit.h:380
static const char * GetStringFromType(int type)
Helper method to go from a enum type to a string type.
vtkLight * BackLight1
Definition: vtkLightKit.h:376
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)
Definition: vtkLightKit.h:270
double KeyLightIntensity
Definition: vtkLightKit.h:357
void WarmthToRGB(double w, double rgb[3])
double GetBackLightElevation()
Definition: vtkLightKit.h:297
vtkLight * FillLight
Definition: vtkLightKit.h:367
double WarmthToIntensity(double w)
a virtual light for 3D rendering
Definition: vtkLight.h:60
abstract base class for most VTK objects
Definition: vtkObject.h:63
Defines a 1D piecewise function.
abstract specification for renderers
Definition: vtkRenderer.h:73
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165