Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# vtkLight Class Reference

`#include <vtkLight.h>`

Inheritance diagram for vtkLight:

[legend]
Collaboration diagram for vtkLight:

[legend]
List of all members.

## Detailed Description

a virtual light for 3D rendering

Date:
  2003/01/07 15:08:46

Revision:
  1.55

vtkLight is a virtual light for 3D rendering. It provides methods to locate and point the light, turn it on and off, and set its brightness and color. In addition to the basic infinite distance point light source attributes, you also can specify the light attenuation values and cone angle. These attributes are only used if the light is a positional light. The default is a directional light (e.g. infinite point light source).

Lights have a type that describes how the light should move with respect to the camera. A Headlight is always located at the current camera position and shines on the camera's focal point. A CameraLight also moves with the camera, but may not be coincident to it. CameraLights are defined in a normalized coordinate space where the camera is located at (0, 0, 1), the camera is looking at (0, 0, 0), and up is (0, 1, 0). Finally, a SceneLight is part of the scene itself and does not move with the camera. (Renderers are responsible for moving the light based on its type.)

Lights have a transformation matrix that describes the space in which they are positioned. A light's world space position and focal point are defined by their local position and focal point, transformed by their transformation matrix (if it exists).

Created by:
  - Martin, Ken

CVS contributions (if > 5%):
  - Martin, Ken (48%)
  - Halle, Michael (30%)
  - Schroeder, Will (10%)

