From Serge Lages, "Here you can find some modifications to osgManipulator to work with double values instead of floats. Indeed I faced problems with the osgManipulator library when working with Earth based scenes, it was impossible to drag objects in a precise way if they were too far from the center of the scene."

This commit is contained in:
Robert Osfield
2008-11-21 11:23:21 +00:00
parent 672a5d14fe
commit 341abcb315
21 changed files with 261 additions and 261 deletions

View File

@@ -26,11 +26,11 @@ using namespace osgManipulator;
namespace
{
osg::Vec2 computeScale(const osg::Vec3& startProjectedPoint,
const osg::Vec3& projectedPoint,
const osg::Vec2& scaleCenter)
osg::Vec2d computeScale(const osg::Vec3d& startProjectedPoint,
const osg::Vec3d& projectedPoint,
const osg::Vec2d& scaleCenter)
{
osg::Vec2 scale(1.0,1.0);
osg::Vec2d scale(1.0,1.0);
if ((startProjectedPoint[0] - scaleCenter[0]) != 0.0)
scale[0] = (projectedPoint[0] - scaleCenter[0])/(startProjectedPoint[0] - scaleCenter[0]);
if ((startProjectedPoint[2] - scaleCenter[1]) != 0.0)
@@ -126,11 +126,11 @@ bool Scale2DDragger::handle(const PointerInfo& pointer, const osgGA::GUIEventAda
// Pick move.
case (osgGA::GUIEventAdapter::DRAG):
{
osg::Vec3 projectedPoint;
osg::Vec3d projectedPoint;
if (_projector->project(pointer, projectedPoint))
{
// Compute scale.
osg::Vec2 scale = computeScale(_startProjectedPoint,projectedPoint,_scaleCenter);
osg::Vec2d scale = computeScale(_startProjectedPoint,projectedPoint,_scaleCenter);
if (scale[0] < getMinScale()[0]) scale[0] = getMinScale()[0];
if (scale[1] < getMinScale()[1]) scale[1] = getMinScale()[1];