From: curt Date: Sun, 20 Jan 2002 03:52:36 +0000 (+0000) Subject: Restructured the 'freeze' property a bit. We now have X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dea7284cc7d3c8b73a45544703c62396fd3ea7de;p=flightgear.git Restructured the 'freeze' property a bit. We now have /sim/freeze/master (implimented) /sim/freeze/fuel (implimented) /sim/freeze/position (not implimented) /sim/freeze/time-of-day (not implimented) /sim/freeze/master is bound to the 'p' key via keyboard.xml, however, /sim/freeze/fuel is not bound to anything at the moment so you must change it via the external property interface, or specify an initial value on the command line. --- diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index da4bd24f4..d45f0bb5c 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -125,7 +125,7 @@ FGJSBsim::FGJSBsim( double dt ) init_gear(); // Set initial fuel levels if provided. - for (int i = 0; i < Propulsion->GetNumTanks(); i++) { + for (unsigned int i = 0; i < Propulsion->GetNumTanks(); i++) { SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true); if (node->getChild("level-gal_us", 0, false) != 0) Propulsion->GetTank(i) @@ -240,7 +240,7 @@ FGJSBsim::update( int multiloop ) { int i; - double save_alt = 0.0; + // double save_alt = 0.0; copy_to_JSBsim(); @@ -291,7 +291,7 @@ FGJSBsim::update( int multiloop ) { // Convert from the FGInterface struct to the JSBsim generic_ struct bool FGJSBsim::copy_to_JSBsim() { - int i; + unsigned int i; // copy control positions into the JSBsim structure @@ -463,12 +463,19 @@ bool FGJSBsim::copy_from_JSBsim() { node->setBoolValue("cranking", eng->GetCranking()); } - // Copy the fuel levels from JSBSim. - for (i = 0; i < Propulsion->GetNumTanks(); i++) { - SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true); - double contents = Propulsion->GetTank(i)->GetContents(); - node->setDoubleValue("level-gal_us", contents/6.6); -// node->setDoubleValue("level-lb", contents); + static const SGPropertyNode *fuel_freeze + = fgGetNode("/sim/freeze/fuel"); + + // Copy the fuel levels from JSBSim if fuel + // freeze not enabled. + if ( ! fuel_freeze->getBoolValue() ) { + for (i = 0; i < Propulsion->GetNumTanks(); i++) { + SGPropertyNode * node + = fgGetNode("/consumables/fuel/tank", i, true); + double contents = Propulsion->GetTank(i)->GetContents(); + node->setDoubleValue("level-gal_us", contents/6.6); + // node->setDoubleValue("level-lb", contents); + } } update_gear(); diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index 7d11ce73c..067635bf4 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -119,15 +119,20 @@ void FGLaRCsim::update( int multiloop ) { fgSetDouble("/engines/engine/running", eng.getRunningFlag()); fgSetDouble("/engines/engine/cranking", eng.getCrankingFlag()); - //Assume we are using both tanks equally for now - fgSetDouble("/consumables/fuel/tank[0]/level-gal_us", - fgGetDouble("/consumables/fuel/tank[0]") - - (eng.get_fuel_flow_gals_hr() / (2 * 3600)) - * get_delta_t()); - fgSetDouble("/consumables/fuel/tank[1]/level-gal_us", - fgGetDouble("/consumables/fuel/tank[1]") - - (eng.get_fuel_flow_gals_hr() / (2 * 3600)) - * get_delta_t()); + static const SGPropertyNode *fuel_freeze + = fgGetNode("/sim/freeze/fuel"); + + if ( ! fuel_freeze->getBoolValue() ) { + //Assume we are using both tanks equally for now + fgSetDouble("/consumables/fuel/tank[0]/level-gal_us", + fgGetDouble("/consumables/fuel/tank[0]") + - (eng.get_fuel_flow_gals_hr() / (2 * 3600)) + * get_delta_t()); + fgSetDouble("/consumables/fuel/tank[1]/level-gal_us", + fgGetDouble("/consumables/fuel/tank[1]") + - (eng.get_fuel_flow_gals_hr() / (2 * 3600)) + * get_delta_t()); + } F_X_engine = eng.get_prop_thrust_lbs(); // cout << "F_X_engine = " << F_X_engine << '\n'; diff --git a/src/GUI/apt_dlg.cxx b/src/GUI/apt_dlg.cxx index d7c0b6334..dc87cb7eb 100644 --- a/src/GUI/apt_dlg.cxx +++ b/src/GUI/apt_dlg.cxx @@ -55,6 +55,8 @@ void AptDialog_OK (puObject *) = fgGetNode("/position/longitude-deg"); static const SGPropertyNode *latitude = fgGetNode("/position/latitude-deg"); + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); SGPath path( globals->get_fg_root() ); path.append( "Airports" ); @@ -63,9 +65,10 @@ void AptDialog_OK (puObject *) FGAirport a; - int freeze = globals->get_freeze(); - if(!freeze) - globals->set_freeze( true ); + bool freeze = master_freeze->getBoolValue(); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", true); + } char *s; AptDialogInput->getValue(&s); @@ -97,15 +100,8 @@ void AptDialog_OK (puObject *) SGD_RADIANS_TO_DEGREES); // BusyCursor(0); fgReInitSubsystems(); - // if ( global_tile_mgr.init() ) { - // Load the local scenery data global_tile_mgr.update( longitude->getDoubleValue(), latitude->getDoubleValue() ); - // } else { - // SG_LOG( SG_GENERAL, SG_ALERT, - // "Error in Tile Manager initialization!" ); - // exit(-1); - // } // BusyCursor(1); } else { AptId += " not in database."; @@ -113,7 +109,7 @@ void AptDialog_OK (puObject *) } } if ( !freeze ) { - globals->set_freeze( false ); + fgSetBool("/sim/freeze/master", false); } } diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx index 568ae55eb..abae19663 100644 --- a/src/GUI/gui.cxx +++ b/src/GUI/gui.cxx @@ -493,9 +493,13 @@ void fgHiResDump() char *filename = new char [24]; static int count = 1; - int freeze = globals->get_freeze(); - if(!freeze) - globals->set_freeze( true ); + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); + + bool freeze = master_freeze->getBoolValue(); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", true); + } if(gui_menu_on) { show_menu = true; @@ -668,8 +672,9 @@ void fgHiResDump() puShowCursor(); } - if(!freeze) - globals->set_freeze( false ); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", false); + } } #endif // #if defined( TR_HIRES_SNAP) @@ -760,9 +765,13 @@ void fgDumpSnapShot () { string message; static int count = 1; - int freeze = globals->get_freeze(); - if(!freeze) - globals->set_freeze( true ); + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); + + bool freeze = master_freeze->getBoolValue(); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", true); + } mainMenuBar->hide(); TurnCursorOff(); @@ -812,8 +821,9 @@ void fgDumpSnapShot () { mainMenuBar->reveal(); } - if(!freeze) - globals->set_freeze( false ); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", false); + } } #ifdef FG_NETWORK_OLK diff --git a/src/GUI/gui_local.cxx b/src/GUI/gui_local.cxx index 37b3d3b4c..e351f5099 100644 --- a/src/GUI/gui_local.cxx +++ b/src/GUI/gui_local.cxx @@ -54,9 +54,13 @@ void reInit(puObject *cb) // BusyCursor(0); Quat0(); - int freeze = globals->get_freeze(); - if(!freeze) - globals->set_freeze( true ); + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); + + bool freeze = master_freeze->getBoolValue(); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", true); + } cur_fdm_state->unbind(); @@ -89,7 +93,7 @@ void reInit(puObject *cb) // BusyCursor(1); if ( !freeze ) { - globals->set_freeze( false ); + fgSetBool("/sim/freeze/master", false); } } diff --git a/src/GUI/net_dlg.cxx b/src/GUI/net_dlg.cxx index ebbb1e1c1..74133fce1 100644 --- a/src/GUI/net_dlg.cxx +++ b/src/GUI/net_dlg.cxx @@ -67,27 +67,33 @@ void NetIdDialog_Cancel(puObject *) void NetIdDialog_OK (puObject *) { - string NetId; + string NetId; + + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); + + bool freeze = master_freeze->getBoolValue(); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", true); + } - bool freeze = globals->get_freeze(); - if(!freeze) - globals->set_freeze( true ); /* The following needs some cleanup because "string options.NetId" and "char *net_callsign" */ - NetIdDialogInput->getValue(&net_callsign); - NetId = net_callsign; + NetIdDialogInput->getValue(&net_callsign); + NetId = net_callsign; - NetIdDialog_Cancel( NULL ); - fgSetString("/networking/call-sign", NetId.c_str() ); - strcpy( fgd_callsign, net_callsign); + NetIdDialog_Cancel( NULL ); + fgSetString("/networking/call-sign", NetId.c_str() ); + strcpy( fgd_callsign, net_callsign); // strcpy( fgd_callsign, fgGetString("/sim/networking/call-sign").c_str()); /* Entering a callsign indicates : user wants Net HUD Info */ - net_hud_display = 1; + net_hud_display = 1; - if(!freeze) - globals->set_freeze( false ); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", false); + } } void NewCallSign(puObject *cb) @@ -164,57 +170,72 @@ void NetFGDDialog_Cancel(puObject *) void NetFGDDialog_OK (puObject *) { - char *NetFGD; - - bool freeze = globals->get_freeze(); - if(!freeze) - globals->set_freeze( true ); - NetFGDHostDialogInput->getValue( &NetFGD ); - strcpy( fgd_host, NetFGD); - NetFGDPortLoDialogInput->getValue( (int *) &base_port ); - NetFGDPortHiDialogInput->getValue( (int *) &end_port ); - NetFGDDialog_Cancel( NULL ); - if(!freeze) - globals->set_freeze( false ); + char *NetFGD; + + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); + + bool freeze = master_freeze->getBoolValue(); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", true); + } + + NetFGDHostDialogInput->getValue( &NetFGD ); + strcpy( fgd_host, NetFGD); + NetFGDPortLoDialogInput->getValue( (int *) &base_port ); + NetFGDPortHiDialogInput->getValue( (int *) &end_port ); + NetFGDDialog_Cancel( NULL ); + + if ( !freeze ) { + fgSetBool("/sim/freeze/master", false); + } } void NetFGDDialog_SCAN (puObject *) { - char *NetFGD; - int fgd_port; + char *NetFGD; + int fgd_port; + + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); + + bool freeze = master_freeze->getBoolValue(); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", true); + } - bool freeze = globals->get_freeze(); - if(!freeze) - globals->set_freeze( true ); // printf("Vor getvalue %s\n"); - NetFGDHostDialogInput->getValue( &NetFGD ); + NetFGDHostDialogInput->getValue( &NetFGD ); // printf("Vor strcpy %s\n", (char *) NetFGD); - strcpy( fgd_host, NetFGD); - NetFGDPortLoDialogInput->getValue( (int *) &base_port ); - NetFGDPortHiDialogInput->getValue( (int *) &end_port ); - printf("FGD: %s Port-Start: %d Port-End: %d\n", fgd_host, - base_port, end_port); - net_resolv_fgd(fgd_host); - printf("Resolve : %d\n", net_r); - if(!freeze) - globals->set_freeze( false ); - if ( net_r == 0 ) { - fgd_port = 10000; - strcpy( fgd_name, ""); - for( current_port = base_port; ( current_port <= end_port); current_port++) { - fgd_send_com("0" , FGFS_host); - sprintf( NewNetFGDLabel , "Scanning for deamon Port: %d", current_port); - printf("FGD: searching %s\n", fgd_name); - if ( strcmp( fgd_name, "") != 0 ) { - sprintf( NewNetFGDLabel , "Found %s at Port: %d", - fgd_name, current_port); - fgd_port = current_port; - current_port = end_port+1; - } - } - current_port = end_port = base_port = fgd_port; + strcpy( fgd_host, NetFGD); + NetFGDPortLoDialogInput->getValue( (int *) &base_port ); + NetFGDPortHiDialogInput->getValue( (int *) &end_port ); + printf("FGD: %s Port-Start: %d Port-End: %d\n", fgd_host, + base_port, end_port); + net_resolv_fgd(fgd_host); + printf("Resolve : %d\n", net_r); + + if ( !freeze ) { + fgSetBool("/sim/freeze/master", false); + } + + if ( net_r == 0 ) { + fgd_port = 10000; + strcpy( fgd_name, ""); + for( current_port = base_port; ( current_port <= end_port); current_port++) { + fgd_send_com("0" , FGFS_host); + sprintf( NewNetFGDLabel , "Scanning for deamon Port: %d", current_port); + printf("FGD: searching %s\n", fgd_name); + if ( strcmp( fgd_name, "") != 0 ) { + sprintf( NewNetFGDLabel , "Found %s at Port: %d", + fgd_name, current_port); + fgd_port = current_port; + current_port = end_port+1; + } } - NetFGDDialog_Cancel( NULL ); + current_port = end_port = base_port = fgd_port; + } + NetFGDDialog_Cancel( NULL ); } diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 77b9aedf7..67ec281de 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -267,24 +267,28 @@ do_screen_capture (const SGPropertyNode * arg, SGCommandState ** state) static bool do_tile_cache_reload (const SGPropertyNode * arg, SGCommandState ** state) { - bool freeze = globals->get_freeze(); - SG_LOG(SG_INPUT, SG_INFO, "ReIniting TileCache"); - if ( !freeze ) - globals->set_freeze( true ); - // BusyCursor(0); - if ( global_tile_mgr.init() ) { - // Load the local scenery data - global_tile_mgr.update(fgGetDouble("/position/longitude-deg"), - fgGetDouble("/position/latitude-deg")); - } else { - SG_LOG( SG_GENERAL, SG_ALERT, - "Error in Tile Manager initialization!" ); - exit(-1); - } - // BusyCursor(1); - if ( !freeze ) - globals->set_freeze( false ); - return true; + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); + bool freeze = master_freeze->getBoolValue(); + SG_LOG(SG_INPUT, SG_INFO, "ReIniting TileCache"); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", true); + } + // BusyCursor(0); + if ( global_tile_mgr.init() ) { + // Load the local scenery data + global_tile_mgr.update(fgGetDouble("/position/longitude-deg"), + fgGetDouble("/position/latitude-deg")); + } else { + SG_LOG( SG_GENERAL, SG_ALERT, + "Error in Tile Manager initialization!" ); + exit(-1); + } + // BusyCursor(1); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", false); + } + return true; } diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 35568c80c..56c4d9592 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -916,13 +916,15 @@ void fgReInitSubsystems( void ) = fgGetNode("/position/latitude-deg"); static const SGPropertyNode *altitude = fgGetNode("/position/altitude-ft"); + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); SG_LOG( SG_GENERAL, SG_INFO, "/position/altitude = " << altitude->getDoubleValue() ); - bool freeze = globals->get_freeze(); - if( !freeze ) { - globals->set_freeze( true ); + bool freeze = master_freeze->getBoolValue(); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", true); } // Initialize the Scenery Management subsystem @@ -1002,6 +1004,7 @@ void fgReInitSubsystems( void ) cur_light_params.Update(); fgUpdateLocalTime(); - if( !freeze ) - globals->set_freeze( false ); + if ( !freeze ) { + fgSetBool("/sim/freeze/master", false); + } } diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index 42b07265a..edd3d916c 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -264,6 +264,7 @@ setLoggingPriority (string priority) } +#if 0 /** * Get the pause state of the sim. */ @@ -290,6 +291,7 @@ setFreeze (bool freeze) current_atcdisplay->CancelRepeatingMessage(); } } +#endif /** * Return the current aircraft directory (UIUC) as a string. @@ -1088,7 +1090,7 @@ fgInitProps () // Simulation fgTie("/sim/logging/priority", getLoggingPriority, setLoggingPriority); fgTie("/sim/logging/classes", getLoggingClasses, setLoggingClasses); - fgTie("/sim/freeze", getFreeze, setFreeze); + // fgTie("/sim/freeze", getFreeze, setFreeze); fgTie("/sim/aircraft-dir", getAircraftDir, setAircraftDir); fgTie("/sim/view/offset-deg", getViewOffset, setViewOffset, false); fgSetArchivable("/sim/view/offset-deg"); diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 10995370a..59712dca7 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -36,7 +36,6 @@ FGGlobals *globals; // Constructor FGGlobals::FGGlobals() : - freeze( false ), #if defined(FX) && defined(XMESA) fullscreen( true ), #endif diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index db6473150..2b15a3bda 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -60,8 +60,10 @@ private: // Root of FlightGear scenery tree string fg_scenery; +#if 0 // Freeze sim bool freeze; +#endif // Fullscreen mode for old 3DFX cards. #if defined(FX) && defined(XMESA) @@ -123,8 +125,10 @@ public: fg_scenery = scenery; } +#if 0 inline bool get_freeze() const { return freeze; } inline void set_freeze( bool f ) { freeze = f; } +#endif #if defined(FX) && defined(XMESA) inline bool get_fullscreen() const { return fullscreen; } diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 4f613cd06..fd8ff4982 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -899,6 +899,8 @@ void fgRenderFrame( void ) { // Update internal time dependent calculations (i.e. flight model) void fgUpdateTimeDepCalcs() { static bool inited = false; + static const SGPropertyNode *master_freeze + = fgGetNode("/sim/freeze/master"); // cout << "Updating time dep calcs()" << endl; @@ -926,7 +928,7 @@ void fgUpdateTimeDepCalcs() { // instance ... if ( !cur_fdm_state->get_inited() ) { // do nothing, fdm isn't inited yet - } else if ( globals->get_freeze() ) { + } else if ( master_freeze->getBoolValue() ) { // we are frozen, run the fdm's with 0 time slices in case // they want to do something with that. @@ -1516,16 +1518,6 @@ int mainLoop( int argc, char **argv ) { glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -0.5 ) ; #endif -#if 0 -#ifdef GL_EXT_texture_filter_anisotropic - float max_anisotropy; - glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, - max_anisotropy ); - cout << "Max anisotropy = " << max_anisotropy << endl; -#endif -#endif - // set current_options lon/lat if an airport id is specified // cout << "3. airport_id = " << fgGetString("/sim/startup/airport-id") << endl; if ( fgGetString("/sim/startup/airport-id").length() ) { diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 48fde868c..eda548ad3 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -187,6 +187,12 @@ fgSetDefaults () fgSetBool("/sim/networking/network-olk", false); fgSetString("/sim/networking/call-sign", "Johnny"); + + // Freeze options + fgSetBool("/sim/freeze/master", false); + fgSetBool("/sim/freeze/position", false); + fgSetBool("/sim/freeze/fuel", false); + fgSetBool("/sim/freeze/time-of-day", false); } @@ -548,9 +554,9 @@ parse_option (const string& arg) } else if ( arg == "--enable-mouse-pointer" ) { fgSetString("/sim/startup/mouse-pointer", "enabled"); } else if ( arg == "--disable-freeze" ) { - fgSetBool("/sim/freeze", false); + fgSetBool("/sim/freeze/master", false); } else if ( arg == "--enable-freeze" ) { - fgSetBool("/sim/freeze", true); + fgSetBool("/sim/freeze/master", true); } else if ( arg == "--disable-anti-alias-hud" ) { fgSetBool("/sim/hud/antialiased", false); } else if ( arg == "--enable-anti-alias-hud" ) { diff --git a/src/Objects/matlib.cxx b/src/Objects/matlib.cxx index 9c0ec1e59..859f1c0ea 100644 --- a/src/Objects/matlib.cxx +++ b/src/Objects/matlib.cxx @@ -217,3 +217,5 @@ void FGMaterialLib::load_next_deferred() { return; } } + + diff --git a/src/Objects/newmat.cxx b/src/Objects/newmat.cxx index 9a272d9c2..7ac493dea 100644 --- a/src/Objects/newmat.cxx +++ b/src/Objects/newmat.cxx @@ -202,6 +202,15 @@ FGNewMat::build_ssg_state (bool defer_tex_load) textured->enable( GL_TEXTURE_2D ); textured->disable( GL_BLEND ); textured->disable( GL_ALPHA_TEST ); +#if 0 +# ifdef GL_EXT_texture_filter_anisotropic + float max_anisotropy; + glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy ); + glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, + max_anisotropy ); + cout << "Max anisotropy = " << max_anisotropy << endl; +# endif +#endif if ( !defer_tex_load ) { textured->setTexture( (char *)texture_path.c_str(), wrapu, wrapv ); texture_loaded = true; diff --git a/src/Scenery/tileentry.cxx b/src/Scenery/tileentry.cxx index c1e4bc3c7..eb4136847 100644 --- a/src/Scenery/tileentry.cxx +++ b/src/Scenery/tileentry.cxx @@ -868,6 +868,32 @@ void FGTileEntry::prep_ssg_node( const Point3D& p, float vis) { } +// Set up lights rendering call backs +static int fgLightsPredraw( ssgEntity *e ) { +#ifdef GL_EXT_point_parameters + if (glutExtensionSupported("GL_EXT_point_parameters")) { + static float quadratic[3] = {1.0, 0.01, 0.0001}; + glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, quadratic); + glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, 1.0); + glPointSize(4.0); + } +#endif + return true; +} + +static int fgLightsPostdraw( ssgEntity *e ) { +#ifdef GL_EXT_point_parameters + if (glutExtensionSupported("GL_EXT_point_parameters")) { + static float default_attenuation[3] = {1.0, 0.0, 0.0}; + glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, + default_attenuation); + glPointSize(1.0); + } +#endif + return true; +} + + ssgLeaf* FGTileEntry::gen_lights( ssgVertexArray *lights, int inc, float bright ) { // generate a repeatable random seed float *p1 = lights->get( 0 ); @@ -920,6 +946,8 @@ ssgLeaf* FGTileEntry::gen_lights( ssgVertexArray *lights, int inc, float bright // assign state FGNewMat *newmat = material_lib.find( "LIGHTS" ); leaf->setState( newmat->get_state() ); + leaf->setCallback( SSG_CALLBACK_PREDRAW, fgLightsPredraw ); + leaf->setCallback( SSG_CALLBACK_POSTDRAW, fgLightsPostdraw ); return leaf; }