]> git.mxchange.org Git - flightgear.git/commitdiff
Updated from Norman to hack on clouds ... some progress.
authorcurt <curt>
Wed, 18 Sep 2002 14:57:20 +0000 (14:57 +0000)
committercurt <curt>
Wed, 18 Sep 2002 14:57:20 +0000 (14:57 +0000)
Makefile.am
src/Main/fg_init.cxx
src/Main/main.cxx
src/Objects/newmat.cxx
src/Objects/newmat.hxx

index 923d46dfb4b203b4dfdaff7d8f49d30e91c7208c..6d9e5310330a5b0ef4c52b1f2c365925ec707287 100644 (file)
@@ -98,7 +98,8 @@ fgfs-manual-zip:
 
 fgfs-win32-bin:
        (cd $(HOME); \
-       zip -r fgfs-win32-bin-$(VERSION).zip FlightGear/bin )
+       zip -r fgfs-win32-bin-$(VERSION).zip FlightGear/runfgfs.bat \
+        FlightGear/bin/Win32 )
 
 # make the win32-libs distribution (depricated)
 win32-libs:
index 0c174927a511c57c5c7daab6fe6e3e8d09c114b2..5138254cf46113310d6a188f4e7b8751b5a7da51 100644 (file)
@@ -645,6 +645,15 @@ void fgInitFDM() {
     }
 }
 
