From 25abad83072d5613164adb093646e3015786b609 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 21 Feb 2006 13:51:10 +0000 Subject: [PATCH] From Paul Martz, "I've attempted to make AutoTransform override computeBounds() to return an invalid bounding sphere if it hasn't seen a cull traversal yet. It depends on _firstTimeToSetEyePoint, which is initially true, then false after a cull. There might be a better way? If so, let me know. This change does resolve the issue I had encountered with auto scale to screen and incorrect culling." --- include/osg/AutoTransform | 1 + src/osg/AutoTransform.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/osg/AutoTransform b/include/osg/AutoTransform index 8bf2c0e9e..0bef0788a 100644 --- a/include/osg/AutoTransform +++ b/include/osg/AutoTransform @@ -82,6 +82,7 @@ class OSG_EXPORT AutoTransform : public Transform virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const; + virtual BoundingSphere computeBound() const; protected : diff --git a/src/osg/AutoTransform.cpp b/src/osg/AutoTransform.cpp index a1677ad58..abac04529 100644 --- a/src/osg/AutoTransform.cpp +++ b/src/osg/AutoTransform.cpp @@ -189,3 +189,16 @@ void AutoTransform::accept(NodeVisitor& nv) // now do the proper accept Transform::accept(nv); } + +BoundingSphere AutoTransform::computeBound() const +{ + BoundingSphere bsphere; + + float scale( 1.f ); + if ( getAutoScaleToScreen() && _firstTimeToInitEyePoint ) + return bsphere; + + bsphere = Transform::computeBound(); + + return bsphere; +}