1
0
Fork 0

Merge branch 'next' of git://gitorious.org/fg/flightgear into next

This commit is contained in:
Erik Hofman 2010-11-28 10:58:18 +01:00
commit 4dc76922c8
9 changed files with 53 additions and 29 deletions

View file

@ -673,7 +673,7 @@ void FGRouteMgr::insertWayptAtIndex(Waypt* aWpt, int aIndex)
}
int index = aIndex;
if ((aIndex == -1) || (aIndex > _route.size())) {
if ((aIndex == -1) || (aIndex > (int) _route.size())) {
index = _route.size();
}
@ -1027,7 +1027,7 @@ void FGRouteMgr::jumpToIndex(int index)
void FGRouteMgr::currentWaypointChanged()
{
Waypt* cur = currentWaypt();
Waypt* cur = (_currentIndex<numWaypts()) ? currentWaypt() : NULL;
Waypt* next = nextWaypt();
wp0->getChild("id")->setStringValue(cur ? cur->ident() : "");

View file

@ -152,6 +152,11 @@ FGEnvironmentMgr::bind ()
&FGEnvironmentMgr::get_cloud_layer_coverage_type,
&FGEnvironmentMgr::set_cloud_layer_coverage_type);
_tiedProperties.Tie( layerNode->getNode( "visibility-m",true), this, i,
&FGEnvironmentMgr::get_cloud_layer_visibility_m,
&FGEnvironmentMgr::set_cloud_layer_visibility_m);
}
_tiedProperties.setRoot( fgGetNode("/sim/rendering", true ) );
@ -315,6 +320,19 @@ FGEnvironmentMgr::get_cloud_layer_coverage_type (int index) const
return thesky->get_cloud_layer(index)->getCoverage();
}
double
FGEnvironmentMgr::get_cloud_layer_visibility_m (int index) const
{
return thesky->get_cloud_layer(index)->getVisibility_m();
}
void
FGEnvironmentMgr::set_cloud_layer_visibility_m (int index, double visibility_m)
{
thesky->get_cloud_layer(index)->setVisibility_m(visibility_m);
}
void
FGEnvironmentMgr::set_cloud_layer_coverage_type (int index, int type )

View file

@ -87,6 +87,8 @@ private:
void set_cloud_layer_coverage (int index, const char * coverage);
int get_cloud_layer_coverage_type (int index) const;
void set_cloud_layer_coverage_type (int index, int type );
double get_cloud_layer_visibility_m (int index) const;
void set_cloud_layer_visibility_m (int index, double visibility_m);
FGEnvironment * _environment; // always the same, for now
FGClouds *fgClouds;

View file

@ -279,12 +279,9 @@ void FGClouds::buildCloudLayers(void) {
//double wind_speed_kt = metar_root->getDoubleValue("wind-speed-kt");
double temperature_degc = metar_root->getDoubleValue("temperature-sea-level-degc");
double dewpoint_degc = metar_root->getDoubleValue("dewpoint-sea-level-degc");
double pressure_mb = metar_root->getDoubleValue("pressure-sea-level-inhg") * SG_INHG_TO_PA / 100.0;
double dewp = pow(10.0, 7.5 * dewpoint_degc / (237.7 + dewpoint_degc));
double temp = pow(10.0, 7.5 * temperature_degc / (237.7 + temperature_degc));
double rel_humidity = dewp * 100 / temp;
double dewpoint_degc = metar_root->getDoubleValue("dewpoint-sea-level-degc");
double pressure_mb = metar_root->getDoubleValue("pressure-sea-level-inhg") * SG_INHG_TO_PA / 100.0;
double rel_humidity = metar_root->getDoubleValue("relative-humidity");
// formule d'Epsy, base d'un cumulus
double cumulus_base = 122.0 * (temperature_degc - dewpoint_degc);
@ -295,7 +292,7 @@ void FGClouds::buildCloudLayers(void) {
double alt_ft = cloud_root->getDoubleValue("elevation-ft");
double alt_m = alt_ft * SG_FEET_TO_METER;
string coverage = cloud_root->getStringValue("coverage");
string coverage = cloud_root->getStringValue("coverage");
double coverage_norm = 0.0;
if( coverage == "few" )
@ -337,6 +334,7 @@ void FGClouds::buildCloudLayers(void) {
}
}
cloud_root->setStringValue("layer-type",layer_type);
buildLayer(iLayer, layer_type, alt_m, coverage_norm);
}
}

