Hi Chris,

I've looked over your suggested changes but don't feel they are appropriate
to merge as is.  FYI, submissions should be sent as full modified files
rather than copy and pasted diffs.  I graphical merge all files.  diff's
like this are OK for discussion though.

While I haven't had enough time to think through an ideal way to provide
the functionality you are after, I think one would need to provide both the
up and side vector, just providing the up vector would not be sufficient.
Caching the rotation matrices is also something that is probably not needed
- the camera manipulators are only called once per frame so the overhead in
computing values on the fly is very low.

Also when I merged submissions I attribute each submissions to the
contributors, could you provide a full name.

Thanks,
Robert.

Robert.

On 8 October 2014 16:04, SkillCheck <[email protected]> wrote:

> Hi,
>
> I would like to submit my modifications to the osgGA::SphericalManipulator
> class to allow the specification of any up axis. The default now is to
> always use the Z axis as the vertical axis. This change is a generalization
> of the idea allowing one to specify any vector as the up axis.
>
> I've implemented the getMatrix() and getInverseMatrix() methods to
> incorporate this additional transformation. However, I did not update the
> setByMatrix() method as I was unsure of the correct way to implement this.
> If anyone has hints about how to do this please let me know and I will
> incorporate it.
>
> Regards,
> Chris
>
> $ diff
> /s/sandbox/dev/extern/OpenSceneGraph-3.2.0/include/osgGA/SphericalManipulator
> SphericalManipulator
> 81a82,85
>
> >         void setUpAxis(const osg::Vec3d& upAxis);
> >         const osg::Vec3d& getUpAxis() const {return _upAxis;}
> >         const osg::Vec3d& getPitchAxis() const {return _pitchAxis;}
> >
> 170a175,178
> >         osg::Vec3d      _upAxis;
> >         osg::Vec3d      _pitchAxis;
> >         osg::Matrix     _orientationOffset;
> >         osg::Matrix     _orientationOffsetInverse;
>
>
>
> $ diff
> /s/sandbox/dev/extern/OpenSceneGraph-3.2.0/src/osgGA/SphericalManipulator.cpp
> SphericalManipulator.cpp
> 17a18,19
>
> >     _upAxis.set(0.0, 0.0, 1.0);
> >     _pitchAxis.set(1.0, 0.0, 0.0);
> 62a65,77
> >
> >
> //--------------------------------------------------------------------------------------------------
> > void SphericalManipulator::setUpAxis(const osg::Vec3d& upAxis)
> > {
> >     _upAxis = upAxis;
> >     _upAxis.normalize();
> >
> >     osg::Quat q; q.makeRotate( osg::Vec3d(0.0,0.0,1.0), _upAxis );
> >     _pitchAxis = q * osg::Vec3d(1.0,0.0,0.0);
> >     _orientationOffset.makeRotate(q);
> >     _orientationOffsetInverse = osg::Matrix::inverse(_orientationOffset);
> > }
> >
> 263,264c278,280
> <            osg::Matrixd::rotate(PI_2-_elevation,1.0,0.0,0.0)*
> <            osg::Matrixd::rotate(PI_2+_heading,0.0,0.0,1.0)*
> ---
> >            _orientationOffset*
> >            osg::Matrixd::rotate(PI_2-_elevation,_pitchAxis)*
> >            osg::Matrixd::rotate(PI_2+_heading,_upAxis)*
> 271,272c287,289
> <            osg::Matrixd::rotate(PI_2+_heading,0.0,0.0,-1.0)*
> <            osg::Matrixd::rotate(PI_2-_elevation,-1.0,0.0,0.0)*
> ---
> >            osg::Matrixd::rotate(PI_2+_heading,-_upAxis)*
> >            osg::Matrixd::rotate(PI_2-_elevation,-_pitchAxis)*
> >            _orientationOffsetInverse*
> 427a445
> >
>
> _______________________________________________
> 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