Added support for Viewer::setViewer::setView so that the internal old
style osg::Camera and camera manipulators are updated correctly.
This commit is contained in:
@@ -357,8 +357,8 @@ bool OsgCameraGroup::realize()
|
||||
getTopMostSceneData()->accept(sfpn);
|
||||
if (sfpn._foundParticles)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Warning: disabling multi-threading of cull and draw"<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<" to avoid threading problems in osgParticle."<<std::endl;
|
||||
osg::notify(osg::INFO)<<"Warning: disabling multi-threading of cull and draw"<<std::endl;
|
||||
osg::notify(osg::INFO)<<" to avoid threading problems in osgParticle."<<std::endl;
|
||||
_thread_model = Producer::CameraGroup::SingleThreaded;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,6 +172,23 @@ unsigned int Viewer::addCameraManipulator(osgGA::CameraManipulator* cm)
|
||||
return num;
|
||||
}
|
||||
|
||||
bool Viewer::done() const
|
||||
{
|
||||
return _done;
|
||||
}
|
||||
|
||||
void Viewer::setView(const osg::Matrix& matrix)
|
||||
{
|
||||
OsgCameraGroup::setView(matrix);
|
||||
if (_keyswitchManipulator.valid() && _old_style_osg_camera.valid())
|
||||
{
|
||||
_old_style_osg_camera->home();
|
||||
_old_style_osg_camera->transformLookAt(matrix);
|
||||
osg::ref_ptr<osgProducer::EventAdapter> init_event = _kbmcb->createEventAdapter();
|
||||
_keyswitchManipulator->init(*init_event,*this);
|
||||
}
|
||||
}
|
||||
|
||||
bool Viewer::realize( ThreadingModel thread_model )
|
||||
{
|
||||
if( _realized ) return _realized;
|
||||
@@ -194,7 +211,7 @@ bool Viewer::realize()
|
||||
{
|
||||
osg::ref_ptr<osgProducer::EventAdapter> init_event = _kbmcb->createEventAdapter();
|
||||
init_event->adaptFrame(0.0);
|
||||
|
||||
|
||||
_keyswitchManipulator->setCamera(_old_style_osg_camera.get());
|
||||
_keyswitchManipulator->setNode(getSceneDecorator());
|
||||
_keyswitchManipulator->home(*init_event,*this);
|
||||
@@ -256,7 +273,7 @@ void Viewer::update()
|
||||
}
|
||||
|
||||
// update the main producer camera
|
||||
if (_old_style_osg_camera.valid()) setView(_old_style_osg_camera->getModelViewMatrix());
|
||||
if (_old_style_osg_camera.valid()) OsgCameraGroup::setView(_old_style_osg_camera->getModelViewMatrix());
|
||||
}
|
||||
|
||||
void Viewer::frame()
|
||||
@@ -282,15 +299,13 @@ void Viewer::selectCameraManipulator(unsigned int no)
|
||||
|
||||
void Viewer::requestWarpPointer(float x,float y)
|
||||
{
|
||||
|
||||
if (_kbmcb)
|
||||
{
|
||||
EventAdapter::_s_mx = x;
|
||||
EventAdapter::_s_my = y;
|
||||
_kbmcb->getKeyboardMouse()->positionPointer(x,y);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::getUsage(osg::ApplicationUsage& usage) const
|
||||
|
||||
Reference in New Issue
Block a user