[osg-users] Force osgDB::readNodeFile to not return cached model

Voerman, L. l.voerman at rug.nl
Mon Nov 11 06:58:33 PST 2019


Hi Brad,
I think your code should work, but instead of disabling the cache you can
clone only the parts you need:
osg::ref_ptr<osg::Node> newNode = dynamic_cast<osg::Node
*>(oldNode->clone(osg::CopyOp::DEEP_COPY_NODES));
Assuming the rotating is done on a Transform node, this will let you share
all geometry and statesets.
Laurens.

On Fri, Nov 8, 2019 at 4:05 AM Brad Colbert <bcolbert at rscusa.com> wrote:

> Hello,
>
> I'm reading a model multiple times using osgDB::readNodeFile.  I'm
> rotating a part on one of the models but the same part on all of the
> instances of the model are rotating.
>
> I've looked at the pointer returned from osgDB::readNodeFile for all of
> the load calls (for the same model file) and they are all the same.  I'm
> assuming that the model is cached the first time and I'm getting an
> instance of the cached model for each subsequent call to
> osgDB::readNodeFile.
>
> I've tried what I think should disable the caching for this instance (from
> one of the examples):
>
>
> Code:
> // Load the model
> osg::ref_ptr<osgDB::Options> options = new osgDB::Options("a=1 b=2 c=3");
> options->setObjectCacheHint(osgDB::Options::CACHE_NONE);
> osg::Node* model = osgDB::readNodeFile(modelName, options);
>
>
>
>
> How do I turn this off or get around this?
>
> OpenSceneGraph Library 3.6.3
>
> Thank you!
>
> Cheers,
> Brad
> Code:
>
>
>
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76884#76884
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20191111/c5baa139/attachment.html>


More information about the osg-users mailing list