1
0
Fork 0

src/Viewer/sview.cxx: minor cleanup.

This commit is contained in:
Julian Smith 2021-02-25 08:57:06 +00:00
parent 91dbc902a2
commit 1868d66e45

View file

@ -829,8 +829,8 @@ struct SviewStepDouble : SviewStep
We require that: We require that:
EL is local aircraft's chase-distance (though at the moment we use EL is local aircraft's chase-distance so that local aircraft is in
a fixed value) so that local aircraft is in perfect view. perfect view.
Angle LER is fixed to give good view of both aircraft in Angle LER is fixed to give good view of both aircraft in
window. (Should be related to the vertical angular size of the window. (Should be related to the vertical angular size of the
@ -1647,6 +1647,8 @@ struct EventHandler : osgGA::EventHandler
std::shared_ptr<SviewView> SviewCreate(SGPropertyNode* config) std::shared_ptr<SviewView> SviewCreate(SGPropertyNode* config)
{ {
assert(config);
FGRenderer* renderer = globals->get_renderer(); FGRenderer* renderer = globals->get_renderer();
osgViewer::ViewerBase* viewer_base = renderer->getViewerBase(); osgViewer::ViewerBase* viewer_base = renderer->getViewerBase();
osgViewer::CompositeViewer* composite_viewer = dynamic_cast<osgViewer::CompositeViewer*>(viewer_base); osgViewer::CompositeViewer* composite_viewer = dynamic_cast<osgViewer::CompositeViewer*>(viewer_base);
@ -1655,19 +1657,15 @@ std::shared_ptr<SviewView> SviewCreate(SGPropertyNode* config)
return nullptr; return nullptr;
} }
osgViewer::View* main_view = renderer->getView(); osgViewer::View* main_view = renderer->getView();
osg::Node* scene_data = main_view->getSceneData(); osg::Node* scene_data = main_view->getSceneData();
SG_LOG(SG_GENERAL, SG_ALERT, "main_view->getNumSlaves()=" << main_view->getNumSlaves()); SG_LOG(SG_GENERAL, SG_ALERT, "main_view->getNumSlaves()=" << main_view->getNumSlaves());
osgViewer::View* view = new osgViewer::View(); osgViewer::View* view = new osgViewer::View();
//EventHandler* event_handler = new EventHandler;
flightgear::FGEventHandler* event_handler = globals->get_renderer()->getEventHandler(); flightgear::FGEventHandler* event_handler = globals->get_renderer()->getEventHandler();
view->addEventHandler(event_handler); view->addEventHandler(event_handler);
assert(config);
std::shared_ptr<SviewView> sview_view; std::shared_ptr<SviewView> sview_view;
const char* type = config->getStringValue("type"); const char* type = config->getStringValue("type");
@ -1708,6 +1706,7 @@ std::shared_ptr<SviewView> SviewCreate(SGPropertyNode* config)
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
osg::ref_ptr<osg::GraphicsContext> gc; osg::ref_ptr<osg::GraphicsContext> gc;
/* When we implement canvas views, we won't create a new window here. */
if (1) { if (1) {
/* Create a new window. */ /* Create a new window. */