- // Make an FGPanel object. But *don't* call init() or bind() on
- // it -- those methods touch static state.
- const char *path = props->getStringValue("path");
- _panel = fgReadPanel(path);
- if (!_panel)
- throw sg_io_exception(string("Failed to load panel ") + path);
-
- // And the corner points
- SGPropertyNode* pt = props->getChild("bottom-left");
- _bottomLeft[0] = pt->getFloatValue("x-m");
- _bottomLeft[1] = pt->getFloatValue("y-m");
- _bottomLeft[2] = pt->getFloatValue("z-m");
+ commonInit();
+ _panelPath = props->getStringValue("path");
+
+ // And the corner points
+ SGPropertyNode* pt = props->getChild("bottom-left");
+ _bottomLeft[0] = pt->getFloatValue("x-m");
+ _bottomLeft[1] = pt->getFloatValue("y-m");
+ _bottomLeft[2] = pt->getFloatValue("z-m");
+
+ pt = props->getChild("top-left");
+ _topLeft[0] = pt->getFloatValue("x-m");
+ _topLeft[1] = pt->getFloatValue("y-m");
+ _topLeft[2] = pt->getFloatValue("z-m");
+
+ pt = props->getChild("bottom-right");
+ _bottomRight[0] = pt->getFloatValue("x-m");
+ _bottomRight[1] = pt->getFloatValue("y-m");
+ _bottomRight[2] = pt->getFloatValue("z-m");
+
+ _depthTest = props->getBoolValue("depth-test");
+}
+
+FGPanelNode::FGPanelNode() :
+ _is2d(true),
+ _resizeToViewport(true),
+ _depthTest(false)
+{
+ globals->get_commands()->addCommand("panel-mouse-click", this, &FGPanelNode::panelMouseClickCommand);
+
+ SGPropertyNode* pathNode = fgGetNode("/sim/panel/path");
+ _pathListener.reset(new PanelPathListener(this));
+ pathNode->addChangeListener(_pathListener.get());
+ setPanelPath(pathNode->getStringValue());