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.
Spotlight(std::string const &name)
Do not call the copy constructor directly; instead, use
copy_subgraph()to make a copy of a node.
Clears a custom specular color setting, meaning that the specular color will now come from the color.
static TypeHandle get_class_type(void)
PN_stdfloat get_max_distance(void) const
Returns the maximum distance at which the light has any effect, as previously specified by
static PointerTo<Texture> make_spot(int pixel_width, PN_stdfloat full_radius, LColor &fg, LColor &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.
void set_attenuation(LVecBase3 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.
void set_exponent(PN_stdfloat 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.
void set_max_distance(PN_stdfloat 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.
- Spotlight(std::string const &name)