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 =========================================================================*/
46 #ifndef vtkLight_h
47 #define vtkLight_h
48 
49 #include "vtkRenderingCoreModule.h" // For export macro
50 #include "vtkObject.h"
51 
52 /* need for virtual function */
53 class vtkRenderer;
54 class vtkMatrix4x4;
55 
56 #define VTK_LIGHT_TYPE_HEADLIGHT 1
57 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
58 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3
59 
61 {
62 public:
63  vtkTypeMacro(vtkLight,vtkObject);
64  void PrintSelf(ostream& os, vtkIndent indent);
65 
72  static vtkLight *New();
73 
78  virtual vtkLight *ShallowClone();
79 
84  virtual void Render(vtkRenderer *, int) {}
85 
87 
91  vtkSetVector3Macro(AmbientColor,double);
92  vtkGetVectorMacro(AmbientColor,double,3);
93  vtkSetVector3Macro(DiffuseColor,double);
94  vtkGetVectorMacro(DiffuseColor,double,3);
95  vtkSetVector3Macro(SpecularColor,double);
96  vtkGetVectorMacro(SpecularColor,double,3);
97  void SetColor(double, double, double);
98  void SetColor(const double a[3]) { this->SetColor(a[0], a[1], a[2]); }
100 
102 
106  vtkSetVector3Macro(Position,double);
107  vtkGetVectorMacro(Position,double,3);
108  void SetPosition(const float *a) {this->SetPosition(a[0],a[1],a[2]);};
110 
112 
117  vtkSetVector3Macro(FocalPoint,double);
118  vtkGetVectorMacro(FocalPoint,double,3);
119  void SetFocalPoint(const float *a) {this->SetFocalPoint(a[0],a[1],a[2]);};
121 
123 
124  vtkSetMacro(Intensity,double);
125  vtkGetMacro(Intensity,double);
127 
129 
130  vtkSetMacro(Switch,int);
131  vtkGetMacro(Switch,int);
132  vtkBooleanMacro(Switch,int);
134 
136 
137  vtkSetMacro(Positional,int);
138  vtkGetMacro(Positional,int);
139  vtkBooleanMacro(Positional,int);
141 
143 
144  vtkSetClampMacro(Exponent,double,0.0,128.0);
145  vtkGetMacro(Exponent,double);
147 
149 
153  vtkSetMacro(ConeAngle,double);
154  vtkGetMacro(ConeAngle,double);
156 
158 
160  vtkSetVector3Macro(AttenuationValues,double);
161  vtkGetVectorMacro(AttenuationValues,double,3);
163 
165 
168  virtual void SetTransformMatrix(vtkMatrix4x4*);
169  vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
171 
173 
175  void GetTransformedPosition(double &a0, double &a1, double &a2);
176  void GetTransformedPosition(double a[3]);
177  double *GetTransformedPosition();
179 
181 
183  void GetTransformedFocalPoint(double &a0, double &a1, double &a2);
184  void GetTransformedFocalPoint(double a[3]);
185  double *GetTransformedFocalPoint();
187 
189 
193  void SetDirectionAngle(double elevation, double azimuth);
194  void SetDirectionAngle(const double ang[2]) {
195  this->SetDirectionAngle(ang[0], ang[1]); };
197 
199  void DeepCopy(vtkLight *light);
200 
202 
213  vtkSetMacro(LightType, int);
214  vtkGetMacro(LightType, int);
216  {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);}
218  {
219  this->SetTransformMatrix(NULL);
220  this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT);
221  }
223  {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);}
225 
227 
228  int LightTypeIsHeadlight();
229  int LightTypeIsSceneLight();
230  int LightTypeIsCameraLight();
232 
233  void ReadSelf(istream& is);
234  void WriteSelf(ostream& os);
235 
236 protected:
237  vtkLight();
238  ~vtkLight();
239 
240  double FocalPoint[3];
241  double Position[3];
242  double Intensity;
243  double AmbientColor[3];
244  double DiffuseColor[3];
245  double SpecularColor[3];
246  int Switch;
248  double Exponent;
249  double ConeAngle;
250  double AttenuationValues[3];
252  double TransformedFocalPointReturn[3];
253  double TransformedPositionReturn[3];
255 
256 private:
257  vtkLight(const vtkLight&); // Not implemented.
258  void operator=(const vtkLight&); // Not implemented.
259 };
260 
261 #endif
double Exponent
Definition: vtkLight.h:248
abstract base class for most VTK objects
Definition: vtkObject.h:61
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:251
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:58
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
abstract specification for renderers
Definition: vtkRenderer.h:63
double Intensity
Definition: vtkLight.h:242
void SetLightTypeToHeadlight()
Definition: vtkLight.h:215
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:57
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:56
void SetColor(const double a[3])
Definition: vtkLight.h:98
int LightType
Definition: vtkLight.h:254
double ConeAngle
Definition: vtkLight.h:249
virtual void PrintSelf(ostream &os, vtkIndent indent)
void SetLightTypeToCameraLight()
Definition: vtkLight.h:222
a simple class to control print indentation
Definition: vtkIndent.h:38
a virtual light for 3D rendering
Definition: vtkLight.h:60
int Positional
Definition: vtkLight.h:247
int Switch
Definition: vtkLight.h:246
void SetFocalPoint(const float *a)
Definition: vtkLight.h:119
void SetDirectionAngle(const double ang[2])
Definition: vtkLight.h:194
#define VTKRENDERINGCORE_EXPORT
static vtkObject * New()
void SetLightTypeToSceneLight()
Definition: vtkLight.h:217
virtual void Render(vtkRenderer *, int)
Definition: vtkLight.h:84
void SetPosition(const float *a)
Definition: vtkLight.h:108