Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# Spotlight Class Reference

A light originating from a single point in space, and shining in a particular direction, with a cone-shaped falloff. More...

Inheritance diagram for Spotlight:

List of all members.

## Public Member Functions
| Spotlight (string name)
VBase3 const | getAttenuation ()
| Returns the terms of the attenuation equation for the light.
float | getExponent ()
| Returns the exponent that controls the amount of light falloff from the center of the spotlight.
VBase4 const | getSpecularColor ()
| Returns the color of specular highlights generated by the light.
| setAttenuation (VBase3 const attenuation)
| Sets the terms of the attenuation equation for the light.
| setExponent (float exponent)
| Sets the exponent that controls the amount of light falloff from the center of the spotlight.
| setSpecularColor (VBase4 const color)
| Sets the color of specular highlights generated by the light.
## Static Public Member Functions
static TypeHandle | getClassType ()
static Texture | makeSpot (int pixel_width, float full_radius, VBase4 fg, VBase4 bg)
| Returns a newly-generated Texture that renders a circular spot image as might be cast from the spotlight.

## Detailed Description

A light originating from a single point in space, and shining in a particular direction, with a cone-shaped falloff.

The Spotlight frustum is defined using a Lens, so it can have any of the properties that a camera lens can have.

Note that the class is named Spotlight instead of SpotLight, because "spotlight" is a single English word, instead of two words.

## Constructor & Destructor Documentation

Spotlight | ( | string | name | ) |

## Member Function Documentation

VBase3 const getAttenuation | ( |  | ) |

Returns the terms of the attenuation equation for the light.

These are, in order, the constant, linear, and quadratic terms based on the distance from the point to the vertex.

static TypeHandle getClassType | ( |  | ) | `[static]`

Reimplemented from LightLensNode.

float getExponent | ( |  | ) |

Returns the exponent that controls the amount of light falloff from the center of the spotlight.

See set_exponent().

VBase4 const getSpecularColor | ( |  | ) |

Returns the color of specular highlights generated by the light.

static Texture makeSpot | ( | int | pixel_width,
|  | float | full_radius,
|  | VBase4 | fg,
|  | VBase4 | bg
| ) |  | `[static]`

Returns a newly-generated Texture that renders a circular spot image as might be cast from the spotlight.

This may be projected onto target geometry (for instance, via NodePath.project_texture()) instead of actually enabling the light itself, as a cheesy way to make a high-resolution spot appear on the geometry.

pixel_width specifies the height and width of the new texture in pixels, full_radius is a value in the range 0..1 that indicates the relative size of the fully bright center spot, and fg and bg are the colors of the interior and exterior of the spot, respectively.

setAttenuation | ( | VBase3 const | attenuation | ) |

Sets the terms of the attenuation equation for the light.

These are, in order, the constant, linear, and quadratic terms based on the distance from the point to the vertex.

setExponent | ( | float | exponent | ) |

Sets the exponent that controls the amount of light falloff from the center of the spotlight.

The light is attenuated by the cosine of the angle between the direction of the light and the direction of the point being lighted, raised to the power of this exponent. Thus, higher exponents result in a more focused light source, regardless of the field-of-view of the lens.

setSpecularColor | ( | VBase4 const | color | ) |

Sets the color of specular highlights generated by the light.

All Classes Namespaces Functions Variables Enumerations Enumerator Properties