]> git.mxchange.org Git - flightgear.git/commitdiff
This is step "1" of probably "many" in the process of separating out the
authorcurt <curt>
Tue, 6 May 2003 23:46:24 +0000 (23:46 +0000)
committercurt <curt>
Tue, 6 May 2003 23:46:24 +0000 (23:46 +0000)
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.

54 files changed:
src/ATC/AIEntity.cxx
src/ATC/AILocalTraffic.cxx
src/ATC/ATCdisplay.cxx
src/Aircraft/aircraft.cxx
src/Autopilot/newauto.hxx
src/Cockpit/cockpit.cxx
src/Cockpit/hud.cxx
src/Cockpit/panel.hxx
src/Cockpit/panel_io.cxx
src/Controls/controls.hxx
src/FDM/JSBSim/FGPropertyManager.cpp
src/FDM/JSBSim/FGPropertyManager.h
src/FDM/JSBSim/JSBSim.hxx
src/FDM/LaRCsim.cxx
src/FDM/YASim/FGFDM.hpp
src/FDM/YASim/Makefile.am
src/FDM/YASim/YASim.cxx
src/FDM/YASim/yasim-test.cpp
src/FDM/flight.cxx
src/GUI/dialog.hxx
src/GUI/gui.cxx
src/GUI/new_gui.hxx
src/GUI/prop_picker.cxx
src/GUI/prop_picker.hxx
src/Input/input.cxx
src/Input/input.hxx
src/Instrumentation/airspeed_indicator.hxx
src/Instrumentation/altimeter.hxx
src/Instrumentation/attitude_indicator.hxx
src/Instrumentation/dme.hxx
src/Instrumentation/gps.hxx
src/Instrumentation/heading_indicator.hxx
src/Instrumentation/mag_compass.hxx
src/Instrumentation/slip_skid_ball.hxx
src/Instrumentation/turn_indicator.hxx
src/Instrumentation/vertical_speed_indicator.hxx
src/Main/Makefile.am
src/Main/fg_commands.cxx
src/Main/fg_commands.hxx
src/Main/fg_init.cxx
src/Main/fg_props.cxx
src/Main/fg_props.hxx
src/Main/fgfs.hxx
src/Main/logger.hxx
src/Main/main.cxx
src/Main/viewer.cxx
src/Main/viewer.hxx
src/Model/acmodel.cxx
src/Model/loader.cxx
src/Model/loader.hxx
src/Model/model.cxx
src/Model/model.hxx
src/Model/modelmgr.cxx
src/Model/panelnode.cxx

index 126d0377852c7b948783117b1e4ed0d61dc2f286..88945a1efbe1381c50b1e4a48f9f46bfc2f208ba 100644 (file)
@@ -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() );    
 }
index 17b6421216930db0ff22602675c0490fe758c311..e6667699b4de576635595ca4d7c57ad705c7255a 100644 (file)
 #  include <config.h>
 #endif
 
+#include <simgear/scene/model/location.hxx>
+
 #include <Airports/runways.hxx>
 #include <Main/globals.hxx>
-#include <Main/location.hxx>
 #include <Scenery/scenery.hxx>
 #include <Scenery/tilemgr.hxx>
 #include <simgear/math/point3d.hxx>
@@ -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 ) {
index 85bb9245efed9f77ba3221497941c97f7451d54a..4f75c489e5736d268529c310b335c547a6ab712d 100644 (file)
@@ -22,7 +22,7 @@
 #  include <config.h>
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include <Include/general.hxx>
 #include <Main/fg_props.hxx>
index 9b667c8f7e842dd64d4e79fa5694486c5dc8bf9a..681dd48e8bc2c764ea98c42daccce84b1a99a942 100644 (file)
@@ -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()));
              }
index 37dd3dd944dcadf2154f6c2a815b52440384bca4..de1d39bbbe3e22e3ce9491b3e8a13cb10ec99818 100644 (file)
@@ -27,7 +27,7 @@
 #define _NEWAUTO_HXX
 
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 #include <simgear/route/waypoint.hxx>
 
 #include <Main/fgfs.hxx>
index 0415b86a8219afa70c605517db0e81627f42b779..3dd91cae214d8e81b17d4eb1ac0812087dcf4966 100644 (file)
@@ -38,7 +38,7 @@
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/polar3d.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 #include <simgear/timing/sg_time.hxx>
 
 #include <Aircraft/aircraft.hxx>
index d9654f231e2341b00bb74c5a0ca6be6ad967c2a0..4f7ddfdedc7a6b29d2f8775f944e4f93b9451446 100644 (file)
 
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 #include <simgear/misc/sg_path.hxx>
-//#include <simgear/math/fg_random.h>
-//#include <simgear/math/polar3d.hxx>
 
 #include <Aircraft/aircraft.hxx>
 #include <Autopilot/newauto.hxx>
@@ -61,7 +59,6 @@
 #include <NetworkOLK/network.h>
 #endif
 #include <Scenery/scenery.hxx>
-//#include <Time/fg_timer.hxx>
 
 #if defined ( __sun__ ) || defined ( __sgi )
 extern "C" {
index 00125ea6d440877969d1eaaeed48167586024dd5..fc2afda00aa4b846103f6875725a0a52a8510015 100644 (file)
@@ -41,7 +41,7 @@
 #include <plib/ssg.h>
 
 #include <simgear/math/interpolater.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 #include <simgear/timing/timestamp.hxx>
 
 #include <cmath>
index f7721a98278629feec0aeb98de70827259433aad..88fe30c4a9d5c07aa9721d654a613301f6241fcd 100644 (file)
@@ -31,9 +31,9 @@
 #include <simgear/compiler.h>
 #include <simgear/misc/exception.hxx>
 
-#include <simgear/misc/sg_path.hxx>
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/misc/sg_path.hxx>
+#include <simgear/props/props.hxx>
 
 #include STL_IOSTREAM
 #include STL_FSTREAM
@@ -137,7 +137,8 @@ readConditions (FGConditional * component, const SGPropertyNode * node)
   const SGPropertyNode * conditionNode = node->getChild("condition");
   if (conditionNode != 0)
                                // The top level is implicitly AND
-    component->setCondition(fgReadCondition(conditionNode));
+    component->setCondition(fgReadCondition(globals->get_props(),
+                                            conditionNode) );
 }
 
 
index 4175f421eb350a201737d7cb6912ca37dd9346db..2e467a5ae5fdb02f1c670289c129d59cd546bb38 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef _CONTROLS_HXX
 #define _CONTROLS_HXX
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include <Main/fgfs.hxx>
 #include <Main/globals.hxx>
index d0f810ab8ae7a4977731bd258fb35981cb751a23..ae942e7d44a9917befcd51748b6411975cf0f323 100644 (file)
@@ -28,7 +28,7 @@
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 #include "FGPropertyManager.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 57e090daf19247b7a545474b1533507612fb6794..8e4d818a267d308040d82fcf004b836ece3e5fd6 100644 (file)
@@ -36,7 +36,7 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include <string>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
index 04a10b29934c7e481ec84d21a2dbc656a890bb87..2d83588ec5c24d0b53b4b052ed086a7b2a955eb6 100644 (file)
@@ -53,7 +53,7 @@ DEFINITIONS
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include <FDM/JSBSim/FGFDMExec.h>
 
index 6a07646169f2cd469c4b1835b9386a268a68ffae..c4c0eb48ff6f8b8ff9dae293ebbed169f52f79af 100644 (file)
 
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
+#include <simgear/scene/model/location.hxx>
 
-
-#include <Main/fg_props.hxx>
 #include <Aircraft/aircraft.hxx>
 #include <Controls/controls.hxx>
 #include <Model/model.hxx>
