VTK  9.2.6
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 =========================================================================*/
53 #ifndef vtkLight_h
54 #define vtkLight_h
55 
56 #include "vtkObject.h"
57 #include "vtkRenderingCoreModule.h" // For export macro
58 
59 /* need for virtual function */
60 class vtkInformation;
61 class vtkRenderer;
62 class vtkMatrix4x4;
63 
64 #define VTK_LIGHT_TYPE_HEADLIGHT 1
65 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
66 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3
67 
68 class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
69 {
70 public:
71  vtkTypeMacro(vtkLight, vtkObject);
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
82  static vtkLight* New();
83 
90  virtual vtkLight* ShallowClone();
91 
98  virtual void Render(vtkRenderer*, int) {}
99 
101 
107  vtkSetVector3Macro(AmbientColor, double);
108  vtkGetVectorMacro(AmbientColor, double, 3);
109  vtkSetVector3Macro(DiffuseColor, double);
110  vtkGetVectorMacro(DiffuseColor, double, 3);
111  vtkSetVector3Macro(SpecularColor, double);
112  vtkGetVectorMacro(SpecularColor, double, 3);
113  void SetColor(double, double, double);
114  void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
116 
118 
125  vtkSetVector3Macro(Position, double);
126  vtkGetVectorMacro(Position, double, 3);
127  void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
129 
131 
138  vtkSetVector3Macro(FocalPoint, double);
139  vtkGetVectorMacro(FocalPoint, double, 3);
140  void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
142 
144 
147  vtkSetMacro(Intensity, double);
148  vtkGetMacro(Intensity, double);
150 
152 
155  vtkSetMacro(Switch, vtkTypeBool);
156  vtkGetMacro(Switch, vtkTypeBool);
157  vtkBooleanMacro(Switch, vtkTypeBool);
159 
161 
164  vtkSetMacro(Positional, vtkTypeBool);
165  vtkGetMacro(Positional, vtkTypeBool);
166  vtkBooleanMacro(Positional, vtkTypeBool);
168 
170 
173  vtkSetClampMacro(Exponent, double, 0.0, 128.0);
174  vtkGetMacro(Exponent, double);
176 
178 
185  vtkSetMacro(ConeAngle, double);
186  vtkGetMacro(ConeAngle, double);
188 
190 
194  vtkSetVector3Macro(AttenuationValues, double);
195  vtkGetVectorMacro(AttenuationValues, double, 3);
197 
199 
205  vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
207 
209 
213  void GetTransformedPosition(double& x, double& y, double& z);
214  void GetTransformedPosition(double a[3]);
217 
219 
223  void GetTransformedFocalPoint(double& x, double& y, double& z);
224  void GetTransformedFocalPoint(double a[3]);
225  double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
227 
231  void TransformPoint(double a[3], double b[3]);
232 
236  void TransformVector(double a[3], double b[3]);
237 
239 
245  void SetDirectionAngle(double elevation, double azimuth);
246  void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
248 
252  void DeepCopy(vtkLight* light);
253 
255 
273  virtual void SetLightType(int);
274  vtkGetMacro(LightType, int);
275 
276  void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
277  void SetLightTypeToSceneLight() { this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT); }
280 
282 
289 
291 
297  vtkSetMacro(ShadowAttenuation, float);
298  vtkGetMacro(ShadowAttenuation, float);
300 
302 
305  vtkGetObjectMacro(Information, vtkInformation);
308 
309 protected:
311  ~vtkLight() override;
312 
313  double FocalPoint[3];
314  double Position[3];
315  double Intensity;
316  double AmbientColor[3];
317  double DiffuseColor[3];
318  double SpecularColor[3];
321  double Exponent;
322  double ConeAngle;
323  double AttenuationValues[3];
325  double TransformedFocalPointReturn[3];
326  double TransformedPositionReturn[3];
329 
330  // Arbitrary extra information associated with this light.
332 
333 private:
334  vtkLight(const vtkLight&) = delete;
335  void operator=(const vtkLight&) = delete;
336 };
337 
338 #endif
a simple class to control print indentation
Definition: vtkIndent.h:49
Store vtkAlgorithm input/output information.
a virtual light for 3D rendering
Definition: vtkLight.h:69
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition: vtkLight.h:246
int LightTypeIsHeadlight()
Query the type of the light.
static vtkLight * New()
Create a light with the focal point at the origin and its position set to (0,0,1).
double * GetTransformedPosition()
Get the position of the light, modified by the transformation matrix (if it exists).
vtkTypeBool Switch
Definition: vtkLight.h:319
vtkTypeBool Positional
Definition: vtkLight.h:320
float ShadowAttenuation
Definition: vtkLight.h:328
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:276
virtual void SetLightType(int)
Set/Get the type of the light.
virtual void SetTransformMatrix(vtkMatrix4x4 *)
Set/Get the light's transformation matrix.
double Intensity
Definition: vtkLight.h:315
double ConeAngle
Definition: vtkLight.h:322
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition: vtkLight.h:140
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:114
void GetTransformedPosition(double &x, double &y, double &z)
Get the position of the light, modified by the transformation matrix (if it exists).
~vtkLight() override
int LightTypeIsSceneLight()
Query the type of the light.
void SetPosition(const float *a)
Set/Get the position of the light.
Definition: vtkLight.h:127
vtkInformation * Information
Definition: vtkLight.h:331
virtual void SetInformation(vtkInformation *)
Set/Get the information object associated with the light.
void SetLightTypeToSceneLight()
Set/Get the type of the light.
Definition: vtkLight.h:277
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:324
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:278
int LightType
Definition: vtkLight.h:327
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:98
void DeepCopy(vtkLight *light)
Perform deep copy of this light.
virtual vtkLight * ShallowClone()
Create a new light object with the same light parameters than the current object (any ivar from the s...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetColor(double, double, double)
Set/Get the color of the light.
void GetTransformedPosition(double a[3])
Get the position of the light, modified by the transformation matrix (if it exists).
double Exponent
Definition: vtkLight.h:321
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:51
abstract base class for most VTK objects
Definition: vtkObject.h:72
abstract specification for renderers
Definition: vtkRenderer.h:82
@ Switch
Definition: vtkX3D.h:59
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:66
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:65
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:64
#define VTK_SIZEHINT(...)