Ok, I seem to have found a workaround if anyone's interested:
Basically I add a read file callback that simply records in a map the 
ReadResult for each file that is requested.
I then subclass the DatabasePager class to override the requestNodeFile 
function so that it only calls the base class function for files that not been 
recorded with a failed readresult.


Code:
    class CustomDatabasePager : public osgDB::DatabasePager
    {
    public:
        virtual void requestNodeFile(const std::string& fileName,osg::Group* 
group,
                                     float priority, const osg::FrameStamp* 
framestamp,
                                     osg::ref_ptr<osg::Referenced>& 
databaseRequest,
                                     const osg::Referenced* options)
        {
            osgDB::ReaderWriter::ReadResult::ReadStatus status;
            if (CustomReadFileCallback::getCachedReadStatus(fileName, status))
            {
                if (status != osgDB::ReaderWriter::ReadResult::FILE_LOADED &&
                    status != 
osgDB::ReaderWriter::ReadResult::FILE_LOADED_FROM_CACHE)
                {
                    // If we have requested this file and it failed, there is no
                    // point requesting it again, so bypassing normal request
                    // mechanism here.
                    return;
                }
            }
            osgDB::DatabasePager::requestNodeFile(fileName, group, priority, 
framestamp, databaseRequest, options);
        }
    };




chrisd wrote:
> I'm using the function:
> viewer->getDatabasePager()->getFileRequestListSize()
> to determine whether background processing of PagedLOD objects is complete. 
> e.g I wait until it returns zero before performing screen grab.
> This normally works fine, but if there are any files referred to by the 
> PagedLOD nodes are missing, then the files seem to keep getting added back to 
> the database pager file request list by the cull visitor.
> This means (a) It is continuallly retrying to find each missing file, and (b) 
> the file request queue is never empty and so I can't determine when the 
> loading is as complete as it can get.
> 
> My questions are:
> 1. Should this be happening?
> 2. How do I avoid it?
> 
> I suppose I could check for file existence before constructing the PagedLOD 
> object, but I wanted to avoid that because this check is relatively expensive 
> over http, and would prefer that to be deferred to the db pager thread.
> 
> Cheers,
> Chris

Code:



Code:



Code:




------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35404#35404





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to