Added support for tracking a user specified CoordinateSystemNode for the

CoordinateFrame to use in the camera manipulation
This commit is contained in:
Robert Osfield
2004-04-29 22:19:57 +00:00
parent f81447e839
commit 522ffca03c
2 changed files with 23 additions and 1 deletions

View File

@@ -488,6 +488,23 @@ void Viewer::update()
osgProducer::KeyboardMouseCallback::EventQueue queue;
if (_kbmcb.valid()) _kbmcb->getEventQueue(queue);
if (getKeySwitchMatrixManipulator() && !_coordinateSystemNodePath.empty())
{
osg::Matrixd coordinateFrame;
osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(_coordinateSystemNodePath.back());
if (csn)
{
coordinateFrame = csn->computeLocalCoordinateFrame(_position[0],_position[1],_position[2])* osg::computeLocalToWorld(_coordinateSystemNodePath);
}
else
{
coordinateFrame = osg::computeLocalToWorld(_coordinateSystemNodePath);
}
getKeySwitchMatrixManipulator()->setCoordinateFrame(coordinateFrame);
}
// create an event to signal the new frame.
osg::ref_ptr<osgProducer::EventAdapter> frame_event = new osgProducer::EventAdapter;
frame_event->adaptFrame(_frameStamp->getReferenceTime());
@@ -513,7 +530,6 @@ void Viewer::update()
osgDB::Registry::instance()->getDatabasePager()->updateSceneGraph(_frameStamp->getReferenceTime());
}
if (_updateVisitor.valid())
{
_updateVisitor->setTraversalNumber(_frameStamp->getFrameNumber());