Spotlight

from panda3d.core import Spotlight
class Spotlight

Bases: LightLensNode

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.

Inheritance diagram

Inheritance diagram of Spotlight

__init__(*args, **kwargs)
attenuation
clearSpecularColor()

C++ Interface: clear_specular_color(const Spotlight self)

/**
  • Clears a custom specular color setting, meaning that the specular color

  • will now come from the color.

*/

clear_specular_color()

C++ Interface: clear_specular_color(const Spotlight self)

/**
  • Clears a custom specular color setting, meaning that the specular color

  • will now come from the color.

*/

exponent
getClassType()

C++ Interface: get_class_type()

getMaxDistance()

C++ Interface: get_max_distance(Spotlight self)

/**
  • Returns the maximum distance at which the light has any effect, as previously

  • specified by set_max_distance.

*/

get_class_type()

C++ Interface: get_class_type()

get_max_distance()

C++ Interface: get_max_distance(Spotlight self)

/**
  • Returns the maximum distance at which the light has any effect, as previously

  • specified by set_max_distance.

*/

makeSpot()

C++ Interface: make_spot(int pixel_width, float full_radius, LVecBase4f fg, LVecBase4f bg)

/**
  • 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.

*/

make_spot()

C++ Interface: make_spot(int pixel_width, float full_radius, LVecBase4f fg, LVecBase4f bg)

/**
  • 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.

*/

max_distance
setAttenuation()

C++ Interface: set_attenuation(const Spotlight self, const LVecBase3f 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()

C++ Interface: set_exponent(const Spotlight self, 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.

*/

setMaxDistance()

C++ Interface: set_max_distance(const Spotlight self, float max_distance)

/**
  • Sets the radius of the light’s sphere of influence. Beyond this distance, the

  • light may be attenuated to zero, if this is supported by the shader.

*/

setSpecularColor()

C++ Interface: set_specular_color(const Spotlight self, const LVecBase4f color)

/**
  • Sets the color of specular highlights generated by the light.

*/

set_attenuation()

C++ Interface: set_attenuation(const Spotlight self, const LVecBase3f 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.

*/

set_exponent()

C++ Interface: set_exponent(const Spotlight self, 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.

*/

set_max_distance()

C++ Interface: set_max_distance(const Spotlight self, float max_distance)

/**
  • Sets the radius of the light’s sphere of influence. Beyond this distance, the

  • light may be attenuated to zero, if this is supported by the shader.

*/

set_specular_color()

C++ Interface: set_specular_color(const Spotlight self, const LVecBase4f color)

/**
  • Sets the color of specular highlights generated by the light.

*/

specular_color