-#include <Main/location.hxx>
 #include <FDM/flight.hxx>
 #include <FDM/LaRCsim/ls_cockpit.h>
 #include <FDM/LaRCsim/ls_generic.h>
 #include <FDM/LaRCsim/ls_interface.h>
 #include <FDM/LaRCsimIC.hxx>
 #include <FDM/UIUCModel/uiuc_aircraft.h>
+#include <Main/fg_props.hxx>
 #include <Model/acmodel.hxx>
 
 #include "IO360.hxx"
index f67afe9f4d6f2b90cf23b20dc86fbedea5e6fdc8..cd91e50d4fd44411dcc62dfb347963cf8e389995 100644 (file)
@@ -2,7 +2,7 @@
 #define _FGFDM_HPP
 
 #include <simgear/xml/easyxml.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include "Airplane.hpp"
 #include "Vector.hpp"
index d8b62c4fc7edfc784f2bdbe3ed3dd9bbc3ce3d41..f74548c99b4e7cfa4720e34ac7063a13fbe811cb 100644 (file)
@@ -55,6 +55,6 @@ yasim_SOURCES = yasim-test.cpp \
         Vector.hpp \
         Wing.cpp Wing.hpp
 
-yasim_LDADD = -lsgxml -lsgmisc -lsgdebug
+yasim_LDADD = -lsgxml -lsgprops -lsgmisc -lsgdebug
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
index f7f634165ced956a99aa6facfe582169a02f1623..f1cbe429efcb35e7b7a810b258455e84a54925c5 100644 (file)
@@ -1,11 +1,12 @@
-#include <simgear/misc/sg_path.hxx>
 #include <simgear/debug/logstream.hxx>
+#include <simgear/misc/sg_path.hxx>
+#include <simgear/scene/model/location.hxx>
 #include <simgear/xml/easyxml.hxx>
+
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 #include <Model/acmodel.hxx>
 #include <Model/model.hxx>
-#include <Main/location.hxx>
 
 #include "FGFDM.hpp"
 #include "Atmosphere.hpp"
index 4e18b5cdfa3c56e577b68fdeba7cfde46e9039db..5693c898a9456f6058ef05b0e567feaf9802a3ba 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 
+#include <simgear/props/props.hxx>
 #include <simgear/xml/easyxml.hxx>
-#include <simgear/misc/props.hxx>
 
 #include "FGFDM.hpp"
 #include "Airplane.hpp"
index c7f6b0944db618faf5bcad32cccf7bcd60107099..59bc6cbc087c022f881614874ffb19390d46f7ff 100644 (file)
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/sg_geodesy.hxx>
+#include <simgear/scene/model/location.hxx>
 #include <simgear/timing/timestamp.hxx>
 
 #include <Scenery/scenery.hxx>
 #include <FDM/LaRCsim/ls_interface.h>
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
-#include <Main/location.hxx>
 #include <Model/model.hxx>
 #include <Model/acmodel.hxx>
 
index cf0c199f89fd4040d178c37ba51d50b19d10cf6e..a399849ff457bb0b25174dc384c00aaa9d7d5096 100644 (file)
@@ -10,7 +10,7 @@
 #include <plib/pu.h>
 
 #include <simgear/compiler.h>  // for SG_USING_STD
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include <vector>
 SG_USING_STD(vector);
index e853760b1b164e2890ecf328d209385fbd49cb6c..c4d1a05f23ed395be300bc70b6e2f78d1818dedf 100644 (file)
 #  include <windows.h>
 #endif
 
-#include <simgear/misc/props.hxx>
-#include <simgear/misc/props_io.hxx>
 #include <simgear/misc/exception.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/props/props.hxx>
+#include <simgear/props/props_io.hxx>
 
 #include <plib/pu.h>
 
index 637f2c592687cecb968125f94a2e52ff464f8ab0..35cc3d831532f782d188c561d17b62b657e5f9b3 100644 (file)
@@ -10,7 +10,7 @@
 #include <plib/pu.h>
 
 #include <simgear/compiler.h>  // for SG_USING_STD
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include <vector>
 SG_USING_STD(vector);
index 445128d34e9d63518d96d53fcb25c93ff6b88eb8..20480755fb1e38e4324cd77158ebff44d34ea830 100755 (executable)
 #  include <config.h>
 #endif
 
-#include "prop_picker.hxx"
-#include <Main/globals.hxx>
-
 #include <simgear/compiler.h>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include STL_STRING
+
+#include <Main/globals.hxx>
+
+#include "prop_picker.hxx"
+
 SG_USING_STD(string);
 
 // A local alternative name, for use when a variable called "string" is in scope - e.g. in classes derived from puInput.
index 16f92aa67ab4b817f40b3747cc53f80108f3de40..e2c293a742721d323b9acb3d147b1aae7ac7ca39 100755 (executable)
@@ -7,7 +7,7 @@
 
 #include <stdio.h>
 #include "gui.h"
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 void prop_pickerInit();
 void prop_pickerView( puObject * );
index a6c578e934a5150a8c3d0f3c9f00257d58968237..a2419ca9ba4c473d77ec4715608310530eb68020 100644 (file)
@@ -45,7 +45,7 @@
 
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include <Aircraft/aircraft.hxx>
 #include <Autopilot/auto_gui.hxx>
