diff --git a/README.OSG b/README.OSG index b44695ad3..d547ffecc 100644 --- a/README.OSG +++ b/README.OSG @@ -3,11 +3,7 @@ You *must* have OpenSceneGraph (OSG) installed to build this version of FlightGear. -Notice that from FlightGear version 1.9.0, OSG version 2.7.8 or later -is required. Using earlier versions of OSG will yield serious -rendering bugs. If you are using an 'older' distribution, this may mean -a suitable version of OSG may not be availble through the usual package -repositories. +Notice that FlightGear 2.6.0 requires at least version 3.0.0. You can get the latest version of OSG from: diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index 93b8c1760..69442229c 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -267,7 +267,7 @@ bool FGAIBase::init(bool search_in_AI_path) { else _installed = true; - osg::Node * mdl = SGModelLib::loadPagedModel(f, props, new FGNasalModelData(props)); + osg::Node * mdl = SGModelLib::loadDeferredModel(f, props, new FGNasalModelData(props)); if (_model.valid()) { diff --git a/src/GUI/MapWidget.cxx b/src/GUI/MapWidget.cxx index 390668510..e166e24a6 100644 --- a/src/GUI/MapWidget.cxx +++ b/src/GUI/MapWidget.cxx @@ -374,7 +374,7 @@ int MapData::_fontDescender = 0; /////////////////////////////////////////////////////////////////////////// -const int MAX_ZOOM = 16; +const int MAX_ZOOM = 12; const int SHOW_DETAIL_ZOOM = 8; const int CURSOR_PAN_STEP = 32; @@ -403,11 +403,13 @@ MapWidget::~MapWidget() void MapWidget::setProperty(SGPropertyNode_ptr prop) { _root = prop; - int zoom = _root->getBoolValue("zoom", -1); + int zoom = _root->getIntValue("zoom", -1); if (zoom < 0) { _root->setIntValue("zoom", 6); // default zoom } +// expose MAX_ZOOM to the UI + _root->setIntValue("max-zoom", MAX_ZOOM); _root->setBoolValue("centre-on-aircraft", true); _root->setBoolValue("draw-data", false); _root->setBoolValue("magnetic-headings", true); @@ -515,15 +517,6 @@ int MapWidget::zoom() const } void MapWidget::zoomIn() -{ - if (zoom() <= 0) { - return; - } - - _root->setIntValue("zoom", zoom() - 1); -} - -void MapWidget::zoomOut() { if (zoom() >= MAX_ZOOM) { return; @@ -532,6 +525,15 @@ void MapWidget::zoomOut() _root->setIntValue("zoom", zoom() + 1); } +void MapWidget::zoomOut() +{ + if (zoom() <= 0) { + return; + } + + _root->setIntValue("zoom", zoom() - 1); +} + void MapWidget::draw(int dx, int dy) { _aircraft = SGGeod::fromDeg(fgGetDouble("/position/longitude-deg"), @@ -561,7 +563,7 @@ void MapWidget::draw(int dx, int dy) _upHeading = 0.0; } - _cachedZoom = zoom(); + _cachedZoom = MAX_ZOOM - zoom(); SGGeod topLeft = unproject(SGVec2d(_width/2, _height/2)); // compute draw range, including a fudge factor for ILSs and other 'long' // symbols diff --git a/src/Main/options.cxx b/src/Main/options.cxx index bcb5ccdad..5bd6820e6 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1560,6 +1560,10 @@ public: { OptionValueVec::const_iterator it = values.begin(); for (; it != values.end(); ++it) { + if (!it->desc) { + continue; // ignore markers + } + if (it->desc->option == key) { return it; } @@ -1580,6 +1584,10 @@ public: int processOption(OptionDesc* desc, const string& arg_value) { + if (!desc) { + return FG_OPTIONS_OK; // tolerate marker options + } + switch ( desc->type & 0xffff ) { case OPTION_BOOL: fgSetBool( desc->property, desc->b_param ); @@ -1647,10 +1655,36 @@ public: return FG_OPTIONS_OK; } + + /** + * insert a marker value into the values vector. This is necessary + * when processing options, to ensure the correct ordering, where we scan + * for marker values in reverse, and then forwards within each group. + */ + void insertGroupMarker() + { + values.push_back(OptionValue(NULL, "-")); + } + + /** + * given a current iterator into the values, find the preceeding group marker, + * or return the beginning of the value vector. + */ + OptionValueVec::const_iterator rfindGroup(OptionValueVec::const_iterator pos) const + { + while (--pos != values.begin()) { + if (pos->desc == NULL) { + return pos; // found a marker, we're done + } + } + + return pos; + } bool showHelp, verbose, showAircraft; + OptionDescDict options; OptionValueVec values; simgear::PathList propertyFiles; @@ -1710,6 +1744,7 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath) p->propertyFiles.push_back(f); } } // of arguments iteration + p->insertGroupMarker(); // command line is one group // then config files SGPath config; @@ -1850,6 +1885,7 @@ void Options::readConfig(const SGPath& path) in >> skipcomment; } + p->insertGroupMarker(); // each config file is a group } int Options::parseOption(const string& s) @@ -1898,6 +1934,7 @@ int Options::addOption(const string &key, const string &value) { OptionDesc* desc = p->findOption(key); if (!desc) { + SG_LOG(SG_GENERAL, SG_ALERT, "unknown option:" << key); return FG_OPTIONS_ERROR; } @@ -1934,6 +1971,10 @@ string_list Options::valuesForOption(const std::string& key) const string_list result; OptionValueVec::const_iterator it = p->values.begin(); for (; it != p->values.end(); ++it) { + if (!it->desc) { + continue; // ignore marker values + } + if (it->desc->option == key) { result.push_back(it->value); } @@ -1951,17 +1992,28 @@ void Options::processOptions() exit(0); } - // proces options in LIFO order, so earlier (first in) options are processed - // after, and hence override, later specified options. - OptionValueVec::const_reverse_iterator it = p->values.rbegin(); - for (; it != p->values.rend(); ++it) { - int result = p->processOption(it->desc, it->value); - if (result == FG_OPTIONS_ERROR) { - showUsage(); - exit(-1); + // processing order is complicated. We must process groups LIFO, but the + // values *within* each group in FIFO order, to retain consistency with + // older versions of FG, and existing user configs. + // in practice this means system.fgfsrc must be *processed* before + // .fgfsrc, which must be processed before the command line args, and so on. + OptionValueVec::const_iterator groupEnd = p->values.end(); + + while (groupEnd != p->values.begin()) { + OptionValueVec::const_iterator groupBegin = p->rfindGroup(groupEnd); + // run over the group in FIFO order + OptionValueVec::const_iterator it; + for (it = groupBegin; it != groupEnd; ++it) { + int result = p->processOption(it->desc, it->value); + if (result == FG_OPTIONS_ERROR) { + showUsage(); + exit(-1); + } } + + groupEnd = groupBegin; } - + BOOST_FOREACH(const SGPath& file, p->propertyFiles) { if (!file.exists()) { SG_LOG(SG_GENERAL, SG_ALERT, "config file not found:" << file.str()); diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index e511213f8..0e1c550c8 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -276,7 +276,7 @@ FGTileMgr::loadTileModel(const string& modelPath, bool cacheModel) new FGNasalModelData); else result= - SGModelLib::loadDeferedModel(fullPath.str(), globals->get_props(), + SGModelLib::loadDeferredModel(fullPath.str(), globals->get_props(), new FGNasalModelData); } catch (const sg_io_exception& exc) { string m(exc.getMessage()); diff --git a/src/Time/light.cxx b/src/Time/light.cxx index 74ee50f92..c43ec333f 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -149,7 +149,8 @@ void FGLight::bind () { prop->tie("/rendering/scene/overcast",SGRawValuePointer(&_overcast)); _sunAngleRad = prop->getNode("/sim/time/sun-angle-rad", true); - + _sunAngleRad->setDoubleValue(_sun_angle); + // Read Only prop->tie("/rendering/scene/ambient/red",SGRawValuePointer(&_scene_ambient[0])); prop->tie("/rendering/scene/ambient/green",SGRawValuePointer(&_scene_ambient[1]));