VTK
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 =========================================================================*/
98 #ifndef vtkLightKit_h
99 #define vtkLightKit_h
100 
101 #include "vtkRenderingCoreModule.h" // For export macro
102 #include "vtkObject.h"
103 
104 class vtkLight;
106 class vtkRenderer;
107 
108 class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
109 {
110 public:
111  static vtkLightKit *New();
112  vtkTypeMacro(vtkLightKit, vtkObject);
113  void PrintSelf(ostream& os, vtkIndent indent);
114 
119  THeadLight
120  };
121 
129  KHRatio
130  };
131 
133 
138  vtkSetMacro(KeyLightIntensity, double);
139  vtkGetMacro(KeyLightIntensity, double);
141 
143 
154  vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
155  vtkGetMacro(KeyToFillRatio, double);
157 
159 
170  vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
171  vtkGetMacro(KeyToHeadRatio, double);
173 
175 
182  vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
183  vtkGetMacro(KeyToBackRatio, double);
185 
187 
199  vtkSetMacro(KeyLightWarmth, double);
200  vtkGetMacro(KeyLightWarmth, double);
202 
203  vtkSetMacro(FillLightWarmth, double);
204  vtkGetMacro(FillLightWarmth, double);
205 
206  vtkSetMacro(HeadLightWarmth, double);
207  vtkGetMacro(HeadLightWarmth, double);
208 
209  vtkSetMacro(BackLightWarmth, double);
210  vtkGetMacro(BackLightWarmth, double);
211 
213 
216  vtkGetVectorMacro(KeyLightColor, double, 3);
217  vtkGetVectorMacro(FillLightColor, double, 3);
218  vtkGetVectorMacro(HeadLightColor, double, 3);
219  vtkGetVectorMacro(BackLightColor, double, 3);
221 
223 
228  vtkBooleanMacro(MaintainLuminance, int);
229  vtkGetMacro(MaintainLuminance, int);
230  vtkSetMacro(MaintainLuminance, int);
232 
246  void SetKeyLightAngle(double elevation, double azimuth);
247  void SetKeyLightAngle(double angle[2])
248  { this->SetKeyLightAngle(angle[0], angle[1]); }
249 
250  void SetKeyLightElevation(double x)
251  { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
252 
253  void SetKeyLightAzimuth(double x)
254  { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
255 
256  vtkGetVectorMacro(KeyLightAngle, double, 2);
258  { double ang[2]; this->GetKeyLightAngle(ang); return ang[0]; }
259 
261  { double ang[2]; this->GetKeyLightAngle(ang); return ang[1]; }
262 
263  void SetFillLightAngle(double elevation, double azimuth);
264  void SetFillLightAngle(double angle[2])
265  { this->SetFillLightAngle(angle[0], angle[1]); }
266 
267  void SetFillLightElevation(double x)
268  { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
269 
270  void SetFillLightAzimuth(double x)
271  { this->SetFillLightAngle(this->FillLightAngle[0], x); }
272 
273  vtkGetVectorMacro(FillLightAngle, double, 2);
275  double ang[2]; this->GetFillLightAngle(ang); return ang[0]; }
276 
278  { double ang[2]; this->GetFillLightAngle(ang); return ang[1]; }
279 
280  void SetBackLightAngle(double elevation, double azimuth);
281  void SetBackLightAngle(double angle[2])
282  { this->SetBackLightAngle(angle[0], angle[1]); }
283 
284  void SetBackLightElevation(double x)
285  { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
286 
287  void SetBackLightAzimuth(double x)
288  { this->SetBackLightAngle(this->BackLightAngle[0], x); }
289 
290  vtkGetVectorMacro(BackLightAngle, double, 2);
292  { double ang[2]; this->GetBackLightAngle(ang); return ang[0]; }
293 
295  { double ang[2]; this->GetBackLightAngle(ang); return ang[1]; }
296 
298 
302  void AddLightsToRenderer(vtkRenderer *renderer);
303  void RemoveLightsFromRenderer(vtkRenderer *renderer);
305 
306  void DeepCopy(vtkLightKit *kit);
307 
308  void Modified();
309  void Update();
310 
314  static const char *GetStringFromType(int type);
315 
319  static const char *GetStringFromSubType(int type);
320 
326  static const char *GetShortStringFromSubType(int subtype);
327 
332  static LightKitSubType GetSubType(LightKitType type, int i);
333 
334 protected:
335  vtkLightKit();
336  ~vtkLightKit();
337 
338  void WarmthToRGBI(double w, double rgb[3], double& i);
339  void WarmthToRGB(double w, double rgb[3]);
340  void InitializeWarmthFunctions();
341  double WarmthToIntensity(double w);
342 
343 
348 
351  double KeyLightAngle[2];
352  double KeyLightColor[3];
353 
356  double FillLightAngle[2];
357  double FillLightColor[3];
358 
360  double BackLightColor[3];
361 
364 
365  double BackLightAngle[2];
366 
369  double HeadLightColor[3];
370 
372 
373  vtkPiecewiseFunction *WarmthFunction[4]; // r, g, b, perceptual length
374 
375 private:
376  vtkLightKit(const vtkLightKit&) VTK_DELETE_FUNCTION;
377  void operator=(const vtkLightKit&) VTK_DELETE_FUNCTION;
378 };
379 
380 #endif
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:264
abstract base class for most VTK objects
Definition: vtkObject.h:59
double KeyLightIntensity
Definition: vtkLightKit.h:344
double GetFillLightAzimuth()
Definition: vtkLightKit.h:277
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_DOUBLE_MAX
Definition: vtkType.h:163
Defines a 1D piecewise function.
vtkLight * BackLight0
Definition: vtkLightKit.h:362
double KeyToBackRatio
Definition: vtkLightKit.h:347
double GetBackLightAzimuth()
Definition: vtkLightKit.h:294
void SetBackLightAzimuth(double x)
Definition: vtkLightKit.h:287
double KeyToFillRatio
Definition: vtkLightKit.h:345
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:284
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void Update()
Updates the extensions string.
a simple but quality lighting kit
Definition: vtkLightKit.h:108
vtkLight * KeyLight
Definition: vtkLightKit.h:349
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:247
double KeyLightWarmth
Definition: vtkLightKit.h:350
vtkLight * FillLight
Definition: vtkLightKit.h:354
a simple class to control print indentation
Definition: vtkIndent.h:39
double GetKeyLightElevation()
Definition: vtkLightKit.h:257
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:250
a virtual light for 3D rendering
Definition: vtkLight.h:61
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:253
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:260
double GetBackLightElevation()
Definition: vtkLightKit.h:291
vtkLight * BackLight1
Definition: vtkLightKit.h:363
virtual void Modified()
Update the modification time for this object.
int MaintainLuminance
Definition: vtkLightKit.h:371
void SetFillLightElevation(double x)
Definition: vtkLightKit.h:267
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:281
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
double BackLightWarmth
Definition: vtkLightKit.h:359
double HeadLightWarmth
Definition: vtkLightKit.h:368
double FillLightWarmth
Definition: vtkLightKit.h:355
vtkLight * HeadLight
Definition: vtkLightKit.h:367
double KeyToHeadRatio
Definition: vtkLightKit.h:346
double GetFillLightElevation()
Definition: vtkLightKit.h:274
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:270