diff --git a/panda/src/pgraph/lightAttrib.I b/panda/src/pgraph/lightAttrib.I index c78b6322d0..7bac28c836 100644 --- a/panda/src/pgraph/lightAttrib.I +++ b/panda/src/pgraph/lightAttrib.I @@ -65,6 +65,37 @@ get_light(int n) const { return _lights[n]; } +//////////////////////////////////////////////////////////////////// +// Function: LightAttrib::add_light +// Access: Published +// Description: Returns a new LightAttrib, just like this one, but +// with the indicated light added to the list of lights. +//////////////////////////////////////////////////////////////////// +INLINE CPT(RenderAttrib) LightAttrib:: +add_light(Light *light) const { + if (_operation == O_remove) { + return compose(make(O_remove, light)); + } else { + return compose(make(O_add, light)); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: LightAttrib::remove_light +// Access: Published +// Description: Returns a new LightAttrib, just like this one, but +// with the indicated light removed from the list of +// lights. +//////////////////////////////////////////////////////////////////// +INLINE CPT(RenderAttrib) LightAttrib:: +remove_light(Light *light) const { + if (_operation == O_remove) { + return compose(make(O_add, light)); + } else { + return compose(make(O_remove, light)); + } +} + //////////////////////////////////////////////////////////////////// // Function: LightAttrib::is_identity // Access: Published diff --git a/panda/src/pgraph/lightAttrib.h b/panda/src/pgraph/lightAttrib.h index be556eb22c..280aa7056e 100644 --- a/panda/src/pgraph/lightAttrib.h +++ b/panda/src/pgraph/lightAttrib.h @@ -61,6 +61,9 @@ PUBLISHED: INLINE Light *get_light(int n) const; bool has_light(Light *light) const; + INLINE CPT(RenderAttrib) add_light(Light *light) const; + INLINE CPT(RenderAttrib) remove_light(Light *light) const; + INLINE bool is_identity() const; INLINE bool is_all_off() const;