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

Wojciech Lewandowski lewandowski at ai.com.pl
Wed Sep 24 06:27:55 PDT 2008


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

  ----- Original Message ----- 
  From: Glenn Waldron 
  To: OpenSceneGraph Users 
  Sent: Wednesday, September 24, 2008 1:53 PM
  Subject: Re: [osg-users] Passing explicitly loaded model to DatabasePagerfor expiry management


  On Wed, Sep 24, 2008 at 6:45 AM, Wojciech Lewandowski <lewandowski at ai.com.pl> wrote:

    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 ?



  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



------------------------------------------------------------------------------


  _______________________________________________
  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/20080924/b157075c/attachment-0003.htm>


More information about the osg-users mailing list