I think you can solve what you want by making sure your own pseudo loader is used instead. You do this by adding some extension (.ott_terrain, .ott_model, ...) to the filenames of the children of your PagedLODs and you register a ReaderWriter that supports those extensions. You can then in your ReaderWriter remove the extension and load the real file with the right loader by calling osgDB::readNodeFile as usual and then do the postprocessing of the node. Note that all this will be done in a thread created by DatabasePager. If you need to do some postprocessing in your main scenegraph thread you can add a callback (update callback or cull callback) to the node.
If you need an example how this can be done please have a look at osgEarth. Good luck! /Jakob Ruhe 2009/4/28 Alan Ott <[email protected]>: > Robert and Bryan, > > Thanks for the info. From this, it seems like I can get a handle to the > newly loaded node before it gets added to the main tree. The only thing now > is that once I've got a handle to this node, I don't really know _what_ the > node is supposed to be (is it a terrain tile, a moving model? etc.). > > ReadFileCallback::readNode() gives me the ReaderWriterOptions, and it seems > like I could make a new option string telling me how to post-process this > model load, but I can't see how in PagedLOD to set ReaderWriterOptions. > > PagedLOD has the setDatabaseRequest() function, which based on another > mailing list post, looks like it is to be used as a "user data" pointer. The > problem here is that I don't know how to get this object from inside the > ReadFileCallback. > > I simply need to tag each request (made by the PagedLOD) as "terrain" or > "model" so that I know specifically what initialization to do in the > ReadFileCallback. > > Am I missing something obvious here? > > Thanks for your help, > > Alan. > > > Robert Osfield wrote: > > Hi Alan, > > As Bryan wrote, what you need is to write a custom > osgDB::Registry::ReadFileCallback that will intercept all DB calls, > you then leave it up to Registry itself to the do the reading from the > plugin, but then you process the loaded data before passing the end > result back from the callback. Have a look at the ReadFileCallback > implementation and study the default implementations, this should give > you a clue how to put it together. > > Robert. > > On Mon, Apr 27, 2009 at 10:40 PM, Alan Ott <[email protected]> wrote: > > > Hello, > > I'm using PagedLOD to load terrain tiles off disk. The problem I have is > that before I want the tile to actually render, I want to do a setup of the > tile (to look up certain control nodes and set switches according to the > current state of the system (eg: day/night mode, etc)). > > So on my own update(), I check to see if each PagedLOD has just loaded, and > if it has, I run the initialization on it. The problem is, when a tile gets > loaded, it is rendered for one frame _before_ I can do my initialization on > it. So for one frame, it is drawn wrong, then the next frame, it is drawn > right. > > I thought I might be able to get around this by setting the Node Mask to 0 > until it was initialized, but that seems to just keep the tiles from getting > loaded entirely (because the update traverser isn't getting into the > PagedLOD either). > > Do any of you have any ideas of what I could try to do to get around this? > Is there some value of the NodeMask that I could use to enable update but > not draw? Such a value did not seem to be documented in the API. > > Thanks for all your help, > > Alan. > > > _______________________________________________ > 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 > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

