Neetha Girish <neethagirish@usa.net>
==================================== Cockpit.cxx ----------- Commented #ifdef FIGHTER_HUD. Hud.cxx ------- Included code to read the xml file and draw the corresponding instrument. Hud.hxx, Hud_ladr.cxx, Hud_card.cxx and Hud_labl.cxx --------------------------------------------------- Integrated code to draw any kind of hud. Preference.xml --------------- Included XML file path in the sim/hud property. ReadMe.xmlhud ------------- The Readme.xmlhud describes the reconfigurable HUD implemented thru XML files.
This commit is contained in:
parent
6f6f19cf24
commit
af80c2080b
6 changed files with 1735 additions and 2554 deletions
|
@ -286,22 +286,28 @@ float get_view_direction( void )
|
|||
}
|
||||
|
||||
// $$$ begin - added, VS Renganathan 13 Oct 2K
|
||||
#ifdef FIGHTER_HUD
|
||||
// #ifdef FIGHTER_HUD
|
||||
float get_Vx ( void )
|
||||
{
|
||||
float Vxx = current_aircraft.fdm_state->get_V_north_rel_ground();
|
||||
// CLO - 5 Jan 2000 - something needs to get addressed here
|
||||
// float Vxx = current_aircraft.fdm_state->get_V_north_rel_ground();
|
||||
float Vxx = 0;
|
||||
return (Vxx);
|
||||
}
|
||||
|
||||
float get_Vy ( void )
|
||||
{
|
||||
float Vyy = current_aircraft.fdm_state->get_V_east_rel_ground();
|
||||
// CLO - 5 Jan 2000 - something needs to get addressed here
|
||||
// float Vyy = current_aircraft.fdm_state->get_V_east_rel_ground();
|
||||
float Vyy = 0;
|
||||
return (Vyy);
|
||||
}
|
||||
|
||||
float get_Vz ( void )
|
||||
{
|
||||
float Vzz = current_aircraft.fdm_state->get_V_down_rel_ground();
|
||||
// CLO - 5 Jan 2000 - something needs to get addressed here
|
||||
// float Vzz = current_aircraft.fdm_state->get_V_down_rel_ground();
|
||||
float Vzz = 0;
|
||||
return (Vzz);
|
||||
}
|
||||
|
||||
|
@ -508,7 +514,7 @@ float get_aux18 (void)
|
|||
FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
|
||||
return fdm->get_aux18();
|
||||
}
|
||||
#endif
|
||||
// #endif
|
||||
// $$$ end - added, VS Renganathan 13 Oct 2K
|
||||
|
||||
|
||||
|
|
1682
src/Cockpit/hud.cxx
1682
src/Cockpit/hud.cxx
File diff suppressed because it is too large
Load diff
|
@ -530,6 +530,8 @@ class instr_label : public instr_item {
|
|||
int fontSize;
|
||||
int blink;
|
||||
char format_buffer[80];
|
||||
bool lat;
|
||||
bool lon;
|
||||
|
||||
public:
|
||||
instr_label( int x,
|
||||
|
@ -538,14 +540,16 @@ class instr_label : public instr_item {
|
|||
UINT height,
|
||||
FLTFNPTR data_source,
|
||||
const char *label_format,
|
||||
const char *pre_label_string = 0,
|
||||
const char *post_label_string = 0,
|
||||
float scale_data = 1.0,
|
||||
UINT options = HUDS_TOP,
|
||||
fgLabelJust justification = CENTER_JUST,
|
||||
int font_size = SMALL,
|
||||
int blinking = NOBLINK,
|
||||
bool working = true);
|
||||
const char *pre_label_string,
|
||||
const char *post_label_string,
|
||||
float scale_data,
|
||||
UINT options,
|
||||
fgLabelJust justification,
|
||||
int font_size,
|
||||
int blinking,
|
||||
bool latitude,
|
||||
bool longitude,
|
||||
bool working);
|
||||
|
||||
~instr_label();
|
||||
|
||||
|
@ -574,14 +578,14 @@ class lat_label : public instr_item {
|
|||
UINT height,
|
||||
FLTFNPTR data_source,
|
||||
const char *label_format,
|
||||
const char *pre_label_string = 0,
|
||||
const char *post_label_string = 0,
|
||||
float scale_data = 1.0,
|
||||
UINT options = HUDS_TOP,
|
||||
fgLabelJust justification = CENTER_JUST,
|
||||
int font_size = SMALL,
|
||||
int blinking = NOBLINK,
|
||||
bool working = true);
|
||||
const char *pre_label_string,
|
||||
const char *post_label_string,
|
||||
float scale_data,
|
||||
UINT options,
|
||||
fgLabelJust justification,
|
||||
int font_size,
|
||||
int blinking,
|
||||
bool working);
|
||||
|
||||
~lat_label();
|
||||
|
||||
|
@ -609,14 +613,14 @@ class lon_label : public instr_item {
|
|||
UINT height,
|
||||
FLTFNPTR data_source,
|
||||
const char *label_format,
|
||||
const char *pre_label_string = 0,
|
||||
const char *post_label_string = 0,
|
||||
float scale_data = 1.0,
|
||||
UINT options = HUDS_TOP,
|
||||
fgLabelJust justification = CENTER_JUST,
|
||||
int font_size = SMALL,
|
||||
int blinking = NOBLINK,
|
||||
bool working = true);
|
||||
const char *pre_label_string,
|
||||
const char *post_label_string,
|
||||
float scale_data,
|
||||
UINT options,
|
||||
fgLabelJust justification,
|
||||
int font_size,
|
||||
int blinking,
|
||||
bool working);
|
||||
|
||||
~lon_label();
|
||||
|
||||
|
@ -652,13 +656,13 @@ class instr_scale : public instr_item {
|
|||
FLTFNPTR load_fn,
|
||||
UINT options,
|
||||
float show_range,
|
||||
float max_value = 100.0,
|
||||
float min_value = 0.0,
|
||||
float disp_scaling = 1.0,
|
||||
UINT major_divs = 10,
|
||||
UINT minor_divs = 5,
|
||||
UINT rollover = 0,
|
||||
int dp_showing = 2,
|
||||
float max_value,
|
||||
float min_value,
|
||||
float disp_scaling,
|
||||
UINT major_divs,
|
||||
UINT minor_divs,
|
||||
UINT rollover,
|
||||
int dp_showing,
|
||||
bool working = true);
|
||||
|
||||
virtual ~instr_scale();
|
||||
|
@ -683,7 +687,20 @@ class instr_scale : public instr_item {
|
|||
class hud_card : public instr_scale {
|
||||
private:
|
||||
float val_span;
|
||||
string type;
|
||||
float half_width_units;
|
||||
bool draw_tick_bottom;
|
||||
bool draw_tick_top;
|
||||
bool draw_tick_right;
|
||||
bool draw_tick_left;
|
||||
bool draw_cap_bottom;
|
||||
bool draw_cap_top;
|
||||
bool draw_cap_right;
|
||||
bool draw_cap_left;
|
||||
float marker_offset;
|
||||
bool pointer;
|
||||
string pointer_type;
|
||||
|
||||
|
||||
public:
|
||||
hud_card( int x,
|
||||
|
@ -692,15 +709,27 @@ class hud_card : public instr_scale {
|
|||
UINT height,
|
||||
FLTFNPTR load_fn,
|
||||
UINT options,
|
||||
float maxValue = 100.0,
|
||||
float minValue = 0.0,
|
||||
float disp_scaling = 1.0,
|
||||
UINT major_divs = 10,
|
||||
UINT minor_divs = 5,
|
||||
UINT modulator = 100,
|
||||
int dp_showing = 2,
|
||||
float value_span = 100.0,
|
||||
bool working = true);
|
||||
float maxValue,
|
||||
float minValue,
|
||||
float disp_scaling,
|
||||
UINT major_divs,
|
||||
UINT minor_divs,
|
||||
UINT modulator,
|
||||
int dp_showing,
|
||||
float value_span,
|
||||
string type,
|
||||
bool draw_tick_bottom,
|
||||
bool draw_tick_top,
|
||||
bool draw_tick_right,
|
||||
bool draw_tick_left,
|
||||
bool draw_cap_bottom,
|
||||
bool draw_cap_top,
|
||||
bool draw_cap_right,
|
||||
bool draw_cap_left,
|
||||
float marker_offset,
|
||||
bool pointer,
|
||||
string pointer_type,
|
||||
bool working);
|
||||
|
||||
~hud_card();
|
||||
hud_card( const hud_card & image);
|
||||
|
@ -719,14 +748,14 @@ class guage_instr : public instr_scale {
|
|||
UINT height,
|
||||
FLTFNPTR load_fn,
|
||||
UINT options,
|
||||
float disp_scaling = 1.0,
|
||||
float maxValue = 100,
|
||||
float minValue = 0,
|
||||
UINT major_divs = 50,
|
||||
UINT minor_divs = 0,
|
||||
int dp_showing = 2,
|
||||
UINT modulus = 0,
|
||||
bool working = true);
|
||||
float disp_scaling,
|
||||
float maxValue,
|
||||
float minValue,
|
||||
UINT major_divs,
|
||||
UINT minor_divs,
|
||||
int dp_showing,
|
||||
UINT modulus,
|
||||
bool working);
|
||||
|
||||
~guage_instr();
|
||||
guage_instr( const guage_instr & image);
|
||||
|
@ -750,8 +779,8 @@ class dual_instr_item : public instr_item {
|
|||
UINT height,
|
||||
FLTFNPTR chn1_source,
|
||||
FLTFNPTR chn2_source,
|
||||
bool working = true,
|
||||
UINT options = HUDS_TOP);
|
||||
bool working,
|
||||
UINT options );
|
||||
|
||||
virtual ~dual_instr_item() {};
|
||||
dual_instr_item( const dual_instr_item & image);
|
||||
|
@ -773,12 +802,12 @@ class fgTBI_instr : public dual_instr_item {
|
|||
int y,
|
||||
UINT width,
|
||||
UINT height,
|
||||
FLTFNPTR chn1_source = get_roll,
|
||||
FLTFNPTR chn2_source = get_sideslip,
|
||||
float maxBankAngle = 45.0,
|
||||
float maxSlipAngle = 5.0,
|
||||
UINT gap_width = 5,
|
||||
bool working = true);
|
||||
FLTFNPTR chn1_source,
|
||||
FLTFNPTR chn2_source,
|
||||
float maxBankAngle,
|
||||
float maxSlipAngle,
|
||||
UINT gap_width,
|
||||
bool working);
|
||||
|
||||
fgTBI_instr( const fgTBI_instr & image);
|
||||
fgTBI_instr & operator = (const fgTBI_instr & rhs );
|
||||
|
@ -800,29 +829,52 @@ class HudLadder : public dual_instr_item {
|
|||
UINT minor_div;
|
||||
UINT label_pos;
|
||||
UINT scr_hole;
|
||||
UINT minimal;
|
||||
float vmax;
|
||||
float vmin;
|
||||
float factor;
|
||||
string hudladder_type;
|
||||
bool frl;
|
||||
bool target_spot;
|
||||
bool velocity_vector;
|
||||
bool drift_marker;
|
||||
bool alpha_bracket;
|
||||
bool energy_marker;
|
||||
bool climb_dive_marker;
|
||||
bool glide_slope_marker;
|
||||
float glide_slope;
|
||||
bool energy_worm;
|
||||
bool waypoint_marker;
|
||||
|
||||
fgTextList TextList;
|
||||
fgLineList LineList;
|
||||
fgLineList StippleLineList;
|
||||
|
||||
public:
|
||||
HudLadder( int x,
|
||||
HudLadder( string name,
|
||||
int x,
|
||||
int y,
|
||||
UINT width,
|
||||
UINT height,
|
||||
UINT minimal = 0,
|
||||
FLTFNPTR ptch_source = get_roll,
|
||||
FLTFNPTR roll_source = get_pitch,
|
||||
float span_units = 45.0,
|
||||
float division_units = 10.0,
|
||||
float minor_division = 0.0,
|
||||
UINT screen_hole = 70,
|
||||
UINT lbl_pos = 0,
|
||||
bool working = true );
|
||||
float factor,
|
||||
FLTFNPTR ptch_source,
|
||||
FLTFNPTR roll_source,
|
||||
float span_units,
|
||||
float division_units,
|
||||
float minor_division,
|
||||
UINT screen_hole,
|
||||
UINT lbl_pos,
|
||||
bool frl,
|
||||
bool target_spot,
|
||||
bool velocity_vector,
|
||||
bool drift_marker,
|
||||
bool alpha_bracket,
|
||||
bool energy_marker,
|
||||
bool climb_dive_marker,
|
||||
bool glide_slope_marker,
|
||||
float glide_slope,
|
||||
bool energy_worm,
|
||||
bool waypoint_marker,
|
||||
bool working);
|
||||
|
||||
~HudLadder();
|
||||
|
||||
|
@ -867,6 +919,7 @@ extern void strokeString( int x,
|
|||
char *msg,
|
||||
void *font = GLUT_STROKE_ROMAN,
|
||||
float theta = 0);
|
||||
|
||||
//extern void strokeString(float xx,
|
||||
// float yy,
|
||||
// char *msg,
|
||||
|
|
|
@ -24,6 +24,18 @@ hud_card( int x,
|
|||
UINT modulus, // 360
|
||||
int dp_showing,
|
||||
float value_span,
|
||||
string card_type,
|
||||
bool tick_bottom,
|
||||
bool tick_top,
|
||||
bool tick_right,
|
||||
bool tick_left,
|
||||
bool cap_bottom,
|
||||
bool cap_top,
|
||||
bool cap_right,
|
||||
bool cap_left,
|
||||
float mark_offset,
|
||||
bool pointer_enable,
|
||||
string type_pointer,
|
||||
bool working) :
|
||||
instr_scale( x,y,width,height,
|
||||
data_source, options,
|
||||
|
@ -31,7 +43,20 @@ hud_card( int x,
|
|||
max_value, min_value, disp_scaling,
|
||||
major_divs, minor_divs, modulus,
|
||||
working),
|
||||
val_span ( value_span)
|
||||
val_span ( value_span),
|
||||
type ( card_type),
|
||||
draw_tick_bottom (tick_bottom),
|
||||
draw_tick_top (tick_top),
|
||||
draw_tick_right (tick_right),
|
||||
draw_tick_left (tick_left),
|
||||
draw_cap_bottom (cap_bottom),
|
||||
draw_cap_top (cap_top),
|
||||
draw_cap_right (cap_right),
|
||||
draw_cap_left (cap_left),
|
||||
marker_offset (mark_offset),
|
||||
pointer (pointer_enable),
|
||||
pointer_type (type_pointer)
|
||||
|
||||
{
|
||||
half_width_units = range_to_show() / 2.0;
|
||||
// UINT options = get_options();
|
||||
|
@ -51,7 +76,20 @@ hud_card ::
|
|||
hud_card( const hud_card & image):
|
||||
instr_scale( (const instr_scale & ) image),
|
||||
val_span( image.val_span),
|
||||
half_width_units (image.half_width_units)
|
||||
half_width_units (image.half_width_units),
|
||||
draw_tick_bottom (image.draw_tick_bottom),
|
||||
draw_tick_top (image.draw_tick_top),
|
||||
draw_tick_right (image.draw_tick_right),
|
||||
draw_tick_left (image.draw_tick_left),
|
||||
draw_cap_bottom (image.draw_cap_bottom),
|
||||
draw_cap_top (image.draw_cap_top),
|
||||
draw_cap_right (image.draw_cap_right),
|
||||
draw_cap_left (image.draw_cap_left),
|
||||
marker_offset (image.marker_offset),
|
||||
type(image.type),
|
||||
pointer (image.pointer),
|
||||
pointer_type (image.pointer_type)
|
||||
|
||||
{
|
||||
// UINT options = get_options();
|
||||
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
|
||||
|
@ -70,26 +108,41 @@ operator = (const hud_card & rhs )
|
|||
instr_scale::operator = (rhs);
|
||||
val_span = rhs.val_span;
|
||||
half_width_units = rhs.half_width_units;
|
||||
draw_tick_bottom = rhs.draw_tick_bottom;
|
||||
draw_tick_top = rhs.draw_tick_top;
|
||||
draw_tick_right = rhs.draw_tick_right;
|
||||
draw_tick_left = rhs.draw_tick_left;
|
||||
draw_cap_bottom = rhs.draw_cap_bottom;
|
||||
draw_cap_top = rhs.draw_cap_top;
|
||||
draw_cap_right = rhs.draw_cap_right;
|
||||
draw_cap_left = rhs.draw_cap_left;
|
||||
marker_offset = rhs.marker_offset;
|
||||
type = rhs.type;
|
||||
pointer = rhs.pointer;
|
||||
pointer_type = rhs.pointer_type;
|
||||
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// $$$ begin - added, VS Renganathan, 13 Oct 2K
|
||||
#ifdef FIGHTER_HUD
|
||||
void hud_card ::
|
||||
draw( void ) // (HUD_scale * pscale )
|
||||
{
|
||||
|
||||
float vmin, vmax;
|
||||
int marker_xs;
|
||||
int marker_xe;
|
||||
int marker_ys;
|
||||
int marker_ye;
|
||||
int text_x, text_y;
|
||||
int lenstr;
|
||||
int height, width;
|
||||
int i, last;
|
||||
char TextScale[80];
|
||||
bool condition;
|
||||
int disp_val = 0;
|
||||
|
||||
|
||||
POINT mid_scr = get_centroid();
|
||||
float cur_value = get_value();
|
||||
RECT scrn_rect = get_location();
|
||||
|
@ -98,21 +151,40 @@ draw( void ) // (HUD_scale * pscale )
|
|||
height = scrn_rect.top + scrn_rect.bottom;
|
||||
width = scrn_rect.left + scrn_rect.right;
|
||||
|
||||
|
||||
|
||||
if(type=="guage") {
|
||||
|
||||
vmin = min_val();
|
||||
vmax = max_val();
|
||||
text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/);
|
||||
text_x = marker_xs;
|
||||
}
|
||||
else
|
||||
if(type=="tape") {
|
||||
|
||||
vmin = cur_value - half_width_units; // width units == needle travel
|
||||
vmax = cur_value + half_width_units; // or picture unit span.
|
||||
text_x = mid_scr.x;
|
||||
text_y = mid_scr.y;
|
||||
}
|
||||
|
||||
|
||||
// Draw the basic markings for the scale...
|
||||
|
||||
if( huds_vert(options) ) { // Vertical scale
|
||||
// drawOneLine( scrn_rect.left, // Bottom tick bar
|
||||
// scrn_rect.top,
|
||||
// width,
|
||||
// scrn_rect.top);
|
||||
|
||||
// drawOneLine( scrn_rect.left, // Top tick bar
|
||||
// height,
|
||||
// width,
|
||||
// height );
|
||||
if (draw_tick_bottom) {
|
||||
drawOneLine( scrn_rect.left, // Bottom tick bar
|
||||
scrn_rect.top,
|
||||
width,
|
||||
scrn_rect.top);
|
||||
} // endif draw_tick_bottom
|
||||
if (draw_tick_top) {
|
||||
drawOneLine( scrn_rect.left, // Top tick bar
|
||||
height,
|
||||
width,
|
||||
height );
|
||||
} // endif draw_tick_top
|
||||
|
||||
marker_xs = scrn_rect.left; // x start
|
||||
marker_xe = width; // x extent
|
||||
|
@ -129,30 +201,48 @@ draw( void ) // (HUD_scale * pscale )
|
|||
// glVertex2f( marker_xe, marker_ye );
|
||||
// glEnd();
|
||||
|
||||
|
||||
// We do not use else in the following so that combining the two
|
||||
// options produces a "caged" display with double carrots. The
|
||||
// same is done for horizontal card indicators.
|
||||
|
||||
if( huds_left(options) ) { // Calculate x marker offset
|
||||
// drawOneLine( marker_xe, scrn_rect.top,
|
||||
// marker_xe, marker_ye); // Cap right side
|
||||
|
||||
if (draw_cap_right) {
|
||||
|
||||
drawOneLine( marker_xe, scrn_rect.top,
|
||||
marker_xe, marker_ye); // Cap right side
|
||||
} //endif cap_right
|
||||
|
||||
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
||||
// Indicator carrot
|
||||
|
||||
// drawOneLine( marker_xs, mid_scr.y,
|
||||
// marker_xe, mid_scr.y + scrn_rect.right / 6);
|
||||
// drawOneLine( marker_xs, mid_scr.y,
|
||||
// marker_xe, mid_scr.y - scrn_rect.right / 6);
|
||||
|
||||
// draw pointer
|
||||
if(pointer) {
|
||||
if(pointer_type=="fixed") {
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( 10+marker_xe, mid_scr.y + scrn_rect.right / 6);
|
||||
glVertex2f( 10+marker_xs, mid_scr.y);
|
||||
glVertex2f( 10+marker_xe, mid_scr.y - scrn_rect.right / 6);
|
||||
glVertex2f( marker_offset+marker_xe, text_y + scrn_rect.right / 6);
|
||||
glVertex2f( marker_offset+marker_xs, text_y);
|
||||
glVertex2f( marker_offset+marker_xe, text_y - scrn_rect.right / 6);
|
||||
glEnd();
|
||||
}
|
||||
else
|
||||
if(pointer_type=="moving") {
|
||||
//Code for Moving Type Pointer to be included.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( huds_right(options) ) { // We'll default this for now.
|
||||
// drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||
// scrn_rect.left, marker_ye ); // Cap left side
|
||||
if (draw_cap_left) {
|
||||
drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||
scrn_rect.left, marker_ye ); // Cap left side
|
||||
} //endif cap_left
|
||||
|
||||
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
||||
// Indicator carrot
|
||||
|
@ -160,12 +250,22 @@ draw( void ) // (HUD_scale * pscale )
|
|||
// marker_xe, mid_scr.y );
|
||||
// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
|
||||
// marker_xe, mid_scr.y);
|
||||
|
||||
// draw pointer
|
||||
if(pointer) {
|
||||
if(pointer_type=="fixed") {
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( -10+scrn_rect.left, mid_scr.y + scrn_rect.right / 6);
|
||||
glVertex2f( -10+marker_xe, mid_scr.y );
|
||||
glVertex2f( -10+scrn_rect.left, mid_scr.y - scrn_rect.right / 6);
|
||||
glVertex2f( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6);
|
||||
glVertex2f( -marker_offset+marker_xe, text_y );
|
||||
glVertex2f( -marker_offset+scrn_rect.left, text_y - scrn_rect.right / 6);
|
||||
glEnd();
|
||||
}
|
||||
else
|
||||
if(pointer_type=="moving") {
|
||||
// Code for Moving Type Pointer to be included.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// At this point marker x_start and x_end values are transposed.
|
||||
// To keep this from confusing things they are now interchanged.
|
||||
|
@ -178,13 +278,13 @@ draw( void ) // (HUD_scale * pscale )
|
|||
// Work through from bottom to top of scale. Calculating where to put
|
||||
// minor and major ticks.
|
||||
|
||||
// draw scale or tape
|
||||
// last = FloatToInt(vmax)+1;
|
||||
// i = FloatToInt(vmin);
|
||||
last = (int)vmax + 1;
|
||||
i = (int)vmin;
|
||||
for( ; i <last ; i++ )
|
||||
{
|
||||
|
||||
condition = true;
|
||||
if( !modulo()) {
|
||||
if( i < min_val()) {
|
||||
|
@ -292,19 +392,23 @@ draw( void ) // (HUD_scale * pscale )
|
|||
} // End for range of i from vmin to vmax
|
||||
} // End if VERTICAL SCALE TYPE
|
||||
else { // Horizontal scale by default
|
||||
// commented
|
||||
// left tick bar
|
||||
// drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||
// scrn_rect.left, height);
|
||||
|
||||
if (draw_tick_left) {
|
||||
drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||
scrn_rect.left, height);
|
||||
} // endif draw_tick_left
|
||||
// right tick bar
|
||||
// drawOneLine( width, scrn_rect.top,
|
||||
// width,
|
||||
// height );
|
||||
if (draw_tick_right) {
|
||||
drawOneLine( width, scrn_rect.top,
|
||||
width,
|
||||
height );
|
||||
} // endif draw_tick_right
|
||||
|
||||
marker_ys = scrn_rect.top; // Starting point for
|
||||
marker_ye = height; // tick y location calcs
|
||||
marker_xe = width;
|
||||
marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
|
||||
|
||||
|
||||
// glBegin(GL_LINES);
|
||||
// left tick bar
|
||||
|
@ -317,37 +421,46 @@ draw( void ) // (HUD_scale * pscale )
|
|||
// glEnd();
|
||||
|
||||
if( huds_top(options) ) {
|
||||
if (draw_cap_bottom) {
|
||||
// Bottom box line
|
||||
// commented
|
||||
// drawOneLine( scrn_rect.left,
|
||||
// scrn_rect.top,
|
||||
// width,
|
||||
// scrn_rect.top);
|
||||
drawOneLine( scrn_rect.left,
|
||||
scrn_rect.top,
|
||||
width,
|
||||
scrn_rect.top);
|
||||
} //endif cap_bottom
|
||||
|
||||
// Tick point adjust
|
||||
marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
|
||||
|
||||
// Bottom arrow
|
||||
// drawOneLine( mid_scr.x, marker_ye,
|
||||
// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
||||
// drawOneLine( mid_scr.x, marker_ye,
|
||||
// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
||||
|
||||
// commented
|
||||
// glBegin(GL_LINE_STRIP);
|
||||
// glVertex2f( mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
||||
// glVertex2f( mid_scr.x, marker_ye);
|
||||
// glVertex2f( mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
||||
// glEnd();
|
||||
// draw pointer
|
||||
if(pointer) {
|
||||
if(pointer_type=="fixed") {
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( marker_xs - scrn_rect.bottom / 4, scrn_rect.top);
|
||||
glVertex2f( marker_xs, marker_ye);
|
||||
glVertex2f( marker_xs + scrn_rect.bottom / 4, scrn_rect.top);
|
||||
glEnd();
|
||||
}
|
||||
else
|
||||
if(pointer_type=="moving") {
|
||||
// Code for Moving type Pointer to be included.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if( huds_bottom(options) ) {
|
||||
// Top box line
|
||||
if (draw_cap_top) {
|
||||
drawOneLine( scrn_rect.left, height,
|
||||
width, height);
|
||||
} //endif cap_top
|
||||
|
||||
// Tick point adjust
|
||||
marker_ys = height - scrn_rect.bottom / 2;
|
||||
|
||||
// Top arrow
|
||||
// drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
|
||||
// scrn_rect.top + scrn_rect.bottom,
|
||||
|
@ -355,14 +468,24 @@ draw( void ) // (HUD_scale * pscale )
|
|||
// drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
|
||||
// scrn_rect.top + scrn_rect.bottom,
|
||||
// mid_scr.x , marker_ys );
|
||||
|
||||
// draw pointer
|
||||
if(pointer) {
|
||||
if(pointer_type=="fixed") {
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( mid_scr.x + scrn_rect.bottom / 4,
|
||||
height);
|
||||
glVertex2f( mid_scr.x , marker_ys );
|
||||
glVertex2f( mid_scr.x - scrn_rect.bottom / 4,
|
||||
height);
|
||||
glVertex2f( marker_xs + scrn_rect.bottom / 4, height);
|
||||
glVertex2f( marker_xs, marker_ys );
|
||||
glVertex2f( marker_xs - scrn_rect.bottom / 4, height);
|
||||
glEnd();
|
||||
}
|
||||
else
|
||||
if(pointer_type=="moving") {
|
||||
// Code for Moving Type Pointer to be included.
|
||||
}
|
||||
}//if pointer
|
||||
|
||||
|
||||
}
|
||||
|
||||
// if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
|
||||
// marker_xe = marker_ys;
|
||||
|
@ -413,15 +536,6 @@ draw( void ) // (HUD_scale * pscale )
|
|||
// draw minor ticks
|
||||
drawOneLine( marker_xs, marker_ys,
|
||||
marker_xs, marker_ye - 4);
|
||||
// patch for angled deck heading
|
||||
if (i == 352) {
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex2f( marker_xs, marker_ys+16);
|
||||
glVertex2f( marker_xs+2, marker_ys+13);
|
||||
glVertex2f( marker_xs, marker_ys+10);
|
||||
glVertex2f( marker_xs-2, marker_ys+13);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
else {
|
||||
drawOneLine( marker_xs, marker_ys + 4,
|
||||
|
@ -470,7 +584,6 @@ draw( void ) // (HUD_scale * pscale )
|
|||
}
|
||||
}
|
||||
else {
|
||||
// draw major ticks
|
||||
drawOneLine( marker_xs, marker_ys,
|
||||
marker_xs, marker_ye );
|
||||
if( !huds_notext(options)) {
|
||||
|
@ -488,417 +601,9 @@ draw( void ) // (HUD_scale * pscale )
|
|||
}
|
||||
}
|
||||
}
|
||||
}//if(condition)
|
||||
}
|
||||
// printf("<****> i = %d\n", i);
|
||||
} //if(divmax)
|
||||
} //if(!modulo)
|
||||
} //for
|
||||
}
|
||||
}
|
||||
}
|
||||
} //draw
|
||||
|
||||
#else
|
||||
//$$$ end - VS Renganathan, 13 Oct 2K
|
||||
|
||||
void hud_card ::
|
||||
draw( void ) // (HUD_scale * pscale )
|
||||
{
|
||||
float vmin, vmax;
|
||||
int marker_xs;
|
||||
int marker_xe;
|
||||
int marker_ys;
|
||||
int marker_ye;
|
||||
int lenstr;
|
||||
int height, width;
|
||||
int i, last;
|
||||
char TextScale[80];
|
||||
bool condition;
|
||||
int disp_val = 0;
|
||||
POINT mid_scr = get_centroid();
|
||||
float cur_value = get_value();
|
||||
RECT scrn_rect = get_location();
|
||||
UINT options = get_options();
|
||||
|
||||
height = scrn_rect.top + scrn_rect.bottom;
|
||||
width = scrn_rect.left + scrn_rect.right;
|
||||
|
||||
vmin = cur_value - half_width_units; // width units == needle travel
|
||||
vmax = cur_value + half_width_units; // or picture unit span.
|
||||
|
||||
// Draw the basic markings for the scale...
|
||||
|
||||
if( huds_vert(options) ) { // Vertical scale
|
||||
drawOneLine( scrn_rect.left, // Bottom tick bar
|
||||
scrn_rect.top,
|
||||
width,
|
||||
scrn_rect.top);
|
||||
|
||||
drawOneLine( scrn_rect.left, // Top tick bar
|
||||
height,
|
||||
width,
|
||||
height );
|
||||
|
||||
marker_xs = scrn_rect.left; // x start
|
||||
marker_xe = width; // x extent
|
||||
marker_ye = height;
|
||||
|
||||
// glBegin(GL_LINES);
|
||||
|
||||
// Bottom tick bar
|
||||
// glVertex2f( marker_xs, scrn_rect.top);
|
||||
// glVertex2f( marker_xe, scrn_rect.top);
|
||||
|
||||
// Top tick bar
|
||||
// glVertex2f( marker_xs, marker_ye);
|
||||
// glVertex2f( marker_xe, marker_ye );
|
||||
// glEnd();
|
||||
|
||||
// We do not use else in the following so that combining the two
|
||||
// options produces a "caged" display with double carrots. The
|
||||
// same is done for horizontal card indicators.
|
||||
|
||||
if( huds_left(options) ) { // Calculate x marker offset
|
||||
drawOneLine( marker_xe, scrn_rect.top,
|
||||
marker_xe, marker_ye); // Cap right side
|
||||
|
||||
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
||||
// Indicator carrot
|
||||
// drawOneLine( marker_xs, mid_scr.y,
|
||||
// marker_xe, mid_scr.y + scrn_rect.right / 6);
|
||||
// drawOneLine( marker_xs, mid_scr.y,
|
||||
// marker_xe, mid_scr.y - scrn_rect.right / 6);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( marker_xe, mid_scr.y + scrn_rect.right / 6);
|
||||
glVertex2f( marker_xs, mid_scr.y);
|
||||
glVertex2f( marker_xe, mid_scr.y - scrn_rect.right / 6);
|
||||
glEnd();
|
||||
}
|
||||
if( huds_right(options) ) { // We'll default this for now.
|
||||
drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||
scrn_rect.left, marker_ye ); // Cap left side
|
||||
|
||||
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
||||
// Indicator carrot
|
||||
// drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
|
||||
// marker_xe, mid_scr.y );
|
||||
// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
|
||||
// marker_xe, mid_scr.y);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( scrn_rect.left, mid_scr.y + scrn_rect.right / 6);
|
||||
glVertex2f( marker_xe, mid_scr.y );
|
||||
glVertex2f( scrn_rect.left, mid_scr.y - scrn_rect.right / 6);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
// At this point marker x_start and x_end values are transposed.
|
||||
// To keep this from confusing things they are now interchanged.
|
||||
if(huds_both(options)) {
|
||||
marker_ye = marker_xs;
|
||||
marker_xs = marker_xe;
|
||||
marker_xe = marker_ye;
|
||||
}
|
||||
|
||||
// Work through from bottom to top of scale. Calculating where to put
|
||||
// minor and major ticks.
|
||||
|
||||
// last = FloatToInt(vmax)+1;
|
||||
// i = FloatToInt(vmin);
|
||||
last = (int)vmax + 1;
|
||||
i = (int)vmin;
|
||||
for( ; i <last ; i++ )
|
||||
{
|
||||
condition = true;
|
||||
if( !modulo()) {
|
||||
if( i < min_val()) {
|
||||
condition = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( condition ) { // Show a tick if necessary
|
||||
// Calculate the location of this tick
|
||||
marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
|
||||
// marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
|
||||
// Block calculation artifact from drawing ticks below min coordinate.
|
||||
// Calculation here accounts for text height.
|
||||
|
||||
if(( marker_ys < (scrn_rect.top + 4)) |
|
||||
( marker_ys > (height - 4))) {
|
||||
// Magic numbers!!!
|
||||
continue;
|
||||
}
|
||||
if( div_min()) {
|
||||
// if( (i%div_min()) == 0) {
|
||||
if( !(i%(int)div_min())) {
|
||||
if((( marker_ys - 5) > scrn_rect.top ) &&
|
||||
(( marker_ys + 5) < (height))){
|
||||
if( huds_both(options) ) {
|
||||
drawOneLine( scrn_rect.left, marker_ys,
|
||||
marker_xs, marker_ys );
|
||||
drawOneLine( marker_xe, marker_ys,
|
||||
width, marker_ys );
|
||||
// glBegin(GL_LINES);
|
||||
// glVertex2f( scrn_rect.left, marker_ys );
|
||||
// glVertex2f( marker_xs, marker_ys );
|
||||
// glVertex2f( marker_xe, marker_ys);
|
||||
// glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
|
||||
// glEnd();
|
||||
}
|
||||
else {
|
||||
if( huds_left(options) ) {
|
||||
drawOneLine( marker_xs + 4, marker_ys,
|
||||
marker_xe, marker_ys );
|
||||
}
|
||||
else {
|
||||
drawOneLine( marker_xs, marker_ys,
|
||||
marker_xe - 4, marker_ys );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( div_max() ) {
|
||||
if( !(i%(int)div_max()) )
|
||||
{
|
||||
if(modulo()) {
|
||||
if( disp_val < 0) {
|
||||
while(disp_val < 0)
|
||||
disp_val += modulo();
|
||||
// } else {
|
||||
// disp_val = i % (int)modulo();
|
||||
}
|
||||
disp_val = i % (int) modulo(); // ?????????
|
||||
} else {
|
||||
disp_val = i;
|
||||
}
|
||||
|
||||
lenstr = sprintf( TextScale, "%d",
|
||||
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
||||
// (int)(disp_val * data_scaling() +.5));
|
||||
if(( (marker_ys - 8 ) > scrn_rect.top ) &&
|
||||
( (marker_ys + 8) < (height))){
|
||||
if( huds_both(options) ) {
|
||||
// drawOneLine( scrn_rect.left, marker_ys,
|
||||
// marker_xs, marker_ys);
|
||||
// drawOneLine( marker_xs, marker_ys,
|
||||
// scrn_rect.left + scrn_rect.right,
|
||||
// marker_ys);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( scrn_rect.left, marker_ys );
|
||||
glVertex2f( marker_xs, marker_ys);
|
||||
glVertex2f( width, marker_ys);
|
||||
glEnd();
|
||||
if( !huds_notext(options)) {
|
||||
textString ( marker_xs + 2, marker_ys,
|
||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
|
||||
if( !huds_notext(options) ) {
|
||||
if( huds_left(options) ) {
|
||||
textString( marker_xs - 8 * lenstr - 2,
|
||||
marker_ys - 4,
|
||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||
}
|
||||
else {
|
||||
textString( marker_xe + 3 * lenstr,
|
||||
marker_ys - 4,
|
||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Else read oriented right
|
||||
} // End if modulo division by major interval is zero
|
||||
} // End if major interval divisor non-zero
|
||||
} // End if condition
|
||||
} // End for range of i from vmin to vmax
|
||||
} // End if VERTICAL SCALE TYPE
|
||||
else { // Horizontal scale by default
|
||||
// left tick bar
|
||||
drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||
scrn_rect.left, height);
|
||||
|
||||
// right tick bar
|
||||
drawOneLine( width, scrn_rect.top,
|
||||
width,
|
||||
height );
|
||||
|
||||
marker_ys = scrn_rect.top; // Starting point for
|
||||
marker_ye = height; // tick y location calcs
|
||||
marker_xe = width;
|
||||
|
||||
// glBegin(GL_LINES);
|
||||
// left tick bar
|
||||
// glVertex2f( scrn_rect.left, scrn_rect.top);
|
||||
// glVertex2f( scrn_rect.left, marker_ye);
|
||||
|
||||
// right tick bar
|
||||
// glVertex2f( marker_xe, scrn_rect.top);
|
||||
// glVertex2f( marker_xe, marker_ye );
|
||||
// glEnd();
|
||||
|
||||
if( huds_top(options) ) {
|
||||
// Bottom box line
|
||||
drawOneLine( scrn_rect.left,
|
||||
scrn_rect.top,
|
||||
width,
|
||||
scrn_rect.top);
|
||||
|
||||
// Tick point adjust
|
||||
marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
|
||||
|
||||
// Bottom arrow
|
||||
// drawOneLine( mid_scr.x, marker_ye,
|
||||
// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
||||
// drawOneLine( mid_scr.x, marker_ye,
|
||||
// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
||||
glVertex2f( mid_scr.x, marker_ye);
|
||||
glVertex2f( mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
||||
glEnd();
|
||||
}
|
||||
if( huds_bottom(options) ) {
|
||||
// Top box line
|
||||
drawOneLine( scrn_rect.left, height,
|
||||
width, height);
|
||||
// Tick point adjust
|
||||
marker_ys = height - scrn_rect.bottom / 2;
|
||||
|
||||
// Top arrow
|
||||
// drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
|
||||
// scrn_rect.top + scrn_rect.bottom,
|
||||
// mid_scr.x, marker_ys );
|
||||
// drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
|
||||
// scrn_rect.top + scrn_rect.bottom,
|
||||
// mid_scr.x , marker_ys );
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( mid_scr.x + scrn_rect.bottom / 4,
|
||||
height);
|
||||
glVertex2f( mid_scr.x , marker_ys );
|
||||
glVertex2f( mid_scr.x - scrn_rect.bottom / 4,
|
||||
height);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
// if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
|
||||
// marker_xe = marker_ys;
|
||||
// marker_ys = marker_ye;
|
||||
// marker_ye = marker_xe;
|
||||
// }
|
||||
|
||||
// printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
|
||||
|
||||
// last = FloatToInt(vmax)+1;
|
||||
// i = FloatToInt(vmin);
|
||||
last = (int)vmax + 1;
|
||||
i = (int)vmin;
|
||||
for(; i <last ; i++ ) {
|
||||
// for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
||||
// printf("<*> i = %d\n", i);
|
||||
condition = true;
|
||||
if( !modulo()) {
|
||||
if( i < min_val()) {
|
||||
condition = false;
|
||||
}
|
||||
}
|
||||
// printf("<**> i = %d\n", i);
|
||||
if( condition ) {
|
||||
// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
|
||||
marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
|
||||
if( div_min()){
|
||||
// if( (i%(int)div_min()) == 0 ) {
|
||||
if( !(i%(int)div_min() )) {
|
||||
// draw in ticks only if they aren't too close to the edge.
|
||||
if((( marker_xs - 5) > scrn_rect.left ) &&
|
||||
(( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
|
||||
|
||||
if( huds_both(options) ) {
|
||||
drawOneLine( marker_xs, scrn_rect.top,
|
||||
marker_xs, marker_ys - 4);
|
||||
drawOneLine( marker_xs, marker_ye + 4,
|
||||
marker_xs, height);
|
||||
// glBegin(GL_LINES);
|
||||
// glVertex2f( marker_xs, scrn_rect.top);
|
||||
// glVertex2f( marker_xs, marker_ys - 4);
|
||||
// glVertex2f( marker_xs, marker_ye + 4);
|
||||
// glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
|
||||
// glEnd();
|
||||
}
|
||||
else {
|
||||
if( huds_top(options)) {
|
||||
drawOneLine( marker_xs, marker_ys,
|
||||
marker_xs, marker_ye - 4);
|
||||
}
|
||||
else {
|
||||
drawOneLine( marker_xs, marker_ys + 4,
|
||||
marker_xs, marker_ye);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// printf("<***> i = %d\n", i);
|
||||
if( div_max()) {
|
||||
// printf("i = %d\n", i);
|
||||
// if( (i%(int)div_max())==0 ) {
|
||||
if( !(i%(int)div_max()) ) {
|
||||
if(modulo()) {
|
||||
if( disp_val < 0) {
|
||||
while(disp_val<0)
|
||||
disp_val += modulo();
|
||||
}
|
||||
disp_val = i % (int) modulo(); // ?????????
|
||||
} else {
|
||||
disp_val = i;
|
||||
}
|
||||
// printf("disp_val = %d\n", disp_val);
|
||||
// printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
|
||||
lenstr = sprintf( TextScale, "%d",
|
||||
// (int)(disp_val * data_scaling() +.5));
|
||||
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
||||
// Draw major ticks and text only if far enough from the edge.
|
||||
if(( (marker_xs - 10)> scrn_rect.left ) &&
|
||||
( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
|
||||
if( huds_both(options) ) {
|
||||
// drawOneLine( marker_xs, scrn_rect.top,
|
||||
// marker_xs, marker_ys);
|
||||
// drawOneLine( marker_xs, marker_ye,
|
||||
// marker_xs, scrn_rect.top + scrn_rect.bottom);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f( marker_xs, scrn_rect.top);
|
||||
glVertex2f( marker_xs, marker_ye);
|
||||
glVertex2f( marker_xs, height);
|
||||
glEnd();
|
||||
if( !huds_notext(options) ) {
|
||||
textString ( marker_xs - 4 * lenstr,
|
||||
marker_ys + 4,
|
||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
drawOneLine( marker_xs, marker_ys,
|
||||
marker_xs, marker_ye );
|
||||
if( !huds_notext(options)) {
|
||||
if( huds_top(options) ) {
|
||||
textString ( marker_xs - 4 * lenstr,
|
||||
height - 10,
|
||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||
}
|
||||
else {
|
||||
textString( marker_xs - 4 * lenstr,
|
||||
scrn_rect.top,
|
||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// printf("<****> i = %d\n", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,8 @@ instr_label ::
|
|||
fgLabelJust justification,
|
||||
int font_size,
|
||||
int blinking,
|
||||
bool latitude,
|
||||
bool longitude,
|
||||
bool working):
|
||||
instr_item( x, y, width, height,
|
||||
data_source,scale_data,options, working ),
|
||||
|
@ -31,7 +33,10 @@ instr_label ::
|
|||
post_str ( post_label_string ),
|
||||
justify ( justification ),
|
||||
fontSize ( font_size ),
|
||||
blink ( blinking )
|
||||
blink ( blinking ),
|
||||
lat ( latitude ),
|
||||
lon ( longitude )
|
||||
|
||||
{
|
||||
if( pre_str != NULL) {
|
||||
if( post_str != NULL ) {
|
||||
|
@ -63,7 +68,10 @@ instr_label :: instr_label( const instr_label & image) :
|
|||
pformat ( image.pformat ),
|
||||
pre_str ( image.pre_str ),
|
||||
post_str ( image.post_str ),
|
||||
blink ( image.blink )
|
||||
blink ( image.blink ),
|
||||
lat ( image.lat ),
|
||||
lon ( image.lon )
|
||||
|
||||
{
|
||||
if( pre_str != NULL) {
|
||||
if( post_str != NULL ) {
|
||||
|
@ -91,6 +99,10 @@ instr_label & instr_label ::operator = (const instr_label & rhs )
|
|||
justify = rhs.justify;
|
||||
pre_str = rhs.pre_str;
|
||||
post_str = rhs.post_str;
|
||||
lat = rhs.lat;
|
||||
lon = rhs.lon;
|
||||
|
||||
|
||||
strcpy(format_buffer,rhs.format_buffer);
|
||||
}
|
||||
return *this;
|
||||
|
@ -110,6 +122,12 @@ draw( void ) // Required method in base class
|
|||
RECT scrn_rect = get_location();
|
||||
|
||||
if( data_available() ) {
|
||||
if(lat)
|
||||
sprintf( label_buffer, format_buffer, coord_format_lat(get_value()) );
|
||||
else
|
||||
if(lon)
|
||||
sprintf( label_buffer, format_buffer, coord_format_lon(get_value()) );
|
||||
else
|
||||
sprintf( label_buffer, format_buffer, get_value() );
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
#define DO_PANEL_HACK
|
||||
|
||||
//====================== Top of HudLadder Class =======================
|
||||
HudLadder :: HudLadder( int x,
|
||||
HudLadder :: HudLadder( string name,
|
||||
int x,
|
||||
int y,
|
||||
UINT width,
|
||||
UINT height,
|
||||
UINT mini,
|
||||
float factr,
|
||||
FLTFNPTR ptch_source,
|
||||
FLTFNPTR roll_source,
|
||||
float span_units,
|
||||
|
@ -17,6 +18,17 @@ HudLadder :: HudLadder( int x,
|
|||
float minor_div,
|
||||
UINT screen_hole,
|
||||
UINT lbl_pos,
|
||||
bool frl_spot,
|
||||
bool target,
|
||||
bool vel_vec,
|
||||
bool drift,
|
||||
bool alpha,
|
||||
bool energy,
|
||||
bool climb,
|
||||
bool glide,
|
||||
float glide_slope_val,
|
||||
bool worm_energy,
|
||||
bool waypoint,
|
||||
bool working) :
|
||||
dual_instr_item( x, y, width, height,
|
||||
ptch_source,
|
||||
|
@ -29,19 +41,26 @@ HudLadder :: HudLadder( int x,
|
|||
label_pos ( lbl_pos ),
|
||||
scr_hole ( screen_hole ),
|
||||
vmax ( span_units/2 ),
|
||||
vmin ( -vmax )
|
||||
vmin ( -vmax ),
|
||||
factor ( factr ),
|
||||
hudladder_type ( name ),
|
||||
frl ( frl_spot ),
|
||||
velocity_vector ( vel_vec ),
|
||||
drift_marker ( drift ),
|
||||
alpha_bracket ( alpha ),
|
||||
energy_marker ( energy ),
|
||||
climb_dive_marker ( climb ),
|
||||
target_spot ( target ),
|
||||
glide_slope_marker ( glide ),
|
||||
glide_slope ( glide_slope_val),
|
||||
energy_worm ( worm_energy),
|
||||
waypoint_marker ( waypoint)
|
||||
|
||||
|
||||
{
|
||||
if( !width_units ) {
|
||||
width_units = 45;
|
||||
}
|
||||
// $$$ begin -added VS Renganthan 16 Oct 2k
|
||||
#ifdef FIGHTER_HUD
|
||||
factor = 480.0 / 33.75;
|
||||
#else
|
||||
// $$$ begin -added VS Renganthan 16 Oct 2k
|
||||
factor = (float)get_span() / (float) width_units;
|
||||
#endif
|
||||
minimal = mini;
|
||||
}
|
||||
|
||||
HudLadder :: ~HudLadder()
|
||||
|
@ -57,7 +76,19 @@ HudLadder :: ~HudLadder()
|
|||
scr_hole ( image.scr_hole ),
|
||||
vmax ( image.vmax ),
|
||||
vmin ( image.vmin ),
|
||||
factor ( image.factor )
|
||||
factor ( image.factor ),
|
||||
hudladder_type ( image.hudladder_type),
|
||||
frl ( image.frl),
|
||||
velocity_vector ( image.velocity_vector),
|
||||
drift_marker ( image.drift_marker),
|
||||
alpha_bracket ( image.alpha_bracket),
|
||||
energy_marker ( image.energy_marker),
|
||||
climb_dive_marker ( image.climb_dive_marker),
|
||||
target_spot ( image.target_spot),
|
||||
glide_slope_marker ( image.glide_slope_marker),
|
||||
glide_slope ( image.glide_slope),
|
||||
energy_worm ( image.energy_worm),
|
||||
waypoint_marker ( image.waypoint_marker)
|
||||
{
|
||||
}
|
||||
HudLadder & HudLadder :: operator = ( const HudLadder & rhs )
|
||||
|
@ -71,6 +102,18 @@ HudLadder & HudLadder :: operator = ( const HudLadder & rhs )
|
|||
vmax = rhs.vmax;
|
||||
vmin = rhs.vmin;
|
||||
factor = rhs.factor;
|
||||
hudladder_type = rhs.hudladder_type;
|
||||
frl = rhs.frl;
|
||||
velocity_vector = rhs.velocity_vector;
|
||||
drift_marker = rhs.drift_marker;
|
||||
alpha_bracket = rhs.alpha_bracket;
|
||||
energy_marker = rhs.energy_marker;
|
||||
climb_dive_marker = rhs.climb_dive_marker;
|
||||
target_spot = rhs.target_spot;
|
||||
glide_slope_marker = rhs.glide_slope_marker;
|
||||
glide_slope = rhs.glide_slope;
|
||||
energy_worm = rhs.energy_worm;
|
||||
waypoint_marker = rhs.waypoint_marker;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -78,18 +121,21 @@ HudLadder & HudLadder :: operator = ( const HudLadder & rhs )
|
|||
//
|
||||
// Draws a climb ladder in the center of the HUD
|
||||
//
|
||||
// $$$ begin - added VS Renganathan, 13 Oct 2K
|
||||
#ifdef FIGHTER_HUD
|
||||
|
||||
void HudLadder :: draw( void )
|
||||
{
|
||||
float x_ini;
|
||||
float x_end;
|
||||
|
||||
float x_ini,x_ini2;
|
||||
float x_end,x_end2;
|
||||
float y;
|
||||
int count;
|
||||
float cosine, sine,xvvr,yvvr,Vxx,Vyy,Vzz,up_vel,ground_vel,actslope;
|
||||
float Axx,Ayy,Azz,total_vel,pot_slope,t1,t2,psi,alpha,pla;
|
||||
float vel_x,vel_y,drift;
|
||||
char Textaux[8] ;
|
||||
bool pitch_ladder;
|
||||
bool climb_dive_ladder;
|
||||
bool clip_plane;
|
||||
|
||||
GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
|
||||
GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
|
||||
|
@ -103,47 +149,37 @@ void HudLadder :: draw( void )
|
|||
alpha = get_aoa();
|
||||
pla = get_throttleval();
|
||||
|
||||
int lgear,wown,wowm,iclaw,ihook;
|
||||
iclaw = get_iaux1();
|
||||
int lgear,wown,wowm,ilcanclaw,ihook;
|
||||
ilcanclaw = get_iaux1();
|
||||
lgear = get_iaux2();
|
||||
wown = get_iaux3();
|
||||
wowm = get_iaux4();
|
||||
ihook = get_iaux5();
|
||||
|
||||
float pitch_value = current_ch1() * RAD_TO_DEG;
|
||||
vmin = pitch_value - (float)width_units;
|
||||
vmax = pitch_value + (float)width_units; //$$$
|
||||
|
||||
if(hudladder_type=="Climb/Dive Ladder") {
|
||||
pitch_ladder = false;
|
||||
climb_dive_ladder = true;
|
||||
clip_plane = true;
|
||||
}
|
||||
else
|
||||
if(hudladder_type=="Pitch Ladder") {
|
||||
pitch_ladder = true;
|
||||
climb_dive_ladder = false;
|
||||
clip_plane = false;
|
||||
}
|
||||
|
||||
//**************************************************************
|
||||
glPushMatrix();
|
||||
// define (0,0) as center of screen
|
||||
glTranslatef( centroid.x, centroid.y, 0);
|
||||
|
||||
//*********************************************************
|
||||
//waypoint marker computation
|
||||
float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
|
||||
|
||||
fromwp_lon = get_longitude()*DEG_TO_RAD;
|
||||
fromwp_lat = get_latitude()*DEG_TO_RAD;
|
||||
towp_lon = get_aux5()*DEG_TO_RAD;
|
||||
towp_lat = get_aux6()*DEG_TO_RAD;
|
||||
|
||||
dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
|
||||
delx= towp_lat - fromwp_lat;
|
||||
dely = towp_lon - fromwp_lon;
|
||||
hyp = sqrt(pow(delx,2)+pow(dely,2));
|
||||
if (hyp != 0) {
|
||||
theta = asin(dely/hyp);
|
||||
} else {
|
||||
theta = 0.0;
|
||||
}
|
||||
brg = theta*RAD_TO_DEG;
|
||||
if (brg > 360.0) brg = 0.0;
|
||||
if (delx < 0) brg = 180 - brg;
|
||||
|
||||
// {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
|
||||
// Brg = Brg * RAD_TO_DEG; }
|
||||
dist = dist*RAD_TO_DEG * 60.0*1852.0; //rad->deg->nm->m
|
||||
//*********************************************************
|
||||
// OBJECT STATIC RETICLE
|
||||
// TYPE FRL
|
||||
// ATTRIB - ALWAYS
|
||||
// Draw the FRL spot and line
|
||||
if(frl) {
|
||||
#define FRL_DIAMOND_SIZE 2.0
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
|
||||
|
@ -156,8 +192,27 @@ void HudLadder :: draw( void )
|
|||
glVertex2f(0, 8.0 );
|
||||
glEnd();
|
||||
#undef FRL_DIAMOND_SIZE
|
||||
}
|
||||
// TYPE WATERLINE_MARK (W shaped _ _ )
|
||||
// \/\/
|
||||
|
||||
//****************************************************************
|
||||
// TYPE TARGET_SPOT
|
||||
// Draw the target spot.
|
||||
if (target_spot) {
|
||||
#define CENTER_DIAMOND_SIZE 6.0
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
|
||||
glVertex2f(0.0, CENTER_DIAMOND_SIZE);
|
||||
glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
|
||||
glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
|
||||
glEnd();
|
||||
#undef CENTER_DIAMOND_SIZE
|
||||
}
|
||||
|
||||
//****************************************************************
|
||||
//velocity vector reticle - computations
|
||||
if(velocity_vector) {
|
||||
Vxx = get_Vx();
|
||||
Vyy = get_Vy();
|
||||
Vzz = get_Vz();
|
||||
|
@ -188,23 +243,102 @@ void HudLadder :: draw( void )
|
|||
vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
|
||||
vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*(640/45.0);
|
||||
// printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
|
||||
|
||||
//****************************************************************
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE - DRIFT MARKER
|
||||
// ATTRIB - ALWAYS
|
||||
// drift marker
|
||||
if(drift_marker) {
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f((xvvr*25/120)-6, -4);
|
||||
glVertex2f(xvvr*25/120, 8);
|
||||
glVertex2f((xvvr*25/120)+6, -4);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
// clip hud ladder
|
||||
//****************************************************************
|
||||
// Clipping coordinates for ladder to be input from xml file
|
||||
// Clip hud ladder
|
||||
if (clip_plane) {
|
||||
glClipPlane(GL_CLIP_PLANE0,eqn_top);
|
||||
glEnable(GL_CLIP_PLANE0);
|
||||
glClipPlane(GL_CLIP_PLANE1,eqn_left);
|
||||
glEnable(GL_CLIP_PLANE1);
|
||||
glClipPlane(GL_CLIP_PLANE2,eqn_right);
|
||||
glEnable(GL_CLIP_PLANE2);
|
||||
// glScissor(-100,-240,200,240);
|
||||
// glEnable(GL_SCISSOR_TEST);
|
||||
}
|
||||
//****************************************************************
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE VELOCITY VECTOR
|
||||
// ATTRIB - ALWAYS
|
||||
// velocity vector
|
||||
glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
|
||||
for(count=0; count<50; count++) {
|
||||
cosine = 6 * cos(count * 2 * M_PI/50.0);
|
||||
sine = 6 * sin(count * 2 * M_PI/50.0);
|
||||
glVertex2f(cosine+vel_x, sine+vel_y);
|
||||
}
|
||||
glEnd();
|
||||
//velocity vector reticle orientation lines
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x-12, vel_y);
|
||||
glVertex2f(vel_x-6, vel_y);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x+12, vel_y);
|
||||
glVertex2f(vel_x+6, vel_y);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x, vel_y+12);
|
||||
glVertex2f(vel_x, vel_y+6);
|
||||
glEnd();
|
||||
|
||||
// alpha bracket - reqd only for landing (tied to hook)
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE LINE
|
||||
// ATTRIB - ON CONDITION
|
||||
if (lgear == 1) {
|
||||
// undercarriage status
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x+8, vel_y);
|
||||
glVertex2f(vel_x+8, vel_y-4);
|
||||
glEnd();
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE LINE
|
||||
// ATTRIB - ON CONDITION
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x-8, vel_y);
|
||||
glVertex2f(vel_x-8, vel_y-4);
|
||||
glEnd();
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE LINE
|
||||
// ATTRIB - ON CONDITION
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x, vel_y-6);
|
||||
glVertex2f(vel_x, vel_y-10);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE V
|
||||
// ATTRIB - ON CONDITION
|
||||
if (ihook == 1) {
|
||||
// arrestor hook status
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x-4, vel_y-8);
|
||||
glVertex2f(vel_x, vel_y-10);
|
||||
glVertex2f(vel_x+4, vel_y-8);
|
||||
glEnd();
|
||||
}
|
||||
}//if velocity_vector
|
||||
|
||||
//***************************************************************
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE - SQUARE_BRACKET
|
||||
// ATTRIB - ON CONDITION
|
||||
// alpha bracket
|
||||
if (alpha_bracket) {
|
||||
if (ihook == 1) {
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
|
||||
|
@ -219,11 +353,15 @@ void HudLadder :: draw( void )
|
|||
glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
}
|
||||
//printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
|
||||
//printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
|
||||
|
||||
//****************************************************************
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE ENERGY_MARKERS
|
||||
// ATTRIB - ALWAYS
|
||||
//energy markers - compute potential slope
|
||||
if(energy_marker) {
|
||||
if (total_vel < 5.0) {
|
||||
t1 = 0;
|
||||
t2 = 0;
|
||||
|
@ -232,6 +370,8 @@ void HudLadder :: draw( void )
|
|||
t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
|
||||
}
|
||||
pot_slope = ((t2/3)*RAD_TO_DEG)*factor + vel_y;
|
||||
// if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
|
||||
// if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
|
||||
|
||||
//energy markers
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
@ -256,19 +396,30 @@ void HudLadder :: draw( void )
|
|||
glVertex2f(vel_x+24, pot_slope+5);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
// ramp reticle - for ski jump takeoff only
|
||||
if (iclaw == 1) {
|
||||
}
|
||||
//**********************************************************
|
||||
// ramp reticle
|
||||
// OBJECT STATIC RETICLE
|
||||
// TYPE LINE
|
||||
// ATTRIB - ON CONDITION
|
||||
if (energy_worm) {
|
||||
if (ilcanclaw == 1) {
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(-15, -134);
|
||||
glVertex2f(15, -134);
|
||||
glEnd();
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE BOX
|
||||
// ATTRIB - ON CONDITION
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(-6, -134);
|
||||
glVertex2f(-6, t2*RAD_TO_DEG*4.0 - 134);
|
||||
glVertex2f(+6, t2*RAD_TO_DEG*4.0 - 134);
|
||||
glVertex2f(6, -134);
|
||||
glEnd();
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE DIAMOND
|
||||
// ATTRIB - ON CONDITION
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f(-6, actslope*4.0 - 134);
|
||||
glVertex2f(0, actslope*4.0 -134 +3);
|
||||
|
@ -276,66 +427,41 @@ void HudLadder :: draw( void )
|
|||
glVertex2f(0, actslope*4.0 -134 -3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
}
|
||||
//*************************************************************
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE DIAMOND
|
||||
// ATTRIB - ALWAYS
|
||||
// Draw the locked velocity vector.
|
||||
if(climb_dive_marker) {
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f( -3.0, 0.0+vel_y);
|
||||
glVertex2f(0.0, 6.0+vel_y);
|
||||
glVertex2f( 3.0, 0.0+vel_y);
|
||||
glVertex2f(0.0, -6.0+vel_y);
|
||||
glEnd();
|
||||
|
||||
// draw velocity vector
|
||||
glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
|
||||
for(count=0; count<50; count++) {
|
||||
cosine = 6 * cos(count * 2 * M_PI/50.0);
|
||||
sine = 6 * sin(count * 2 * M_PI/50.0);
|
||||
glVertex2f(cosine+vel_x, sine+vel_y);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
//velocity vector reticle orientation lines
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x-12, vel_y);
|
||||
glVertex2f(vel_x-6, vel_y);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x+12, vel_y);
|
||||
glVertex2f(vel_x+6, vel_y);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x, vel_y+12);
|
||||
glVertex2f(vel_x, vel_y+6);
|
||||
glEnd();
|
||||
|
||||
if (lgear == 1) {
|
||||
// undercarriage status
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x+8, vel_y);
|
||||
glVertex2f(vel_x+8, vel_y-4);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x-8, vel_y);
|
||||
glVertex2f(vel_x-8, vel_y-4);
|
||||
glEnd();
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x, vel_y-6);
|
||||
glVertex2f(vel_x, vel_y-10);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if (ihook == 1) {
|
||||
// arrestor hook status
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex2f(vel_x-4, vel_y-8);
|
||||
glVertex2f(vel_x, vel_y-10);
|
||||
glVertex2f(vel_x+4, vel_y-8);
|
||||
glEnd();
|
||||
}
|
||||
//****************************************************************
|
||||
|
||||
if(climb_dive_ladder) {// CONFORMAL_HUD
|
||||
|
||||
vmin = pitch_value - (float)width_units;
|
||||
vmax = pitch_value + (float)width_units;
|
||||
|
||||
// FRL marker not rotated - this line shifted below
|
||||
glTranslatef( vel_x, vel_y, 0);
|
||||
|
||||
}
|
||||
else
|
||||
if (pitch_ladder) {//Default Hud
|
||||
|
||||
vmin = pitch_value - (float)width_units * 0.5f;
|
||||
vmax = pitch_value + (float)width_units * 0.5f;
|
||||
|
||||
}
|
||||
|
||||
glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
|
||||
// FRL marker not rotated - this line shifted below
|
||||
|
||||
if( div_units ) {
|
||||
|
||||
|
@ -347,7 +473,13 @@ void HudLadder :: draw( void )
|
|||
float bot ;
|
||||
float top ;
|
||||
float text_offset = 4.0f ;
|
||||
float zero_offset = 50.0f ;
|
||||
float zero_offset;
|
||||
|
||||
if(climb_dive_ladder)
|
||||
zero_offset = 50.0f ;
|
||||
else
|
||||
if(pitch_ladder)
|
||||
zero_offset = 10.0f ;
|
||||
|
||||
fntFont *font = HUDtext->getFont();
|
||||
float pointsize = HUDtext->getPointSize();
|
||||
|
@ -362,6 +494,7 @@ void HudLadder :: draw( void )
|
|||
int i = FloatToInt(vmin);
|
||||
|
||||
if( !scr_hole ) {
|
||||
x_end = half_span;
|
||||
for( ; i<last ; i++ ) {
|
||||
|
||||
y = (((float)(i - pitch_value) * factor) + .5f);
|
||||
|
@ -375,7 +508,6 @@ void HudLadder :: draw( void )
|
|||
label_height = (top - bot)/2.0f;
|
||||
|
||||
x_ini = -half_span;
|
||||
x_end = half_span;
|
||||
|
||||
if( i >= 0 ) {
|
||||
// Make zero point wider on left
|
||||
|
@ -397,9 +529,15 @@ void HudLadder :: draw( void )
|
|||
else // if(scr_hole )
|
||||
{ // Draw ladder with space in the middle of the lines
|
||||
float hole = (float)((scr_hole)/2.0f);
|
||||
|
||||
x_end = -half_span + hole;
|
||||
x_ini2= half_span - hole;
|
||||
for( ; i<last ; i++ ) {
|
||||
|
||||
// y = (((float)(i - pitch_value) * factor) + .5);
|
||||
if(hudladder_type=="Pitch Ladder")
|
||||
y = (((float)(i - pitch_value) * factor) + .5);
|
||||
else
|
||||
if(hudladder_type=="Climb/Dive Ladder")
|
||||
y = (((float)(i - actslope) * factor) + .5);
|
||||
|
||||
if( !(i % div_units )) { // At integral multiple of div
|
||||
|
@ -415,59 +553,52 @@ void HudLadder :: draw( void )
|
|||
// Start by calculating the points and drawing the
|
||||
// left side lines.
|
||||
x_ini = -half_span;
|
||||
x_end = -half_span + hole;
|
||||
x_end2= half_span;
|
||||
|
||||
if( i >= 0 ) {
|
||||
// Make zero point wider on left
|
||||
if( i == 0 ) {
|
||||
x_ini -= zero_offset;
|
||||
x_end2 +=zero_offset;
|
||||
} else {
|
||||
if(climb_dive_ladder){
|
||||
// Zero or above draw solid lines
|
||||
Line(x_end, y-5.0, x_end, y);
|
||||
Line(x_ini2, y-5.0, x_ini2, y);
|
||||
}
|
||||
}
|
||||
|
||||
Line(x_ini, y, x_end, y);
|
||||
Line(x_ini2, y, x_end2, y);
|
||||
|
||||
} else {
|
||||
// Below zero draw dashed lines.
|
||||
if(climb_dive_ladder) {
|
||||
Line(x_end, y+5.0, x_end, y);
|
||||
Line(x_ini2, y+5.0, x_ini2, y);
|
||||
}
|
||||
StippleLine(x_ini, y, x_end, y);
|
||||
StippleLine(x_ini2, y, x_end2, y);
|
||||
}
|
||||
|
||||
// Now calculate the location of the left side label using
|
||||
Text( x_ini-label_length, y-label_height, TextLadder );
|
||||
Text (x_end2+text_offset, y-label_height, TextLadder );
|
||||
|
||||
// Now calculate and draw the right side line location
|
||||
x_ini = half_span - hole;
|
||||
x_end = half_span;
|
||||
|
||||
if( i >= 0 ) {
|
||||
if( i == 0 ) {
|
||||
x_end += zero_offset;
|
||||
} else {
|
||||
Line(x_ini, y-5.0, x_ini, y);
|
||||
}
|
||||
// Zero or above draw solid lines
|
||||
Line(x_ini, y, x_end, y);
|
||||
} else {
|
||||
// Below zero draw dashed lines.
|
||||
Line(x_ini, y+5.0, x_ini, y);
|
||||
StippleLine(x_ini, y, x_end, y);
|
||||
}
|
||||
|
||||
// Calculate the location and draw the right side label
|
||||
Text( x_end+text_offset, y-label_height, TextLadder );
|
||||
}
|
||||
}
|
||||
|
||||
// draw appraoch glide slope marker - for landing only (tied to hook)
|
||||
// OBJECT LADDER MARK
|
||||
// TYPE LINE
|
||||
// ATTRIB - ON CONDITION
|
||||
// draw appraoch glide slope marker
|
||||
if (glide_slope_marker) {
|
||||
if (ihook) {
|
||||
Line(-half_span+15, (-4-actslope)*factor, -half_span + hole, (-4-actslope)*factor);
|
||||
Line(half_span-15, (-4-actslope)*factor, half_span - hole, (-4-actslope)*factor);
|
||||
Line(-half_span+15, (glide_slope-actslope)*factor, -half_span + hole, (glide_slope-actslope)*factor);
|
||||
Line(half_span-15, (glide_slope-actslope)*factor, half_span - hole, (glide_slope-actslope)*factor);
|
||||
}
|
||||
|
||||
}// if glide_slope_marker
|
||||
}
|
||||
|
||||
TextList.draw();
|
||||
|
||||
glLineWidth(0.2);
|
||||
|
@ -485,6 +616,36 @@ void HudLadder :: draw( void )
|
|||
// glDisable(GL_SCISSOR_TEST);
|
||||
glPopMatrix();
|
||||
//*************************************************************
|
||||
//*************************************************************
|
||||
if(waypoint_marker) {
|
||||
//waypoint marker computation
|
||||
float fromwp_lat,towp_lat,fromwp_lon,towp_lon,dist,delx,dely,hyp,theta,brg;
|
||||
|
||||
fromwp_lon = get_longitude()*DEG_TO_RAD;
|
||||
fromwp_lat = get_latitude()*DEG_TO_RAD;
|
||||
towp_lon = get_aux5()*DEG_TO_RAD;
|
||||
towp_lat = get_aux6()*DEG_TO_RAD;
|
||||
|
||||
dist = acos(sin(fromwp_lat)*sin(towp_lat)+cos(fromwp_lat)*cos(towp_lat)*cos(fabs(fromwp_lon-towp_lon)));
|
||||
delx= towp_lat - fromwp_lat;
|
||||
dely = towp_lon - fromwp_lon;
|
||||
hyp = sqrt(pow(delx,2)+pow(dely,2));
|
||||
if (hyp != 0) {
|
||||
theta = asin(dely/hyp);
|
||||
} else {
|
||||
theta = 0.0;
|
||||
}
|
||||
brg = theta*RAD_TO_DEG;
|
||||
if (brg > 360.0) brg = 0.0;
|
||||
if (delx < 0) brg = 180 - brg;
|
||||
|
||||
// {Brg = asin(cos(towp_lat)*sin(fabs(fromwp_lon-towp_lon))/ sin(dist));
|
||||
// Brg = Brg * RAD_TO_DEG; }
|
||||
dist = dist*RAD_TO_DEG * 60.0*1852.0; //rad->deg->nm->m
|
||||
// end waypoint marker computation
|
||||
//*********************************************************
|
||||
// OBJECT MOVING RETICLE
|
||||
// TYPE ARROW
|
||||
// waypoint marker
|
||||
if (fabs(brg-psi) > 10.0) {
|
||||
glPushMatrix();
|
||||
|
@ -515,169 +676,5 @@ if (fabs(brg-psi) < 12.0) {
|
|||
glEnd();
|
||||
}
|
||||
//*************************************************************
|
||||
|
||||
}
|
||||
#else
|
||||
// $$$ end - added VS Renganathan, 13 Oct 2K
|
||||
|
||||
// draw DEFAULT_HUD
|
||||
void HudLadder :: draw( void )
|
||||
{
|
||||
POINT centroid = get_centroid();
|
||||
|
||||
float roll_value = current_ch2();
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef( centroid.x, centroid.y, 0);
|
||||
// Alex's panel patch
|
||||
// glScalef( globals->get_options()->get_fov()/55.0, 1.0, 1.0 );
|
||||
glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
|
||||
|
||||
// Draw the target spot.
|
||||
#define CENTER_DIAMOND_SIZE 6.0f
|
||||
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
|
||||
glVertex2f( 0.0, CENTER_DIAMOND_SIZE);
|
||||
glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
|
||||
glVertex2f( 0.0, -CENTER_DIAMOND_SIZE);
|
||||
glEnd();
|
||||
|
||||
if( minimal || ! div_units ) {
|
||||
glPopMatrix();
|
||||
return;
|
||||
}
|
||||
|
||||
float x_ini;
|
||||
float x_end;
|
||||
float y;
|
||||
|
||||
float pitch_value = current_ch1() * RAD_TO_DEG;
|
||||
vmin = pitch_value - (float)width_units * 0.5f;
|
||||
vmax = pitch_value + (float)width_units * 0.5f;
|
||||
|
||||
RECT box = get_location();
|
||||
|
||||
float half_span = box.right * 0.5f ;
|
||||
|
||||
char TextLadder[8] ;
|
||||
float label_length ;
|
||||
float label_height ;
|
||||
float left ;
|
||||
float right ;
|
||||
float bot ;
|
||||
float top ;
|
||||
float text_offset = 4.0f ;
|
||||
float zero_offset = 10.0f ;
|
||||
|
||||
fntFont *font = HUDtext->getFont();
|
||||
float pointsize = HUDtext->getPointSize();
|
||||
float italic = HUDtext->getSlant();
|
||||
|
||||
TextList.setFont( HUDtext );
|
||||
TextList.erase();
|
||||
LineList.erase();
|
||||
StippleLineList.erase();
|
||||
|
||||
int last = FloatToInt(vmax)+1;
|
||||
int i = FloatToInt(vmin);
|
||||
|
||||
if( !scr_hole ) {
|
||||
x_end = half_span;
|
||||
for( ; i<last ; i++ ) {
|
||||
|
||||
y = (((float)(i - pitch_value) * factor) + .5f);
|
||||
if( !(i % div_units )) { // At integral multiple of div
|
||||
|
||||
sprintf( TextLadder, "%d", i );
|
||||
font->getBBox ( TextLadder, pointsize, italic,
|
||||
&left, &right, &bot, &top ) ;
|
||||
|
||||
label_length = right - left;
|
||||
label_length += text_offset;
|
||||
label_height = (top - bot) * 0.5f;
|
||||
|
||||
x_ini = -half_span;
|
||||
|
||||
if( i >= 0 ) {
|
||||
// Make zero point wider on left
|
||||
if( i == 0 )
|
||||
x_ini -= zero_offset;
|
||||
// Zero or above draw solid lines
|
||||
Line(x_ini, y, x_end, y);
|
||||
} else {
|
||||
// Below zero draw dashed lines.
|
||||
StippleLine(x_ini, y, x_end, y);
|
||||
}
|
||||
|
||||
// Calculate the position of the left text and write it.
|
||||
Text( x_ini-label_length, y-label_height, TextLadder );
|
||||
Text( x_end+text_offset, y-label_height, TextLadder );
|
||||
}
|
||||
}
|
||||
} else { // scr_hole != 0
|
||||
// Draw ladder with space in the middle of the lines
|
||||
float x_ini2;
|
||||
float x_end2;
|
||||
float hole = (float)((scr_hole)*0.5f);
|
||||
|
||||
x_end = -half_span + hole;
|
||||
x_ini2 = half_span - hole;
|
||||
|
||||
for( ; i<last ; i++ ) {
|
||||
|
||||
y = (((float)(i - pitch_value) * factor) + .5);
|
||||
if( !(i % div_units )) { // At integral multiple of div
|
||||
|
||||
sprintf( TextLadder, "%d", i );
|
||||
font->getBBox ( TextLadder, pointsize, italic,
|
||||
&left, &right, &bot, &top ) ;
|
||||
label_length = right - left;
|
||||
label_length += text_offset;
|
||||
label_height = (top - bot) * 0.5f;
|
||||
|
||||
// Start by calculating the points and drawing the
|
||||
// left side lines.
|
||||
x_ini = -half_span;
|
||||
x_end2 = half_span;
|
||||
|
||||
if( i >= 0 ) {
|
||||
// Make zero point wider on left
|
||||
if( i == 0 ) {
|
||||
x_ini -= zero_offset;
|
||||
x_end2 += zero_offset;
|
||||
}
|
||||
// Zero or above draw solid lines
|
||||
Line(x_ini, y, x_end, y);
|
||||
Line(x_ini2, y, x_end2, y);
|
||||
} else {
|
||||
// Below zero draw dashed lines.
|
||||
StippleLine(x_ini, y, x_end, y);
|
||||
StippleLine(x_ini2, y, x_end2, y);
|
||||
}
|
||||
// Calculate the location of the left side label using
|
||||
Text( x_ini-label_length, y-label_height, TextLadder );
|
||||
// Calculate the location and draw the right side label
|
||||
Text( x_end2+text_offset, y-label_height, TextLadder );
|
||||
}
|
||||
}
|
||||
}
|
||||
TextList.draw();
|
||||
|
||||
LineList.draw();
|
||||
|
||||
glEnable(GL_LINE_STIPPLE);
|
||||
#ifdef DO_PANEL_HACK
|
||||
glLineStipple( 1, fgPanelVisible() ? 0x0F0F : 0x00FF );
|
||||
#else
|
||||
glLineStipple( 1, 0x00FF );
|
||||
#endif
|
||||
|
||||
StippleLineList.draw( );
|
||||
glDisable(GL_LINE_STIPPLE);
|
||||
|
||||
// } // if(div_units)
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
#endif // DEFAULT_HUD
|
||||
}// if waypoint_marker
|
||||
}//draw
|
||||
|
|
Loading…
Add table
Reference in a new issue