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 =========================================================================*/
150 #ifndef vtkLight_h
151 #define vtkLight_h
152 
153 #include "vtkObject.h"
154 #include "vtkRenderingCoreModule.h" // For export macro
155 
156 /* need for virtual function */
157 class vtkInformation;
158 class vtkRenderer;
159 class vtkMatrix4x4;
160 
161 #define VTK_LIGHT_TYPE_HEADLIGHT 1
162 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
163 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3
164 
165 class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
166 {
167 public:
168  vtkTypeMacro(vtkLight, vtkObject);
169  void PrintSelf(ostream& os, vtkIndent indent) override;
170 
179  static vtkLight* New();
180 
187  virtual vtkLight* ShallowClone();
188 
195  virtual void Render(vtkRenderer*, int) {}
196 
198 
204  vtkSetVector3Macro(AmbientColor, double);
205  vtkGetVectorMacro(AmbientColor, double, 3);
206  vtkSetVector3Macro(DiffuseColor, double);
207  vtkGetVectorMacro(DiffuseColor, double, 3);
208  vtkSetVector3Macro(SpecularColor, double);
209  vtkGetVectorMacro(SpecularColor, double, 3);
210  void SetColor(double, double, double);
211  void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
213 
215 
222  vtkSetVector3Macro(Position, double);
223  vtkGetVectorMacro(Position, double, 3);
224  void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
226 
228 
235  vtkSetVector3Macro(FocalPoint, double);
236  vtkGetVectorMacro(FocalPoint, double, 3);
237  void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
239 
241 
244  vtkSetMacro(Intensity, double);
245  vtkGetMacro(Intensity, double);
247 
249 
252  vtkSetMacro(Switch, vtkTypeBool);
253  vtkGetMacro(Switch, vtkTypeBool);
254  vtkBooleanMacro(Switch, vtkTypeBool);
256 
258 
261  vtkSetMacro(Positional, vtkTypeBool);
262  vtkGetMacro(Positional, vtkTypeBool);
263  vtkBooleanMacro(Positional, vtkTypeBool);
265 
267 
270  vtkSetClampMacro(Exponent, double, 0.0, 128.0);
271  vtkGetMacro(Exponent, double);
273 
275 
282  vtkSetMacro(ConeAngle, double);
283  vtkGetMacro(ConeAngle, double);
285 
287 
291  vtkSetVector3Macro(AttenuationValues, double);
292  vtkGetVectorMacro(AttenuationValues, double, 3);
294 
296 
302  vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
304 
306 
310  void GetTransformedPosition(double& x, double& y, double& z);
311  void GetTransformedPosition(double a[3]);
314 
316 
320  void GetTransformedFocalPoint(double& x, double& y, double& z);
321  void GetTransformedFocalPoint(double a[3]);
322  double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
324 
328  void TransformPoint(double a[3], double b[3]);
329 
333  void TransformVector(double a[3], double b[3]);
334 
336 
342  void SetDirectionAngle(double elevation, double azimuth);
343  void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
345 
349  void DeepCopy(vtkLight* light);
350 
352 
370  virtual void SetLightType(int);
371  vtkGetMacro(LightType, int);
372 
373  void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
374  void SetLightTypeToSceneLight() { this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT); }
377 
379 
386 
388 
394  vtkSetMacro(ShadowAttenuation, float);
395  vtkGetMacro(ShadowAttenuation, float);
397 
399 
402  vtkGetObjectMacro(Information, vtkInformation);
405 
406 protected:
408  ~vtkLight() override;
409 
410  double FocalPoint[3];
411  double Position[3];
412  double Intensity;
413  double AmbientColor[3];
414  double DiffuseColor[3];
415  double SpecularColor[3];
418  double Exponent;
419  double ConeAngle;
420  double AttenuationValues[3];
422  double TransformedFocalPointReturn[3];
423  double TransformedPositionReturn[3];
426 
427  // Arbitrary extra information associated with this light.
429 
430 private:
431  vtkLight(const vtkLight&) = delete;
432  void operator=(const vtkLight&) = delete;
433 };
434 
435 #endif
a simple class to control print indentation
Definition: vtkIndent.h:113
Store vtkAlgorithm input/output information.
a virtual light for 3D rendering
Definition: vtkLight.h:166
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition: vtkLight.h:343
int LightTypeIsHeadlight()
Query the type of the light.
static vtkLight * New()
Create a light with the focal point at the origin and its position set to (0,0,1).
double * GetTransformedPosition()
Get the position of the light, modified by the transformation matrix (if it exists).
vtkTypeBool Switch
Definition: vtkLight.h:416
vtkTypeBool Positional
Definition: vtkLight.h:417
float ShadowAttenuation
Definition: vtkLight.h:425
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:373
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:412
double ConeAngle
Definition: vtkLight.h:419
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition: vtkLight.h:237
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:211
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.
void SetPosition(const float *a)
Set/Get the position of the light.
Definition: vtkLight.h:224
vtkInformation * Information
Definition: vtkLight.h:428
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:374
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:421
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:375
int LightType
Definition: vtkLight.h:424
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:195
void DeepCopy(vtkLight *light)
Perform deep copy of this light.
virtual vtkLight * ShallowClone()
Create a new light object with the same light parameters than the current object (any ivar from the s...
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:418
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:145
abstract base class for most VTK objects
Definition: vtkObject.h:73
abstract specification for renderers
Definition: vtkRenderer.h:173
@ Switch
Definition: vtkX3D.h:59
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:163
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:162
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:161
#define VTK_SIZEHINT(...)