Thrall, Bryan wrote:

Alan Ott wrote on Tuesday, April 28, 2009 10:34 AM:
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.
Unfortunately, at the moment PagedLOD doesn't have a way to specify
ReaderWriterOptions (and adding that ability is a little complicated,
because we don't want a circular dependency between osg and osgDB).

One thing you can do is subclass PagedLOD in your app to add the ability
to specify a ReaderWriterOptions when it calls readNode().

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.

This makes me think you're using an older version of OSG? The latest OSG
in svn only has getDatabaseRequest() (which you can use to set the
DatabaseRequest). In any case, the database request isn't really for
"user data"; it is specifically for osgDB::DatabasePager use.

Robert Osfield wrote:
        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.

        On Mon, Apr 27, 2009 at 10:40 PM, Alan Ott <a...@signal11.us>
<mailto:a...@signal11.us> wrote:
                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.

Bryan,

You are right. I didn't read closely enough, and there is no setDatabaesRequest(). I am using OSG 2.6. You had a good idea with the subclassing of PagedLOD and the options, but what I ended up doing was I think simpler. I subclassed PagedLOD and overrode the addChild() method, calling my init function from the override. This way I could have all the "user data" I want (with pointers to my own objects), which would not have been possible from the callback.

Thanks for your help,

Alan.

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

Reply via email to