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 =========================================================================*/
97 #ifndef vtkLightKit_h
98 #define vtkLightKit_h
99 
100 #include "vtkRenderingCoreModule.h" // For export macro
101 #include "vtkObject.h"
102 
103 class vtkLight;
105 class vtkRenderer;
106 
108 {
109 public:
110  static vtkLightKit *New();
111  vtkTypeMacro(vtkLightKit, vtkObject);
112  void PrintSelf(ostream& os, vtkIndent indent);
113 
114  //BTX
119  THeadLight
120  };
121 
129  KHRatio
130  };
131 
132  //ETX
133 
135 
138  vtkSetMacro(KeyLightIntensity, double);
139  vtkGetMacro(KeyLightIntensity, double);
141 
143 
151  vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
152  vtkGetMacro(KeyToFillRatio, double);
154 
156 
165  vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
166  vtkGetMacro(KeyToHeadRatio, double);
168 
170 
175  vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
176  vtkGetMacro(KeyToBackRatio, double);
178 
180 
189  vtkSetMacro(KeyLightWarmth, double);
190  vtkGetMacro(KeyLightWarmth, double);
192 
193  vtkSetMacro(FillLightWarmth, double);
194  vtkGetMacro(FillLightWarmth, double);
195 
196  vtkSetMacro(HeadLightWarmth, double);
197  vtkGetMacro(HeadLightWarmth, double);
198 
199  vtkSetMacro(BackLightWarmth, double);
200  vtkGetMacro(BackLightWarmth, double);
201 
203 
204  vtkGetVectorMacro(KeyLightColor, double, 3);
205  vtkGetVectorMacro(FillLightColor, double, 3);
206  vtkGetVectorMacro(HeadLightColor, double, 3);
207  vtkGetVectorMacro(BackLightColor, double, 3);
209 
211 
214  vtkBooleanMacro(MaintainLuminance, int);
215  vtkGetMacro(MaintainLuminance, int);
216  vtkSetMacro(MaintainLuminance, int);
218 
220 
231  void SetKeyLightAngle(double elevation, double azimuth);
232  void SetKeyLightAngle(double angle[2])
233  { this->SetKeyLightAngle(angle[0], angle[1]); }
235 
236  void SetKeyLightElevation(double x)
237  { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
238 
239  void SetKeyLightAzimuth(double x)
240  { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
241 
242  vtkGetVectorMacro(KeyLightAngle, double, 2);
244  { double ang[2]; this->GetKeyLightAngle(ang); return ang[0]; }
245 
247  { double ang[2]; this->GetKeyLightAngle(ang); return ang[1]; }
248 
249  void SetFillLightAngle(double elevation, double azimuth);
250  void SetFillLightAngle(double angle[2])
251  { this->SetFillLightAngle(angle[0], angle[1]); }
252 
253  void SetFillLightElevation(double x)
254  { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
255 
256  void SetFillLightAzimuth(double x)
257  { this->SetFillLightAngle(this->FillLightAngle[0], x); }
258 
259  vtkGetVectorMacro(FillLightAngle, double, 2);
261  double ang[2]; this->GetFillLightAngle(ang); return ang[0]; }
262 
264  { double ang[2]; this->GetFillLightAngle(ang); return ang[1]; }
265 
266  void SetBackLightAngle(double elevation, double azimuth);
267  void SetBackLightAngle(double angle[2])
268  { this->SetBackLightAngle(angle[0], angle[1]); }
269 
270  void SetBackLightElevation(double x)
271  { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
272 
273  void SetBackLightAzimuth(double x)
274  { this->SetBackLightAngle(this->BackLightAngle[0], x); }
275 
276  vtkGetVectorMacro(BackLightAngle, double, 2);
278  { double ang[2]; this->GetBackLightAngle(ang); return ang[0]; }
279 
281  { double ang[2]; this->GetBackLightAngle(ang); return ang[1]; }
282 
284 
286  void AddLightsToRenderer(vtkRenderer *renderer);
287  void RemoveLightsFromRenderer(vtkRenderer *renderer);
289 
290  void DeepCopy(vtkLightKit *kit);
291 
292  void Modified();
293  void Update();
294 
296  static const char *GetStringFromType(int type);
297 
299  static const char *GetStringFromSubType(int type);
300 
304  static const char *GetShortStringFromSubType(int subtype);
305 
308  static LightKitSubType GetSubType(LightKitType type, int i);
309 
310 protected:
311  vtkLightKit();
312  ~vtkLightKit();
313 
314  void WarmthToRGBI(double w, double rgb[3], double& i);
315  void WarmthToRGB(double w, double rgb[3]);
316  void InitializeWarmthFunctions();
317  double WarmthToIntensity(double w);
318 
319 
324 
327  double KeyLightAngle[2];
328  double KeyLightColor[3];
329 
332  double FillLightAngle[2];
333  double FillLightColor[3];
334 
336  double BackLightColor[3];
337 
340 
341  double BackLightAngle[2];
342 
345  double HeadLightColor[3];
346 
348 
349  vtkPiecewiseFunction *WarmthFunction[4]; // r, g, b, perceptual length
350 
351 private:
352  vtkLightKit(const vtkLightKit&); // Not implemented.
353  void operator=(const vtkLightKit&); // Not implemented.
354 };
355 
356 #endif
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:250
abstract base class for most VTK objects
Definition: vtkObject.h:61
double KeyLightIntensity
Definition: vtkLightKit.h:320
double GetFillLightAzimuth()
Definition: vtkLightKit.h:263
#define VTK_DOUBLE_MAX
Definition: vtkType.h:142
Defines a 1D piecewise function.
vtkLight * BackLight0
Definition: vtkLightKit.h:338
double KeyToBackRatio
Definition: vtkLightKit.h:323
double GetBackLightAzimuth()
Definition: vtkLightKit.h:280
void SetBackLightAzimuth(double x)
Definition: vtkLightKit.h:273
double KeyToFillRatio
Definition: vtkLightKit.h:321
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:270
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void Update()
a simple but quality lighting kit
Definition: vtkLightKit.h:107
vtkLight * KeyLight
Definition: vtkLightKit.h:325
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:232
double KeyLightWarmth
Definition: vtkLightKit.h:326
vtkLight * FillLight
Definition: vtkLightKit.h:330
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
double GetKeyLightElevation()
Definition: vtkLightKit.h:243
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:236
a virtual light for 3D rendering
Definition: vtkLight.h:60
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:239
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:246
double GetBackLightElevation()
Definition: vtkLightKit.h:277
vtkLight * BackLight1
Definition: vtkLightKit.h:339
virtual void Modified()
int MaintainLuminance
Definition: vtkLightKit.h:347
void SetFillLightElevation(double x)
Definition: vtkLightKit.h:253
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:267
#define VTKRENDERINGCORE_EXPORT
static vtkObject * New()
double BackLightWarmth
Definition: vtkLightKit.h:335
double HeadLightWarmth
Definition: vtkLightKit.h:344
double FillLightWarmth
Definition: vtkLightKit.h:331
vtkLight * HeadLight
Definition: vtkLightKit.h:343
double KeyToHeadRatio
Definition: vtkLightKit.h:322
double GetFillLightElevation()
Definition: vtkLightKit.h:260
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:256