CVS logs (CVSweb):
  - .`cxx` (`/Rendering/vtkLight.cxx)`
  - .`h` (`/Rendering/vtkLight.h)`

Examples:
  vtkLight (Examples)

Tests:
  vtkLight (Tests)

Definition at line 75 of file vtkLight.h.

## Public Types
typedef vtkObject | Superclass
## Public Methods
virtual const char * | GetClassName ()
virtual int | IsA (const char *type)
void | PrintSelf (ostream &os, vtkIndent indent)
virtual void | Render (vtkRenderer *, int)
void | DeepCopy (vtkLight *light)
void | ReadSelf (istream &is)
void | WriteSelf (ostream &os)
virtual void | SetColor (float, float, float)
virtual void | SetColor (float[3])
virtual float * | GetColor ()
virtual void | GetColor (float data[3])
virtual void | SetPosition (float, float, float)
virtual void | SetPosition (float[3])
virtual float * | GetPosition ()
virtual void | GetPosition (float data[3])
void | SetPosition (double *a)
virtual void | SetFocalPoint (float, float, float)
virtual void | SetFocalPoint (float[3])
virtual float * | GetFocalPoint ()
virtual void | GetFocalPoint (float data[3])
void | SetFocalPoint (double *a)
virtual void | SetIntensity (float)
virtual float | GetIntensity ()
virtual void | SetSwitch (int)
virtual int | GetSwitch ()
virtual void | SwitchOn ()
virtual void | SwitchOff ()
virtual void | SetPositional (int)
virtual int | GetPositional ()
virtual void | PositionalOn ()
virtual void | PositionalOff ()
virtual void | SetExponent (float)
virtual float | GetExponent ()
virtual void | SetConeAngle (float)
virtual float | GetConeAngle ()
virtual void | SetAttenuationValues (float, float, float)
virtual void | SetAttenuationValues (float[3])
virtual float * | GetAttenuationValues ()
virtual void | GetAttenuationValues (float data[3])
virtual void | SetTransformMatrix (vtkMatrix4x4 *)
virtual vtkMatrix4x4 * | GetTransformMatrix ()
void | GetTransformedPosition (float &a0, float &a1, float &a2)
void | GetTransformedPosition (float a[3])
float * | GetTransformedPosition ()
void | GetTransformedFocalPoint (float &a0, float &a1, float &a2)
void | GetTransformedFocalPoint (float a[3])
float * | GetTransformedFocalPoint ()
void | SetDirectionAngle (float elevation, float azimuth)
void | SetDirectionAngle (float ang[2])
virtual void | SetLightType (int)
virtual int | GetLightType ()
void | SetLightTypeToHeadlight ()
void | SetLightTypeToSceneLight ()
void | SetLightTypeToCameraLight ()
int | LightTypeIsHeadlight ()
int | LightTypeIsSceneLight ()
int | LightTypeIsCameraLight ()
## Static Public Methods
int | IsTypeOf (const char *type)
vtkLight * | SafeDownCast (vtkObject *o)
vtkLight * | New ()
## Protected Methods
| vtkLight ()
| ~vtkLight ()
## Protected Attributes
float | FocalPoint [3]
float | Position [3]
float | Intensity
float | Color [3]
int | Switch
int | Positional
float | Exponent
float | ConeAngle
float | AttenuationValues [3]
vtkMatrix4x4 * | TransformMatrix
float | TransformedFocalPointReturn [3]
float | TransformedPositionReturn [3]
int | LightType

## Member Typedef Documentation

typedef vtkObject vtkLight::Superclass

| Reimplemented from vtkObject. Reimplemented in vtkRIBLight, vtkMesaLight, and vtkOpenGLLight. Definition at line 78 of file vtkLight.h.

## Constructor & Destructor Documentation

vtkLight::vtkLight | ( |  | ) | `[protected]`

vtkLight::~vtkLight | ( |  | ) | `[protected]`

## Member Function Documentation

virtual const char* vtkLight::GetClassName | ( |  | ) | `[virtual]`

| Reimplemented from vtkObject. Reimplemented in vtkRIBLight, vtkMesaLight, and vtkOpenGLLight.

int vtkLight::IsTypeOf | ( | const char * | type | ) | `[static]`

| Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject. Reimplemented in vtkRIBLight, vtkMesaLight, and vtkOpenGLLight.

virtual int vtkLight::IsA | ( | const char * | type | ) | `[virtual]`

| Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject. Reimplemented in vtkRIBLight, vtkMesaLight, and vtkOpenGLLight.

vtkLight* vtkLight::SafeDownCast | ( | vtkObject * | o | ) | `[static]`

| Reimplemented from vtkObject. Reimplemented in vtkRIBLight, vtkMesaLight, and vtkOpenGLLight.

void vtkLight::PrintSelf | ( | ostream & | os,
|  | vtkIndent | indent
| ) | `[virtual]`

| Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes. Reimplemented from vtkObject. Reimplemented in vtkRIBLight, vtkMesaLight, and vtkOpenGLLight.

vtkLight* vtkLight::New | ( |  | ) | `[static]`

| Create a light with the focal point at the origin and its position set to (0,0,1). The light is a SceneLight, its color is white, intensity=1, and the light is turned on. Reimplemented from vtkObject. Reimplemented in vtkRIBLight, vtkMesaLight, and vtkOpenGLLight.

virtual void vtkLight::Render | ( | vtkRenderer * | ,
|  | int |
| ) | `[inline, virtual]`

| Abstract interface to renderer. Each concrete subclass of vtkLight will load its data into the graphics system in response to this method invocation. The actual loading is performed by a vtkLightDevice subclass, which will get created automatically. Reimplemented in vtkRIBLight, vtkMesaLight, and vtkOpenGLLight. Definition at line 90 of file vtkLight.h.

virtual void vtkLight::SetColor | ( | float | ,
|  | float | ,
|  | float |
| ) | `[virtual]`

| Set/Get the color of the light.

virtual void vtkLight::SetColor | ( | float | [3] | ) | `[virtual]`

| Set/Get the color of the light.

virtual float* vtkLight::GetColor | ( |  | ) | `[virtual]`

| Set/Get the color of the light.

virtual void vtkLight::GetColor | ( | float | data[3] | ) | `[virtual]`

| Set/Get the color of the light.

virtual void vtkLight::SetPosition | ( | float | ,
|  | float | ,
|  | float |
| ) | `[virtual]`

| Set/Get the position of the light. Note: The position of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space position, use vtkGetTransformedPosition() instead of vtkGetPosition().

virtual void vtkLight::SetPosition | ( | float | [3] | ) | `[virtual]`

| Set/Get the position of the light. Note: The position of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space position, use vtkGetTransformedPosition() instead of vtkGetPosition().

virtual float* vtkLight::GetPosition | ( |  | ) | `[virtual]`

| Set/Get the position of the light. Note: The position of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space position, use vtkGetTransformedPosition() instead of vtkGetPosition().

virtual void vtkLight::GetPosition | ( | float | data[3] | ) | `[virtual]`

| Set/Get the position of the light. Note: The position of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space position, use vtkGetTransformedPosition() instead of vtkGetPosition().

void vtkLight::SetPosition | ( | double * | a | ) | `[inline]`

| Set/Get the position of the light. Note: The position of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space position, use vtkGetTransformedPosition() instead of vtkGetPosition(). Definition at line 105 of file vtkLight.h.

virtual void vtkLight::SetFocalPoint | ( | float | ,
|  | float | ,
|  | float |
| ) | `[virtual]`

| Set/Get the point at which the light is shining. Note: The focal point of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space focal point, use vtkGetTransformedFocalPoint() instead of vtkGetFocalPoint().

virtual void vtkLight::SetFocalPoint | ( | float | [3] | ) | `[virtual]`

| Set/Get the point at which the light is shining. Note: The focal point of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space focal point, use vtkGetTransformedFocalPoint() instead of vtkGetFocalPoint().

virtual float* vtkLight::GetFocalPoint | ( |  | ) | `[virtual]`

| Set/Get the point at which the light is shining. Note: The focal point of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space focal point, use vtkGetTransformedFocalPoint() instead of vtkGetFocalPoint().

virtual void vtkLight::GetFocalPoint | ( | float | data[3] | ) | `[virtual]`

| Set/Get the point at which the light is shining. Note: The focal point of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space focal point, use vtkGetTransformedFocalPoint() instead of vtkGetFocalPoint().

void vtkLight::SetFocalPoint | ( | double * | a | ) | `[inline]`

| Set/Get the point at which the light is shining. Note: The focal point of the light is defined in the coordinate space indicated by its transformation matrix (if it exists). Thus, to get the light's world space focal point, use vtkGetTransformedFocalPoint() instead of vtkGetFocalPoint(). Definition at line 119 of file vtkLight.h.

virtual void vtkLight::SetIntensity | ( | float |  | ) | `[virtual]`

| Set/Get the brightness of the light (from one to zero).

virtual float vtkLight::GetIntensity | ( |  | ) | `[virtual]`

| Set/Get the brightness of the light (from one to zero).

virtual void vtkLight::SetSwitch | ( | int |  | ) | `[virtual]`

| Turn the light on or off.

virtual int vtkLight::GetSwitch | ( |  | ) | `[virtual]`

| Turn the light on or off.

virtual void vtkLight::SwitchOn | ( |  | ) | `[virtual]`

| Turn the light on or off.

virtual void vtkLight::SwitchOff | ( |  | ) | `[virtual]`

| Turn the light on or off.

virtual void vtkLight::SetPositional | ( | int |  | ) | `[virtual]`

| Turn positional lighting on or off.

virtual int vtkLight::GetPositional | ( |  | ) | `[virtual]`

| Turn positional lighting on or off.

virtual void vtkLight::PositionalOn | ( |  | ) | `[virtual]`

| Turn positional lighting on or off.

virtual void vtkLight::PositionalOff | ( |  | ) | `[virtual]`

| Turn positional lighting on or off.

virtual void vtkLight::SetExponent | ( | float |  | ) | `[virtual]`

| Set/Get the exponent of the cosine used in positional lighting.

virtual float vtkLight::GetExponent | ( |  | ) | `[virtual]`

| Set/Get the exponent of the cosine used in positional lighting.

virtual void vtkLight::SetConeAngle | ( | float |  | ) | `[virtual]`

| Set/Get the lighting cone angle of a positional light in degrees. A value of 180 indicates that you want no spot lighting effects just a positional light.

virtual float vtkLight::GetConeAngle | ( |  | ) | `[virtual]`

| Set/Get the lighting cone angle of a positional light in degrees. A value of 180 indicates that you want no spot lighting effects just a positional light.

virtual void vtkLight::SetAttenuationValues | ( | float | ,
|  | float | ,
|  | float |
| ) | `[virtual]`

| Set/Get the quadratic attenuation constants. They are specified as constant, linear, and quadratic, in that order.

virtual void vtkLight::SetAttenuationValues | ( | float | [3] | ) | `[virtual]`

| Set/Get the quadratic attenuation constants. They are specified as constant, linear, and quadratic, in that order.

virtual float* vtkLight::GetAttenuationValues | ( |  | ) | `[virtual]`

| Set/Get the quadratic attenuation constants. They are specified as constant, linear, and quadratic, in that order.

virtual void vtkLight::GetAttenuationValues | ( | float | data[3] | ) | `[virtual]`

| Set/Get the quadratic attenuation constants. They are specified as constant, linear, and quadratic, in that order.

virtual void vtkLight::SetTransformMatrix | ( | vtkMatrix4x4 * |  | ) | `[virtual]`

| Set/Get the light's transformation matrix. If a matrix is set for a light, the light's parameters (position and focal point) are transformed by the matrix before being rendered.

virtual vtkMatrix4x4* vtkLight::GetTransformMatrix | ( |  | ) | `[virtual]`

| Set/Get the light's transformation matrix. If a matrix is set for a light, the light's parameters (position and focal point) are transformed by the matrix before being rendered.

void vtkLight::GetTransformedPosition | ( | float & | a0,
|  | float & | a1,
|  | float & | a2
| ) |

| Get the position of the light, modified by the transformation matrix (if it exists).

void vtkLight::GetTransformedPosition | ( | float | a[3] | ) |

| Get the position of the light, modified by the transformation matrix (if it exists).

float* vtkLight::GetTransformedPosition | ( |  | ) |

| Get the position of the light, modified by the transformation matrix (if it exists).

void vtkLight::GetTransformedFocalPoint | ( | float & | a0,
|  | float & | a1,
|  | float & | a2
| ) |

| Get the focal point of the light, modified by the transformation matrix (if it exists).

void vtkLight::GetTransformedFocalPoint | ( | float | a[3] | ) |

| Get the focal point of the light, modified by the transformation matrix (if it exists).

float* vtkLight::GetTransformedFocalPoint | ( |  | ) |

| Get the focal point of the light, modified by the transformation matrix (if it exists).

void vtkLight::SetDirectionAngle | ( | float | elevation,
|  | float | azimuth
| ) |

| Set the position and focal point of a light based on elevation and azimuth. The light is moved so it is shining from the given angle. Angles are given in degrees. If the light is a positional light, it is made directional instead.

void vtkLight::SetDirectionAngle | ( | float | ang[2] | ) | `[inline]`

| Set the position and focal point of a light based on elevation and azimuth. The light is moved so it is shining from the given angle. Angles are given in degrees. If the light is a positional light, it is made directional instead. Definition at line 196 of file vtkLight.h.

void vtkLight::DeepCopy | ( | vtkLight * | light | ) |

| Perform deep copy of this light.

virtual void vtkLight::SetLightType | ( | int |  | ) | `[virtual]`

| Set/Get the type of the light. A SceneLight is a light located in the world coordinate space. A light is initially created as a scene light. A Headlight is always located at the camera and is pointed at the camera's focal point. The renderer is free to modify the position and focal point of the camera at any time. A CameraLight is also attached to the camera, but is not necessarily located at the camera's position. CameraLights are defined in a coordinate space where the camera is located at (0, 0, 1), looking towards (0, 0, 0) at a distance of 1, with up being (0, 1, 0). Note: Use SetLightTypeToSceneLight, rather than SetLightType(3), since the former clears the light's transform matrix.

virtual int vtkLight::GetLightType | ( |  | ) | `[virtual]`

| Set/Get the type of the light. A SceneLight is a light located in the world coordinate space. A light is initially created as a scene light. A Headlight is always located at the camera and is pointed at the camera's focal point. The renderer is free to modify the position and focal point of the camera at any time. A CameraLight is also attached to the camera, but is not necessarily located at the camera's position. CameraLights are defined in a coordinate space where the camera is located at (0, 0, 1), looking towards (0, 0, 0) at a distance of 1, with up being (0, 1, 0). Note: Use SetLightTypeToSceneLight, rather than SetLightType(3), since the former clears the light's transform matrix.

void vtkLight::SetLightTypeToHeadlight | ( |  | ) | `[inline]`

| Set/Get the type of the light. A SceneLight is a light located in the world coordinate space. A light is initially created as a scene light. A Headlight is always located at the camera and is pointed at the camera's focal point. The renderer is free to modify the position and focal point of the camera at any time. A CameraLight is also attached to the camera, but is not necessarily located at the camera's position. CameraLights are defined in a coordinate space where the camera is located at (0, 0, 1), looking towards (0, 0, 0) at a distance of 1, with up being (0, 1, 0). Note: Use SetLightTypeToSceneLight, rather than SetLightType(3), since the former clears the light's transform matrix. Definition at line 216 of file vtkLight.h. References VTK_LIGHT_TYPE_HEADLIGHT.

void vtkLight::SetLightTypeToSceneLight | ( |  | ) | `[inline]`

| Set/Get the type of the light. A SceneLight is a light located in the world coordinate space. A light is initially created as a scene light. A Headlight is always located at the camera and is pointed at the camera's focal point. The renderer is free to modify the position and focal point of the camera at any time. A CameraLight is also attached to the camera, but is not necessarily located at the camera's position. CameraLights are defined in a coordinate space where the camera is located at (0, 0, 1), looking towards (0, 0, 0) at a distance of 1, with up being (0, 1, 0). Note: Use SetLightTypeToSceneLight, rather than SetLightType(3), since the former clears the light's transform matrix. Definition at line 218 of file vtkLight.h. References VTK_LIGHT_TYPE_SCENE_LIGHT.

void vtkLight::SetLightTypeToCameraLight | ( |  | ) | `[inline]`

| Set/Get the type of the light. A SceneLight is a light located in the world coordinate space. A light is initially created as a scene light. A Headlight is always located at the camera and is pointed at the camera's focal point. The renderer is free to modify the position and focal point of the camera at any time. A CameraLight is also attached to the camera, but is not necessarily located at the camera's position. CameraLights are defined in a coordinate space where the camera is located at (0, 0, 1), looking towards (0, 0, 0) at a distance of 1, with up being (0, 1, 0). Note: Use SetLightTypeToSceneLight, rather than SetLightType(3), since the former clears the light's transform matrix. Definition at line 223 of file vtkLight.h. References VTK_LIGHT_TYPE_CAMERA_LIGHT.

int vtkLight::LightTypeIsHeadlight | ( |  | ) |

| Query the type of the light.

int vtkLight::LightTypeIsSceneLight | ( |  | ) |

| Query the type of the light.

int vtkLight::LightTypeIsCameraLight | ( |  | ) |

| Query the type of the light.

void vtkLight::ReadSelf | ( | istream & | is | ) |

void vtkLight::WriteSelf | ( | ostream & | os | ) |

## Member Data Documentation

float vtkLight::FocalPoint[3]`[protected]`

| Definition at line 241 of file vtkLight.h.

float vtkLight::Position[3]`[protected]`

| Definition at line 242 of file vtkLight.h.

float vtkLight::Intensity`[protected]`

| Definition at line 243 of file vtkLight.h.

float vtkLight::Color[3]`[protected]`

| Definition at line 244 of file vtkLight.h.

int vtkLight::Switch`[protected]`

| Definition at line 245 of file vtkLight.h.

int vtkLight::Positional`[protected]`

| Definition at line 246 of file vtkLight.h.

float vtkLight::Exponent`[protected]`

| Definition at line 247 of file vtkLight.h.

float vtkLight::ConeAngle`[protected]`

| Definition at line 248 of file vtkLight.h.

float vtkLight::AttenuationValues[3]`[protected]`

| Definition at line 249 of file vtkLight.h.

vtkMatrix4x4* vtkLight::TransformMatrix`[protected]`

| Definition at line 250 of file vtkLight.h.

float vtkLight::TransformedFocalPointReturn[3]`[protected]`

| Definition at line 251 of file vtkLight.h.

float vtkLight::TransformedPositionReturn[3]`[protected]`

| Definition at line 252 of file vtkLight.h.

int vtkLight::LightType`[protected]`

| Definition at line 253 of file vtkLight.h.

The documentation for this class was generated from the following file:

- Rendering/vtkLight.h