[osg-users] Refactoring DatabasePager NeedToRemovestringflagging technique

Wojciech Lewandowski lewandowski at ai.com.pl
Mon Nov 23 09:35:14 PST 2009


Hi Chris,

> Robert Osfield wrote:
>>> Second important issue for me is usage of _name in scene graph. I always
>>> expected that _name is reserved for users and its a normal rule in all 
>>> Scene
>>> Graph implementations that libraries do not change it.  Names are 
>>> ususlly
>>> used to identify certain portions of models and hook up the code 
>>> properly.
>>> Thats something that provide standard linking mechanisms between artists 
>>> and
>>> programmers works.
>> I agree, but... in this instance the DatabasePager's algorithm was
>> about deleting a subgraph that would no longer have any role to play
>> in the applications life so the changing of name should never have got
>> outside that algorithm as the subgraph would be just deleted.  So it
>> is in theory just a black box, how it does it's job shouldn't effect
>> anything else.  Alas in this case it looks like the algorithm in
>> DatabasePager is flawed.
>
>  This is the part that I couldn't tell from a simple reading of the code. 
> Once a node is
> renamed to "NeedToRemove", under normal circumstances (ignoring the cache 
> trick above), is
> there any possibility that that node can "return to life"? It sounds like 
> you're saying
> there is no possibility, in which case I sort of agree with Robert that 
> altering the name
> is fair game, as the node is now "the walking dead" and anything is 
> permissible.

I disagree, when Scene is available in update traversal for various visitors 
you could expect that some user may want to do some specific decoration of 
the PageLOD node. Modify texture attributes, attach some objects etc. So 
once you allowed user to get to PagedLOD via update traversal vistiors you 
should expect that this PagedLOD ref_count increases. In such case 
DatabasePager should not longer assume it posses this node completely.

Other case could be following. We overrite ReadFileCallback and generate and 
reuse some procedural generic tile (for example spherical sector of ocean 
mesh). This is again a case where PageLOD is not directly loaded by 
DatabasePager but only used by it. So DatabasePager should behave politely 
with this node...

Cheers,
Wojtek 



More information about the osg-users mailing list