1999-01-07 19:25:53 +00:00
|
|
|
// panel.hxx -- instrument panel defines and prototypes
|
|
|
|
//
|
|
|
|
// Written by Friedemann Reinhard, started June 1998.
|
1999-12-23 17:37:18 +00:00
|
|
|
//
|
|
|
|
// Major code reorganization by David Megginson, November 1999.
|
1999-01-07 19:25:53 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
1998-11-11 00:19:27 +00:00
|
|
|
//
|
1999-01-07 19:25:53 +00:00
|
|
|
// $Id$
|
1999-05-12 02:04:38 +00:00
|
|
|
|
1998-06-27 16:47:53 +00:00
|
|
|
|
|
|
|
#ifndef _PANEL_HXX
|
|
|
|
#define _PANEL_HXX
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __cplusplus
|
|
|
|
# error This library requires C++
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1998-11-09 23:38:50 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
1999-01-07 19:25:53 +00:00
|
|
|
#ifdef HAVE_WINDOWS_H
|
1998-11-09 23:38:50 +00:00
|
|
|
# include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <GL/glut.h>
|
1999-01-07 19:25:53 +00:00
|
|
|
#include <XGL/xgl.h>
|
1998-11-09 23:38:50 +00:00
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
class FGInstrument; // FIXME: rearrange to avoid this?
|
|
|
|
|
1998-11-09 23:38:50 +00:00
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
/**
|
|
|
|
* Top-level class to hold an instance of a panel.
|
|
|
|
*/
|
1999-03-08 21:56:08 +00:00
|
|
|
class FGPanel{
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
static FGPanel *OurPanel; // current_panel would be better
|
|
|
|
|
|
|
|
// FIXME: a few other classes have a
|
|
|
|
// dependency on this information; it
|
|
|
|
// would be nice to fix that.
|
|
|
|
GLuint panel_tex_id[2];
|
|
|
|
|
|
|
|
FGPanel();
|
|
|
|
virtual ~FGPanel ();
|
|
|
|
virtual float get_height(void) { return height; }
|
|
|
|
virtual void ReInit( int x, int y, int finx, int finy);
|
|
|
|
virtual void Update(void);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
int height;
|
|
|
|
int width;
|
|
|
|
GLubyte *background;
|
|
|
|
GLubyte *imag;
|
|
|
|
int imag_width, imag_height;
|
|
|
|
GLubyte *img;
|
|
|
|
int img_width, img_height;
|
|
|
|
// The instruments on the panel.
|
|
|
|
FGInstrument * horizonIndicator;
|
|
|
|
FGInstrument * turnCoordinator;
|
|
|
|
FGInstrument * rpmIndicator;
|
|
|
|
FGInstrument * airspeedIndicator;
|
|
|
|
FGInstrument * verticalSpeedIndicator;
|
|
|
|
FGInstrument * altimeter;
|
|
|
|
FGInstrument * altimeter2;
|
1999-03-08 21:56:08 +00:00
|
|
|
};
|
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract base class for all panel instruments.
|
|
|
|
*/
|
1999-03-08 21:56:08 +00:00
|
|
|
class FGInstrument{
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
FGInstrument (void) {}
|
|
|
|
virtual ~FGInstrument (void) {}
|
|
|
|
virtual void Init(void) = 0;
|
|
|
|
virtual void Render(void) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
float XPos;
|
|
|
|
float YPos;
|
1999-03-08 21:56:08 +00:00
|
|
|
};
|
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instrument: the artificial horizon.
|
|
|
|
*/
|
|
|
|
class FGHorizon : public FGInstrument
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
FGHorizon (float inXPos, float inYPos);
|
|
|
|
virtual ~FGHorizon (void);
|
|
|
|
virtual void Init (void);
|
|
|
|
virtual void Render (void);
|
1999-05-12 02:04:38 +00:00
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
private:
|
|
|
|
float texXPos;
|
|
|
|
float texYPos;
|
|
|
|
float radius;
|
|
|
|
float bottom; // tell the program the offset between midpoint and bottom
|
|
|
|
float top; // guess what ;-)
|
|
|
|
float vertices[180][2];
|
|
|
|
float normals[180][3];
|
|
|
|
float texCoord[180][2];
|
1999-03-08 21:56:08 +00:00
|
|
|
};
|
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instrument: the turn co-ordinator.
|
|
|
|
*/
|
|
|
|
class FGTurnCoordinator : public FGInstrument
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
FGTurnCoordinator (float inXPos, float inYPos);
|
2000-02-10 23:37:56 +00:00
|
|
|
virtual ~FGTurnCoordinator (void);
|
1999-12-23 17:37:18 +00:00
|
|
|
virtual void Init (void);
|
|
|
|
virtual void Render(void);
|
|
|
|
|
|
|
|
private:
|
|
|
|
float PlaneTexXPos;
|
|
|
|
float PlaneTexYPos;
|
|
|
|
float alpha;
|
|
|
|
float PlaneAlpha;
|
|
|
|
float alphahist[2];
|
|
|
|
float rollhist[2];
|
|
|
|
float BallXPos;
|
|
|
|
float BallYPos;
|
|
|
|
float BallTexXPos;
|
|
|
|
float BallTexYPos;
|
|
|
|
float BallRadius;
|
|
|
|
GLfloat vertices[72];
|
|
|
|
static GLfloat wingArea[];
|
|
|
|
static GLfloat elevatorArea[];
|
|
|
|
static GLfloat rudderArea[];
|
1999-03-08 21:56:08 +00:00
|
|
|
};
|
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Abstract base class for gauges with needles and textured backgrounds.
|
|
|
|
*
|
|
|
|
* The airspeed indicator, vertical speed indicator, altimeter, and RPM
|
|
|
|
* gauge are all derived from this class.
|
|
|
|
*/
|
|
|
|
class FGTexInstrument : public FGInstrument
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGTexInstrument (void);
|
|
|
|
virtual ~FGTexInstrument ();
|
|
|
|
virtual void Init(void);
|
|
|
|
virtual void Render(void);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void CreatePointer(void);
|
|
|
|
virtual void UpdatePointer(void);
|
|
|
|
virtual double getValue () const = 0;
|
|
|
|
|
|
|
|
float radius;
|
|
|
|
float length;
|
|
|
|
float width;
|
|
|
|
float angle;
|
|
|
|
float tape[2];
|
|
|
|
float value1;
|
|
|
|
float value2;
|
|
|
|
float alpha1;
|
|
|
|
float alpha2;
|
|
|
|
float textureXPos;
|
|
|
|
float textureYPos;
|
|
|
|
GLfloat vertices[20];
|
1999-03-08 21:56:08 +00:00
|
|
|
};
|
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instrument: the airspeed indicator.
|
|
|
|
*/
|
|
|
|
class FGAirspeedIndicator : public FGTexInstrument
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGAirspeedIndicator (int x, int y);
|
|
|
|
virtual ~FGAirspeedIndicator ();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
double getValue () const;
|
1999-03-08 21:56:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
/**
|
|
|
|
* Instrument: the vertical speed indicator.
|
|
|
|
*/
|
|
|
|
class FGVerticalSpeedIndicator : public FGTexInstrument
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGVerticalSpeedIndicator (int x, int y);
|
|
|
|
virtual ~FGVerticalSpeedIndicator ();
|
1998-11-09 23:38:50 +00:00
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
protected:
|
|
|
|
double getValue () const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instrument: the altimeter (big hand?)
|
|
|
|
*/
|
|
|
|
class FGAltimeter : public FGTexInstrument
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGAltimeter (int x, int y);
|
|
|
|
virtual ~FGAltimeter ();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
double getValue () const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instrument: the altimeter (little hand?)
|
|
|
|
*/
|
|
|
|
class FGAltimeter2 : public FGTexInstrument
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGAltimeter2 (int x, int y);
|
|
|
|
virtual ~FGAltimeter2 ();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
double getValue () const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instrument: the RPM gauge (actually manifold pressure right now).
|
|
|
|
*/
|
|
|
|
class FGRPMIndicator : public FGTexInstrument
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FGRPMIndicator (int x, int y);
|
|
|
|
virtual ~FGRPMIndicator ();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
double getValue () const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: move to FGPanel, somehow
|
|
|
|
void fgEraseArea(GLfloat *array, int NumVerti, GLfloat texXPos, GLfloat texYPos, GLfloat XPos, GLfloat YPos, int Texid, float ScaleFactor);
|
1998-11-09 23:38:50 +00:00
|
|
|
|
1999-01-07 19:25:53 +00:00
|
|
|
#endif // _PANEL_HXX
|