/* view parameters */
static GLfloat win_ratio = 1.0;
+static GLint winWidth, winHeight;
/* temporary hack */
/* pointer to scenery structure */
/* Yet another hack. This one used by the HUD code. Michele */
int show_hud;
+/* Yet another other hack. Used for my prototype instrument code. (Durk) */
+int displayInstruments;
+
/**************************************************************************
* fgInitVisuals() -- Initialize various GL/view parameters
/* xglFogf (GL_FOG_START, 1.0); */
xglFogf (GL_FOG_END, w->visibility);
/* xglFogf (GL_FOG_DENSITY, w->visibility); */
- /* xglHint (GL_FOG_HINT, GL_FASTEST); */
+ xglHint (GL_FOG_HINT, GL_NICEST /* GL_FASTEST */ );
}
fgViewUpdate(f, v, l);
- /* Tell GL we are about to modify the projection parameters */
- xglMatrixMode(GL_PROJECTION);
- xglLoadIdentity();
- gluPerspective(55.0, 1.0/win_ratio, 1.0, 100000.0);
+ if (displayInstruments)
+ {
+ xglViewport(0, (GLint)(winHeight / 2 ) , (GLint)winWidth, (GLint)winHeight / 2);
+ /* Tell GL we are about to modify the projection parameters */
+ xglMatrixMode(GL_PROJECTION);
+ xglLoadIdentity();
+ gluPerspective(55.0, 2.0/win_ratio, 1.0, 100000.0);
+ }
+ else
+ {
+ xglViewport(0, 0 , (GLint)winWidth, (GLint) winHeight);
+ /* Tell GL we are about to modify the projection parameters */
+ xglMatrixMode(GL_PROJECTION);
+ xglLoadIdentity();
+ gluPerspective(55.0, 1.0/win_ratio, 1.0, 100000.0);
+ }
xglMatrixMode(GL_MODELVIEW);
xglLoadIdentity();
x_10 = x_8 * x_2;
light = pow(1.1, -x_10 / 30.0);
- ambient = 0.3 * light;
+ ambient = 0.2 * light;
diffuse = 0.9 * light;
sky_brightness = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15;
/* sky_brightness = 0.15; */ /* to force a dark sky (for testing) */
- if ( ambient < 0.1 ) { ambient = 0.1; }
+ if ( ambient < 0.02 ) { ambient = 0.02; }
if ( diffuse < 0.0 ) { diffuse = 0.0; }
if ( sky_brightness < 0.1 ) { sky_brightness = 0.1; }
}
+/*************************************************************************
+ * Draw a basic instrument panel
+ ************************************************************************/
+static void fgUpdateInstrViewParams() {
+ xglViewport(0, 0 , (GLint)winWidth, (GLint)winHeight / 2);
+
+ xglMatrixMode(GL_PROJECTION);
+ xglPushMatrix();
+
+ xglLoadIdentity();
+ gluOrtho2D(0, 640, 0, 480);
+ xglMatrixMode(GL_MODELVIEW);
+ xglPushMatrix();
+ xglLoadIdentity();
+
+ xglColor3f(1.0, 1.0, 1.0);
+ xglIndexi(7);
+
+ xglDisable(GL_DEPTH_TEST);
+ xglDisable(GL_LIGHTING);
+
+ xglLineWidth(1);
+ xglColor3f (0.5, 0.5, 0.5);
+
+ xglBegin(GL_QUADS);
+ xglVertex2f(0.0, 0.00);
+ xglVertex2f(0.0, 480.0);
+ xglVertex2f(640.0,480.0);
+ xglVertex2f(640.0, 0.0);
+ xglEnd();
+
+ xglRectf(0.0,0.0, 640, 480);
+ xglEnable(GL_DEPTH_TEST);
+ xglEnable(GL_LIGHTING);
+ xglMatrixMode(GL_PROJECTION);
+ xglPopMatrix();
+ xglMatrixMode(GL_MODELVIEW);
+ xglPopMatrix();
+}
+
+
/**************************************************************************
* Update all Visuals (redraws anything graphics related)
**************************************************************************/
xglPopMatrix();
/* draw scenery */
- xglShadeModel( GL_FLAT );
+ xglShadeModel( GL_SMOOTH );
xglEnable( GL_DEPTH_TEST );
xglEnable( GL_FOG );
xglFogfv (GL_FOG_COLOR, l->fog_color);
fgSceneryRender();
/* display HUD */
- /* if( show_hud )
- fgCockpitUpdate(); */
+ if( show_hud ) {
+ fgCockpitUpdate();
+ }
+
+ /* display instruments */
+ if (displayInstruments) {
+ fgUpdateInstrViewParams();
+ }
#ifdef GLUT
xglutSwapBuffers();
}
*/
+
/* What should we do when we have nothing else to do? How about get
* ready for the next move and update the display? */
static void fgMainLoop( void ) {
printf("Model iterations needed = %d, new remainder = %d\n", multi_loop,
remainder);
+ /* Run flight model */
if ( ! use_signals ) {
/* flight model */
fgUpdateTimeDepCalcs(multi_loop);
fgAircraftOutputCurrent(a);
+ /* Process/manage pending events */
+ fgEventProcess();
+
/* redraw display */
fgRenderFrame();
}
win_ratio = (GLfloat) height / (GLfloat) width;
}
- /* Inform gl of our view window size */
- xglViewport(0, 0, (GLint)width, (GLint)height);
+ winWidth = width;
+ winHeight = height;
+
+ /* Inform gl of our view window size (now handled elsewhere) */
+ /* xglViewport(0, 0, (GLint)width, (GLint)height); */
fgUpdateViewParams();
/* $Log$
-/* Revision 1.39 1997/12/22 23:45:45 curt
-/* First stab at sunset/sunrise sky glow effects.
+/* Revision 1.43 1997/12/30 20:47:43 curt
+/* Integrated new event manager with subsystem initializations.
/*
+ * Revision 1.42 1997/12/30 16:36:47 curt
+ * Merged in Durk's changes ...
+ *
+ * Revision 1.41 1997/12/30 13:06:56 curt
+ * A couple lighting tweaks ...
+ *
+ * Revision 1.40 1997/12/30 01:38:37 curt
+ * Switched back to per vertex normals and smooth shading for terrain.
+ *
+ * Revision 1.39 1997/12/22 23:45:45 curt
+ * First stab at sunset/sunrise sky glow effects.
+ *
* Revision 1.38 1997/12/22 04:14:28 curt
* Aligned sky with sun so dusk/dawn effects can be correct relative to the sun.
*