Thank you Sergey. I knew there had to be a better way.

Cory

On 6/24/2011 7:00 AM, Sergey Polischuk wrote:
> Hi, Cory
>
> You can write technique for outline effect to use additional passes with 
> different settings, and add different cull masks to each pass, so you can use 
> effect node at top of your graph and apply masks on nodes to get correct 
> effect passes running on them.
>
> You will need to change traverse method like this:
>               void traverse(osg::NodeVisitor& nv, osgFX::Effect* fx)
>               {
>                       if (!getNumPasses())
>                       {
>                               define_passes();
>                       }
>
>                       osgUtil::CullVisitor *cv = 
> dynamic_cast<osgUtil::CullVisitor *>(&nv);
>                       if (!cv) return;
>                       unsigned int mask = cv->getTraversalMask();
>
>                       for (unsigned i=0; i<getNumPasses(); ++i)
>                       {
>                               if (cv)
>                               {
>                                       cv->pushStateSet(getPassStateSet(i));
>                               }
>
>                               if (i < masks.size())
>                               {
>                                       cv->setTraversalMask(masks[i]);
>                                       fx->inherited_traverse(nv);
>                               }
>                               else
>                               {
>                                       cv->setTraversalMask(mask);
>                                       fx->inherited_traverse(nv);
>                               }
>
>                               if (cv)
>                               {
>                                       cv->popStateSet();
>                               }
>                       }
>                       cv->setTraversalMask(mask);
>               }
>
> masks is vector with traverse masks to be used by cull visitor for each pass.
>
> Cheers,
> Sergey.
>
>
> 23.06.2011, 23:18, "Cory Riddell" <[email protected]>:
>> I've been playing with the osgFX classes and I'm thinking about using
>> osgFX::Outline() to highlight the node(s) under the mouse.
>>
>> First, I would need a list of highlighted nodes. Initially it would be
>> empty.
>>
>> Every highlightable node would have a parent osgFX::Outline instance
>> with an initial thin black outline.
>>
>> I would handle osgGA::GUIEventAdapter::MOVE events. Using the
>> osgUtil::LineSegmentIntersector to find what's under the mouse pointer.
>> I would compare my list of nodes under the mouse pointer with my list of
>> highlighted nodes. Any nodes on the highlighted list not under the
>> mouse, would be reverted to a thin black outline. Any nodes under the
>> mouse would get a thicker, yellow outline. The list of highlighted nodes
>> would be updated to reflect the current state.
>>
>> Is this reasonable? Is having an osgFX::Outline instance on every node a
>> heavy way of accomplishing this? Is hit-testing every move event crazy?
>>
>> Alternatively, I thought about just lightening the face color of every
>> node under the mouse. This wouldn't require any osgFX::Outline() nodes.
>>
>> Thanks,
>> Cory
>> _______________________________________________
>> 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
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to