class Light

The abstract interface to all kinds of lights. The actual light objects also inherit from PandaNode, and can therefore be added to the scene graph at some arbitrary point to define the coordinate system of effect.

Inheritance diagram

Inheritance diagram of Light

virtual PandaNode *as_node(void) = 0
virtual LVecBase3 const &get_attenuation(void) const

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.

virtual int get_class_priority(void) const = 0
static TypeHandle get_class_type(void)
LColor const &get_color(void) const

Returns the basic color of the light.

PN_stdfloat get_color_temperature(void) const

Returns the basic color temperature of the light, assuming has_color_temperature() returns true.

New in version 1.10.0.

virtual PN_stdfloat get_exponent(void) const

For spotlights, returns the exponent that controls the amount of light falloff from the center of the spotlight. For other kinds of lights, returns 0.

int get_priority(void) const

Returns the priority associated with this light. See set_priority().

virtual LColor const &get_specular_color(void) const

Returns the color of specular highlights generated by the light. This value is meaningless for ambient lights.

bool has_color_temperature(void) const

Returns true if the color was specified as a temperature in kelvins, and get_color_temperature is defined.

New in version 1.10.0.

virtual bool is_ambient_light(void) const

Returns true if this is an AmbientLight, false if it is some other kind of light.

void set_color(LColor const &color)

Sets the basic color of the light.

void set_color_temperature(PN_stdfloat temperature)

Sets the color temperature of the light in kelvins. This will recalculate the light’s color.

The default value is 6500 K, corresponding to a perfectly white light assuming a D65 white point.

New in version 1.10.0.

void set_priority(int priority)

Changes the relative importance of this light relative to the other lights that are applied simultaneously.

The priority number is used to decide which of the requested lights are to be selected for rendering when more lights are requested than the hardware will support. The highest-priority n lights are selected for rendering.

This is similar to TextureStage::set_priority().