Re: [osg-users] PagedLOD and page in/out detection

2016-06-03 Thread Trajce Nikolov NICK
Hi Robert,

thanks for the *hints* :) ... Reading the code is always the best option
:-). I found the thing while reading the code you pointed me to. It is this
thing that when set up properly per the database, then it works nicely ..

viewer->getDatabasePager()->setTargetMaximumNumberOfPageLOD(...);

Thanks again!

Cheers,
Nick

p.s. I still like my simple hack :-). I will keep it and not do it the
proper way this time ;-)

On Fri, Jun 3, 2016 at 7:51 PM, Robert Osfield 
wrote:

> Hi Nick,
>
> It's *really* inefficient to use an update callback to do this type of
> task, I can not recommend going this path, it's waste of both our time
> trying to coax it to do something useful.
>
> The right way of doing it is by overriding the
> DatabasePager::updateSceneGraph() method or implementing you own
> equivalent method in the Viewer::updateTraversak() in place of current
> calls to updateceneSceneGraph().
>
> Robert.
>
> On 3 June 2016 at 18:28, Trajce Nikolov NICK
>  wrote:
> > 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(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  >
> > 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
> >>  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@lists.openscenegraph.org
> >> >
> >> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> >
> >> ___
> >> osg-users mailing list
> >> osg-users@lists.openscenegraph.org
> >>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> >
> >
> > --
> > trajce nikolov nick
> >
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and page in/out detection

2016-06-03 Thread Robert Osfield
Hi Nick,

It's *really* inefficient to use an update callback to do this type of
task, I can not recommend going this path, it's waste of both our time
trying to coax it to do something useful.

The right way of doing it is by overriding the
DatabasePager::updateSceneGraph() method or implementing you own
equivalent method in the Viewer::updateTraversak() in place of current
calls to updateceneSceneGraph().

Robert.

On 3 June 2016 at 18:28, Trajce Nikolov NICK
 wrote:
> 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(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 
> 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
>>  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@lists.openscenegraph.org
>> >
>> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>> >
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
>
>
> --
> trajce nikolov nick
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and page in/out detection

2016-06-03 Thread Trajce Nikolov NICK
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(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 
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
>  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@lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and page in/out detection

2016-06-03 Thread Robert Osfield
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
 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@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PagedLOD and page in/out detection

2016-06-03 Thread Alberto Luaces
Trajce Nikolov NICK writes:

> Now it doesn't .. Any clue or hint how to detect such changes?

git bisect?  It is very useful for that kind of "it does work / now it
doesn't"...

-- 
Alberto

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


[osg-users] PagedLOD and page in/out detection

2016-06-03 Thread Trajce Nikolov NICK
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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org