1 // panel.hxx -- instrument panel defines and prototypes
3 // Written by Friedemann Reinhard, started June 1998.
5 // Major code reorganization by David Megginson, November 1999.
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 # error This library requires C++
44 class FGInstrument; // FIXME: rearrange to avoid this?
48 * Top-level class to hold an instance of a panel.
53 static FGPanel *OurPanel; // current_panel would be better
55 // FIXME: a few other classes have a
56 // dependency on this information; it
57 // would be nice to fix that.
58 GLuint panel_tex_id[2];
62 virtual float get_height(void) { return height; }
63 virtual void ReInit( int x, int y, int finx, int finy);
64 virtual void Update(void);
72 int imag_width, imag_height;
74 int img_width, img_height;
75 // The instruments on the panel.
76 FGInstrument * horizonIndicator;
77 FGInstrument * turnCoordinator;
78 FGInstrument * rpmIndicator;
79 FGInstrument * airspeedIndicator;
80 FGInstrument * verticalSpeedIndicator;
81 FGInstrument * altimeter;
82 FGInstrument * altimeter2;
87 * Abstract base class for all panel instruments.
92 FGInstrument (void) {}
93 virtual ~FGInstrument (void) {}
94 virtual void Init(void) = 0;
95 virtual void Render(void) = 0;
104 * Instrument: the artificial horizon.
106 class FGHorizon : public FGInstrument
110 FGHorizon (float inXPos, float inYPos);
111 virtual ~FGHorizon (void);
112 virtual void Init (void);
113 virtual void Render (void);
119 float bottom; // tell the program the offset between midpoint and bottom
120 float top; // guess what ;-)
121 float vertices[180][2];
122 float normals[180][3];
123 float texCoord[180][2];
128 * Instrument: the turn co-ordinator.
130 class FGTurnCoordinator : public FGInstrument
134 FGTurnCoordinator (float inXPos, float inYPos);
135 virtual FGTurnCoordinator::~FGTurnCoordinator (void);
136 virtual void Init (void);
137 virtual void Render(void);
151 GLfloat vertices[72];
152 static GLfloat wingArea[];
153 static GLfloat elevatorArea[];
154 static GLfloat rudderArea[];
159 * Abstract base class for gauges with needles and textured backgrounds.
161 * The airspeed indicator, vertical speed indicator, altimeter, and RPM
162 * gauge are all derived from this class.
164 class FGTexInstrument : public FGInstrument
167 FGTexInstrument (void);
168 virtual ~FGTexInstrument ();
169 virtual void Init(void);
170 virtual void Render(void);
173 virtual void CreatePointer(void);
174 virtual void UpdatePointer(void);
175 virtual double getValue () const = 0;
188 GLfloat vertices[20];
193 * Instrument: the airspeed indicator.
195 class FGAirspeedIndicator : public FGTexInstrument
198 FGAirspeedIndicator (int x, int y);
199 virtual ~FGAirspeedIndicator ();
202 double getValue () const;
207 * Instrument: the vertical speed indicator.
209 class FGVerticalSpeedIndicator : public FGTexInstrument
212 FGVerticalSpeedIndicator (int x, int y);
213 virtual ~FGVerticalSpeedIndicator ();
216 double getValue () const;
221 * Instrument: the altimeter (big hand?)
223 class FGAltimeter : public FGTexInstrument
226 FGAltimeter (int x, int y);
227 virtual ~FGAltimeter ();
230 double getValue () const;
235 * Instrument: the altimeter (little hand?)
237 class FGAltimeter2 : public FGTexInstrument
240 FGAltimeter2 (int x, int y);
241 virtual ~FGAltimeter2 ();
244 double getValue () const;
249 * Instrument: the RPM gauge (actually manifold pressure right now).
251 class FGRPMIndicator : public FGTexInstrument
254 FGRPMIndicator (int x, int y);
255 virtual ~FGRPMIndicator ();
258 double getValue () const;
262 // FIXME: move to FGPanel, somehow
263 void fgEraseArea(GLfloat *array, int NumVerti, GLfloat texXPos, GLfloat texYPos, GLfloat XPos, GLfloat YPos, int Texid, float ScaleFactor);