Greetings, all.

 

I've been a lightweight user of OSG for some time now, and have a fair
understanding on how the basic components fit together.  There's
something I'm missing, though, in my current quest.

 

I'm adding XML persistence to my OSG objects.  In general, I wrap OSG
objects in my own objects, and it's those objects that will be doing the
persisting.  For the most part, all is well.  My Viewer object, though,
is having trouble with restoring its camera.  I've succeeded in
restoring the camera to its home position, but have not been able to
restore its "current" position (getMatrix(), setByMatrix()).

 

My Viewer object uses either a MatrixManipulator or a Camera, and my XML
implementation persists the values of those correctly.  With respect to
the MatrixManipulator, I'm doing (paraphrased):

 

                myViewerObject -> its osgViewer ->setCameraManipulator(
a restored myMaxtrixManipulator -> its osgMatrixManipulator);

                // I expect this to do the whole job, but...

 

                myMatrixManipulator -> its osgMatrixManipulator =
myViewerObject -> its osgViewer ->getCameraManipulator();

                // setCameraManipulator seems to create a copy, and I
want to be wrapping the current one.

 

                // Since the above seems to restore just the home
position and not the current, I've tried adding:

                Matrixd testMatrix = myViewer -> its osgViewer ->
getCameraManipulator() ->getMatrix(); // testMatrix is correct.

                myViewerObject -> its osgViewer ->getCameraManipulator()
->setByMatrix( testMatrix);

                // These last seem redundant (and aren't succeeding),
but I'm trying things where things seem broken.

 

I've disabled all "home()" calls, and yet, after loading a persisted
MatrixManipulator, I see my scene from the home position, not the saved
position.

 

I imagine I have a flawed mental model of some facet of this.  Can
someone point me in the right direction?

 

Thanks, in advance,

Phil

 

Philip A. Tessier 



 

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

Reply via email to