[osg-users] Problems porting from osg-3.4.0 to osg-3.6.0
Robert Osfield
robert.osfield at gmail.com
Tue Oct 2 06:42:08 PDT 2018
Hi Herman,
With the change to subclassing Drawable from Node rather than Object,
the dirty flag is now inherited from Node, it's a bit awkward as it's
now _boundingSphereComputed, but it's essentially the same thing.
However, your own code should worry about the dirty flag, that's the
job of the getBound()/getBoundingBox() job to worry about, and this
has always been the case - it's an example of the Template Method
Design Pattern. The getBound*() method provides the high level
managing of dirty status that always needs to be managed coherently
and the compute*() method provides the part that differs.
So in your code just delete the line:
_boundingBoxComputed=true;
It will work fine for 3.4.x and 3.6.x without this line as it was
never needed in the first place :-)
Robert.
On Tue, 2 Oct 2018 at 12:25, Herman Varma <hermanvarma at eastlink.ca> wrote:
>
> Hi,
>
>
> I have encountered another problem. what is the replacement for
> _boundingBoxComputed in osg-3.6.2
>
> in osg-3.4.0
> It was defined in osg\Drawable
>
>
> BoundingBox _initialBound;
> ref_ptr<ComputeBoundingBoxCallback> _computeBoundCallback;
> mutable BoundingBox _boundingBox;
> mutable bool _boundingBoxComputed;
>
> in osg-3.6.2
> it is not defined in osg\Drawable
>
> BoundingBox _initialBoundingBox;
> ref_ptr<ComputeBoundingBoxCallback>_computeBoundingBoxCallback;
> mutable BoundingBox _boundingBox;
>
>
>
> The code to be ported is
>
> osg::BoundingBox OsgDynMesh::computeBoundingBox() const
> {
> FBox3 box;
> m_pDynGeom->DoCalcBoundBox(box);
>
> // convert it to OSG bounds
> v2s(box.min, _boundingBox._min);
> v2s(box.max, _boundingBox._max);
>
> _boundingBoxComputed=true;
> return _boundingBox;
> }
>
> Thank you!
>
> Cheers,
> Herman
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75006#75006
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
More information about the osg-users
mailing list