[osg-users] Fast move a lot of nodes to another group

Robert Osfield robert.osfield at gmail.com
Thu Apr 6 01:09:22 PDT 2017

Hi Yura,

On 6 April 2017 at 06:16, Yura Ivanov <dev3d at protonmail.com> wrote:
> When I put my nodes into subgroups, removeChild becoming fast and cull is faster. Thank you.
> Is there any functions to make tree like structure of my group, or i must do it by hand?

For optimal performance a balanced quad tree is typically best for
scene graph applications, while groups containing a large number of
children breaks this efficiency forcing the traversals to visit all
children all the time.

The osgUtil::Optimizer::SpatializeGroupsVisitor can be used to
reorganize large flat groups of children into a quad tree.  You can
call this visitor on it's own or as part of the wider
Optimizer::optimizer(Node*,int options) operation if you include the
osgUtil::OptimizeSPATIALIZE_GROUPS bit mask to the options parameter.
The class can be found in include/osgUtil/Optimizer.


More information about the osg-users mailing list