Remove obsolete FGWeather subsystem.
This commit is contained in:
parent
71f120e3be
commit
ee3500a0a4
4 changed files with 0 additions and 301 deletions
src/Weather
|
@ -1,3 +0,0 @@
|
||||||
.deps
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
|
@ -1,13 +0,0 @@
|
||||||
# libdir = ${exec_prefix}/lib
|
|
||||||
# lib_LTLIBRARIES = libWeather.la
|
|
||||||
# libWeather_la_SOURCES = weather.c weather.h
|
|
||||||
|
|
||||||
noinst_LIBRARIES = libWeather.a
|
|
||||||
|
|
||||||
libWeather_a_SOURCES = weather.cxx weather.hxx
|
|
||||||
|
|
||||||
if OLD_AUTOMAKE
|
|
||||||
INCLUDES += -I$(top_srcdir) -I$(top_srcdir)/src
|
|
||||||
else
|
|
||||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
|
|
||||||
endif
|
|
|
@ -1,187 +0,0 @@
|
||||||
// weather.cxx -- routines to model weather
|
|
||||||
//
|
|
||||||
// Written by Curtis Olson, started July 1997.
|
|
||||||
//
|
|
||||||
// Copyright (C) 1997 Curtis L. Olson - curt@me.umn.edu
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License as
|
|
||||||
// published by the Free Software Foundation; either version 2 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful, but
|
|
||||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
//
|
|
||||||
// $Id$
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_WINDOWS_H
|
|
||||||
# include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <GL/glut.h>
|
|
||||||
#include <GL/gl.h>
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
|
||||||
#include <simgear/math/sg_random.h>
|
|
||||||
|
|
||||||
#include <Main/fg_props.hxx>
|
|
||||||
#include <Aircraft/aircraft.hxx>
|
|
||||||
#include <Environment/environment.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
// This is a record containing current weather info
|
|
||||||
FGWeather current_weather;
|
|
||||||
|
|
||||||
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Initialize the weather modeling subsystem
|
|
||||||
void FGWeather::init ()
|
|
||||||
{
|
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "Initializing weather subsystem");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
FGWeather::bind ()
|
|
||||||
{
|
|
||||||
fgTie("/environment/visibility-m", this,
|
|
||||||
&FGWeather::get_visibility_m, &FGWeather::set_visibility_m);
|
|
||||||
fgTie("/environment/wind-from-heading-deg", this,
|
|
||||||
&FGWeather::get_wind_from_heading_deg,
|
|
||||||
&FGWeather::set_wind_from_heading_deg);
|
|
||||||
fgTie("/environment/wind-speed-kt", this,
|
|
||||||
&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
|
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
// weather.hxx -- routines to model weather
|
|
||||||
//
|
|
||||||
// Written by Curtis Olson, started July 1997.
|
|
||||||
//
|
|
||||||
// Copyright (C) 1997 Curtis L. Olson - curt@me.umn.edu
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License as
|
|
||||||
// published by the Free Software Foundation; either version 2 of the
|
|
||||||
// License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful, but
|
|
||||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
//
|
|
||||||
// $Id$
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WEATHER_HXX
|
|
||||||
#define _WEATHER_HXX
|
|
||||||
|
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
|
||||||
|
|
||||||
#include <GL/gl.h>
|
|
||||||
|
|
||||||
#include <Main/fgfs.hxx>
|
|
||||||
|
|
||||||
#ifdef SG_HAVE_STD_INCLUDES
|
|
||||||
# include <cmath>
|
|
||||||
#else
|
|
||||||
# include <math.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// holds the current weather values
|
|
||||||
class FGWeather : public FGSubsystem
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
FGWeather();
|
|
||||||
virtual ~FGWeather();
|
|
||||||
|
|
||||||
virtual void init ();
|
|
||||||
virtual void bind ();
|
|
||||||
virtual void unbind ();
|
|
||||||
virtual void update (int dt);
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void set_visibility_m (double v);
|
|
||||||
virtual void set_wind_from_heading_deg (double h);
|
|
||||||
virtual void set_wind_speed_kt (double s);
|
|
||||||
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);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void _recalc_hdgspd ();
|
|
||||||
void _recalc_ne ();
|
|
||||||
|
|
||||||
double visibility_m;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
extern FGWeather current_weather;
|
|
||||||
|
|
||||||
#endif // _WEATHER_HXX
|
|
Loading…
Add table
Reference in a new issue