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 =========================================================================*/
41 #ifndef vtkLight_h
42 #define vtkLight_h
43 
44 #include "vtkRenderingCoreModule.h" // For export macro
45 #include "vtkObject.h"
46 
47 /* need for virtual function */
48 class vtkRenderer;
49 class vtkMatrix4x4;
50 
51 #define VTK_LIGHT_TYPE_HEADLIGHT 1
52 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
53 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3
54 
55 class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
56 {
57 public:
58  vtkTypeMacro(vtkLight,vtkObject);
59  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
60 
69  static vtkLight *New();
70 
77  virtual vtkLight *ShallowClone();
78 
85  virtual void Render(vtkRenderer *, int) {}
86 
88 
94  vtkSetVector3Macro(AmbientColor,double);
95  vtkGetVectorMacro(AmbientColor,double,3);
96  vtkSetVector3Macro(DiffuseColor,double);
97  vtkGetVectorMacro(DiffuseColor,double,3);
98  vtkSetVector3Macro(SpecularColor,double);
99  vtkGetVectorMacro(SpecularColor,double,3);
100  void SetColor(double, double, double);
101  void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
103 
105 
112  vtkSetVector3Macro(Position,double);
113  vtkGetVectorMacro(Position,double,3);
114  void SetPosition(const float *a) {this->SetPosition(a[0],a[1],a[2]);};
116 
118 
125  vtkSetVector3Macro(FocalPoint,double);
126  vtkGetVectorMacro(FocalPoint,double,3);
127  void SetFocalPoint(const float *a) {this->SetFocalPoint(a[0],a[1],a[2]);};
129 
131 
134  vtkSetMacro(Intensity,double);
135  vtkGetMacro(Intensity,double);
137 
139 
142  vtkSetMacro(Switch,int);
143  vtkGetMacro(Switch,int);
144  vtkBooleanMacro(Switch,int);
146 
148 
151  vtkSetMacro(Positional,int);
152  vtkGetMacro(Positional,int);
153  vtkBooleanMacro(Positional,int);
155 
157 
160  vtkSetClampMacro(Exponent,double,0.0,128.0);
161  vtkGetMacro(Exponent,double);
163 
165 
172  vtkSetMacro(ConeAngle,double);
173  vtkGetMacro(ConeAngle,double);
175 
177 
181  vtkSetVector3Macro(AttenuationValues,double);
182  vtkGetVectorMacro(AttenuationValues,double,3);
184 
186 
191  virtual void SetTransformMatrix(vtkMatrix4x4*);
192  vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
194 
196 
200  void GetTransformedPosition(double &a0, double &a1, double &a2);
201  void GetTransformedPosition(double a[3]);
202  double *GetTransformedPosition();
204 
206 
210  void GetTransformedFocalPoint(double &a0, double &a1, double &a2);
211  void GetTransformedFocalPoint(double a[3]);
212  double *GetTransformedFocalPoint();
214 
216 
222  void SetDirectionAngle(double elevation, double azimuth);
223  void SetDirectionAngle(const double ang[2]) {
224  this->SetDirectionAngle(ang[0], ang[1]); };
226 
230  void DeepCopy(vtkLight *light);
231 
233 
250  vtkSetMacro(LightType, int);
251  vtkGetMacro(LightType, int);
253  {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);}
255  {
256  this->SetTransformMatrix(NULL);
257  this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT);
258  }
260  {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);}
262 
264 
267  int LightTypeIsHeadlight();
268  int LightTypeIsSceneLight();
269  int LightTypeIsCameraLight();
271 
272  void ReadSelf(istream& is);
273  void WriteSelf(ostream& os);
274 
276 
282  vtkSetMacro(ShadowAttenuation,float);
283  vtkGetMacro(ShadowAttenuation,float);
285 
286 
287 protected:
288  vtkLight();
289  ~vtkLight() VTK_OVERRIDE;
290 
291  double FocalPoint[3];
292  double Position[3];
293  double Intensity;
294  double AmbientColor[3];
295  double DiffuseColor[3];
296  double SpecularColor[3];
297  int Switch;
299  double Exponent;
300  double ConeAngle;
301  double AttenuationValues[3];
303  double TransformedFocalPointReturn[3];
304  double TransformedPositionReturn[3];
307 
308 private:
309  vtkLight(const vtkLight&) VTK_DELETE_FUNCTION;
310  void operator=(const vtkLight&) VTK_DELETE_FUNCTION;
311 };
312 
313 #endif
double Exponent
Definition: vtkLight.h:299
abstract base class for most VTK objects
Definition: vtkObject.h:53
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:302
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:53
abstract specification for renderers
Definition: vtkRenderer.h:57
double Intensity
Definition: vtkLight.h:293
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:252
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:52
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:51
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:101
int LightType
Definition: vtkLight.h:305
double ConeAngle
Definition: vtkLight.h:300
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:259
a simple class to control print indentation
Definition: vtkIndent.h:33
a virtual light for 3D rendering
Definition: vtkLight.h:55
int Positional
Definition: vtkLight.h:298
int Switch
Definition: vtkLight.h:297
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:127
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition: vtkLight.h:223
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:254
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:85
float ShadowAttenuation
Definition: vtkLight.h:306
void SetPosition(const float *a)
Set/Get the position of the light.
Definition: vtkLight.h:114