FGState *f;
fgTIME *t;
fgVIEW *v;
- struct fgWEATHER *w;
+ FGWeather *w;
float fov, tmp;
static bool winding_ccw = true;
v->update_fov = TRUE;
return;
case 90: // Z key
- tmp = fgWeatherGetVisibility(); // in meters
+ tmp = w->get_visibility(); // in meters
tmp /= 1.10;
- fgWeatherSetVisibility( tmp );
+ w->set_visibility( tmp );
return;
}
} else {
v->update_fov = TRUE;
return;
case 122: // z key
- tmp = fgWeatherGetVisibility(); // in meters
+ tmp = w->get_visibility(); // in meters
tmp *= 1.10;
- fgWeatherSetVisibility( tmp );
+ w->set_visibility( tmp );
return;
case 27: // ESC
// if( fg_DebugOutput ) {
// $Log$
+// Revision 1.36 1998/12/06 13:51:20 curt
+// Turned "struct fgWEATHER" into "class FGWeather".
+//
// Revision 1.35 1998/12/05 16:13:17 curt
// Renamed class fgCONTROLS to class FGControls.
//
// fgInitVisuals() -- Initialize various GL/view parameters
static void fgInitVisuals( void ) {
fgLIGHT *l;
- struct fgWEATHER *w;
l = &cur_light_params;
- w = ¤t_weather;
// Go full screen if requested ...
if ( current_options.get_fullscreen() ) {
FG_LOG( FG_ALL, FG_DEBUG, "Running Main Loop");
FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
- fgWeatherUpdate();
+ current_weather.Update();
// Fix elevation. I'm just sticking this here for now, it should
// probably move eventually
// fgInitDebug();
// set default log levels
- fglog().setLogLevels( FG_ALL, FG_DEBUG );
+ fglog().setLogLevels( FG_ALL, FG_INFO );
FG_LOG( FG_GENERAL, FG_INFO, "Flight Gear: Version " << VERSION << endl );
// $Log$
+// Revision 1.73 1998/12/06 13:51:22 curt
+// Turned "struct fgWEATHER" into "class FGWeather".
+//
// Revision 1.72 1998/12/05 15:54:18 curt
// Renamed class fgFLIGHT to class FGState as per request by JSB.
//
fgEVENT::FG_EVENT_READY, 30000 );
// Initialize the weather modeling subsystem
- fgWeatherInit();
+ current_weather.Init();
// Initialize the Cockpit subsystem
if( fgCockpitInit( ¤t_aircraft )) {
// $Log$
+// Revision 1.56 1998/12/06 13:51:23 curt
+// Turned "struct fgWEATHER" into "class FGWeather".
+//
// Revision 1.55 1998/12/05 15:54:20 curt
// Renamed class fgFLIGHT to class FGState as per request by JSB.
//
// Check near and far clip plane
if( ( eye[2] > radius ) ||
- ( eye[2] + radius + current_weather.visibility < 0) )
+ ( eye[2] + radius + current_weather.get_visibility() < 0) )
{
return(0);
}
}
// Check far clip plane
- if ( eye[2] + radius < -current_weather.visibility ) {
+ if ( eye[2] + radius < -current_weather.get_visibility() ) {
return(0);
}
// $Log$
+// Revision 1.50 1998/12/06 13:51:25 curt
+// Turned "struct fgWEATHER" into "class FGWeather".
+//
// Revision 1.49 1998/12/05 15:54:26 curt
// Renamed class fgFLIGHT to class FGState as per request by JSB.
//
// This is a record containing current weather info
-struct fgWEATHER current_weather;
+FGWeather current_weather;
-// Initialize the weather modeling subsystem
-void fgWeatherInit( void ) {
- struct fgWEATHER *w;
+FGWeather::FGWeather() {
+}
+
+
+FGWeather::~FGWeather() {
+}
- w = ¤t_weather;
+// Initialize the weather modeling subsystem
+void FGWeather::Init( ) {
FG_LOG( FG_GENERAL, FG_INFO, "Initializing weather subsystem");
// Configure some wind
// FG_V_north_airmass = 15; // ft/s =~ 10mph
- // fgWeatherSetVisibility(45000.0); // in meters
- fgWeatherSetVisibility(32000.0); // about 20 miles (in meters)
+ // set_visibility( 45000.0 ); // in meters
+ set_visibility( 32000.0 ); // about 20 miles (in meters)
}
// Update the weather parameters for the current position
-void fgWeatherUpdate( void ) {
-
- // temporarily remove the code of this do-nothing routine
-
-// #ifdef FG_WEATHER_UPDATE
+void FGWeather::Update( void ) {
FGState *f;
- struct fgWEATHER *w;
f = current_aircraft.fdm_state;
- w = ¤t_weather;
// Add some random turbulence
- // FG_U_gust = fg_random() * 5.0 - 2.5;
- // FG_V_gust = fg_random() * 5.0 - 2.5;
- // FG_W_gust = fg_random() * 5.0 - 2.5;
-// #endif FG_WEATHER_UPDATE
-}
-
-
-// Get the current visibility
-float fgWeatherGetVisibility( void ) {
- struct fgWEATHER *w;
- w = ¤t_weather;
-
- return ( w->visibility );
-}
-
-
-// Set the visibility and update fog parameters
-void fgWeatherSetVisibility( float visibility ) {
- struct fgWEATHER *w;
- w = ¤t_weather;
-
- w->visibility = visibility; // in meters
- // w->fog_density = -log(0.01 / w->visibility; // for GL_FOG_EXP
- w->fog_density = sqrt( -log(0.01) ) / w->visibility; // for GL_FOG_EXP2
- xglFogf (GL_FOG_DENSITY, w->fog_density);
- FG_LOG( FG_INPUT, FG_DEBUG, "Fog density = " << w->fog_density );
+ // f->set_U_gust( fg_random() * 5.0 - 2.5 );
+ // f->set_V_gust( fg_random() * 5.0 - 2.5 );
+ // f->set_W_gust( fg_random() * 5.0 - 2.5 );
}
// $Log$
+// Revision 1.5 1998/12/06 13:51:26 curt
+// Turned "struct fgWEATHER" into "class FGWeather".
+//
// Revision 1.4 1998/12/05 15:54:31 curt
// Renamed class fgFLIGHT to class FGState as per request by JSB.
//
// (Log is kept at end of this file)
-#ifndef _WEATHER_H
-#define _WEATHER_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef _WEATHER_HXX
+#define _WEATHER_HXX
// holds the current weather values
-struct fgWEATHER {
- float visibility;
- float fog_density;
-};
+class FGWeather {
-extern struct fgWEATHER current_weather;
+private:
+ double visibility;
+ GLfloat fog_exp_density;
+ GLfloat fog_exp2_density;
-// Initialize the weather modeling subsystem
-void fgWeatherInit( void );
+public:
+ FGWeather();
+ ~FGWeather();
-// Update the weather parameters for the current position
-void fgWeatherUpdate( void );
+ void Init();
+ void Update();
+
+ inline double get_visibility() const { return visibility; }
+ inline void set_visibility( double v ) {
+ // in meters
+ visibility = v;
-// Get the current visibility
-float fgWeatherGetVisibility( void );
+ // for GL_FOG_EXP
+ fog_exp_density = -log(0.01 / visibility);
+ // for GL_FOG_EXP2
+ fog_exp2_density = sqrt( -log(0.01) ) / visibility;
-// Set the visibility and update fog parameters
-void fgWeatherSetVisibility( float visibility );
+ // Set correct opengl fog density
+ xglFogf (GL_FOG_DENSITY, fog_exp2_density);
+ // FG_LOG( FG_INPUT, FG_DEBUG, "Fog density = " << w->fog_density );
+ }
+};
-#ifdef __cplusplus
-}
-#endif
+extern FGWeather current_weather;
-#endif // _WEATHER_H
+#endif // _WEATHER_HXX
// $Log$
+// Revision 1.2 1998/12/06 13:51:27 curt
+// Turned "struct fgWEATHER" into "class FGWeather".
+//
// Revision 1.1 1998/10/17 01:34:37 curt
// C++ ifying ...
//