]> git.mxchange.org Git - flightgear.git/commitdiff
Working on scene rendering order and options.
authorcurt <curt>
Fri, 19 Dec 1997 16:44:57 +0000 (16:44 +0000)
committercurt <curt>
Fri, 19 Dec 1997 16:44:57 +0000 (16:44 +0000)
Cockpit/depend
Main/GLUTmain.c
Main/depend
Main/fg_init.c
Scenery/Makefile
Scenery/astro.c
Scenery/depend
Scenery/moon.c
Scenery/sky.c
Time/depend

index 1e0cb8cc7878d93aeeec6dfebaf8a3a39f0f799a..d5e9f450e0fe3204cf619b2e7820b456b47a56a0 100644 (file)
@@ -18,13 +18,3 @@ hud.o: hud.c hud.h ../Aircraft/aircraft.h \
  ../Scenery/scenery.h ../Scenery/../Include/types.h ../Math/mat3.h \
  ../Math/polar.h ../Math/../Include/types.h ../Time/fg_timer.h \
  ../Math/fg_random.h ../Weather/weather.h
-test.o: test.c test.h ../Aircraft/aircraft.h \
- ../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
- ../Aircraft/../Flight/LaRCsim/ls_interface.h \
- ../Aircraft/../Flight/LaRCsim/../flight.h \
- ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../Include/limits.h ../Flight/flight.h \
- ../Controls/controls.h ../Include/constants.h ../Scenery/mesh.h \
- ../Scenery/scenery.h ../Scenery/../Include/types.h ../Math/mat3.h \
- ../Math/polar.h ../Math/../Include/types.h ../Time/fg_timer.h \
- ../Math/fg_random.h ../Weather/weather.h
index 49a121b632bc8eec7ccd54b4511b35665e2508bb..6556ca98352ec8328be14dd20fcc484d11bcea5d 100644 (file)
 #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/fg_time.h"
 #include "../Time/fg_timer.h"
 #include "../Time/sunpos.h"
