Hi Rui,

On 15 February 2013 12:39, Wang Rui <[email protected]> wrote:
> So I think we should at least find a way to return the computed near/far
> values to user level, for further debugging and testing. Do you think it a
> better alternative to set the near/far values to the owner camera in
> CullVisitor::popProjectionMatrix()?
>

Could the osg::CullSettings ClampProjectionMatrixCallback be used for this?

        /** Callback for overriding the CullVisitor's default clamping
of the projection matrix to computed near and far values.
          * Note, both Matrixf and Matrixd versions of
clampProjectionMatrixImplementation must be implemented as the
CullVisitor
          * can target either Matrix data type, configured at compile time.*/
        struct ClampProjectionMatrixCallback : public osg::Referenced
        {
            virtual bool
clampProjectionMatrixImplementation(osg::Matrixf& projection, double&
znear, double& zfar) const = 0;
            virtual bool
clampProjectionMatrixImplementation(osg::Matrixd& projection, double&
znear, double& zfar) const = 0;
        };

This is intended for providing custom computation of the znear and
zfar but you could write a callback that deferred to the
CullVisitor::clampProjectionMatrixImplementation to compute and then
passed back the value to be used however the user wants.

Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to