hi robert, in flightgear we have xml-files that describe models. the code that reads these files needs options passed in:
osg::Node * sgLoad3DModel( const string &fg_root, const string &path, SGPropertyNode *prop_root, double sim_time_sec, osg::Node *(*load_panel) (SGPropertyNode *), SGModelData *data, const SGPath& externalTexturePath ) for DatabasePager to work in flightgear i have added a ReaderWriterXML with ReaderWriterXMLOptions that carry the parameters the above function needs. this is how model paging works right now: i have subclassed PagedLOD to SGPagedLOD ReaderWriterOptions (with the parameters above) are stored in SGPagedLOD nodes. i have copy-pasted PagedLOD::traverse(osg::NodeVisitor& nv) to SGPagedLOD and added ReaderWriterOptions to the requestNodeFile() call in there (casting the DatabaseRequestHandler to a DatabasePager, first). the good thing is that the databaseRequests themselves already contain a ReaderWriterOptions-object per request. so i didn't need to change anything in DatabasePager. cheers, -till On Wednesday 05 March 2008, Robert Osfield wrote: > Hi Till, > > You could you explain the motivation behind these changes, i.e. what > problem do they solve that is currently limiting your work? It may > well be another solution to the problems you are solving, or it may be > that are refactor elsewhere or in a differnt form is more appropriate, > but without more information about the problem you are trying to solve > its impossible to know. > > Robert. > > On Wed, Mar 5, 2008 at 11:58 AM, till busch <[EMAIL PROTECTED]> wrote: > > hi all, > > > > i'm working on model-paging in flightgear. it works fine so far, but i > > had to introduce some quirks to get around the limited hooks in PagedLOD > > and DatabasePager. > > > > so i'd like to propose a few changes to PagedLOD and DatabasePager APIs. > > > > 1. DatabasePager: > > requestNodeFile (const std::string &fileName, osg::Group *group, float > > priority, const osg::FrameStamp *framestamp, ReaderWriter::Options > > *loadOptions) > > > > should be published published in > > osg::NodeVisitor::DatabaseRequestHandler so that loadOptions can be set > > separately for each PagedLOD. > > > > 2. PagedLOD: > > i suggest adding a new virtual function in PagedLOD: > > > > requestNodeFile(osg::NodeVisitor::DatabaseRequestHandler *dbrh, const > > std::string &fileName, osg::Group *group, float priority, const > > osg::FrameStamp *framestamp). > > > > in PagedLOD::traverse(osg::NodeVisitor& nv) this function should be > > called, so a subclass can modify the call to the > > DatabaseRequestHandler::requestNodeFile(), as described above. > > the default implementation could just do what it does now. i.e. call > > osg::NodeVisitor::DatabaseRequestHandler::requestNodeFile (const > > std::string &fileName, osg::Group *group, float priority, const > > osg::FrameStamp *framestamp) with no special loadOptions. > > > > 3. DatabasePager > > looking through the archives i have found other people needing a hook in > > addLoadedDataToSceneGraph(). > > should we add one? i now think i could just as well reimplement > > PagedLOD::addChild() to see when a new child gets paged in. > > > > if you are in support of 1 and 2 i'd be happy to prepare the modified > > files and send them. > > > > cheers, > > > > -till > > > > > > p.s. sorry. it is really hard to describe such things with words ;-) > > _______________________________________________ > > osg-users mailing list > > [email protected] > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

