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 vtkInformation;
55 class vtkRenderer;
56 class vtkMatrix4x4;
57 
58 #define VTK_LIGHT_TYPE_HEADLIGHT 1
59 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
60 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3
61 
62 class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
63 {
64 public:
65  vtkTypeMacro(vtkLight,vtkObject);
66  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
76  static vtkLight *New();
77 
84  virtual vtkLight *ShallowClone();
85 
92  virtual void Render(vtkRenderer *, int) {}
93 
95 
101  vtkSetVector3Macro(AmbientColor,double);
102  vtkGetVectorMacro(AmbientColor,double,3);
103  vtkSetVector3Macro(DiffuseColor,double);
104  vtkGetVectorMacro(DiffuseColor,double,3);
105  vtkSetVector3Macro(SpecularColor,double);
106  vtkGetVectorMacro(SpecularColor,double,3);
107  void SetColor(double, double, double);
108  void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
110 
112 
119  vtkSetVector3Macro(Position,double);
120  vtkGetVectorMacro(Position,double,3);
121  void SetPosition(const float *a) {this->SetPosition(a[0],a[1],a[2]);};
123 
125 
132  vtkSetVector3Macro(FocalPoint,double);
133  vtkGetVectorMacro(FocalPoint,double,3);
134  void SetFocalPoint(const float *a) {this->SetFocalPoint(a[0],a[1],a[2]);};
136 
138 
141  vtkSetMacro(Intensity,double);
142  vtkGetMacro(Intensity,double);
144 
146 
149  vtkSetMacro(Switch,vtkTypeBool);
150  vtkGetMacro(Switch,vtkTypeBool);
151  vtkBooleanMacro(Switch,vtkTypeBool);
153 
155 
158  vtkSetMacro(Positional,vtkTypeBool);
159  vtkGetMacro(Positional,vtkTypeBool);
160  vtkBooleanMacro(Positional,vtkTypeBool);
162 
164 
167  vtkSetClampMacro(Exponent,double,0.0,128.0);
168  vtkGetMacro(Exponent,double);
170 
172 
179  vtkSetMacro(ConeAngle,double);
180  vtkGetMacro(ConeAngle,double);
182 
184 
188  vtkSetVector3Macro(AttenuationValues,double);
189  vtkGetVectorMacro(AttenuationValues,double,3);
191 
193 
198  virtual void SetTransformMatrix(vtkMatrix4x4*);
199  vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
201 
203 
207  void GetTransformedPosition(double &a0, double &a1, double &a2);
208  void GetTransformedPosition(double a[3]);
209  double *GetTransformedPosition() VTK_SIZEHINT(3);
211 
213 
217  void GetTransformedFocalPoint(double &a0, double &a1, double &a2);
218  void GetTransformedFocalPoint(double a[3]);
219  double *GetTransformedFocalPoint() VTK_SIZEHINT(3);
221 
223 
229  void SetDirectionAngle(double elevation, double azimuth);
230  void SetDirectionAngle(const double ang[2]) {
231  this->SetDirectionAngle(ang[0], ang[1]); };
233 
237  void DeepCopy(vtkLight *light);
238 
240 
258  virtual void SetLightType(int);
259  vtkGetMacro(LightType, int);
260 
262  { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
264  { this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT); }
266  { this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT); }
268 
270 
273  int LightTypeIsHeadlight();
274  int LightTypeIsSceneLight();
275  int LightTypeIsCameraLight();
277 
279 
285  vtkSetMacro(ShadowAttenuation,float);
286  vtkGetMacro(ShadowAttenuation,float);
288 
290 
293  vtkGetObjectMacro(Information, vtkInformation);
294  virtual void SetInformation(vtkInformation*);
296 
297 protected:
298  vtkLight();
299  ~vtkLight() override;
300 
301  double FocalPoint[3];
302  double Position[3];
303  double Intensity;
304  double AmbientColor[3];
305  double DiffuseColor[3];
306  double SpecularColor[3];
309  double Exponent;
310  double ConeAngle;
311  double AttenuationValues[3];
313  double TransformedFocalPointReturn[3];
314  double TransformedPositionReturn[3];
317 
318  // Arbitrary extra information associated with this light.
320 
321 private:
322  vtkLight(const vtkLight&) = delete;
323  void operator=(const vtkLight&) = delete;
324 };
325 
326 #endif
double Exponent
Definition: vtkLight.h:309
vtkInformation * Information
Definition: vtkLight.h:319
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.
Store vtkAlgorithm input/output information.
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:312
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:60
abstract specification for renderers
Definition: vtkRenderer.h:63
double Intensity
Definition: vtkLight.h:303
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:261
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:59
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:58
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:108
int LightType
Definition: vtkLight.h:315
int vtkTypeBool
Definition: vtkABI.h:69
double ConeAngle
Definition: vtkLight.h:310
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:265
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkTypeBool Positional
Definition: vtkLight.h:308
a virtual light for 3D rendering
Definition: vtkLight.h:62
#define VTK_SIZEHINT(...)
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition: vtkLight.h:134
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition: vtkLight.h:230
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:263
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:92
float ShadowAttenuation
Definition: vtkLight.h:316
void SetPosition(const float *a)
Set/Get the position of the light.
Definition: vtkLight.h:121
vtkTypeBool Switch
Definition: vtkLight.h:307