Hi Sherman, Hi Paul, Hi all

Sorry for the short answer last week.
I was in holiday in a little village in South of the France where internet
is restricted and limited.


On Fri, Aug 8, 2008 at 8:45 PM, sherman wilcox <[EMAIL PROTECTED]>
wrote:
> in transform.cpp - BoundingSphere Transform::computeBound()  the first
> few lines of code look like:
>
> BoundingSphere Transform::computeBound() const
> {
>    BoundingSphere bsphere = Group::computeBound();
>    if (!bsphere.valid()) return bsphere;
>
>   ...
> }
>
> After  "if (!bsphere.valid()) return bsphere;" the code continues on
> to calculate a bounding sphere. However, there's a bug here (I think.)
> Shouldn't this line read:
>
>    if (bsphere.valid() == true) return bsphere;
>
> OR
>
>    if (bsphere.valid()) return bsphere;
>
> It doesn't seem to make sense to return an invalid bounding sphere if
> Group::computeBound() returns an invalid object.
>

Behaviors here is :
if bsphere is not valid (so bsphere.radius < 0) return an uninitialized
BoundingSphere.
Original code in osg::Transform is good.






>
> > The code in TextBase is definitely fishy, as the _autoTransformCache list
> is
> > never filled with items, only resized and it is explicitly used when
> > auto-rotate-to-screen is active.
> >
>

  _autoTransformCache list is always used. It is fill in
TextBase::ComputePosition(unsigned int ContextID) method.
  No need to pass a value to fill it, just use default constructor when call
_autoTransformCache[contextID] operator.
  Then this instance is initialized with property value, and finally use in
computeBound and DrawImplementation method,
  auto-rotate-to-screen enable or disable.









BUG : Forgot to recompute the Position of the Text after change the
TextBase::_autoRotateToScreen flag.
FIX   : call osgText::TextBase::computePosition() after change the
TextBase::_autoRotateToScreen flag.

BUG : In TextBase::computeBound(), if _autoTransformCache is not valid we
don't take it into account
when compute bounding volume. This result in invalid scenegraph's
BoudingSphere  if there are only one osgText::Text drawable in the graph.
FIX : Always use _autoTransformCache, even if it is invalid. Invalid here
seem AutoTransformCache::traversaleNumber == -1.
        But AutoTransformCache::_matrix is computed and can be used to
compute the BoundingSphere.



Fixed file attached.


Sherman ,can you test it before definitively submit it to Robert ?


Cheers
David Callu

Attachment: TextBase.tgz
Description: GNU Zip compressed data

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

Reply via email to