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 =========================================================================*/
94 #ifndef __vtkLightKit_h
95 #define __vtkLightKit_h
96 
97 #include "vtkRenderingCoreModule.h" // For export macro
98 #include "vtkObject.h"
99 
100 class vtkLight;
102 class vtkRenderer;
103 
105 {
106 public:
107  static vtkLightKit *New();
109  void PrintSelf(ostream& os, vtkIndent indent);
110 
111  //BTX
116  THeadLight
117  };
118 
126  KHRatio
127  };
128 
129  //ETX
130 
132 
135  vtkSetMacro(KeyLightIntensity, double);
136  vtkGetMacro(KeyLightIntensity, double);
138 
140 
148  vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
149  vtkGetMacro(KeyToFillRatio, double);
151 
153 
162  vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
163  vtkGetMacro(KeyToHeadRatio, double);
165 
167 
172  vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
173  vtkGetMacro(KeyToBackRatio, double);
175 
177 
186  vtkSetMacro(KeyLightWarmth, double);
187  vtkGetMacro(KeyLightWarmth, double);
189 
190  vtkSetMacro(FillLightWarmth, double);
191  vtkGetMacro(FillLightWarmth, double);
192 
193  vtkSetMacro(HeadLightWarmth, double);
194  vtkGetMacro(HeadLightWarmth, double);
195 
196  vtkSetMacro(BackLightWarmth, double);
197  vtkGetMacro(BackLightWarmth, double);
198 
200 
201  vtkGetVectorMacro(KeyLightColor, double, 3);
202  vtkGetVectorMacro(FillLightColor, double, 3);
203  vtkGetVectorMacro(HeadLightColor, double, 3);
204  vtkGetVectorMacro(BackLightColor, double, 3);
206 
208 
211  vtkBooleanMacro(MaintainLuminance, int);
212  vtkGetMacro(MaintainLuminance, int);
213  vtkSetMacro(MaintainLuminance, int);
215 
217 
228  void SetKeyLightAngle(double elevation, double azimuth);
229  void SetKeyLightAngle(double angle[2])
230  { this->SetKeyLightAngle(angle[0], angle[1]); }
232 
233  void SetKeyLightElevation(double x)
234  { this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
235 
236  void SetKeyLightAzimuth(double x)
237  { this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
238 
239  vtkGetVectorMacro(KeyLightAngle, double, 2);
241  { double ang[2]; this->GetKeyLightAngle(ang); return ang[0]; }
242 
244  { double ang[2]; this->GetKeyLightAngle(ang); return ang[1]; }
245 
246  void SetFillLightAngle(double elevation, double azimuth);
247  void SetFillLightAngle(double angle[2])
248  { this->SetFillLightAngle(angle[0], angle[1]); }
249 
251  { this->SetFillLightAngle(x, this->FillLightAngle[1]); }
252 
253  void SetFillLightAzimuth(double x)
254  { this->SetFillLightAngle(this->FillLightAngle[0], x); }
255 
256  vtkGetVectorMacro(FillLightAngle, double, 2);
258  double ang[2]; this->GetFillLightAngle(ang); return ang[0]; }
259 
261  { double ang[2]; this->GetFillLightAngle(ang); return ang[1]; }
262 
263  void SetBackLightAngle(double elevation, double azimuth);
264  void SetBackLightAngle(double angle[2])
265  { this->SetBackLightAngle(angle[0], angle[1]); }
266 
268  { this->SetBackLightAngle(x, this->BackLightAngle[1]); }
269 
270  void SetBackLightAzimuth(double x)
271  { this->SetBackLightAngle(this->BackLightAngle[0], x); }
272 
273  vtkGetVectorMacro(BackLightAngle, double, 2);
275  { double ang[2]; this->GetBackLightAngle(ang); return ang[0]; }
276 
278  { double ang[2]; this->GetBackLightAngle(ang); return ang[1]; }
279 
281 
283  void AddLightsToRenderer(vtkRenderer *renderer);
284  void RemoveLightsFromRenderer(vtkRenderer *renderer);
286 
287  void DeepCopy(vtkLightKit *kit);
288 
289  void Modified();
290  void Update();
291 
293  static const char *GetStringFromType(int type);
294 
296  static const char *GetStringFromSubType(int type);
297 
301  static const char *GetShortStringFromSubType(int subtype);
302 
305  static LightKitSubType GetSubType(LightKitType type, int i);
306 
307 protected:
308  vtkLightKit();
309  ~vtkLightKit();
310 
311  void WarmthToRGBI(double w, double rgb[3], double& i);
312  void WarmthToRGB(double w, double rgb[3]);
313  void InitializeWarmthFunctions();
314  double WarmthToIntensity(double w);
315 
316 
321 
324  double KeyLightAngle[2];
325  double KeyLightColor[3];
326 
329  double FillLightAngle[2];
330  double FillLightColor[3];
331 
333  double BackLightColor[3];
334 
337 
338  double BackLightAngle[2];
339 
342  double HeadLightColor[3];
343 
345 
346  vtkPiecewiseFunction *WarmthFunction[4]; // r, g, b, perceptual length
347 
348 private:
349  vtkLightKit(const vtkLightKit&); // Not implemented.
350  void operator=(const vtkLightKit&); // Not implemented.
351 };
352 
353 #endif
void SetFillLightAngle(double angle[2])
Definition: vtkLightKit.h:247
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
abstract base class for most VTK objects
Definition: vtkObject.h:61
double KeyLightIntensity
Definition: vtkLightKit.h:317
double GetFillLightAzimuth()
Definition: vtkLightKit.h:260
#define VTK_DOUBLE_MAX
Definition: vtkType.h:141
Defines a 1D piecewise function.
vtkLight * BackLight0
Definition: vtkLightKit.h:335
double KeyToBackRatio
Definition: vtkLightKit.h:320
double GetBackLightAzimuth()
Definition: vtkLightKit.h:277
void SetBackLightAzimuth(double x)
Definition: vtkLightKit.h:270
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
double KeyToFillRatio
Definition: vtkLightKit.h:318
void SetBackLightElevation(double x)
Definition: vtkLightKit.h:267
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
abstract specification for renderers
Definition: vtkRenderer.h:63
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
virtual void Update()
a simple but quality lighting kit
Definition: vtkLightKit.h:104
vtkLight * KeyLight
Definition: vtkLightKit.h:322
void SetKeyLightAngle(double angle[2])
Definition: vtkLightKit.h:229
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
double KeyLightWarmth
Definition: vtkLightKit.h:323
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
GLubyte GLubyte GLubyte GLubyte w
Definition: vtkgl.h:12054
vtkLight * FillLight
Definition: vtkLightKit.h:327
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
double GetKeyLightElevation()
Definition: vtkLightKit.h:240
void SetKeyLightElevation(double x)
Definition: vtkLightKit.h:233
a virtual light for 3D rendering
Definition: vtkLight.h:60
void SetKeyLightAzimuth(double x)
Definition: vtkLightKit.h:236
double GetKeyLightAzimuth()
Definition: vtkLightKit.h:243
double GetBackLightElevation()
Definition: vtkLightKit.h:274
vtkLight * BackLight1
Definition: vtkLightKit.h:336
virtual void Modified()
int MaintainLuminance
Definition: vtkLightKit.h:344
void SetFillLightElevation(double x)
Definition: vtkLightKit.h:250
void SetBackLightAngle(double angle[2])
Definition: vtkLightKit.h:264
#define VTKRENDERINGCORE_EXPORT
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
static vtkObject * New()
double BackLightWarmth
Definition: vtkLightKit.h:332
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:414
double HeadLightWarmth
Definition: vtkLightKit.h:341
double FillLightWarmth
Definition: vtkLightKit.h:328
vtkLight * HeadLight
Definition: vtkLightKit.h:340
double KeyToHeadRatio
Definition: vtkLightKit.h:319
double GetFillLightElevation()
Definition: vtkLightKit.h:257
GLfloat angle
Definition: vtkgl.h:18174
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69
void SetFillLightAzimuth(double x)
Definition: vtkLightKit.h:253