]> git.mxchange.org Git - flightgear.git/blob - src/Model/panelnode.hxx
Continuous replay: use correct replay duration
[flightgear.git] / src / Model / panelnode.hxx
1 #ifndef FG_PANELNODE_HXX
2 #define FG_PANELNODE_HXX
3
4 #include <osg/Vec3>
5 #include <osg/Matrix>
6 #include <osg/Drawable>
7
8 class FGPanel;
9 class SGPropertyNode;
10
11 // PanelNode defines an SSG leaf object that draws a FGPanel object
12 // into the scene graph.  Note that this is an incomplete SSG object,
13 // many methods, mostly involved with modelling and runtime
14 // inspection, are unimplemented.
15
16 // Static mouse handler for all FGPanelNodes.  Very clumsy; this
17 // should really be done through our container (an aircraft model,
18 // typically).
19 bool fgHandle3DPanelMouseEvent(int button, int updown, int x, int y);
20 void fgUpdate3DPanels();
21
22 class FGPanelNode : public osg::Drawable // OSGFIXME 
23 {
24 public:
25     FGPanelNode(SGPropertyNode* props);
26     virtual ~FGPanelNode();
27
28     // OSGFIXME
29     virtual osg::Object* cloneType() const { return 0; }
30     virtual osg::Object* clone(const osg::CopyOp& copyop) const { return 0; }        
31
32     bool doMouseAction(int button, int updown, int x, int y);
33
34     FGPanel* getPanel() { return _panel; }
35
36     virtual void drawImplementation(osg::RenderInfo& renderInfo) const
37     { drawImplementation(*renderInfo.getState()); }
38     void drawImplementation(osg::State& state) const;
39     virtual osg::BoundingBox computeBound() const;
40
41 private:
42     FGPanel* _panel;
43
44     // Panel corner coordinates
45     osg::Vec3 _bottomLeft, _topLeft, _bottomRight;
46
47     // The input range expected in the panel definition.  These x/y
48     // coordinates will map to the right/top sides.
49     float _xmax, _ymax;
50     
51     // The matrix that results, which transforms 2D x/y panel
52     // coordinates into 3D coordinates of the panel quadrilateral.
53     osg::Matrix _xform;
54
55     // The matrix transformation state that was active the last time
56     // we were rendered.  Used by the mouse code to compute
57     // intersections.
58     mutable osg::Matrix _lastModelview;
59     mutable osg::Matrix _lastProjection;
60     mutable double _lastViewport[4];
61 };
62
63
64 #endif // FG_PANELNODE_HXX