Hello Tom,
Tom H wrote:
> Hi,
> I have been using openscenegraph(osg) for a while and now switching to
> opensg. I have a question about opensg in general. Why is it necessary
> to use
>
> beginEditCP() and endEditCP macros, e.g.
>
> beginEditCP(root, Node::CoreFieldMask);
>
> root->setCore(sun);
>
> endEditCP(root, Node::CoreFieldMask);
>
> There is no such thing in osg. I supposed those are mutex locking mechanisms.
the nice thing about OpenSG is that it tries hard to keep locks out of
the picture as much as possible.
It uses a mechanism called aspects (basically lazy copies of the
scenegraph) and records/transports changes made from one aspect to
another. This allows modification of the scene in one thread (associated
with one aspect) without disturbing the render thread (associated with
another aspect) for example.
beginEditCP places an entry into the current threads ChangeList to
record that the fields given by the mask where modified. endEditCP
triggers a call to the changed function so that derived values can be
updated. When synchronizing aspects only fields recorded in the
ChangeList as modified are copied.
Since the verbosity of the begin/endEditCP calls is indeed quite
annoying we actually got rid of them for OpenSG 2, there is only the
equivalent of endEditCP (now called commitChanges) which updates derived
values after you have completed a number of related changes.
> If so, why not put them with the correct mask in setCore() function, so that
> the user don't have to deal with them.
that is more or less what OpenSG 2 does. Initially it was thought to be
too expensive to perform this recording on each call to a mutating
function. Internal changes in 2 now reduce this cost so that the
convenience of not having to call begin/endEditCP outweighs the
performance impact.
Cheers,
Carsten
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users