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=========================================================================*/
153#ifndef vtkLight_h
154#define vtkLight_h
155
156#include "vtkObject.h"
157#include "vtkRenderingCoreModule.h" // For export macro
158
159/* need for virtual function */
160class vtkInformation;
161class vtkRenderer;
162class vtkMatrix4x4;
163
164#define VTK_LIGHT_TYPE_HEADLIGHT 1
165#define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
166#define VTK_LIGHT_TYPE_SCENE_LIGHT 3
167
168class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
169{
170public:
171 vtkTypeMacro(vtkLight, vtkObject);
172 void PrintSelf(ostream& os, vtkIndent indent) override;
173
182 static vtkLight* New();
183
191
198 virtual void Render(vtkRenderer*, int) {}
199
201
207 vtkSetVector3Macro(AmbientColor, double);
208 vtkGetVectorMacro(AmbientColor, double, 3);
209 vtkSetVector3Macro(DiffuseColor, double);
210 vtkGetVectorMacro(DiffuseColor, double, 3);
211 vtkSetVector3Macro(SpecularColor, double);
212 vtkGetVectorMacro(SpecularColor, double, 3);
213 void SetColor(double, double, double);
214 void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
216
218
225 vtkSetVector3Macro(Position, double);
226 vtkGetVectorMacro(Position, double, 3);
227 void SetPosition(const float* a) { this->SetPosition(a[0], a[1], a[2]); }
229
231
238 vtkSetVector3Macro(FocalPoint, double);
239 vtkGetVectorMacro(FocalPoint, double, 3);
240 void SetFocalPoint(const float* a) { this->SetFocalPoint(a[0], a[1], a[2]); }
242
244
247 vtkSetMacro(Intensity, double);
248 vtkGetMacro(Intensity, double);
250
252
255 vtkSetMacro(Switch, vtkTypeBool);
256 vtkGetMacro(Switch, vtkTypeBool);
257 vtkBooleanMacro(Switch, vtkTypeBool);
259
261
264 vtkSetMacro(Positional, vtkTypeBool);
265 vtkGetMacro(Positional, vtkTypeBool);
266 vtkBooleanMacro(Positional, vtkTypeBool);
268
270
273 vtkSetClampMacro(Exponent, double, 0.0, 128.0);
274 vtkGetMacro(Exponent, double);
276
278
285 vtkSetMacro(ConeAngle, double);
286 vtkGetMacro(ConeAngle, double);
288
290
294 vtkSetVector3Macro(AttenuationValues, double);
295 vtkGetVectorMacro(AttenuationValues, double, 3);
297
299
305 vtkGetObjectMacro(TransformMatrix, vtkMatrix4x4);
307
309
313 void GetTransformedPosition(double& x, double& y, double& z);
314 void GetTransformedPosition(double a[3]);
317
319
323 void GetTransformedFocalPoint(double& x, double& y, double& z);
324 void GetTransformedFocalPoint(double a[3]);
325 double* GetTransformedFocalPoint() VTK_SIZEHINT(3);
327
331 void TransformPoint(double a[3], double b[3]);
332
336 void TransformVector(double a[3], double b[3]);
337
339
345 void SetDirectionAngle(double elevation, double azimuth);
346 void SetDirectionAngle(const double ang[2]) { this->SetDirectionAngle(ang[0], ang[1]); }
348
352 void DeepCopy(vtkLight* light);
353
355
373 virtual void SetLightType(int);
374 vtkGetMacro(LightType, int);
375
376 void SetLightTypeToHeadlight() { this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT); }
380
382
389
391
397 vtkSetMacro(ShadowAttenuation, float);
398 vtkGetMacro(ShadowAttenuation, float);
400
402
405 vtkGetObjectMacro(Information, vtkInformation);
408
409protected:
411 ~vtkLight() override;
412
413 double FocalPoint[3];
414 double Position[3];
415 double Intensity;
416 double AmbientColor[3];
417 double DiffuseColor[3];
418 double SpecularColor[3];
421 double Exponent;
422 double ConeAngle;
423 double AttenuationValues[3];
425 double TransformedFocalPointReturn[3];
426 double TransformedPositionReturn[3];
429
430 // Arbitrary extra information associated with this light.
432
433private:
434 vtkLight(const vtkLight&) = delete;
435 void operator=(const vtkLight&) = delete;
436};
437
438#endif
a simple class to control print indentation
Definition: vtkIndent.h:119
Store vtkAlgorithm input/output information.
a virtual light for 3D rendering
Definition: vtkLight.h:169
void SetDirectionAngle(const double ang[2])
Set the position and focal point of a light based on elevation and azimuth.
Definition: vtkLight.h:346
int LightTypeIsHeadlight()
Query the type of the light.
vtkTypeBool Switch
Definition: vtkLight.h:419
vtkTypeBool Positional
Definition: vtkLight.h:420
float ShadowAttenuation
Definition: vtkLight.h:428
void SetLightTypeToHeadlight()
Set/Get the type of the light.
Definition: vtkLight.h:376
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:415
double ConeAngle
Definition: vtkLight.h:422
void SetFocalPoint(const float *a)
Set/Get the point at which the light is shining.
Definition: vtkLight.h:240
void SetColor(const double a[3])
Set/Get the color of the light.
Definition: vtkLight.h:214
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:227
vtkInformation * Information
Definition: vtkLight.h:431
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:377
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:424
void SetLightTypeToCameraLight()
Set/Get the type of the light.
Definition: vtkLight.h:378
int LightType
Definition: vtkLight.h:427
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:198
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:421
int LightTypeIsCameraLight()
Query the type of the light.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
abstract base class for most VTK objects
Definition: vtkObject.h:82
abstract specification for renderers
Definition: vtkRenderer.h:182
@ Switch
Definition: vtkX3D.h:59
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:166
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:165
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:164
#define VTK_SIZEHINT(...)