[osg-users] PagedLOD and page in/out detection
Trajce Nikolov NICK
trajce.nikolov.nick at gmail.com
Fri Jun 3 10:28:16 PDT 2016
Hi Robert,
this is my update callback .. And I know for sure it was working. I just
did a clean app (modified osgviewer with only this callback installed in
the root PagedLODs) and I never see a Paged Out tile ... I am limited to
not having the possibility to make a custom DatabasePager or it will go
really complicated. The root PagedLOD can have only one or zero children
(that is the test database I am testing it against)
struct UpdateCallback : public osg::NodeCallback
{
UpdateCallback()
: _numChildren(0)
{
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
osg::PagedLOD* plod = dynamic_cast<osg::PagedLOD*>(node);
if (plod)
{
if (plod->getNumChildren() != _numChildren)
{
_numChildren = plod->getNumChildren();
if (_numChildren)
std::cout << "Paged in" << std::endl;
else
std::cout << "Paged out" << std::endl;
}
}
traverse(node, nv);
}
protected:
int _numChildren;
};
On Fri, Jun 3, 2016 at 6:49 PM, Robert Osfield <robert.osfield at gmail.com>
wrote:
> Hi Nick,
>
> There isn't a feature directly built into osg::PageLOD or
> DatabasePager for this.
>
> What you could do is look at the creating a custom DatabasePager that
> overrides the following method:
>
> /** Merge the changes to the scene graph by calling calling
> removeExpiredSubgraphs then addLoadedDataToSceneGraph.
> * Note, must only be called from single thread update phase. */
> virtual void updateSceneGraph(const osg::FrameStamp& frameStamp);
>
> Within this you could add your own tracking of when things are merge or
> removed.
>
> Robert.
>
>
>
> On 3 June 2016 at 17:15, Trajce Nikolov NICK
> <trajce.nikolov.nick at gmail.com> wrote:
> > Hi Community,
> >
> > I was looking for a way to detect when PagedLOD gets its children paged
> > in/out. So I installed an update callback and based on a difference in
> the
> > children number I was able to know when such change occurred. And this
> was
> > working with a code an year ago.
> >
> > Now it doesn't .. Any clue or hint how to detect such changes?
> >
> > Thanks a bunch as always!
> >
> > Cheers,
> > Nick
> >
> > --
> > trajce nikolov nick
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160603/d077eec3/attachment-0003.htm>
More information about the osg-users
mailing list