+static void printMat(const sgVec4 *mat, char *name="")
+{
+    int i;
+    cout << name << endl;
+    for(i=0; i<4; i++) {
+        cout <<"  "<<mat[i][0]<<" "<<mat[i][1]<<" "<<mat[i][2]<<" "<<mat[i][3]<<endl;
+    }
+    cout << endl;
+}
 
 // Initialize view parameters
 void fgInitView() {
@@ -652,6 +661,11 @@ void fgInitView() {
   globals->get_aircraft_model()->update(0);
   // run update for current view so that data is current...
   globals->get_viewmgr()->update(0);
+
+  printMat(globals->get_current_view()->get_VIEW(),"VIEW");
+  printMat(globals->get_current_view()->get_UP(),"UP");
+  // printMat(globals->get_current_view()->get_LOCAL(),"LOCAL");
+  
 }
 
 
@@ -896,16 +910,17 @@ bool fgInitSubsystems( void ) {
     ////////////////////////////////////////////////////////////////////
     // Initialize the 3D cloud subsystem.
     ////////////////////////////////////////////////////////////////////
-
     if ( fgGetBool("/sim/rendering/clouds3d") ) {
         SGPath cloud_path(globals->get_fg_root());
         cloud_path.append("large.sky");
+        SG_LOG(SG_GENERAL, SG_INFO, "Loading CLOUDS3d from: " << cloud_path.c_str());
         if ( !sgCloud3d->Load( cloud_path.str() ) ) {
             fgSetBool("/sim/rendering/clouds3d", false);
+            SG_LOG(SG_GENERAL, SG_INFO, "CLOUDS3d FAILED: ");
         }
+        SG_LOG(SG_GENERAL, SG_INFO, "CLOUDS3d Loaded: ");
     }
 
-
     ////////////////////////////////////////////////////////////////////
     // Initialize vor/ndb/ils/fix list management and query systems
     ////////////////////////////////////////////////////////////////////
index fc833ceecd336f5582f098b9a0228ef151b8e468..2cb4f1102c4a8e38a629703f7b2aa673ba510d08 100644 (file)
@@ -391,11 +391,6 @@ void trRenderFrame( void ) {
 
     globals->get_model_mgr()->draw();
     globals->get_aircraft_model()->draw();
-
-    // need to do this here as hud_and_panel state is static to
-    // main.cxx  and HUD and Panel routines have to be called with
-    // knowledge of the the TR struct < see gui.cxx::HighResDump()
-    hud_and_panel->apply();
 }
 
 
@@ -454,18 +449,6 @@ void fgRenderFrame() {
        // calculate our current position in cartesian space
        globals->get_scenery()->set_center( globals->get_scenery()->get_next_center() );
 
-       // do it here. at init time the clouds are loaded BEFORE our position is known
-       if ( fgGetBool("/sim/rendering/clouds3d") ) {
-            if ( _bcloud_orig ) {
-                // cloud center can be  anywhere in fgfs coordinates, but the tile
-                // cener is a good place as we'll have some  visible when starting
-                posit =  globals->get_scenery()->get_center();
-                sgClouds3d->Set_Cloud_Orig( _posit );
-                _bcloud_orig = false;
-            }
-            sgClouds3d->Update( current__view->get_absolute_view_pos() );
-        }
-               
        // update view port
        fgReshape( fgGetInt("/sim/startup/xsize"),
                   fgGetInt("/sim/startup/ysize") );
@@ -492,6 +475,15 @@ void fgRenderFrame() {
        }
        glClear( clear_mask );
 
+        if ( fgGetBool("/sim/rendering/clouds3d") ) {
+            posit =  globals->get_scenery()->get_center();
+            if ( _bcloud_orig ) {
+                sgClouds3d->Set_Cloud_Orig( _posit );
+                _bcloud_orig = false;
+            }
+            sgClouds3d->Update( current__view->get_absolute_view_pos() );
+        }
+
        // Tell GL we are switching to model view parameters
 
        // I really should create a derived ssg node or use a call
@@ -765,15 +757,6 @@ void fgRenderFrame() {
        globals->get_model_mgr()->draw();
        globals->get_aircraft_model()->draw();
 
-       // draw the 3D clouds   
-       if ( fgGetBool("/sim/rendering/clouds3d") ) {
-            //glPushAttrib(GL_ALL_ATTRIB_BITS);
-            // transform the current view matrix with camera offset position
-            sgClouds3d->Draw( (sgVec4 *)current__view->get_VIEW() );
-            //sgClouds3d->Draw();
-            //glPopAttrib();
-        }
-       
        // display HUD && Panel
        glDisable( GL_FOG );
        glDisable( GL_DEPTH_TEST );
@@ -804,7 +787,15 @@ void fgRenderFrame() {
        puDisplay();
        // glDisable ( GL_BLEND ) ;
 
-       // glEnable( GL_FOG );
+        if ( fgGetBool("/sim/rendering/clouds3d") ) {
+            // cout << "drawing new clouds" << endl;
+            // set the opengl state to known default values
+            // default_state->force();
+            sgClouds3d->Draw((sgVec4 *)current__view->get_VIEW());
+        }
+
+        glEnable( GL_DEPTH_TEST );
+        glEnable( GL_FOG );
 
        globals->get_logger()->update(delta_time_sec);
     }
index b02b717a5588bf82930c24ae00329847db120e69..afc392e1a16b310c870b57e9bc98642862d3aa6e 100644 (file)
@@ -318,6 +318,8 @@ FGNewMat::read_properties (const SGPropertyNode * props)
   emission[2] = props->getDoubleValue("emissive/b", 0.0);
   emission[3] = props->getDoubleValue("emissive/a", 0.0);
 
+  shininess = props->getDoubleValue("shininess", 0.0);
+
   vector<SGPropertyNode_ptr> object_group_nodes =
     ((SGPropertyNode *)props)->getChildren("object-group");
   for (unsigned int i = 0; i < object_group_nodes.size(); i++)
@@ -345,6 +347,7 @@ FGNewMat::init ()
   light_coverage = 0.0;
   texture_loaded = false;
   refcount = 0;
+  shininess = 0.0;
   for (int i = 0; i < 4; i++)
     ambient[i] = diffuse[i] = specular[i] = emission[i] = 0.0;
 }
@@ -416,10 +419,10 @@ FGNewMat::build_ssg_state (bool defer_tex_load)
     textured->setMaterial ( GL_SPECULAR,
                             specular[0], specular[1],
                             specular[2], specular[3] ) ;
-    textured->setShininess( 75.0 );
     textured->setMaterial ( GL_EMISSION,
                             emission[0], emission[1],
                             emission[2], emission[3] ) ;
+    textured->setShininess ( shininess );
 #endif
 
     // Set up the coloured state
@@ -443,6 +446,7 @@ FGNewMat::build_ssg_state (bool defer_tex_load)
     nontextured->setMaterial ( GL_EMISSION, 
                               emission[0], emission[1], 
                               emission[2], emission[3] ) ;
+    nontextured->setShininess ( shininess );
 
     state->setStep( 0, textured );    // textured
     state->setStep( 1, nontextured ); // untextured
@@ -489,6 +493,7 @@ void FGNewMat::set_ssg_state( ssgSimpleState *s )
     nontextured->setMaterial ( GL_EMISSION, 
                               emission[0], emission[1], 
                               emission[2], emission[3] ) ;
+    nontextured->setShininess ( shininess );
 
     state->setStep( 0, textured );    // textured
     state->setStep( 1, nontextured ); // untextured
index f02c6705530e5581299187d6238bf6f6175bc161..eac328576f7851077926287f830c8cc502b6e682 100644 (file)
@@ -381,6 +381,7 @@ private:
 
   // material properties
   sgVec4 ambient, diffuse, specular, emission;
+  double shininess;
 
   // true if texture loading deferred, and not yet loaded
   bool texture_loaded;