#endif
#include <GL/glut.h>
-#include "../XGL/xgl.h"
+#include <XGL/xgl.h>
#include <stdio.h>
-#include "GLUTkey.h"
-#include "fg_init.h"
-#include "views.h"
-
-#include "../Include/constants.h"
-#include "../Include/general.h"
-
-#include "../Aircraft/aircraft.h"
-#include "../Cockpit/cockpit.h"
-#include "../Joystick/joystick.h"
-#include "../Math/fg_geodesy.h"
-#include "../Math/mat3.h"
-#include "../Math/polar.h"
-#include "../Scenery/mesh.h"
-#include "../Scenery/moon.h"
-#include "../Scenery/scenery.h"
-#include "../Scenery/sky.h"
-#include "../Scenery/stars.h"
-#include "../Scenery/sun.h"
-#include "../Time/event.h"
-#include "../Time/fg_time.h"
-#include "../Time/fg_timer.h"
-#include "../Time/sunpos.h"
-#include "../Weather/weather.h"
+#include <Main/GLUTkey.h>
+#include <Main/fg_init.h>
+#include <Main/fg_debug.h>
+#include <Main/views.h>
+
+#include <Include/fg_constants.h>
+#include <Include/general.h>
+
+#include <Aircraft/aircraft.h>
+#include <Astro/moon.h>
+#include <Astro/planets.h>
+#include <Astro/sky.h>
+#include <Astro/stars.h>
+#include <Astro/sun.h>
+#include <Cockpit/cockpit.h>
+#include <Joystick/joystick.h>
+#include <Math/fg_geodesy.h>
+#include <Math/mat3.h>
+#include <Math/polar.h>
+#include <Scenery/scenery.h>
+#include <Scenery/tilemgr.h>
+#include <Time/event.h>
+#include <Time/fg_time.h>
+#include <Time/fg_timer.h>
+#include <Time/sunpos.h>
+#include <Weather/weather.h>
/* This is a record containing global housekeeping information */
/* pointer to scenery structure */
/* static GLint scenery, runway; */
-double Simtime;
+/* double Simtime; */
/* Another hack */
int use_signals = 0;
* fgInitVisuals() -- Initialize various GL/view parameters
**************************************************************************/
-static void fgInitVisuals() {
+static void fgInitVisuals( void ) {
struct fgLIGHT *l;
struct fgTIME *t;
struct fgWEATHER *w;
xglFogf (GL_FOG_END, w->visibility);
/* xglFogf (GL_FOG_DENSITY, w->visibility); */
xglHint (GL_FOG_HINT, GL_NICEST /* GL_FASTEST */ );
+
+ /* draw wire frame */
+ /* xglPolygonMode(GL_FRONT_AND_BACK,GL_LINE); */
}
* Update the view volume, position, and orientation
**************************************************************************/
-static void fgUpdateViewParams() {
- struct fgFLIGHT *f;
+static void fgUpdateViewParams( void ) {
+ fgFLIGHT *f;
struct fgLIGHT *l;
struct fgTIME *t;
struct fgVIEW *v;
- f = ¤t_aircraft.flight;
+ f = current_aircraft.flight;
l = &cur_light_params;
t = &cur_time_params;
v = ¤t_view;
/*************************************************************************
* Draw a basic instrument panel
************************************************************************/
-static void fgUpdateInstrViewParams() {
+static void fgUpdateInstrViewParams( void ) {
xglViewport(0, 0 , (GLint)winWidth, (GLint)winHeight / 2);
xglMatrixMode(GL_PROJECTION);
/* update view volume parameters */
fgUpdateViewParams();
- xglClear( GL_DEPTH_BUFFER_BIT /* | GL_COLOR_BUFFER_BIT */ );
+ xglClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
/* Tell GL we are switching to model view parameters */
xglMatrixMode(GL_MODELVIEW);
xglPushMatrix();
/* Translate to view position */
xglTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z );
- /* Rotate based on gst (side real time) */
+ /* Rotate based on gst (sidereal time) */
angle = t->gst * 15.041085; /* should be 15.041085, Curt thought it was 15*/
/* printf("Rotating astro objects by %.2f degrees\n",angle); */
xglRotatef( angle, 0.0, 0.0, -1.0 );
/* draw stars and planets */
fgStarsRender();
+ fgPlanetsRender();
/* draw the sun */
fgSunRender();
xglLightfv(GL_LIGHT0, GL_AMBIENT, white );
xglLightfv(GL_LIGHT0, GL_DIFFUSE, white );
xglEnable( GL_CULL_FACE );
+
+ /* Let's try some blending technique's (Durk)*/
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE);
fgMoonRender();
+ glDisable(GL_BLEND);
xglPopMatrix();
/* set lighting parameters */
xglLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
xglLightfv(GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
- fgSceneryRender();
+ fgTileMgrRender();
+ /* fgSceneryRender(); */
/* display HUD */
if( show_hud ) {
**************************************************************************/
void fgUpdateTimeDepCalcs(int multi_loop) {
- struct fgFLIGHT *f;
+ fgFLIGHT *f;
struct fgTIME *t;
struct fgVIEW *v;
int i;
- f = ¤t_aircraft.flight;
+ f = current_aircraft.flight;
t = &cur_time_params;
v = ¤t_view;
}
-void fgInitTimeDepCalcs() {
+void fgInitTimeDepCalcs( void ) {
/* initialize timer */
#ifdef USE_ITIMER
static int remainder = 0;
int elapsed, multi_loop;
double cur_elev;
- double joy_x, joy_y;
- int joy_b1, joy_b2;
- struct fgAIRCRAFT *a;
- struct fgFLIGHT *f;
+ /* double joy_x, joy_y; */
+ /* int joy_b1, joy_b2; */
+ fgAIRCRAFT *a;
+ fgFLIGHT *f;
struct fgTIME *t;
- printf("Running Main Loop\n");
- printf("======= ==== ====\n");
+ fgPrintf( FG_ALL, FG_DEBUG, "Running Main Loop\n");
+ fgPrintf( FG_ALL, FG_DEBUG, "======= ==== ====\n");
a = ¤t_aircraft;
- f = &a->flight;
+ f = a->flight;
t = &cur_time_params;
/* update "time" */
/* Calculate model iterations needed */
elapsed = fgGetTimeInterval();
- printf("Time interval is = %d, previous remainder is = %d\n", elapsed,
- remainder);
- printf("--> Frame rate is = %.2f\n", 1000.0 / (float)elapsed);
+ fgPrintf( FG_ALL, FG_BULK, "Time interval is = %d, previous remainder is = %d\n",
+ elapsed, remainder);
+ fgPrintf( FG_ALL, FG_BULK, "--> Frame rate is = %.2f\n", 1000.0 / (float)elapsed);
elapsed += remainder;
multi_loop = ((float)elapsed * 0.001) * DEFAULT_MODEL_HZ;
remainder = elapsed - ((multi_loop*1000) / DEFAULT_MODEL_HZ);
- printf("Model iterations needed = %d, new remainder = %d\n", multi_loop,
- remainder);
+ fgPrintf( FG_ALL, FG_BULK, "Model iterations needed = %d, new remainder = %d\n",
+ multi_loop, remainder);
/* Run flight model */
if ( ! use_signals ) {
/* I'm just sticking this here for now, it should probably move
* eventually */
- cur_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC,
- FG_Latitude * RAD_TO_ARCSEC);
+ /* cur_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC,
+ FG_Latitude * RAD_TO_ARCSEC); */
+ /* there is no ground collision detection really, so for now I
+ * just hard code the ground elevation to be 0 */
+ cur_elev = 0;
+
/* printf("Ground elevation is %.2f meters here.\n", cur_elev); */
/* FG_Runway_altitude = cur_elev * METER_TO_FEET; */
/* now set aircraft altitude above ground */
FG_Altitude = cur_elev * METER_TO_FEET + 3.758099;
- printf("<*> resetting altitude to %.0f meters\n",
+ fgPrintf( FG_ALL, FG_BULK, "<*> resetting altitude to %.0f meters\n",
FG_Altitude * FEET_TO_METER);
}
- /* fgAircraftOutputCurrent(a); */
+ fgAircraftOutputCurrent(a);
+
+ /* see if we need to load any new scenery tiles */
+ fgTileMgrUpdate();
/* Process/manage pending events */
fgEventProcess();
/* redraw display */
fgRenderFrame();
- printf("\n");
+ fgPrintf( FG_ALL, FG_DEBUG, "\n");
}
**************************************************************************/
int main( int argc, char *argv[] ) {
- struct fgFLIGHT *f;
+ fgFLIGHT *f;
- f = ¤t_aircraft.flight;
+ f = current_aircraft.flight;
printf("Flight Gear: Version %s\n\n", VERSION);
}
-#ifdef NO_PRINTF
- #include <stdarg.h>
- int printf (const char *format, ...) {
- }
+#ifdef __SUNPRO_CC
+ extern "C" {
+ void __eprintf( void ) {
+ }
+ }
#endif
-
/* $Log$
-/* Revision 1.44 1997/12/30 22:22:31 curt
-/* Further integration of event manager.
+/* Revision 1.57 1998/02/07 15:29:40 curt
+/* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
+/* <chotchkiss@namg.us.anritsu.com>
/*
+ * Revision 1.56 1998/02/03 23:20:23 curt
+ * Lots of little tweaks to fix various consistency problems discovered by
+ * Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
+ * passed arguments along to the real printf(). Also incorporated HUD changes
+ * by Michele America.
+ *
+ * Revision 1.55 1998/02/02 20:53:58 curt
+ * Incorporated Durk's changes.
+ *
+ * Revision 1.54 1998/01/31 00:43:10 curt
+ * Added MetroWorks patches from Carmen Volpe.
+ *
+ * Revision 1.53 1998/01/27 18:35:54 curt
+ * Minor tweaks.
+ *
+ * Revision 1.52 1998/01/27 00:47:56 curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
+ * Revision 1.51 1998/01/26 15:57:05 curt
+ * Tweaks for dynamic scenery development.
+ *
+ * Revision 1.50 1998/01/19 19:27:07 curt
+ * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
+ * This should simplify things tremendously.
+ *
+ * Revision 1.49 1998/01/19 18:40:31 curt
+ * Tons of little changes to clean up the code and to remove fatal errors
+ * when building with the c++ compiler.
+ *
+ * Revision 1.48 1998/01/19 18:35:46 curt
+ * Minor tweaks and fixes for cygwin32.
+ *
+ * Revision 1.47 1998/01/13 00:23:08 curt
+ * Initial changes to support loading and management of scenery tiles. Note,
+ * there's still a fair amount of work left to be done.
+ *
+ * Revision 1.46 1998/01/08 02:22:06 curt
+ * Beginning to integrate Tile management subsystem.
+ *
+ * Revision 1.45 1998/01/07 03:18:55 curt
+ * Moved astronomical stuff from .../Src/Scenery to .../Src/Astro/
+ *
+ * Revision 1.44 1997/12/30 22:22:31 curt
+ * Further integration of event manager.
+ *
* Revision 1.43 1997/12/30 20:47:43 curt
* Integrated new event manager with subsystem initializations.
*