Hi,

I found a very old article covering this issue: 
https://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg15948.html. 
In the meantime it seems to be that proposal (2) has been implemented and the 
AutoTransform's computeBound() method returns an invalid bounding sphere during 
the first cull traversal. Nevertheless, when checking in the example 
osgautotransform.cpp the bounding spheres (of the text messages) remain 
invalid. To check this I have added an update callback to the AutoTransforms 
that only checks the validity of the bounding sphere.

Now, if the bounding sphere remains invalid culling of the AutoTransform's 
children will not be correctly performed because the AutoTransform's 
isCullingActive method will always return false (bounding sphere is invalid).

To solve this issue I was thinking to add a ComputeBoundingSphere callback or 
an update callback to the AutoTransform. But this is not a good solution 
because in this case I have to calculate always a new bounding sphere as I do 
not have access to the node's "_boundingSphereComputed" flag.

Another solution is to patch the node's getBound() method that will set the 
flag "_boundingSphereComputed" only to true if a valid "_boundingSphere" 
exists. This sounds reasonable in any case:

Code:
        inline const BoundingSphere& getBound() const
        {
            if(!_boundingSphereComputed)
            {
                _boundingSphere = _initialBound;
                if (_computeBoundCallback.valid())
                    
_boundingSphere.expandBy(_computeBoundCallback->computeBound(*this));
                else
                    _boundingSphere.expandBy(computeBound());

                _boundingSphereComputed = _boundingSphere.valid();
            }
            return _boundingSphere;
        }



But I do not know if this breaks anything.

Is there any other method to get a valid bounding sphere for the AutoTransform 
without sacrificing performance?

Thank you!

Cheers,
Hartwig

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73174#73174





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to