]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_fog.cpp
Remove confusing reference to SDL/GLUT
[flightgear.git] / src / FDM / UIUCModel / uiuc_fog.cpp
1 /**********************************************************************
2
3  FILENAME:     uiuc_fog.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  changes Fog variable to +/-1 or 0 using fog 
8                parameters and Simtime
9
10 ----------------------------------------------------------------------
11
12  STATUS:       alpha version
13
14 ----------------------------------------------------------------------
15
16  REFERENCES:   
17
18 ----------------------------------------------------------------------
19
20  HISTORY:      05/20/2001   initial release
21
22 ----------------------------------------------------------------------
23
24  AUTHOR(S):    Michael Savchenko         <savchenk@uiuc.edu>
25
26 ----------------------------------------------------------------------
27
28  VARIABLES:
29
30 ----------------------------------------------------------------------
31
32  INPUTS:        -Simtime
33                 -Fog
34                 -fog_field
35                 -fog_next_time
36                 -fog_current_segment
37                 -fog_value
38                 -fog_time
39                
40 ----------------------------------------------------------------------
41
42  OUTPUTS:       -Fog
43                 -fog_field
44                 -fog_next_time
45                 -fog_current_segment
46  
47 ----------------------------------------------------------------------
48
49  CALLED BY:    uiuc_wrapper
50
51 ----------------------------------------------------------------------
52
53  CALLS TO:     none
54
55 ----------------------------------------------------------------------
56
57  COPYRIGHT:    (C) 2000 by Michael Selig
58
59  This program is free software; you can redistribute it and/or
60  modify it under the terms of the GNU General Public License
61  as published by the Free Software Foundation.
62
63  This program is distributed in the hope that it will be useful,
64  but WITHOUT ANY WARRANTY; without even the implied warranty of
65  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
66  GNU General Public License for more details.
67
68  You should have received a copy of the GNU General Public License
69  along with this program; if not, write to the Free Software
70  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
71
72 **********************************************************************/
73
74
75 #include "uiuc_fog.h"
76
77 void uiuc_fog()
78 {
79   if (Simtime >= fog_next_time)
80   {
81     if (fog_current_segment != 0)
82     {
83       if (fog_value[fog_current_segment] > fog_value[fog_current_segment-1])
84         Fog = 1;
85       else if (fog_value[fog_current_segment] < fog_value[fog_current_segment-1])
86         Fog = -1;
87       else
88         Fog = 0;
89     }
90     else
91       Fog = 0;
92
93     if (Simtime > fog_time[fog_current_segment]) {
94       if (fog_current_segment == fog_segments)
95       {
96         fog_field = false;
97         Fog = 0;
98         return;
99       }
100       else
101         fog_current_segment++;                  }
102
103     if (fog_value[fog_current_segment] == fog_value[fog_current_segment-1])
104       fog_next_time = fog_time[fog_current_segment];
105     else
106       fog_next_time += (fog_time[fog_current_segment]-fog_time[fog_current_segment-1]) / abs(fog_value[fog_current_segment]-fog_value[fog_current_segment-1]);
107   }
108   else
109     Fog = 0;
110   
111   return;
112 }
113