From Mikhail Izmestev, "I have discovered problem with draggers from osgManipulator in HUD.
This problem caused because osgManipulator::Dragger uses matrices of top camera instead last absolute Camera in NodePath. I attached modified osgManipulator/Dragger.cpp file, where added code for finding last absolute camera. With this changes draggers works in HUD. Example for demonstrate this problem you can find in osg-users list [1]. Mikhail. [1] http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/62636 "
This commit is contained in:
parent
0328691f76
commit
b5c57c3d68
@ -309,9 +309,6 @@ bool Dragger::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&
|
||||
|
||||
if (view->computeIntersections(ea.getX(),ea.getY(),intersections))
|
||||
{
|
||||
_pointer.setCamera(view->getCamera());
|
||||
_pointer.setMousePosition(ea.getX(), ea.getY());
|
||||
|
||||
for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin();
|
||||
hitr != intersections.end();
|
||||
++hitr)
|
||||
@ -327,6 +324,24 @@ bool Dragger::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&
|
||||
{
|
||||
if (dragger==this)
|
||||
{
|
||||
osg::Camera *rootCamera = view->getCamera();
|
||||
osg::NodePath nodePath = _pointer._hitList.front().first;
|
||||
osg::NodePath::reverse_iterator ritr;
|
||||
for(ritr = nodePath.rbegin();
|
||||
ritr != nodePath.rend();
|
||||
++ritr)
|
||||
{
|
||||
osg::Camera* camera = dynamic_cast<osg::Camera*>(*ritr);
|
||||
if (camera && (camera->getReferenceFrame()!=osg::Transform::RELATIVE_RF || camera->getParents().empty()))
|
||||
{
|
||||
rootCamera = camera;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_pointer.setCamera(rootCamera);
|
||||
_pointer.setMousePosition(ea.getX(), ea.getY());
|
||||
|
||||
dragger->handle(_pointer, ea, aa);
|
||||
dragger->setDraggerActive(true);
|
||||
handled = true;
|
||||
@ -341,7 +356,7 @@ bool Dragger::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&
|
||||
if (_draggerActive)
|
||||
{
|
||||
_pointer._hitIter = _pointer._hitList.begin();
|
||||
_pointer.setCamera(view->getCamera());
|
||||
// _pointer.setCamera(view->getCamera());
|
||||
_pointer.setMousePosition(ea.getX(), ea.getY());
|
||||
|
||||
handle(_pointer, ea, aa);
|
||||
|
Loading…
Reference in New Issue
Block a user