Hi, Robert

Fourth method looks good to me.


I have difficulties in imagining the situation when one calls 
setAttribute( SOME_NON_DEFAULT_VALUE ) and does not change inheritance mask. 
It does not make much sense to me, because not setting mask does effectively 
ignore the attribute.

On the other hand if someone wants to reset attribute:
     he may set it either with setAttribute( DEFAULT_VALUE ) to safeguard 
from inheritance override
or
    simply activating inheritance mask bit allowing inheritance override.

So in practice there are 3 cases of usage and I think that they can be 
served with option #5:

setAttribute( ) would always clear inheritance flag.

but also add a method:

inheritAttribute( ) which would set the inheritance flag and reset attribute 
to default.

But it is just a thought, I don't want to complicate things more : option #4 
works for me ;-)

Wojtek


----- Original Message ----- 
From: "Robert Osfield" <[EMAIL PROTECTED]>
To: "OpenSceneGraph Users" <[email protected]>
Sent: Wednesday, March 19, 2008 10:55 AM
Subject: Re: [osg-users] osgShadow example and gerneral question


> 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
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to