LightAttrib

class LightAttrib

Bases: RenderAttrib

Indicates which set of lights should be considered “on” to illuminate geometry at this level and below. A LightAttrib can either add lights or remove lights from the total set of “on” lights.

Inheritance diagram

Inheritance diagram of LightAttrib

enum Operation

This is the old, deprecated interface to LightAttrib. Do not use any of these methods for new code; these methods will be removed soon.

enumerator O_set = 0
enumerator O_add = 1
enumerator O_remove = 2
ConstPointerTo<RenderAttrib> add_light(Light *light) const

Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights.

Deprecated: Use add_on_light() or add_off_light() instead.

ConstPointerTo<RenderAttrib> add_off_light(NodePath const &light) const

Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights turned off by this attrib.

ConstPointerTo<RenderAttrib> add_on_light(NodePath const &light) const

Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights turned on by this attrib.

LColor get_ambient_contribution(void) const

Returns the total contribution of all the ambient lights.

static int get_class_slot(void)
static TypeHandle get_class_type(void)
Light *get_light(int n) const

Returns the nth light listed in the attribute.

Deprecated: LightAttribs nowadays have a separate list of on_lights and

off_lights, so this method no longer makes sense. Query the lists independently.

NodePath get_most_important_light(void) const

Returns the most important light (that is, the light with the highest priority) in the LightAttrib, excluding any ambient lights. Returns an empty NodePath if no non-ambient lights are found.

int get_num_lights(void) const

Returns the number of lights listed in the attribute.

Deprecated: LightAttribs nowadays have a separate list of on_lights and

off_lights, so this method no longer makes sense. Query the lists independently.

std::size_t get_num_non_ambient_lights(void) const

Returns the number of non-ambient lights that are turned on by this attribute.

std::size_t get_num_off_lights(void) const

Returns the number of lights that are turned off by the attribute.

std::size_t get_num_on_lights(void) const

Returns the number of lights that are turned on by the attribute.

NodePath get_off_light(std::size_t n) const

Returns the nth light turned off by the attribute, sorted in arbitrary (pointer) order.

NodePath get_on_light(std::size_t n) const

Returns the nth light turned on by the attribute, sorted in render order.

Operation get_operation(void) const

Returns the basic operation type of the LightAttrib. If this is O_set, the lights listed here completely replace any lights that were already on. If this is O_add, the lights here are added to the set of lights that were already on, and if O_remove, the lights here are removed from the set of lights that were on.

Deprecated: LightAttribs nowadays have a separate list of on_lights and

off_lights, so this method no longer makes sense. Query the lists independently.

bool has_all_off(void) const

Returns true if this attrib turns off all lights (although it may also turn some on).

bool has_any_on_light(void) const

Returns true if any light is turned on by the attrib, false otherwise.

bool has_light(Light *light) const

Returns true if the indicated light is listed in the attrib, false otherwise.

Deprecated: LightAttribs nowadays have a separate list of on_lights and

off_lights, so this method no longer makes sense. Query the lists independently.

bool has_off_light(NodePath const &light) const

Returns true if the indicated light is turned off by the attrib, false otherwise.

bool has_on_light(NodePath const &light) const

Returns true if the indicated light is turned on by the attrib, false otherwise.

bool is_identity(void) const

Returns true if this is an identity attrib: it does not change the set of lights in use.

static ConstPointerTo<RenderAttrib> make(LightAttrib::Operation op, Light *light)
static ConstPointerTo<RenderAttrib> make(LightAttrib::Operation op, Light *light1, Light *light2)
static ConstPointerTo<RenderAttrib> make(LightAttrib::Operation op, Light *light1, Light *light2, Light *light3)
static ConstPointerTo<RenderAttrib> make(LightAttrib::Operation op, Light *light1, Light *light2, Light *light3, Light *light4)
static ConstPointerTo<RenderAttrib> make(void)

The following is the new, more general interface to the LightAttrib.

Constructs a new LightAttrib object that turns on (or off, according to op) the indicated light(s).

Deprecated: Use add_on_light() or add_off_light() instead.

Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s).

Deprecated: Use add_on_light() or add_off_light() instead.

Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s).

Deprecated: Use add_on_light() or add_off_light() instead.

Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s).

Deprecated: Use add_on_light() or add_off_light() instead.

Constructs a new LightAttrib object that does nothing.

static ConstPointerTo<RenderAttrib> make_all_off(void)

Constructs a new LightAttrib object that turns off all lights (and hence disables lighting).

static ConstPointerTo<RenderAttrib> make_default(void)

Returns a RenderAttrib that corresponds to whatever the standard default properties for render attributes of this type ought to be.

ConstPointerTo<RenderAttrib> remove_light(Light *light) const

Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights.

Deprecated: Use remove_on_light() or remove_off_light() instead.

ConstPointerTo<RenderAttrib> remove_off_light(NodePath const &light) const

Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights turned off by this attrib.

ConstPointerTo<RenderAttrib> remove_on_light(NodePath const &light) const

Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights turned on by this attrib.

ConstPointerTo<RenderAttrib> replace_off_light(NodePath const &source, NodePath const &dest) const

Returns a new LightAttrib, just like this one, but with the indicated light replaced with the given other light.

ConstPointerTo<RenderAttrib> replace_on_light(NodePath const &source, NodePath const &dest) const

Returns a new LightAttrib, just like this one, but with the indicated light replaced with the given other light.