@@ -89,9 +92,6 @@ static void fgInitVisuals() {
     t = &cur_time_params;
     w = &current_weather;
 
-    xglEnable( GL_DEPTH_TEST );
-    /* xglFrontFace(GL_CW); */
-    xglEnable( GL_CULL_FACE );
     
     /* xglDisable( GL_DITHER ); */
 
@@ -218,22 +218,64 @@ static void fgUpdateViewParams() {
  **************************************************************************/
 
 static void fgUpdateVisuals( void ) {
+    struct fgTIME *t;
+    struct fgVIEW *v;
+    double angle;
+    static double lastAstroUpdate = 0;
+
+    t = &cur_time_params;
+    v = &current_view;
+
     /* update view volume parameters */
     fgUpdateViewParams();
 
-    xglClear( /* GL_COLOR_BUFFER_BIT | */ GL_DEPTH_BUFFER_BIT );
+    xglClear( GL_DEPTH_BUFFER_BIT /* | GL_COLOR_BUFFER_BIT */ );
 
     /* Tell GL we are switching to model view parameters */
     xglMatrixMode(GL_MODELVIEW);
     /* xglLoadIdentity(); */
 
     /* draw sky */
+    xglDisable( GL_DEPTH_TEST );
+    xglDisable( GL_LIGHTING );
+    xglDisable( GL_CULL_FACE );
+    xglShadeModel( GL_SMOOTH );
     fgSkyRender();
 
-    /* draw astronomical objects */
-    /* fgAstroRender(); */
-    
+    /* a hack: Force sun and moon position to be updated on an hourly basis */
+    if (((t->gst - lastAstroUpdate) > 1) || (t->gst < lastAstroUpdate)) {
+       lastAstroUpdate = t->gst;
+       fgSunInit();
+       fgMoonInit();
+    }
+
+    /* setup transformation for drawing astronomical objects */
+    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) */
+    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 */
+    xglDisable( GL_FOG );
+    fgStarsRender();
+
+    /* draw the sun */
+    fgSunRender();
+
+    /* render the moon */
+    xglEnable( GL_LIGHTING );
+    xglEnable( GL_CULL_FACE );
+    fgMoonRender();
+
+    xglPopMatrix();
+
     /* draw scenery */
+    xglShadeModel( GL_FLAT ); 
+    xglEnable( GL_DEPTH_TEST );
+    xglEnable( GL_FOG );
     fgSceneryRender();
 
     /* display HUD */
@@ -569,9 +611,12 @@ int main( int argc, char *argv[] ) {
 
 
 /* $Log$
-/* Revision 1.35  1997/12/18 23:32:32  curt
-/* First stab at sky dome actually starting to look reasonable. :-)
+/* Revision 1.36  1997/12/19 16:44:57  curt
+/* Working on scene rendering order and options.
 /*
+ * Revision 1.35  1997/12/18 23:32:32  curt
+ * First stab at sky dome actually starting to look reasonable. :-)
+ *
  * Revision 1.34  1997/12/17 23:13:34  curt
  * Began working on rendering a sky.
  *
index 0fac299af1f1f4eaa2228a41661814b1334ca72d..01b1374e7d94ff416ee08d53cd2ad246d40343e0 100644 (file)
@@ -1,11 +1,11 @@
-GLUTkey.o: GLUTkey.c GLUTkey.h views.h ../Include/types.h \
+GLUTkey.o: GLUTkey.c ../XGL/xgl.h GLUTkey.h views.h ../Include/types.h \
  ../Flight/flight.h ../Flight/Slew/slew.h \
  ../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
  ../Math/mat3.h ../Include/constants.h ../Aircraft/aircraft.h \
  ../Aircraft/../Flight/flight.h ../Aircraft/../Controls/controls.h \
  ../Aircraft/../Controls/../Include/limits.h ../Weather/weather.h
-GLUTmain.o: GLUTmain.c GLUTkey.h fg_init.h views.h ../Include/types.h \
- ../Flight/flight.h ../Flight/Slew/slew.h \
+GLUTmain.o: GLUTmain.c ../XGL/xgl.h GLUTkey.h fg_init.h views.h \
+ ../Include/types.h ../Flight/flight.h ../Flight/Slew/slew.h \
  ../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
  ../Math/mat3.h ../Include/constants.h ../Include/general.h \
  ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
@@ -14,10 +14,13 @@ GLUTmain.o: GLUTmain.c GLUTkey.h fg_init.h views.h ../Include/types.h \
  ../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
  ../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
  ../Joystick/joystick.h ../Math/fg_geodesy.h ../Math/polar.h \
- ../Math/../Include/types.h ../Scenery/mesh.h ../Scenery/scenery.h \
- ../Scenery/../Include/types.h ../Time/fg_time.h \
- ../Time/../Include/types.h ../Time/../Flight/flight.h \
- ../Time/fg_timer.h ../Time/sunpos.h ../Weather/weather.h
+ ../Math/../Include/types.h ../Scenery/mesh.h ../Scenery/moon.h \
+ ../Scenery/orbits.h ../Scenery/../Time/fg_time.h \
+ ../Scenery/../Time/../Include/types.h \
+ ../Scenery/../Time/../Flight/flight.h ../Scenery/scenery.h \
+ ../Scenery/../Include/types.h ../Scenery/sky.h ../Scenery/stars.h \
+ ../Scenery/sun.h ../Time/fg_time.h ../Time/fg_timer.h \
+ ../Time/sunpos.h ../Time/../Include/types.h ../Weather/weather.h
 fg_init.o: fg_init.c fg_init.h views.h ../Include/types.h \
  ../Flight/flight.h ../Flight/Slew/slew.h \
  ../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
@@ -28,10 +31,12 @@ fg_init.o: fg_init.c fg_init.h views.h ../Include/types.h \
  ../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
  ../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
  ../Joystick/joystick.h ../Math/fg_random.h ../Scenery/mesh.h \
- ../Scenery/astro.h ../Scenery/stars.h ../Scenery/scenery.h \
- ../Scenery/../Include/types.h ../Time/fg_time.h \
- ../Time/../Include/types.h ../Time/../Flight/flight.h \
- ../Time/sunpos.h ../Weather/weather.h
+ ../Scenery/moon.h ../Scenery/orbits.h ../Scenery/../Time/fg_time.h \
+ ../Scenery/../Time/../Include/types.h \
+ ../Scenery/../Time/../Flight/flight.h ../Scenery/scenery.h \
+ ../Scenery/../Include/types.h ../Scenery/sky.h ../Scenery/stars.h \
+ ../Scenery/sun.h ../Time/fg_time.h ../Time/sunpos.h \
+ ../Time/../Include/types.h ../Weather/weather.h
 views.o: views.c views.h ../Include/types.h ../Flight/flight.h \
  ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
  ../Flight/LaRCsim/../flight.h ../Math/mat3.h ../Include/constants.h \
index 3883337844234ff0e6fd451a703d02d5ce069321..d7e9991c48fc6325db6268749fadfd3ca8c905f8 100644 (file)
 #include "../Joystick/joystick.h"
 #include "../Math/fg_random.h"
 #include "../Scenery/mesh.h"
-#include "../Scenery/astro.h"
+#include "../Scenery/moon.h"
 #include "../Scenery/scenery.h"
 #include "../Scenery/sky.h"
+#include "../Scenery/stars.h"
+#include "../Scenery/sun.h"
 #include "../Time/fg_time.h"
 #include "../Time/sunpos.h"
 #include "../Weather/weather.h"
@@ -179,8 +181,17 @@ void fgInitSubsystems( void ) {
     }
     */
 
-    /* Initialize Astronomical Objects */
-    fgAstroInit();
+    /* Initialize the orbital elements of sun, moon and mayor planets */
+    fgSolarSystemInit(*t);
+
+    /* Initialize the Stars subsystem */
+    fgStarsInit();             
+
+    /* Initialize the sun's position */
+    fgSunInit();       
+
+    /* Intialize the moon's position */
+    fgMoonInit(); 
 
     /* Initialize the "sky" */
     fgSkyInit();
@@ -224,9 +235,12 @@ void fgInitSubsystems( void ) {
 
 
 /* $Log$
-/* Revision 1.20  1997/12/18 23:32:33  curt
-/* First stab at sky dome actually starting to look reasonable. :-)
+/* Revision 1.21  1997/12/19 16:45:00  curt
+/* Working on scene rendering order and options.
 /*
+ * Revision 1.20  1997/12/18 23:32:33  curt
+ * First stab at sky dome actually starting to look reasonable. :-)
+ *
  * Revision 1.19  1997/12/17 23:13:36  curt
  * Began working on rendering a sky.
  *
index a74585110fa485ce84fd96072533bd2677298986..2977fee0a0c7b4fee6f9e9ae82a9b9f7fe43506a 100644 (file)
@@ -26,7 +26,7 @@
 
 TARGET = libScenery.a
 
-CFILES = astro.c common.c geometry.c mesh.c moon.c obj.c orbits.c planets.c \
+CFILES = common.c geometry.c mesh.c moon.c obj.c orbits.c planets.c \
        scenery.c sky.c stars.c sun.c
 
 OFILES = $(CFILES:.c=.o)
@@ -99,6 +99,9 @@ geometry.o:
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.26  1997/12/19 16:45:01  curt
+# Working on scene rendering order and options.
+#
 # Revision 1.25  1997/12/17 23:13:45  curt
 # Began working on rendering the sky.
 #
index 4e1558e748eaf5e5eb579e819b2685d1f3b73a41..d49af70101857c28646b4fdd871a9a14ddd0631d 100644 (file)
@@ -87,9 +87,6 @@ void fgAstroRender() {
        fgMoonInit();
     }
 
-    /* Disable fog effects */
-    xglDisable( GL_FOG );
-
     /* set the sun position */
     /* xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec_inv ); */
 
@@ -115,16 +112,16 @@ void fgAstroRender() {
     fgSunRender();
 
     xglPopMatrix();
-
-    /* reenable fog effects */
-    xglEnable( GL_FOG );
 }
 
 
 /* $Log$
-/* Revision 1.9  1997/12/18 23:32:35  curt
-/* First stab at sky dome actually starting to look reasonable. :-)
+/* Revision 1.10  1997/12/19 16:45:01  curt
+/* Working on scene rendering order and options.
 /*
+ * Revision 1.9  1997/12/18 23:32:35  curt
+ * First stab at sky dome actually starting to look reasonable. :-)
+ *
  * Revision 1.8  1997/12/15 23:54:57  curt
  * Add xgl wrappers for debugging.
  * Generate terrain normals on the fly.
index 86a0234756414375341dd291abf15e9044fa52a6..5c3cceec6ac2eac0481c946fb67bc774d0a3fdf6 100644 (file)
@@ -1,6 +1,6 @@
-astro.o: astro.c astro.h stars.h moon.h orbits.h ../Time/fg_time.h \
- ../Time/../Include/types.h ../Time/../Flight/flight.h \
- ../Time/../Flight/Slew/slew.h \
+astro.o: astro.c ../XGL/xgl.h astro.h stars.h moon.h orbits.h \
+ ../Time/fg_time.h ../Time/../Include/types.h \
+ ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
  ../Time/../Flight/LaRCsim/../flight.h planets.h sun.h \
  ../Include/constants.h ../Include/general.h ../Main/views.h \
@@ -13,13 +13,15 @@ geometry.o: geometry.c geometry.h mesh.h
 mesh.o: mesh.c ../Include/constants.h ../Include/types.h \
  ../Math/fg_geodesy.h ../Math/fg_random.h ../Math/mat3.h \
  ../Math/polar.h ../Math/../Include/types.h mesh.h common.h scenery.h
-moon.o: moon.c orbits.h ../Time/fg_time.h ../Time/../Include/types.h \
- ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
+moon.o: moon.c ../XGL/xgl.h orbits.h ../Time/fg_time.h \
+ ../Time/../Include/types.h ../Time/../Flight/flight.h \
+ ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
  ../Time/../Flight/LaRCsim/../flight.h moon.h ../Include/general.h \
  ../Main/views.h ../Main/../Include/types.h ../Main/../Flight/flight.h \
  ../Main/../Math/mat3.h
-obj.o: obj.c obj.h scenery.h ../Include/types.h ../Math/mat3.h
+obj.o: obj.c ../XGL/xgl.h obj.h scenery.h ../Include/types.h \
+ ../Math/mat3.h
 orbits.o: orbits.c orbits.h ../Time/fg_time.h \
  ../Time/../Include/types.h ../Time/../Flight/flight.h \
  ../Time/../Flight/Slew/slew.h \
@@ -29,10 +31,20 @@ planets.o: planets.c ../Time/fg_time.h ../Time/../Include/types.h \
  ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
  ../Time/../Flight/LaRCsim/../flight.h orbits.h planets.h sun.h
-scenery.o: scenery.c ../Include/general.h astro.h stars.h obj.h \
- scenery.h ../Include/types.h
-stars.o: stars.c orbits.h ../Time/fg_time.h ../Time/../Include/types.h \
- ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
+scenery.o: scenery.c ../XGL/xgl.h ../Include/general.h astro.h stars.h \
+ obj.h scenery.h ../Include/types.h
+sky.o: sky.c ../XGL/xgl.h sky.h ../Time/fg_time.h \
+ ../Time/../Include/types.h ../Time/../Flight/flight.h \
+ ../Time/../Flight/Slew/slew.h \
+ ../Time/../Flight/LaRCsim/ls_interface.h \
+ ../Time/../Flight/LaRCsim/../flight.h ../Aircraft/aircraft.h \
+ ../Aircraft/../Flight/flight.h ../Aircraft/../Controls/controls.h \
+ ../Aircraft/../Controls/../Include/limits.h ../Flight/flight.h \
+ ../Include/constants.h ../Main/views.h ../Main/../Include/types.h \
+ ../Main/../Flight/flight.h ../Main/../Math/mat3.h ../Math/fg_random.h
+stars.o: stars.c ../XGL/xgl.h orbits.h ../Time/fg_time.h \
+ ../Time/../Include/types.h ../Time/../Flight/flight.h \
+ ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
  ../Time/../Flight/LaRCsim/../flight.h planets.h stars.h \
  ../Include/constants.h ../Include/general.h ../Aircraft/aircraft.h \
@@ -40,7 +52,7 @@ stars.o: stars.c orbits.h ../Time/fg_time.h ../Time/../Include/types.h \
  ../Aircraft/../Controls/../Include/limits.h ../Main/views.h \
  ../Main/../Include/types.h ../Main/../Flight/flight.h \
  ../Main/../Math/mat3.h
-sun.o: sun.c ../Time/fg_time.h ../Time/../Include/types.h \
+sun.o: sun.c ../XGL/xgl.h ../Time/fg_time.h ../Time/../Include/types.h \
  ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
  ../Time/../Flight/LaRCsim/../flight.h ../Main/views.h \
index 203d70bf265c78f9458447e487eff46629919fbc..17446e300ff10e2f0a259ce1121c0bacf5ec342a 100644 (file)
@@ -258,7 +258,7 @@ void fgMoonInit() {
            cos(moonPos.Declination);
        zMoon = 60000.0 * sin(moonPos.Declination);
 
-       glutSolidSphere(1.0, 15, 15);
+       glutSolidSphere(1.0, 10, 10);
 
        xglEndList();
     }
index ef81c8b53e6f5299836314d059eda14aad24dd29..dc26283791842c5b79e54d2d0b359002b1b0055a 100644 (file)
@@ -107,10 +107,6 @@ void fgSkyRender() {
 
     printf("Rendering the sky.\n");
 
-    xglDisable( GL_LIGHTING );
-    xglDisable( GL_CULL_FACE );
-    xglShadeModel( GL_SMOOTH );
-
     xglPushMatrix();
 
     /* Translate to view position */
@@ -159,17 +155,16 @@ void fgSkyRender() {
     xglEnd();
 
     xglPopMatrix();
-
-    xglShadeModel( GL_FLAT ); 
-    xglEnable( GL_CULL_FACE );
-    xglEnable( GL_LIGHTING );
 }
 
 
 /* $Log$
-/* Revision 1.3  1997/12/18 23:32:36  curt
-/* First stab at sky dome actually starting to look reasonable. :-)
+/* Revision 1.4  1997/12/19 16:45:02  curt
+/* Working on scene rendering order and options.
 /*
+ * Revision 1.3  1997/12/18 23:32:36  curt
+ * First stab at sky dome actually starting to look reasonable. :-)
+ *
  * Revision 1.2  1997/12/18 04:07:03  curt
  * Worked on properly translating and positioning the sky dome.
  *
index 8eb45bb2243fdc769e490a20a7f3ac5dfc36b452..20661a2b4f490bf8821b8ee0a223f93c47bd9c69 100644 (file)
@@ -3,7 +3,7 @@ fg_time.o: fg_time.c fg_time.h ../Include/types.h ../Flight/flight.h \
  ../Flight/LaRCsim/../flight.h ../Include/constants.h \
  ../Time/fg_time.h
 fg_timer.o: fg_timer.c fg_timer.h
-sidereal.o: sidereal.c ../Include/constants.h
+sptest.o: sptest.c sunpos.h ../Include/types.h ../Include/constants.h
 sunpos.o: sunpos.c sunpos.h ../Include/types.h fg_time.h \
  ../Flight/flight.h ../Flight/Slew/slew.h \
  ../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \