Debian Codegraph @

test_suite/FGTestApi/scene_graph.cxx

raw symbols SCIP
1 /*
2 * Copyright (C) 2018 Edward d'Auvergne
3 *
4 * This file is part of the program FlightGear.
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "scene_graph.hxx"
21
22 #include <Main/fg_props.hxx>
23 #include <Main/globals.hxx>
24 #include <Main/locale.hxx>
25 #include <Scenery/scenery.hxx>
26 #include <Viewer/renderer.hxx>
27 #include <Viewer/FGEventHandler.hxx>
28
29
30 namespace FGTestApi {
31 namespace setUp {
32
33 void initScenery()
34 {
35 // Read the global defaults from $FG_ROOT/defaults.xml (needed by the renderer).
36 SGPath defaultsXML = globals->get_fg_root() / "defaults.xml";
37 if (!defaultsXML.exists())
38 SG_LOG(SG_GENERAL, SG_ALERT, "Cannot read the global defaults from \"" << defaultsXML.utf8Str() << "\".");
39 fgLoadProps("defaults.xml", globals->get_props());
40
41 // otherwise fgSplashProgress will assert
42 globals->get_locale()->selectLanguage({});
43
44 // Set up the renderer.
45 osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
46 FGRenderer* render = globals->get_renderer();
47 render->init();
48 render->setView(viewer.get());
49
50 // Start up the scenery subsystem.
51 globals->get_subsystem_mgr()->add<FGScenery>();
52 globals->get_scenery()->init();
53 globals->get_scenery()->bind();
54 }
55
56 } // End of namespace setUp.
57 } // End of namespace FGTestApi.