Thanks Robert for your prompt reply.
Now think at this case that represents a particle system where all elements
share ParticleSystem_1:
Group {
num_children 4
Geode {
name "Layer 0"
num_drawables 1
osgParticle::ParticleSystem {
UniqueID ParticleSystem_1
}
}
MatrixTransform {
num_children 1
osgParticle::ModularEmitter {
UniqueID ModularEmitter_7
Use ParticleSystem_1
}
}
}
osgParticle::ModularProgram {
UniqueID ModularProgram_8
Use ParticleSystem_1
}
osgParticle::ParticleSystemUpdater {
Use ParticleSystem_1
}
}
If you perform the copy I mentioned above, the result will be that all
objects *will share *the same ParticleSystem (i.e. drawable), all objects
*but* the "Layer 0" that will have a deep copy of the original PS (so, not
the same instance as happened before the Drawable Class refactoring).
This behavior is somehow anomalous, right?
Cheers,
Giuseppe
On Tue, Oct 28, 2014 at 12:33 PM, Robert Osfield <[email protected]>
wrote:
> Hi Giuseppe,
>
> osg::Drawable now subclasses from osg::Node so a deep copy of Node should
> create a new instances of any Drawables contained.
>
> This might not be what you are looking for, but it's not a bug.
>
> If you want to clone a subgraph and share things in a specific way then
> you'll need to write a NodeVisitor to clone and share the bits you want.
>
> Robert.
>
> On 28 October 2014 11:14, Giuseppe Donvito <[email protected]>
> wrote:
>
>> I've found a weird behavior in the clone() method when the sub-graph to
>> be cloned has a group with a ParticleSystem (or drawable) directly attached
>> to it.
>>
>> For instance in this case if you want apply a shallow copy for drawables
>> and a deep copy for nodes and statesets, this piece of code will fail:
>> osg::ref_ptr<osg::Node>
>> copy =
>> static_cast<osg::Node*>(subgraph->clone(osg::CopyOp::DEEP_COPY_NODES |
>> osg::CopyOp::DEEP_COPY_STATESETS));
>>
>> The "copy" instance will have full copies of ParticleSystems (or
>> drawables) instead of copies by reference.
>> I think this is due to the generic cast to "Node" objects in the Group
>> constructor iteration for copy. (osg version 3.3.2, Group.cpp, line 39).
>>
>> this bug, if verified, could cause performance issues in term of memory
>> footprint.
>>
>> BR,
>> Giuseppe
>>
>> _______________________________________________
>> osg-submissions mailing list
>> [email protected]
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>>
>>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org