VTK  9.1.0
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=========================================================================*/
101#ifndef vtkLightKit_h
102#define vtkLightKit_h
103
104#include "vtkObject.h"
105#include "vtkRenderingCoreModule.h" // For export macro
106
107class vtkLight;
109class vtkRenderer;
110
111class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
112{
113public:
114 static vtkLightKit* New();
115 vtkTypeMacro(vtkLightKit, vtkObject);
116 void PrintSelf(ostream& os, vtkIndent indent) override;
117
119 {
123 THeadLight
124 };
125
127 {
134 KHRatio
135 };
136
138
143 vtkSetMacro(KeyLightIntensity, double);
144 vtkGetMacro(KeyLightIntensity, double);
146
148
159 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
160 vtkGetMacro(KeyToFillRatio, double);
162
164
175 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
176 vtkGetMacro(KeyToHeadRatio, double);
178
180
187 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
188 vtkGetMacro(KeyToBackRatio, double);
190
192
204 vtkSetMacro(KeyLightWarmth, double);
205 vtkGetMacro(KeyLightWarmth, double);
207
208 vtkSetMacro(FillLightWarmth, double);
209 vtkGetMacro(FillLightWarmth, double);
210
211 vtkSetMacro(HeadLightWarmth, double);
212 vtkGetMacro(HeadLightWarmth, double);
213
214 vtkSetMacro(BackLightWarmth, double);
215 vtkGetMacro(BackLightWarmth, double);
216
218
221 vtkGetVectorMacro(KeyLightColor, double, 3);
222 vtkGetVectorMacro(FillLightColor, double, 3);
223 vtkGetVectorMacro(HeadLightColor, double, 3);
224 vtkGetVectorMacro(BackLightColor, double, 3);
226
228
233 vtkBooleanMacro(MaintainLuminance, vtkTypeBool);
234 vtkGetMacro(MaintainLuminance, vtkTypeBool);
235 vtkSetMacro(MaintainLuminance, vtkTypeBool);
237
251 void SetKeyLightAngle(double elevation, double azimuth);
252 void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
253
254 void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
255
256 void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
257
258 vtkGetVectorMacro(KeyLightAngle, double, 2);
260 {
261 double ang[2];
262 this->GetKeyLightAngle(ang);
263 return ang[0];
264 }
265
267 {
268 double ang[2];
269 this->GetKeyLightAngle(ang);
270 return ang[1];
271 }
272
273 void SetFillLightAngle(double elevation, double azimuth);
274 void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
275
276 void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
277
278 void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
279
280 vtkGetVectorMacro(FillLightAngle, double, 2);
282 {
283 double ang[2];
284 this->GetFillLightAngle(ang);
285 return ang[0];
286 }
287
289 {
290 double ang[2];
291 this->GetFillLightAngle(ang);
292 return ang[1];
293 }
294
295 void SetBackLightAngle(double elevation, double azimuth);
296 void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
297
298 void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
299
300 void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
301
302 vtkGetVectorMacro(BackLightAngle, double, 2);
304 {
305 double ang[2];
306 this->GetBackLightAngle(ang);
307 return ang[0];
308 }
309
311 {
312 double ang[2];
313 this->GetBackLightAngle(ang);
314 return ang[1];
315 }
316
318
325
327
328 void Modified() override;
329 void Update();
330
334 static const char* GetStringFromType(int type);
335
339 static const char* GetStringFromSubType(int type);
340
346 static const char* GetShortStringFromSubType(int subtype);
347
353
354protected:
356 ~vtkLightKit() override;
357
358 void WarmthToRGBI(double w, double rgb[3], double& i);
359 void WarmthToRGB(double w, double rgb[3]);
361 double WarmthToIntensity(double w);
362
367
370 double KeyLightAngle[2];
371 double KeyLightColor[3];
372
375 double FillLightAngle[2];
376 double FillLightColor[3];
377
379 double BackLightColor[3];
380
383
384 double BackLightAngle[2];
385
388 double HeadLightColor[3];
389
391
392 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
393
394private:
395 vtkLightKit(const vtkLightKit&) = delete;
396 void operator=(const vtkLightKit&) = delete;
397};
398
399#endif
a simple class to control print indentation
Definition: vtkIndent.h:43
a simple but quality lighting kit
Definition: vtkLightKit.h:112
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:381
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:298
void AddLightsToRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
void SetBackLightAzimuth(double x)
Definition: vtkLightKit.h:300
static const char * GetStringFromSubType(int type)
Helper method to go from a enum subtype to a string subtype.
double FillLightWarmth
Definition: vtkLightKit.h:374
double GetBackLightAzimuth()
Definition: vtkLightKit.h:310
double KeyLightWarmth
Definition: vtkLightKit.h:369
void Update()
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:274
double KeyToHeadRatio
Definition: vtkLightKit.h:365
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:296
vtkLight * KeyLight
Definition: vtkLightKit.h:368
void DeepCopy(vtkLightKit *kit)
double GetKeyLightElevation()
Definition: vtkLightKit.h:259
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:252
void InitializeWarmthFunctions()
double HeadLightWarmth
Definition: vtkLightKit.h:387
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:254
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:256
double KeyToFillRatio
Definition: vtkLightKit.h:364
static vtkLightKit * New()
void WarmthToRGBI(double w, double rgb[3], double &i)
double GetFillLightElevation()
Definition: vtkLightKit.h:281
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:266
double KeyToBackRatio
Definition: vtkLightKit.h:366
void RemoveLightsFromRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
double GetFillLightAzimuth()
Definition: vtkLightKit.h:288
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:278
void Modified() override
Update the modification time for this object.
double BackLightWarmth
Definition: vtkLightKit.h:378
vtkTypeBool MaintainLuminance
Definition: vtkLightKit.h:390
vtkLight * HeadLight
Definition: vtkLightKit.h:386
static const char * GetStringFromType(int type)
Helper method to go from a enum type to a string type.
vtkLight * BackLight1
Definition: vtkLightKit.h:382
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:276
double KeyLightIntensity
Definition: vtkLightKit.h:363
void WarmthToRGB(double w, double rgb[3])
double GetBackLightElevation()
Definition: vtkLightKit.h:303
vtkLight * FillLight
Definition: vtkLightKit.h:373
double WarmthToIntensity(double w)
a virtual light for 3D rendering
Definition: vtkLight.h:66
abstract base class for most VTK objects
Definition: vtkObject.h:63
Defines a 1D piecewise function.
abstract specification for renderers
Definition: vtkRenderer.h:73
@ type
Definition: vtkX3D.h:522
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165