]> git.mxchange.org Git - flightgear.git/blob - src/Environment/environment.hxx
Initial take of new environment subsystem. Configure with
[flightgear.git] / src / Environment / environment.hxx
1 // environment.hxx -- routines to model the natural environment.
2 //
3 // Written by David Megginson, started February 2002.
4 //
5 // Copyright (C) 2002  David Megginson - david@megginson.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _ENVIRONMENT_HXX
25 #define _ENVIRONMENT_HXX
26
27 #include <simgear/compiler.h>
28
29 #include <GL/gl.h>
30
31 #include <Main/fgfs.hxx>
32
33 #ifdef SG_HAVE_STD_INCLUDES
34 #  include <cmath>
35 #else
36 #  include <math.h>
37 #endif
38
39
40 /**
41  * Model the natural environment.
42  *
43  * This class models the natural environment at a specific place and
44  * time.  A separate instance is necessary for each location or time.
45  *
46  * This class should eventually move to SimGear.
47  */
48 class FGEnvironment : public FGSubsystem
49 {
50
51 public:
52
53   FGEnvironment();
54   virtual ~FGEnvironment();
55   
56   virtual void init ();
57   virtual void bind ();
58   virtual void unbind ();
59   virtual void update (int dt);
60     
61   inline virtual double get_visibility_m () const { return visibility_m; }
62   inline virtual double get_wind_from_heading_deg () const {
63     return wind_from_heading_deg;
64   }
65   inline virtual double get_wind_speed_kt () const { return wind_speed_kt; }
66   inline virtual double get_wind_from_north_fps () const {
67     return wind_from_north_fps;
68   }
69   inline virtual double get_wind_from_east_fps () const {
70     return wind_from_east_fps;
71   }
72   inline virtual double get_wind_from_down_fps () const {
73     return wind_from_down_fps;
74   }
75
76   virtual void set_visibility_m (double v);
77   virtual void set_wind_from_heading_deg (double h);
78   virtual void set_wind_speed_kt (double s);
79   virtual void set_wind_from_north_fps (double n);
80   virtual void set_wind_from_east_fps (double e);
81   virtual void set_wind_from_down_fps (double d);
82
83 private:
84
85   void _recalc_hdgspd ();
86   void _recalc_ne ();
87
88   double visibility_m;
89
90   double wind_from_heading_deg;
91   double wind_speed_kt;
92
93   double wind_from_north_fps;
94   double wind_from_east_fps;
95   double wind_from_down_fps;
96
97                                 // Do these belong here?
98   GLfloat fog_exp_density;
99   GLfloat fog_exp2_density;
100
101 };
102
103 // FIXME: move to FGGlobals.
104 extern FGEnvironment current_environment;
105
106 #endif // _ENVIRONMENT_HXX