]> git.mxchange.org Git - flightgear.git/commitdiff
Stubbed in initial support for 3d clouds.
authorcurt <curt>
Fri, 13 Sep 2002 20:38:15 +0000 (20:38 +0000)
committercurt <curt>
Fri, 13 Sep 2002 20:38:15 +0000 (20:38 +0000)
src/Main/Makefile.am
src/Main/fg_init.cxx
src/Main/main.cxx

index 085682d8f099f0b4e1770198bf661b8398ca3538..1752e521dafc81ed32eeeea3746024af1b16845f 100644 (file)
@@ -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) \
index e816adaa6b3d397d91e0b31956c2867b6d8be594..0b2a590bba0c8c8bc8c2b17aa526daddd815609b 100644 (file)
@@ -63,6 +63,8 @@
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/sky/SkySceneLoader.hpp>
+#include <simgear/sky/SkyUtil.hpp>
 #include <simgear/timing/sg_time.hxx>
 #include <simgear/timing/lowleveltime.h>
 
@@ -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
     ////////////////////////////////////////////////////////////////////
index 9114a36f64503de10e01423f9c07857f8f225ffd..4ccfc0a49549292190645b5ed79ddc1b58e2d538 100644 (file)
@@ -80,6 +80,8 @@ SG_USING_STD(endl);
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_random.h>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/sky/SkySceneLoader.hpp>
+#include <simgear/sky/SkyUtil.hpp>
 #include <simgear/sky/sky.hxx>
 #include <simgear/timing/sg_time.hxx>
 
@@ -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"