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 "vtkObject.h"
50 
51 /* need for virtual function */
52 class vtkRenderer;
53 class vtkMatrix4x4;
54 
55 #define VTK_LIGHT_TYPE_HEADLIGHT 1
56 #define VTK_LIGHT_TYPE_CAMERA_LIGHT 2
57 #define VTK_LIGHT_TYPE_SCENE_LIGHT 3
58 
60 {
61 public:
62  vtkTypeMacro(vtkLight,vtkObject);
63  void PrintSelf(ostream& os, vtkIndent indent);
64 
71  static vtkLight *New();
72 
77  virtual vtkLight *ShallowClone();
78 
83  virtual void Render(vtkRenderer *, int) {};
84 
86 
90  vtkSetVector3Macro(AmbientColor,double);
91  vtkGetVectorMacro(AmbientColor,double,3);
92  vtkSetVector3Macro(DiffuseColor,double);
93  vtkGetVectorMacro(DiffuseColor,double,3);
94  vtkSetVector3Macro(SpecularColor,double);
95  vtkGetVectorMacro(SpecularColor,double,3);
96  void SetColor(double, double, double);
97  void SetColor(double a[3]) { this->SetColor(a[0], a[1], a[2]); }
99 
101 
102  VTK_LEGACY(void GetColor(double rgb[3]));
103  VTK_LEGACY(double *GetColor());
105 
107 
111  vtkSetVector3Macro(Position,double);
112  vtkGetVectorMacro(Position,double,3);
113  void SetPosition(float *a) {this->SetPosition(a[0],a[1],a[2]);};
115 
117 
122  vtkSetVector3Macro(FocalPoint,double);
123  vtkGetVectorMacro(FocalPoint,double,3);
124  void SetFocalPoint(float *a) {this->SetFocalPoint(a[0],a[1],a[2]);};
126 
128 
129  vtkSetMacro(Intensity,double);
130  vtkGetMacro(Intensity,double);
132 
134 
135  vtkSetMacro(Switch,int);
136  vtkGetMacro(Switch,int);
137  vtkBooleanMacro(Switch,int);
139 
141 
142  vtkSetMacro(Positional,int);
143  vtkGetMacro(Positional,int);
144  vtkBooleanMacro(Positional,int);
146 
148 
149  vtkSetClampMacro(Exponent,double,0.0,128.0);
150  vtkGetMacro(Exponent,double);
152 
154 
158  vtkSetMacro(ConeAngle,double);
159  vtkGetMacro(ConeAngle,double);
161 
163 
165  vtkSetVector3Macro(AttenuationValues,double);
166  vtkGetVectorMacro(AttenuationValues,double,3);
168 
170 
173  virtual void SetTransformMatrix(vtkMatrix4x4*);
174  vtkGetObjectMacro(TransformMatrix,vtkMatrix4x4);
176 
178 
180  void GetTransformedPosition(double &a0, double &a1, double &a2);
181  void GetTransformedPosition(double a[3]);
182  double *GetTransformedPosition();
184 
186 
188  void GetTransformedFocalPoint(double &a0, double &a1, double &a2);
189  void GetTransformedFocalPoint(double a[3]);
190  double *GetTransformedFocalPoint();
192 
194 
198  void SetDirectionAngle(double elevation, double azimuth);
199  void SetDirectionAngle(double ang[2]) {
200  this->SetDirectionAngle(ang[0], ang[1]); };
202 
204  void DeepCopy(vtkLight *light);
205 
207 
218  vtkSetMacro(LightType, int);
219  vtkGetMacro(LightType, int);
221  {this->SetLightType(VTK_LIGHT_TYPE_HEADLIGHT);}
223  {
224  this->SetTransformMatrix(NULL);
225  this->SetLightType(VTK_LIGHT_TYPE_SCENE_LIGHT);
226  }
228  {this->SetLightType(VTK_LIGHT_TYPE_CAMERA_LIGHT);}
230 
232 
233  int LightTypeIsHeadlight();
234  int LightTypeIsSceneLight();
235  int LightTypeIsCameraLight();
237 
238  void ReadSelf(istream& is);
239  void WriteSelf(ostream& os);
240 
241 protected:
242  vtkLight();
243  ~vtkLight();
244 
245  double FocalPoint[3];
246  double Position[3];
247  double Intensity;
248  double AmbientColor[3];
249  double DiffuseColor[3];
250  double SpecularColor[3];
251  int Switch;
253  double Exponent;
254  double ConeAngle;
255  double AttenuationValues[3];
257  double TransformedFocalPointReturn[3];
258  double TransformedPositionReturn[3];
260 
261 private:
262  vtkLight(const vtkLight&); // Not implemented.
263  void operator=(const vtkLight&); // Not implemented.
264 };
265 
266 #endif
double Exponent
Definition: vtkLight.h:253
abstract base class for most VTK objects
Definition: vtkObject.h:60
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:37
void SetDirectionAngle(double ang[2])
Definition: vtkLight.h:199
vtkMatrix4x4 * TransformMatrix
Definition: vtkLight.h:256
#define VTK_LIGHT_TYPE_SCENE_LIGHT
Definition: vtkLight.h:57
abstract specification for renderers
Definition: vtkRenderer.h:69
double Intensity
Definition: vtkLight.h:247
void SetLightTypeToHeadlight()
Definition: vtkLight.h:220
#define VTK_LIGHT_TYPE_CAMERA_LIGHT
Definition: vtkLight.h:56
#define VTK_LIGHT_TYPE_HEADLIGHT
Definition: vtkLight.h:55
int LightType
Definition: vtkLight.h:259
double ConeAngle
Definition: vtkLight.h:254
virtual void PrintSelf(ostream &os, vtkIndent indent)
void SetLightTypeToCameraLight()
Definition: vtkLight.h:227
a simple class to control print indentation
Definition: vtkIndent.h:37
a virtual light for 3D rendering
Definition: vtkLight.h:59
void SetPosition(float *a)
Definition: vtkLight.h:113
int Positional
Definition: vtkLight.h:252
int Switch
Definition: vtkLight.h:251
#define VTK_RENDERING_EXPORT
void SetFocalPoint(float *a)
Definition: vtkLight.h:124
void SetColor(double a[3])
Definition: vtkLight.h:97
static vtkObject * New()
void SetLightTypeToSceneLight()
Definition: vtkLight.h:222
virtual void Render(vtkRenderer *, int)
Definition: vtkLight.h:83