VTK
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=========================================================================*/
47#ifndef vtkLight_h
48#define vtkLight_h
49
50#include "vtkRenderingCoreModule.h" // For export macro
51#include "vtkObject.h"
52
53/* need for virtual function */
54class vtkRenderer;
55class vtkMatrix4x4;
56
57#define VTK_LIGHT_TYPE_HEADLIGHT 1
58#define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
59#define VTK_LIGHT_TYPE_SCENE_LIGHT 3
60
61class VTKRENDERINGCORE_EXPORT vtkLight : public vtkObject
62{
63public:
64 vtkTypeMacro(vtkLight,vtkObject);
65 void PrintSelf(ostream& os, vtkIndent indent);
66
75 static vtkLight *New();
76
84
91 virtual void Render(vtkRenderer *, int) {}
92
94
100 vtkSetVector3Macro(AmbientColor,double);
101 vtkGetVectorMacro(AmbientColor,double,3);
102 vtkSetVector3Macro(DiffuseColor,double);
103 vtkGetVectorMacro(DiffuseColor,double,3);
104 vtkSetVector3Macro(SpecularColor,double);
105 vtkGetVectorMacro(SpecularColor,double,3);
106 void SetColor(double, double, double);
107 void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
109
111
118 vtkSetVector3Macro(Position,double);
119 vtkGetVectorMacro(Position,double,3);
120 void SetPosition(const float *a) {this->SetPosition(a[0],a[1],a[2]);};
122
124
131 vtkSetVector3Macro(FocalPoint,double);
132 vtkGetVectorMacro(FocalPoint,double,3);
133 void SetFocalPoint(const float *a) {this->SetFocalPoint(a[0],a[1],a[2]);};
135
137
140 vtkSetMacro(Intensity,double);
141 vtkGetMacro(Intensity,double);
143
145
149 vtkGetMacro(Switch,int);
152
154
157 vtkSetMacro(Positional,int);
158 vtkGetMacro(Positional,int);
159 vtkBooleanMacro(Positional,int);
161
163
166 vtkSetClampMacro(Exponent,double,0.0,128.0);
167 vtkGetMacro(Exponent,double);
169
171
178 vtkSetMacro(ConeAngle,double);
179 vtkGetMacro(ConeAngle,double);
181
183
187 vtkSetVector3Macro(AttenuationValues,double);
188 vtkGetVectorMacro(AttenuationValues,double,3);
190
192
198 vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
200
202
206 void GetTransformedPosition(double &a0, double &a1, double &a2);
207 void GetTransformedPosition(double a[3]);
210
212
216 void GetTransformedFocalPoint(double &a0, double &a1, double &a2);
217 void GetTransformedFocalPoint(double a[3]);
220
222
228 void SetDirectionAngle(double elevation, double azimuth);
229 void SetDirectionAngle(const double ang[2]) {
230 this->SetDirectionAngle(ang[0], ang[1]); };
232
236 void DeepCopy(vtkLight *light);
237
239
256 vtkSetMacro(LightType, int);
257 vtkGetMacro(LightType, int);
259 {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);}
261 {
262 this->SetTransformMatrix(NULL);
263 this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT);
264 }
266 {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);}
268
270
277
278 void ReadSelf(istream& is);
279 void WriteSelf(ostream& os);
280
282
288 vtkSetMacro(ShadowAttenuation,float);
289 vtkGetMacro(ShadowAttenuation,float);
291
292
293protected:
296
297 double FocalPoint[3];
298 double Position[3];
299 double Intensity;
300 double AmbientColor[3];
301 double DiffuseColor[3];
302 double SpecularColor[3];
305 double Exponent;
306 double ConeAngle;
307 double AttenuationValues[3];
309 double TransformedFocalPointReturn[3];
310 double TransformedPositionReturn[3];
313
314private:
315 vtkLight(const vtkLight&) VTK_DELETE_FUNCTION;
316 void operator=(const vtkLight&) VTK_DELETE_FUNCTION;
317};
318
319#endif
a simple class to control print indentation
Definition: vtkIndent.h:40
a virtual light for 3D rendering
Definition: vtkLight.h:62
void SetDirectionAngle(const double ang[2])
Definition: vtkLight.h:229
int Switch
Definition: vtkLight.h:303
int LightTypeIsHeadlight()
Query the type of the light.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void GetTransformedFocalPoint(double &a0, double &a1, double &a2)
Get the focal point of the light, modified by the transformation matrix (if it exists).
float ShadowAttenuation
Definition: vtkLight.h:312
void SetLightTypeToHeadlight()
Definition: vtkLight.h:258
virtual void SetTransformMatrix(vtkMatrix4x4 *)
Set/Get the light's transformation matrix.
double Intensity
Definition: vtkLight.h:299
void GetTransformedPosition(double &a0, double &a1, double &a2)
Get the position of the light, modified by the transformation matrix (if it exists).
double ConeAngle
Definition: vtkLight.h:306
void SetFocalPoint(const float *a)
Definition: vtkLight.h:133
double * GetTransformedFocalPoint()
void SetColor(const double a[3])
Definition: vtkLight.h:107
int LightTypeIsSceneLight()
double * GetTransformedPosition()
void ReadSelf(istream &is)
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)
Definition: vtkLight.h:120
void SetDirectionAngle(double elevation, double azimuth)
Set the position and focal point of a light based on elevation and azimuth.
void SetLightTypeToSceneLight()
Definition: vtkLight.h:260
static vtkLight * New()
Create a light with the focal point at the origin and its position set to (0,0,1).
void WriteSelf(ostream &os)
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:308
void SetLightTypeToCameraLight()
Definition: vtkLight.h:265
int LightType
Definition: vtkLight.h:311
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:91
void DeepCopy(vtkLight *light)
Perform deep copy of this light.
void GetTransformedFocalPoint(double a[3])
void SetColor(double, double, double)
void GetTransformedPosition(double a[3])
int Positional
Definition: vtkLight.h:304
double Exponent
Definition: vtkLight.h:305
int LightTypeIsCameraLight()
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
abstract base class for most VTK objects
Definition: vtkObject.h:60
abstract specification for renderers
Definition: vtkRenderer.h:64
@ Switch
Definition: vtkX3D.h:53
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:59
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:58
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:57
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.