[osg-users] Setting CullVisitor

Tim Moore timoore at redhat.com
Tue Nov 10 09:23:33 PST 2009


On 11/10/2009 06:07 PM, Paul Martz wrote:
> Jean-Sébastien Guay wrote:
>> I know I risk making the thread diverge into unrelated concerns, but I
>> wanted to ask:
> 
> No actually, I think this is the right direction for this thread to
> take. :-)
> 
>> Are there advantages to modifying CullVisitor rather than overriding
>> traverse(), other than one dynamic_cast per frame per node? I think if
>> that's the only advantage, I'd personally prefer keeping all the code
>> related to the node type local to the type itself, even if that node
>> type were to be included into OSG.
> 
> Not sure. When I looked into this for OcclusionQueryNode, I was just
> following the existing coding pattern for core OSG nodes. Most of them
> had the bulk of their cull traversal functionality in the
> CullVisitor::apply() for that particular node type, and did not override
> the traverse() member function.
>    -Paul
If you want to customize culling for a node that is a subclass of osg::Geode,
you pretty much need to write your own cull visitor and override
CullVisitor::apply(Geode&); the low-level code that puts geometry
into the render graph is contained in that function and is called after
the traverse() function of the node class.

Tim


More information about the osg-users mailing list