Hi Robert,

Hows about using a cull callback that caches the compute near/far
values before traversing the subgaph then restores the value
afterwards, it'd only take a couple of lines of code.

Unless I'm reading the headers wrong, there is no setter for the computed near and far values? Only getters?

    inline value_type getCalculatedNearPlane() const {
        return _computed_znear; }

    inline value_type getCalculatedFarPlane() const {
        return _computed_zfar; }

I don't see anything that sets _computed_znear and _computed_zfar except for methods that do actual calculations, like updateCalculatedNearFar(...) .

Is there some other way of doing what you're suggesting that I'm missing?

Otherwise, I guess I could cache and reset the ComputeNearFarMode like this:

class DoNotIncludeInNearFarComputationCallback
    : public osg::NodeCallback
{
public:
    virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
    {
        osgUtil::CullVisitor *cv =
            dynamic_cast< osgUtil::CullVisitor*>( nv );

        // Default value
        osg::CullSettings::ComputeNearFarMode oldMode =
            osg::CullSettings::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES;

        if( cv )
        {
            oldMode = cv->getComputeNearFarMode();
            cv->setComputeNearFarMode(
                osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
        }

        traverse(node, nv);

        if( cv )
        {
            cv->setComputeNearFarMode(oldMode);
        }
    }
};

Does that look like something that could work? (it doesn't seem to at first glance, but maybe I'm doing something wrong)

Thanks,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  • [osg-use... Jean-Sébastien Guay
    • Re:... Cole, Charles E. (LARC-B702)[RAYTHEON TECHNICAL SERVICES COMPANY]
      • ... Jean-Sébastien Guay
        • ... Robert Osfield
          • ... Jean-Sébastien Guay
          • ... Jean-Sébastien Guay
            • ... Chris 'Xenon' Hanson
    • Re:... Paul Martz
      • ... Chris 'Xenon' Hanson
        • ... Paul Martz
        • ... Jean-Sébastien Guay
          • ... Chris 'Xenon' Hanson
            • ... Chris 'Xenon' Hanson
              • ... Jean-Sébastien Guay
                • ... Chris 'Xenon' Hanson
                • ... Jean-Sébastien Guay

Reply via email to