[osg-users] Passing explicitly loaded model to DatabasePager for expiry management

7 views
Skip to first unread message

Wojciech Lewandowski

unread,
Sep 24, 2008, 6:45:48 AM9/24/08
to osg-...@lists.openscenegraph.org
Hi Everyone,
 
I have quick question. We have added simple ReadCallback to osg::IntersectionVisitor to enforce loading of highest PAgedLODs from our terrain.
We simply call osgDB::readNodeFile( PageLOD_file ). Intersection works, but it looks like these files are not stored in any cache nor they are actually attached to parent PagedLOD. Is there a way we can add them to DatabasePager loaded model list to avoid further loads of the same file ?
 
Cheers,
Wojtek
 

Robert Osfield

unread,
Sep 24, 2008, 6:53:09 AM9/24/08
to OpenSceneGraph Users
HI Wojtek,

You could use the osg::Registry object cache for the subgraphs you've loaded.

Robert.

> _______________________________________________
> osg-users mailing list
> osg-...@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Wojciech Lewandowski

unread,
Sep 24, 2008, 7:10:36 AM9/24/08
to OpenSceneGraph Users
Thanks,

> You could use the osg::Registry object cache for the subgraphs you've
> loaded.

Thanks, We will try to do this. We will call readNodeFile with CACHE_ALL in
options.

Cheers,
Wojtek

Glenn Waldron

unread,
Sep 24, 2008, 7:53:47 AM9/24/08
to OpenSceneGraph Users
One option is to implement a cache in the ReadCallback itself, as demonstrated in osgSim/LineOfSight.cpp.

Glenn

--
Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : +1.703.652.4791

Wojciech Lewandowski

unread,
Sep 24, 2008, 9:27:55 AM9/24/08
to OpenSceneGraph Users
Hi Again,
 
We tried object cache  When Intersection Visitor loads PagedLOD through ReadCallback its used in vistor apply method local scope then ref counter drops to zero so object cache will also free the object just after it was used. (See IntersectionVisitor line 347).
 
It looks like we should attach loaded PagedLOD to some parent to prevent object cache flush. But IntersectVisitor::ReadCallback does not know the parent. One would need to override IntersectVisitor to allow for this.
 
On the other hand osgSim::DatabaseCacheReadCallback works like a local intersection only cache. DatabasePager does not know anything about it. So subsequent read request issued from Cull traversal will actually reload the file even if IntersectionVisitor just loaded it.
 
So we figured out that using both Object cache with osgSim::DatabaseCacheReadCallback may do the trick. There is a chance that DatabaseCacheReadCallback cache will keep PagedLOD for some time in memory making its ref counter non zero what will cause Object cache to keep it as well. Finally when Object cache will keep it, there is a chance that next DatabasePager request will find it in the cache and will not reload from disk. Funny scenario, isn't it ? I wish it was a bit simpler ;-)
 
Cheers,
Wojtek
 
Reply all
Reply to author
Forward
0 new messages