VTK  9.4.20251203
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 */
40VTK_ABI_NAMESPACE_BEGIN
41class vtkInformation;
42class vtkRenderer;
43class 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
49class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkLight : public vtkObject
50{
51public:
52 vtkTypeMacro(vtkLight, vtkObject);
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
63 static vtkLight* New();
64
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
186 vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
188
190
194 void GetTransformedPosition(double& x, double& y, double& z);
195 void GetTransformedPosition(double a[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); }
261
263
270
272
278 vtkSetMacro(ShadowAttenuation, float);
279 vtkGetMacro(ShadowAttenuation, float);
281
283
287 vtkGetObjectMacro(Information, vtkInformation);
289 virtual void SetInformation(vtkInformation*);
291
292protected:
294 ~vtkLight() override;
295
296 double FocalPoint[3];
297 double Position[3];
298 double Intensity;
299 double AmbientColor[3];
300 double DiffuseColor[3];
301 double SpecularColor[3];
303 vtkTypeBool Positional;
304 double Exponent;
305 double ConeAngle;
306 double AttenuationValues[3];
307 vtkMatrix4x4* TransformMatrix;
308 double TransformedFocalPointReturn[3];
309 double TransformedPositionReturn[3];
310 int LightType;
311 float ShadowAttenuation;
312
313 // Arbitrary extra information associated with this light.
314 vtkInformation* Information;
315
316private:
317 vtkLight(const vtkLight&) = delete;
318 void operator=(const vtkLight&) = delete;
319};
320
321VTK_ABI_NAMESPACE_END
322#endif
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
a virtual light for 3D rendering
Definition vtkLight.h:50
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition vtkLight.h:227
int LightTypeIsHeadlight()
Query the type of the light.
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition vtkLight.h:257
virtual void SetLightType(int)
Set/Get the type of the light.
virtual void SetTransformMatrix(vtkMatrix4x4 *)
Set/Get the light's transformation matrix.
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition vtkLight.h:121
void SetColor(const double a[3])
Set/Get the color of the light.
Definition vtkLight.h:95
void GetTransformedPosition(double &x, double &y, double &z)
Get the position of the light, modified by the transformation matrix (if it exists).
int LightTypeIsSceneLight()
Query the type of the light.
double * GetTransformedPosition()
Get the position of the light, modified by the transformation matrix (if it exists).
virtual vtkLight * ShallowClone()
Create a new light object with the same light parameters than the current object (any ivar from the s...
void SetPosition(const float *a)
Set/Get the position of the light.
Definition vtkLight.h:108
void SetLightTypeToSceneLight()
Set/Get the type of the light.
Definition vtkLight.h:258
static vtkLight * New()
Create a light with the focal point at the origin and its position set to (0,0,1).
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition vtkLight.h:259
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition vtkLight.h:79
void DeepCopy(vtkLight *light)
Perform deep copy of this light.
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).
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
abstract base class for most VTK objects
Definition vtkObject.h:53
abstract specification for renderers
Definition vtkRenderer.h:63
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition vtkLight.h:47
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition vtkLight.h:46
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition vtkLight.h:45
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)