VTK  9.7.1
vtkLight.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
32 #ifndef vtkLight_h
33 #define vtkLight_h
34 
35 #include "vtkObject.h"
36 #include "vtkRenderingCoreModule.h" // For export macro
37 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
38 
39 /* need for virtual function */
40 VTK_ABI_NAMESPACE_BEGIN
41 class vtkInformation;
42 class vtkRenderer;
43 class vtkMatrix4x4;
44 
45 #define VTK_LIGHT_TYPE_HEADLIGHT 1
46 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
47 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3
48 
49 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkLight : public vtkObject
50 {
51 public:
52  vtkTypeMacro(vtkLight, vtkObject);
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
63  static vtkLight* New();
64 
71  virtual vtkLight* ShallowClone();
72 
79  virtual void Render(vtkRenderer*, int) {}
80 
82 
88  vtkSetVector3Macro(AmbientColor, double);
89  vtkGetVectorMacro(AmbientColor, double, 3);
90  vtkSetVector3Macro(DiffuseColor, double);
91  vtkGetVectorMacro(DiffuseColor, double, 3);
92  vtkSetVector3Macro(SpecularColor, double);
93  vtkGetVectorMacro(SpecularColor, double, 3);
94  void SetColor(double, double, double);
95  void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
97 
99 
106  vtkSetVector3Macro(Position, double);
107  vtkGetVectorMacro(Position, double, 3);
108  void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
110 
112 
119  vtkSetVector3Macro(FocalPoint, double);
120  vtkGetVectorMacro(FocalPoint, double, 3);
121  void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
123 
125 
128  vtkSetMacro(Intensity, double);
129  vtkGetMacro(Intensity, double);
131 
133 
136  vtkSetMacro(Switch, vtkTypeBool);
137  vtkGetMacro(Switch, vtkTypeBool);
138  vtkBooleanMacro(Switch, vtkTypeBool);
140 
142 
145  vtkSetMacro(Positional, vtkTypeBool);
146  vtkGetMacro(Positional, vtkTypeBool);
147  vtkBooleanMacro(Positional, vtkTypeBool);
149 
151 
154  vtkSetClampMacro(Exponent, double, 0.0, 128.0);
155  vtkGetMacro(Exponent, double);
157 
159 
166  vtkSetMacro(ConeAngle, double);
167  vtkGetMacro(ConeAngle, double);
169 
171 
175  vtkSetVector3Macro(AttenuationValues, double);
176  vtkGetVectorMacro(AttenuationValues, double, 3);
178 
180 
185  virtual void SetTransformMatrix(vtkMatrix4x4*);
186  vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
188 
190 
194  void GetTransformedPosition(double& x, double& y, double& z);
195  void GetTransformedPosition(double a[3]);
196  double* GetTransformedPosition() VTK_SIZEHINT(3);
198 
200 
204  void GetTransformedFocalPoint(double& x, double& y, double& z);
205  void GetTransformedFocalPoint(double a[3]);
206  double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
208 
212  void TransformPoint(double a[3], double b[3]);
213 
217  void TransformVector(double a[3], double b[3]);
218 
220 
226  void SetDirectionAngle(double elevation, double azimuth);
227  void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
229 
233  void DeepCopy(vtkLight* light);
234 
236 
254  virtual void SetLightType(int);
255  vtkGetMacro(LightType, int);
256 
257  void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
258  void SetLightTypeToSceneLight() { this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT); }
261 
263 
266  int LightTypeIsHeadlight();
267  int LightTypeIsSceneLight();
268  int LightTypeIsCameraLight();
270 
272 
278  vtkSetMacro(ShadowAttenuation, float);
279  vtkGetMacro(ShadowAttenuation, float);
281 
283 
286  vtkGetObjectMacro(Information, vtkInformation);
287  virtual void SetInformation(vtkInformation*);
289 
290 protected:
291  vtkLight();
292  ~vtkLight() override;
293 
294  double FocalPoint[3];
295  double Position[3];
296  double Intensity;
297  double AmbientColor[3];
298  double DiffuseColor[3];
299  double SpecularColor[3];
302  double Exponent;
303  double ConeAngle;
304  double AttenuationValues[3];
306  double TransformedFocalPointReturn[3];
307  double TransformedPositionReturn[3];
310 
311  // Arbitrary extra information associated with this light.
313 
314 private:
315  vtkLight(const vtkLight&) = delete;
316  void operator=(const vtkLight&) = delete;
317 };
318 
319 VTK_ABI_NAMESPACE_END
320 #endif
double Exponent
Definition: vtkLight.h:302
vtkInformation * Information
Definition: vtkLight.h:312
abstract base class for most VTK objects
Definition: vtkObject.h:52
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
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:305
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:47
abstract specification for renderers
Definition: vtkRenderer.h:63
double Intensity
Definition: vtkLight.h:296
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:257
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:46
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:45
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:95
int LightType
Definition: vtkLight.h:308
int vtkTypeBool
Definition: vtkABI.h:64
double ConeAngle
Definition: vtkLight.h:303
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:259
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkTypeBool Positional
Definition: vtkLight.h:301
a virtual light for 3D rendering
Definition: vtkLight.h:49
#define VTK_SIZEHINT(...)
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition: vtkLight.h:121
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition: vtkLight.h:227
#define VTK_MARSHALAUTO
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:258
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:79
float ShadowAttenuation
Definition: vtkLight.h:309
void SetPosition(const float *a)
Set/Get the position of the light.
Definition: vtkLight.h:108
vtkTypeBool Switch
Definition: vtkLight.h:300