VTK  9.2.6
vtkLight.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkLight.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
44#ifndef vtkLight_h
45#define vtkLight_h
46
47#include "vtkObject.h"
48#include "vtkRenderingCoreModule.h" // For export macro
49
50/* need for virtual function */
51class vtkInformation;
52class vtkRenderer;
53class vtkMatrix4x4;
54
55#define VTK_LIGHT_TYPE_HEADLIGHT 1
56#define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
57#define VTK_LIGHT_TYPE_SCENE_LIGHT 3
58
59class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
60{
61public:
62 vtkTypeMacro(vtkLight, vtkObject);
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
73 static vtkLight* New();
74
82
89 virtual void Render(vtkRenderer*, int) {}
90
92
98 vtkSetVector3Macro(AmbientColor, double);
99 vtkGetVectorMacro(AmbientColor, double, 3);
100 vtkSetVector3Macro(DiffuseColor, double);
101 vtkGetVectorMacro(DiffuseColor, double, 3);
102 vtkSetVector3Macro(SpecularColor, double);
103 vtkGetVectorMacro(SpecularColor, double, 3);
104 void SetColor(double, double, double);
105 void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
107
109
116 vtkSetVector3Macro(Position, double);
117 vtkGetVectorMacro(Position, double, 3);
118 void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
120
122
129 vtkSetVector3Macro(FocalPoint, double);
130 vtkGetVectorMacro(FocalPoint, double, 3);
131 void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
133
135
138 vtkSetMacro(Intensity, double);
139 vtkGetMacro(Intensity, double);
141
143
146 vtkSetMacro(Switch, vtkTypeBool);
147 vtkGetMacro(Switch, vtkTypeBool);
148 vtkBooleanMacro(Switch, vtkTypeBool);
150
152
155 vtkSetMacro(Positional, vtkTypeBool);
156 vtkGetMacro(Positional, vtkTypeBool);
157 vtkBooleanMacro(Positional, vtkTypeBool);
159
161
164 vtkSetClampMacro(Exponent, double, 0.0, 128.0);
165 vtkGetMacro(Exponent, double);
167
169
176 vtkSetMacro(ConeAngle, double);
177 vtkGetMacro(ConeAngle, double);
179
181
185 vtkSetVector3Macro(AttenuationValues, double);
186 vtkGetVectorMacro(AttenuationValues, double, 3);
188
190
196 vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
198
200
204 void GetTransformedPosition(double& x, double& y, double& z);
205 void GetTransformedPosition(double a[3]);
208
210
214 void GetTransformedFocalPoint(double& x, double& y, double& z);
215 void GetTransformedFocalPoint(double a[3]);
216 double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
218
222 void TransformPoint(double a[3], double b[3]);
223
227 void TransformVector(double a[3], double b[3]);
228
230
236 void SetDirectionAngle(double elevation, double azimuth);
237 void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
239
243 void DeepCopy(vtkLight* light);
244
246
264 virtual void SetLightType(int);
265 vtkGetMacro(LightType, int);
266
267 void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
271
273
280
282
288 vtkSetMacro(ShadowAttenuation, float);
289 vtkGetMacro(ShadowAttenuation, float);
291
293
296 vtkGetObjectMacro(Information, vtkInformation);
299
300protected:
302 ~vtkLight() override;
303
304 double FocalPoint[3];
305 double Position[3];
306 double Intensity;
307 double AmbientColor[3];
308 double DiffuseColor[3];
309 double SpecularColor[3];
312 double Exponent;
313 double ConeAngle;
314 double AttenuationValues[3];
316 double TransformedFocalPointReturn[3];
317 double TransformedPositionReturn[3];
320
321 // Arbitrary extra information associated with this light.
323
324private:
325 vtkLight(const vtkLight&) = delete;
326 void operator=(const vtkLight&) = delete;
327};
328
329#endif
a simple class to control print indentation
Definition vtkIndent.h:40
Store vtkAlgorithm input/output information.
a virtual light for 3D rendering
Definition vtkLight.h:60
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition vtkLight.h:237
int LightTypeIsHeadlight()
Query the type of the light.
vtkTypeBool Switch
Definition vtkLight.h:310
vtkTypeBool Positional
Definition vtkLight.h:311
float ShadowAttenuation
Definition vtkLight.h:319
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition vtkLight.h:267
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:306
double ConeAngle
Definition vtkLight.h:313
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition vtkLight.h:131
void SetColor(const double a[3])
Set/Get the color of the light.
Definition vtkLight.h:105
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:118
vtkInformation * Information
Definition vtkLight.h:322
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:268
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:315
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition vtkLight.h:269
int LightType
Definition vtkLight.h:318
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition vtkLight.h:89
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:312
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
abstract base class for most VTK objects
Definition vtkObject.h:63
abstract specification for renderers
Definition vtkRenderer.h:73
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition vtkLight.h:57
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition vtkLight.h:56
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition vtkLight.h:55
#define VTK_SIZEHINT(...)