I am trying to use osgDB::Registry cache to avoid loading the same models multiple times.
Caching works ok, reduces the memory usage as expected.
I enable caching with :
Code:
osgDB::Options* opt = osgDB::Registry::instance()->getOptions();
if (opt == NULL)
{
opt = new osgDB::Options();
}
opt->setObjectCacheHint(osgDB::Options::CACHE_ALL);
osgDB::Registry::instance()->setOptions(opt);
I read an ive file with :
Code:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(f);
(a quick question : if i enable caching globally like the above chunk of code, do i have to pass options parameter to the overloaded readNodeFile function ?)
But whenever i read an ive file with switch ability more than once; a switching action during runtime alters all of the models.
For eg. when i load two traffic lights, the second one is retrieved from cache. And if i change the switch on any of them, the other one gets affected too!
Any hints guys ?
PS : I was trying to read osgCal animated meshes in my OSG code a while ago. And i implemented a map to not to load the same animated mesh from file more than once. But at the time, i had the same problem : when an animation was triggered, all of the animated mesh instances got affected. I overcame this problem by caching osgCal::CoreModel instead of osgCal::Model
Thanks in advance
Arif Yetkin
------------------------
http://www.youtube.com/watch?v=naX3hOkDx8w
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35156#35156
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Cheers,
Sergey
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35216#35216