]> git.mxchange.org Git - flightgear.git/blob - src/Model/model_panel.cxx
Avoid division by zero.
[flightgear.git] / src / Model / model_panel.cxx
1 // model.cxx - manage a 3D aircraft model.
2 // Written by David Megginson, started 2002.
3 //
4 // This file is in the Public Domain, and comes with no warranty.
5
6 #ifdef HAVE_CONFIG_H
7 #  include <config.h>
8 #endif
9
10 #include <simgear/compiler.h>
11
12 #include <osg/Geode>
13
14 #include <simgear/props/props.hxx>
15 #include <simgear/scene/model/modellib.hxx>
16 #include <simgear/scene/util/SGNodeMasks.hxx>
17
18 #include "panelnode.hxx"
19 #include "model_panel.hxx"
20
21 using std::vector;
22
23 using namespace simgear;
24
25 static
26 osg::Node* load_panel(SGPropertyNode *n)
27 {
28     osg::Geode* geode = new osg::Geode;
29     geode->addDrawable(new FGPanelNode(n));
30     return geode;
31 }
32
33 \f
34 ////////////////////////////////////////////////////////////////////////
35 // Global functions.
36 ////////////////////////////////////////////////////////////////////////
37
38 osg::Node *
39 fgLoad3DModelPanel(const string &path, SGPropertyNode *prop_root)
40 {
41     osg::Node* node = SGModelLib::loadModel(path, prop_root, load_panel);
42     if (node)
43         node->setNodeMask(~SG_NODEMASK_TERRAIN_BIT);
44     return node;
45 }
46
47
48 // end of model_panel.cxx