Hello Enrico,

Enrico Borrione wrote:
> Hi OpenSG users,
>       in my application i have a fairly big library of models which i use
> as prototypes
> to build different pieces of a scene. Till the time being I just cloned the
> prototype nodes and dragged then into the scene, but since the number of
> traversed nodes is growing and growing, I am planning to make some model
> optimization. 
> The first step is to unshare all the geometry cores to apply the other
> optimizations (i.e. flushing of transformations inside the geometries). 

I'm sure you are already aware of this, but that means they also do not 
share the display list, which can increase the memory consumption of 
your app significantly. Of course, depending on circumstances this can 
be a perfectly valid tradeoff.

> I have written a small optimizer to unshared the geo cores which basically
> looks like:
> 
>         osg::MFNodePtr parents = curNode->getCore()->getParents();
                     ^^^^
        const OSG::MFNodePtr &parents = ...
but that is just an optimization that should not be related
> 
>         printf ("Node %s has %d parents\n", osg::getName (curNode),
> parents.size());
> 
>         if  (parents.size()>1)  // unshare this baby
>         {
>             osg::GeometryPtr core = osg::GeometryPtr::dcast
> (curNode->getCore());
>             osg::GeometryPtr newCore = core->clone ();
>             
>             beginEditCP( newCore );
>                           OSG::separateProperties( newCore );
>                   endEditCP( newCore );
> 
>             beginEditCP( curNode, osg::Node::CoreFieldMask );
>                           curNode->setCore (newCore);
>                   endEditCP( curNode, osg::Node::CoreFieldMask );
> 
>             printf ("splitted\n");
>         }
> 
> As long as I just do the optimize and dump the model, all seems to work
> fine: the geometries are unshared. 
> 
> My problem is that my app is working in a cluster environment, so when I do:
> 
> Node= prototypeNode->clone ();
> Optimize (Node);
> 
> clientsceneRoot->addChild (Node);

is this last line surrounded by beginEditCP/endEditCP calls ?

> in the server window doesn't appear any geometry. Probably I am messing up
> with the change lists, but I can't see where is my problem...

Hm, perhaps, but to be able to tell, you'd have to give a description of 
how you handle the changelists ;)

        Thanks,
                Carsten

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to