Thursday's tweaks.
This commit is contained in:
parent
e5a447ece9
commit
2805fb7cb2
8 changed files with 133 additions and 41 deletions
100
Cockpit/hud.c
100
Cockpit/hud.c
|
@ -151,6 +151,15 @@ double get_altitude( void )
|
|||
return( FG_Altitude * FEET_TO_METER /* -rough_elev */ );
|
||||
}
|
||||
|
||||
double get_sideslip( void )
|
||||
{
|
||||
fgFLIGHT *f;
|
||||
|
||||
f = current_aircraft.flight;
|
||||
|
||||
return( FG_Beta );
|
||||
}
|
||||
|
||||
//
|
||||
// The following code deals with painting the "instrument" on the display
|
||||
//
|
||||
|
@ -624,21 +633,53 @@ static void drawhorizon( HUD_horizon *horizon )
|
|||
{
|
||||
int x_inc1, y_inc1;
|
||||
int x_inc2, y_inc2;
|
||||
int x_t_inc1, y_t_inc1;
|
||||
|
||||
int d_bottom_x, d_bottom_y;
|
||||
int d_right_x, d_right_y;
|
||||
int d_top_x, d_top_y;
|
||||
int d_left_x, d_left_y;
|
||||
|
||||
// struct fgFLIGHT *f = ¤t_aircraft.flight;
|
||||
double sin_bank, cos_bank;
|
||||
double bank_angle;
|
||||
double bank_angle, sideslip_angle;
|
||||
double sin_sideslip, cos_sideslip;
|
||||
double ss_const; // sideslip angle pixels per rad
|
||||
|
||||
bank_angle = (*horizon->load_value)();
|
||||
bank_angle = (*horizon->load_roll)();
|
||||
sideslip_angle = (*horizon->load_sideslip)();
|
||||
|
||||
// sin_bank = sin( FG_2PI-FG_Phi );
|
||||
// cos_bank = cos( FG_2PI-FG_Phi );
|
||||
sin_bank = sin(FG_2PI-bank_angle);
|
||||
cos_bank = cos(FG_2PI-bank_angle);
|
||||
sin_sideslip = sin(sideslip_angle);
|
||||
cos_sideslip = cos(sideslip_angle);
|
||||
|
||||
x_inc1 = (int)(horizon->scr_width * cos_bank);
|
||||
y_inc1 = (int)(horizon->scr_width * sin_bank);
|
||||
x_inc2 = (int)(horizon->scr_hole * cos_bank);
|
||||
y_inc2 = (int)(horizon->scr_hole * sin_bank);
|
||||
|
||||
x_t_inc1 = (int)(horizon->tee_height * sin_bank);
|
||||
y_t_inc1 = (int)(horizon->tee_height * cos_bank);
|
||||
|
||||
d_bottom_x = horizon->x_pos;
|
||||
d_bottom_y = horizon->y_pos-horizon->scr_hole;
|
||||
d_right_x = horizon->x_pos+horizon->scr_hole;
|
||||
d_right_y = horizon->y_pos;
|
||||
d_top_x = horizon->x_pos;
|
||||
d_top_y = horizon->y_pos+horizon->scr_hole;
|
||||
d_left_x = horizon->x_pos-horizon->scr_hole;
|
||||
d_left_y = horizon->y_pos;
|
||||
|
||||
ss_const = (FG_PI_2/2)/(2*horizon->scr_width-2*horizon->scr_hole);
|
||||
|
||||
d_bottom_x += sideslip_angle*ss_const; // horizon->scr_width-horizon->scr_hole;
|
||||
d_right_x += sideslip_angle*ss_const; // horizon->scr_width-horizon->scr_hole;
|
||||
d_left_x += sideslip_angle*ss_const; // horizon->scr_width-horizon->scr_hole;
|
||||
d_top_x += sideslip_angle*ss_const; // horizon->scr_width-horizon->scr_hole;
|
||||
|
||||
if( horizon->scr_hole == 0 )
|
||||
{
|
||||
drawOneLine( horizon->x_pos - x_inc1, horizon->y_pos - y_inc1, \
|
||||
|
@ -651,6 +692,18 @@ static void drawhorizon( HUD_horizon *horizon )
|
|||
drawOneLine( horizon->x_pos + x_inc2, horizon->y_pos + y_inc2, \
|
||||
horizon->x_pos + x_inc1, horizon->y_pos + y_inc1 );
|
||||
}
|
||||
|
||||
// draw teemarks (?)
|
||||
drawOneLine( horizon->x_pos + x_inc2, horizon->y_pos + y_inc2, \
|
||||
horizon->x_pos + x_inc2 + x_t_inc1, horizon->y_pos + y_inc2 - y_t_inc1 );
|
||||
drawOneLine( horizon->x_pos - x_inc2, horizon->y_pos - y_inc2, \
|
||||
horizon->x_pos - x_inc2 + x_t_inc1, horizon->y_pos - y_inc2 - y_t_inc1 );
|
||||
|
||||
// draw sideslip diamond (it is not yet positioned correctly )
|
||||
drawOneLine( d_bottom_x, d_bottom_y, d_right_x, d_right_y )
|
||||
drawOneLine( d_right_x, d_right_y, d_top_x, d_top_y );
|
||||
drawOneLine( d_top_x, d_top_y, d_left_x, d_left_y );
|
||||
drawOneLine( d_left_x, d_left_y, d_bottom_x, d_bottom_y );
|
||||
}
|
||||
|
||||
// drawControlSurfaces()
|
||||
|
@ -861,7 +914,7 @@ Hptr fgHUDInit( fgAIRCRAFT *current_aircraft )
|
|||
fgHUDSetBrightness( hud, BRT_LIGHT );
|
||||
|
||||
// Small, original HUD configuration
|
||||
// fgHUDAddHorizon( hud, 590, 50, 40, 20, get_roll );
|
||||
// fgHUDAddHorizon( hud, 590, 50, 40, 5, 10, get_roll, get_sideslip );
|
||||
// fgHUDAddLadder ( hud, 330, 190, 90, 180, 70, 10,
|
||||
// NONE, 45, get_roll, get_pitch );
|
||||
// fgHUDAddScale ( hud, VERTICAL, LIMIT, 220, 100, 280, 5, 10,
|
||||
|
@ -877,7 +930,7 @@ Hptr fgHUDInit( fgAIRCRAFT *current_aircraft )
|
|||
// fgHUDAddControlSurfaces( hud, 10, 10, NULL );
|
||||
|
||||
// Bigger and placed a bit higher HUD configuration
|
||||
fgHUDAddHorizon( hud, 590, 50, 40, 20, get_roll );
|
||||
fgHUDAddHorizon( hud, 590, 50, 40, 5, 10, get_roll, get_sideslip );
|
||||
fgHUDAddLadder ( hud, 330, 270, 120, 180, 70, 10,
|
||||
NONE, 45, get_roll, get_pitch );
|
||||
fgHUDAddScale ( hud, VERTICAL, LIMIT, 200, 180, 380, 5, 10,
|
||||
|
@ -920,12 +973,14 @@ void add_instrument( Hptr hud, HIptr pinstrument )
|
|||
// Constructs a HUD_horizon "object" and installs it into the hud instrument
|
||||
// list.
|
||||
|
||||
Hptr fgHUDAddHorizon( Hptr hud, \
|
||||
int x_pos, \
|
||||
int y_pos, \
|
||||
int length, \
|
||||
int hole_len, \
|
||||
double (*load_value)() )
|
||||
Hptr fgHUDAddHorizon( Hptr hud, \
|
||||
int x_pos, \
|
||||
int y_pos, \
|
||||
int length, \
|
||||
int hole_len, \
|
||||
int tee_height,\
|
||||
double (*load_roll)(),\
|
||||
double (*load_sideslip)() )
|
||||
{
|
||||
HUD_horizon *phorizon;
|
||||
HUD_instr *pinstrument;
|
||||
|
@ -946,13 +1001,15 @@ Hptr fgHUDAddHorizon( Hptr hud, \
|
|||
return( NULL );
|
||||
}
|
||||
|
||||
phorizon->x_pos = x_pos;
|
||||
phorizon->y_pos = y_pos;
|
||||
phorizon->scr_width = length;
|
||||
phorizon->scr_hole = hole_len;
|
||||
phorizon->load_value = load_value;
|
||||
phorizon->x_pos = x_pos;
|
||||
phorizon->y_pos = y_pos;
|
||||
phorizon->scr_width = length;
|
||||
phorizon->scr_hole = hole_len;
|
||||
phorizon->tee_height = tee_height;
|
||||
phorizon->load_roll = load_roll;
|
||||
phorizon->load_sideslip = load_sideslip;
|
||||
// Install the horizon in the parent.
|
||||
pinstrument->instr = phorizon;
|
||||
pinstrument->instr = phorizon;
|
||||
// Install the instrument into hud.
|
||||
add_instrument( hud, pinstrument);
|
||||
|
||||
|
@ -1360,11 +1417,14 @@ void fgHUDSetBrightness( Hptr hud, int brightness )
|
|||
}
|
||||
|
||||
/* $Log$
|
||||
/* Revision 1.16 1998/02/19 13:05:49 curt
|
||||
/* Incorporated some HUD tweaks from Michelle America.
|
||||
/* Tweaked the sky's sunset/rise colors.
|
||||
/* Other misc. tweaks.
|
||||
/* Revision 1.17 1998/02/20 00:16:21 curt
|
||||
/* Thursday's tweaks.
|
||||
/*
|
||||
* Revision 1.16 1998/02/19 13:05:49 curt
|
||||
* Incorporated some HUD tweaks from Michelle America.
|
||||
* Tweaked the sky's sunset/rise colors.
|
||||
* Other misc. tweaks.
|
||||
*
|
||||
* Revision 1.15 1998/02/16 13:38:39 curt
|
||||
* Integrated changes from Charlie Hotchkiss.
|
||||
*
|
||||
|
|
|
@ -187,7 +187,9 @@ typedef struct{
|
|||
int y_pos;
|
||||
int scr_width;
|
||||
int scr_hole;
|
||||
double (*load_value)( void );
|
||||
int tee_height;
|
||||
double (*load_roll)( void );
|
||||
double (*load_sideslip)( void );
|
||||
} HUD_horizon, *pHUDhorizon;
|
||||
|
||||
typedef struct {
|
||||
|
@ -264,7 +266,9 @@ Hptr fgHUDAddHorizon( Hptr hud,
|
|||
int y_pos,
|
||||
int length,
|
||||
int hole_len,
|
||||
double (*load_value)( void ) );
|
||||
int tee_height,
|
||||
double (*load_roll)( void ),
|
||||
double (*load_sideslip)( void ) );
|
||||
|
||||
Hptr fgHUDAddScale ( Hptr hud, \
|
||||
int type, \
|
||||
|
@ -353,11 +357,14 @@ void fgUpdateHUD2( Hptr hud ); // Future use?
|
|||
#endif // _HUD_H
|
||||
|
||||
/* $Log$
|
||||
/* Revision 1.12 1998/02/19 13:05:52 curt
|
||||
/* Incorporated some HUD tweaks from Michelle America.
|
||||
/* Tweaked the sky's sunset/rise colors.
|
||||
/* Other misc. tweaks.
|
||||
/* Revision 1.13 1998/02/20 00:16:22 curt
|
||||
/* Thursday's tweaks.
|
||||
/*
|
||||
* Revision 1.12 1998/02/19 13:05:52 curt
|
||||
* Incorporated some HUD tweaks from Michelle America.
|
||||
* Tweaked the sky's sunset/rise colors.
|
||||
* Other misc. tweaks.
|
||||
*
|
||||
* Revision 1.11 1998/02/16 13:38:42 curt
|
||||
* Integrated changes from Charlie Hotchkiss.
|
||||
*
|
||||
|
|
|
@ -253,7 +253,7 @@ static void fgUpdateViewParams( void ) {
|
|||
/* Tell GL we are about to modify the projection parameters */
|
||||
xglMatrixMode(GL_PROJECTION);
|
||||
xglLoadIdentity();
|
||||
gluPerspective(55.0, 1.0/win_ratio, 1.0, 100000.0);
|
||||
gluPerspective(55.0, 1.0/win_ratio, 10.0, 100000.0);
|
||||
}
|
||||
|
||||
xglMatrixMode(GL_MODELVIEW);
|
||||
|
@ -793,9 +793,12 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* $Log$
|
||||
/* Revision 1.63 1998/02/16 16:17:39 curt
|
||||
/* Minor tweaks.
|
||||
/* Revision 1.64 1998/02/20 00:16:23 curt
|
||||
/* Thursday's tweaks.
|
||||
/*
|
||||
* Revision 1.63 1998/02/16 16:17:39 curt
|
||||
* Minor tweaks.
|
||||
*
|
||||
* Revision 1.62 1998/02/16 13:39:42 curt
|
||||
* Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
|
||||
* tiles to occasionally be missing.
|
||||
|
|
11
Main/views.c
11
Main/views.c
|
@ -55,6 +55,10 @@ void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, struct fgLIGHT *l) {
|
|||
MAT3mat R, TMP, UP, LOCAL, VIEW;
|
||||
double ntmp;
|
||||
|
||||
scenery.center.x = scenery.next_center.x;
|
||||
scenery.center.y = scenery.next_center.y;
|
||||
scenery.center.z = scenery.next_center.z;
|
||||
|
||||
/* calculate the cartesion coords of the current lat/lon/0 elev */
|
||||
v->cur_zero_elev = fgPolarToCart(FG_Longitude, FG_Lat_geocentric,
|
||||
FG_Sea_level_radius * FEET_TO_METER);
|
||||
|
@ -184,9 +188,12 @@ void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, struct fgLIGHT *l) {
|
|||
|
||||
|
||||
/* $Log$
|
||||
/* Revision 1.14 1998/02/09 15:07:50 curt
|
||||
/* Minor tweaks.
|
||||
/* Revision 1.15 1998/02/20 00:16:24 curt
|
||||
/* Thursday's tweaks.
|
||||
/*
|
||||
* Revision 1.14 1998/02/09 15:07:50 curt
|
||||
* Minor tweaks.
|
||||
*
|
||||
* Revision 1.13 1998/02/07 15:29:45 curt
|
||||
* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
|
||||
* <chotchkiss@namg.us.anritsu.com>
|
||||
|
|
|
@ -39,6 +39,9 @@ struct fgSCENERY {
|
|||
/* center of current scenery chunk */
|
||||
struct fgCartesianPoint center;
|
||||
|
||||
/* next center of current scenery chunk */
|
||||
struct fgCartesianPoint next_center;
|
||||
|
||||
/* angle of sun relative to current local horizontal */
|
||||
double sun_angle;
|
||||
};
|
||||
|
@ -63,10 +66,13 @@ void fgSceneryRender( void );
|
|||
|
||||
|
||||
/* $Log$
|
||||
/* Revision 1.16 1998/01/27 00:48:03 curt
|
||||
/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
|
||||
/* system and commandline/config file processing code.
|
||||
/* Revision 1.17 1998/02/20 00:16:24 curt
|
||||
/* Thursday's tweaks.
|
||||
/*
|
||||
* Revision 1.16 1998/01/27 00:48:03 curt
|
||||
* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
|
||||
* system and commandline/config file processing code.
|
||||
*
|
||||
* Revision 1.15 1998/01/22 02:59:41 curt
|
||||
* Changed #ifdef FILE_H to #ifdef _FILE_H
|
||||
*
|
||||
|
|
|
@ -201,7 +201,7 @@ void fgTileMgrRender( void ) {
|
|||
/* Find current translation offset */
|
||||
fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
|
||||
index = fgTileCacheExists(&p);
|
||||
fgTileCacheEntryInfo(index, &display_list, &scenery.center );
|
||||
fgTileCacheEntryInfo(index, &display_list, &scenery.next_center );
|
||||
|
||||
printf("Current bucket = %d %d %d %d\n", p.lon, p.lat, p.x, p.y );
|
||||
|
||||
|
@ -225,11 +225,14 @@ void fgTileMgrRender( void ) {
|
|||
|
||||
|
||||
/* $Log$
|
||||
/* Revision 1.18 1998/02/19 13:05:54 curt
|
||||
/* Incorporated some HUD tweaks from Michelle America.
|
||||
/* Tweaked the sky's sunset/rise colors.
|
||||
/* Other misc. tweaks.
|
||||
/* Revision 1.19 1998/02/20 00:16:25 curt
|
||||
/* Thursday's tweaks.
|
||||
/*
|
||||
* Revision 1.18 1998/02/19 13:05:54 curt
|
||||
* Incorporated some HUD tweaks from Michelle America.
|
||||
* Tweaked the sky's sunset/rise colors.
|
||||
* Other misc. tweaks.
|
||||
*
|
||||
* Revision 1.17 1998/02/16 13:39:46 curt
|
||||
* Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
|
||||
* tiles to occasionally be missing.
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
| Done
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
2/19/98 - Fixed a problem with smooth view (scenery center) switch
|
||||
when entering a new tile.
|
||||
|
||||
2/18/98 - Fixed a problem with terrain generation that was causing
|
||||
some strips to be put in the wrong winding list.
|
||||
|
||||
2/9/98 - Fixed a problem with terrain tiles not quite matching up perfectly.
|
||||
|
||||
2/2/98 - Fix warning when compiling with c++ ... also successfully built
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
| Todo
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
1/12/98 - Fix time problem on win32
|
||||
|
||||
12/29/97 - View frustum culling
|
||||
|
||||
1/12/98 - Fix time problem on win32
|
||||
|
||||
1/5/98 - Create a development "roadmap"
|
||||
|
||||
12/30/97 - fix winding problem with tri-strips in obj.c (invert normals)
|
||||
|
|
Loading…
Reference in a new issue