Hi Brad,

As Tim Moore suggests the way to go is to use a cull callback attached
to the subgraph that you want to modify the LOD scale for.  The
osgUtil::CullVisitor that does the cull traversal is subclassed from
osg::NodeVisitor and osg::CullStack.  osg::CullStack itself is
subclassed from osg::CullSettings, which is where you'll find the
s/getLODScale().  It's this LODScale that you'll want to save, modify
and restore in the cull callback.  You callback will work something
like:


struct MyCullCallback : public osg::NodeCallback
{
        float myScale;

        MyCullCallback(float scale): myScale(scale) {}

        virtual void operator()(Node* node, NodeVisitor* nv)
        {
            osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
            if (!cv)
            {
                float previousScale = cv->getLODScale();

                cv->setLODScale(myScale);

                traverse(node,nv);

               cv->setLODScale(previousScale);
            }
            else
            {   // shouldn't really get here if you've attached this
as cull callback...
                traverse(node,nv);
             }
        }
}

...

subgraph->setCullCallback(new MyCullCallback(2.0));


Or something along these lines.

Robert.

On Wed, Sep 1, 2010 at 6:53 PM, Brad Huber <[email protected]> wrote:
> Hello,
>
>
>
> I am interested in granularly controlling the LODScale for different parts
> of my scene graph.  For example I have one part of the graph rendering a
> globe (osgEarth) and another part rendering items on the globe.  I would
> like to be able to increase or decrease the LODScale for just the globe
> portion without disturbing everything else.  The CullSettings are typically
> attached to the Camera.  I wasn’t sure initially that creating two separate
> cameras was the right solution.  I still want the depth buffering and render
> order stuff to be preserved the way it is now (the globe and the items on
> the globe render to the same depth buffer).
>
>
>
> Thoughts?
>
>
>
> Thanks
>
> -Brad
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to