@@ -104,7 +104,7 @@ FGBinding::read (const SGPropertyNode * node)
 {
   const SGPropertyNode * conditionNode = node->getChild("condition");
   if (conditionNode != 0)
-    setCondition(fgReadCondition(conditionNode));
+    setCondition(fgReadCondition(globals->get_props(), conditionNode));
 
   _command_name = node->getStringValue("command", "");
   if (_command_name.empty()) {
index d8a4eae1311fc6eb0824fe25e669d55145f7da99..2dc81f5a5f3bad994f07a3879aeef05c44d5598a 100644 (file)
@@ -33,7 +33,8 @@
 #include <simgear/compiler.h>
 
 #include <simgear/misc/commands.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/condition.hxx>
+#include <simgear/props/props.hxx>
 
 #include <Main/fgfs.hxx>
 #include <Main/fg_props.hxx>
index e416e739577e1caef8cdeabf98a182a083de8073..8f0cfd45d699e3b35824b63b7166a9ef680b0727 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 
index 439a677d02daca2ca819b7095f7114a0c537e1fc..0615e021a0a121f3ce19f93313b55d726256f1a9 100644 (file)
@@ -11,7 +11,7 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 #include <Main/fgfs.hxx>
 
 
index d754e287321d98b7349efcf4da833a6639660217..db68dd98bda7ba75e96fd4b26620a3fcc06bd073 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 #include "gyro.hxx"
index 266c5f6f7db6eb661fd02d12f1358cc61cd83271..c70c43ab8ca76e06294b889f5fefa3ec18f7a766 100644 (file)
@@ -12,7 +12,8 @@
 #endif
 
 #include <simgear/math/point3d.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 
index 61b098680d8819e038ca9768f8b3754dbad9ce77..78025aae26da4ae6d4a306a9c06f48066ad48864 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 
index 90d62104c5dffe8871e1b462f16fa6e280a1a8f1..908495adc39ee140d8387a1f61567fd1828146be 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 #include "gyro.hxx"
index 61fb0064097d8c75ecfce23c9cf1a40b39a349ee..f16a22287d38eb67d20c9970993225e43679deee 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 
index 14010af025c9a5892862f8c0ce908affd8f74308..d3e3e076b9922dd126c001a18f53fe84eea049d4 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 #include "gyro.hxx"
index e730f74765e8dcca120f63be2fc2fa6ce27a4613..89681cfea29e58f398e7451979611c7e248ff246 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 #include "gyro.hxx"
index 876fc5ef4e819d5235b84cf2b94ac299b06b275a..007d8ace5ba9bd289d54973cbaf565d5dc2e7e05 100644 (file)
@@ -11,7 +11,8 @@
 # error This library requires C++
 #endif
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+
 #include <Main/fgfs.hxx>
 
 
index 8c58124db427a47e61ee227d07655d6ef6b91b1b..d472885284df619b6c930cfdaef93cd1f552ee2e 100644 (file)
@@ -54,8 +54,7 @@ fgfs_SOURCES = \
        splash.cxx splash.hxx \
        util.cxx util.hxx \
        viewer.cxx viewer.hxx \
-       viewmgr.cxx viewmgr.hxx \
-        location.cxx location.hxx
+       viewmgr.cxx viewmgr.hxx
 
 fgfs_LDADD = \
        $(top_builddir)/src/Aircraft/libAircraft.a \
@@ -89,8 +88,8 @@ fgfs_LDADD = \
        $(top_builddir)/src/Systems/libSystems.a \
        $(top_builddir)/src/Time/libTime.a \
        $(WEATHER_LIBS) \
-       -lsgroute -lsgsky -lsgephem -lsgtiming -lsgio -lsgscreen \
-       -lsgmath -lsgbucket -lsgdebug -lsgmagvar -lsgmisc -lsgxml \
+       -lsgroute -lsgsky -lsgephem -lsgmodel -lsgtiming -lsgio -lsgscreen \
+       -lsgmath -lsgbucket -lsgprops -lsgdebug -lsgmagvar -lsgmisc -lsgxml \
        -lsgserial \
        $(THREAD_LIBS) \
        -lplibpu -lplibfnt -lplibjs -lplibnet -lplibssg -lplibsg -lplibul \
index 389c28fc64c270b6706eaa722a88feeffab0ff27..6e14ee67428f99c192452f8775786930cefd5881 100644 (file)
@@ -8,11 +8,11 @@
 #include STL_STRING
 #include STL_FSTREAM
 
+#include <simgear/sg_inlines.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/math/sg_random.h>
 #include <simgear/misc/commands.hxx>
-#include <simgear/misc/props.hxx>
-#include <simgear/sg_inlines.h>
+#include <simgear/props/props.hxx>
 
 #include <Cockpit/panel.hxx>
 #include <Cockpit/panel_io.hxx>
@@ -22,7 +22,7 @@
 #include <GUI/dialog.hxx>
 #include <Scenery/tilemgr.hxx>
 #if defined(HAVE_PLIB_PSL)
-#include <Scripting/scriptmgr.hxx>
+#  include <Scripting/scriptmgr.hxx>
 #endif
 #include <Time/tmp.hxx>
 
@@ -196,7 +196,7 @@ do_reinit (const SGPropertyNode * arg)
     vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
     if (subsystems.size() == 0)
         globals->get_subsystem_mgr()->reinit();
-    else for (int i = 0; i < subsystems.size(); i++) {
+    else for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
         const char * name = subsystems[i]->getStringValue();
         FGSubsystem * subsystem = globals->get_subsystem(name);
         if (subsystem == 0) {
@@ -220,7 +220,7 @@ do_suspend (const SGPropertyNode * arg)
     bool result = true;
 
     vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
-    for (int i = 0; i < subsystems.size(); i++) {
+    for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
         const char * name = subsystems[i]->getStringValue();
         FGSubsystem * subsystem = globals->get_subsystem(name);
         if (subsystem == 0) {
@@ -244,7 +244,7 @@ do_resume (const SGPropertyNode * arg)
     bool result = true;
 
     vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
-    for (int i = 0; i < subsystems.size(); i++) {
+    for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
         const char * name = subsystems[i]->getStringValue();
         FGSubsystem * subsystem = globals->get_subsystem(name);
         if (subsystem == 0) {
index 3fb0af3a0895af193c49524ea5eb26d4784a3539..92a75a8a6ce891d1942ad8967e7dafd08f6f8e7f 100644 (file)
@@ -17,7 +17,7 @@
 #endif
 
 #include <simgear/misc/commands.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 /**
  * Initialize the built-in commands.
index e2e23766e1cc09eca5ded03b21e99b8325422a11..8f122720aaf9424d0c375b2a74f94ee71d66c290 100644 (file)
@@ -1298,12 +1298,12 @@ SGTime *fgInitTime() {
 // gear, its initialization call should located in this routine.
 // Returns non-zero if a problem encountered.
 bool fgInitSubsystems() {
-    static const SGPropertyNode *longitude
-        = fgGetNode("/sim/presets/longitude-deg");
-    static const SGPropertyNode *latitude
-        = fgGetNode("/sim/presets/latitude-deg");
-    static const SGPropertyNode *altitude
-        = fgGetNode("/sim/presets/altitude-ft");
+    // static const SGPropertyNode *longitude
+    //     = fgGetNode("/sim/presets/longitude-deg");
+    // static const SGPropertyNode *latitude
+    //     = fgGetNode("/sim/presets/latitude-deg");
+    // static const SGPropertyNode *altitude
+    //     = fgGetNode("/sim/presets/altitude-ft");
 
     fgLIGHT *l = &cur_light_params;
 
@@ -1669,10 +1669,10 @@ bool fgInitSubsystems() {
 
 void fgReInitSubsystems()
 {
-    static const SGPropertyNode *longitude
-        = fgGetNode("/sim/presets/longitude-deg");
-    static const SGPropertyNode *latitude
-        = fgGetNode("/sim/presets/latitude-deg");
+    // static const SGPropertyNode *longitude
+    //     = fgGetNode("/sim/presets/longitude-deg");
+    // static const SGPropertyNode *latitude
+    //     = fgGetNode("/sim/presets/latitude-deg");
     static const SGPropertyNode *altitude
         = fgGetNode("/sim/presets/altitude-ft");
     static const SGPropertyNode *master_freeze
index 8b2f202ae5ab2d0fc9aae4b832afdf178495c64e..654a1967566442fe737979e51caf29bcc9486e0a 100644 (file)
@@ -857,398 +857,4 @@ fgUntie (const char * name)
 }
 
 
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGCondition::FGCondition ()
-{
-}
-
-FGCondition::~FGCondition ()
-{
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGPropertyCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGPropertyCondition::FGPropertyCondition (const char * propname)
-  : _node(fgGetNode(propname, true))
-{
-}
-
-FGPropertyCondition::~FGPropertyCondition ()
-{
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGNotCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGNotCondition::FGNotCondition (FGCondition * condition)
-  : _condition(condition)
-{
-}
-
-FGNotCondition::~FGNotCondition ()
-{
-  delete _condition;
-}
-
-bool
-FGNotCondition::test () const
-{
-  return !(_condition->test());
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGAndCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGAndCondition::FGAndCondition ()
-{
-}
-
-FGAndCondition::~FGAndCondition ()
-{
-  for (unsigned int i = 0; i < _conditions.size(); i++)
-    delete _conditions[i];
-}
-
-bool
-FGAndCondition::test () const
-{
-  int nConditions = _conditions.size();
-  for (int i = 0; i < nConditions; i++) {
-    if (!_conditions[i]->test())
-      return false;
-  }
-  return true;
-}
-
-void
-FGAndCondition::addCondition (FGCondition * condition)
-{
-  _conditions.push_back(condition);
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGOrCondition.
-////////////////////////////////////////////////////////////////////////
-
-FGOrCondition::FGOrCondition ()
-{
-}
-
-FGOrCondition::~FGOrCondition ()
-{
-  for (unsigned int i = 0; i < _conditions.size(); i++)
-    delete _conditions[i];
-}
-
-bool
-FGOrCondition::test () const
-{
-  int nConditions = _conditions.size();
-  for (int i = 0; i < nConditions; i++) {
-    if (_conditions[i]->test())
-      return true;
-  }
-  return false;
-}
-
-void
-FGOrCondition::addCondition (FGCondition * condition)
-{
-  _conditions.push_back(condition);
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGComparisonCondition.
-////////////////////////////////////////////////////////////////////////
-
-static int
-doComparison (const SGPropertyNode * left, const SGPropertyNode *right)
-{
-  switch (left->getType()) {
-  case SGPropertyNode::BOOL: {
-    bool v1 = left->getBoolValue();
-    bool v2 = right->getBoolValue();
-    if (v1 < v2)
-      return FGComparisonCondition::LESS_THAN;
-    else if (v1 > v2)
-      return FGComparisonCondition::GREATER_THAN;
-    else
-      return FGComparisonCondition::EQUALS;
-    break;
-  }
-  case SGPropertyNode::INT: {
-    int v1 = left->getIntValue();
-    int v2 = right->getIntValue();
-    if (v1 < v2)
-      return FGComparisonCondition::LESS_THAN;
-    else if (v1 > v2)
-      return FGComparisonCondition::GREATER_THAN;
-    else
-      return FGComparisonCondition::EQUALS;
-    break;
-  }
-  case SGPropertyNode::LONG: {
-    long v1 = left->getLongValue();
-    long v2 = right->getLongValue();
-    if (v1 < v2)
-      return FGComparisonCondition::LESS_THAN;
-    else if (v1 > v2)
-      return FGComparisonCondition::GREATER_THAN;
-    else
-      return FGComparisonCondition::EQUALS;
-    break;
-  }
-  case SGPropertyNode::FLOAT: {
-    float v1 = left->getFloatValue();
-    float v2 = right->getFloatValue();
-    if (v1 < v2)
-      return FGComparisonCondition::LESS_THAN;
-    else if (v1 > v2)
-      return FGComparisonCondition::GREATER_THAN;
-    else
-      return FGComparisonCondition::EQUALS;
-    break;
-  }
-  case SGPropertyNode::DOUBLE: {
-    double v1 = left->getDoubleValue();
-    double v2 = right->getDoubleValue();
-    if (v1 < v2)
-      return FGComparisonCondition::LESS_THAN;
-    else if (v1 > v2)
-      return FGComparisonCondition::GREATER_THAN;
-    else
-      return FGComparisonCondition::EQUALS;
-    break;
-  }
-  case SGPropertyNode::STRING: 
-  case SGPropertyNode::NONE:
-  case SGPropertyNode::UNSPECIFIED: {
-    string v1 = left->getStringValue();
-    string v2 = right->getStringValue();
-    if (v1 < v2)
-      return FGComparisonCondition::LESS_THAN;
-    else if (v1 > v2)
-      return FGComparisonCondition::GREATER_THAN;
-    else
-      return FGComparisonCondition::EQUALS;
-    break;
-  }
-  }
-  throw sg_exception("Unrecognized node type");
-  return 0;
-}
-
-
-FGComparisonCondition::FGComparisonCondition (Type type, bool reverse)
-  : _type(type),
-    _reverse(reverse),
-    _left_property(0),
-    _right_property(0),
-    _right_value(0)
-{
-}
-
-FGComparisonCondition::~FGComparisonCondition ()
-{
-  delete _right_value;
-}
-
-bool
-FGComparisonCondition::test () const
-{
-                               // Always fail if incompletely specified
-  if (_left_property == 0 ||
-      (_right_property == 0 && _right_value == 0))
-    return false;
-
-                               // Get LESS_THAN, EQUALS, or GREATER_THAN
-  int cmp =
-    doComparison(_left_property,
-                (_right_property != 0 ? _right_property : _right_value));
-  if (!_reverse)
-    return (cmp == _type);
-  else
-    return (cmp != _type);
-}
-
-void
-FGComparisonCondition::setLeftProperty (const char * propname)
-{
-  _left_property = fgGetNode(propname, true);
-}
-
-void
-FGComparisonCondition::setRightProperty (const char * propname)
-{
-  delete _right_value;
-  _right_value = 0;
-  _right_property = fgGetNode(propname, true);
-}
-
-void
-FGComparisonCondition::setRightValue (const SGPropertyNode *node)
-{
-  _right_property = 0;
-  delete _right_value;
-  _right_value = new SGPropertyNode(*node);
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Read a condition and use it if necessary.
-////////////////////////////////////////////////////////////////////////
-
-                                // Forward declaration
-static FGCondition * readCondition (const SGPropertyNode * node);
-
-static FGCondition *
-readPropertyCondition (const SGPropertyNode * node)
-{
-  return new FGPropertyCondition(node->getStringValue());
-}
-
-static FGCondition *
-readNotCondition (const SGPropertyNode * node)
-{
-  int nChildren = node->nChildren();
-  for (int i = 0; i < nChildren; i++) {
-    const SGPropertyNode * child = node->getChild(i);
-    FGCondition * condition = readCondition(child);
-    if (condition != 0)
-      return new FGNotCondition(condition);
-  }
-  SG_LOG(SG_COCKPIT, SG_ALERT, "Panel: empty 'not' condition");
-  return 0;
-}
-
-static FGCondition *
-readAndConditions (const SGPropertyNode * node)
-{
-  FGAndCondition * andCondition = new FGAndCondition;
-  int nChildren = node->nChildren();
-  for (int i = 0; i < nChildren; i++) {
-    const SGPropertyNode * child = node->getChild(i);
-    FGCondition * condition = readCondition(child);
-    if (condition != 0)
-      andCondition->addCondition(condition);
-  }
-  return andCondition;
-}
-
-static FGCondition *
-readOrConditions (const SGPropertyNode * node)
-{
-  FGOrCondition * orCondition = new FGOrCondition;
-  int nChildren = node->nChildren();
-  for (int i = 0; i < nChildren; i++) {
-    const SGPropertyNode * child = node->getChild(i);
-    FGCondition * condition = readCondition(child);
-    if (condition != 0)
-      orCondition->addCondition(condition);
-  }
-  return orCondition;
-}
-
-static FGCondition *
-readComparison (const SGPropertyNode * node,
-               FGComparisonCondition::Type type,
-               bool reverse)
-{
-  FGComparisonCondition * condition = new FGComparisonCondition(type, reverse);
-  condition->setLeftProperty(node->getStringValue("property[0]"));
-  if (node->hasValue("property[1]"))
-    condition->setRightProperty(node->getStringValue("property[1]"));
-  else
-    condition->setRightValue(node->getChild("value", 0));
-
-  return condition;
-}
-
-static FGCondition *
-readCondition (const SGPropertyNode * node)
-{
-  const string &name = node->getName();
-  if (name == "property")
-    return readPropertyCondition(node);
-  else if (name == "not")
-    return readNotCondition(node);
-  else if (name == "and")
-    return readAndConditions(node);
-  else if (name == "or")
-    return readOrConditions(node);
-  else if (name == "less-than")
-    return readComparison(node, FGComparisonCondition::LESS_THAN, false);
-  else if (name == "less-than-equals")
-    return readComparison(node, FGComparisonCondition::GREATER_THAN, true);
-  else if (name == "greater-than")
-    return readComparison(node, FGComparisonCondition::GREATER_THAN, false);
-  else if (name == "greater-than-equals")
-    return readComparison(node, FGComparisonCondition::LESS_THAN, true);
-  else if (name == "equals")
-    return readComparison(node, FGComparisonCondition::EQUALS, false);
-  else if (name == "not-equals")
-    return readComparison(node, FGComparisonCondition::EQUALS, true);
-  else
-    return 0;
-}
-
-
-\f
-////////////////////////////////////////////////////////////////////////
-// Implementation of FGConditional.
-////////////////////////////////////////////////////////////////////////
-
-FGConditional::FGConditional ()
-  : _condition (0)
-{
-}
-
-FGConditional::~FGConditional ()
-{
-  delete _condition;
-}
-
-void
-FGConditional::setCondition (FGCondition * condition)
-{
-  delete _condition;
-  _condition = condition;
-}
-
-bool
-FGConditional::test () const
-{
-  return ((_condition == 0) || _condition->test());
-}
-
-
-\f
-// The top-level is always an implicit 'and' group
-FGCondition *
-fgReadCondition (const SGPropertyNode * node)
-{
-  return readAndConditions(node);
-}
-
-
 // end of fg_props.cxx
index 4a58229970adf016f832012c841c1b16848a60db..703636a96a5b67453207a73dd5085023f12d7b52 100644 (file)
@@ -7,8 +7,8 @@
 #define __FG_PROPS_HXX 1
 
 #include <simgear/debug/logstream.hxx>
-#include <simgear/misc/props.hxx>
-#include <simgear/misc/props_io.hxx>
+#include <simgear/props/props.hxx>
+#include <simgear/props/props_io.hxx>
 
 #include "globals.hxx"
 
@@ -539,162 +539,5 @@ fgTie (const char * name, T * obj, int index,
 }
 
 
-\f
-////////////////////////////////////////////////////////////////////////
-// Conditions.
-////////////////////////////////////////////////////////////////////////
-
-
-/**
- * An encoded condition.
- *
- * This class encodes a single condition of some sort, possibly
- * connected with properties.
- *
- * This class should migrate to somewhere more general.
- */
-class FGCondition
-{
-public:
-  FGCondition ();
-  virtual ~FGCondition ();
-  virtual bool test () const = 0;
-};
-
-
-/**
- * Condition for a single property.
- *
- * This condition is true only if the property returns a boolean
- * true value.
- */
-class FGPropertyCondition : public FGCondition
-{
-public:
-  FGPropertyCondition (const char * propname);
-  virtual ~FGPropertyCondition ();
-  virtual bool test () const { return _node->getBoolValue(); }
-private:
-  const SGPropertyNode * _node;
-};
-
-
-/**
- * Condition for a 'not' operator.
- *
- * This condition is true only if the child condition is false.
- */
-class FGNotCondition : public FGCondition
-{
-public:
-                               // transfer pointer ownership
-  FGNotCondition (FGCondition * condition);
-  virtual ~FGNotCondition ();
-  virtual bool test () const;
-private:
-  FGCondition * _condition;
-};
-
-
-/**
- * Condition for an 'and' group.
- *
- * This condition is true only if all of the conditions
- * in the group are true.
- */
-class FGAndCondition : public FGCondition
-{
-public:
-  FGAndCondition ();
-  virtual ~FGAndCondition ();
-  virtual bool test () const;
-                               // transfer pointer ownership
-  virtual void addCondition (FGCondition * condition);
-private:
-  vector<FGCondition *> _conditions;
-};
-
-
-/**
- * Condition for an 'or' group.
- *
- * This condition is true if at least one of the conditions in the
- * group is true.
- */
-class FGOrCondition : public FGCondition
-{
-public:
-  FGOrCondition ();
-  virtual ~FGOrCondition ();
-  virtual bool test () const;
-                               // transfer pointer ownership
-  virtual void addCondition (FGCondition * condition);
-private:
-  vector<FGCondition *> _conditions;
-};
-
-
-/**
- * Abstract base class for property comparison conditions.
- */
-class FGComparisonCondition : public FGCondition
-{
-public:
-  enum Type {
-    LESS_THAN,
-    GREATER_THAN,
-    EQUALS
-  };
-  FGComparisonCondition (Type type, bool reverse = false);
-  virtual ~FGComparisonCondition ();
-  virtual bool test () const;
-  virtual void setLeftProperty (const char * propname);
-  virtual void setRightProperty (const char * propname);
-                               // will make a local copy
-  virtual void setRightValue (const SGPropertyNode * value);
-private:
-  Type _type;
-  bool _reverse;
-  const SGPropertyNode * _left_property;
-  const SGPropertyNode * _right_property;
-  const SGPropertyNode * _right_value;
-};
-
-
-/**
- * Base class for a conditional components.
- *
- * This class manages the conditions and tests; the component should
- * invoke the test() method whenever it needs to decide whether to
- * active itself, draw itself, and so on.
- */
-class FGConditional
-{
-public:
-  FGConditional ();
-  virtual ~FGConditional ();
-                               // transfer pointer ownership
-  virtual void setCondition (FGCondition * condition);
-  virtual const FGCondition * getCondition () const { return _condition; }
-  virtual bool test () const;
-private:
-  FGCondition * _condition;
-};
-
-
-/**
- * Global function to make a condition out of properties.
- *
- * The top-level is always an implicit 'and' group, whatever the
- * node's name (it should usually be "condition").
- *
- * @param node The top-level condition node (usually named "condition").
- * @return A pointer to a newly-allocated condition; it is the
- *         responsibility of the caller to delete the condition when
- *         it is no longer needed.
- */
-FGCondition * fgReadCondition (const SGPropertyNode * node);
-
-
 #endif // __FG_PROPS_HXX
 
index 65472dce818034e2f891a28854d6282d5ace376d..bc435893121212964b0742d56877fe6b2de7818d 100644 (file)
@@ -49,7 +49,7 @@ SG_USING_STD(vector);
 #include <map>
 SG_USING_STD(map);
 
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 
 \f
index 6b7d95291f219f2cee12f2a55279b503dff96efe..4818e44f087a414c70b50e81ebb1e045256cedf9 100644 (file)
@@ -20,7 +20,7 @@
 #include <simgear/compiler.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/exception.hxx>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 SG_USING_STD(ostream);
 SG_USING_STD(vector);
index 6fd0c837fa96ee3800da7cabc2643e62cb492b48..da8bfde6e2e640a672e869c97eda66639959e7c7 100644 (file)
@@ -77,6 +77,7 @@ SG_USING_STD(endl);
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_random.h>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/scene/model/location.hxx>
 #ifdef FG_USE_CLOUDS_3D
 #  include <simgear/sky/clouds3d/SkySceneLoader.hpp>
 #  include <simgear/sky/clouds3d/SkyUtil.hpp>
@@ -105,7 +106,6 @@ SG_USING_STD(endl);
 #include <Model/loader.hxx>
 #include <Model/model.hxx>
 #include <Model/modelmgr.hxx>
-#include <Main/location.hxx>
 #include <Model/panelnode.hxx>
 #ifdef FG_NETWORK_OLK
 #include <NetworkOLK/network.h>
@@ -445,12 +445,12 @@ void fgRenderFrame() {
     // Process/manage pending events
     global_events.update( delta_time_sec );
 
-    static const SGPropertyNode *longitude
-        = fgGetNode("/position/longitude-deg");
-    static const SGPropertyNode *latitude
-        = fgGetNode("/position/latitude-deg");
-    static const SGPropertyNode *altitude
-        = fgGetNode("/position/altitude-ft");
+    // static const SGPropertyNode *longitude
+    //     = fgGetNode("/position/longitude-deg");
+    // static const SGPropertyNode *latitude
+    //     = fgGetNode("/position/latitude-deg");
+    // static const SGPropertyNode *altitude
+    //     = fgGetNode("/position/altitude-ft");
     static const SGPropertyNode *groundlevel_nearplane
         = fgGetNode("/sim/current-view/ground-level-nearplane-m");
 
@@ -1277,7 +1277,7 @@ static void fgMainLoop( void ) {
                                                  visibility_meters );
         globals->get_tile_mgr()->
             update( acmodel_location, visibility_meters,
-                    acmodel_location->get_absolute_view_pos() );
+                    acmodel_location->get_absolute_view_pos(globals->get_scenery()->get_center()) );
         // save results of update in FGLocation for fdm...
         if ( globals->get_scenery()->get_cur_elev() > -9990 ) {
           acmodel_location->
@@ -1955,7 +1955,7 @@ void fgLoadDCS(void) {
 
                 if ( strcmp(obj_filename,"repeat") != 0) {
                     ship_obj =
-                        globals->get_model_loader()->load_model( obj_filename );
+                      globals->get_model_loader()->load_model( globals->get_fg_root(), obj_filename, globals->get_props(), globals->get_sim_time_sec() );
                 }
       
                 if ( ship_obj != NULL ) {
@@ -1976,11 +1976,11 @@ void fgLoadDCS(void) {
                             // temporary hack for deck lights - ultimately should move to PLib (when??)
                             //const char *extn = file_extension ( obj_filename ) ;
                             if ( objc == 1 ){
-                                ssgVertexArray *lights = new ssgVertexArray( 100 );
+                                // ssgVertexArray *lights = new ssgVertexArray( 100 );
                                ssgVertexArray *lightpoints = new ssgVertexArray( 100 );
                                ssgVertexArray *lightnormals = new ssgVertexArray( 100 );
                                ssgVertexArray *lightdir = new ssgVertexArray( 100 );
-                               int ltype[500], light_type;
+                               int ltype[500], light_type = 0;
                                static int ltcount = 0;
                                 string token;
                                sgVec3 rway_dir,rway_normal,lightpt;
index 8fbaea6d4b59f209c05307173e339c5bc74c75fb..fd7b133125bd818c2b73f02c0a0caddee7d2056e 100644 (file)
@@ -485,7 +485,8 @@ FGViewer::updateFromModelLocation (FGLocation * location)
 void
 FGViewer::updateAtModelLocation (FGLocation * location)
 {
-  sgCopyMat4(ATLOCAL, location->getCachedTransformMatrix());
+  sgCopyMat4(ATLOCAL, 
+             location->getCachedTransformMatrix());
 }
 
 void
@@ -495,7 +496,8 @@ FGViewer::recalcOurOwnLocation (FGLocation * location, double lon_deg, double la
   // update from our own data...
   location->setPosition( lon_deg, lat_deg, alt_ft );
   location->setOrientation( roll_deg, pitch_deg, heading_deg );
-  sgCopyMat4(LOCAL, location->getTransformMatrix());
+  sgCopyMat4(LOCAL,
+             location->getTransformMatrix(globals->get_scenery()->get_center()));
 }
 
 // recalc() is done every time one of the setters is called (making the 
@@ -519,7 +521,7 @@ FGViewer::recalcLookFrom ()
 {
 
   sgVec3 right, forward;
-  sgVec3 eye_pos;
+  // sgVec3 eye_pos;
   sgVec3 position_offset; // eye position offsets (xyz)
 
   // LOOKFROM mode...
@@ -606,7 +608,9 @@ FGViewer::recalcLookAt ()
   // calculate the "at" target object positon relative to eye or view's tile center...
   sgdVec3 dVec3;
   sgdSetVec3(dVec3,  _location->get_tile_center()[0], _location->get_tile_center()[1], _location->get_tile_center()[2]);
-  sgdSubVec3(dVec3, _target_location->get_absolute_view_pos(), dVec3 );
+  sgdSubVec3(dVec3,
+             _target_location->get_absolute_view_pos(globals->get_scenery()->get_center()),
+             dVec3 );
   sgSetVec3(at_pos, dVec3[0], dVec3[1], dVec3[2]);
 
   // Update location data for eye...
@@ -668,7 +672,8 @@ FGViewer::copyLocationData()
   // Get our friendly vectors from the eye location...
   sgCopyVec3(_zero_elev_view_pos,  _location->get_zero_elev());
   sgCopyVec3(_relative_view_pos, _location->get_view_pos());
-  sgdCopyVec3(_absolute_view_pos, _location->get_absolute_view_pos());
+  sgdCopyVec3(_absolute_view_pos,
+              _location->get_absolute_view_pos(globals->get_scenery()->get_center()));
   sgCopyMat4(UP, _location->getCachedUpMatrix());
   sgCopyVec3(_world_up, _location->get_world_up());
   // these are the vectors that the sun and moon code like to get...
index 52cb51f37c45569785bdfb4bf9b4cee1898ad18e..291f4a4913ace6bb19dbb4764d5579caf5002061 100644 (file)
 
 #include <simgear/compiler.h>
 #include <simgear/constants.h>
+#include <simgear/scene/model/location.hxx>
 
 #include <plib/sg.h>           // plib include
 
 #include "fgfs.hxx"
 
-#include <Main/location.hxx>
-
 #define FG_FOV_MIN 0.1
 #define FG_FOV_MAX 179.9
 
index 786a6ba0775872ccbb6a08f5721f34a59c7f4f9f..a39b76a3f8c74d9f7d6b3846e3ca5aeaec45a096 100644 (file)
@@ -54,11 +54,17 @@ FGAircraftModel::init ()
   _aircraft = new FGModelPlacement;
   string path = fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
   try {
-    _aircraft->init(path);
+    _aircraft->init( globals->get_fg_root(),
+                     path,
+                     globals->get_props(),
+                     globals->get_sim_time_sec() );
   } catch (const sg_exception &ex) {
     SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load aircraft from " << path);
     SG_LOG(SG_GENERAL, SG_ALERT, "(Falling back to glider.ac.)");
-    _aircraft->init("Models/Geometry/glider.ac");
+    _aircraft->init( globals->get_fg_root(),
+                     "Models/Geometry/glider.ac",
+                     globals->get_props(),
+                     globals->get_sim_time_sec() );
   }
   _scene->addKid(_aircraft->getSceneGraph());
   _selector->addKid(_aircraft->getSceneGraph());
@@ -94,7 +100,7 @@ FGAircraftModel::update (double dt)
   _aircraft->setOrientation(fgGetDouble("/orientation/roll-deg"),
                            fgGetDouble("/orientation/pitch-deg"),
                            fgGetDouble("/orientation/heading-deg"));
-  _aircraft->update();
+  _aircraft->update( globals->get_scenery()->get_center() );
 
 }
 
index 5fcd8360e5d605c91105259f29aecff02e73d008..0902bd8b12929425f79e6448b4961c53ef4f51c0 100644 (file)
@@ -5,7 +5,7 @@
 #endif
 
 #include <simgear/compiler.h>
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
 
 #include "loader.hxx"
 #include "model.hxx"
@@ -61,13 +61,16 @@ FGModelLoader::~FGModelLoader ()
 }
 
 ssgEntity *
-FGModelLoader::load_model (const string &path)
+FGModelLoader::load_model( const string &fg_root,
+                           const string &path,
+                           SGPropertyNode *prop_root,
+                           double sim_time_sec )
 {
                                 // FIXME: normalize path to
                                 // avoid duplicates.
     std::map<string, ssgBase *>::iterator it = _table.find(path);
     if (it == _table.end()) {
-        _table[path] = fgLoad3DModel((char *)path.c_str());
+        _table[path] = fgLoad3DModel( fg_root, path, prop_root, sim_time_sec );
         it = _table.find(path);
         it->second->ref();      // add one reference to keep it around
     }
@@ -89,7 +92,7 @@ FGTextureLoader::~FGTextureLoader ()
 }
 
 ssgTexture *
-FGTextureLoader::load_texture (const string &path)
+FGTextureLoader::load_texture( const string &fg_root, const string &path )
 {
     std::map<string, ssgBase *>::iterator it = _table.find(path);
     if (it == _table.end()) {
index 956e6bdcd4a18d55d277cc87cca2c2a745c3e51d..6606efb06160afe299db0c5f22d8d24a4ba30f44 100644 (file)
@@ -39,7 +39,10 @@ public:
     FGModelLoader ();
     virtual ~FGModelLoader ();
 
-    virtual ssgEntity * load_model (const string &path);
+    virtual ssgEntity * load_model( const string &fg_root,
+                                    const string &path,
+                                    SGPropertyNode *prop_root,
+                                    double sim_time_sec );
 };
 
 
@@ -52,7 +55,8 @@ public:
     FGTextureLoader ();
     virtual ~FGTextureLoader ();
 
-    virtual ssgTexture * load_texture (const string &path);
+    virtual ssgTexture * load_texture( const string &fg_root,
+                                       const string &path );
 };
 
 #endif
index 8160ccf06fa6a64b820bb3bdd56797bd16d0ccc7..254bc0731000200d738b2049005c0c319f42432f 100644 (file)
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/misc/exception.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/props/condition.hxx>
+#include <simgear/props/props_io.hxx>
+#include <simgear/scene/model/location.hxx>
 
-#include <Main/fg_props.hxx>
-#include <Main/globals.hxx>
-#include <Main/location.hxx>
-#include <Scenery/scenery.hxx>
+// #include <Main/fg_props.hxx>
+// #include <Main/globals.hxx>
+// #include <Scenery/scenery.hxx>
 
 #include "model.hxx"
 #include "panelnode.hxx"
@@ -177,7 +179,9 @@ static void
 make_animation (ssgBranch * model,
                 const char * name,
                 vector<SGPropertyNode_ptr> &name_nodes,
-                SGPropertyNode_ptr node)
+                SGPropertyNode *prop_root,
+                SGPropertyNode_ptr node,
+                double sim_time_sec )
 {
   Animation * animation = 0;
   const char * type = node->getStringValue("type", "none");
@@ -188,15 +192,15 @@ make_animation (ssgBranch * model,
   } else if (!strcmp("billboard", type)) {
     animation = new BillboardAnimation(node);
   } else if (!strcmp("select", type)) {
-    animation = new SelectAnimation(node);
+    animation = new SelectAnimation(prop_root, node);
   } else if (!strcmp("spin", type)) {
-    animation = new SpinAnimation(node);
+    animation = new SpinAnimation(prop_root, node, sim_time_sec );
   } else if (!strcmp("timed", type)) {
     animation = new TimedAnimation(node);
   } else if (!strcmp("rotate", type)) {
-    animation = new RotateAnimation(node);
+    animation = new RotateAnimation(prop_root, node);
   } else if (!strcmp("translate", type)) {
-    animation = new TranslateAnimation(node);
+    animation = new TranslateAnimation(prop_root, node);
   } else {
     animation = new NullAnimation(node);
     SG_LOG(SG_INPUT, SG_WARN, "Unknown animation type " << type);
@@ -221,7 +225,7 @@ make_animation (ssgBranch * model,
   ssgBranch * branch = animation->getBranch();
   splice_branch(branch, object);
 
-  for (int i = 1; i < name_nodes.size(); i++) {
+  for (unsigned int i = 1; i < name_nodes.size(); i++) {
       const char * name = name_nodes[i]->getStringValue();
       object = find_named_node(model, name);
       if (object == 0) {
@@ -246,7 +250,9 @@ make_animation (ssgBranch * model,
 ////////////////////////////////////////////////////////////////////////
 
 ssgBranch *
-fgLoad3DModel (const string &path)
+fgLoad3DModel( const string &fg_root, const string &path,
+               SGPropertyNode *prop_root,
+               double sim_time_sec )
 {
   ssgBranch * model = 0;
   SGPropertyNode props;
@@ -258,7 +264,7 @@ fgLoad3DModel (const string &path)
     xmlpath = modelpath;
   }
   else {
-    xmlpath = globals->get_fg_root();
+    xmlpath = fg_root;
     xmlpath.append(modelpath.str());
   }
 
@@ -313,7 +319,8 @@ fgLoad3DModel (const string &path)
     const char * name = animation_nodes[i]->getStringValue("name", 0);
     vector<SGPropertyNode_ptr> name_nodes =
       animation_nodes[i]->getChildren("object-name");
-    make_animation(model, name, name_nodes, animation_nodes[i]);
+    make_animation( model, name, name_nodes, prop_root, animation_nodes[i],
+                    sim_time_sec);
   }
 
                                 // Load sub-models
@@ -331,7 +338,8 @@ fgLoad3DModel (const string &path)
                         node->getFloatValue("offsets/z-m", 0.0));
     align->setTransform(res_matrix);
 
-    ssgBranch * kid = fgLoad3DModel(node->getStringValue("path"));
+    ssgBranch * kid = fgLoad3DModel( fg_root, node->getStringValue("path"),
+                                     prop_root, sim_time_sec );
     align->addKid(kid);
     model->addKid(align);
   }
@@ -420,13 +428,14 @@ BillboardAnimation::~BillboardAnimation ()
 // Implementation of SelectAnimation
 ////////////////////////////////////////////////////////////////////////
 
-SelectAnimation::SelectAnimation (SGPropertyNode_ptr props)
+SelectAnimation::SelectAnimation( SGPropertyNode *prop_root,
+                                  SGPropertyNode_ptr props )
   : Animation(props, new ssgSelector),
     _condition(0)
 {
   SGPropertyNode_ptr node = props->getChild("condition");
   if (node != 0)
-    _condition = fgReadCondition(node);
+    _condition = fgReadCondition(prop_root, node);
 }
 
 SelectAnimation::~SelectAnimation ()
@@ -449,12 +458,14 @@ SelectAnimation::update ()
 // Implementation of SpinAnimation
 ////////////////////////////////////////////////////////////////////////
 
-SpinAnimation::SpinAnimation (SGPropertyNode_ptr props)
+SpinAnimation::SpinAnimation( SGPropertyNode *prop_root,
+                              SGPropertyNode_ptr props,
+                              double sim_time_sec )
   : Animation(props, new ssgTransform),
-    _prop(fgGetNode(props->getStringValue("property", "/null"), true)),
+    _prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)),
     _factor(props->getDoubleValue("factor", 1.0)),
     _position_deg(props->getDoubleValue("starting-position-deg", 0)),
-    _last_time_sec(globals->get_sim_time_sec())
+    _last_time_sec( sim_time_sec /* globals->get_sim_time_sec() */ )
 {
     _center[0] = props->getFloatValue("center/x-m", 0);
     _center[1] = props->getFloatValue("center/y-m", 0);
@@ -470,11 +481,10 @@ SpinAnimation::~SpinAnimation ()
 }
 
 void
-SpinAnimation::update ()
+SpinAnimation::update( double sim_time_sec )
 {
-  double sim_time = globals->get_sim_time_sec();
-  double dt = sim_time - _last_time_sec;
-  _last_time_sec = sim_time;
+  double dt = sim_time_sec - _last_time_sec;
+  _last_time_sec = sim_time_sec;
 
   float velocity_rpms = (_prop->getDoubleValue() * _factor / 60.0);
   _position_deg += (dt * velocity_rpms * 360);
@@ -505,9 +515,8 @@ TimedAnimation::~TimedAnimation ()
 }
 
 void
-TimedAnimation::update ()
+TimedAnimation::update( double sim_time_sec )
 {
-    float sim_time_sec = globals->get_sim_time_sec();
     if ((sim_time_sec - _last_time_sec) >= _duration_sec) {
         _last_time_sec = sim_time_sec;
         _step++;
@@ -523,9 +532,10 @@ TimedAnimation::update ()
 // Implementation of RotateAnimation
 ////////////////////////////////////////////////////////////////////////
 
-RotateAnimation::RotateAnimation (SGPropertyNode_ptr props)
+RotateAnimation::RotateAnimation( SGPropertyNode *prop_root,
+                                  SGPropertyNode_ptr props )
     : Animation(props, new ssgTransform),
-      _prop(fgGetNode(props->getStringValue("property", "/null"), true)),
+      _prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)),
       _offset_deg(props->getDoubleValue("offset-deg", 0.0)),
       _factor(props->getDoubleValue("factor", 1.0)),
       _table(read_interpolation_table(props)),
@@ -550,7 +560,7 @@ RotateAnimation::~RotateAnimation ()
 }
 
 void
-RotateAnimation::update ()
+RotateAnimation::update()
 {
   if (_table == 0) {
    _position_deg = _prop->getDoubleValue() * _factor + _offset_deg;
@@ -571,9 +581,10 @@ RotateAnimation::update ()
 // Implementation of TranslateAnimation
 ////////////////////////////////////////////////////////////////////////
 
-TranslateAnimation::TranslateAnimation (SGPropertyNode_ptr props)
+TranslateAnimation::TranslateAnimation( SGPropertyNode *prop_root,
+                                        SGPropertyNode_ptr props )
   : Animation(props, new ssgTransform),
-    _prop(fgGetNode(props->getStringValue("property", "/null"), true)),
+      _prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)),
     _offset_m(props->getDoubleValue("offset-m", 0.0)),
     _factor(props->getDoubleValue("factor", 1.0)),
     _table(read_interpolation_table(props)),
@@ -634,9 +645,12 @@ FGModelPlacement::~FGModelPlacement ()
 }
 
 void
-FGModelPlacement::init (const string &path)
+FGModelPlacement::init( const string &fg_root,
+                        const string &path,
+                        SGPropertyNode *prop_root,
+                        double sim_time_sec )
 {
-  ssgBranch * model = fgLoad3DModel(path);
+  ssgBranch * model = fgLoad3DModel( fg_root, path, prop_root, sim_time_sec );
   if (model != 0)
       _position->addKid(model);
   _selector->addKid(_position);
@@ -644,12 +658,12 @@ FGModelPlacement::init (const string &path)
 }
 
 void
-FGModelPlacement::update ()
+FGModelPlacement::update( const Point3D scenery_center )
 {
   _location->setPosition( _lon_deg, _lat_deg, _elev_ft );
   _location->setOrientation( _roll_deg, _pitch_deg, _heading_deg );
 
-  sgCopyMat4(POS, _location->getTransformMatrix());
+  sgCopyMat4( POS, _location->getTransformMatrix(scenery_center) );
 
   sgVec3 trans;
   sgCopyVec3(trans, _location->get_view_pos());
index 313a5d9d3136fff7b9c473ba91f0d40a5bfa3a19..e3cbe1d56840722ccee2bbed014eefef46c7ed02 100644 (file)
@@ -17,7 +17,8 @@ SG_USING_STD(vector);
 #include <plib/sg.h>
 #include <plib/ssg.h>
 
-#include <simgear/misc/props.hxx>
+#include <simgear/math/point3d.hxx>
+#include <simgear/props/props.hxx>
 
 
 // Don't pull in the headers, since we don't need them here.
@@ -51,7 +52,9 @@ class FGLocation;
  * Subsystems should not normally invoke this function directly;
  * instead, they should use the FGModelLoader declared in loader.hxx.
  */
-ssgBranch * fgLoad3DModel (const string &path);
+ssgBranch * fgLoad3DModel( const string& fg_root, const string &path,
+                           SGPropertyNode *prop_root,
+                           double sim_time_sec );
 
 
 \f
@@ -131,7 +134,8 @@ public:
 class SelectAnimation : public Animation
 {
 public:
-  SelectAnimation (SGPropertyNode_ptr props);
+  SelectAnimation( SGPropertyNode *prop_root,
+                   SGPropertyNode_ptr props );
   virtual ~SelectAnimation ();
   virtual void update ();
 private:
@@ -147,9 +151,11 @@ private:
 class SpinAnimation : public Animation
 {
 public:
-  SpinAnimation (SGPropertyNode_ptr props);
+  SpinAnimation( SGPropertyNode *prop_root,
+                 SGPropertyNode_ptr props,
+                 double sim_time_sec );
   virtual ~SpinAnimation ();
-  virtual void update ();
+  virtual void update( double sim_time_sec );
 private:
   SGPropertyNode_ptr _prop;
   double _factor;
@@ -169,7 +175,7 @@ class TimedAnimation : public Animation
 public:
     TimedAnimation (SGPropertyNode_ptr props);
     virtual ~TimedAnimation ();
-    virtual void update ();
+    virtual void update( double sim_time_sec );
 private:
     double _duration_sec;
     double _last_time_sec;
@@ -185,9 +191,9 @@ private:
 class RotateAnimation : public Animation
 {
 public:
-  RotateAnimation (SGPropertyNode_ptr props);
+  RotateAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props );
   virtual ~RotateAnimation ();
-  virtual void update ();
+  virtual void update();
 private:
   SGPropertyNode_ptr _prop;
   double _offset_deg;
@@ -210,7 +216,8 @@ private:
 class TranslateAnimation : public Animation
 {
 public:
-  TranslateAnimation (SGPropertyNode_ptr props);
+  TranslateAnimation( SGPropertyNode *prop_root,
+                      SGPropertyNode_ptr props );
   virtual ~TranslateAnimation ();
   virtual void update ();
 private:
@@ -243,8 +250,11 @@ public:
   FGModelPlacement ();
   virtual ~FGModelPlacement ();
 
-  virtual void init (const string &path);
-  virtual void update ();
+  virtual void init( const string &fg_root,
+                     const string &path,
+                     SGPropertyNode *prop_root,
+                     double sim_time_sec );
+  virtual void update( const Point3D scenery_center );
 
   virtual ssgEntity * getSceneGraph () { return (ssgEntity *)_selector; }
 
index 29693ecf1e11ef2218fa28c2966cbcf99242733e..609f7abdfbdf8ebd98c8f3ddefc02c7a6fc56db9 100644 (file)
@@ -38,7 +38,10 @@ FGModelMgr::init ()
     Instance * instance = new Instance;
     FGModelPlacement * model = new FGModelPlacement;
     instance->model = model;
-    model->init(node->getStringValue("path", "Models/Geometry/glider.ac"));
+    model->init( globals->get_fg_root(),
+                 node->getStringValue("path", "Models/Geometry/glider.ac"),
+                 globals->get_props(),
+                 globals->get_sim_time_sec() );
 
                                // Set position and orientation either
                                // indirectly through property refs
@@ -120,7 +123,7 @@ FGModelMgr::update (double dt)
     if (instance->heading_deg_node != 0)
       model->setHeadingDeg(instance->heading_deg_node->getDoubleValue());
 
-    instance->model->update();
+    instance->model->update( globals->get_scenery()->get_center() );
   }
 }
 
index b257a3bee2884fe1828ff07a8fd32d5c202b2089..30f2e4a6c7cb9c68d72b05da105480353140af97 100644 (file)
 // Static (!) handling for all 3D panels in the program.  Very
 // clumsy.  Replace with per-aircraft handling.
 vector<FGPanelNode*> all_3d_panels;
-bool fgHandle3DPanelMouseEvent(int button, int updown, int x, int y)
+bool fgHandle3DPanelMouseEvent( int button, int updown, int x, int y )
 {
-    for(int i=0; i<all_3d_panels.size(); i++)
-        if(all_3d_panels[i]->doMouseAction(button, updown, x, y))
+    for ( unsigned int i = 0; i < all_3d_panels.size(); i++ ) {
+        if ( all_3d_panels[i]->doMouseAction(button, updown, x, y) ) {
             return true;
+        }
+    }
     return false;
 }
 
 void fgUpdate3DPanels()
 {
-    for(int i=0; i<all_3d_panels.size(); i++)
+    for ( unsigned int i = 0; i < all_3d_panels.size(); i++ ) {
         all_3d_panels[i]->getPanel()->updateMouseDelay();
+    }
 }
 
 FGPanelNode::FGPanelNode(SGPropertyNode* props)