From: curt Date: Fri, 13 Sep 2002 20:38:15 +0000 (+0000) Subject: Stubbed in initial support for 3d clouds. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a4b3e35c0e902f7624cb546d4109f65cd15fe0c6;p=flightgear.git Stubbed in initial support for 3d clouds. --- diff --git a/src/Main/Makefile.am b/src/Main/Makefile.am index 085682d8f..1752e521d 100644 --- a/src/Main/Makefile.am +++ b/src/Main/Makefile.am @@ -69,7 +69,7 @@ fgfs_LDADD = \ $(top_builddir)/src/Time/libTime.a \ $(WEATHER_LIBS) \ $(top_builddir)/src/Input/libInput.a \ - -lsgroute -lsgsky -lsgephem -lsgtiming -lsgio -lsgscreen \ + -lsgroute -lsgsky -lsgclouds3d -lsgephem -lsgtiming -lsgio -lsgscreen \ -lsgmath -lsgbucket -lsgdebug -lsgmagvar -lsgmisc -lsgxml \ -lsgserial \ $(THREAD_LIBS) \ diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index e816adaa6..0b2a590bb 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -63,6 +63,8 @@ #include #include #include +#include +#include #include #include @@ -135,6 +137,7 @@ SG_USING_STD(string); extern const char *default_root; +SkySceneLoader *sgCloud3d; // Read in configuration (file and command line) and just set fg_root bool fgInitFGRoot ( int argc, char **argv ) { @@ -890,6 +893,19 @@ bool fgInitSubsystems( void ) { globals->get_environment_mgr()->bind(); #endif + //////////////////////////////////////////////////////////////////// + // Initialize the 3D cloud subsystem. + //////////////////////////////////////////////////////////////////// + + if ( fgGetBool("/sim/rendering/clouds3d") ) { + SGPath cloud_path(globals->get_fg_root()); + cloud_path.append("large.sky"); + if ( !sgCloud3d->Load( cloud_path.str() ) ) { + fgSetBool("/sim/rendering/clouds3d", false); + } + } + + //////////////////////////////////////////////////////////////////// // Initialize vor/ndb/ils/fix list management and query systems //////////////////////////////////////////////////////////////////// diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 9114a36f6..4ccfc0a49 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -80,6 +80,8 @@ SG_USING_STD(endl); #include #include #include +#include +#include #include #include @@ -207,6 +209,10 @@ ssgTransform *fgd_pos = NULL; // Sky structures SGSky *thesky; +SkySceneLoader *sgClouds3d; +bool _bcloud_orig = true; +Point3D posit; +Point3D *_posit = &posit; // hack sgMat4 copy_of_ssgOpenGLAxisSwapMatrix = @@ -356,7 +362,7 @@ void trRenderFrame( void ) { // a completely dark scene. So, we set GL_LIGHT_MODEL_AMBIENT // explicitely to black. glLightModelfv( GL_LIGHT_MODEL_AMBIENT, black ); - // glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE ); + glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE ); ssgGetLight( 0 ) -> setColour( GL_AMBIENT, l->scene_ambient ); @@ -448,6 +454,17 @@ void fgRenderFrame() { // calculate our current position in cartesian space globals->get_scenery()->set_center( globals->get_scenery()->get_next_center() ); + if ( fgGetBool("/sim/rendering/clouds3d") ) { + posit = globals->get_scenery()->get_center(); + if ( _bcloud_orig ) { + sgClouds3d->Set_Cloud_Orig( _posit ); + _bcloud_orig = false; + } + /* sgClouds3d->Update( (sgVec4 *)current__view->get_cloud_VIEW(), + _posit ); + */ + } + // update view port fgReshape( fgGetInt("/sim/startup/xsize"), fgGetInt("/sim/startup/ysize") ); @@ -738,13 +755,18 @@ void fgRenderFrame() { if ( fgGetBool("/sim/rendering/skyblend") ) { // draw the sky cloud layers - if (fgGetBool("/environment/clouds/status")) - thesky->postDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER ); + if (fgGetBool("/environment/clouds/status")) { + thesky->postDraw( cur_fdm_state->get_Altitude() + * SG_FEET_TO_METER ); + } } globals->get_model_mgr()->draw(); globals->get_aircraft_model()->draw(); + // draw the 3D clouds + if ( fgGetBool("/sim/rendering/clouds3d") ) sgClouds3d->Draw(); + // display HUD && Panel glDisable( GL_FOG ); glDisable( GL_DEPTH_TEST ); @@ -1296,6 +1318,8 @@ void fgReshape( int width, int height ) { viewmgr->get_current_view()->get_v_fov() ); fgHUDReshape(); + sgClouds3d->Resize( viewmgr->get_current_view()->get_h_fov(), + viewmgr->get_current_view()->get_v_fov() ); } // Initialize GLUT and define a main window @@ -1308,7 +1332,7 @@ int fgGlutInit( int *argc, char **argv ) { #endif // Define Display Parameters - glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); + glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_ALPHA); SG_LOG( SG_GENERAL, SG_INFO, "Opening a window: " << fgGetInt("/sim/startup/xsize") << "x"