[osg-users] Managing scene graph for picked/unpicked objects
Robert Osfield
robert.osfield at gmail.com
Tue Mar 29 01:02:20 PDT 2016
Hi Lee,
There a couple of different ways to manage things.
1) manage a list of picked nodes separate from the scene graph
2) Use osg::Object::setUserValue() functionality i.e.
node->setUserValue("picked",true);
bool picked;
if (node->getUserValue("picked",picked) && picked) { // node is
picked; }
3) Insert /remove osgFX::Scribe node above each of the picked subgraphs,
and use the presence of the Scribe node to determine if a subgraph is
picked
4) Implement a CullCallback that implements the mutlipass technique that
osgFX::Scribe
implements, assigning this to the top node of the subgraph being picked.
You can then search in the scene graph and if it's has this custom
ScribeCullCallback
you know it's picked. The advantage with approach is that you aren'
inserting/removing
nodes from the scene graph, just assigned or removing a cull callback.
Potentially you could put a flag in the cull callback to toggle it
on/off rather than have it
assigned and removed from node.
Robert.
On 28 March 2016 at 18:46, Lee Butler <iraytrace at gmail.com> wrote:
> How do you manage the scene graph for picked objects? That is, how do you
> structure the graph to track selected vs. not selected objects? Do you
> (for example) insert an osgFX::Scribe node between each selected node and
> its parent? Do you create a single osgFX::Scribe node and move nodes into
> it? What is the best way to keep track of where they should return to once
> they are unselected? Is there a better way I am not thinking of?
>
> Lee
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160329/457395b8/attachment-0003.htm>
More information about the osg-users
mailing list