Changed HelpHandler so it supports use with CompositeViewer and Viewer
This commit is contained in:
parent
a5ed021066
commit
4cf73d4c87
@ -249,8 +249,8 @@ int main( int argc, char **argv )
|
||||
|
||||
view->addEventHandler( statesetManipulator.get() );
|
||||
|
||||
osg::ref_ptr<osgViewer::StatsHandler> statsHandler = new osgViewer::StatsHandler;
|
||||
view->addEventHandler( statsHandler.get() );
|
||||
view->addEventHandler( new osgViewer::StatsHandler );
|
||||
view->addEventHandler( new osgViewer::HelpHandler );
|
||||
}
|
||||
|
||||
// view two
|
||||
@ -283,6 +283,7 @@ int main( int argc, char **argv )
|
||||
|
||||
}
|
||||
|
||||
|
||||
while (arguments.read("-s")) { viewer.setThreadingModel(osgViewer::CompositeViewer::SingleThreaded); }
|
||||
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::CompositeViewer::ThreadPerContext); }
|
||||
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::CompositeViewer::ThreadPerCamera); }
|
||||
|
@ -50,9 +50,9 @@ class OSGVIEWER_EXPORT HelpHandler : public osgGA::GUIEventHandler
|
||||
|
||||
protected:
|
||||
|
||||
void setUpHUDCamera(osgViewer::Viewer* viewer);
|
||||
void setUpHUDCamera(osgViewer::ViewerBase* viewer);
|
||||
|
||||
void setUpScene(osgViewer::Viewer* viewer);
|
||||
void setUpScene(osgViewer::ViewerBase* viewer);
|
||||
|
||||
osg::ref_ptr<osg::ApplicationUsage> _applicationUsage;
|
||||
|
||||
|
@ -40,7 +40,10 @@ void HelpHandler::reset()
|
||||
|
||||
bool HelpHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
|
||||
{
|
||||
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
|
||||
if (!view) return false;
|
||||
|
||||
osgViewer::ViewerBase* viewer = view->getViewerBase();
|
||||
if (!viewer) return false;
|
||||
|
||||
if (ea.getHandled()) return false;
|
||||
@ -77,7 +80,7 @@ bool HelpHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapt
|
||||
|
||||
}
|
||||
|
||||
void HelpHandler::setUpHUDCamera(osgViewer::Viewer* viewer)
|
||||
void HelpHandler::setUpHUDCamera(osgViewer::ViewerBase* viewer)
|
||||
{
|
||||
osgViewer::GraphicsWindow* window = dynamic_cast<osgViewer::GraphicsWindow*>(_camera->getGraphicsContext());
|
||||
|
||||
@ -106,7 +109,7 @@ void HelpHandler::setUpHUDCamera(osgViewer::Viewer* viewer)
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
void HelpHandler::setUpScene(osgViewer::Viewer* viewer)
|
||||
void HelpHandler::setUpScene(osgViewer::ViewerBase* viewer)
|
||||
{
|
||||
_switch = new osg::Switch;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user