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