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=========================================================================*/
41#ifndef vtkLight_h
42#define vtkLight_h
43
44#include "vtkObject.h"
45#include "vtkRenderingCoreModule.h" // For export macro
46
47/* need for virtual function */
48class vtkInformation;
49class vtkRenderer;
50class vtkMatrix4x4;
51
52#define VTK_LIGHT_TYPE_HEADLIGHT 1
53#define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
54#define VTK_LIGHT_TYPE_SCENE_LIGHT 3
55
56class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
57{
58public:
59 vtkTypeMacro(vtkLight, vtkObject);
60 void PrintSelf(ostream& os, vtkIndent indent) override;
61
70 static vtkLight* New();
71
79
86 virtual void Render(vtkRenderer*, int) {}
87
89
95 vtkSetVector3Macro(AmbientColor, double);
96 vtkGetVectorMacro(AmbientColor, double, 3);
97 vtkSetVector3Macro(DiffuseColor, double);
98 vtkGetVectorMacro(DiffuseColor, double, 3);
99 vtkSetVector3Macro(SpecularColor, double);
100 vtkGetVectorMacro(SpecularColor, double, 3);
101 void SetColor(double, double, double);
102 void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
104
106
113 vtkSetVector3Macro(Position, double);
114 vtkGetVectorMacro(Position, double, 3);
115 void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
117
119
126 vtkSetVector3Macro(FocalPoint, double);
127 vtkGetVectorMacro(FocalPoint, double, 3);
128 void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
130
132
135 vtkSetMacro(Intensity, double);
136 vtkGetMacro(Intensity, double);
138
140
143 vtkSetMacro(Switch, vtkTypeBool);
144 vtkGetMacro(Switch, vtkTypeBool);
145 vtkBooleanMacro(Switch, vtkTypeBool);
147
149
152 vtkSetMacro(Positional, vtkTypeBool);
153 vtkGetMacro(Positional, vtkTypeBool);
154 vtkBooleanMacro(Positional, vtkTypeBool);
156
158
161 vtkSetClampMacro(Exponent, double, 0.0, 128.0);
162 vtkGetMacro(Exponent, double);
164
166
173 vtkSetMacro(ConeAngle, double);
174 vtkGetMacro(ConeAngle, double);
176
178
182 vtkSetVector3Macro(AttenuationValues, double);
183 vtkGetVectorMacro(AttenuationValues, double, 3);
185
187
193 vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
195
197
201 void GetTransformedPosition(double& x, double& y, double& z);
202 void GetTransformedPosition(double a[3]);
205
207
211 void GetTransformedFocalPoint(double& x, double& y, double& z);
212 void GetTransformedFocalPoint(double a[3]);
213 double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
215
219 void TransformPoint(double a[3], double b[3]);
220
224 void TransformVector(double a[3], double b[3]);
225
227
233 void SetDirectionAngle(double elevation, double azimuth);
234 void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
236
240 void DeepCopy(vtkLight* light);
241
243
261 virtual void SetLightType(int);
262 vtkGetMacro(LightType, int);
263
264 void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
268
270
277
279
285 vtkSetMacro(ShadowAttenuation, float);
286 vtkGetMacro(ShadowAttenuation, float);
288
290
293 vtkGetObjectMacro(Information, vtkInformation);
296
297protected:
299 ~vtkLight() override;
300
301 double FocalPoint[3];
302 double Position[3];
303 double Intensity;
304 double AmbientColor[3];
305 double DiffuseColor[3];
306 double SpecularColor[3];
309 double Exponent;
310 double ConeAngle;
311 double AttenuationValues[3];
313 double TransformedFocalPointReturn[3];
314 double TransformedPositionReturn[3];
317
318 // Arbitrary extra information associated with this light.
320
321private:
322 vtkLight(const vtkLight&) = delete;
323 void operator=(const vtkLight&) = delete;
324};
325
326#endif
a simple class to control print indentation
Definition: vtkIndent.h:34
Store vtkAlgorithm input/output information.
a virtual light for 3D rendering
Definition: vtkLight.h:57
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition: vtkLight.h:234
int LightTypeIsHeadlight()
Query the type of the light.
vtkTypeBool Switch
Definition: vtkLight.h:307
vtkTypeBool Positional
Definition: vtkLight.h:308
float ShadowAttenuation
Definition: vtkLight.h:316
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:264
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:303
double ConeAngle
Definition: vtkLight.h:310
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition: vtkLight.h:128
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:102
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:115
vtkInformation * Information
Definition: vtkLight.h:319
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:265
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:312
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:266
int LightType
Definition: vtkLight.h:315
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:86
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:309
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
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:54
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:53
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:52
#define VTK_SIZEHINT(...)