]> git.mxchange.org Git - flightgear.git/commitdiff
Working on separating out ephemeris code from the actual rendering code
authorcurt <curt>
Thu, 2 Mar 2000 13:51:31 +0000 (13:51 +0000)
committercurt <curt>
Thu, 2 Mar 2000 13:51:31 +0000 (13:51 +0000)
which I am trying to ssg-ify at the same time.

src/Main/Makefile.am
src/Main/fg_init.cxx
src/Main/keyboard.cxx
src/Main/main.cxx

index 2e10ed8b3f074c0d0ca71cd6df04629ada80fb5d..560e580b1d5874afffbe95fa577b5d611dc1522f 100644 (file)
@@ -62,6 +62,7 @@ fgfs_LDADD = \
        $(top_builddir)/src/Clouds/libClouds.a \
        $(top_builddir)/src/Time/libTime.a \
        $(WEATHER_LIBS) \
+       $(top_builddir)/src/Sky/libSky.a \
        $(top_builddir)/src/Joystick/libJoystick.a \
        $(SERIAL_LIBS) \
        -lsgscreen -lsgmath -lsgbucket -lsgdebug -lsgmisc \
index d2329af9d866dc69d545bd3b8abc220d70a5a9c3..78dac6cd92ffbc8d6e80e9e8550e01d16d15ec74 100644 (file)
@@ -70,7 +70,6 @@
 #include <Joystick/joystick.hxx>
 #include <Scenery/scenery.hxx>
 #include <Scenery/tilemgr.hxx>
-#include <Sky/skydome.hxx>
 #include <Time/event.hxx>
 #include <Time/fg_time.hxx>
 #include <Time/light.hxx>
index cfbab6e8e46a92a87eb01811c28e9598a3e79010..90efdb5fd7ce9a743c1a2fafe9e6aa88af82d597 100644 (file)
@@ -47,7 +47,6 @@
 
 #include <Aircraft/aircraft.hxx>
 #include <Astro/solarsystem.hxx>
-// #include <Astro/skydome.hxx>
 #include <Autopilot/autopilot.hxx>
 #include <Cockpit/hud.hxx>
 #include <GUI/gui.h>
@@ -75,9 +74,6 @@ static void local_update_sky_and_lighting_params( void ) {
     // fgSunInit();
     SolarSystem::theSolarSystem->rebuild();
     cur_light_params.Update();
-    /* current_sky.repaint( cur_light_params.sky_color,
-                        cur_light_params.fog_color,
-                        cur_light_params.sun_angle ); */
 }
 
 
index 3bf58b5f611ddbc14077467f8d3220c203957d81..16371bfb06dbf710f1fc268f09aab303907952b5 100644 (file)
@@ -74,6 +74,7 @@
 #include <Include/general.hxx>
 
 #include <Aircraft/aircraft.hxx>
+#include <Astro/ephemeris.hxx>
 #include <Astro/stars.hxx>
 #include <Astro/solarsystem.hxx>
 
@@ -88,7 +89,7 @@
 #include <Scenery/scenery.hxx>
 #include <Scenery/tilemgr.hxx>
 #include <Sky/skydome.hxx>
-#include <Sky/sphere.hxx>
+#include <Sky/skysun.hxx>
 #include <Time/event.hxx>
 #include <Time/fg_time.hxx>
 #include <Time/fg_timer.hxx>
@@ -155,6 +156,11 @@ ssgTransform *fgd_pos = NULL;
 // current fdm/position used for view
 FGInterface cur_view_fdm;
 
+// Sky structures
+FGEphemeris ephem;
+FGSkyDome current_sky;
+FGSkySun current_sun;
+
 // hack
 sgMat4 copy_of_ssgOpenGLAxisSwapMatrix =
 {
@@ -345,24 +351,11 @@ void fgRenderFrame( void ) {
        // set the opengl state to known default values
        default_state->force();
 
-       // draw sky
        xglDisable( GL_DEPTH_TEST );
        xglDisable( GL_FOG );
-       // xglDisable( GL_TEXTURE_2D );
-       // xglDisable( GL_LIGHTING );
-       // xglDisable( GL_CULL_FACE );
-       // xglShadeModel( GL_SMOOTH );
-
-       /* if ( current_options.get_fog() > 0 ) {
-           xglEnable( GL_FOG );
-           xglFogi( GL_FOG_MODE, GL_EXP2 );
-           xglFogfv( GL_FOG_COLOR, l->adj_fog_color );
-       } */
-
 
+       // draw sky dome
        if ( current_options.get_skyblend() ) {
-           // fgSkyRender();
-
            sgVec3 zero_elev;
            sgSetVec3( zero_elev,
                       current_view.get_cur_zero_elev().x(),
@@ -378,13 +371,17 @@ void fgRenderFrame( void ) {
                                    cur_fdm_state->get_Latitude(),
                                    cur_light_params.sun_rotation );
 
-           xglPushMatrix();
-
            current_sky.draw();
-
-           xglPopMatrix();
        }
 
+       // draw the sun
+       current_sun.repaint( cur_light_params.sun_angle );
+       cout << "ra = " << ephem.getSunRightAscension() << " dec = " 
+            << ephem.getSunDeclination() << endl;
+       current_sun.reposition( ephem.getSunRightAscension(),
+                               ephem.getSunDeclination() );
+       current_sun.draw();
+
        // xglDisable( GL_FOG );
 
        /* 
@@ -612,7 +609,7 @@ void fgRenderFrame( void ) {
        }
 # endif
 
-       ssgSetCamera( current_view.VIEW );
+       // ssgSetCamera( current_view.VIEW );
 
        // position tile nodes and update range selectors
        global_tile_mgr.prep_ssg_nodes();
@@ -741,6 +738,9 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
           FG_Psi * RAD_TO_DEG, current_view.view_offset * RAD_TO_DEG, 
           -(l->sun_rotation+FG_PI) * RAD_TO_DEG, tmp * RAD_TO_DEG); */
     l->UpdateAdjFog();
+
+    // Update solar system
+    ephem.update( t );
 }
 
 
@@ -1359,12 +1359,13 @@ int main( int argc, char **argv ) {
 
     // Initialize the sky
     current_sky.initialize();
+    current_sun.initialize();
 
     // temporary visible aircraft "own ship"
     penguin_sel = new ssgSelector;
     penguin_pos = new ssgTransform;
-    ssgBranch *tux_obj = ssgMakeSphere( 10.0, 10, 10 );
-    // ssgEntity *tux_obj = ssgLoadAC( "glider.ac" );
+    // ssgBranch *tux_obj = ssgMakeSphere( 10.0, 10, 10 );
+    ssgEntity *tux_obj = ssgLoadAC( "glider.ac" );
     // ssgEntity *tux_obj = ssgLoadAC( "Tower1x.ac" );
 
     penguin_pos->addKid( tux_obj );