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 vtkInformation;
49 class vtkRenderer;
50 class vtkMatrix4x4;
51 
52 #define VTK_LIGHT_TYPE_HEADLIGHT 1
53 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
54 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3
55 
56 class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
57 {
58 public:
59  vtkTypeMacro(vtkLight,vtkObject);
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
70  static vtkLight *New();
71 
78  virtual vtkLight *ShallowClone();
79 
86  virtual void Render(vtkRenderer *, int) {}
87 
89 
95  vtkSetVector3Macro(AmbientColor,double);
96  vtkGetVectorMacro(AmbientColor,double,3);
97  vtkSetVector3Macro(DiffuseColor,double);
98  vtkGetVectorMacro(DiffuseColor,double,3);
99  vtkSetVector3Macro(SpecularColor,double);
100  vtkGetVectorMacro(SpecularColor,double,3);
101  void SetColor(double, double, double);
102  void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
104 
106 
113  vtkSetVector3Macro(Position,double);
114  vtkGetVectorMacro(Position,double,3);
115  void SetPosition(const float *a) {this->SetPosition(a[0],a[1],a[2]);};
117 
119 
126  vtkSetVector3Macro(FocalPoint,double);
127  vtkGetVectorMacro(FocalPoint,double,3);
128  void SetFocalPoint(const float *a) {this->SetFocalPoint(a[0],a[1],a[2]);};
130 
132 
135  vtkSetMacro(Intensity,double);
136  vtkGetMacro(Intensity,double);
138 
140 
143  vtkSetMacro(Switch,vtkTypeBool);
144  vtkGetMacro(Switch,vtkTypeBool);
145  vtkBooleanMacro(Switch,vtkTypeBool);
147 
149 
152  vtkSetMacro(Positional,vtkTypeBool);
153  vtkGetMacro(Positional,vtkTypeBool);
154  vtkBooleanMacro(Positional,vtkTypeBool);
156 
158 
161  vtkSetClampMacro(Exponent,double,0.0,128.0);
162  vtkGetMacro(Exponent,double);
164 
166 
173  vtkSetMacro(ConeAngle,double);
174  vtkGetMacro(ConeAngle,double);
176 
178 
182  vtkSetVector3Macro(AttenuationValues,double);
183  vtkGetVectorMacro(AttenuationValues,double,3);
185 
187 
192  virtual void SetTransformMatrix(vtkMatrix4x4*);
193  vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
195 
197 
201  void GetTransformedPosition(double &a0, double &a1, double &a2);
202  void GetTransformedPosition(double a[3]);
203  double *GetTransformedPosition() VTK_SIZEHINT(3);
205 
207 
211  void GetTransformedFocalPoint(double &a0, double &a1, double &a2);
212  void GetTransformedFocalPoint(double a[3]);
213  double *GetTransformedFocalPoint() VTK_SIZEHINT(3);
215 
217 
223  void SetDirectionAngle(double elevation, double azimuth);
224  void SetDirectionAngle(const double ang[2]) {
225  this->SetDirectionAngle(ang[0], ang[1]); };
227 
231  void DeepCopy(vtkLight *light);
232 
234 
252  virtual void SetLightType(int);
253  vtkGetMacro(LightType, int);
254 
256  { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
258  { this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT); }
260  { this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT); }
262 
264 
267  int LightTypeIsHeadlight();
268  int LightTypeIsSceneLight();
269  int LightTypeIsCameraLight();
271 
273 
279  vtkSetMacro(ShadowAttenuation,float);
280  vtkGetMacro(ShadowAttenuation,float);
282 
284 
287  vtkGetObjectMacro(Information, vtkInformation);
288  virtual void SetInformation(vtkInformation*);
290 
291 protected:
292  vtkLight();
293  ~vtkLight() override;
294 
295  double FocalPoint[3];
296  double Position[3];
297  double Intensity;
298  double AmbientColor[3];
299  double DiffuseColor[3];
300  double SpecularColor[3];
303  double Exponent;
304  double ConeAngle;
305  double AttenuationValues[3];
307  double TransformedFocalPointReturn[3];
308  double TransformedPositionReturn[3];
311 
312  // Arbitrary extra information associated with this light.
314 
315 private:
316  vtkLight(const vtkLight&) = delete;
317  void operator=(const vtkLight&) = delete;
318 };
319 
320 #endif
double Exponent
Definition: vtkLight.h:303
vtkInformation * Information
Definition: vtkLight.h:313
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.
Store vtkAlgorithm input/output information.
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:306
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:54
abstract specification for renderers
Definition: vtkRenderer.h:57
double Intensity
Definition: vtkLight.h:297
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:255
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:53
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:52
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:102
int LightType
Definition: vtkLight.h:309
int vtkTypeBool
Definition: vtkABI.h:69
double ConeAngle
Definition: vtkLight.h:304
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:259
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkTypeBool Positional
Definition: vtkLight.h:302
a virtual light for 3D rendering
Definition: vtkLight.h:56
#define VTK_SIZEHINT(...)
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition: vtkLight.h:128
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:257
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:86
float ShadowAttenuation
Definition: vtkLight.h:310
void SetPosition(const float *a)
Set/Get the position of the light.
Definition: vtkLight.h:115
vtkTypeBool Switch
Definition: vtkLight.h:301