Updated osgstereoimage and osgimpostor to handle the new default

orientation of normalized mouse coords.
This commit is contained in:
Robert Osfield
2003-04-14 18:49:41 +00:00
parent 5df7118d6d
commit deac5b8d4a
3 changed files with 11 additions and 12 deletions

View File

@@ -272,7 +272,7 @@ bool TestManipulator::calcMovement()
// pan model.
osg::Vec3 dv = osg::Vec3(0.0f, 0.0f, 500.0f) * dy;
osg::Vec3 dv = osg::Vec3(0.0f, 0.0f, -500.0f) * dy;
_center += dv;
@@ -287,7 +287,7 @@ bool TestManipulator::calcMovement()
osg::Vec3 uv = _camera->getUpVector();
osg::Vec3 sv = _camera->getSideVector();
osg::Vec3 fv = uv ^ sv;
osg::Vec3 dv = fv*(dy*500.0f)-sv*(dx*500.0f);
osg::Vec3 dv = fv*(dy*-500.0f)-sv*(dx*500.0f);
_center += dv;
computeCameraFromLocalData();

View File

@@ -173,16 +173,16 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
case(osgGA::GUIEventAdapter::DRAG):
case(osgGA::GUIEventAdapter::MOVE):
{
static float px = ea.getX();
static float py = ea.getY();
static float px = ea.getXnormalized();
static float py = ea.getYnormalized();
float dx = ea.getX()-px;
float dy = ea.getY()-py;
float dx = ea.getXnormalized()-px;
float dy = ea.getYnormalized()-py;
px = ea.getX();
py = ea.getY();
px = ea.getXnormalized();
py = ea.getYnormalized();
rotateImage((float)dx/(float)(ea.getXmax()-ea.getXmin()),(float)dy/(float)(ea.getYmax()-ea.getYmin()));
rotateImage(dx,dy);
return true;
}
@@ -267,8 +267,8 @@ void SlideEventHandler::offsetImage(float ds,float dt)
void SlideEventHandler::rotateImage(float rx,float ry)
{
const float scale = 0.5f;
_texmatLeft->setMatrix(_texmatLeft->getMatrix()*osg::Matrix::translate(-rx*scale,ry*scale,0.0f));
_texmatRight->setMatrix(_texmatRight->getMatrix()*osg::Matrix::translate(-rx*scale,ry*scale,0.0f));
_texmatLeft->setMatrix(_texmatLeft->getMatrix()*osg::Matrix::translate(-rx*scale,-ry*scale,0.0f));
_texmatRight->setMatrix(_texmatRight->getMatrix()*osg::Matrix::translate(-rx*scale,-ry*scale,0.0f));
}
void SlideEventHandler::initTexMatrices()

View File

@@ -308,7 +308,6 @@ void Viewer::requestWarpPointer(float x,float y)
{
if (_kbmcb)
{
cout << "x="<<x<<" y="<<y<<endl;
EventAdapter::_s_mx = x;
EventAdapter::_s_my = y;
_kbmcb->getKeyboardMouse()->positionPointer(x,y);