VTK  9.5.20250802
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
141#ifndef vtkLight_h
142#define vtkLight_h
143
144#include "vtkObject.h"
145#include "vtkRenderingCoreModule.h" // For export macro
146#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
147
148/* need for virtual function */
149VTK_ABI_NAMESPACE_BEGIN
150class vtkInformation;
151class vtkRenderer;
152class vtkMatrix4x4;
153
154#define VTK_LIGHT_TYPE_HEADLIGHT 1
155#define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
156#define VTK_LIGHT_TYPE_SCENE_LIGHT 3
157
158class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkLight : public vtkObject
159{
160public:
161 vtkTypeMacro(vtkLight, vtkObject);
162 void PrintSelf(ostream& os, vtkIndent indent) override;
163
172 static vtkLight* New();
173
181
188 virtual void Render(vtkRenderer*, int) {}
189
191
197 vtkSetVector3Macro(AmbientColor, double);
198 vtkGetVectorMacro(AmbientColor, double, 3);
199 vtkSetVector3Macro(DiffuseColor, double);
200 vtkGetVectorMacro(DiffuseColor, double, 3);
201 vtkSetVector3Macro(SpecularColor, double);
202 vtkGetVectorMacro(SpecularColor, double, 3);
203 void SetColor(double, double, double);
204 void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
206
208
215 vtkSetVector3Macro(Position, double);
216 vtkGetVectorMacro(Position, double, 3);
217 void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
219
221
228 vtkSetVector3Macro(FocalPoint, double);
229 vtkGetVectorMacro(FocalPoint, double, 3);
230 void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
232
234
237 vtkSetMacro(Intensity, double);
238 vtkGetMacro(Intensity, double);
240
242
245 vtkSetMacro(Switch, vtkTypeBool);
246 vtkGetMacro(Switch, vtkTypeBool);
247 vtkBooleanMacro(Switch, vtkTypeBool);
249
251
254 vtkSetMacro(Positional, vtkTypeBool);
255 vtkGetMacro(Positional, vtkTypeBool);
256 vtkBooleanMacro(Positional, vtkTypeBool);
258
260
263 vtkSetClampMacro(Exponent, double, 0.0, 128.0);
264 vtkGetMacro(Exponent, double);
266
268
275 vtkSetMacro(ConeAngle, double);
276 vtkGetMacro(ConeAngle, double);
278
280
284 vtkSetVector3Macro(AttenuationValues, double);
285 vtkGetVectorMacro(AttenuationValues, double, 3);
287
289
295 vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
297
299
303 void GetTransformedPosition(double& x, double& y, double& z);
304 void GetTransformedPosition(double a[3]);
307
309
313 void GetTransformedFocalPoint(double& x, double& y, double& z);
314 void GetTransformedFocalPoint(double a[3]);
315 double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
317
321 void TransformPoint(double a[3], double b[3]);
322
326 void TransformVector(double a[3], double b[3]);
327
329
335 void SetDirectionAngle(double elevation, double azimuth);
336 void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
338
342 void DeepCopy(vtkLight* light);
343
345
363 virtual void SetLightType(int);
364 vtkGetMacro(LightType, int);
365
366 void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
370
372
379
381
387 vtkSetMacro(ShadowAttenuation, float);
388 vtkGetMacro(ShadowAttenuation, float);
390
392
395 vtkGetObjectMacro(Information, vtkInformation);
398
399protected:
401 ~vtkLight() override;
402
403 double FocalPoint[3];
404 double Position[3];
405 double Intensity;
406 double AmbientColor[3];
407 double DiffuseColor[3];
408 double SpecularColor[3];
411 double Exponent;
412 double ConeAngle;
413 double AttenuationValues[3];
415 double TransformedFocalPointReturn[3];
416 double TransformedPositionReturn[3];
419
420 // Arbitrary extra information associated with this light.
422
423private:
424 vtkLight(const vtkLight&) = delete;
425 void operator=(const vtkLight&) = delete;
426};
427
428VTK_ABI_NAMESPACE_END
429#endif
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
a virtual light for 3D rendering
Definition vtkLight.h:159
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition vtkLight.h:336
int LightTypeIsHeadlight()
Query the type of the light.
vtkTypeBool Switch
Definition vtkLight.h:409
vtkTypeBool Positional
Definition vtkLight.h:410
float ShadowAttenuation
Definition vtkLight.h:418
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition vtkLight.h:366
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:405
double ConeAngle
Definition vtkLight.h:412
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition vtkLight.h:230
void SetColor(const double a[3])
Set/Get the color of the light.
Definition vtkLight.h:204
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:217
vtkInformation * Information
Definition vtkLight.h:421
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:367
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:414
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition vtkLight.h:368
int LightType
Definition vtkLight.h:417
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition vtkLight.h:188
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:411
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
abstract base class for most VTK objects
Definition vtkObject.h:162
abstract specification for renderers
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition vtkLight.h:156
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition vtkLight.h:155
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition vtkLight.h:154
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO