# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\src\Main\views.cxx\r
+SOURCE=.\src\Main\viewer.cxx\r
\r
!IF "$(CFG)" == "FlightGear - Win32 Release"\r
\r
#include <Aircraft/aircraft.hxx>
#include <Include/general.hxx>
+#include <FDM/ADA.hxx>
#include <Main/globals.hxx>
#include <Main/options.hxx>
-#include <Main/views.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include <GUI/gui.h>
float get_view_direction( void )
{
- double view;
-
- view = FG_2PI - current_view.get_view_offset();
- view = ( current_aircraft.fdm_state->get_Psi() + view) * RAD_TO_DEG;
+ double view_off = FG_2PI - globals->get_current_view()->get_view_offset();
+ double view = ( current_aircraft.fdm_state->get_Psi() + view_off)
+ * RAD_TO_DEG;
if(view > 360.)
view -= 360.;
else if(view<0.)
view += 360.;
- float fview = view;
- return( fview );
+ return view;
}
+// $$$ begin - added, VS Renganathan 13 Oct 2K
+#ifdef FIGHTER_HUD
+float get_Vx ( void )
+{
+ float Vxx = current_aircraft.fdm_state->get_V_north_rel_ground();
+ return (Vxx);
+}
+
+float get_Vy ( void )
+{
+ float Vyy = current_aircraft.fdm_state->get_V_east_rel_ground();
+ return (Vyy);
+}
+
+float get_Vz ( void )
+{
+ float Vzz = current_aircraft.fdm_state->get_V_down_rel_ground();
+ return (Vzz);
+}
+
+float get_Ax ( void )
+{
+ float Ax = current_aircraft.fdm_state->get_V_dot_north();
+ return (Ax);
+}
+
+float get_Ay ( void )
+{
+ float Ay = current_aircraft.fdm_state->get_V_dot_east();
+ return (Ay);
+}
+
+float get_Az ( void )
+{
+ float Az = current_aircraft.fdm_state->get_V_dot_down();
+ return (Az);
+}
+
+float get_anzg ( void )
+{
+ float anzg = current_aircraft.fdm_state->get_N_Z_cg();
+ return (anzg);
+}
+
+int get_iaux1 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux1();
+}
+
+int get_iaux2 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux2();
+}
+
+int get_iaux3 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux3();
+}
+
+int get_iaux4 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux4();
+}
+
+int get_iaux5 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux5();
+}
+
+int get_iaux6 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux6();
+}
+
+int get_iaux7 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux7();
+}
+
+int get_iaux8 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux8();
+}
+
+int get_iaux9 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux9();
+}
+
+int get_iaux10 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux10();
+}
+
+int get_iaux11 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux11();
+}
+
+int get_iaux12 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_iaux12();
+}
+
+float get_aux1 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux1();
+}
+
+float get_aux2 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux2();
+}
+
+float get_aux3 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux3();
+}
+
+float get_aux4 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux4();
+}
+
+float get_aux5 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux5();
+}
+
+float get_aux6 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux6();
+}
+
+float get_aux7 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux7();
+}
+
+float get_aux8 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux8();
+}
+
+float get_aux9 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux9();
+}
+
+float get_aux10 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux10();
+}
+
+float get_aux11 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux11();
+}
+
+float get_aux12 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux12();
+}
+
+float get_aux13 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux13();
+}
+
+float get_aux14 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux14();
+}
+
+float get_aux15 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux15();
+}
+
+float get_aux16 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux16();
+}
+
+float get_aux17 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux17();
+}
+
+float get_aux18 (void)
+{
+ FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
+ return fdm->get_aux18();
+}
+#endif
+// $$$ end - added, VS Renganathan 13 Oct 2K
+
+
#ifdef NOT_USED
/****************************************************************************/
/* Convert degrees to dd mm'ss.s" (DMS-Format) */
"Cockpit: code " << ac_cockpit->code() << " status "
<< ac_cockpit->status() );
- int iwidth = current_view.get_winWidth();
- int iheight = current_view.get_winHeight();
+ int iwidth = globals->get_current_view()->get_winWidth();
+ int iheight = globals->get_current_view()->get_winHeight();
float width = iwidth;
float height = iheight;
int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
{
- instr_item *HIptr;
-// int index;
-
-// int off = 50;
- int min_x = 25; //off/2;
- int max_x = 615; //640-(off/2);
-// int min_y = off;
- int max_y = 430; //480-off;
- int cen_x = 320;
- int cen_y = 240;
- unsigned int text_h = 10;
- unsigned int ladr_w2 = 60;
- int ladr_h2 = 90;
- int ladr_t = 35;
- int compass_w = 200;
- int gap = 10;
+ instr_item *HIptr;
+ // int index;
+
+ // $$$ begin - added VS Renganathan
+#ifdef FIGHTER_HUD
+ // int off = 400;
+ int min_x = 200;
+ int max_x = 440;
+ // int min_y = 100;
+ int max_y = 380;
+ int cen_x = 320;
+ int cen_y = 240;
+ unsigned int text_h = 10;
+ unsigned int ladr_w2 = 60;
+ int ladr_h2 = 90;
+ int ladr_t = 35;
+ int compass_w = 120;
+ int gap = 10;
+#else
+ // $$$ end - added VS Renganathan
+
+ // int off = 50;
+ int min_x = 25; //off/2;
+ int max_x = 615; //640-(off/2);
+ // int min_y = off;
+ int max_y = 430; //480-off;
+ int cen_x = 320;
+ int cen_y = 240;
+ unsigned int text_h = 10;
+ unsigned int ladr_w2 = 60;
+ int ladr_h2 = 90;
+ int ladr_t = 35;
+ int compass_w = 200;
+ int gap = 10;
+#endif
// int font_size = current_options.get_xsize() / 60;
int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
// int x = 290; /*cen_x-30*/
// int y = 45; /*off-5*/
// HIptr = (instr_item *) new fgTBI_instr( x, y, ladr_w2, text_h );
+// $$$ begin - added, VS Renganathan 13 Oct 2K
+#ifdef FIGHTER_HUD
+// case 1: // Artificial Horizon
+ HIptr = (instr_item *) new HudLadder( cen_x-ladr_w2, cen_y-ladr_h2,
+ 2*ladr_w2, 2*ladr_h2 );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// case 4: // GYRO COMPASS
+ HIptr = (instr_item *) new hud_card( cen_x-(compass_w/2),
+ cen_y+8.0, //CENTER_DIAMOND_SIZE
+ compass_w,
+ 28,
+ get_heading,
+ HUDS_TOP,
+ 360, 0,
+ 1.0,
+ 10, 1,
+ 360,
+ 0,
+ 25,
+ true);
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// case 10: // Digital KIAS
+ HIptr = (instr_item *) new instr_label ( cen_x-190,
+ cen_y+25,
+ 40,
+ 30,
+ get_speed,
+ "%5.0f",
+ NULL,
+ " ",
+ 1.0,
+ HUDS_TOP,
+ RIGHT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+// Mach no
+ HIptr = (instr_item *) new instr_label ( cen_x-180,
+ cen_y+5,
+ 40,
+ 30,
+ get_mach,
+ "%5.2f",
+ NULL,
+ " ",
+ 1.0,
+ HUDS_TOP,
+ RIGHT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+// Pressure Altitude
+ HIptr = (instr_item *) new instr_label ( cen_x+110,
+ cen_y+25,
+ 40,
+ 30,
+ get_altitude,
+ "%5.0f",
+ NULL,
+ " ",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+// Radio Altitude
+ HIptr = (instr_item *) new instr_label ( cen_x+110,
+ cen_y+5,
+ 40,
+ 30,
+ get_agl,
+ "%5.0f",
+ NULL,
+ " R",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// case 2: // AOA
+ HIptr = (instr_item *) new hud_card( cen_x-145.0, //min_x +18,
+ cen_y-190,
+ 28,
+ 120,
+ get_aoa,
+ HUDS_LEFT | HUDS_VERT,
+// HUDS_RIGHT | HUDS_VERT,
+ 30.0, -15.0,
+ 1.0,
+ 10, 2,
+ 0,
+ 0,
+ 60.0,
+ true);
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+// case 2: // normal acceleration at cg, g's
+ HIptr = (instr_item *) new hud_card( cen_x-185, //min_x +18,
+ cen_y-220,
+ 18,
+ 130,
+ get_anzg,
+ HUDS_LEFT | HUDS_VERT,
+// HUDS_RIGHT | HUDS_VERT,
+ 10.0, -5.0,
+ 1.0,
+ 2, 1,
+ 0,
+ 0,
+ 20.0,
+ true);
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+// case 2: // VSI
+ HIptr = (instr_item *) new hud_card( (2*cen_x)-195.0, //min_x +18,
+ cen_y-190,
+ 28,
+ 120,
+ get_climb_rate, //fix
+// HUDS_LEFT | HUDS_VERT,
+ HUDS_RIGHT | HUDS_VERT,
+ 500.0, -500.0,
+ 1.0,
+ 5, 1,
+ 0,
+ 0,
+ 15.0,
+ true);
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+
+// Aux parameter 16 - xposn
+ HIptr = (instr_item *) new instr_label ( cen_x+170,
+ cen_y+200,
+ 40,
+ 30,
+ get_aux16,
+ "%5.1f",
+ NULL,
+ " pstick",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+
+// Aux parameter 17 - xposn
+ HIptr = (instr_item *) new instr_label ( cen_x+170,
+ cen_y+190,
+ 40,
+ 30,
+ get_aux17,
+ "%5.1f",
+ NULL,
+ " rstick",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+
+
+
+
+
+
+// Aux parameter 1 - xposn
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+200,
+ 40,
+ 30,
+ get_aux1,
+ "%5.0f",
+ NULL,
+ " m",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// Aux parameter 2 - pla
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+190,
+ 40,
+ 30,
+ get_aux9,
+ "%5.0f",
+ NULL,
+ " pla",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// Aux parameter 3 - xtd
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+170,
+ 40,
+ 30,
+ get_aux11,
+ "%5.1f",
+ NULL,
+ " xtd",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// Aux parameter 4 - ytd
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+160,
+ 40,
+ 30,
+ get_aux12,
+ "%5.1f",
+ NULL,
+ " ytd",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// Aux parameter 5 - nztd
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+150,
+ 40,
+ 30,
+ get_aux10,
+ "%5.1f",
+ NULL,
+ " nztd",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// Aux parameter 6 - vvtd
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+140,
+ 40,
+ 30,
+ get_aux13,
+ "%5.1f",
+ NULL,
+ " vvtd",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// Aux parameter 7 - vtd
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+130,
+ 40,
+ 30,
+ get_aux14,
+ "%5.1f",
+ NULL,
+ " vtd",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// Aux parameter 8 - alftd
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+120,
+ 40,
+ 30,
+ get_aux15,
+ "%5.1f",
+ NULL,
+ " alftd",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// Aux parameter 9 - fnr
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+100,
+ 40,
+ 30,
+ get_aux8,
+ "%5.1f",
+ NULL,
+ " fnose",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+// Aux parameter 10 - Ax
+ HIptr = (instr_item *) new instr_label ( cen_x+240,
+ cen_y+90,
+ 40,
+ 30,
+ get_Ax,
+ "%5.2f",
+ NULL,
+ " Ax",
+ 1.0,
+ HUDS_TOP,
+ LEFT_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+#else
+// $$$ end - added , VS Renganathan 13 Oct 2K
+
HIptr = (instr_item *) new fgTBI_instr( 290, 45, 60, 10 );
HUD_deque.insert( HUD_deque.begin(), HIptr);
0.0
);
HUD_deque.insert( HUD_deque.begin(), HIptr);
+#endif
// Remove this when below uncommented
// case 10:
HIptr = (instr_item *) new instr_label( 10,
TRUE );
HUD_deque.insert( HUD_deque.begin(), HIptr);
- HIptr = (instr_item *) new lat_label( (cen_x - (compass_w/2))/2,
+// $$$ begin - added VS Renganthan 19 Oct 2K
+#ifdef FIGHTER_HUD
+ HIptr = (instr_item *) new lat_label( 70,
+ 40,
+ 1,
+ text_h,
+ get_latitude,
+ "%s%", //"%.0f",
+ "", //"Lat ",
+ "",
+ 1.0,
+ HUDS_TOP,
+ CENTER_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+ HIptr = (instr_item *) new lon_label( 475,
+ 40,
+ 1, text_h,
+ get_longitude,
+ "%s%",//"%.0f",
+ "", //"Lon ",
+ "",
+ 1.0,
+ HUDS_TOP,
+ CENTER_JUST,
+ font_size,
+ 0,
+ TRUE );
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+#else
+ HIptr = (instr_item *) new lat_label( (cen_x - (compass_w/2))/2,
max_y,
1,
text_h,
0,
TRUE );
HUD_deque.insert( HUD_deque.begin(), HIptr);
-
+#endif
+// $$$ end - added VS Renganthan 19 Oct 2K
/*
// case 10: // Digital KIAS
HIptr = (instr_item *) new instr_label ( 110,
extern char *coord_format_lon(float);
//extern char *coord_format_latlon(float latitude, float longitude); // cockpit.cxx
+// $$$ begin - added, VS Renganathan, 13 Oct 2K
+// #define FIGHTER_HUD
+extern float get_anzg (void);
+extern float get_Vx (void);
+extern float get_Vy (void);
+extern float get_Vz (void);
+extern float get_Ax (void);
+extern float get_Ay (void);
+extern float get_Az (void);
+extern int get_iaux1 (void);
+extern int get_iaux2 (void);
+extern int get_iaux3 (void);
+extern int get_iaux4 (void);
+extern int get_iaux5 (void);
+extern int get_iaux6 (void);
+extern int get_iaux7 (void);
+extern int get_iaux8 (void);
+extern int get_iaux9 (void);
+extern int get_iaux10 (void);
+extern int get_iaux11 (void);
+extern int get_iaux12 (void);
+extern float get_aux1(void);
+extern float get_aux2(void);
+extern float get_aux3(void);
+extern float get_aux4(void);
+extern float get_aux5 (void);
+extern float get_aux6 (void);
+extern float get_aux8(void);
+extern float get_aux9(void);
+extern float get_aux10(void);
+extern float get_aux11(void);
+extern float get_aux12(void);
+extern float get_aux13(void);
+extern float get_aux14(void);
+extern float get_aux15(void);
+extern float get_aux16(void);
+extern float get_aux17(void);
+extern float get_aux18(void);
+// $$$ end - added, VS Renganathan, 13 Oct 2K
+
extern char *get_formated_gmt_time( void );
extern void fgHUDReshape(void);
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 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( 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);
+ 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( -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);
+ 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
+// commented
+ // 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
+// commented
+// 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);
+
+// 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();
+
+ }
+ 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)) {
+ // 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,
+ 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 {
+ // draw major ticks
+ 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 );
+ }
+ }
+ }
+ }
+ }
+ }//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 )
{
}
}
+#endif
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;
}
//
// 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 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] ;
+
+ GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
+ GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
+ GLdouble eqn_right[4] = {1.0,0.0,0.0,100.0};
+
+ POINT centroid = get_centroid();
+ RECT box = get_location();
+
+ float half_span = box.right / 2.0;
+ float roll_value = current_ch2();
+ alpha = get_aoa();
+ pla = get_throttleval();
+
+ int lgear,wown,wowm,iclaw,ihook;
+ iclaw = 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; //$$$
+
+ glPushMatrix();
+ 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
+//*********************************************************
+ // Draw the FRL spot and line
+#define FRL_DIAMOND_SIZE 2.0
+ glBegin(GL_LINE_LOOP);
+ glVertex2f( -FRL_DIAMOND_SIZE, 0.0);
+ glVertex2f(0.0, FRL_DIAMOND_SIZE);
+ glVertex2f( FRL_DIAMOND_SIZE, 0.0);
+ glVertex2f(0.0, -FRL_DIAMOND_SIZE);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(0, FRL_DIAMOND_SIZE);
+ glVertex2f(0, 8.0 );
+ glEnd();
+#undef FRL_DIAMOND_SIZE
+
+ //velocity vector reticle - computations
+ Vxx = get_Vx();
+ Vyy = get_Vy();
+ Vzz = get_Vz();
+ Axx = get_Ax();
+ Ayy = get_Ay();
+ Azz = get_Az();
+ psi = get_heading();
+
+ if (psi > 180.0) psi = psi - 360;
+
+ total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
+ ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
+ up_vel = Vzz;
+
+ if (ground_vel < 2.0) {
+ if (fabs(up_vel) < 2.0) {
+ actslope = 0.0;
+ } else {
+ actslope = (up_vel/fabs(up_vel))*90.0;
+ }
+ } else {
+ actslope = atan(up_vel/ground_vel)*RAD_TO_DEG;
+ }
+
+ xvvr = (((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi)*(640.0/45.0));
+ drift = ((atan2(Vyy,Vxx)*RAD_TO_DEG)-psi);
+ yvvr = ((actslope - pitch_value)*factor);
+ 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);
+
+ // 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
+ 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);
+
+ // alpha bracket - reqd only for landing (tied to hook)
+ if (ihook == 1) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x-17, vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x-17, vel_y-(14-alpha)*factor);
+ glVertex2f(vel_x-20, vel_y-(14-alpha)*factor);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
+ 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);
+
+ //energy markers - compute potential slope
+ if (total_vel < 5.0) {
+ t1 = 0;
+ t2 = 0;
+ } else {
+ t1 = up_vel/total_vel;
+ t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
+ }
+ pot_slope = ((t2/3)*RAD_TO_DEG)*factor + vel_y;
+
+ //energy markers
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-20, pot_slope-5);
+ glVertex2f(vel_x-15, pot_slope);
+ glVertex2f(vel_x-20, pot_slope+5);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+20, pot_slope-5);
+ glVertex2f(vel_x+15, pot_slope);
+ glVertex2f(vel_x+20, pot_slope+5);
+ glEnd();
+ if (pla > (105.0/131.0)) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-24, pot_slope-5);
+ glVertex2f(vel_x-19, pot_slope);
+ glVertex2f(vel_x-24, pot_slope+5);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+24, pot_slope-5);
+ glVertex2f(vel_x+19, pot_slope);
+ glVertex2f(vel_x+24, pot_slope+5);
+ glEnd();
+ }
+
+// ramp reticle - for ski jump takeoff only
+ if (iclaw == 1) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(-15, -134);
+ glVertex2f(15, -134);
+ glEnd();
+ 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();
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(-6, actslope*4.0 - 134);
+ glVertex2f(0, actslope*4.0 -134 +3);
+ glVertex2f(6, actslope*4.0 - 134);
+ glVertex2f(0, actslope*4.0 -134 -3);
+ glEnd();
+ }
+
+ // Draw the locked velocity vector.
+ 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();
+ }
+
+ // FRL marker not rotated - this line shifted below
+ glTranslatef( vel_x, vel_y, 0);
+ glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
+
+ if( div_units ) {
+
+ 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 = 50.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 ) {
+ 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)/2.0f;
+
+ x_ini = -half_span;
+ x_end = 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 // if(scr_hole )
+ { // Draw ladder with space in the middle of the lines
+ float hole = (float)((scr_hole)/2.0f);
+ for( ; i<last ; i++ ) {
+
+// y = (((float)(i - pitch_value) * factor) + .5);
+ y = (((float)(i - actslope) * 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)/2.0f;
+// printf("l %f r %f b %f t %f\n",left, right, bot, top );
+
+ // Start by calculating the points and drawing the
+ // left side lines.
+ x_ini = -half_span;
+ x_end = -half_span + hole;
+
+ if( i >= 0 ) {
+ // Make zero point wider on left
+ if( i == 0 ) {
+ x_ini -= zero_offset;
+ } else {
+ // Zero or above draw solid lines
+ Line(x_end, y-5.0, x_end, y);
+ }
+
+ Line(x_ini, y, x_end, y);
+
+ } else {
+ // Below zero draw dashed lines.
+ Line(x_end, y+5.0, x_end, y);
+ StippleLine(x_ini, y, x_end, y);
+ }
+
+ // Now calculate the location of the left side label using
+ Text( x_ini-label_length, 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)
+ 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);
+ }
+
+ }
+
+ TextList.draw();
+
+ glLineWidth(0.2);
+
+ LineList.draw();
+
+ glEnable(GL_LINE_STIPPLE);
+ glLineStipple( 1, 0x00FF );
+ StippleLineList.draw( );
+ glDisable(GL_LINE_STIPPLE);
+ }
+ glDisable(GL_CLIP_PLANE0);
+ glDisable(GL_CLIP_PLANE1);
+ glDisable(GL_CLIP_PLANE2);
+// glDisable(GL_SCISSOR_TEST);
+ glPopMatrix();
+//*************************************************************
+// waypoint marker
+if (fabs(brg-psi) > 10.0) {
+ glPushMatrix();
+ glTranslatef( centroid.x, centroid.y, 0);
+ glTranslatef( vel_x, vel_y, 0);
+ glRotatef(brg - psi,0.0,0.0,-1.0);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(-2.5,20.0);
+ glVertex2f(-2.5,30.0);
+ glVertex2f(-5.0,30.0);
+ glVertex2f(0.0,35.0);
+ glVertex2f(5.0,30.0);
+ glVertex2f(2.5,30.0);
+ glVertex2f(2.5,20.0);
+ glEnd();
+ glPopMatrix();
+}
+// waypoint marker on heading scale
+if (fabs(brg-psi) < 12.0) {
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(((brg-psi)*60/25)+320,240.0);
+ glVertex2f(((brg-psi)*60/25)+326,240.0-4);
+ glVertex2f(((brg-psi)*60/25)+323,240.0-4);
+ glVertex2f(((brg-psi)*60/25)+323,240.0-8);
+ glVertex2f(((brg-psi)*60/25)+317,240.0-8);
+ glVertex2f(((brg-psi)*60/25)+317,240.0-4);
+ glVertex2f(((brg-psi)*60/25)+314,240.0-4);
+ glEnd();
+}
+//*************************************************************
+
+}
+#else
+// $$$ end - added VS Renganathan, 13 Oct 2K
+// draw DEFAULT_HUD
void HudLadder :: draw( void )
{
POINT centroid = get_centroid();
glPopMatrix();
}
+#endif // DEFAULT_HUD
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgpath.hxx>
+#include <Main/globals.hxx>
#include <Main/options.hxx>
-#include <Main/views.hxx>
#include <Objects/texload.h>
#include "hud.hxx"
{
return ((current_options.get_panel_status()) &&
(current_options.get_view_mode() == fgOPTIONS::FG_VIEW_PILOT) &&
- (current_view.get_view_offset() == 0.0));
+ (globals->get_current_view()->get_view_offset() == 0.0));
}
}
// Scale for the real window size.
- x = int(((float)x / current_view.get_winWidth()) * _winw);
- y = int(_winh - (((float)y / current_view.get_winHeight()) * _winh));
+ x = int(((float)x / globals->get_current_view()->get_winWidth()) * _winw);
+ y = int(_winh - (((float)y / globals->get_current_view()->get_winHeight())
+ * _winh));
// Adjust for offsets.
x -= _x_offset;
--- /dev/null
+// ADA.cxx -- interface to the "External"-ly driven ADA flight model
+//
+// 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.
+//
+// $Id$
+
+// Modified by Cdr. VS Renganthan <vsranga@ada.ernet.in>, 12 Oct 2K
+
+#include <simgear/io/iochannel.hxx>
+
+#include <Controls/controls.hxx>
+#include <GUI/gui.h>
+
+#include "ADA.hxx"
+
+#define numberofbytes 472
+
+struct {
+ double number_of_bytes;
+ double lat_geoc;
+ double lon_geoc;
+ double altitude;
+ double psirad;
+ double thetrad;
+ double phirad;
+ double earth_posn_angle;
+ double radius_to_vehicle;
+ double sea_level_radius;
+ double latitude;
+ double longitude;
+ double Vnorth;
+ double Veast;
+ double Vdown;
+ double Vcas_kts;
+ double prad;
+ double qrad;
+ double rrad;
+ double alpharad;
+ double betarad;
+ double latitude_dot;
+ double longitude_dot;
+ double radius_dot;
+ double Gamma_vert_rad;
+ double Runway_altitude;
+ double throttle;
+ double pstick;
+ double rstick;
+ double rpedal;
+ double U_local;
+ double V_local;
+ double W_local;
+ double U_dot_local;
+ double V_dot_local;
+ double W_dot_local;
+ double Machno;
+ double anxg;
+ double anyg;
+ double anzg;
+ double aux1;
+ double aux2;
+ double aux3;
+ double aux4;
+ double aux5;
+ double aux6;
+ double aux7;
+ double aux8;
+ int iaux1;
+ int iaux2;
+ int iaux3;
+ int iaux4;
+ int iaux5;
+ int iaux6;
+ int iaux7;
+ int iaux8;
+ int iaux9;
+ int iaux10;
+ int iaux11;
+ int iaux12;
+ float aux9;
+ float aux10;
+ float aux11;
+ float aux12;
+ float aux13;
+ float aux14;
+ float aux15;
+ float aux16;
+ float aux17;
+ float aux18;
+} sixdof_to_visuals;
+
+#define number_of_bytes sixdof_to_visuals.number_of_bytes
+#define U_dot_local sixdof_to_visuals.U_dot_local
+#define V_dot_local sixdof_to_visuals.V_dot_local
+#define W_dot_local sixdof_to_visuals.W_dot_local
+#define U_local sixdof_to_visuals.U_local
+#define V_local sixdof_to_visuals.V_local
+#define W_local sixdof_to_visuals.W_local
+#define throttle sixdof_to_visuals.throttle
+#define pstick sixdof_to_visuals.pstick
+#define rstick sixdof_to_visuals.rstick
+#define rpedal sixdof_to_visuals.rpedal
+#define V_north sixdof_to_visuals.Vnorth
+#define V_east sixdof_to_visuals.Veast
+#define V_down sixdof_to_visuals.Vdown
+#define V_calibrated_kts sixdof_to_visuals.Vcas_kts
+#define P_body sixdof_to_visuals.prad
+#define Q_body sixdof_to_visuals.qrad
+#define R_body sixdof_to_visuals.rrad
+#define Latitude_dot sixdof_to_visuals.latitude_dot
+#define Longitude_dot sixdof_to_visuals.longitude_dot
+#define Radius_dot sixdof_to_visuals.radius_dot
+#define Latitude sixdof_to_visuals.latitude
+#define Longitude sixdof_to_visuals.longitude
+#define Lat_geocentric sixdof_to_visuals.lat_geoc
+#define Lon_geocentric sixdof_to_visuals.lon_geoc
+#define Radius_to_vehicle sixdof_to_visuals.radius_to_vehicle
+#define Altitude sixdof_to_visuals.altitude
+#define Phi sixdof_to_visuals.phirad
+#define Theta sixdof_to_visuals.thetrad
+#define Psi sixdof_to_visuals.psirad
+#define Alpha sixdof_to_visuals.alpharad
+#define Beta sixdof_to_visuals.betarad
+#define Sea_level_radius sixdof_to_visuals.sea_level_radius
+#define Earth_position_angle sixdof_to_visuals.earth_posn_angle
+#define Runway_altitude sixdof_to_visuals.Runway_altitude
+#define Gamma_vert_rad sixdof_to_visuals.Gamma_vert_rad
+#define Machno sixdof_to_visuals.Machno
+#define anxg sixdof_to_visuals.anxg
+#define anyg sixdof_to_visuals.anyg
+#define anzg sixdof_to_visuals.anzg
+
+
+// Initialize the ADA flight model, dt is the time increment
+// for each subsequent iteration through the EOM
+bool FGADA::init( double dt ) {
+ // cout << "FGADA::init()" << endl;
+
+ char Buffer[numberofbytes];
+
+ // set valid time for this record
+ stamp_time();
+
+ printf("\nInitialising UDP sockets\n");
+ // initialise a "udp" socket
+ fdmsock = new SGSocket( "reddy_pc", "5001", "udp" );
+
+ // open as a client
+ bool result = fdmsock->open(SG_IO_OUT);
+ if (result == false) {
+ printf ("Socket Open Error\n");
+ } else {
+ // Dummy Write FGExternal structure from socket to establish connection
+ int result = fdmsock->write(Buffer, numberofbytes);
+ printf("Connection established.\n");
+ }
+
+ return true;
+}
+
+
+// Run an iteration of the EOM. This is essentially a NOP here
+// because these values are getting filled in elsewhere based on
+// external input.
+bool FGADA::update( int multiloop ) {
+ // cout << "FGADA::update()" << endl;
+
+ char Buffer[numberofbytes];
+
+ // Read FGExternal structure from socket
+ int result = fdmsock->read(Buffer, numberofbytes);
+ // Loop to read from top of socket buffer - Last in first out
+ while (result == numberofbytes) {
+ result = fdmsock->read(Buffer, numberofbytes);
+ }
+
+ // Copy buffer into FGExternal structure
+ memcpy (&sixdof_to_visuals, &Buffer, sizeof (Buffer));
+
+ //cout << endl << sixdof_to_visuals.aux18 << endl;
+ // Close Visuals through message/flag from Flight model
+ if (sixdof_to_visuals.aux18 == 1) {
+ fdmsock->close();
+ ConfirmExitDialog();
+ }
+ //cout << endl << sixdof_to_visuals.aux18 << endl;
+
+ // Convert from the FGExternal struct to the FGInterface struct (input)
+ copy_from_FGADA();
+
+ return true;
+}
+
+// Convert from the FGInterface struct to the FGADA struct (output)
+bool FGADA::copy_to_FGADA () {
+
+ return true;
+}
+
+
+// Convert from the FGADA struct to the FGInterface struct (input)
+bool FGADA::copy_from_FGADA() {
+
+ // Velocities
+ set_Velocities_Local( V_north, V_east, V_down );
+ set_V_calibrated_kts( V_calibrated_kts );
+
+ // Angular rates
+ set_Omega_Body( P_body, Q_body, R_body );
+ set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
+
+ // FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << Longitude
+ // << " lat_geoc = " << Lat_geocentric << " lat_geod = " << Latitude
+ // << " alt = " << Altitude << " sl_radius = " << Sea_level_radius
+ // << " radius_to_vehicle = " << Radius_to_vehicle );
+
+ // Positions
+ set_Geocentric_Position( Lat_geocentric, Lon_geocentric,Radius_to_vehicle );
+ set_Geodetic_Position( Latitude, Longitude, Altitude );
+ set_Euler_Angles( Phi, Theta, Psi );
+
+ // Miscellaneous quantities
+ set_Alpha( Alpha );
+ set_Beta( Beta );
+ set_Gamma_vert_rad( Gamma_vert_rad );
+ set_Sea_level_radius( Sea_level_radius );
+ set_Earth_position_angle( Earth_position_angle );
+ set_Runway_altitude( Runway_altitude );
+ set_sin_lat_geocentric(Lat_geocentric);
+ set_cos_lat_geocentric(Lat_geocentric);
+ set_sin_cos_longitude(Longitude);
+ set_sin_cos_latitude(Latitude);
+ set_Accels_Local( U_dot_local, V_dot_local, W_dot_local );
+ set_Velocities_Ground( U_local, V_local, W_local );
+ set_Accels_CG_Body_N( anxg,anyg,anzg);
+ set_Mach_number( Machno);
+
+ // printf("sr=%f\n",Sea_level_radius);
+ // printf("psi = %f %f\n",Psi,Psi*RAD_TO_DEG);
+
+ // controls
+ controls.set_throttle(0,throttle/131.0);
+ controls.set_elevator(pstick);
+ controls.set_aileron(rstick);
+ controls.set_rudder(rpedal);
+
+ // auxilliary parameters for HUD
+ set_iaux1(sixdof_to_visuals.iaux1);
+ set_iaux2(sixdof_to_visuals.iaux2);
+ set_iaux3(sixdof_to_visuals.iaux3);
+ set_iaux4(sixdof_to_visuals.iaux4);
+ set_iaux5(sixdof_to_visuals.iaux5);
+ set_iaux6(sixdof_to_visuals.iaux6);
+ set_iaux7(sixdof_to_visuals.iaux7);
+ set_iaux8(sixdof_to_visuals.iaux8);
+ set_iaux9(sixdof_to_visuals.iaux9);
+ set_iaux10(sixdof_to_visuals.iaux10);
+ set_iaux11(sixdof_to_visuals.iaux11);
+ set_iaux12(sixdof_to_visuals.iaux12);
+ set_aux1(sixdof_to_visuals.aux1);
+ set_aux2(sixdof_to_visuals.aux2);
+ set_aux3(sixdof_to_visuals.aux3);
+ set_aux4(sixdof_to_visuals.aux4);
+ set_aux5(sixdof_to_visuals.aux5);
+ set_aux6(sixdof_to_visuals.aux6);
+ set_aux7(sixdof_to_visuals.aux7);
+ set_aux8(sixdof_to_visuals.aux8);
+ set_aux9(sixdof_to_visuals.aux9);
+ set_aux10(sixdof_to_visuals.aux10);
+ set_aux11(sixdof_to_visuals.aux11);
+ set_aux12(sixdof_to_visuals.aux12);
+ set_aux13(sixdof_to_visuals.aux13);
+ set_aux14(sixdof_to_visuals.aux14);
+ set_aux15(sixdof_to_visuals.aux15);
+ set_aux16(sixdof_to_visuals.aux16);
+ set_aux17(sixdof_to_visuals.aux17);
+ set_aux18(sixdof_to_visuals.aux18);
+
+ cout << endl << sixdof_to_visuals.aux18 << endl;
+
+ return true;
+}
--- /dev/null
+// ADA.hxx -- interface to the "External"-ly driven ADA flight model
+//
+// 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.
+//
+// $Id$
+
+
+#ifndef _ADA_HXX
+#define _ADA_HXX
+
+
+#include <simgear/io/sg_socket.hxx>
+
+#include "flight.hxx"
+
+
+class FGADA: public FGInterface {
+
+private:
+
+ SGSocket *fdmsock;
+
+ // Auxilliary Flight Model parameters, basically for HUD
+ double aux1; // auxilliary flag
+ double aux2; // auxilliary flag
+ double aux3; // auxilliary flag
+ double aux4; // auxilliary flag
+ double aux5; // auxilliary flag
+ double aux6; // auxilliary flag
+ double aux7; // auxilliary flag
+ double aux8; // auxilliary flag
+ float aux9; // auxilliary flag
+ float aux10; // auxilliary flag
+ float aux11; // auxilliary flag
+ float aux12; // auxilliary flag
+ float aux13; // auxilliary flag
+ float aux14; // auxilliary flag
+ float aux15; // auxilliary flag
+ float aux16; // auxilliary flag
+ float aux17; // auxilliary flag
+ float aux18; // auxilliary flag
+ int iaux1; // auxilliary flag
+ int iaux2; // auxilliary flag
+ int iaux3; // auxilliary flag
+ int iaux4; // auxilliary flag
+ int iaux5; // auxilliary flag
+ int iaux6; // auxilliary flag
+ int iaux7; // auxilliary flag
+ int iaux8; // auxilliary flag
+ int iaux9; // auxilliary flag
+ int iaux10; // auxilliary flag
+ int iaux11; // auxilliary flag
+ int iaux12; // auxilliary flag
+
+ // copy FDM state to FGADA structures
+ bool copy_to_FGADA();
+
+ // copy FDM state from FGADA structures
+ bool copy_from_FGADA();
+
+public:
+
+ // reset flight params to a specific position
+ bool init( double dt );
+
+ // update position based on inputs, positions, velocities, etc.
+ bool update( int multiloop );
+
+ // auxiliary data getters and setters
+ inline double get_aux1() const { return aux1; }
+ inline void set_aux1(double aux) { aux1 = aux; }
+
+ inline double get_aux2() const { return aux2; }
+ inline void set_aux2(double aux) { aux2 = aux; }
+
+ inline double get_aux3() const { return aux3; }
+ inline void set_aux3(double aux) { aux3 = aux; }
+
+ inline double get_aux4() const { return aux4; }
+ inline void set_aux4(double aux) { aux4 = aux; }
+
+ inline double get_aux5() const { return aux5; }
+ inline void set_aux5(double aux) { aux5 = aux; }
+
+ inline double get_aux6() const { return aux6; }
+ inline void set_aux6(double aux) { aux6 = aux; }
+
+ inline double get_aux7() const { return aux7; }
+ inline void set_aux7(double aux) { aux7 = aux; }
+
+ inline double get_aux8() const { return aux8; }
+ inline void set_aux8(double aux) { aux8 = aux; }
+
+ inline float get_aux9() const { return aux9; }
+ inline void set_aux9(float aux) { aux9 = aux; }
+
+ inline float get_aux10() const { return aux10; }
+ inline void set_aux10(float aux) { aux10 = aux; }
+
+ inline float get_aux11() const { return aux11; }
+ inline void set_aux11(float aux) { aux11 = aux; }
+
+ inline float get_aux12() const { return aux12; }
+ inline void set_aux12(float aux) { aux12 = aux; }
+
+ inline float get_aux13() const { return aux13; }
+ inline void set_aux13(float aux) { aux13 = aux; }
+
+ inline float get_aux14() const { return aux14; }
+ inline void set_aux14(float aux) { aux14 = aux; }
+
+ inline float get_aux15() const { return aux15; }
+ inline void set_aux15(float aux) { aux15 = aux; }
+
+ inline float get_aux16() const { return aux16; }
+ inline void set_aux16(float aux) { aux16 = aux; }
+
+ inline float get_aux17() const { return aux17; }
+ inline void set_aux17(float aux) { aux17 = aux; }
+
+ inline float get_aux18() const { return aux18; }
+ inline void set_aux18(float aux) { aux18 = aux; }
+
+ inline int get_iaux1() const { return iaux1; }
+ inline void set_iaux1(int iaux) { iaux1 = iaux; }
+
+ inline int get_iaux2() const { return iaux2; }
+ inline void set_iaux2(int iaux) { iaux2 = iaux; }
+
+ inline int get_iaux3() const { return iaux3; }
+ inline void set_iaux3(int iaux) { iaux3 = iaux; }
+
+ inline int get_iaux4() const { return iaux4; }
+ inline void set_iaux4(int iaux) { iaux4 = iaux; }
+
+ inline int get_iaux5() const { return iaux5; }
+ inline void set_iaux5(int iaux) { iaux5 = iaux; }
+
+ inline int get_iaux6() const { return iaux6; }
+ inline void set_iaux6(int iaux) { iaux6 = iaux; }
+
+ inline int get_iaux7() const { return iaux7; }
+ inline void set_iaux7(int iaux) { iaux7 = iaux; }
+
+ inline int get_iaux8() const { return iaux8; }
+ inline void set_iaux8(int iaux) { iaux8 = iaux; }
+
+ inline int get_iaux9() const { return iaux9; }
+ inline void set_iaux9(int iaux) { iaux9 = iaux; }
+
+ inline int get_iaux10() const { return iaux10; }
+ inline void set_iaux10(int iaux) { iaux10 = iaux; }
+
+ inline int get_iaux11() const { return iaux11; }
+ inline void set_iaux11(int iaux) { iaux11 = iaux; }
+
+ inline int get_iaux12() const { return iaux12; }
+ inline void set_iaux12(int iaux) { iaux12 = iaux; }
+};
+
+
+#endif // _ADA_HXX
noinst_LIBRARIES = libFlight.a
libFlight_a_SOURCES = \
+ ADA.cxx ADA.hxx \
Balloon.cxx Balloon.h \
External.cxx External.hxx \
flight.cxx flight.hxx \
// Christian's hot air balloon simulation
FG_BALLOONSIM = 3,
+ // AEronautical DEvelopment AGEncy, Bangalore India
+ FG_ADA = 4,
+
// The following aren't implemented but are here to spark
// thoughts and discussions, and maybe even action.
- FG_ACM = 4,
- FG_SUPER_SONIC = 5,
- FG_HELICOPTER = 6,
- FG_AUTOGYRO = 7,
- FG_PARACHUTE = 8,
+ FG_ACM = 5,
+ FG_SUPER_SONIC = 6,
+ FG_HELICOPTER = 7,
+ FG_AUTOGYRO = 8,
+ FG_PARACHUTE = 9,
// Driven externally via a serial port, net, file, etc.
- FG_EXTERNAL = 9
+ FG_EXTERNAL = 10
};
// ========== Mass properties and geometry values ==========
}
// inline double * get_N_cg_body_v() { return n_cg_body_v; }
- // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
- // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
- // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
- // inline void set_Accels_CG_Body_N( double x, double y, double z ) {
- // n_cg_body_v[0] = x;
- // n_cg_body_v[1] = y;
- // n_cg_body_v[2] = z;
- // }
+ inline double get_N_X_cg() const { return n_cg_body_v[0]; }
+ inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
+ inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
+ inline void set_Accels_CG_Body_N( double x, double y, double z ) {
+ n_cg_body_v[0] = x;
+ n_cg_body_v[1] = y;
+ n_cg_body_v[2] = z;
+ }
// inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
// inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
// inline double * get_V_local_rel_ground_v() {
// return v_local_rel_ground_v;
// }
- // inline double get_V_north_rel_ground() const {
- // return v_local_rel_ground_v[0];
- // }
- // inline double get_V_east_rel_ground() const {
- // return v_local_rel_ground_v[1];
- // }
- // inline double get_V_down_rel_ground() const {
- // return v_local_rel_ground_v[2];
- // }
- // inline void set_Velocities_Ground(double north, double east, double down)
- // {
- // v_local_rel_ground_v[0] = north;
- // v_local_rel_ground_v[1] = east;
- // v_local_rel_ground_v[2] = down;
- // }
+ inline double get_V_north_rel_ground() const {
+ return v_local_rel_ground_v[0];
+ }
+ inline double get_V_east_rel_ground() const {
+ return v_local_rel_ground_v[1];
+ }
+ inline double get_V_down_rel_ground() const {
+ return v_local_rel_ground_v[2];
+ }
+ inline void set_Velocities_Ground(double north, double east, double down) {
+ v_local_rel_ground_v[0] = north;
+ v_local_rel_ground_v[1] = east;
+ v_local_rel_ground_v[2] = down;
+ }
// inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
#include <Main/fg_io.hxx>
#include <Main/globals.hxx>
#include <Main/options.hxx>
-#include <Main/views.hxx>
#include <Main/save.hxx>
#ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h>
}
#endif
#if defined(X_CURSOR_TWEAKS)
- glutWarpPointer( current_view.get_winWidth()/2, current_view.get_winHeight()/2);
+ glutWarpPointer( globals->get_current_view()->get_winWidth()/2,
+ globals->get_current_view()->get_winHeight()/2);
#endif
}
#if defined(WIN32_CURSOR_TWEAKS)
glutSetCursor(GLUT_CURSOR_NONE);
#elif defined(X_CURSOR_TWEAKS)
- glutWarpPointer( current_view.get_winWidth(), current_view.get_winHeight());
+ glutWarpPointer( globals->get_current_view()->get_winWidth(),
+ globals->get_current_view()->get_winHeight());
#endif
}
// reset left click MOUSE_VIEW toggle feature
_mVtoggle = 0;
- ww = current_view.get_winWidth();
- wh = current_view.get_winHeight();
+ ww = globals->get_current_view()->get_winWidth();
+ wh = globals->get_current_view()->get_winHeight();
switch (mouse_mode) {
case MOUSE_YOKE:
// do horizontal pan
// this could be done in above quat
// but requires redoing view pipeline
- offset = current_view.get_goal_view_offset();
+ offset = globals->get_current_view()->get_goal_view_offset();
offset += ((_mX - x) * FG_2PI / W );
while (offset < 0.0) {
offset += FG_2PI;
while (offset > FG_2PI) {
offset -= FG_2PI;
}
- current_view.set_goal_view_offset(offset);
+ globals->get_current_view()->set_goal_view_offset(offset);
#ifdef NO_SMOOTH_MOUSE_VIEW
- current_view.set_view_offset(offset);
+ globals->get_current_view()->set_view_offset(offset);
#endif
break;
curquat[1] = _quat[1];
curquat[2] = _quat[2];
curquat[3] = _quat[3];
- current_view.set_goal_view_offset(_view_offset);
+ globals->get_current_view()->set_goal_view_offset(_view_offset);
#ifdef NO_SMOOTH_MOUSE_VIEW
- current_view.set_view_offset(_view_offset);
+ globals->get_current_view()->set_view_offset(_view_offset);
#endif
} else {
// center view
_quat[1] = curquat[1];
_quat[2] = curquat[2];
_quat[3] = curquat[3];
- x = current_view.get_winWidth()/2;
- y = current_view.get_winHeight()/2;
+ x = globals->get_current_view()->get_winWidth()/2;
+ y = globals->get_current_view()->get_winHeight()/2;
Quat0();
- _view_offset = current_view.get_goal_view_offset();
- current_view.set_goal_view_offset(0.0);
+ _view_offset = globals->get_current_view()->get_goal_view_offset();
+ globals->get_current_view()->set_goal_view_offset(0.0);
#ifdef NO_SMOOTH_MOUSE_VIEW
- current_view.set_view_offset(0.0);
+ globals->get_current_view()->set_view_offset(0.0);
#endif
}
glutWarpPointer( x , y);
_savedX = x;
_savedY = y;
// start with zero point in center of screen
- _mX = current_view.get_winWidth()/2;
- _mY = current_view.get_winHeight()/2;
+ _mX = globals->get_current_view()->get_winWidth()/2;
+ _mY = globals->get_current_view()->get_winHeight()/2;
// try to have the MOUSE_YOKE position
// reflect the current stick position
case MOUSE_YOKE:
mouse_mode = MOUSE_VIEW;
current_options.set_control_mode( fgOPTIONS::FG_JOYSTICK );
- x = current_view.get_winWidth()/2;
- y = current_view.get_winHeight()/2;
+ x = globals->get_current_view()->get_winWidth()/2;
+ y = globals->get_current_view()->get_winHeight()/2;
_mVtoggle = 0;
Quat0();
build_rotmatrix(quat_mat, curquat);
#ifdef RESET_VIEW_ON_LEAVING_MOUSE_VIEW
Quat0();
build_rotmatrix(quat_mat, curquat);
- current_view.set_goal_view_offset(0.0);
+ globals->get_current_view()->set_goal_view_offset(0.0);
#ifdef NO_SMOOTH_MOUSE_VIEW
- current_view.set_view_offset(0.0);
+ globals->get_current_view()->set_view_offset(0.0);
#endif
#endif // RESET_VIEW_ON_LEAVING_MOUSE_VIEW
glutSetCursor(GLUT_CURSOR_INHERIT);
{
float oldfov = current_options.get_fov();
float fov = oldfov / multiplier;
- FGView *v = ¤t_view;
+ FGViewer *v = globals->get_current_view();
current_options.set_fov(fov);
v->force_update_fov_math();
fgInitVisuals();
- int cur_width = current_view.get_winWidth( );
- int cur_height = current_view.get_winHeight( );
+ int cur_width = globals->get_current_view()->get_winWidth( );
+ int cur_height = globals->get_current_view()->get_winHeight( );
if (b1) delete( b1 );
// New empty (mostly) bitmap
b1 = new GlBitmap( GL_RGB, 1, 1, (unsigned char *)"123" );
b1->copyBitmap( &b2, cur_width*x, cur_height*y );
}
}
- current_view.UpdateViewParams(cur_view_fdm);
+ globals->get_current_view()->UpdateViewParams(cur_view_fdm);
current_options.set_fov(oldfov);
v->force_update_fov_math();
return b1->getBitmap();
mainMenuBar->hide();
CGlPrinter p( CGlPrinter::PRINT_BITMAP );
- int cur_width = current_view.get_winWidth( );
- int cur_height = current_view.get_winHeight( );
+ int cur_width = globals->get_current_view()->get_winWidth( );
+ int cur_height = globals->get_current_view()->get_winHeight( );
p.Begin( "FlightGear", cur_width*3, cur_height*3 );
p.End( hiResScreenCapture(3) );
}
fgInitVisuals();
- fgReshape( current_view.get_winWidth(), current_view.get_winHeight() );
+ fgReshape( globals->get_current_view()->get_winWidth(),
+ globals->get_current_view()->get_winHeight() );
// we need two render frames here to clear the menu and cursor
// ... not sure why but doing an extra fgFenderFrame() shoulnd't
options.cxx options.hxx \
save.cxx save.hxx \
splash.cxx splash.hxx \
- views.cxx views.hxx
+ viewer.cxx viewer.hxx
fgfs_LDADD = \
$(top_builddir)/src/Aircraft/libAircraft.a \
#include <Cockpit/radiostack.hxx>
#include <Cockpit/panel.hxx>
#include <Cockpit/panel_io.hxx>
+#include <FDM/ADA.hxx>
#include <FDM/Balloon.h>
#include <FDM/External.hxx>
#include <FDM/JSBSim.hxx>
#include "fg_io.hxx"
#include "globals.hxx"
#include "options.hxx"
-#include "views.hxx"
#include "bfi.hxx"
#if defined(FX) && defined(XMESA)
cur_fdm_state = new FGLaRCsim;
} else if ( current_options.get_flight_model() == FGInterface::FG_JSBSIM ) {
cur_fdm_state = new FGJSBsim;
+ } else if ( current_options.get_flight_model() == FGInterface::FG_ADA ) {
+ cur_fdm_state = new FGADA;
} else if ( current_options.get_flight_model() ==
FGInterface::FG_BALLOONSIM ) {
cur_fdm_state = new FGBalloonSim;
// Initialize view parameters
FG_LOG( FG_GENERAL, FG_DEBUG, "Before current_view.init()");
- current_view.Init();
- pilot_view.Init();
+ globals->get_current_view()->Init();
+ globals->get_pilot_view()->Init();
FG_LOG( FG_GENERAL, FG_DEBUG, "After current_view.init()");
- current_view.UpdateViewMath(*cur_fdm_state);
- pilot_view.UpdateViewMath(*cur_fdm_state);
- FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << current_view.get_abs_view_pos());
+ globals->get_current_view()->UpdateViewMath(*cur_fdm_state);
+ globals->get_pilot_view()->UpdateViewMath(*cur_fdm_state);
+ FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = "
+ << globals->get_current_view()->get_abs_view_pos());
// current_view.UpdateWorldToEye(f);
// Initialize the planetary subsystem
cur_fdm_state->set_CG_Position( 0.0, 0.0, 0.0 );
// Initialize view parameters
- current_view.set_view_offset( 0.0 );
- current_view.set_goal_view_offset( 0.0 );
- pilot_view.set_view_offset( 0.0 );
- pilot_view.set_goal_view_offset( 0.0 );
+ globals->get_current_view()->set_view_offset( 0.0 );
+ globals->get_current_view()->set_goal_view_offset( 0.0 );
+ globals->get_pilot_view()->set_view_offset( 0.0 );
+ globals->get_pilot_view()->set_goal_view_offset( 0.0 );
FG_LOG( FG_GENERAL, FG_DEBUG, "After current_view.init()");
- current_view.UpdateViewMath(*cur_fdm_state);
- pilot_view.UpdateViewMath(*cur_fdm_state);
- FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << current_view.get_abs_view_pos());
+ globals->get_current_view()->UpdateViewMath(*cur_fdm_state);
+ globals->get_pilot_view()->UpdateViewMath(*cur_fdm_state);
+ FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = "
+ << globals->get_current_view()->get_abs_view_pos());
// fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
// 1.0 / current_options.get_model_hz() );
#include <simgear/route/route.hxx>
#include <simgear/timing/sg_time.hxx>
+#include "viewer.hxx"
+
class FGGlobals {
// Global autopilot "route"
SGRoute *route;
+ FGViewer *pilot_view;
+ FGViewer *current_view;
+
public:
FGGlobals();
inline SGRoute *get_route() const { return route; }
inline void set_route( SGRoute *r ) { route = r; }
+
+ inline FGViewer *get_pilot_view() const { return pilot_view; }
+ inline void set_pilot_view( FGViewer *v ) { pilot_view = v; }
+
+ inline FGViewer *get_current_view() const { return current_view; }
+ inline void set_current_view( FGViewer *v ) { current_view = v; }
+
};
#include "keyboard.hxx"
#include "options.hxx"
#include "save.hxx"
-#include "views.hxx"
// From main.cxx
extern void fgReshape( int width, int height );
void GLUTkey(unsigned char k, int x, int y) {
FGInterface *f;
SGTime *t;
- FGView *v;
+ FGViewer *v;
float fov, tmp;
static bool winding_ccw = true;
int speed;
f = current_aircraft.fdm_state;
- v = ¤t_view;
+ v = globals->get_current_view();
FG_LOG( FG_INPUT, FG_DEBUG, "Key hit = " << k );
if ( puKeyboard(k, PU_DOWN) ) {
case 49: // numeric keypad 1
v->set_goal_view_offset( FG_PI * 0.75 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(-25.0, 25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
v->set_view_offset( FG_PI * 0.75 );
}
return;
case 50: // numeric keypad 2
v->set_goal_view_offset( FG_PI );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(-25.0, 0.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
v->set_view_offset( FG_PI );
}
return;
case 51: // numeric keypad 3
v->set_goal_view_offset( FG_PI * 1.25 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(-25.0, -25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
v->set_view_offset( FG_PI * 1.25 );
}
return;
case 52: // numeric keypad 4
v->set_goal_view_offset( FG_PI * 0.50 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(0.0, 25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
v->set_view_offset( FG_PI * 0.50 );
}
return;
case 54: // numeric keypad 6
v->set_goal_view_offset( FG_PI * 1.50 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(0.0, -25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
v->set_view_offset( FG_PI * 1.50 );
}
return;
case 55: // numeric keypad 7
v->set_goal_view_offset( FG_PI * 0.25 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(25.0, 25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
v->set_view_offset( FG_PI * 0.25 );
}
return;
case 56: // numeric keypad 8
v->set_goal_view_offset( 0.00 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(25.0, 0.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
v->set_view_offset( 0.00 );
}
return;
case 57: // numeric keypad 9
v->set_goal_view_offset( FG_PI * 1.75 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(25.0, -25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
v->set_view_offset( FG_PI * 1.75 );
}
return;
current_options.set_view_mode(fgOPTIONS::FG_VIEW_FOLLOW);
v->set_goal_view_offset( FG_PI * 1.75 );
v->set_view_offset( FG_PI * 1.75 );
- pilot_view.set_pilot_offset(25.0, -25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
}
- fgReshape( current_view.get_winWidth(),
- current_view.get_winHeight() );
+ fgReshape( globals->get_current_view()->get_winWidth(),
+ globals->get_current_view()->get_winHeight() );
return;
case 120: // x key
fov = current_options.get_fov();
// Handle "special" keyboard events
void GLUTspecialkey(int k, int x, int y) {
- FGView *v;
+ FGViewer *v;
- v = ¤t_view;
+ v = globals->get_current_view();
FG_LOG( FG_INPUT, FG_DEBUG, "Special key hit = " << k );
}
case GLUT_KEY_F5: {
current_panel->setYOffset(current_panel->getYOffset() - 5);
- fgReshape(current_view.get_winWidth(),
- current_view.get_winHeight());
+ fgReshape(globals->get_current_view()->get_winWidth(),
+ globals->get_current_view()->get_winHeight());
return;
}
case GLUT_KEY_F6: {
current_panel->setYOffset(current_panel->getYOffset() + 5);
- fgReshape(current_view.get_winWidth(),
- current_view.get_winHeight());
+ fgReshape(globals->get_current_view()->get_winWidth(),
+ globals->get_current_view()->get_winHeight());
return;
}
case GLUT_KEY_F7: {
case GLUT_KEY_END: // numeric keypad 1
v->set_goal_view_offset( FG_PI * 0.75 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(-25.0, 25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(-25.0, 25.0, 1.0);
v->set_view_offset( FG_PI * 0.75 );
}
return;
case GLUT_KEY_DOWN: // numeric keypad 2
v->set_goal_view_offset( FG_PI );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(-25.0, 0.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(-25.0, 0.0, 1.0);
v->set_view_offset( FG_PI );
}
return;
case GLUT_KEY_PAGE_DOWN: // numeric keypad 3
v->set_goal_view_offset( FG_PI * 1.25 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(-25.0, -25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(-25.0, -25.0, 1.0);
v->set_view_offset( FG_PI * 1.25 );
}
return;
case GLUT_KEY_LEFT: // numeric keypad 4
v->set_goal_view_offset( FG_PI * 0.50 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(0.0, 25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(0.0, 25.0, 1.0);
v->set_view_offset( FG_PI * 0.50 );
}
return;
case GLUT_KEY_RIGHT: // numeric keypad 6
v->set_goal_view_offset( FG_PI * 1.50 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(0.0, -25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(0.0, -25.0, 1.0);
v->set_view_offset( FG_PI * 1.50 );
}
return;
case GLUT_KEY_HOME: // numeric keypad 7
v->set_goal_view_offset( FG_PI * 0.25 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(25.0, 25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(25.0, 25.0, 1.0);
v->set_view_offset( FG_PI * 0.25 );
}
return;
case GLUT_KEY_UP: // numeric keypad 8
v->set_goal_view_offset( 0.00 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(25.0, 0.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(25.0, 0.0, 1.0);
v->set_view_offset( 0.00 );
}
return;
case GLUT_KEY_PAGE_UP: // numeric keypad 9
v->set_goal_view_offset( FG_PI * 1.75 );
if (current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW) {
- pilot_view.set_pilot_offset(25.0, -25.0, 1.0);
+ globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
v->set_view_offset( FG_PI * 1.75 );
}
return;
#include <Time/sunpos.hxx>
#include <Time/tmp.hxx>
+// $$$ begin - added VS Renganathan
+#include <simgear/misc/fgstream.hxx>
+#include <FDM/flight.hxx>
+void fgLoadDCS (void);
+void fgUpdateDCS (void);
+ssgSelector *ship_sel = NULL;
+ssgTransform *ship_pos = NULL;
+//int totalDCSobj = 0;
+// $$$ end - added VS Renganathan
+
#ifndef FG_OLD_WEATHER
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
#include "keyboard.hxx"
#include "options.hxx"
#include "splash.hxx"
-#include "views.hxx"
// -dw- use custom sioux settings so I can see output window
// update view volume parameters
// cout << "before pilot_view update" << endl;
if ( current_options.get_view_mode() == fgOPTIONS::FG_VIEW_FOLLOW ) {
- float * offset = pilot_view.get_pilot_offset();
- current_view.set_pilot_offset(offset[0], offset[1], offset[2]);
+ float * offset = globals->get_pilot_view()->get_pilot_offset();
+ globals->get_current_view()->set_pilot_offset( offset[0],
+ offset[1],
+ offset[2] );
} else {
- current_view.set_pilot_offset(0.0, 0.0, 0.0);
+ globals->get_current_view()->set_pilot_offset(0.0, 0.0, 0.0);
}
- pilot_view.UpdateViewParams(*cur_fdm_state);
+ globals->get_pilot_view()->UpdateViewParams(*cur_fdm_state);
// cout << "after pilot_view update" << endl;
- current_view.UpdateViewParams(cur_view_fdm);
+ globals->get_current_view()->UpdateViewParams(cur_view_fdm);
// set the sun position
glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
// ssg does to set up the model view matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- ssgSetCamera( current_view.VIEW );
+ ssgSetCamera( (sgMat4)globals->get_current_view()->get_VIEW() );
/*
sgMat4 vm_tmp, view_mat;
if ( current_options.get_skyblend() ) {
sgVec3 view_pos;
sgSetVec3( view_pos,
- current_view.get_view_pos().x(),
- current_view.get_view_pos().y(),
- current_view.get_view_pos().z() );
+ globals->get_current_view()->get_view_pos().x(),
+ globals->get_current_view()->get_view_pos().y(),
+ globals->get_current_view()->get_view_pos().z() );
sgVec3 zero_elev;
sgSetVec3( zero_elev,
- current_view.get_cur_zero_elev().x(),
- current_view.get_cur_zero_elev().y(),
- current_view.get_cur_zero_elev().z() );
+ globals->get_current_view()->get_cur_zero_elev().x(),
+ globals->get_current_view()->get_cur_zero_elev().y(),
+ globals->get_current_view()->get_cur_zero_elev().z() );
/* cout << "thesky->repaint() sky_color = "
<< cur_light_params.sky_color[0] << " "
<< " moon dec = " << globals->get_ephem()->getMoonDeclination() << endl; */
thesky->reposition( view_pos, zero_elev,
- current_view.get_local_up(),
+ globals->get_current_view()->get_local_up(),
cur_fdm_state->get_Longitude(),
cur_fdm_state->get_Latitude(),
cur_fdm_state->get_Altitude() * FEET_TO_METER,
// glLoadIdentity();
float fov = current_options.get_fov();
// ssgSetFOV(fov * current_view.get_win_ratio(), fov);
- ssgSetFOV(fov, fov * current_view.get_win_ratio());
+ ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
double agl = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
- scenery.cur_elev;
sgMat4 sgTRANS;
sgMakeTransMat4( sgTRANS,
- pilot_view.view_pos.x(),
- pilot_view.view_pos.y(),
- pilot_view.view_pos.z() );
+ globals->get_pilot_view()->get_view_pos().x(),
+ globals->get_pilot_view()->get_view_pos().y(),
+ globals->get_pilot_view()->get_view_pos().z() );
sgVec3 ownship_up;
sgSetVec3( ownship_up, 0.0, 0.0, 1.0);
// sgTUX = ( sgROT * pilot_view.VIEW_ROT ) * sgTRANS
sgMat4 sgTUX;
sgCopyMat4( sgTUX, sgROT );
- sgPostMultMat4( sgTUX, pilot_view.VIEW_ROT );
+ sgPostMultMat4( sgTUX, globals->get_pilot_view()->get_VIEW_ROT() );
sgPostMultMat4( sgTUX, sgTRANS );
sgCoord tuxpos;
penguin_pos->setTransform( &tuxpos );
}
+ // $$$ begin - added VS Renganthan 17 Oct 2K
+ fgUpdateDCS();
+ // $$$ end - added VS Renganthan 17 Oct 2K
+
# ifdef FG_NETWORK_OLK
if ( current_options.get_network_olk() ) {
sgCoord fgdpos;
// update the view angle
for ( i = 0; i < multi_loop; i++ ) {
- if ( fabs(current_view.get_goal_view_offset() -
- current_view.get_view_offset()) < 0.05 )
+ if ( fabs(globals->get_current_view()->get_goal_view_offset() -
+ globals->get_current_view()->get_view_offset()) < 0.05 )
{
- current_view.set_view_offset( current_view.get_goal_view_offset() );
+ globals->get_current_view()->set_view_offset( globals->get_current_view()->get_goal_view_offset() );
break;
} else {
// move current_view.view_offset towards current_view.goal_view_offset
- if ( current_view.get_goal_view_offset() >
- current_view.get_view_offset() )
+ if ( globals->get_current_view()->get_goal_view_offset() >
+ globals->get_current_view()->get_view_offset() )
{
- if ( current_view.get_goal_view_offset() -
- current_view.get_view_offset() < FG_PI )
+ if ( globals->get_current_view()->get_goal_view_offset() -
+ globals->get_current_view()->get_view_offset() < FG_PI )
{
- current_view.inc_view_offset( 0.01 );
+ globals->get_current_view()->inc_view_offset( 0.01 );
} else {
- current_view.inc_view_offset( -0.01 );
+ globals->get_current_view()->inc_view_offset( -0.01 );
}
} else {
- if ( current_view.get_view_offset() -
- current_view.get_goal_view_offset() < FG_PI )
+ if ( globals->get_current_view()->get_view_offset() -
+ globals->get_current_view()->get_goal_view_offset() < FG_PI )
{
- current_view.inc_view_offset( -0.01 );
+ globals->get_current_view()->inc_view_offset( -0.01 );
} else {
- current_view.inc_view_offset( 0.01 );
+ globals->get_current_view()->inc_view_offset( 0.01 );
}
}
- if ( current_view.get_view_offset() > FG_2PI ) {
- current_view.inc_view_offset( -FG_2PI );
- } else if ( current_view.get_view_offset() < 0 ) {
- current_view.inc_view_offset( FG_2PI );
+ if ( globals->get_current_view()->get_view_offset() > FG_2PI ) {
+ globals->get_current_view()->inc_view_offset( -FG_2PI );
+ } else if ( globals->get_current_view()->get_view_offset() < 0 ) {
+ globals->get_current_view()->inc_view_offset( FG_2PI );
}
}
}
double tmp = -(l->sun_rotation + FG_PI)
- - (cur_fdm_state->get_Psi() - current_view.get_view_offset() );
+ - (cur_fdm_state->get_Psi() - globals->get_current_view()->get_view_offset() );
while ( tmp < 0.0 ) {
tmp += FG_2PI;
}
// Handle new window size or exposure
void fgReshape( int width, int height ) {
if ( ! fgPanelVisible() || idle_state != 1000 ) {
- current_view.set_win_ratio( (float)height / (float)width );
+ globals->get_current_view()->set_win_ratio( (float)height / (float)width );
glViewport(0, 0 , (GLint)(width), (GLint)(height) );
} else {
int view_h =
int((current_panel->getViewHeight() - current_panel->getYOffset())
* (height / 768.0)) + 1;
- current_view.set_win_ratio( (float)view_h / (float)width );
+ globals->get_current_view()->set_win_ratio( (float)view_h / (float)width );
glViewport(0, (GLint)(height - view_h),
(GLint)(width), (GLint)(view_h) );
}
- current_view.set_winWidth( width );
- current_view.set_winHeight( height );
- current_view.force_update_fov_math();
+ globals->get_current_view()->set_winWidth( width );
+ globals->get_current_view()->set_winHeight( height );
+ globals->get_current_view()->force_update_fov_math();
// set these fov to be the same as in fgRenderFrame()
// float x_fov = current_options.get_fov();
// glViewport ( 0, 0, width, height );
float fov = current_options.get_fov();
// ssgSetFOV(fov * current_view.get_win_ratio(), fov);
- ssgSetFOV(fov, fov * current_view.get_win_ratio());
+ ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
fgHUDReshape();
// yes we've finished all our initializations and are running
// the main loop, so this will now work without seg faulting
// the system.
- current_view.UpdateViewParams(cur_view_fdm);
+ globals->get_current_view()->UpdateViewParams(cur_view_fdm);
}
}
globals = new FGGlobals;
SGRoute *route = new SGRoute;
globals->set_route( route );
-
+ FGViewer *pv = new FGViewer;
+ globals->set_pilot_view( pv );
+ FGViewer *cv = new FGViewer;
+ globals->set_current_view( cv );
+
// Load the configuration parameters
if ( !fgInitConfig(argc, argv) ) {
FG_LOG( FG_GENERAL, FG_ALERT, "Config option parsing failed ..." );
globals->get_ephem()->getNumStars(),
globals->get_ephem()->getStars(), 60000.0 );
- thesky->add_cloud_layer( 2600.0, 200.0, 50.0, 40000.0,
- SG_CLOUD_MOSTLY_SUNNY );
- thesky->add_cloud_layer( 6000.0, 20.0, 10.0, 40000.0,
- SG_CLOUD_CIRRUS );
-
- // thesky->add_cloud_layer( 1000.0, 200.0, 50.0, SG_CLOUD_MOSTLY_SUNNY );
- // thesky->add_cloud_layer( 1800.0, 400.0, 100.0, SG_CLOUD_OVERCAST );
- // thesky->add_cloud_layer( 5000.0, 20.0, 10.0, SG_CLOUD_CIRRUS );
+ if ( current_options.get_clouds() == true ) {
+ thesky->add_cloud_layer( 2600.0, 200.0, 50.0, 40000.0,
+ SG_CLOUD_MOSTLY_SUNNY );
+ thesky->add_cloud_layer( 6000.0, 20.0, 10.0, 40000.0,
+ SG_CLOUD_CIRRUS );
+ // thesky->add_cloud_layer( 1000.0, 200.0, 50.0,
+ // SG_CLOUD_MOSTLY_SUNNY );
+ // thesky->add_cloud_layer( 1800.0, 400.0, 100.0, SG_CLOUD_OVERCAST );
+ // thesky->add_cloud_layer( 5000.0, 20.0, 10.0, SG_CLOUD_CIRRUS );
+ }
// Initialize MagVar model
SGMagVar *magvar = new SGMagVar();
penguin_sel->clrTraversalMaskBits( SSGTRAV_HOT );
scene->addKid( penguin_sel );
+ // $$$ begin - added VS Renganthan 17 Oct 2K
+ fgLoadDCS();
+ // $$$ end - added VS Renganthan 17 Oct 2K
+
#ifdef FG_NETWORK_OLK
// Do the network intialization
if ( current_options.get_network_olk() ) {
// etc.
return 0;
}
+
+
+// $$$ end - added VS Renganathan, 15 Oct 2K
+void fgLoadDCS(void) {
+
+ double obj_lat,obj_lon,obj_alt;
+ int i = 1;
+ string obj_filename;
+
+ FGPath tile_path( current_options.get_fg_root());
+ tile_path.append( "Scenery" );
+ tile_path.append( "Objects.txt" );
+ fg_gzifstream in( tile_path.str() );
+ if ( ! in.is_open() ) {
+ FG_LOG( FG_TERRAIN, FG_ALERT, "Cannot open file: " << tile_path.str() );
+ }
+
+ FGPath modelpath( current_options.get_fg_root() );
+ modelpath.append( "Models" );
+ modelpath.append( "Geometry" );
+
+ FGPath texturepath( current_options.get_fg_root() );
+ texturepath.append( "Models" );
+ texturepath.append( "Textures" );
+
+ ssgModelPath( (char *)modelpath.c_str() );
+ ssgTexturePath( (char *)texturepath.c_str() );
+
+ // while ( ! in.eof() ) {
+ // in >> obj_filename >> obj_lat >> obj_lon >> obj_alt;
+ // totalDCSobj = totalDCSobj+1;
+
+ ship_sel = new ssgSelector;
+ ship_pos = new ssgTransform;
+ ssgEntity *ship_obj = ssgLoadOBJ( "saratoga.obj" );
+ if ( ship_obj != NULL ) {
+ ship_pos->addKid( ship_obj ); // add object to transform node
+ ship_sel->addKid( ship_pos ); // add transform node to selector
+ // ssgFlatten( ship_obj );
+ // ssgStripify( ship_sel );
+ ship_sel->clrTraversalMaskBits( SSGTRAV_HOT );
+ scene->addKid( ship_sel ); //add selector node to root node
+ } else {
+ FG_LOG( FG_TERRAIN, FG_ALERT, "Cannot open file: " << "saratoga.obj" );
+ }
+
+ // if (in.eof()) break;
+
+ // } // while
+ return;
+}
+
+
+void fgUpdateDCS (void) {
+
+ double eye_lat,eye_lon,eye_alt;
+ static double obj_lat=15.377603*DEG_TO_RAD;
+ static double obj_lon= 73.816436*DEG_TO_RAD;
+ static double obj_alt=0.15;
+ static double obj_head;
+ double sl_radius,obj_latgc;
+ float nresultmat[4][4];
+ sgMat4 Trans,rothead,rotlon,rot180,rotlat,resultmat1,resultmat2,resultmat3;
+ double bz[3];
+
+ obj_lat = obj_lat + 0.0000001;
+
+ // Instantaneous Geodetic Lat/Lon/Alt of moving object
+ // obj_lon = current_aircraft.fdm_state->get_aux5()*DEG_TO_RAD;
+ // obj_lat = current_aircraft.fdm_state->get_aux6()*DEG_TO_RAD;
+ // obj_alt = current_aircraft.fdm_state->get_aux7();
+
+ // Geodetic to Geocentric angles for rotation
+ sgGeodToGeoc(obj_lat,obj_alt,&sl_radius,&obj_latgc);
+
+ // moving object gbs-posn in cartesian coords
+ Point3D obj_posn = Point3D( obj_lon,obj_lat,obj_alt);
+ Point3D obj_pos = sgGeodToCart( obj_posn );
+
+ // Translate moving object w.r.t eye
+ Point3D Objtrans = obj_pos-scenery.center;
+ bz[0]=Objtrans.x();
+ bz[1]=Objtrans.y();
+ bz[2]=Objtrans.z();
+
+ // rotate dynamic objects for lat,lon & alt and other motion about its axes
+ if ( ship_sel != NULL ) {
+ ship_sel->select(1);
+
+ sgMat4 sgTRANS;
+ sgMakeTransMat4( sgTRANS, bz[0],bz[1],bz[2]);
+
+ sgVec3 ship_fwd,ship_rt,ship_up;
+ sgSetVec3( ship_fwd, 1.0, 0.0, 0.0);//east,roll
+ sgSetVec3( ship_rt, 0.0, 1.0, 0.0);//up,pitch
+ sgSetVec3( ship_up, 0.0, 0.0, 1.0); //north,yaw
+
+ sgMat4 sgROT_lon, sgROT_lat, sgROT_hdg;
+ sgMakeRotMat4( sgROT_lon, obj_lon*RAD_TO_DEG, ship_up );
+ sgMakeRotMat4( sgROT_lat, 90-obj_latgc*RAD_TO_DEG, ship_rt );
+ sgMakeRotMat4( sgROT_hdg, 180.0, ship_up );
+
+ sgMat4 sgTUX;
+ sgCopyMat4( sgTUX, sgROT_hdg );
+ sgPostMultMat4( sgTUX, sgROT_lat );
+ sgPostMultMat4( sgTUX, sgROT_lon );
+ sgPostMultMat4( sgTUX, sgTRANS );
+
+ sgCoord shippos;
+ sgSetCoord( &shippos, sgTUX );
+ ship_pos->setTransform( &shippos );
+ }
+}
+
+// $$$ end - added VS Renganathan, 15 Oct 2K
#include "fg_init.hxx"
#include "globals.hxx"
#include "options.hxx"
-#include "views.hxx"
FG_USING_STD(string);
FG_USING_NAMESPACE(std);
ysize(600),
bpp(16),
view_mode(FG_VIEW_PILOT),
+ default_view_offset(0),
// Scenery options
tile_diameter(5),
} */
// fgReshape( xsize, ysize);
- fgReshape( current_view.get_winWidth(), current_view.get_winHeight() );
+ fgReshape( globals->get_current_view()->get_winWidth(),
+ globals->get_current_view()->get_winHeight() );
if( !freeze )
globals->set_freeze( false );
fgOPTIONS::parse_fdm( const string& fm ) {
// cout << "fdm = " << fm << endl;
- if ( fm == "balloon" ) {
+ if ( fm == "ada" ) {
+ return FGInterface::FG_ADA;
+ } else if ( fm == "balloon" ) {
return FGInterface::FG_BALLOONSIM;
} else if ( fm == "external" ) {
return FGInterface::FG_EXTERNAL;
current_properties.setStringValue(name.c_str(), value);
FG_LOG(FG_GENERAL, FG_INFO, "Setting default value of property "
<< name << " to \"" << value << '"');
+ // $$$ begin - added VS Renganathan, 14 Oct 2K
+ // for multi-window outside window imagery
+ } else if ( arg.find( "--view-offset=" ) != string::npos ) {
+ string woffset = arg.substr( 14 );
+ if ( woffset == "LEFT" ) {
+ default_view_offset = M_PI * 0.25;
+ } else if ( woffset == "RIGHT" ) {
+ default_view_offset = M_PI * 1.75;
+ } else if ( woffset == "CENTER" ) {
+ default_view_offset = 0.00;
+ } else {
+ default_view_offset = atof( woffset.c_str() ) * DEG_TO_RAD;
+ }
+ // $$$ end - added VS Renganathan, 14 Oct 2K
} else if ( arg.find( "--wp=" ) != string::npos ) {
parse_wp( arg.substr( 5 ) );
} else {
cout << "Flight Model:" << endl;
cout << "\t--fdm=abcd: selects the core flight model code." << endl;
- cout << "\t\tcan be one of jsb, larcsim, magic, or external" << endl;
+ cout << "\t\tcan be one of jsb, larcsim, magic, external, balloon, or ada"
+ << endl;
cout << "\t--aircraft=abcd: aircraft model to load" << endl;
cout << "\t--model-hz=n: run the FDM this rate (iterations per second)"
<< endl;
cout << "\t--enable-wireframe: enable wireframe drawing mode" << endl;
cout << "\t--geometry=WWWxHHH: window geometry: 640x480, 800x600, etc."
<< endl;
+ cout << "\t--view-offset=xxx: set the default forward view direction"
+ << endl;
+ cout << "\t\tas an offset from straight ahead. Allowable values are"
+ << endl;
+ cout << "\t\tLEFT, RIGHT, CENTER, or a specific number of degrees" << endl;
cout << endl;
cout << "Scenery Options:" << endl;
int xsize, ysize; // window size derived from geometry string
int bpp; // bits per pixel
fgViewMode view_mode; // view mode
+ double default_view_offset; // default forward view offset (for use by
+ // multi-display configuration
// Scenery options
int tile_radius; // Square radius of rendered tiles (around center
inline int get_ysize() const { return ysize; }
inline int get_bpp() const { return bpp; }
inline fgViewMode get_view_mode() const { return view_mode; }
+ inline double get_default_view_offset() const {
+ return default_view_offset;
+ }
+
+
inline int get_tile_radius() const { return tile_radius; }
inline int get_tile_diameter() const { return tile_diameter; }
#include <Main/options.hxx>
#include <Objects/texload.h>
+#include "globals.hxx"
#include "splash.hxx"
-#include "views.hxx"
static GLuint splash_texid;
int xsize = 480;
int ysize = 380;
- if ( !current_view.get_winWidth() || !current_view.get_winHeight() ) {
+ if ( !globals->get_current_view()->get_winWidth()
+ || !globals->get_current_view()->get_winHeight() ) {
return;
}
- xmin = (current_view.get_winWidth() - xsize) / 2;
+ xmin = (globals->get_current_view()->get_winWidth() - xsize) / 2;
xmax = xmin + xsize;
- ymin = (current_view.get_winHeight() - ysize) / 2;
+ ymin = (globals->get_current_view()->get_winHeight() - ysize) / 2;
ymax = ymin + ysize;
// first clear the screen;
xglMatrixMode(GL_PROJECTION);
xglPushMatrix();
xglLoadIdentity();
- gluOrtho2D(0, current_view.get_winWidth(), 0, current_view.get_winHeight());
+ gluOrtho2D(0, globals->get_current_view()->get_winWidth(),
+ 0, globals->get_current_view()->get_winHeight());
xglMatrixMode(GL_MODELVIEW);
xglPushMatrix();
xglLoadIdentity();
--- /dev/null
+// viewer.cxx -- class for managing a viewer in the flightgear world.
+//
+// Written by Curtis Olson, started August 1997.
+// overhaul started October 2000.
+//
+// Copyright (C) 1997 - 2000 Curtis L. Olson - curt@flightgear.org
+//
+// 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.
+//
+// $Id$
+
+
+#include <simgear/compiler.h>
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <plib/ssg.h> // plib include
+
+#include <simgear/constants.h>
+#include <simgear/debug/logstream.hxx>
+#include <simgear/math/point3d.hxx>
+#include <simgear/math/polar3d.hxx>
+#include <simgear/math/vector.hxx>
+
+#include <Aircraft/aircraft.hxx>
+#include <Cockpit/panel.hxx>
+#include <Scenery/scenery.hxx>
+
+#include "options.hxx"
+#include "viewer.hxx"
+
+
+// Constructor
+FGViewer::FGViewer( void ) {
+}
+
+#define USE_FAST_VIEWROT
+#ifdef USE_FAST_VIEWROT
+// VIEW_ROT = LARC_TO_SSG * ( VIEWo * VIEW_OFFSET )
+// This takes advantage of the fact that VIEWo and VIEW_OFFSET
+// only have entries in the upper 3x3 block
+// and that LARC_TO_SSG is just a shift of rows NHV
+inline static void fgMakeViewRot( sgMat4 dst, const sgMat4 m1, const sgMat4 m2 )
+{
+ for ( int j = 0 ; j < 3 ; j++ ) {
+ dst[2][j] = m2[0][0] * m1[0][j] +
+ m2[0][1] * m1[1][j] +
+ m2[0][2] * m1[2][j];
+
+ dst[0][j] = m2[1][0] * m1[0][j] +
+ m2[1][1] * m1[1][j] +
+ m2[1][2] * m1[2][j];
+
+ dst[1][j] = m2[2][0] * m1[0][j] +
+ m2[2][1] * m1[1][j] +
+ m2[2][2] * m1[2][j];
+ }
+ dst[0][3] =
+ dst[1][3] =
+ dst[2][3] =
+ dst[3][0] =
+ dst[3][1] =
+ dst[3][2] = SG_ZERO;
+ dst[3][3] = SG_ONE;
+}
+#endif
+
+// Initialize a view structure
+void FGViewer::Init( void ) {
+ FG_LOG( FG_VIEW, FG_INFO, "Initializing View parameters" );
+
+ view_offset = goal_view_offset = current_options.get_default_view_offset();
+ sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 );
+
+ winWidth = current_options.get_xsize();
+ winHeight = current_options.get_ysize();
+
+ set_win_ratio( winHeight / winWidth );
+
+#ifndef USE_FAST_VIEWROT
+ // This never changes -- NHV
+ LARC_TO_SSG[0][0] = 0.0;
+ LARC_TO_SSG[0][1] = 1.0;
+ LARC_TO_SSG[0][2] = -0.0;
+ LARC_TO_SSG[0][3] = 0.0;
+
+ LARC_TO_SSG[1][0] = 0.0;
+ LARC_TO_SSG[1][1] = 0.0;
+ LARC_TO_SSG[1][2] = 1.0;
+ LARC_TO_SSG[1][3] = 0.0;
+
+ LARC_TO_SSG[2][0] = 1.0;
+ LARC_TO_SSG[2][1] = -0.0;
+ LARC_TO_SSG[2][2] = 0.0;
+ LARC_TO_SSG[2][3] = 0.0;
+
+ LARC_TO_SSG[3][0] = 0.0;
+ LARC_TO_SSG[3][1] = 0.0;
+ LARC_TO_SSG[3][2] = 0.0;
+ LARC_TO_SSG[3][3] = 1.0;
+#endif // USE_FAST_VIEWROT
+
+ force_update_fov_math();
+}
+
+
+#define USE_FAST_LOCAL
+#ifdef USE_FAST_LOCAL
+inline static void fgMakeLOCAL( sgMat4 dst, const double Theta,
+ const double Phi, const double Psi)
+{
+ SGfloat cosTheta = (SGfloat) cos(Theta);
+ SGfloat sinTheta = (SGfloat) sin(Theta);
+ SGfloat cosPhi = (SGfloat) cos(Phi);
+ SGfloat sinPhi = (SGfloat) sin(Phi);
+ SGfloat sinPsi = (SGfloat) sin(Psi) ;
+ SGfloat cosPsi = (SGfloat) cos(Psi) ;
+
+ dst[0][0] = cosPhi * cosTheta;
+ dst[0][1] = sinPhi * cosPsi + cosPhi * -sinTheta * -sinPsi;
+ dst[0][2] = sinPhi * sinPsi + cosPhi * -sinTheta * cosPsi;
+ dst[0][3] = SG_ZERO;
+
+ dst[1][0] = -sinPhi * cosTheta;
+ dst[1][1] = cosPhi * cosPsi + -sinPhi * -sinTheta * -sinPsi;
+ dst[1][2] = cosPhi * sinPsi + -sinPhi * -sinTheta * cosPsi;
+ dst[1][3] = SG_ZERO ;
+
+ dst[2][0] = sinTheta;
+ dst[2][1] = cosTheta * -sinPsi;
+ dst[2][2] = cosTheta * cosPsi;
+ dst[2][3] = SG_ZERO;
+
+ dst[3][0] = SG_ZERO;
+ dst[3][1] = SG_ZERO;
+ dst[3][2] = SG_ZERO;
+ dst[3][3] = SG_ONE ;
+}
+#endif
+
+
+// Update the view volume, position, and orientation
+void FGViewer::UpdateViewParams( const FGInterface& f ) {
+ UpdateViewMath(f);
+
+ if ( ! fgPanelVisible() ) {
+ xglViewport(0, 0 , (GLint)(winWidth), (GLint)(winHeight) );
+ } else {
+ int view_h =
+ int((current_panel->getViewHeight() - current_panel->getYOffset())
+ * (winHeight / 768.0));
+ glViewport(0, (GLint)(winHeight - view_h),
+ (GLint)(winWidth), (GLint)(view_h) );
+ }
+}
+
+
+// convert sgMat4 to MAT3 and print
+static void print_sgMat4( sgMat4 &in) {
+ int i, j;
+ for ( i = 0; i < 4; i++ ) {
+ for ( j = 0; j < 4; j++ ) {
+ printf("%10.4f ", in[i][j]);
+ }
+ cout << endl;
+ }
+}
+
+
+// Update the view parameters
+void FGViewer::UpdateViewMath( const FGInterface& f ) {
+
+ Point3D p;
+ sgVec3 v0, minus_z, sgvec, forward;
+ sgMat4 VIEWo, TMP;
+
+ if ( update_fov ) {
+ ssgSetFOV( current_options.get_fov(),
+ current_options.get_fov() * win_ratio );
+ update_fov = false;
+ }
+
+ scenery.center = scenery.next_center;
+
+ // printf("scenery center = %.2f %.2f %.2f\n", scenery.center.x,
+ // scenery.center.y, scenery.center.z);
+
+ // calculate the cartesion coords of the current lat/lon/0 elev
+ p = Point3D( f.get_Longitude(),
+ f.get_Lat_geocentric(),
+ f.get_Sea_level_radius() * FEET_TO_METER );
+
+ cur_zero_elev = sgPolarToCart3d(p) - scenery.center;
+
+ // calculate view position in current FG view coordinate system
+ // p.lon & p.lat are already defined earlier, p.radius was set to
+ // the sea level radius, so now we add in our altitude.
+ if ( f.get_Altitude() * FEET_TO_METER >
+ (scenery.cur_elev + 0.5 * METER_TO_FEET) ) {
+ p.setz( p.radius() + f.get_Altitude() * FEET_TO_METER );
+ } else {
+ p.setz( p.radius() + scenery.cur_elev + 0.5 * METER_TO_FEET );
+ }
+
+ abs_view_pos = sgPolarToCart3d(p);
+
+ view_pos = abs_view_pos - scenery.center;
+
+ FG_LOG( FG_VIEW, FG_DEBUG, "Polar view pos = " << p );
+ FG_LOG( FG_VIEW, FG_DEBUG, "Absolute view pos = " << abs_view_pos );
+ FG_LOG( FG_VIEW, FG_DEBUG, "Relative view pos = " << view_pos );
+
+ // code to calculate LOCAL matrix calculated from Phi, Theta, and
+ // Psi (roll, pitch, yaw) in case we aren't running LaRCsim as our
+ // flight model
+
+#ifdef USE_FAST_LOCAL
+
+ fgMakeLOCAL( LOCAL, f.get_Theta(), f.get_Phi(), -f.get_Psi() );
+
+#else // USE_TEXT_BOOK_METHOD
+
+ sgVec3 rollvec;
+ sgSetVec3( rollvec, 0.0, 0.0, 1.0 );
+ sgMat4 PHI; // roll
+ sgMakeRotMat4( PHI, f.get_Phi() * RAD_TO_DEG, rollvec );
+
+ sgVec3 pitchvec;
+ sgSetVec3( pitchvec, 0.0, 1.0, 0.0 );
+ sgMat4 THETA; // pitch
+ sgMakeRotMat4( THETA, f.get_Theta() * RAD_TO_DEG, pitchvec );
+
+ // ROT = PHI * THETA
+ sgMat4 ROT;
+ // sgMultMat4( ROT, PHI, THETA );
+ sgCopyMat4( ROT, PHI );
+ sgPostMultMat4( ROT, THETA );
+
+ sgVec3 yawvec;
+ sgSetVec3( yawvec, 1.0, 0.0, 0.0 );
+ sgMat4 PSI; // pitch
+ sgMakeRotMat4( PSI, -f.get_Psi() * RAD_TO_DEG, yawvec );
+
+ // LOCAL = ROT * PSI
+ // sgMultMat4( LOCAL, ROT, PSI );
+ sgCopyMat4( LOCAL, ROT );
+ sgPostMultMat4( LOCAL, PSI );
+
+#endif // YIKES
+
+ // cout << "LOCAL matrix" << endl;
+ // print_sgMat4( LOCAL );
+
+ sgMakeRotMat4( UP,
+ f.get_Longitude() * RAD_TO_DEG,
+ 0.0,
+ -f.get_Latitude() * RAD_TO_DEG );
+
+ sgSetVec3( local_up, UP[0][0], UP[0][1], UP[0][2] );
+ // sgXformVec3( local_up, UP );
+ // cout << "Local Up = " << local_up[0] << "," << local_up[1] << ","
+ // << local_up[2] << endl;
+
+ // Alternative method to Derive local up vector based on
+ // *geodetic* coordinates
+ // alt_up = sgPolarToCart(FG_Longitude, FG_Latitude, 1.0);
+ // printf( " Alt Up = (%.4f, %.4f, %.4f)\n",
+ // alt_up.x, alt_up.y, alt_up.z);
+
+ // VIEWo = LOCAL * UP
+ // sgMultMat4( VIEWo, LOCAL, UP );
+ sgCopyMat4( VIEWo, LOCAL );
+ sgPostMultMat4( VIEWo, UP );
+ // cout << "VIEWo matrix" << endl;
+ // print_sgMat4( VIEWo );
+
+ // generate the sg view up and forward vectors
+ sgSetVec3( view_up, VIEWo[0][0], VIEWo[0][1], VIEWo[0][2] );
+ // cout << "view = " << view[0] << ","
+ // << view[1] << "," << view[2] << endl;
+ sgSetVec3( forward, VIEWo[2][0], VIEWo[2][1], VIEWo[2][2] );
+ // cout << "forward = " << forward[0] << ","
+ // << forward[1] << "," << forward[2] << endl;
+
+ // generate the pilot offset vector in world coordinates
+ sgVec3 pilot_offset_world;
+ sgSetVec3( pilot_offset_world,
+ pilot_offset[2], pilot_offset[1], -pilot_offset[0] );
+ sgXformVec3( pilot_offset_world, pilot_offset_world, VIEWo );
+
+ // generate the view offset matrix
+ sgMakeRotMat4( VIEW_OFFSET, view_offset * RAD_TO_DEG, view_up );
+ // cout << "VIEW_OFFSET matrix" << endl;
+ // print_sgMat4( VIEW_OFFSET );
+ sgXformVec3( view_forward, forward, VIEW_OFFSET );
+ // cout << "view_forward = " << view_forward[0] << ","
+ // << view_forward[1] << "," << view_forward[2] << endl;
+
+ // VIEW_ROT = LARC_TO_SSG * ( VIEWo * VIEW_OFFSET )
+#ifdef USE_FAST_VIEWROT
+ fgMakeViewRot( VIEW_ROT, VIEW_OFFSET, VIEWo );
+#else
+ // sgMultMat4( VIEW_ROT, VIEW_OFFSET, VIEWo );
+ // sgPreMultMat4( VIEW_ROT, LARC_TO_SSG );
+ sgCopyMat4( VIEW_ROT, VIEWo );
+ sgPostMultMat4( VIEW_ROT, VIEW_OFFSET );
+ sgPreMultMat4( VIEW_ROT, LARC_TO_SSG );
+#endif
+ // cout << "VIEW_ROT matrix" << endl;
+ // print_sgMat4( VIEW_ROT );
+
+ sgVec3 trans_vec;
+ sgSetVec3( trans_vec,
+ view_pos.x() + pilot_offset_world[0],
+ view_pos.y() + pilot_offset_world[1],
+ view_pos.z() + pilot_offset_world[2] );
+
+ // VIEW = VIEW_ROT * TRANS
+ sgCopyMat4( VIEW, VIEW_ROT );
+ sgPostMultMat4ByTransMat4( VIEW, trans_vec );
+
+ //!!!!!!!!!!!!!!!!!!!
+ // THIS IS THE EXPERIMENTAL VIEWING ANGLE SHIFTER
+ // THE MAJORITY OF THE WORK IS DONE IN GUI.CXX
+ // this in gui.cxx for now just testing
+ extern float quat_mat[4][4];
+ sgPreMultMat4( VIEW, quat_mat);
+ // !!!!!!!!!! testing
+
+ // make a vector to the current view position
+ sgSetVec3( v0, view_pos.x(), view_pos.y(), view_pos.z() );
+
+ // Given a vector pointing straight down (-Z), map into onto the
+ // local plane representing "horizontal". This should give us the
+ // local direction for moving "south".
+ sgSetVec3( minus_z, 0.0, 0.0, -1.0 );
+
+ sgmap_vec_onto_cur_surface_plane(local_up, v0, minus_z, surface_south);
+ sgNormalizeVec3(surface_south);
+ // cout << "Surface direction directly south " << surface_south[0] << ","
+ // << surface_south[1] << "," << surface_south[2] << endl;
+
+ // now calculate the surface east vector
+#define USE_FAST_SURFACE_EAST
+#ifdef USE_FAST_SURFACE_EAST
+ sgVec3 local_down;
+ sgNegateVec3(local_down, local_up);
+ sgVectorProductVec3(surface_east, surface_south, local_down);
+#else
+#define USE_LOCAL_UP
+#ifdef USE_LOCAL_UP
+ sgMakeRotMat4( TMP, FG_PI_2 * RAD_TO_DEG, local_up );
+#else
+ sgMakeRotMat4( TMP, FG_PI_2 * RAD_TO_DEG, view_up );
+#endif // USE_LOCAL_UP
+ // cout << "sgMat4 TMP" << endl;
+ // print_sgMat4( TMP );
+ sgXformVec3(surface_east, surface_south, TMP);
+#endif // USE_FAST_SURFACE_EAST
+ // cout << "Surface direction directly east " << surface_east[0] << ","
+ // << surface_east[1] << "," << surface_east[2] << endl;
+ // cout << "Should be close to zero = "
+ // << sgScalarProductVec3(surface_south, surface_east) << endl;
+}
+
+
+void FGViewer::CurrentNormalInLocalPlane(sgVec3 dst, sgVec3 src) {
+ sgVec3 tmp;
+ sgSetVec3(tmp, src[0], src[1], src[2] );
+ sgMat4 TMP;
+ sgTransposeNegateMat4 ( TMP, UP ) ;
+ sgXformVec3(tmp, tmp, TMP);
+ sgSetVec3(dst, tmp[2], tmp[1], tmp[0] );
+}
+
+
+// Destructor
+FGViewer::~FGViewer( void ) {
+}
--- /dev/null
+// viewer.hxx -- class for managing a viewer in the flightgear world.
+//
+// Written by Curtis Olson, started August 1997.
+// overhaul started October 2000.
+//
+// Copyright (C) 1997 - 2000 Curtis L. Olson - curt@flightgear.org
+//
+// 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.
+//
+// $Id$
+
+
+#ifndef _VIEWER_HXX
+#define _VIEWER_HXX
+
+
+#ifndef __cplusplus
+# error This library requires C++
+#endif
+
+#include <simgear/compiler.h>
+#include <simgear/math/point3d.hxx>
+#include <simgear/timing/sg_time.hxx>
+
+#include <list>
+
+#include <plib/sg.h> // plib include
+
+#include <FDM/flight.hxx>
+#include <Time/light.hxx>
+
+#include "options.hxx"
+
+FG_USING_STD(list);
+
+
+#define FG_FOV_MIN 0.1
+#define FG_FOV_MAX 179.9
+
+
+// Define a structure containing view information
+class FGViewer {
+
+private:
+
+ // the current view offset angle from forward (rotated about the
+ // view_up vector)
+ double view_offset;
+
+ // the goal view offset angle (used for smooth view changes)
+ double goal_view_offset;
+
+ // flag forcing update of fov related stuff
+ bool update_fov;
+
+ // fov of view is specified in the X direction, win_ratio is used to
+ // calculate the fov in the Y direction. fov(y) = fov(x) * win_ratio
+ double win_ratio;
+
+ // width & height of window
+ int winWidth, winHeight;
+
+ // absolute view position in earth coordinates
+ Point3D abs_view_pos;
+
+ // view position in opengl world coordinates (this is the
+ // abs_view_pos translated to scenery.center)
+ Point3D view_pos;
+
+ // pilot offset from center of gravity. The X axis is positive
+ // out the tail, Y is out the right wing, and Z is positive up.
+ // Distances in meters of course.
+ sgVec3 pilot_offset;
+
+ // cartesion coordinates of current lon/lat if at sea level
+ // translated to scenery.center
+ Point3D cur_zero_elev;
+
+ // vector in cartesian coordinates from current position to the
+ // postion on the earth's surface the sun is directly over
+ sgVec3 to_sun;
+
+ // surface direction to go to head towards sun
+ sgVec3 surface_to_sun;
+
+ // vector in cartesian coordinates from current position to the
+ // postion on the earth's surface the moon is directly over
+ sgVec3 to_moon;
+
+ // surface direction to go to head towards moon
+ sgVec3 surface_to_moon;
+
+ // surface vector heading south
+ sgVec3 surface_south;
+
+ // surface vector heading east (used to unambiguously align sky
+ // with sun)
+ sgVec3 surface_east;
+
+ // local up vector (normal to the plane tangent to the earth's
+ // surface at the spot we are directly above
+ sgVec3 local_up;
+
+ // up vector for the view (usually point straight up through the
+ // top of the aircraft
+ sgVec3 view_up;
+
+ // the vector pointing straight out the nose of the aircraft
+ sgVec3 view_forward;
+
+ // Transformation matrix for eye coordinates to aircraft coordinates
+ // sgMat4 AIRCRAFT;
+
+ // Transformation matrix for the view direction offset relative to
+ // the AIRCRAFT matrix
+ sgMat4 VIEW_OFFSET;
+
+ // sg versions of our friendly matrices
+ sgMat4 LOCAL, UP, VIEW_ROT, TRANS, VIEW, LARC_TO_SSG;
+
+public:
+
+ // Constructor
+ FGViewer( void );
+
+ // Destructor
+ ~FGViewer( void );
+
+ // Initialize a view class
+ void Init( void );
+
+ // Update the view volume, position, and orientation
+ void UpdateViewParams( const FGInterface& f );
+
+ // Flag to request that UpdateFOV() be called next time
+ // UpdateViewMath() is run.
+ inline void force_update_fov_math() { update_fov = true; }
+
+ // Update the view parameters
+ void UpdateViewMath( const FGInterface& f );
+
+ // Update the field of view coefficients
+ void UpdateFOV( const fgOPTIONS& o );
+
+ // Transform a vector from world coordinates to the local plane
+ void CurrentNormalInLocalPlane(sgVec3 dst, sgVec3 src);
+
+ // accessor functions
+ inline double get_view_offset() const { return view_offset; }
+ inline void set_view_offset( double a ) { view_offset = a; }
+ inline void inc_view_offset( double amt ) { view_offset += amt; }
+ inline double get_goal_view_offset() const { return goal_view_offset; }
+ inline void set_goal_view_offset( double a) { goal_view_offset = a; }
+ inline double get_win_ratio() const { return win_ratio; }
+ inline void set_win_ratio( double r ) { win_ratio = r; }
+ inline int get_winWidth() const { return winWidth; }
+ inline void set_winWidth( int w ) { winWidth = w; }
+ inline int get_winHeight() const { return winHeight; }
+ inline void set_winHeight( int h ) { winHeight = h; }
+ inline Point3D get_abs_view_pos() const { return abs_view_pos; }
+ inline Point3D get_view_pos() const { return view_pos; }
+ inline float *get_pilot_offset() { return pilot_offset; }
+ inline void set_pilot_offset( float x, float y, float z ) {
+ sgSetVec3( pilot_offset, x, y, z );
+ }
+ inline Point3D get_cur_zero_elev() const { return cur_zero_elev; }
+ inline float *get_to_sun() { return to_sun; }
+ inline void set_to_sun( float x, float y, float z ) {
+ sgSetVec3( to_sun, x, y, z );
+ }
+ inline float *get_surface_to_sun() { return surface_to_sun; }
+ inline void set_surface_to_sun( float x, float y, float z) {
+ sgSetVec3( surface_to_sun, x, y, z );
+ }
+ inline float *get_to_moon() { return to_moon; }
+ inline void set_to_moon( float x, float y, float z) {
+ sgSetVec3( to_moon, x, y, z );
+ }
+ inline float *get_surface_to_moon() { return surface_to_moon; }
+ inline void set_surface_to_moon( float x, float y, float z) {
+ sgSetVec3( surface_to_moon, x, y, z );
+ }
+ inline float *get_surface_south() { return surface_south; }
+ inline float *get_surface_east() { return surface_east; }
+ inline float *get_local_up() { return local_up; }
+ inline float *get_view_forward() { return view_forward; }
+
+ inline const sgVec4 *get_VIEW() { return VIEW; }
+ inline const sgVec4 *get_VIEW_ROT() { return VIEW_ROT; }
+};
+
+#endif // _VIEWER_HXX
+
+
//
// $Id$
+#error do not compile me
+
#include <simgear/compiler.h>
#ifdef HAVE_CONFIG_H
#ifndef _VIEWS_HXX
#define _VIEWS_HXX
+#error do not include me!
#ifndef __cplusplus
# error This library requires C++
// width & height of window
int winWidth, winHeight;
- // absolute view position
+ // absolute view position in earth coordinates
Point3D abs_view_pos;
- // view position translated to scenery.center
+ // view position in opengl world coordinates (this is the
+ // abs_view_pos translated to scenery.center)
Point3D view_pos;
// pilot offset from center of gravity. The X axis is positive
#include <Cockpit/hud.hxx>
#include <plib/ssg.h>
-#include <Main/views.hxx>
+#include <Main/globals.hxx>
//#define printf //
return i;
}
-void fgd_print_Mat4( sgMat4 m ) {
+void fgd_print_Mat4( const sgMat4 m ) {
printf("0.0 %f 0.1 %f 0.2 %f 0.3 %f\n",
m[0][0], m[0][1], m[0][2], m[0][3] );
printf("1.0 %f 1.1 %f 1.2 %f 1.3 %f\n",
int net_resolv_fgd( char *fgd_host_check ) {
-char *fgd_ip_check;
+ char *fgd_ip_check = "";
/* resolving the destination host, here fgd's host */
net_r = 0;
/* Here sending the previously calculated view.Mat4 by FGFS */
case 17: if (verbose == 2) printf("Checkpoint\n");
- sgCopyMat4(sgFGD_COORD, current_view.VIEW);
+ sgCopyMat4(sgFGD_COORD, globals->get_current_view()->get_VIEW());
if (verbose == 2) {
printf("current_view\n");
- fgd_print_Mat4( current_view.VIEW);
+ fgd_print_Mat4( globals->get_current_view()->get_VIEW());
printf("FGD_COORD\n");
fgd_print_Mat4( sgFGD_COORD);
}
#include <Include/general.hxx>
#include <Main/options.hxx>
-#include <Main/views.hxx>
#include <Scenery/tileentry.hxx>
#include "matlib.hxx"
#include <simgear/misc/fgstream.hxx>
#include <simgear/misc/fgpath.hxx>
+#include <Main/globals.hxx>
#include <Main/options.hxx>
-#include <Main/views.hxx>
#include <Objects/obj.hxx>
#include <Scenery/scenery.hxx> // for scenery.center
return(i);
} else if ( tile_cache[i].is_loaded() || tile_cache[i].is_cached() ) {
// calculate approximate distance from view point
- abs_view_pos = current_view.get_abs_view_pos();
+ abs_view_pos = globals->get_current_view()->get_abs_view_pos();
FG_LOG( FG_TERRAIN, FG_DEBUG,
"DIST Abs view pos = " << abs_view_pos );
#include <simgear/math/vector.hxx>
// #include <Aircraft/aircraft.hxx>
+#include <Main/globals.hxx>
#include <Main/options.hxx>
-#include <Main/views.hxx>
#include <Objects/obj.hxx>
#ifndef FG_OLD_WEATHER
sgSetVec3(tmp, hit_list.get_normal(this_hit));
ssgState *IntersectedLeafState =
((ssgLeaf*)hit_list.get_entity(this_hit))->getState();
- current_view.CurrentNormalInLocalPlane(tmp, tmp);
+ globals->get_current_view()->CurrentNormalInLocalPlane(tmp, tmp);
sgdSetVec3( scenery.cur_normal, tmp );
// cout << "NED: " << tmp[0] << " " << tmp[1] << " " << tmp[2] << endl;
return true;
} else {
FG_LOG( FG_TERRAIN, FG_INFO, "no terrain intersection" );
scenery.cur_elev = 0.0;
- float *up = current_view.local_up;
+ float *up = globals->get_current_view()->get_local_up();
sgdSetVec3(scenery.cur_normal, up[0], up[1], up[2]);
return false;
}
} else {
// cout << "abs view pos = " << current_view.abs_view_pos
// << " view pos = " << current_view.view_pos << endl;
- current_elev_ssg( current_view.abs_view_pos,
- current_view.view_pos );
+ current_elev_ssg( globals->get_current_view()->get_abs_view_pos(),
+ globals->get_current_view()->get_view_pos() );
}
// cout << "current elevation (ssg) == " << scenery.cur_elev << endl;
#include <simgear/misc/fgpath.hxx>
#include <Aircraft/aircraft.hxx>
+#include <Main/globals.hxx>
#include <Main/options.hxx>
-#include <Main/views.hxx>
#include "light.hxx"
#include "sunpos.hxx"
// first determine the difference between our view angle and local
// direction to the sun
rotation = -(sun_rotation + FG_PI)
- - (f->get_Psi() - current_view.get_view_offset());
+ - (f->get_Psi() - globals->get_current_view()->get_view_offset());
while ( rotation < 0 ) {
rotation += FG_2PI;
}
#include <simgear/math/vector.hxx>
#include <Main/globals.hxx>
-#include <Main/views.hxx>
#include <Scenery/scenery.hxx>
#include "moonpos.hxx"
// update the cur_time_params structure with the current moon position
void fgUpdateMoonPos( void ) {
fgLIGHT *l;
- FGView *v;
+ FGViewer *v;
sgVec3 nup, nmoon, v0, surface_to_moon;
Point3D p, rel_moonpos;
double dot, east_dot;
l = &cur_light_params;
SGTime *t = globals->get_time_params();
- v = ¤t_view;
+ v = globals->get_current_view();
FG_LOG( FG_EVENT, FG_INFO, " Updating Moon position" );
#include <simgear/math/vector.hxx>
#include <Main/globals.hxx>
-#include <Main/views.hxx>
#include <Scenery/scenery.hxx>
#include "sunpos.hxx"
// update the cur_time_params structure with the current sun position
void fgUpdateSunPos( void ) {
fgLIGHT *l;
- FGView *v;
+ FGViewer *v;
sgVec3 nup, nsun, v0, surface_to_sun;
Point3D p, rel_sunpos;
double dot, east_dot;
l = &cur_light_params;
SGTime *t = globals->get_time_params();
- v = ¤t_view;
+ v = globals->get_current_view();
FG_LOG( FG_EVENT, FG_INFO, " Updating Sun position" );
FG_LOG( FG_EVENT, FG_INFO, " Gst = " << t->getGst() );