VTK  9.3.0
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
41#ifndef vtkLight_h
42#define vtkLight_h
43
44#include "vtkObject.h"
45#include "vtkRenderingCoreModule.h" // For export macro
46
47/* need for virtual function */
48VTK_ABI_NAMESPACE_BEGIN
49class vtkInformation;
50class vtkRenderer;
51class vtkMatrix4x4;
52
53#define VTK_LIGHT_TYPE_HEADLIGHT 1
54#define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
55#define VTK_LIGHT_TYPE_SCENE_LIGHT 3
56
57class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
58{
59public:
60 vtkTypeMacro(vtkLight, vtkObject);
61 void PrintSelf(ostream& os, vtkIndent indent) override;
62
71 static vtkLight* New();
72
80
87 virtual void Render(vtkRenderer*, int) {}
88
90
96 vtkSetVector3Macro(AmbientColor, double);
97 vtkGetVectorMacro(AmbientColor, double, 3);
98 vtkSetVector3Macro(DiffuseColor, double);
99 vtkGetVectorMacro(DiffuseColor, double, 3);
100 vtkSetVector3Macro(SpecularColor, double);
101 vtkGetVectorMacro(SpecularColor, double, 3);
102 void SetColor(double, double, double);
103 void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
105
107
114 vtkSetVector3Macro(Position, double);
115 vtkGetVectorMacro(Position, double, 3);
116 void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
118
120
127 vtkSetVector3Macro(FocalPoint, double);
128 vtkGetVectorMacro(FocalPoint, double, 3);
129 void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
131
133
136 vtkSetMacro(Intensity, double);
137 vtkGetMacro(Intensity, double);
139
141
144 vtkSetMacro(Switch, vtkTypeBool);
145 vtkGetMacro(Switch, vtkTypeBool);
146 vtkBooleanMacro(Switch, vtkTypeBool);
148
150
153 vtkSetMacro(Positional, vtkTypeBool);
154 vtkGetMacro(Positional, vtkTypeBool);
155 vtkBooleanMacro(Positional, vtkTypeBool);
157
159
162 vtkSetClampMacro(Exponent, double, 0.0, 128.0);
163 vtkGetMacro(Exponent, double);
165
167
174 vtkSetMacro(ConeAngle, double);
175 vtkGetMacro(ConeAngle, double);
177
179
183 vtkSetVector3Macro(AttenuationValues, double);
184 vtkGetVectorMacro(AttenuationValues, double, 3);
186
188
194 vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
196
198
202 void GetTransformedPosition(double& x, double& y, double& z);
203 void GetTransformedPosition(double a[3]);
206
208
212 void GetTransformedFocalPoint(double& x, double& y, double& z);
213 void GetTransformedFocalPoint(double a[3]);
214 double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
216
220 void TransformPoint(double a[3], double b[3]);
221
225 void TransformVector(double a[3], double b[3]);
226
228
234 void SetDirectionAngle(double elevation, double azimuth);
235 void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
237
241 void DeepCopy(vtkLight* light);
242
244
262 virtual void SetLightType(int);
263 vtkGetMacro(LightType, int);
264
265 void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
269
271
278
280
286 vtkSetMacro(ShadowAttenuation, float);
287 vtkGetMacro(ShadowAttenuation, float);
289
291
294 vtkGetObjectMacro(Information, vtkInformation);
297
298protected:
300 ~vtkLight() override;
301
302 double FocalPoint[3];
303 double Position[3];
304 double Intensity;
305 double AmbientColor[3];
306 double DiffuseColor[3];
307 double SpecularColor[3];
310 double Exponent;
311 double ConeAngle;
312 double AttenuationValues[3];
314 double TransformedFocalPointReturn[3];
315 double TransformedPositionReturn[3];
318
319 // Arbitrary extra information associated with this light.
321
322private:
323 vtkLight(const vtkLight&) = delete;
324 void operator=(const vtkLight&) = delete;
325};
326
327VTK_ABI_NAMESPACE_END
328#endif
a simple class to control print indentation
Definition vtkIndent.h:38
Store vtkAlgorithm input/output information.
a virtual light for 3D rendering
Definition vtkLight.h:58
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition vtkLight.h:235
int LightTypeIsHeadlight()
Query the type of the light.
vtkTypeBool Switch
Definition vtkLight.h:308
vtkTypeBool Positional
Definition vtkLight.h:309
float ShadowAttenuation
Definition vtkLight.h:317
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition vtkLight.h:265
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:304
double ConeAngle
Definition vtkLight.h:311
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition vtkLight.h:129
void SetColor(const double a[3])
Set/Get the color of the light.
Definition vtkLight.h:103
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.
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:116
vtkInformation * Information
Definition vtkLight.h:320
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:266
static vtkLight * New()
Create a light with the focal point at the origin and its position set to (0,0,1).
vtkMatrix4x4 * TransformMatrix
Definition vtkLight.h:313
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition vtkLight.h:267
int LightType
Definition vtkLight.h:316
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition vtkLight.h:87
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).
double Exponent
Definition vtkLight.h:310
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
abstract base class for most VTK objects
Definition vtkObject.h:58
abstract specification for renderers
Definition vtkRenderer.h:68
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition vtkLight.h:55
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition vtkLight.h:54
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition vtkLight.h:53
#define VTK_SIZEHINT(...)