Thanks Wang Rui, changes look sensible, now merged and submitted to svn/trunk.

On Fri, Mar 12, 2010 at 1:50 PM, Wang Rui <[email protected]> wrote:
> Hi Robert,
>
> Here is a small fix in the eventTraversal() function of both viewer
> and composite viewer class.
>
> if (getCameraWithFocus())
> {
>    if (getCameraWithFocus()!=getCamera())  // Newly added
>    {
>        osg::Viewport* viewport = getCameraWithFocus()->getViewport();
>        osg::Matrix localCameraVPW =
> getCameraWithFocus()->getViewMatrix() *
> getCameraWithFocus()->getProjectionMatrix();
>        if (viewport) localCameraVPW *= viewport->computeWindowMatrix();
>
>        osg::Matrix matrix( osg::Matrix::inverse(localCameraVPW) *
> masterCameraVPW );
>
>        osg::Vec3d new_coord = osg::Vec3d(x,y,0.0) * matrix;
>
>        x = new_coord.x();
>        y = new_coord.y();
>    }
>    ...
> }
>
> I put an additional conditional statement here to ensure that
> _cameraWithCamera and _camera are different, otherwise it's no need to
> calculate the transition matrix from main camera to focus camera. The
> excess calculations of 'matrix' and 'new_coord' may cause
> floating-point error and return a slightly wrong result other than an
> identity matrix. It seems OK in most cases but will be still pain when
> there is little difference between two mouse moving events. What do
> you think?
>
> Cheers,
>
> Wang Rui
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to