ok, thanks for the explanation !

2008/5/13 Robert Osfield <[EMAIL PROTECTED]>:

> Hi Christophe,
>
> There is a reason why ViewerBase::updateTraversals() is a virtual function
> :-)
>
> Basically different applications will have different requirements
> w.r.t set up and use of
> the view matrix, most apps they won't be dependant on each other,
> other applications
> will have a view matrix that tracks objects in the scene - such as
> ones use NodeTrackerManipulator
> for these you have to do update first, then update the camera
> manipulator, then others like
> yours want to obtain the view matrix after the camera's view matrix
> has been set.  There
> is no way you to solve all of these usage models with one code path,
> so osgViewer simply
> implements the most common usage model.
>
> For your own app you can override the updateTraversals() method, or
> manually call the
> camera manipulator before you call updateTraversals() in your frame loop -
> i,e,
>
>  while(!viewer.done())
>  {
>     // break frame down into its separate traversals
>     viewer.advance();
>     viewer.eventTraversal();
>     // your custom code for updating the view matrix
>     viewer.updateTraversal();
>     viewer.renderingTraversals();
>  }
>
> One item to note, is the OSG is designed to allow one to have multiple
> cameras viewing the
> same scene graph, which in your instance you're callback will only be
> called once, but you'll
> have to track multiple view matrices.  If you never use multiple
> View(s) or multiple slave Camera(s)
> then this won't be an issue, but it's something worth flagging.
>
> Robert.
>
>
>
> On Tue, May 13, 2008 at 7:33 AM, christophe loustaunau
> <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > In our application, I need to get the cameraViewMatrix in the
> > updateTraversal. I have done that with an update callback.
> > But I think I have the ViewMatrix of the last frame, not the current
> frame,
> > because of some graphics problems.
> >
> > I have look in Viewer::updateTraversal() and I have found that the
> > updateTraversal is done before the camera matrix is set by the
> manipulator,
> > see the code :
> >
> > void Viewer::updateTraversal()
> > {
> >     ......
> >      if (getSceneData())
> >     {
> >         getSceneData()->accept(*_updateVisitor);
> >     }
> >     .......
> >     if (_cameraManipulator.valid())
> >     {
> >         setFusionDistance(
> getCameraManipulator()->getFusionDistanceMode(),
> >
> > getCameraManipulator()->getFusionDistanceValue() );
> >
> >         _camera->setViewMatrix(_cameraManipulator->getInverseMatrix());
> >     }
> >     ......
> > }
> >
> > Is this intend ?
> >  I have try to set the camera matrix from the manipulator before the
> > traversalUpdate and everything works fine.
> >
> > I wan't to know if there is resons for this specific order, or if we
> could
> > set the camera matrix from the manipulator before the traversalUpdate.
> If
> > so, I could submit this change to osg-submissions.
> >
> > Regards.
> >
> > --
> > Christophe Loustaunau.
> > _______________________________________________
> >  osg-users mailing list
> >  osg-users@lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



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

Reply via email to