Hi Johnm

On Tue, May 25, 2010 at 12:38 PM, PCJohn <[email protected]> wrote:
> Hi Robert,
>
> briefly:
> - DEFAULT_SETTTINGS is a good idea
> - Trackball rotation speed independent on FPS - definitely useful
> - changing Vec3d to Vec3 is ok for me. This came to my mind in the final
> code review as well.
> - FlightManipulator - ?
> - DriveManipulator - ?
>
> DriveManipulator does not contain the bug as I did not had no more time left
> to convert the manipulator to the "new" architecture.
> FlightManipulator contains the problem, however, I will follow your
> suggestion and wait for your tweaks to be checked in.

You submission plus my changes are now checked into svn/trunk.

Items left to do are :

1) fix the FlightManipulator,

2) fix the throw speed when vysync is off or frame rate is low so the
trackball matches the behavior that was previously in svn/trunk.  See
below code segment.

3) replacement of assert() in code.  I don't favor code that behaves
different in debug and release builds.  If there are bugs we want to
catch then we be able to detect them in release or debug builds.  I
for one only ever build debug when I have a bug I'm investigating that
requires a debugging info, for 95% of the rest of the time I develop
against release build, so will rarely get to see code paths that an
assert might help with.  IMHO, It's far better to detect the error
condition and report a warning and do something about the error
condition directly.

4) Rationalize manipulators so we don't have multiple overlapping
ones.  This may mean breaking the build
for those who use some of niche manipulators, but long term sake of
the code base and users we need to avoid proliferation of classes.

5) Move remaining manipulators all across to using the new scheme.

Robert.

--  Previous svn/trunk's src/osgGA/TrackballManipulator.cpp's
calcMovement() code that adds in throw scaling:

    double throwScale =  (_thrown && _ga_t0.valid() && _ga_t1.valid()) ?
            _delta_frame_time / (_ga_t0->getTime() - _ga_t1->getTime()) :
            1.0;

    if (buttonMask==GUIEventAdapter::LEFT_MOUSE_BUTTON)
    {

        // rotate camera.

        osg::Vec3 axis;
        float angle;

        float px0 = _ga_t0->getXnormalized();
        float py0 = _ga_t0->getYnormalized();

        float px1 = _ga_t1->getXnormalized();
        float py1 = _ga_t1->getYnormalized();


        trackball(axis,angle,px1,py1,px0,py0);

        osg::Quat new_rotate;

        new_rotate.makeRotate(angle * throwScale,axis);

        _rotation = _rotation*new_rotate;

        return true;

    }
    else if (buttonMask==GUIEventAdapter::MIDDLE_MOUSE_BUTTON ||
        
buttonMask==(GUIEventAdapter::LEFT_MOUSE_BUTTON|GUIEventAdapter::RIGHT_MOUSE_BUTTON))
    {

        // pan model.

        float scale = -0.3f * _distance * throwScale;

        osg::Matrix rotation_matrix;
        rotation_matrix.makeRotate(_rotation);

        osg::Vec3 dv(dx*scale,dy*scale,0.0f);

        _center += dv*rotation_matrix;

        return true;

    }
    else if ((buttonMask==GUIEventAdapter::RIGHT_MOUSE_BUTTON) ||
(buttonMask==GUIEventAdapter::SCROLL))
    {

        // zoom model.

        float fd = _distance;
        float scale = 1.0f+ dy * throwScale;
        if (fd*scale>_modelScale*_minimumZoomScale)
        {

            _distance *= scale;

        }
        else
        {

            // notify(DEBUG_INFO) << "Pushing forward"<<std::endl;
            // push the camera forward.
            float scale = -fd;

            osg::Matrix rotation_matrix(_rotation);

            osg::Vec3 dv =
(osg::Vec3(0.0f,0.0f,-1.0f)*rotation_matrix)*(dy*scale);

            _center += dv;

        }

        return true;

    }
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to