On 7 May 2010 01:35, Paul Martz <[email protected]> wrote:
> Andrew Cunningham wrote:
>
>> Hi,
>> May I am not seeing something here, but using the NodeMask seems to be not
>> able to handle 'multiple' states.
>>
>> For example, I am using a mask ,0x01 to control the 'visibility' of the
>> nodes. This works great.
>>
>> I have another mask to control 'pickable' state of the node, say 0x02 when
>> used with IntersectionVisitor.
>> Obviously a node that is not visible is not pickable. That is (pickable &&
>> !visible) should be culled during a IntersectionVisitor traversal
>>
>> Therein lies the problem that I see. A simple "bitwise AND" is performed
>> between the traversal mask and the node mask and the result compared to 0.
>>
>> There is no mask that can be passed to IntersectionVisitor that will cull
>> (pickable && !visible). As long as the pickable bit is on, the node will
>> always be traversed.
>>
>
> Maybe I'm stating the obvious but, you appear to be overriding the visible
> bit to mean both visible and pickable. But you already have a pickable bit.
> So there's no reason to override the visible bit for pickability. Use the
> visible bit for visibility, and the pickable bit for pickability, and it
> should work fine. Or am I missing something?
>
> Yes, he wants to only pick objects which are pickable AND visible.
Which you can't do just using a node mask, you'll get anything which is
pickable OR visible.
Andrew:
The easiest way is to derive your own visitor and override apply(Node&)
void NodeVisitor::apply(Node& node)
{
if(isPickableAndVisible(node)
traverse(node);
}
--
http://www.ssTk.co.uk
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org