VTK
vtkLight.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLight.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 =========================================================================*/
47 #ifndef vtkLight_h
48 #define vtkLight_h
49 
50 #include "vtkRenderingCoreModule.h" // For export macro
51 #include "vtkObject.h"
52 
53 /* need for virtual function */
54 class vtkRenderer;
55 class vtkMatrix4x4;
56 
57 #define VTK_LIGHT_TYPE_HEADLIGHT 1
58 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
59 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3
60 
61 class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
62 {
63 public:
64  vtkTypeMacro(vtkLight,vtkObject);
65  void PrintSelf(ostream& os, vtkIndent indent);
66 
75  static vtkLight *New();
76 
83  virtual vtkLight *ShallowClone();
84 
91  virtual void Render(vtkRenderer *, int) {}
92 
94 
100  vtkSetVector3Macro(AmbientColor,double);
101  vtkGetVectorMacro(AmbientColor,double,3);
102  vtkSetVector3Macro(DiffuseColor,double);
103  vtkGetVectorMacro(DiffuseColor,double,3);
104  vtkSetVector3Macro(SpecularColor,double);
105  vtkGetVectorMacro(SpecularColor,double,3);
106  void SetColor(double, double, double);
107  void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
109 
111 
118  vtkSetVector3Macro(Position,double);
119  vtkGetVectorMacro(Position,double,3);
120  void SetPosition(const float *a) {this->SetPosition(a[0],a[1],a[2]);};
122 
124 
131  vtkSetVector3Macro(FocalPoint,double);
132  vtkGetVectorMacro(FocalPoint,double,3);
133  void SetFocalPoint(const float *a) {this->SetFocalPoint(a[0],a[1],a[2]);};
135 
137 
140  vtkSetMacro(Intensity,double);
141  vtkGetMacro(Intensity,double);
143 
145 
148  vtkSetMacro(Switch,int);
149  vtkGetMacro(Switch,int);
150  vtkBooleanMacro(Switch,int);
152 
154 
157  vtkSetMacro(Positional,int);
158  vtkGetMacro(Positional,int);
159  vtkBooleanMacro(Positional,int);
161 
163 
166  vtkSetClampMacro(Exponent,double,0.0,128.0);
167  vtkGetMacro(Exponent,double);
169 
171 
178  vtkSetMacro(ConeAngle,double);
179  vtkGetMacro(ConeAngle,double);
181 
183 
187  vtkSetVector3Macro(AttenuationValues,double);
188  vtkGetVectorMacro(AttenuationValues,double,3);
190 
192 
197  virtual void SetTransformMatrix(vtkMatrix4x4*);
198  vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
200 
202 
206  void GetTransformedPosition(double &a0, double &a1, double &a2);
207  void GetTransformedPosition(double a[3]);
208  double *GetTransformedPosition();
210 
212 
216  void GetTransformedFocalPoint(double &a0, double &a1, double &a2);
217  void GetTransformedFocalPoint(double a[3]);
218  double *GetTransformedFocalPoint();
220 
222 
228  void SetDirectionAngle(double elevation, double azimuth);
229  void SetDirectionAngle(const double ang[2]) {
230  this->SetDirectionAngle(ang[0], ang[1]); };
232 
236  void DeepCopy(vtkLight *light);
237 
239 
256  vtkSetMacro(LightType, int);
257  vtkGetMacro(LightType, int);
259  {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);}
261  {
262  this->SetTransformMatrix(NULL);
263  this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT);
264  }
266  {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);}
268 
270 
273  int LightTypeIsHeadlight();
274  int LightTypeIsSceneLight();
275  int LightTypeIsCameraLight();
277 
278  void ReadSelf(istream& is);
279  void WriteSelf(ostream& os);
280 
282 
288  vtkSetMacro(ShadowAttenuation,float);
289  vtkGetMacro(ShadowAttenuation,float);
291 
292 
293 protected:
294  vtkLight();
295  ~vtkLight();
296 
297  double FocalPoint[3];
298  double Position[3];
299  double Intensity;
300  double AmbientColor[3];
301  double DiffuseColor[3];
302  double SpecularColor[3];
303  int Switch;
305  double Exponent;
306  double ConeAngle;
307  double AttenuationValues[3];
309  double TransformedFocalPointReturn[3];
310  double TransformedPositionReturn[3];
313 
314 private:
315  vtkLight(const vtkLight&) VTK_DELETE_FUNCTION;
316  void operator=(const vtkLight&) VTK_DELETE_FUNCTION;
317 };
318 
319 #endif
double Exponent
Definition: vtkLight.h:305
abstract base class for most VTK objects
Definition: vtkObject.h:59
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:308
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:59
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
abstract specification for renderers
Definition: vtkRenderer.h:63
double Intensity
Definition: vtkLight.h:299
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:258
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:58
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:57
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:107
int LightType
Definition: vtkLight.h:311
double ConeAngle
Definition: vtkLight.h:306
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:265
a simple class to control print indentation
Definition: vtkIndent.h:39
a virtual light for 3D rendering
Definition: vtkLight.h:61
int Positional
Definition: vtkLight.h:304
int Switch
Definition: vtkLight.h:303
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition: vtkLight.h:133
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition: vtkLight.h:229
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...
void SetLightTypeToSceneLight()
Set/Get the type of the light.
Definition: vtkLight.h:260
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:91
float ShadowAttenuation
Definition: vtkLight.h:312
void SetPosition(const float *a)
Set/Get the position of the light.
Definition: vtkLight.h:120