]> git.mxchange.org Git - flightgear.git/commitdiff
Continuing work on ssg-ifying the sky dome.
authorcurt <curt>
Tue, 29 Feb 2000 17:13:02 +0000 (17:13 +0000)
committercurt <curt>
Tue, 29 Feb 2000 17:13:02 +0000 (17:13 +0000)
src/Main/fg_init.cxx
src/Main/keyboard.cxx
src/Main/main.cxx
src/Main/options.cxx
src/Time/fg_time.cxx

index ebe0a5f8d8b91d7727283f96590a502f9e590565..75ddf1feb0f68b221734ddcede7b86b711b2af89 100644 (file)
@@ -472,9 +472,6 @@ bool fgInitSubsystems( void ) {
        exit(-1);
     }
 
-    // Initialize the "sky"
-    fgSkyInit();
-
     // Initialize the flight model subsystem data structures base on
     // above values
 
index dcf0a7057691bdce2bfc814e10f6613c87bbaee3..ce58ec8a931ede767bf9d1559aca70d3688d0e33 100644 (file)
@@ -75,7 +75,9 @@ static void local_update_sky_and_lighting_params( void ) {
     // fgSunInit();
     SolarSystem::theSolarSystem->rebuild();
     cur_light_params.Update();
-    fgSkyColorsInit();
+    current_sky.repaint( cur_light_params.sky_color,
+                        cur_light_params.fog_color,
+                        cur_light_params.sun_angle );
 }
 
 
index e97c4d3767f117eaded55db8edfde23744109a72..d3ab52c9914ac1a37ba41b3b8b6606f471333648 100644 (file)
@@ -145,6 +145,10 @@ ssgBranch *terrain = NULL;
 ssgSelector *penguin_sel = NULL;
 ssgTransform *penguin_pos = NULL;
 
+// the sky needs to be drawn in a specific order, thus we use several
+// "roots" so we can explicitely control this.
+ssgRoot *sky = NULL;
+
 #ifdef FG_NETWORK_OLK
 ssgSelector *fgd_sel = NULL;
 ssgTransform *fgd_pos = NULL;
@@ -325,9 +329,25 @@ void fgRenderFrame( void ) {
        } */
 
        xglShadeModel( GL_SMOOTH );
-       if ( current_options.get_skyblend() ) {
-           fgSkyRender();
-       }
+
+       // if ( current_options.get_skyblend() ) {
+       //    fgSkyRender();
+       // }
+       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() );
+
+       current_sky.reposition( zero_elev, 
+                               cur_fdm_state->get_Longitude(),
+                               cur_fdm_state->get_Latitude(),
+                               cur_light_params.sun_rotation );
+
+       xglPushMatrix();
+       ssgSetCamera( current_view.VIEW );
+       ssgCullAndDraw( sky );
+       xglPopMatrix();
 
        // xglDisable( GL_FOG );
 
@@ -1306,12 +1326,24 @@ int main( int argc, char **argv ) {
     ssgModelPath( (char *)modelpath.c_str() );
     ssgTexturePath( (char *)texturepath.c_str() );
 
+    // Scene graph root
     scene = new ssgRoot;
+    scene->setName( "Scene" );
+
+    // Terrain branch
     terrain = new ssgBranch;
     terrain->setName( "Terrain" );
+    scene->addKid( terrain );
+
+    // Sky branch
+    sky = new ssgRoot;
+    sky->setName( "Sky" );
+    current_sky.initialize( sky );
+    scene->addKid( sky );
+
+    // temporary visible aircraft "own ship"
     penguin_sel = new ssgSelector;
     penguin_pos = new ssgTransform;
-
     ssgEntity *tux_obj = ssgLoadAC( "glider.ac" );
     // ssgEntity *tux_obj = ssgLoadAC( "Tower1x.ac" );
     penguin_pos->addKid( tux_obj );
@@ -1319,6 +1351,7 @@ int main( int argc, char **argv ) {
     ssgFlatten( tux_obj );
     ssgStripify( penguin_sel );
     penguin_sel->clrTraversalMaskBits( SSGTRAV_HOT );
+    scene->addKid( penguin_sel );
 
 #ifdef FG_NETWORK_OLK
     // Do the network intialization
@@ -1327,9 +1360,6 @@ int main( int argc, char **argv ) {
     }
 #endif
 
-    scene->addKid( terrain );
-    scene->addKid( penguin_sel );
-
     // pass control off to the master GLUT event handler
     glutMainLoop();
 
index 57a9fa2571fb0ded99dcd60c2df1b058999df6b2..9ff8a8e9dcb734008a388b600df60f7ff6888d54 100644 (file)
@@ -82,6 +82,7 @@ atoi( const string& str )
 #endif
 }
 
+
 // Defined the shared options class here
 fgOPTIONS current_options;
 
index eebf7b6b37a3d799a1ca314a55b5401e79bd4d40..ccb60e58b8c0739e8d8df7b056cf663fc45e0da4 100644 (file)
@@ -534,7 +534,9 @@ void FGTime::local_update_sky_and_lighting_params( void ) {
     // fgSunInit();
     SolarSystem::theSolarSystem->rebuild();
     cur_light_params.Update();
-    fgSkyColorsInit();
+    current_sky.repaint( cur_light_params.sky_color,
+                        cur_light_params.fog_color,
+                        cur_light_params.sun_angle );
 }