VTK  9.0.1
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 */
48 class vtkInformation;
49 class vtkRenderer;
50 class 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 
56 class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
57 {
58 public:
59  vtkTypeMacro(vtkLight, vtkObject);
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
70  static vtkLight* New();
71 
78  virtual vtkLight* ShallowClone();
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 
192  virtual void SetTransformMatrix(vtkMatrix4x4*);
193  vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
195 
197 
201  void GetTransformedPosition(double& a0, double& a1, double& a2);
202  void GetTransformedPosition(double a[3]);
203  double* GetTransformedPosition() VTK_SIZEHINT(3);
205 
207 
211  void GetTransformedFocalPoint(double& a0, double& a1, double& a2);
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); }
265  void SetLightTypeToSceneLight() { this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT); }
268 
270 
273  int LightTypeIsHeadlight();
274  int LightTypeIsSceneLight();
275  int LightTypeIsCameraLight();
277 
279 
285  vtkSetMacro(ShadowAttenuation, float);
286  vtkGetMacro(ShadowAttenuation, float);
288 
290 
293  vtkGetObjectMacro(Information, vtkInformation);
294  virtual void SetInformation(vtkInformation*);
296 
297 protected:
298  vtkLight();
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 
321 private:
322  vtkLight(const vtkLight&) = delete;
323  void operator=(const vtkLight&) = delete;
324 };
325 
326 #endif
vtkLight::Intensity
double Intensity
Definition: vtkLight.h:303
vtkLight::SetLightTypeToHeadlight
void SetLightTypeToHeadlight()
Definition: vtkLight.h:264
vtkLight
a virtual light for 3D rendering
Definition: vtkLight.h:56
vtkLight::SetLightTypeToSceneLight
void SetLightTypeToSceneLight()
Definition: vtkLight.h:265
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkLight::Exponent
double Exponent
Definition: vtkLight.h:309
vtkLight::SetColor
void SetColor(const double a[3])
Definition: vtkLight.h:102
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkLight::TransformMatrix
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:312
vtkLight::ConeAngle
double ConeAngle
Definition: vtkLight.h:310
vtkLight::SetFocalPoint
void SetFocalPoint(const float *a)
Definition: vtkLight.h:128
VTK_LIGHT_TYPE_CAMERA_LIGHT
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:53
vtkLight::LightType
int LightType
Definition: vtkLight.h:315
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h
vtkLight::Render
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:86
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkX3D::Switch
@ Switch
Definition: vtkX3D.h:59
vtkLight::SetLightTypeToCameraLight
void SetLightTypeToCameraLight()
Definition: vtkLight.h:266
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:67
vtkLight::Positional
vtkTypeBool Positional
Definition: vtkLight.h:308
vtkLight::SetPosition
void SetPosition(const float *a)
Definition: vtkLight.h:115
VTK_LIGHT_TYPE_HEADLIGHT
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:52
VTK_LIGHT_TYPE_SCENE_LIGHT
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:54
vtkLight::Information
vtkInformation * Information
Definition: vtkLight.h:319
vtkLight::Switch
vtkTypeBool Switch
Definition: vtkLight.h:307
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkLight::SetDirectionAngle
void SetDirectionAngle(const double ang[2])
Definition: vtkLight.h:234
vtkLight::ShadowAttenuation
float ShadowAttenuation
Definition: vtkLight.h:316