From 17ba5c39b0da7c7d26794b4adf97d127e5d8e1c2 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 29 Mar 2002 17:55:32 +0000 Subject: [PATCH] add_light, remove_light --- panda/src/pgraph/lightAttrib.I | 31 +++++++++++++++++++++++++++++++ panda/src/pgraph/lightAttrib.h | 3 +++ 2 files changed, 34 insertions(+) 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;