VTK  9.1.0
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=========================================================================*/
50#ifndef vtkLight_h
51#define vtkLight_h
52
53#include "vtkObject.h"
54#include "vtkRenderingCoreModule.h" // For export macro
55
56/* need for virtual function */
57class vtkInformation;
58class vtkRenderer;
59class vtkMatrix4x4;
60
61#define VTK_LIGHT_TYPE_HEADLIGHT 1
62#define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
63#define VTK_LIGHT_TYPE_SCENE_LIGHT 3
64
65class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
66{
67public:
68 vtkTypeMacro(vtkLight, vtkObject);
69 void PrintSelf(ostream& os, vtkIndent indent) override;
70
79 static vtkLight* New();
80
88
95 virtual void Render(vtkRenderer*, int) {}
96
98
104 vtkSetVector3Macro(AmbientColor, double);
105 vtkGetVectorMacro(AmbientColor, double, 3);
106 vtkSetVector3Macro(DiffuseColor, double);
107 vtkGetVectorMacro(DiffuseColor, double, 3);
108 vtkSetVector3Macro(SpecularColor, double);
109 vtkGetVectorMacro(SpecularColor, double, 3);
110 void SetColor(double, double, double);
111 void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
113
115
122 vtkSetVector3Macro(Position, double);
123 vtkGetVectorMacro(Position, double, 3);
124 void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
126
128
135 vtkSetVector3Macro(FocalPoint, double);
136 vtkGetVectorMacro(FocalPoint, double, 3);
137 void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
139
141
144 vtkSetMacro(Intensity, double);
145 vtkGetMacro(Intensity, double);
147
149
152 vtkSetMacro(Switch, vtkTypeBool);
153 vtkGetMacro(Switch, vtkTypeBool);
154 vtkBooleanMacro(Switch, vtkTypeBool);
156
158
161 vtkSetMacro(Positional, vtkTypeBool);
162 vtkGetMacro(Positional, vtkTypeBool);
163 vtkBooleanMacro(Positional, vtkTypeBool);
165
167
170 vtkSetClampMacro(Exponent, double, 0.0, 128.0);
171 vtkGetMacro(Exponent, double);
173
175
182 vtkSetMacro(ConeAngle, double);
183 vtkGetMacro(ConeAngle, double);
185
187
191 vtkSetVector3Macro(AttenuationValues, double);
192 vtkGetVectorMacro(AttenuationValues, double, 3);
194
196
202 vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
204
206
210 void GetTransformedPosition(double& x, double& y, double& z);
211 void GetTransformedPosition(double a[3]);
214
216
220 void GetTransformedFocalPoint(double& x, double& y, double& z);
221 void GetTransformedFocalPoint(double a[3]);
222 double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
224
228 void TransformPoint(double a[3], double b[3]);
229
233 void TransformVector(double a[3], double b[3]);
234
236
242 void SetDirectionAngle(double elevation, double azimuth);
243 void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
245
249 void DeepCopy(vtkLight* light);
250
252
270 virtual void SetLightType(int);
271 vtkGetMacro(LightType, int);
272
273 void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
277
279
286
288
294 vtkSetMacro(ShadowAttenuation, float);
295 vtkGetMacro(ShadowAttenuation, float);
297
299
302 vtkGetObjectMacro(Information, vtkInformation);
305
306protected:
308 ~vtkLight() override;
309
310 double FocalPoint[3];
311 double Position[3];
312 double Intensity;
313 double AmbientColor[3];
314 double DiffuseColor[3];
315 double SpecularColor[3];
318 double Exponent;
319 double ConeAngle;
320 double AttenuationValues[3];
322 double TransformedFocalPointReturn[3];
323 double TransformedPositionReturn[3];
326
327 // Arbitrary extra information associated with this light.
329
330private:
331 vtkLight(const vtkLight&) = delete;
332 void operator=(const vtkLight&) = delete;
333};
334
335#endif
a simple class to control print indentation
Definition: vtkIndent.h:43
Store vtkAlgorithm input/output information.
a virtual light for 3D rendering
Definition: vtkLight.h:66
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition: vtkLight.h:243
int LightTypeIsHeadlight()
Query the type of the light.
vtkTypeBool Switch
Definition: vtkLight.h:316
vtkTypeBool Positional
Definition: vtkLight.h:317
float ShadowAttenuation
Definition: vtkLight.h:325
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:273
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:312
double ConeAngle
Definition: vtkLight.h:319
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition: vtkLight.h:137
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:111
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:124
vtkInformation * Information
Definition: vtkLight.h:328
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:274
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:321
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:275
int LightType
Definition: vtkLight.h:324
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:95
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:318
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:45
abstract base class for most VTK objects
Definition: vtkObject.h:63
abstract specification for renderers
Definition: vtkRenderer.h:73
@ Switch
Definition: vtkX3D.h:59
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:63
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:62
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:61
#define VTK_SIZEHINT(...)