Hi Mark, Wojtek et. al,

On Wed, Mar 19, 2008 at 1:17 AM, Mark Sciabica <[EMAIL PROTECTED]> wrote:
> I think #3 is a good option, but I would like to suggest using an
>  interface similar to that used for state attributes. I.e. use an
>  enumeration for the possible values instead of a bool, even if only
>  two values are needed initially. Having a more uniform interface for
>  handling inheritance in the scene graph will lessen the learning
>  curve.

I have also been thinking about option #3 an use a enum.  And also
been thinking about another option related to option #3.  A glimpse of
the enum:

        enum InheritanceMaskActionOnAttributeSetting
        {
            DISABLE_ASSOCIATED_INHERITANCE_MASK_BIT,
            DO_NOT_MODIFY_INHERITANCE_MASK
        };

And the set methods would be like:
        void setImpostorsActive(bool active,
InheritanceMaskActionOnAttributeSetting
action=DISABLE_ASSOCICATED_INHERITANCE_MASK_BIT);

I take I'm not the only one that finds this a little too much of a
mouthful, and kinda obscures the important bit - the set method name
and its primary parameter.  One could go for a simpler enum name, but
in the end the bool is far less intrusive.

The other approach is to do modify the setAttribute() signature, but
instead have a separate method so setting the action i.e

  void 
setInheritanceMaskActionOnAttributeSetting(InheritanceMaskActionOnAttributeSetting
action);
  InheritanceMaskActionOnAttributeSetting
getInheritanceMaskActionOnAttributeSetting() const;

Then in the set methods we'd have:

   void setImpostorsActive(bool active)
  {
       _impostorActive = active;
       if 
(_inheritanceMaskActionOnAttributeSetting==DISABLE_ASSOCICATED_INHERITANCE_MASK_BIT)
       {
            _inheritanceMask = _inheritanceMask & (~IMPOSTOR_ACTIVE);
       }
   }

We'd let _inheritanceMaskActionOnAttributeSetting default to
DISABLE_ASSOCICATED_INHERITANCE_MASK_BIT.

This forth approach is currently my favoured as its least intrusive
w.r.t setAttribute() method parameters, but... I'm not overly happy
with the behind the scenes automatic setting of other parameters.
Doxygen comments can come in to solve this one though.

Thoughts?

Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to