Ok, setting on projectionCullingStack works fine for the whole subgraph, you
just have to transform the plane to view space first:
Code:
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if (cv)
{
osg::CullingSet& cullingStack =
cv->getProjectionCullingStack().back();
osg::Polytope::PlaneList origPlaneList =
cullingStack.getFrustum().getPlaneList();
osg::Plane transformed = mCullPlane;
transformed.transform(cv->getCurrentCamera()->getViewMatrix());
cullingStack.getFrustum().add(transformed);
traverse(node, nv);
// undo
cullingStack.getFrustum().set(origPlaneList);
}
else
traverse(node, nv);
}
It's a bit ugly, but good enough for me. Unless Robert has a better idea, I'll
stick with this approach!
Cheers,
Jannik[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65434#65434
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org