First steps in a weather reorganization. Note especially that
properties have been renamed from wind-(north|east|down)-fps to wind-from-(north|east|down)-fps, and the FDMs modified appropriately. No other changes should be visible unless FG_OLD_WEATHER is defined.
This commit is contained in:
parent
e90cbeacc3
commit
3b870192f4
12 changed files with 207 additions and 79 deletions
|
@ -96,6 +96,7 @@ FGATIS::~FGATIS() {
|
||||||
|
|
||||||
string FGATIS::get_transmission() {
|
string FGATIS::get_transmission() {
|
||||||
//void FGATIS::get_transmission() {
|
//void FGATIS::get_transmission() {
|
||||||
|
#if !defined(FG_OLD_WEATHER)
|
||||||
|
|
||||||
string transmission = "";
|
string transmission = "";
|
||||||
double visibility;
|
double visibility;
|
||||||
|
@ -218,4 +219,7 @@ string FGATIS::get_transmission() {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return(transmission);
|
return(transmission);
|
||||||
|
#else
|
||||||
|
return "Station unavailable (not supported by FG_OLD_WEATHER)";
|
||||||
|
#endif // FG_OLD_WEATHER
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,9 +326,9 @@ bool FGJSBsim::copy_to_JSBsim() {
|
||||||
Atmosphere->SetExTemperature(get_Static_temperature());
|
Atmosphere->SetExTemperature(get_Static_temperature());
|
||||||
Atmosphere->SetExPressure(get_Static_pressure());
|
Atmosphere->SetExPressure(get_Static_pressure());
|
||||||
Atmosphere->SetExDensity(get_Density());
|
Atmosphere->SetExDensity(get_Density());
|
||||||
Atmosphere->SetWindNED(get_V_north_airmass() * -1.0,
|
Atmosphere->SetWindNED(get_V_north_airmass(),
|
||||||
get_V_east_airmass() * -1.0,
|
get_V_east_airmass(),
|
||||||
get_V_down_airmass() * -1.0);
|
get_V_down_airmass());
|
||||||
// SG_LOG(SG_FLIGHT,SG_INFO, "Wind NED: "
|
// SG_LOG(SG_FLIGHT,SG_INFO, "Wind NED: "
|
||||||
// << get_V_north_airmass() << ", "
|
// << get_V_north_airmass() << ", "
|
||||||
// << get_V_east_airmass() << ", "
|
// << get_V_east_airmass() << ", "
|
||||||
|
|
|
@ -559,9 +559,9 @@ void FGLaRCsim::set_ls(void) {
|
||||||
Latitude=lsic->GetLatitudeGDRadIC();
|
Latitude=lsic->GetLatitudeGDRadIC();
|
||||||
Longitude=lsic->GetLongitudeRadIC();
|
Longitude=lsic->GetLongitudeRadIC();
|
||||||
Runway_altitude=lsic->GetRunwayAltitudeFtIC();
|
Runway_altitude=lsic->GetRunwayAltitudeFtIC();
|
||||||
V_north_airmass = lsic->GetVnorthAirmassFpsIC();
|
V_north_airmass = lsic->GetVnorthAirmassFpsIC() * -1;
|
||||||
V_east_airmass = lsic->GetVeastAirmassFpsIC();
|
V_east_airmass = lsic->GetVeastAirmassFpsIC() * -1;
|
||||||
V_down_airmass = lsic->GetVdownAirmassFpsIC();
|
V_down_airmass = lsic->GetVdownAirmassFpsIC() * -1;
|
||||||
ls_loop(0.0,-1);
|
ls_loop(0.0,-1);
|
||||||
copy_from_LaRCsim();
|
copy_from_LaRCsim();
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,12 +230,12 @@ void uiuc_force_moment(double dt)
|
||||||
vis *= 1.01;
|
vis *= 1.01;
|
||||||
WeatherDatabase->setWeatherVisibility( vis );
|
WeatherDatabase->setWeatherVisibility( vis );
|
||||||
#else
|
#else
|
||||||
vis = current_weather->get_visibility();
|
vis = current_weather.get_visibility_m();
|
||||||
if (Fog > 0)
|
if (Fog > 0)
|
||||||
vis /= 1.01;
|
vis /= 1.01;
|
||||||
else
|
else
|
||||||
vis *= 1.01;
|
vis *= 1.01;
|
||||||
current_weather->set_visibility( vis );
|
current_weather.set_visibility_m( vis );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,9 +220,9 @@ void YASim::copyToYASim(bool copyState)
|
||||||
|
|
||||||
// Environment
|
// Environment
|
||||||
float wind[3];
|
float wind[3];
|
||||||
wind[0] = get_V_north_airmass() * FT2M;
|
wind[0] = get_V_north_airmass() * FT2M * -1.0;
|
||||||
wind[1] = get_V_east_airmass() * FT2M;
|
wind[1] = get_V_east_airmass() * FT2M * -1.0;
|
||||||
wind[2] = get_V_down_airmass() * FT2M;
|
wind[2] = get_V_down_airmass() * FT2M * -1.0;
|
||||||
|
|
||||||
// The ground elevation doesn't come from FGInterface; query it
|
// The ground elevation doesn't come from FGInterface; query it
|
||||||
// from the scenery and set it for others to find.
|
// from the scenery and set it for others to find.
|
||||||
|
|
|
@ -805,7 +805,8 @@ bool fgInitSubsystems( void ) {
|
||||||
global_events.Register( "weather update", fgUpdateWeatherDatabase,
|
global_events.Register( "weather update", fgUpdateWeatherDatabase,
|
||||||
fgEVENT::FG_EVENT_READY, 30000);
|
fgEVENT::FG_EVENT_READY, 30000);
|
||||||
#else
|
#else
|
||||||
current_weather.Init();
|
current_weather.init();
|
||||||
|
current_weather.bind();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
# include <WeatherCM/FGLocalWeatherDatabase.h>
|
# include <WeatherCM/FGLocalWeatherDatabase.h>
|
||||||
#else
|
#else
|
||||||
# include <Weather/weather.hxx>
|
# include <Weather/weather.hxx>
|
||||||
#endif
|
#endif // FG_OLD_WEATHER
|
||||||
#include <Objects/matlib.hxx>
|
#include <Objects/matlib.hxx>
|
||||||
|
|
||||||
#include <GUI/gui.h>
|
#include <GUI/gui.h>
|
||||||
|
@ -52,9 +52,11 @@ SG_USING_STD(istream);
|
||||||
SG_USING_STD(ostream);
|
SG_USING_STD(ostream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(FG_OLD_WEATHER)
|
||||||
static double getWindNorth ();
|
static double getWindNorth ();
|
||||||
static double getWindEast ();
|
static double getWindEast ();
|
||||||
static double getWindDown ();
|
static double getWindDown ();
|
||||||
|
#endif // FG_OLD_WEATHER
|
||||||
|
|
||||||
// Allow the view to be set from two axes (i.e. a joystick hat)
|
// Allow the view to be set from two axes (i.e. a joystick hat)
|
||||||
// This needs to be in FGViewer itself, somehow.
|
// This needs to be in FGViewer itself, somehow.
|
||||||
|
@ -888,17 +890,15 @@ setAPThrottleControl (double value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(FG_OLD_WEATHER)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current visibility (meters).
|
* Get the current visibility (meters).
|
||||||
*/
|
*/
|
||||||
static double
|
static double
|
||||||
getVisibility ()
|
getVisibility ()
|
||||||
{
|
{
|
||||||
#ifndef FG_OLD_WEATHER
|
|
||||||
return WeatherDatabase->getWeatherVisibility();
|
return WeatherDatabase->getWeatherVisibility();
|
||||||
#else
|
|
||||||
return current_weather.get_visibility();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -908,11 +908,7 @@ getVisibility ()
|
||||||
static void
|
static void
|
||||||
setVisibility (double visibility)
|
setVisibility (double visibility)
|
||||||
{
|
{
|
||||||
#ifndef FG_OLD_WEATHER
|
|
||||||
WeatherDatabase->setWeatherVisibility(visibility);
|
WeatherDatabase->setWeatherVisibility(visibility);
|
||||||
#else
|
|
||||||
current_weather.set_visibility(visibility);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -980,6 +976,8 @@ setWindDown (double speed)
|
||||||
speed);
|
speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // FG_OLD_WEATHER
|
||||||
|
|
||||||
static double
|
static double
|
||||||
getFOV ()
|
getFOV ()
|
||||||
{
|
{
|
||||||
|
@ -1154,6 +1152,7 @@ fgInitProps ()
|
||||||
fgSetArchivable("/autopilot/control-overrides/throttle");
|
fgSetArchivable("/autopilot/control-overrides/throttle");
|
||||||
|
|
||||||
// Environment
|
// Environment
|
||||||
|
#if !defined(FG_OLD_WEATHER)
|
||||||
fgTie("/environment/visibility-m", getVisibility, setVisibility);
|
fgTie("/environment/visibility-m", getVisibility, setVisibility);
|
||||||
fgSetArchivable("/environment/visibility-m");
|
fgSetArchivable("/environment/visibility-m");
|
||||||
fgTie("/environment/wind-north-fps", getWindNorth, setWindNorth);
|
fgTie("/environment/wind-north-fps", getWindNorth, setWindNorth);
|
||||||
|
@ -1162,6 +1161,7 @@ fgInitProps ()
|
||||||
fgSetArchivable("/environment/wind-east-fps");
|
fgSetArchivable("/environment/wind-east-fps");
|
||||||
fgTie("/environment/wind-down-fps", getWindDown, setWindDown);
|
fgTie("/environment/wind-down-fps", getWindDown, setWindDown);
|
||||||
fgSetArchivable("/environment/wind-down-fps");
|
fgSetArchivable("/environment/wind-down-fps");
|
||||||
|
#endif
|
||||||
|
|
||||||
fgTie("/environment/magnetic-variation-deg", getMagVar);
|
fgTie("/environment/magnetic-variation-deg", getMagVar);
|
||||||
fgTie("/environment/magnetic-dip-deg", getMagDip);
|
fgTie("/environment/magnetic-dip-deg", getMagDip);
|
||||||
|
|
|
@ -556,7 +556,7 @@ void fgRenderFrame( void ) {
|
||||||
#ifndef FG_OLD_WEATHER
|
#ifndef FG_OLD_WEATHER
|
||||||
thesky->set_visibility( WeatherDatabase->getWeatherVisibility() );
|
thesky->set_visibility( WeatherDatabase->getWeatherVisibility() );
|
||||||
#else
|
#else
|
||||||
thesky->set_visibility( current_weather.get_visibility() );
|
thesky->set_visibility( current_weather.get_visibility_m() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
thesky->modify_vis( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER,
|
thesky->modify_vis( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER,
|
||||||
|
@ -1043,7 +1043,7 @@ static void fgMainLoop( void ) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FG_OLD_WEATHER
|
#ifdef FG_OLD_WEATHER
|
||||||
current_weather.Update();
|
current_weather.update(0); // FIXME: use real delta time
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fix elevation. I'm just sticking this here for now, it should
|
// Fix elevation. I'm just sticking this here for now, it should
|
||||||
|
|
|
@ -904,13 +904,14 @@ parse_option (const string& arg)
|
||||||
|
|
||||||
// convert to fps
|
// convert to fps
|
||||||
speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
|
speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
|
||||||
dir += 180;
|
while (dir > 360)
|
||||||
if (dir >= 360)
|
|
||||||
dir -= 360;
|
dir -= 360;
|
||||||
|
while (dir <= 0)
|
||||||
|
dir += 360;
|
||||||
dir *= SGD_DEGREES_TO_RADIANS;
|
dir *= SGD_DEGREES_TO_RADIANS;
|
||||||
fgSetDouble("/environment/wind-north-fps",
|
fgSetDouble("/environment/wind-from-north-fps",
|
||||||
speed * cos(dir));
|
speed * cos(dir));
|
||||||
fgSetDouble("/environment/wind-east-fps",
|
fgSetDouble("/environment/wind-from-east-fps",
|
||||||
speed * sin(dir));
|
speed * sin(dir));
|
||||||
} else if ( arg.find( "--wp=" ) == 0 ) {
|
} else if ( arg.find( "--wp=" ) == 0 ) {
|
||||||
parse_wp( arg.substr( 5 ) );
|
parse_wp( arg.substr( 5 ) );
|
||||||
|
|
|
@ -175,7 +175,7 @@ void FGTileMgr::schedule_needed() {
|
||||||
vis = 16000;
|
vis = 16000;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
vis = current_weather.get_visibility();
|
vis = current_weather.get_visibility_m();
|
||||||
#endif
|
#endif
|
||||||
// cout << "visibility = " << vis << endl;
|
// cout << "visibility = " << vis << endl;
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ void FGTileMgr::prep_ssg_nodes() {
|
||||||
vis = 16000;
|
vis = 16000;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
vis = current_weather.get_visibility();
|
vis = current_weather.get_visibility_m();
|
||||||
#endif
|
#endif
|
||||||
// cout << "visibility = " << vis << endl;
|
// cout << "visibility = " << vis << endl;
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
#include <simgear/math/sg_random.h>
|
#include <simgear/math/sg_random.h>
|
||||||
|
|
||||||
|
#include <Main/fg_props.hxx>
|
||||||
#include <Aircraft/aircraft.hxx>
|
#include <Aircraft/aircraft.hxx>
|
||||||
#include <Weather/weather.hxx>
|
#include <Weather/weather.hxx>
|
||||||
|
|
||||||
|
@ -45,36 +46,142 @@
|
||||||
FGWeather current_weather;
|
FGWeather current_weather;
|
||||||
|
|
||||||
|
|
||||||
FGWeather::FGWeather() {
|
FGWeather::FGWeather()
|
||||||
|
: visibility_m(32000),
|
||||||
|
wind_from_heading_deg(0),
|
||||||
|
wind_speed_kt(0),
|
||||||
|
wind_from_north_fps(0),
|
||||||
|
wind_from_east_fps(0),
|
||||||
|
wind_from_down_fps(0),
|
||||||
|
fog_exp_density(0),
|
||||||
|
fog_exp2_density(0)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FGWeather::~FGWeather() {
|
FGWeather::~FGWeather()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Initialize the weather modeling subsystem
|
// Initialize the weather modeling subsystem
|
||||||
void FGWeather::Init( ) {
|
void FGWeather::init ()
|
||||||
|
{
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "Initializing weather subsystem");
|
SG_LOG( SG_GENERAL, SG_INFO, "Initializing weather subsystem");
|
||||||
|
|
||||||
// Configure some wind
|
|
||||||
// FG_V_north_airmass = 15; // ft/s =~ 10mph
|
|
||||||
|
|
||||||
// set_visibility( 45000.0 ); // in meters
|
|
||||||
set_visibility( 32000.0 ); // about 20 miles (in meters)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update the weather parameters for the current position
|
void
|
||||||
void FGWeather::Update( void ) {
|
FGWeather::bind ()
|
||||||
FGInterface *f;
|
{
|
||||||
|
fgTie("/environment/visibility-m", this,
|
||||||
f = current_aircraft.fdm_state;
|
&FGWeather::get_visibility_m, &FGWeather::set_visibility_m);
|
||||||
|
fgTie("/environment/wind-from-heading-deg", this,
|
||||||
// Add some random turbulence
|
&FGWeather::get_wind_from_heading_deg,
|
||||||
// f->set_U_gust( fg_random() * 5.0 - 2.5 );
|
&FGWeather::set_wind_from_heading_deg);
|
||||||
// f->set_V_gust( fg_random() * 5.0 - 2.5 );
|
fgTie("/environment/wind-speed-kt", this,
|
||||||
// f->set_W_gust( fg_random() * 5.0 - 2.5 );
|
&FGWeather::get_wind_speed_kt, &FGWeather::set_wind_speed_kt);
|
||||||
|
fgTie("/environment/wind-from-north-fps", this,
|
||||||
|
&FGWeather::get_wind_from_north_fps,
|
||||||
|
&FGWeather::set_wind_from_north_fps);
|
||||||
|
fgTie("/environment/wind-from-east-fps", this,
|
||||||
|
&FGWeather::get_wind_from_east_fps,
|
||||||
|
&FGWeather::set_wind_from_east_fps);
|
||||||
|
fgTie("/environment/wind-from-down-fps", this,
|
||||||
|
&FGWeather::get_wind_from_down_fps,
|
||||||
|
&FGWeather::set_wind_from_down_fps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGWeather::unbind ()
|
||||||
|
{
|
||||||
|
fgUntie("/environment/visibility-m");
|
||||||
|
fgUntie("/environment/wind-from-heading-deg");
|
||||||
|
fgUntie("/environment/wind-speed-kt");
|
||||||
|
fgUntie("/environment/wind-from-north-fps");
|
||||||
|
fgUntie("/environment/wind-from-east-fps");
|
||||||
|
fgUntie("/environment/wind-from-down-fps");
|
||||||
|
}
|
||||||
|
|
||||||
|
void FGWeather::update (int dt)
|
||||||
|
{
|
||||||
|
// FIXME: the FDMs should update themselves
|
||||||
|
current_aircraft.fdm_state
|
||||||
|
->set_Velocities_Local_Airmass(wind_from_north_fps,
|
||||||
|
wind_from_east_fps,
|
||||||
|
wind_from_down_fps);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGWeather::set_visibility_m (double v)
|
||||||
|
{
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
// in meters
|
||||||
|
visibility_m = v;
|
||||||
|
|
||||||
|
// for GL_FOG_EXP
|
||||||
|
fog_exp_density = -log(0.01 / visibility_m);
|
||||||
|
|
||||||
|
// for GL_FOG_EXP2
|
||||||
|
fog_exp2_density = sqrt( -log(0.01) ) / visibility_m;
|
||||||
|
|
||||||
|
// Set correct opengl fog density
|
||||||
|
glFogf (GL_FOG_DENSITY, fog_exp2_density);
|
||||||
|
glFogi( GL_FOG_MODE, GL_EXP2 );
|
||||||
|
|
||||||
|
// SG_LOG( SG_INPUT, SG_DEBUG, "Fog density = " << fog_density );
|
||||||
|
// SG_LOG( SG_INPUT, SG_INFO,
|
||||||
|
// "Fog exp2 density = " << fog_exp2_density );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGWeather::set_wind_from_heading_deg (double h)
|
||||||
|
{
|
||||||
|
wind_from_heading_deg = h;
|
||||||
|
_recalc_ne();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGWeather::set_wind_speed_kt (double s)
|
||||||
|
{
|
||||||
|
wind_speed_kt = s;
|
||||||
|
_recalc_ne();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGWeather::set_wind_from_north_fps (double n)
|
||||||
|
{
|
||||||
|
wind_from_north_fps = n;
|
||||||
|
_recalc_hdgspd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGWeather::set_wind_from_east_fps (double e)
|
||||||
|
{
|
||||||
|
wind_from_east_fps = e;
|
||||||
|
_recalc_hdgspd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGWeather::set_wind_from_down_fps (double d)
|
||||||
|
{
|
||||||
|
wind_from_down_fps = d;
|
||||||
|
_recalc_hdgspd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGWeather::_recalc_hdgspd ()
|
||||||
|
{
|
||||||
|
wind_from_heading_deg = acos(wind_from_north_fps / wind_speed_kt);
|
||||||
|
wind_speed_kt = asin(wind_from_north_fps / wind_speed_kt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGWeather::_recalc_ne ()
|
||||||
|
{
|
||||||
|
wind_from_north_fps = wind_speed_kt * cos(wind_from_heading_deg);
|
||||||
|
wind_from_east_fps = wind_speed_kt * sin(wind_from_heading_deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// end of weather.cxx
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
|
||||||
|
#include <Main/fgfs.hxx>
|
||||||
|
|
||||||
#ifdef SG_HAVE_STD_INCLUDES
|
#ifdef SG_HAVE_STD_INCLUDES
|
||||||
# include <cmath>
|
# include <cmath>
|
||||||
#else
|
#else
|
||||||
|
@ -36,48 +38,61 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// holds the current weather values
|
// holds the current weather values
|
||||||
class FGWeather {
|
class FGWeather : public FGSubsystem
|
||||||
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
double visibility;
|
|
||||||
GLfloat fog_exp_density;
|
|
||||||
GLfloat fog_exp2_density;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGWeather();
|
FGWeather();
|
||||||
~FGWeather();
|
virtual ~FGWeather();
|
||||||
|
|
||||||
void Init();
|
virtual void init ();
|
||||||
void Update();
|
virtual void bind ();
|
||||||
|
virtual void unbind ();
|
||||||
|
virtual void update (int dt);
|
||||||
|
|
||||||
inline double get_visibility() const { return visibility; }
|
inline virtual double get_visibility_m () const { return visibility_m; }
|
||||||
|
inline virtual double get_wind_from_heading_deg () const {
|
||||||
|
return wind_from_heading_deg;
|
||||||
|
}
|
||||||
|
inline virtual double get_wind_speed_kt () const { return wind_speed_kt; }
|
||||||
|
inline virtual double get_wind_from_north_fps () const {
|
||||||
|
return wind_from_north_fps;
|
||||||
|
}
|
||||||
|
inline virtual double get_wind_from_east_fps () const {
|
||||||
|
return wind_from_east_fps;
|
||||||
|
}
|
||||||
|
inline virtual double get_wind_from_down_fps () const {
|
||||||
|
return wind_from_down_fps;
|
||||||
|
}
|
||||||
|
|
||||||
inline void set_visibility( double v ) {
|
virtual void set_visibility_m (double v);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
virtual void set_wind_from_heading_deg (double h);
|
||||||
// in meters
|
virtual void set_wind_speed_kt (double s);
|
||||||
visibility = v;
|
virtual void set_wind_from_north_fps (double n);
|
||||||
|
virtual void set_wind_from_east_fps (double e);
|
||||||
|
virtual void set_wind_from_down_fps (double d);
|
||||||
|
|
||||||
// for GL_FOG_EXP
|
private:
|
||||||
fog_exp_density = -log(0.01 / visibility);
|
|
||||||
|
|
||||||
// for GL_FOG_EXP2
|
void _recalc_hdgspd ();
|
||||||
fog_exp2_density = sqrt( -log(0.01) ) / visibility;
|
void _recalc_ne ();
|
||||||
|
|
||||||
// Set correct opengl fog density
|
double visibility_m;
|
||||||
glFogf (GL_FOG_DENSITY, fog_exp2_density);
|
|
||||||
glFogi( GL_FOG_MODE, GL_EXP2 );
|
double wind_from_heading_deg;
|
||||||
|
double wind_speed_kt;
|
||||||
|
|
||||||
|
double wind_from_north_fps;
|
||||||
|
double wind_from_east_fps;
|
||||||
|
double wind_from_down_fps;
|
||||||
|
|
||||||
|
// Do these belong here?
|
||||||
|
GLfloat fog_exp_density;
|
||||||
|
GLfloat fog_exp2_density;
|
||||||
|
|
||||||
// SG_LOG( SG_INPUT, SG_DEBUG, "Fog density = " << fog_density );
|
|
||||||
// SG_LOG( SG_INPUT, SG_INFO,
|
|
||||||
// "Fog exp2 density = " << fog_exp2_density );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern FGWeather current_weather;
|
extern FGWeather current_weather;
|
||||||
|
|
||||||
|
|
||||||
#endif // _WEATHER_HXX
|
#endif // _WEATHER_HXX
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue