Merge branch 'next' of http://git.gitorious.org/fg/flightgear into next
This commit is contained in:
commit
67611bb6b0
10 changed files with 127 additions and 22 deletions
|
@ -100,7 +100,7 @@ find_package(Threads REQUIRED)
|
|||
find_package(OpenGL REQUIRED)
|
||||
find_package(OpenAL REQUIRED)
|
||||
find_package(ALUT REQUIRED)
|
||||
find_package(OpenSceneGraph 2.8.2 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
|
||||
find_package(OpenSceneGraph 2.8.1 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
|
||||
|
||||
if(ENABLE_FGADMIN)
|
||||
find_package(FLTK)
|
||||
|
|
82
CMakeModules/SelectLibraryConfigurations.cmake
Normal file
82
CMakeModules/SelectLibraryConfigurations.cmake
Normal file
|
@ -0,0 +1,82 @@
|
|||
# select_library_configurations( basename )
|
||||
#
|
||||
# This macro takes a library base name as an argument, and will choose good
|
||||
# values for basename_LIBRARY, basename_LIBRARIES, basename_LIBRARY_DEBUG, and
|
||||
# basename_LIBRARY_RELEASE depending on what has been found and set. If only
|
||||
# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG,
|
||||
# and basename_LIBRARY_RELEASE will be set to the release value. If only
|
||||
# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY,
|
||||
# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value.
|
||||
#
|
||||
# If the generator supports configuration types, then basename_LIBRARY and
|
||||
# basename_LIBRARIES will be set with debug and optimized flags specifying the
|
||||
# library to be used for the given configuration. If no build type has been set
|
||||
# or the generator in use does not support configuration types, then
|
||||
# basename_LIBRARY and basename_LIBRARIES will take only the release values.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2009 Kitware, Inc.
|
||||
# Copyright 2009 Will Dicharry <wdicharry@stellarscience.com>
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distributed this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# This macro was adapted from the FindQt4 CMake module and is maintained by Will
|
||||
# Dicharry <wdicharry@stellarscience.com>.
|
||||
|
||||
# Utility macro to check if one variable exists while another doesn't, and set
|
||||
# one that doesn't exist to the one that exists.
|
||||
macro( _set_library_name basename GOOD BAD )
|
||||
if( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} )
|
||||
set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} )
|
||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} )
|
||||
set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} )
|
||||
endif( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} )
|
||||
endmacro( _set_library_name )
|
||||
|
||||
macro( select_library_configurations basename )
|
||||
# if only the release version was found, set the debug to be the release
|
||||
# version.
|
||||
_set_library_name( ${basename} RELEASE DEBUG )
|
||||
# if only the debug version was found, set the release value to be the
|
||||
# debug value.
|
||||
_set_library_name( ${basename} DEBUG RELEASE )
|
||||
if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
|
||||
# if the generator supports configuration types or CMAKE_BUILD_TYPE
|
||||
# is set, then set optimized and debug options.
|
||||
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||
set( ${basename}_LIBRARY
|
||||
optimized ${${basename}_LIBRARY_RELEASE}
|
||||
debug ${${basename}_LIBRARY_DEBUG} )
|
||||
set( ${basename}_LIBRARIES
|
||||
optimized ${${basename}_LIBRARY_RELEASE}
|
||||
debug ${${basename}_LIBRARY_DEBUG} )
|
||||
else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||
# If there are no configuration types or build type, just use
|
||||
# the release version
|
||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
|
||||
set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} )
|
||||
endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||
endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
|
||||
|
||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
|
||||
"The ${basename} library" )
|
||||
|
||||
if( ${basename}_LIBRARY )
|
||||
set( ${basename}_FOUND TRUE )
|
||||
endif( ${basename}_LIBRARY )
|
||||
|
||||
mark_as_advanced( ${basename}_LIBRARY
|
||||
${basename}_LIBRARY_RELEASE
|
||||
${basename}_LIBRARY_DEBUG
|
||||
)
|
||||
endmacro( select_library_configurations )
|
||||
|
|
@ -84,6 +84,7 @@ FGAIAircraft::FGAIAircraft(FGAISchedule *ref) : FGAIBase(otAircraft) {
|
|||
|
||||
holdPos = false;
|
||||
needsTaxiClearance = false;
|
||||
_needsGroundElevation = true;
|
||||
|
||||
_performance = 0; //TODO initialize to JET_TRANSPORT from PerformanceDB
|
||||
dt = 0;
|
||||
|
@ -179,6 +180,8 @@ void FGAIAircraft::checkVisibility()
|
|||
|
||||
void FGAIAircraft::AccelTo(double speed) {
|
||||
tgt_speed = speed;
|
||||
if (!isStationary())
|
||||
_needsGroundElevation = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -334,7 +337,7 @@ void FGAIAircraft::ProcessFlightPlan( double dt, time_t now ) {
|
|||
use_perf_vs = true;
|
||||
}
|
||||
}
|
||||
tgt_speed = prev->speed;
|
||||
AccelTo(prev->speed);
|
||||
hdg_lock = alt_lock = true;
|
||||
no_roll = prev->on_ground;
|
||||
}
|
||||
|
@ -403,6 +406,8 @@ bool FGAIAircraft::loadNextLeg(double distance) {
|
|||
void FGAIAircraft::getGroundElev(double dt) {
|
||||
dt_elev_count += dt;
|
||||
|
||||
if (!needGroundElevation())
|
||||
return;
|
||||
// Update minimally every three secs, but add some randomness
|
||||
// to prevent all AI objects doing this in synchrony
|
||||
if (dt_elev_count < (3.0) + (rand() % 10))
|
||||
|
@ -424,14 +429,22 @@ void FGAIAircraft::getGroundElev(double dt) {
|
|||
{
|
||||
double alt;
|
||||
if (getGroundElevationM(SGGeod::fromGeodM(pos, 20000), alt, 0))
|
||||
{
|
||||
tgt_altitude_ft = alt * SG_METER_TO_FEET;
|
||||
if (isStationary())
|
||||
{
|
||||
// aircraft is stationary and we obtained altitude for this spot - we're done.
|
||||
_needsGroundElevation = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FGAIAircraft::doGroundAltitude() {
|
||||
if (fabs(altitude_ft - (tgt_altitude_ft+groundOffset)) > 1000.0)
|
||||
if ((fabs(altitude_ft - (tgt_altitude_ft+groundOffset)) > 1000.0)||
|
||||
(isStationary()))
|
||||
altitude_ft = (tgt_altitude_ft + groundOffset);
|
||||
else
|
||||
altitude_ft += 0.1 * ((tgt_altitude_ft+groundOffset) - altitude_ft);
|
||||
|
@ -601,6 +614,7 @@ void FGAIAircraft::handleFirstWaypoint() {
|
|||
Transform(); // make sure aip is initialized.
|
||||
getGroundElev(60.1); // make sure it's executed first time around, so force a large dt value
|
||||
doGroundAltitude();
|
||||
_needsGroundElevation = true; // check ground elevation again (maybe scenery wasn't available yet)
|
||||
}
|
||||
// Make sure to announce the aircraft's position
|
||||
announcePositionToController();
|
||||
|
|
|
@ -141,6 +141,8 @@ private:
|
|||
void updateActualState();
|
||||
void handleATCRequests();
|
||||
void checkVisibility();
|
||||
inline bool isStationary() { return ((fabs(speed)<=0.0001)&&(fabs(tgt_speed)<=0.0001));}
|
||||
inline bool needGroundElevation() { if (!isStationary()) _needsGroundElevation=true;return _needsGroundElevation;}
|
||||
|
||||
double sign(double x);
|
||||
|
||||
|
@ -160,6 +162,7 @@ private:
|
|||
|
||||
bool reachedWaypoint;
|
||||
bool needsTaxiClearance;
|
||||
bool _needsGroundElevation;
|
||||
time_t timeElapsed;
|
||||
|
||||
PerformanceData* _performance; // the performance data for this aircraft
|
||||
|
|
|
@ -101,6 +101,7 @@ ADF::init ()
|
|||
_bearing_node = node->getChild("indicated-bearing-deg", 0, true);
|
||||
_ident_node = node->getChild("ident", 0, true);
|
||||
_ident_audible_node = node->getChild("ident-audible", 0, true);
|
||||
_power_btn_node = node->getChild("power-btn", 0, true);
|
||||
|
||||
SGSoundMgr *smgr = globals->get_soundmgr();
|
||||
_sgr = smgr->find("avionics", true);
|
||||
|
@ -117,13 +118,19 @@ void
|
|||
ADF::update (double delta_time_sec)
|
||||
{
|
||||
// If it's off, don't waste any time.
|
||||
if (_electrical_node->getDoubleValue() < 1.0
|
||||
|| !_serviceable_node->getBoolValue()) {
|
||||
set_bearing(delta_time_sec, 90);
|
||||
if (_electrical_node->getDoubleValue() < 8.0
|
||||
|| !_serviceable_node->getBoolValue()
|
||||
|| !_power_btn_node->getBoolValue() ) {
|
||||
_ident_node->setStringValue("");
|
||||
return;
|
||||
}
|
||||
|
||||
string mode = _mode_node->getStringValue();
|
||||
if (mode == "ant" || mode == "test") set_bearing(delta_time_sec, 90);
|
||||
if (mode != "bfo" && mode != "adf") {
|
||||
_ident_node->setStringValue("");
|
||||
return;
|
||||
}
|
||||
// Get the frequency
|
||||
int frequency_khz = _frequency_node->getIntValue();
|
||||
if (frequency_khz != _last_frequency_khz) {
|
||||
|
@ -144,11 +151,7 @@ ADF::update (double delta_time_sec)
|
|||
if (_time_before_search_sec < 0)
|
||||
search(frequency_khz, longitude_rad, latitude_rad, altitude_m);
|
||||
|
||||
// If it's off, don't bother.
|
||||
string mode = _mode_node->getStringValue();
|
||||
if (!_transmitter_valid || (mode != "bfo" && mode != "adf"))
|
||||
{
|
||||
set_bearing(delta_time_sec, 90);
|
||||
if (!_transmitter_valid) {
|
||||
_ident_node->setStringValue("");
|
||||
return;
|
||||
}
|
||||
|
@ -208,7 +211,6 @@ ADF::update (double delta_time_sec)
|
|||
}
|
||||
} else {
|
||||
_in_range_node->setBoolValue(false);
|
||||
set_bearing(delta_time_sec, 90);
|
||||
_ident_node->setStringValue("");
|
||||
_sgr->stop( _adf_ident );
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ private:
|
|||
SGPropertyNode_ptr _ident_node;
|
||||
SGPropertyNode_ptr _ident_audible_node;
|
||||
SGPropertyNode_ptr _volume_node;
|
||||
SGPropertyNode_ptr _power_btn_node;
|
||||
|
||||
double _time_before_search_sec;
|
||||
|
||||
|
|
|
@ -185,8 +185,8 @@ fgSetDefaults ()
|
|||
|
||||
// Features
|
||||
fgSetBool("/sim/hud/color/antialiased", false);
|
||||
fgSetBool("/sim/hud/enable3d", true);
|
||||
fgSetBool("/sim/hud/visibility", false);
|
||||
fgSetBool("/sim/hud/enable3d[1]", true);
|
||||
fgSetBool("/sim/hud/visibility[1]", false);
|
||||
fgSetBool("/sim/panel/visibility", true);
|
||||
fgSetBool("/sim/sound/enabled", true);
|
||||
fgSetBool("/sim/sound/working", true);
|
||||
|
@ -1342,16 +1342,16 @@ struct OptionDesc {
|
|||
{"enable-fuel-freeze", false, OPTION_BOOL, "/sim/freeze/fuel", true, "", 0 },
|
||||
{"disable-clock-freeze", false, OPTION_BOOL, "/sim/freeze/clock", false, "", 0 },
|
||||
{"enable-clock-freeze", false, OPTION_BOOL, "/sim/freeze/clock", true, "", 0 },
|
||||
{"disable-hud-3d", false, OPTION_BOOL, "/sim/hud/enable3d", false, "", 0 },
|
||||
{"enable-hud-3d", false, OPTION_BOOL, "/sim/hud/enable3d", true, "", 0 },
|
||||
{"disable-hud-3d", false, OPTION_BOOL, "/sim/hud/enable3d[1]", false, "", 0 },
|
||||
{"enable-hud-3d", false, OPTION_BOOL, "/sim/hud/enable3d[1]", true, "", 0 },
|
||||
{"disable-anti-alias-hud", false, OPTION_BOOL, "/sim/hud/color/antialiased", false, "", 0 },
|
||||
{"enable-anti-alias-hud", false, OPTION_BOOL, "/sim/hud/color/antialiased", true, "", 0 },
|
||||
{"control", true, OPTION_STRING, "/sim/control-mode", false, "", 0 },
|
||||
{"disable-auto-coordination", false, OPTION_BOOL, "/sim/auto-coordination", false, "", 0 },
|
||||
{"enable-auto-coordination", false, OPTION_BOOL, "/sim/auto-coordination", true, "", 0 },
|
||||
{"browser-app", true, OPTION_STRING, "/sim/startup/browser-app", false, "", 0 },
|
||||
{"disable-hud", false, OPTION_BOOL, "/sim/hud/visibility", false, "", 0 },
|
||||
{"enable-hud", false, OPTION_BOOL, "/sim/hud/visibility", true, "", 0 },
|
||||
{"disable-hud", false, OPTION_BOOL, "/sim/hud/visibility[1]", false, "", 0 },
|
||||
{"enable-hud", false, OPTION_BOOL, "/sim/hud/visibility[1]", true, "", 0 },
|
||||
{"disable-panel", false, OPTION_BOOL, "/sim/panel/visibility", false, "", 0 },
|
||||
{"enable-panel", false, OPTION_BOOL, "/sim/panel/visibility", true, "", 0 },
|
||||
{"disable-sound", false, OPTION_BOOL, "/sim/sound/working", false, "", 0 },
|
||||
|
|
|
@ -190,7 +190,7 @@ static naRef f_getprop(naContext c, naRef me, int argc, naRef* args)
|
|||
double dv = p->getDoubleValue();
|
||||
if (osg::isNaN(dv)) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "Nasal getprop: property " << p->getPath() << " is NaN");
|
||||
naRuntimeError(c, "getprop() would have read NaN");
|
||||
return naNil();
|
||||
}
|
||||
|
||||
return naNum(dv);
|
||||
|
|
|
@ -173,7 +173,7 @@ static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
|
|||
double dv = (*node)->getDoubleValue();
|
||||
if (osg::isNaN(dv)) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "Nasal getValue: property " << (*node)->getPath() << " is NaN");
|
||||
naRuntimeError(c, "props.getValue() would have read NaN");
|
||||
return naNil();
|
||||
}
|
||||
|
||||
return naNum(dv);
|
||||
|
|
|
@ -4,30 +4,32 @@ add_executable(MIDGsmooth MIDG-II.cxx MIDG_main.cxx)
|
|||
add_executable(UGsmooth UGear.cxx UGear_command.cxx UGear_main.cxx UGear_telnet.cxx)
|
||||
|
||||
target_link_libraries(GPSsmooth
|
||||
${SIMGEAR_DEBUG_LIBRARY}
|
||||
${SIMGEAR_IO_LIBRARY}
|
||||
${SIMGEAR_MISC_LIBRARY}
|
||||
${SIMGEAR_STRUCTURE_LIBRARY}
|
||||
${SIMGEAR_TIMING_LIBRARY}
|
||||
${SIMGEAR_DEBUG_LIBRARY}
|
||||
${PLIB_SG_LIBRARY}
|
||||
${PLIB_UL_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
${WINMM_LIBRARY}
|
||||
${WINSOCK_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
${RT_LIBRARY}
|
||||
)
|
||||
|
||||
target_link_libraries(MIDGsmooth
|
||||
${SIMGEAR_DEBUG_LIBRARY}
|
||||
${SIMGEAR_IO_LIBRARY}
|
||||
${SIMGEAR_MATH_LIBRARY}
|
||||
${SIMGEAR_SERIAL_LIBRARY}
|
||||
${SIMGEAR_STRUCTURE_LIBRARY}
|
||||
${SIMGEAR_TIMING_LIBRARY}
|
||||
${SIMGEAR_DEBUG_LIBRARY}
|
||||
${PLIB_SG_LIBRARY}
|
||||
${PLIB_UL_LIBRARY}
|
||||
${WINMM_LIBRARY}
|
||||
${WINSOCK_LIBRARY}
|
||||
${RT_LIBRARY}
|
||||
)
|
||||
|
||||
target_link_libraries(UGsmooth
|
||||
|
@ -43,6 +45,7 @@ target_link_libraries(UGsmooth
|
|||
${WINMM_LIBRARY}
|
||||
${WINSOCK_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
${RT_LIBRARY}
|
||||
)
|
||||
|
||||
install(TARGETS GPSsmooth MIDGsmooth UGsmooth RUNTIME DESTINATION bin)
|
||||
|
|
Loading…
Add table
Reference in a new issue