View file

@ -113,7 +113,7 @@ void FDMShell::update(double dt)
double lon = fgGetDouble("/sim/presets/longitude-deg");
double lat = fgGetDouble("/sim/presets/latitude-deg");
double range = 100.0; // in meters
double range = 1000.0; // in meters
SGGeod geod = SGGeod::fromDeg(lon, lat);
if (globals->get_scenery()->scenery_available(geod, range)) {
SG_LOG(SG_FLIGHT, SG_INFO, "Scenery loaded, will init FDM");

View file

@ -78,12 +78,12 @@ void HUD::Runway::draw()
float modelView[4][4], projMat[4][4];
bool anyLines;
//Get the current view
FGViewer* curr_view = globals->get_viewmgr()->get_current_view();
int curr_view_id = globals->get_viewmgr()->get_current();
double gpo = curr_view->getGoalPitchOffset_deg();
double gho = curr_view->getGoalHeadingOffset_deg();
double po = curr_view->getPitchOffset_deg();
double ho = curr_view->getHeadingOffset_deg();
// FGViewer* curr_view = globals->get_viewmgr()->get_current_view();
// int curr_view_id = globals->get_viewmgr()->get_current();
// double gpo = curr_view->getGoalPitchOffset_deg();
// double gho = curr_view->getGoalHeadingOffset_deg();
// double po = curr_view->getPitchOffset_deg();
// double ho = curr_view->getHeadingOffset_deg();
FGViewer* cockpitView = globals->get_viewmgr()->get_view(0);

View file

@ -306,6 +306,8 @@ FGIO::init()
// SG_LOG( SG_IO, SG_INFO, "I/O Channel initialization, " <<
// globals->get_channel_options_list()->size() << " requests." );
_realDeltaTime = fgGetNode("/sim/time/delta-realtime-sec");
FGProtocol *p;
// we could almost do this in a single step except pushing a valid
@ -339,30 +341,31 @@ FGIO::reinit()
// process any IO channel work
void
FGIO::update( double delta_time_sec )
FGIO::update( double /* delta_time_sec */ )
{
// cout << "processing I/O channels" << endl;
// cout << " Elapsed time = " << delta_time_sec << endl;
// use wall-clock, not simulation, delta time, so that network
// protocols update when the simulation is paused
// see http://code.google.com/p/flightgear-bugs/issues/detail?id=125
double delta_time_sec = _realDeltaTime->getDoubleValue();
ProtocolVec::iterator i = io_channels.begin();
ProtocolVec::iterator end = io_channels.end();
for (; i != end; ++i ) {
FGProtocol* p = *i;
if ( p->is_enabled() ) {
FGProtocol* p = *i;
if (!p->is_enabled()) {
continue;
}
p->dec_count_down( delta_time_sec );
double dt = 1 / p->get_hz();
if ( p->get_count_down() < 0.33 * dt ) {
p->process();
p->inc_count();
while ( p->get_count_down() < 0.33 * dt ) {
p->inc_count_down( dt );
p->inc_count_down( dt );
}
// double ave = elapsed_time / p->get_count();
// cout << " ave rate = " << ave << endl;
}
}
}
} // of channel processing
} // of io_channels iteration
}
void

View file

@ -27,6 +27,7 @@
#include <simgear/compiler.h>
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/props.hxx>
#include <vector>
#include <string>
@ -58,6 +59,8 @@ private:
typedef std::vector< FGProtocol* > ProtocolVec;
ProtocolVec io_channels;
SGPropertyNode_ptr _realDeltaTime;
};

View file

@ -279,7 +279,7 @@ int termination_triggering_signals[] = {
#if defined(_MSC_VER) || defined(__MINGW32__)
SIGINT, SIGILL, SIGFPE, SIGSEGV, SIGTERM, SIGBREAK, SIGABRT,
#else
SIGHUP, SIGINT, SIGQUIT, SIGKILL,
SIGHUP, SIGINT, SIGQUIT, SIGKILL, SIGTERM,
#endif
0}; // zero terminated