HiI noticed fps were decreased quite a bit for every reload in KSFO and in the carrier. It seemed AI models were being reloaded without being unloaded, causing duplicate rendering.
This patch solved it for me by only loading once (only tested with the carrier but the code changes look safe to me )
Cheers, Tiago
Index: AIBase.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIBase.cxx,v retrieving revision 1.79 diff -u -p -u -r1.79 AIBase.cxx --- AIBase.cxx 15 Jul 2007 14:08:31 -0000 1.79 +++ AIBase.cxx 5 Jan 2008 15:33:21 -0000 @@ -56,7 +56,9 @@ const double FGAIBase::lbs_to_slugs = 0. FGAIBase::FGAIBase(object_type ot) : props( NULL ), model_removed( fgGetNode("/ai/models/model-removed", true) ), + model( NULL), manager( NULL ), + fp( NULL ), _impact_lat(0), @@ -152,42 +154,48 @@ void FGAIBase::Transform() { bool FGAIBase::init(bool search_in_AI_path) { - if (!model_path.empty()) { - - if ( search_in_AI_path - && (model_path.substr(model_path.size() - 4, 4) == ".xml")) { - SGPath ai_path("AI"); - ai_path.append(model_path); - try { - model = load3DModel( globals->get_fg_root(), ai_path.str(), props, - globals->get_sim_time_sec() ); - } catch (const sg_exception &e) { - model = NULL; - } - } else - model = NULL; - - if (!model.get()) { - try { - model = load3DModel( globals->get_fg_root(), model_path, props, - globals->get_sim_time_sec() ); - } catch (const sg_exception &e) { - model = NULL; - } - } - - } + if(model==NULL) { + if (!model_path.empty()) { + + if ( search_in_AI_path + && (model_path.substr(model_path.size() - 4, 4) == ".xml")) { + SGPath ai_path("AI"); + ai_path.append(model_path); + try { + model = load3DModel( globals->get_fg_root(), ai_path.str(), props, + globals->get_sim_time_sec() ); + } catch (const sg_exception &e) { + model = NULL; + } + } else + model = NULL; + + if (!model.get()) { + try { + model = load3DModel( globals->get_fg_root(), model_path, props, + globals->get_sim_time_sec() ); + } catch (const sg_exception &e) { + model = NULL; + } + } + + } + + if (model.get()) { + aip.init( model.get() ); + aip.setVisible(true); + invisible = false; + globals->get_scenery()->get_scene_graph()->addChild(aip.getSceneGraph()); + fgSetString("/ai/models/model-added", props->getPath()); + + } else if (!model_path.empty()) { + SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path); + } + } + else { + fgSetString("/ai/models/model-added", props->getPath()); + } - if (model.get()) { - aip.init( model.get() ); - aip.setVisible(true); - invisible = false; - globals->get_scenery()->get_scene_graph()->addChild(aip.getSceneGraph()); - fgSetString("/ai/models/model-added", props->getPath()); - - } else if (!model_path.empty()) { - SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path); - } props->setStringValue("submodels/path", _path.c_str()); setDie(false);
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel