[osg-users] Fast move a lot of nodes to another group
Sebastian Messerschmidt
sebastian.messerschmidt at gmx.de
Mon Apr 10 02:06:23 PDT 2017
Hi Yura,
> Hi,
>
> Quads are unique and images are different.
> Sorry but I cant make screenshot of real images because of author. It is just like big puzzle. This is editor, and user decides how many objects can be.
> I am using PagedLods to draw images and have no problem with memory. I have problem with moving a lot of nodes by user input. If I put put them into matrix i can move only it. This is fast but i need to move nodes to another group. Maybe I can use NodeCallback?
I think you need to think outside of the box here. There is more than
one way to draw a collection of quads. You could render them as a big
vertex array or even instanced and modify the sub-region of your vertex
buffer/instance matrices instead of moving individual nodes around. If
you need individual texturing, that still could be done via texture
arrays or atlas-texturing.
If you absolutely want to keep them in your tree-structure you can still
keep duplicates and simply turn them off by setting an appropriate
node-mask (copy them to the new transform and disable drawing in the
original group),
As a second step you could periodically sort the child vectors by the
nodemask and batch-remove non-drawn childs from it (this is faster,
since sorting doesn't need to resize the vector and removing a
contiguous number of elements from the end of a vector is essentially free).
You could also apply the sort-prune algorithm in a custom osg::Group
which will mark elements to be deleted instead of directly removing
them. In the update phase it then could efficiently batch-sort and remove.
Anyways, this all theory as it still unclear what you want to achieve
with your puzzle. We need more details or a small example to look at. If
you cannot present the work, try to create a minimal example to
demonstrate the problem (as a compilable example, so lazy people like me
will take an actual look at it)
Cheers
Sebastian
>
>
> Thank you!
>
> Cheers,
> Yura
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70724#70724
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
More information about the osg-users
mailing list