Discussion:
[osg-users] Problems porting from osg-3.4.0 to osg-3.6.0
Herman Varma
2018-10-02 04:18:28 UTC
Permalink
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
Robert Osfield
2018-10-02 13:42:08 UTC
Permalink
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.
Post by Herman Varma
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
------------------
http://forum.openscenegraph.org/viewtopic.php?p=75006#75006
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Herman Varma
2018-10-04 13:31:14 UTC
Permalink
Hi,


I have upgraded the vtp code to osg 3.6.3
Everything compiled and linked properly. However I still have some execution problems.

I just want to check if the code below is coded properly

FQuat TransformExtension::GetOrient() const
{
const osg::Matrix &xform = m_pTransform->getMatrix();
osg::Quat q;

// xform.get(q);
// Replacing xform.get(q)
// with
q = xform.getRotate();

return FQuat(q.x(), q.y(), q.z(), q.w());
}

...

Thank you!

Cheers,
Herman

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75036#75036
Robert Osfield
2018-10-05 07:05:26 UTC
Permalink
Hi Harman,

The new code looks OK to me. Can't say anything more about the
issues you are having though as you don't provide any specifics. If
you can keep VTP compiling against new and older versions of the OSG
for a while then you could possibly put some debug output on bits of
code that you are suspicious of and see what values both versions of
the OSG are generating, or create a small test program that
illustrates the usage case that you think might be a problems and so
similar testing.

If it does turn out there is change in behaviour then the later
approach would be helpful for others to test things out to see what
might be going on. If there is bug on 3.6.x then we can fix it and
make sure it's part of the next stable point release.

Cheers,
Robert.
Post by Herman Varma
Hi,
I have upgraded the vtp code to osg 3.6.3
Everything compiled and linked properly. However I still have some execution problems.
I just want to check if the code below is coded properly
FQuat TransformExtension::GetOrient() const
{
const osg::Matrix &xform = m_pTransform->getMatrix();
osg::Quat q;
// xform.get(q);
// Replacing xform.get(q)
// with
q = xform.getRotate();
return FQuat(q.x(), q.y(), q.z(), q.w());
}
...
Thank you!
Cheers,
Herman
------------------
http://forum.openscenegraph.org/viewtopic.php?p=75036#75036
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Loading...