[osg-users] SphericalManipulator with limited elevation range

2010-12-15 Thread Matthew Koichi Grimes
I'm transitioning my map viewer code from using GL/GLUT directly to using
OSG. In my old code, the camera manipulation interface was very similar to
osgGA::SphericalManipulator, in that the camera stared at a point on the
ground, while the mouse moved the camera around on a sphere centered at that
point. The one difference was that in my interface, the camera elevation was
limited to 0 to pi/2 radians. This prevented the camera from sinking below
the ground (elevation  0), or rising up and over the top of the sphere,
looking at the ground upside-down (elevation  pi/2).

I would like to have this same camera behavior in OSG. What would be the
best way to go about it? Obviously I could add setMaximumElevation and
setMinimumElevation methods to SphericalManipulator (it already has
setMinimumZoomScale, etc), but if there's a way to limit elevation without
changing the OSG source code, that would be preferable, for distribution
reasons.

Thanks,
-- Matt
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] SphericalManipulator with limited elevation range

2010-12-15 Thread Tom Pearce
If you want to reuse a lot of the code from SphericalManipulator but add some 
new features, derive a new class from SphericalManipulator (instead of changing 
the osg source at all).  At the very least it's a good way to experiment with 
the new features you're adding without having to start over all the way.  And 
later if you want to clean your manipulator up a bit you can derive it from 
MatrixManipulator directly, and reimplement that necessary functions while 
cutting out anything from SphericalManipulator which you don't need.

Cheers,
Tom

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34897#34897





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