]> git.mxchange.org Git - flightgear.git/blob - src/Model/panelnode.hxx
Make sure that all elapsed time gets passed to update when a subsystem
[flightgear.git] / src / Model / panelnode.hxx
1 #include <plib/ssg.h>
2
3 class FGPanel;
4 class SGPropertyNode;
5
6 // PanelNode defines an SSG leaf object that draws a FGPanel object
7 // into the scene graph.  Note that this is an incomplete SSG object,
8 // many methods, mostly involved with modelling and runtime
9 // inspection, are unimplemented.
10
11 // Static mouse handler for all FGPanelNodes.  Very clumsy; this
12 // should really be done through our container (an aircraft model,
13 // typically).
14 bool fgHandle3DPanelMouseEvent(int button, int updown, int x, int y);
15 void fgUpdate3DPanels();
16
17 class FGPanelNode : public ssgLeaf 
18 {
19 protected:
20     virtual void draw_geometry();
21
22 public:
23     FGPanelNode(SGPropertyNode* props);
24     virtual ~FGPanelNode();
25
26     virtual void draw();
27     bool doMouseAction(int button, int updown, int x, int y);
28
29     FGPanel* getPanel() { return _panel; }
30
31     virtual void recalcBSphere() { bsphere_is_invalid = 0; }
32
33     //
34     // A bunch of Plib functions that aren't implemented.  I don't
35     // even know what many of them do, but they're pure virtual and
36     // require implementation.
37     //
38     virtual int getNumTriangles() { die(); return 0; }
39     virtual void getTriangle(int n, short* v1, short* v2, short* v3) { die(); }
40     virtual int getNumLines() { die(); return 0; }
41     virtual void getLine(int n, short* v1, short* v2) { die(); }
42     
43     virtual void drawHighlight(sgVec4 colour) { die(); }
44     virtual void drawHighlight(sgVec4 colour, int i) { die(); }
45     virtual float* getVertex(int i) { die(); return 0; }
46     virtual float* getNormal(int i) { die(); return 0; }
47     virtual float* getColour(int i) { die(); return 0; }
48     virtual float* getTexCoord(int i) { die(); return 0; }
49     virtual void pick(int baseName) { die(); }
50     virtual void isect_triangles(sgSphere* s, sgMat4 m, int testNeeded) { die(); }
51     virtual void hot_triangles(sgVec3 s, sgMat4 m, int testNeeded) { die(); }
52     virtual void los_triangles(sgVec3 s, sgMat4 m, int testNeeded) { die(); }
53     virtual void transform(const sgMat4 m) { die(); }
54
55 private:
56     // Handler for all the unimplemented methods above
57     void die();
58
59     FGPanel* _panel;
60
61     // Panel corner coordinates
62     float _bottomLeft[3], _topLeft[3], _bottomRight[3];
63
64     // The input range expected in the panel definition.  These x/y
65     // coordinates will map to the right/top sides.
66     float _xmax, _ymax;
67     
68     // The matrix that results, which transforms 2D x/y panel
69     // coordinates into 3D coordinates of the panel quadrilateral.
70     GLfloat _xform[16];
71
72     // The matrix transformation state that was active the last time
73     // we were rendered.  Used by the mouse code to compute
74     // intersections.
75     GLfloat _lastModelview[16];
76     GLfloat _lastProjection[16];
77     GLint   _lastViewport[4];
78 };