VTK  9.6.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
31
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]);
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
261
263
270
272
278 vtkSetMacro(ShadowAttenuation, float);
279 vtkGetMacro(ShadowAttenuation, float);
281
283
286 vtkGetObjectMacro(Information, vtkInformation);
289
290protected:
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;
310
311 // Arbitrary extra information associated with this light.
313
314private:
315 vtkLight(const vtkLight&) = delete;
316 void operator=(const vtkLight&) = delete;
317};
318
319VTK_ABI_NAMESPACE_END
320#endif
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
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.
double FocalPoint[3]
Definition vtkLight.h:294
vtkTypeBool Switch
Definition vtkLight.h:300
vtkTypeBool Positional
Definition vtkLight.h:301
float ShadowAttenuation
Definition vtkLight.h:309
double AttenuationValues[3]
Definition vtkLight.h:304
double TransformedFocalPointReturn[3]
Definition vtkLight.h:306
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.
double Intensity
Definition vtkLight.h:296
double ConeAngle
Definition vtkLight.h:303
double Position[3]
Definition vtkLight.h:295
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition vtkLight.h:121
double TransformedPositionReturn[3]
Definition vtkLight.h:307
double DiffuseColor[3]
Definition vtkLight.h:298
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).
~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).
double SpecularColor[3]
Definition vtkLight.h:299
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 GetTransformedFocalPoint(double &x, double &y, double &z)
Get the focal point of the light, modified by the transformation matrix (if it exists).
void TransformVector(double a[3], double b[3])
Use transform matrix to transform vector (if it exists).
vtkInformation * Information
Definition vtkLight.h:312
void SetDirectionAngle(double elevation, double azimuth)
Set the position and focal point of a light based on elevation and azimuth.
virtual void SetInformation(vtkInformation *)
Set/Get the information object associated with the light.
double AmbientColor[3]
Definition vtkLight.h:297
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).
vtkMatrix4x4 * TransformMatrix
Definition vtkLight.h:305
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition vtkLight.h:259
int LightType
Definition vtkLight.h:308
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition vtkLight.h:79
void DeepCopy(vtkLight *light)
Perform deep copy of this light.
void TransformPoint(double a[3], double b[3])
Use transform matrix to transform point (if it exists).
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:302
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
abstract specification for renderers
Definition vtkRenderer.h:64
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_MARSHALAUTO