1 #ifndef FG_PANELNODE_HXX
2 #define FG_PANELNODE_HXX
6 #include <osg/Drawable>
8 #include <simgear/structure/SGSharedPtr.hxx>
9 #include <simgear/props/props.hxx>
14 // PanelNode defines an OSG drawable wrapping the 2D panel drawing code
16 class FGPanelNode : public osg::Drawable
21 FGPanelNode(SGPropertyNode* props);
22 virtual ~FGPanelNode();
25 virtual osg::Object* cloneType() const { return 0; }
26 virtual osg::Object* clone(const osg::CopyOp& copyop) const { return 0; }
28 FGPanel* getPanel() { return _panel; }
30 virtual void drawImplementation(osg::RenderInfo& renderInfo) const
31 { drawImplementation(*renderInfo.getState()); }
33 void drawImplementation(osg::State& state) const;
34 virtual osg::BoundingBox computeBound() const;
36 /** Return true, FGPanelNode does support accept(PrimitiveFunctor&). */
37 virtual bool supports(const osg::PrimitiveFunctor&) const { return true; }
39 virtual void accept(osg::PrimitiveFunctor& functor) const;
41 static osg::Node* load(SGPropertyNode *n);
42 static osg::Node* create2DPanelNode();
44 osg::Matrix transformMatrix() const;
46 void setPanelPath(const std::string& panel);
50 * is visible in 2D mode or not?
52 bool isVisible2d() const;
57 SGSharedPtr<FGPanel> _panel;
58 std::string _panelPath;
60 bool _resizeToViewport;
63 // Panel corner coordinates
64 osg::Vec3 _bottomLeft, _topLeft, _bottomRight;
66 int _xmin, _ymin, _xmax, _ymax;
68 // The matrix that results, which transforms 2D x/y panel
69 // coordinates into 3D coordinates of the panel quadrilateral.
72 /// should the 2D panel auto-hide when the view orientation changes
73 mutable SGPropertyNode_ptr _autoHide2d;
75 /// should the 2D panel be hidden in views other than the default (view 0)
76 mutable SGPropertyNode_ptr _hideNonDefaultViews;
80 #endif // FG_PANELNODE_HXX