VTK  9.2.6
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=========================================================================*/
104#ifndef vtkLightKit_h
105#define vtkLightKit_h
106
107#include "vtkObject.h"
108#include "vtkRenderingCoreModule.h" // For export macro
109
110class vtkLight;
112class vtkRenderer;
113
114class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
115{
116public:
117 static vtkLightKit* New();
118 vtkTypeMacro(vtkLightKit, vtkObject);
119 void PrintSelf(ostream& os, vtkIndent indent) override;
120
122 {
126 THeadLight
127 };
128
130 {
137 KHRatio
138 };
139
141
146 vtkSetMacro(KeyLightIntensity, double);
147 vtkGetMacro(KeyLightIntensity, double);
149
151
162 vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
163 vtkGetMacro(KeyToFillRatio, double);
165
167
178 vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
179 vtkGetMacro(KeyToHeadRatio, double);
181
183
190 vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
191 vtkGetMacro(KeyToBackRatio, double);
193
195
207 vtkSetMacro(KeyLightWarmth, double);
208 vtkGetMacro(KeyLightWarmth, double);
210
211 vtkSetMacro(FillLightWarmth, double);
212 vtkGetMacro(FillLightWarmth, double);
213
214 vtkSetMacro(HeadLightWarmth, double);
215 vtkGetMacro(HeadLightWarmth, double);
216
217 vtkSetMacro(BackLightWarmth, double);
218 vtkGetMacro(BackLightWarmth, double);
219
221
224 vtkGetVectorMacro(KeyLightColor, double, 3);
225 vtkGetVectorMacro(FillLightColor, double, 3);
226 vtkGetVectorMacro(HeadLightColor, double, 3);
227 vtkGetVectorMacro(BackLightColor, double, 3);
229
231
236 vtkBooleanMacro(MaintainLuminance, vtkTypeBool);
237 vtkGetMacro(MaintainLuminance, vtkTypeBool);
238 vtkSetMacro(MaintainLuminance, vtkTypeBool);
240
254 void SetKeyLightAngle(double elevation, double azimuth);
255 void SetKeyLightAngle(double angle[2]) { this->SetKeyLightAngle(angle[0], angle[1]); }
256
257 void SetKeyLightElevation(double x) { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
258
259 void SetKeyLightAzimuth(double x) { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
260
261 vtkGetVectorMacro(KeyLightAngle, double, 2);
263 {
264 double ang[2];
265 this->GetKeyLightAngle(ang);
266 return ang[0];
267 }
268
270 {
271 double ang[2];
272 this->GetKeyLightAngle(ang);
273 return ang[1];
274 }
275
276 void SetFillLightAngle(double elevation, double azimuth);
277 void SetFillLightAngle(double angle[2]) { this->SetFillLightAngle(angle[0], angle[1]); }
278
279 void SetFillLightElevation(double x) { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
280
281 void SetFillLightAzimuth(double x) { this->SetFillLightAngle(this->FillLightAngle[0], x); }
282
283 vtkGetVectorMacro(FillLightAngle, double, 2);
285 {
286 double ang[2];
287 this->GetFillLightAngle(ang);
288 return ang[0];
289 }
290
292 {
293 double ang[2];
294 this->GetFillLightAngle(ang);
295 return ang[1];
296 }
297
298 void SetBackLightAngle(double elevation, double azimuth);
299 void SetBackLightAngle(double angle[2]) { this->SetBackLightAngle(angle[0], angle[1]); }
300
301 void SetBackLightElevation(double x) { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
302
303 void SetBackLightAzimuth(double x) { this->SetBackLightAngle(this->BackLightAngle[0], x); }
304
305 vtkGetVectorMacro(BackLightAngle, double, 2);
307 {
308 double ang[2];
309 this->GetBackLightAngle(ang);
310 return ang[0];
311 }
312
314 {
315 double ang[2];
316 this->GetBackLightAngle(ang);
317 return ang[1];
318 }
319
321
328
330
331 void Modified() override;
332 void Update();
333
337 static const char* GetStringFromType(int type);
338
342 static const char* GetStringFromSubType(int type);
343
349 static const char* GetShortStringFromSubType(int subtype);
350
356
357protected:
359 ~vtkLightKit() override;
360
361 void WarmthToRGBI(double w, double rgb[3], double& i);
362 void WarmthToRGB(double w, double rgb[3]);
364 double WarmthToIntensity(double w);
365
370
373 double KeyLightAngle[2];
374 double KeyLightColor[3];
375
378 double FillLightAngle[2];
379 double FillLightColor[3];
380
382 double BackLightColor[3];
383
386
387 double BackLightAngle[2];
388
391 double HeadLightColor[3];
392
394
395 vtkPiecewiseFunction* WarmthFunction[4]; // r, g, b, perceptual length
396
397private:
398 vtkLightKit(const vtkLightKit&) = delete;
399 void operator=(const vtkLightKit&) = delete;
400};
401
402#endif
a simple class to control print indentation
Definition vtkIndent.h:49
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:69
abstract base class for most VTK objects
Definition vtkObject.h:72
Defines a 1D piecewise function.
abstract specification for renderers
Definition vtkRenderer.h:82
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_DOUBLE_MAX
Definition vtkType.h:165