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
32#ifndef vtkLight_h
33#define vtkLight_h
34
35#include "vtkObject.h"
36#include "vtkRenderingCoreModule.h" // For export macro
37
38/* need for virtual function */
39VTK_ABI_NAMESPACE_BEGIN
40class vtkInformation;
41class vtkRenderer;
42class vtkMatrix4x4;
43
44#define VTK_LIGHT_TYPE_HEADLIGHT 1
45#define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
46#define VTK_LIGHT_TYPE_SCENE_LIGHT 3
47
48class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
49{
50public:
51 vtkTypeMacro(vtkLight, vtkObject);
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
62 static vtkLight* New();
63
71
78 virtual void Render(vtkRenderer*, int) {}
79
81
87 vtkSetVector3Macro(AmbientColor, double);
88 vtkGetVectorMacro(AmbientColor, double, 3);
89 vtkSetVector3Macro(DiffuseColor, double);
90 vtkGetVectorMacro(DiffuseColor, double, 3);
91 vtkSetVector3Macro(SpecularColor, double);
92 vtkGetVectorMacro(SpecularColor, double, 3);
93 void SetColor(double, double, double);
94 void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
96
98
105 vtkSetVector3Macro(Position, double);
106 vtkGetVectorMacro(Position, double, 3);
107 void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
109
111
118 vtkSetVector3Macro(FocalPoint, double);
119 vtkGetVectorMacro(FocalPoint, double, 3);
120 void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
122
124
127 vtkSetMacro(Intensity, double);
128 vtkGetMacro(Intensity, double);
130
132
135 vtkSetMacro(Switch, vtkTypeBool);
136 vtkGetMacro(Switch, vtkTypeBool);
137 vtkBooleanMacro(Switch, vtkTypeBool);
139
141
144 vtkSetMacro(Positional, vtkTypeBool);
145 vtkGetMacro(Positional, vtkTypeBool);
146 vtkBooleanMacro(Positional, vtkTypeBool);
148
150
153 vtkSetClampMacro(Exponent, double, 0.0, 128.0);
154 vtkGetMacro(Exponent, double);
156
158
165 vtkSetMacro(ConeAngle, double);
166 vtkGetMacro(ConeAngle, double);
168
170
174 vtkSetVector3Macro(AttenuationValues, double);
175 vtkGetVectorMacro(AttenuationValues, double, 3);
177
179
185 vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
187
189
193 void GetTransformedPosition(double& x, double& y, double& z);
194 void GetTransformedPosition(double a[3]);
197
199
203 void GetTransformedFocalPoint(double& x, double& y, double& z);
204 void GetTransformedFocalPoint(double a[3]);
205 double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
207
211 void TransformPoint(double a[3], double b[3]);
212
216 void TransformVector(double a[3], double b[3]);
217
219
225 void SetDirectionAngle(double elevation, double azimuth);
226 void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
228
232 void DeepCopy(vtkLight* light);
233
235
253 virtual void SetLightType(int);
254 vtkGetMacro(LightType, int);
255
256 void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
260
262
269
271
277 vtkSetMacro(ShadowAttenuation, float);
278 vtkGetMacro(ShadowAttenuation, float);
280
282
285 vtkGetObjectMacro(Information, vtkInformation);
288
289protected:
291 ~vtkLight() override;
292
293 double FocalPoint[3];
294 double Position[3];
295 double Intensity;
296 double AmbientColor[3];
297 double DiffuseColor[3];
298 double SpecularColor[3];
301 double Exponent;
302 double ConeAngle;
303 double AttenuationValues[3];
305 double TransformedFocalPointReturn[3];
306 double TransformedPositionReturn[3];
309
310 // Arbitrary extra information associated with this light.
312
313private:
314 vtkLight(const vtkLight&) = delete;
315 void operator=(const vtkLight&) = delete;
316};
317
318VTK_ABI_NAMESPACE_END
319#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:49
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition vtkLight.h:226
int LightTypeIsHeadlight()
Query the type of the light.
vtkTypeBool Switch
Definition vtkLight.h:299
vtkTypeBool Positional
Definition vtkLight.h:300
float ShadowAttenuation
Definition vtkLight.h:308
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition vtkLight.h:256
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:295
double ConeAngle
Definition vtkLight.h:302
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition vtkLight.h:120
void SetColor(const double a[3])
Set/Get the color of the light.
Definition vtkLight.h:94
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:107
vtkInformation * Information
Definition vtkLight.h:311
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:257
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:304
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition vtkLight.h:258
int LightType
Definition vtkLight.h:307
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition vtkLight.h:78
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:301
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
abstract base class for most VTK objects
Definition vtkObject.h:49
abstract specification for renderers
Definition vtkRenderer.h:59
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition vtkLight.h:46
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition vtkLight.h:45
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition vtkLight.h:44
#define VTK_SIZEHINT(...)