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=========================================================================*/
92#ifndef vtkLightKit_h
93#define vtkLightKit_h
94
95#include "vtkObject.h"
96#include "vtkRenderingCoreModule.h" // For export macro
97
98class vtkLight;
100class vtkRenderer;
101
102class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
103{
104public:
105 static vtkLightKit* New();
106 vtkTypeMacro(vtkLightKit, vtkObject);
107 void PrintSelf(ostream& os, vtkIndent indent) override;
108
110 {
114 THeadLight
115 };
116
118 {
125 KHRatio
126 };
127
129
134 vtkSetMacro(KeyLightIntensity, double);
135 vtkGetMacro(KeyLightIntensity, double);
137
139
150 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
151 vtkGetMacro(KeyToFillRatio, double);
153
155
166 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
167 vtkGetMacro(KeyToHeadRatio, double);
169
171
178 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
179 vtkGetMacro(KeyToBackRatio, double);
181
183
195 vtkSetMacro(KeyLightWarmth, double);
196 vtkGetMacro(KeyLightWarmth, double);
198
199 vtkSetMacro(FillLightWarmth, double);
200 vtkGetMacro(FillLightWarmth, double);
201
202 vtkSetMacro(HeadLightWarmth, double);
203 vtkGetMacro(HeadLightWarmth, double);
204
205 vtkSetMacro(BackLightWarmth, double);
206 vtkGetMacro(BackLightWarmth, double);
207
209
212 vtkGetVectorMacro(KeyLightColor, double, 3);
213 vtkGetVectorMacro(FillLightColor, double, 3);
214 vtkGetVectorMacro(HeadLightColor, double, 3);
215 vtkGetVectorMacro(BackLightColor, double, 3);
217
219
224 vtkBooleanMacro(MaintainLuminance, vtkTypeBool);
225 vtkGetMacro(MaintainLuminance, vtkTypeBool);
226 vtkSetMacro(MaintainLuminance, vtkTypeBool);
228
242 void SetKeyLightAngle(double elevation, double azimuth);
243 void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
244
245 void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
246
247 void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
248
249 vtkGetVectorMacro(KeyLightAngle, double, 2);
251 {
252 double ang[2];
253 this->GetKeyLightAngle(ang);
254 return ang[0];
255 }
256
258 {
259 double ang[2];
260 this->GetKeyLightAngle(ang);
261 return ang[1];
262 }
263
264 void SetFillLightAngle(double elevation, double azimuth);
265 void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
266
267 void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
268
269 void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
270
271 vtkGetVectorMacro(FillLightAngle, double, 2);
273 {
274 double ang[2];
275 this->GetFillLightAngle(ang);
276 return ang[0];
277 }
278
280 {
281 double ang[2];
282 this->GetFillLightAngle(ang);
283 return ang[1];
284 }
285
286 void SetBackLightAngle(double elevation, double azimuth);
287 void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
288
289 void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
290
291 void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
292
293 vtkGetVectorMacro(BackLightAngle, double, 2);
295 {
296 double ang[2];
297 this->GetBackLightAngle(ang);
298 return ang[0];
299 }
300
302 {
303 double ang[2];
304 this->GetBackLightAngle(ang);
305 return ang[1];
306 }
307
309
316
318
319 void Modified() override;
320 void Update();
321
325 static const char* GetStringFromType(int type);
326
330 static const char* GetStringFromSubType(int type);
331
337 static const char* GetShortStringFromSubType(int subtype);
338
344
345protected:
347 ~vtkLightKit() override;
348
349 void WarmthToRGBI(double w, double rgb[3], double& i);
350 void WarmthToRGB(double w, double rgb[3]);
352 double WarmthToIntensity(double w);
353
358
361 double KeyLightAngle[2];
362 double KeyLightColor[3];
363
366 double FillLightAngle[2];
367 double FillLightColor[3];
368
370 double BackLightColor[3];
371
374
375 double BackLightAngle[2];
376
379 double HeadLightColor[3];
380
382
383 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
384
385private:
386 vtkLightKit(const vtkLightKit&) = delete;
387 void operator=(const vtkLightKit&) = delete;
388};
389
390#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
a simple but quality lighting kit
Definition: vtkLightKit.h:103
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:372
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:289
void AddLightsToRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
void SetBackLightAzimuth(double x)
Definition: vtkLightKit.h:291
static const char * GetStringFromSubType(int type)
Helper method to go from a enum subtype to a string subtype.
double FillLightWarmth
Definition: vtkLightKit.h:365
double GetBackLightAzimuth()
Definition: vtkLightKit.h:301
double KeyLightWarmth
Definition: vtkLightKit.h:360
void Update()
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:265
double KeyToHeadRatio
Definition: vtkLightKit.h:356
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:287
vtkLight * KeyLight
Definition: vtkLightKit.h:359
void DeepCopy(vtkLightKit *kit)
double GetKeyLightElevation()
Definition: vtkLightKit.h:250
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:243
void InitializeWarmthFunctions()
double HeadLightWarmth
Definition: vtkLightKit.h:378
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:245
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:247
double KeyToFillRatio
Definition: vtkLightKit.h:355
static vtkLightKit * New()
void WarmthToRGBI(double w, double rgb[3], double &i)
double GetFillLightElevation()
Definition: vtkLightKit.h:272
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:257
double KeyToBackRatio
Definition: vtkLightKit.h:357
void RemoveLightsFromRenderer(vtkRenderer *renderer)
Add lights to, or remove lights from, a renderer.
double GetFillLightAzimuth()
Definition: vtkLightKit.h:279
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:269
void Modified() override
Update the modification time for this object.
double BackLightWarmth
Definition: vtkLightKit.h:369
vtkTypeBool MaintainLuminance
Definition: vtkLightKit.h:381
vtkLight * HeadLight
Definition: vtkLightKit.h:377
static const char * GetStringFromType(int type)
Helper method to go from a enum type to a string type.
vtkLight * BackLight1
Definition: vtkLightKit.h:373
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:267
double KeyLightIntensity
Definition: vtkLightKit.h:354
void WarmthToRGB(double w, double rgb[3])
double GetBackLightElevation()
Definition: vtkLightKit.h:294
vtkLight * FillLight
Definition: vtkLightKit.h:364
double WarmthToIntensity(double w)
a virtual light for 3D rendering
Definition: vtkLight.h:166
abstract base class for most VTK objects
Definition: vtkObject.h:73
Defines a 1D piecewise function.
abstract specification for renderers
Definition: vtkRenderer.h:173
@ type
Definition: vtkX3D.h:522
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165