[osg-users] How to get all visible nodes

Robert Osfield robert.osfield at gmail.com
Wed Sep 30 01:03:39 PDT 2015


HI Artem,

Just write a NodeVisitor that has it's traversal mode set to
TRAVERSE_ALL_CHILDREN i.e.

class FindAllNodes : public osg::NodeVisitor
{
public:
        FindAllNodes():
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHIILDREN) {}

       void apply(osg::Node& node)
       {
                std::cout<<"Visiting node "<<&node<<std::endl;
                traverse(node);
       }
};

...

FindAllNodes findAllNodes;
viewer.getSceneData()->accept(findAllnodes));


Robert.


..



On 29 September 2015 at 14:52, Artem Ivanov <tema.krukovets at gmail.com>
wrote:

> Hi,
>
> I'm new to OSG, so I think I have simple question, but I cannot find
> answer for it.
> Actually I'm working with osgEarth and have some osgEarth::PlaceNodes on
> the terrain, some models and so on.
> So, I have lots of views.
>
> For some needs, I need a mechanism which will allow me to get all the
> views inside a screen
> (I mean which are visible to me at the moment and which are inside my
> screen).
> I didn't find any information about the way I can implement this.
>
> I'm sure that I've missed something.
> I would appreciate any help with this.
>
> Thank you!
>
> Cheers,
> Artem
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=65244#65244
>
>
>
>
>
> _______________________________________________
> 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/20150930/fc3b05a3/attachment-0003.htm>


More information about the osg-users mailing list