From: curt Date: Tue, 6 May 2003 23:46:24 +0000 (+0000) Subject: This is step "1" of probably "many" in the process of separating out the X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2119db35c3f596268e2ee21d3cd8c359a85cd1ed;p=flightgear.git This is step "1" of probably "many" in the process of separating out the scene management code and organizing it within simgear. My strategy is to identify the code I want to move, and break it's direct flightgear dependencies. Then it will be free to move over into the simgear package. - Moved some property specific code into simgear/props/ - Split out the condition code from fgfs/src/Main/fg_props and put it in it's own source file in simgear/props/ - Created a scene subdirectory for scenery, model, and material property related code. - Moved location.[ch]xx into simgear/scene/model/ - The location and condition code had dependencies on flightgear's global state (all the globals-> stuff, the flightgear property tree, etc.) SimGear code can't depend on it so that data has to be passed as parameters to the functions/methods/constructors. - This need to pass data as function parameters had a dramatic cascading effect throughout the FlightGear code. --- diff --git a/src/ATC/AIEntity.cxx b/src/ATC/AIEntity.cxx index 126d03778..88945a1ef 100644 --- a/src/ATC/AIEntity.cxx +++ b/src/ATC/AIEntity.cxx @@ -54,5 +54,5 @@ void FGAIEntity::RegisterTransmission(int code) { void FGAIEntity::Transform() { aip.setPosition(pos.lon(), pos.lat(), pos.elev() * SG_METER_TO_FEET); aip.setOrientation(roll, pitch, hdg); - aip.update(); + aip.update( globals->get_scenery()->get_center() ); } diff --git a/src/ATC/AILocalTraffic.cxx b/src/ATC/AILocalTraffic.cxx index 17b642121..e6667699b 100644 --- a/src/ATC/AILocalTraffic.cxx +++ b/src/ATC/AILocalTraffic.cxx @@ -23,9 +23,10 @@ # include #endif +#include + #include #include
-#include
#include #include #include @@ -156,7 +157,8 @@ bool FGAILocalTraffic::Init(string ICAO, OperatingState initialState, PatternLeg string planepath = "Aircraft/c172/Models/c172-dpm.ac"; SGPath path = globals->get_fg_root(); path.append(planepath); - aip.init(planepath.c_str()); + aip.init( path.str(), planepath.c_str(), globals->get_props(), + globals->get_sim_time_sec() ); aip.setVisible(false); // This will be set to true once a valid ground elevation has been determined globals->get_scenery()->get_scene_graph()->addKid(aip.getSceneGraph()); @@ -1117,7 +1119,8 @@ void FGAILocalTraffic::DoGroundElev() { double visibility_meters = fgGetDouble("/environment/visibility-m"); //globals->get_tile_mgr()->prep_ssg_nodes( acmodel_location, globals->get_tile_mgr()->prep_ssg_nodes( aip.getFGLocation(), visibility_meters ); - globals->get_tile_mgr()->update( aip.getFGLocation(), visibility_meters, (aip.getFGLocation())->get_absolute_view_pos() ); + Point3D scenery_center = globals->get_scenery()->get_center(); + globals->get_tile_mgr()->update( aip.getFGLocation(), visibility_meters, (aip.getFGLocation())->get_absolute_view_pos( scenery_center ) ); // save results of update in FGLocation for fdm... //if ( globals->get_scenery()->get_cur_elev() > -9990 ) { diff --git a/src/ATC/ATCdisplay.cxx b/src/ATC/ATCdisplay.cxx index 85bb9245e..4f75c489e 100644 --- a/src/ATC/ATCdisplay.cxx +++ b/src/ATC/ATCdisplay.cxx @@ -22,7 +22,7 @@ # include #endif -#include +#include #include #include
diff --git a/src/Aircraft/aircraft.cxx b/src/Aircraft/aircraft.cxx index 9b667c8f7..681dd48e8 100644 --- a/src/Aircraft/aircraft.cxx +++ b/src/Aircraft/aircraft.cxx @@ -90,7 +90,7 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) { // Show available aircraft types void fgReadAircraft(void) { - SGPropertyNode *aircraft_types = fgGetNode("/sim/aircraft-types", true); + // SGPropertyNode *aircraft_types = fgGetNode("/sim/aircraft-types", true); SGPath path( globals->get_fg_root() ); path.append("Aircraft"); @@ -127,10 +127,8 @@ void fgReadAircraft(void) { SGPropertyNode *desc = node->getNode("description"); if (desc) { -#endif - SGPropertyNode *aircraft = + SGPropertyNode *aircraft = aircraft_types->getChild(dire->d_name, 0, true); -#if 0 aircraft->setStringValue(strdup(desc->getStringValue())); } diff --git a/src/Autopilot/newauto.hxx b/src/Autopilot/newauto.hxx index 37dd3dd94..de1d39bbb 100644 --- a/src/Autopilot/newauto.hxx +++ b/src/Autopilot/newauto.hxx @@ -27,7 +27,7 @@ #define _NEWAUTO_HXX -#include +#include #include #include
diff --git a/src/Cockpit/cockpit.cxx b/src/Cockpit/cockpit.cxx index 0415b86a8..3dd91cae2 100644 --- a/src/Cockpit/cockpit.cxx +++ b/src/Cockpit/cockpit.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Cockpit/hud.cxx b/src/Cockpit/hud.cxx index d9654f231..4f7ddfded 100644 --- a/src/Cockpit/hud.cxx +++ b/src/Cockpit/hud.cxx @@ -47,10 +47,8 @@ #include #include -#include +#include #include -//#include -//#include #include #include @@ -61,7 +59,6 @@ #include #endif #include -//#include