1
0
Fork 0

Converted to new logstream debugging facility. This allows release

builds with no messages at all (and no performance impact) by using
the -DFG_NDEBUG flag.
This commit is contained in:
curt 1998-11-06 21:17:31 +00:00
parent ad3ae51348
commit c74350c4fe
38 changed files with 516 additions and 380 deletions

View file

@ -25,7 +25,7 @@
#include <stdio.h> #include <stdio.h>
#include "aircraft.hxx" #include "aircraft.hxx"
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
// This is a record containing all the info for the aircraft currently // This is a record containing all the info for the aircraft currently
@ -35,7 +35,7 @@ fgAIRCRAFT current_aircraft;
// Initialize an Aircraft structure // Initialize an Aircraft structure
void fgAircraftInit( void ) { void fgAircraftInit( void ) {
fgPrintf( FG_AIRCRAFT, FG_INFO, "Initializing Aircraft structure\n" ); FG_LOG( FG_AIRCRAFT, FG_INFO, "Initializing Aircraft structure" );
current_aircraft.flight = &cur_flight_params; current_aircraft.flight = &cur_flight_params;
current_aircraft.controls = &controls; current_aircraft.controls = &controls;
@ -48,24 +48,29 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
f = a->flight; f = a->flight;
fgPrintf( FG_FLIGHT, FG_DEBUG, FG_LOG( FG_FLIGHT, FG_DEBUG,
"Pos = (%.2f,%.2f,%.2f) (Phi,Theta,Psi)=(%.2f,%.2f,%.2f)\n", "Pos = ("
FG_Longitude * 3600.0 * RAD_TO_DEG, << (FG_Longitude * 3600.0 * RAD_TO_DEG) << ","
FG_Latitude * 3600.0 * RAD_TO_DEG, << (FG_Latitude * 3600.0 * RAD_TO_DEG) << ","
FG_Altitude, FG_Phi, FG_Theta, FG_Psi); << FG_Altitude
<< ") (Phi,Theta,Psi)=("
<< FG_Phi << "," << FG_Theta << "," << FG_Psi << ")" );
double elevator = controls.get_elevator(); FG_LOG( FG_FLIGHT, FG_DEBUG,
double aileron = controls.get_aileron(); "Kts = " << FG_V_equiv_kts
double rudder = controls.get_rudder(); << " Elev = " << controls.get_elevator()
double throttle = controls.get_throttle( 0 ); << " Aileron = " << controls.get_aileron()
<< " Rudder = " << controls.get_rudder()
fgPrintf( FG_FLIGHT, FG_DEBUG, << " Power = " << controls.get_throttle( 0 ) );
"Kts = %.0f Elev = %.2f, Aileron = %.2f, Rudder = %.2f Power = %.2f\n",
FG_V_equiv_kts, elevator, aileron,rudder, throttle );
} }
// $Log$ // $Log$
// Revision 1.4 1998/11/06 21:17:31 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.3 1998/10/25 14:08:37 curt // Revision 1.3 1998/10/25 14:08:37 curt
// Turned "struct fgCONTROLS" into a class, with inlined accessor functions. // Turned "struct fgCONTROLS" into a class, with inlined accessor functions.
// //

View file

@ -31,7 +31,7 @@
using namespace std; using namespace std;
#endif #endif
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
// #include <Include/fg_types.h> // #include <Include/fg_types.h>
#include <Math/fg_geodesy.hxx> #include <Math/fg_geodesy.hxx>
#include <Math/mat3.h> #include <Math/mat3.h>
@ -97,9 +97,9 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t)
// find airport base material in the properties list // find airport base material in the properties list
if ( ! material_mgr.find( APT_BASE_MATERIAL, fragment.material_ptr )) { if ( ! material_mgr.find( APT_BASE_MATERIAL, fragment.material_ptr )) {
fgPrintf( FG_TERRAIN, FG_ALERT, FG_LOG( FG_TERRAIN, FG_ALERT,
"Ack! unknown material name = %s in fgAptGenerat()\n", "Ack! unknown material name = " << APT_BASE_MATERIAL
APT_BASE_MATERIAL ); << " in fgAptGenerat()" );
} }
printf(" tile center = %.2f %.2f %.2f\n", printf(" tile center = %.2f %.2f %.2f\n",
@ -281,6 +281,11 @@ fgAptGenerate(const string& path, fgTILE *tile)
// $Log$ // $Log$
// Revision 1.9 1998/11/06 21:17:32 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.8 1998/11/06 14:46:59 curt // Revision 1.8 1998/11/06 14:46:59 curt
// Changes to track Bernie's updates to fgstream. // Changes to track Bernie's updates to fgstream.
// //

View file

@ -27,7 +27,7 @@
#include <string> #include <string>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Misc/fgstream.hxx> #include <Misc/fgstream.hxx>
@ -52,9 +52,10 @@ int fgAIRPORTS::load( const string& file ) {
airports.erase( airports.begin(), airports.end() ); airports.erase( airports.begin(), airports.end() );
fg_gzifstream in( path ); fg_gzifstream in( path );
if ( !in ) if ( !in ) {
fgPrintf( FG_GENERAL, FG_EXIT, "Cannot open file: %s\n", FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << path );
path.c_str()); exit(-1);
}
/* /*
// We can use the STL copy algorithm because the input // We can use the STL copy algorithm because the input
@ -109,6 +110,11 @@ fgAIRPORTS::~fgAIRPORTS( void ) {
// $Log$ // $Log$
// Revision 1.9 1998/11/06 21:17:34 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.8 1998/11/06 14:47:01 curt // Revision 1.8 1998/11/06 14:47:01 curt
// Changes to track Bernie's updates to fgstream. // Changes to track Bernie's updates to fgstream.
// //

View file

@ -25,7 +25,7 @@
#include "celestialBody.hxx" #include "celestialBody.hxx"
#include "star.hxx" #include "star.hxx"
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
/************************************************************************** /**************************************************************************
* void CelestialBody::updatePosition(fgTIME *t, Star *ourSun) * void CelestialBody::updatePosition(fgTIME *t, Star *ourSun)
@ -78,8 +78,8 @@ void CelestialBody::updatePosition(fgTIME *t, Star *ourSun)
ze = yg * sin(ecl) + zg * cos(ecl); ze = yg * sin(ecl) + zg * cos(ecl);
rightAscension = atan2(ye, xe); rightAscension = atan2(ye, xe);
declination = atan2(ze, sqrt(xe*xe + ye*ye)); declination = atan2(ze, sqrt(xe*xe + ye*ye));
fgPrintf(FG_GENERAL, FG_INFO, "Planet found at : %f (ra), %f (dec)\n", FG_LOG(FG_GENERAL, FG_INFO, "Planet found at : "
rightAscension, declination); << rightAscension << " (ra), " << declination << " (dec)" );
//calculate some variables specific to calculating the magnitude //calculate some variables specific to calculating the magnitude
//of the planet //of the planet

View file

@ -26,7 +26,7 @@
#include <string.h> #include <string.h>
#include "moon.hxx" #include "moon.hxx"
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Objects/texload.h> #include <Objects/texload.h>
static GLuint moon_texid; static GLuint moon_texid;
@ -51,7 +51,7 @@ Moon::Moon(fgTIME *t) :
string tpath, fg_tpath; string tpath, fg_tpath;
int width, height; int width, height;
fgPrintf( FG_GENERAL, FG_INFO, "Initializing Moon Texture\n"); FG_LOG( FG_GENERAL, FG_INFO, "Initializing Moon Texture");
#ifdef GL_VERSION_1_1 #ifdef GL_VERSION_1_1
xglGenTextures(1, &moon_texid); xglGenTextures(1, &moon_texid);
xglBindTexture(GL_TEXTURE_2D, moon_texid); xglBindTexture(GL_TEXTURE_2D, moon_texid);
@ -77,9 +77,9 @@ Moon::Moon(fgTIME *t) :
if ( (moon_texbuf = read_rgb_texture(fg_tpath.c_str(), &width, &height)) if ( (moon_texbuf = read_rgb_texture(fg_tpath.c_str(), &width, &height))
== NULL ) == NULL )
{ {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT,
"Error in loading moon texture %s\n", tpath.c_str() ); "Error in loading moon texture " << tpath );
exit(1); exit(-1);
} }
} }
@ -162,7 +162,7 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
r += (-0.58 * cos(M - 2*D) r += (-0.58 * cos(M - 2*D)
-0.46 * cos(2*D) -0.46 * cos(2*D)
); );
fgPrintf(FG_GENERAL, FG_INFO, "Running moon update\n"); FG_LOG(FG_GENERAL, FG_INFO, "Running moon update");
xg = r * cos(lonecl) * cos(latecl); xg = r * cos(lonecl) * cos(latecl);
yg = r * sin(lonecl) * cos(latecl); yg = r * sin(lonecl) * cos(latecl);
zg = r * sin(latecl); zg = r * sin(latecl);
@ -213,8 +213,9 @@ void Moon::newImage(float ra, float dec)
xglRotatef(((RAD_TO_DEG * ra)- 90.0), 0.0, 0.0, 1.0); xglRotatef(((RAD_TO_DEG * ra)- 90.0), 0.0, 0.0, 1.0);
xglRotatef((RAD_TO_DEG * dec), 1.0, 0.0, 0.0); xglRotatef((RAD_TO_DEG * dec), 1.0, 0.0, 0.0);
fgPrintf( FG_GENERAL, FG_INFO, FG_LOG( FG_GENERAL, FG_INFO,
"Ra = (%f), Dec= (%f)", (RAD_TO_DEG *ra), (RAD_TO_DEG *dec) ); "Ra = (" << (RAD_TO_DEG *ra)
<< "), Dec= (" << (RAD_TO_DEG *dec) << ")" );
xglTranslatef(0.0, 58600.0, 0.0); xglTranslatef(0.0, 58600.0, 0.0);
Object = gluNewQuadric(); Object = gluNewQuadric();
gluQuadricTexture( Object, GL_TRUE ); gluQuadricTexture( Object, GL_TRUE );

View file

@ -26,7 +26,6 @@
#define _MOON_HXX_ #define _MOON_HXX_
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Include/general.h> #include <Include/general.h>
#include <Main/views.hxx> #include <Main/views.hxx>

View file

@ -36,7 +36,7 @@
#include <XGL/xgl.h> #include <XGL/xgl.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Flight/flight.hxx> #include <Flight/flight.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Main/views.hxx> #include <Main/views.hxx>
@ -78,7 +78,7 @@ void fgSkyVerticesInit( void ) {
float theta; float theta;
int i; int i;
fgPrintf(FG_ASTRO, FG_INFO, " Generating the sky dome vertices.\n"); FG_LOG(FG_ASTRO, FG_INFO, " Generating the sky dome vertices.");
for ( i = 0; i < 12; i++ ) { for ( i = 0; i < 12; i++ ) {
theta = (i * 30.0) * DEG_TO_RAD; theta = (i * 30.0) * DEG_TO_RAD;
@ -115,8 +115,8 @@ void fgSkyColorsInit( void ) {
l = &cur_light_params; l = &cur_light_params;
fgPrintf( FG_ASTRO, FG_INFO, FG_LOG( FG_ASTRO, FG_INFO,
" Generating the sky colors for each vertex.\n" ); " Generating the sky colors for each vertex." );
// setup for the possibility of sunset effects // setup for the possibility of sunset effects
sun_angle = l->sun_angle * RAD_TO_DEG; sun_angle = l->sun_angle * RAD_TO_DEG;
@ -243,7 +243,7 @@ void fgSkyColorsInit( void ) {
// Initialize the sky structure and colors // Initialize the sky structure and colors
void fgSkyInit( void ) { void fgSkyInit( void ) {
fgPrintf(FG_ASTRO, FG_INFO, "Initializing the sky\n"); FG_LOG( FG_ASTRO, FG_INFO, "Initializing the sky" );
fgSkyVerticesInit(); fgSkyVerticesInit();
@ -365,6 +365,11 @@ void fgSkyRender( void ) {
// $Log$ // $Log$
// Revision 1.14 1998/11/06 21:17:39 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.13 1998/10/20 18:28:30 curt // Revision 1.13 1998/10/20 18:28:30 curt
// Tweaked sunset/sunrise colors. // Tweaked sunset/sunrise colors.
// //

View file

@ -33,7 +33,7 @@
#include <GL/glut.h> #include <GL/glut.h>
#include <XGL/xgl.h> #include <XGL/xgl.h>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Time/sunpos.hxx> #include <Time/sunpos.hxx>
#include "solarsystem.hxx" #include "solarsystem.hxx"
@ -47,7 +47,8 @@ SolarSystem::SolarSystem(fgTIME *t)
{ {
if (theSolarSystem) if (theSolarSystem)
{ {
fgPrintf(FG_GENERAL, FG_EXIT, "Error: only one solarsystem allowed\n"); FG_LOG( FG_GENERAL, FG_ALERT, "Error: only one solarsystem allowed" );
exit(-1);
} }
theSolarSystem = this; theSolarSystem = this;
ourSun = new Star(t); ourSun = new Star(t);

View file

@ -41,7 +41,7 @@
#include <XGL/xgl.h> #include <XGL/xgl.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Misc/fgstream.hxx> #include <Misc/fgstream.hxx>
#include <Main/options.hxx> #include <Main/options.hxx>
@ -70,21 +70,23 @@ int fgStarsInit( void ) {
// double ra_save1, decl_save1; // double ra_save1, decl_save1;
int i, j, starcount, count; int i, j, starcount, count;
fgPrintf( FG_ASTRO, FG_INFO, "Initializing stars\n"); FG_LOG( FG_ASTRO, FG_INFO, "Initializing stars" );
if ( FG_STAR_LEVELS < 4 ) { if ( FG_STAR_LEVELS < 4 ) {
fgPrintf( FG_ASTRO, FG_EXIT, "Big whups in stars.cxx\n"); FG_LOG( FG_ASTRO, FG_ALERT, "Big whups in stars.cxx" );
exit(-1);
} }
// build the full path name to the stars data base file // build the full path name to the stars data base file
string path = current_options.get_fg_root() + "/Astro/stars" + ".gz"; string path = current_options.get_fg_root() + "/Astro/stars" + ".gz";
fgPrintf( FG_ASTRO, FG_INFO, " Loading stars from %s\n", path.c_str() ); FG_LOG( FG_ASTRO, FG_INFO, " Loading stars from " << path );
fg_gzifstream in( path ); fg_gzifstream in( path );
if ( ! in ) if ( ! in ) {
fgPrintf( FG_ASTRO, FG_EXIT, FG_LOG( FG_ASTRO, FG_ALERT, "Cannot open star file: " << path );
"Cannot open star file: '%s'\n", path.c_str() ); exit(-1);
}
starcount = 0; starcount = 0;
@ -195,9 +197,9 @@ int fgStarsInit( void ) {
xglEndList(); xglEndList();
fgPrintf( FG_ASTRO, FG_INFO, FG_LOG( FG_ASTRO, FG_INFO,
" Loading %d stars brighter than %.2f\n", " Loading " << count << " stars brighter than "
count, min_magnitude[i]); << min_magnitude[i] );
} }
return 1; // OK, we got here because initialization worked. return 1; // OK, we got here because initialization worked.
@ -252,6 +254,11 @@ void fgStarsRender( void ) {
// $Log$ // $Log$
// Revision 1.21 1998/11/06 21:17:42 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.20 1998/11/06 14:47:02 curt // Revision 1.20 1998/11/06 14:47:02 curt
// Changes to track Bernie's updates to fgstream. // Changes to track Bernie's updates to fgstream.
// //

View file

@ -31,22 +31,12 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
// #include <list>
// #include <Include/fg_stl_config.h>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>
// #ifdef NEEDNAMESPACESTD
// using namespace std;
// #endif
#include "autopilot.hxx" #include "autopilot.hxx"
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
// static list < double > alt_error_queue;
// The below routines were copied right from hud.c ( I hate reinventing // The below routines were copied right from hud.c ( I hate reinventing
@ -155,12 +145,15 @@ void fgAPInit( fgAIRCRAFT *current_aircraft )
{ {
fgAPDataPtr APData ; fgAPDataPtr APData ;
fgPrintf( FG_AUTOPILOT, FG_INFO, "Init AutoPilot Subsystem\n" ); FG_LOG( FG_AUTOPILOT, FG_INFO, "Init AutoPilot Subsystem" );
APData = (fgAPDataPtr)calloc(sizeof(fgAPData),1); APData = (fgAPDataPtr)calloc(sizeof(fgAPData),1);
if (APData == NULL) // I couldn't get the mem. Dying if (APData == NULL) {
fgPrintf( FG_AUTOPILOT, FG_EXIT,"No ram for Autopilot. Dying.\n"); // I couldn't get the mem. Dying
FG_LOG( FG_AUTOPILOT, FG_ALERT, "No ram for Autopilot. Dying.");
exit(-1);
}
APData->heading_hold = 0 ; // turn the heading hold off APData->heading_hold = 0 ; // turn the heading hold off
APData->altitude_hold = 0 ; // turn the altitude hold off APData->altitude_hold = 0 ; // turn the altitude hold off
@ -203,7 +196,7 @@ int fgAPRun( void )
// figure out how far off we are from desired heading // figure out how far off we are from desired heading
// Now it is time to deterime how far we should be rolled. // Now it is time to deterime how far we should be rolled.
fgPrintf( FG_AUTOPILOT, FG_DEBUG, "RelHeading: %f\n", RelHeading); FG_LOG( FG_AUTOPILOT, FG_DEBUG, "RelHeading: " << RelHeading );
// Check if we are further from heading than the roll out point // Check if we are further from heading than the roll out point
@ -232,7 +225,7 @@ int fgAPRun( void )
// Compare Target roll to Current Roll, Generate Rel Roll // Compare Target roll to Current Roll, Generate Rel Roll
fgPrintf( FG_COCKPIT, FG_BULK, "TargetRoll: %f\n", TargetRoll); FG_LOG( FG_COCKPIT, FG_BULK, "TargetRoll: " << TargetRoll );
RelRoll = NormalizeDegrees(TargetRoll - fgAPget_roll()); RelRoll = NormalizeDegrees(TargetRoll - fgAPget_roll());
@ -413,9 +406,8 @@ void fgAPToggleHeading( void )
APData->TargetHeading = fgAPget_heading(); APData->TargetHeading = fgAPget_heading();
} }
fgPrintf( FG_COCKPIT, FG_INFO, " fgAPSetHeading: (%d) %.2f\n", FG_LOG( FG_COCKPIT, FG_INFO, " fgAPSetHeading: ("
APData->heading_hold, << APData->heading_hold << ") " << APData->TargetHeading );
APData->TargetHeading);
} }
@ -440,9 +432,8 @@ void fgAPToggleAltitude( void )
// alt_error_queue.end() ); // alt_error_queue.end() );
} }
fgPrintf( FG_COCKPIT, FG_INFO, " fgAPSetAltitude: (%d) %.2f\n", FG_LOG( FG_COCKPIT, FG_INFO, " fgAPSetAltitude: ("
APData->altitude_hold, << APData->altitude_hold << ") " << APData->TargetAltitude );
APData->TargetAltitude);
} }
@ -464,9 +455,8 @@ void fgAPToggleAutoThrottle ( void )
APData->speed_error_accum = 0.0; APData->speed_error_accum = 0.0;
} }
fgPrintf( FG_COCKPIT, FG_INFO, " fgAPSetAutoThrottle: (%d) %.2f\n", FG_LOG( FG_COCKPIT, FG_INFO, " fgAPSetAutoThrottle: ("
APData->auto_throttle, << APData->auto_throttle << ") " << APData->TargetSpeed );
APData->TargetSpeed);
} }
void fgAPToggleTerrainFollow( void ) void fgAPToggleTerrainFollow( void )
@ -488,9 +478,8 @@ void fgAPToggleTerrainFollow( void )
APData->alt_error_accum = 0.0; APData->alt_error_accum = 0.0;
} }
fgPrintf( FG_COCKPIT, FG_INFO, " fgAPSetTerrainFollow: (%d) %.2f\n", FG_LOG( FG_COCKPIT, FG_INFO, " fgAPSetTerrainFollow: ("
APData->terrain_follow, << APData->terrain_follow << ") " << APData->TargetAGL );
APData->TargetAGL);
} }
double LinearExtrapolate( double x,double x1,double y1,double x2,double y2) double LinearExtrapolate( double x,double x1,double y1,double x2,double y2)

View file

@ -40,7 +40,7 @@
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Include/general.h> #include <Include/general.h>
#include <Main/options.hxx> #include <Main/options.hxx>
@ -258,7 +258,7 @@ double get_climb_rate( void )
bool fgCockpitInit( fgAIRCRAFT *cur_aircraft ) bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
{ {
fgPrintf( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem\n"); FG_LOG( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem" );
// cockpit->code = 1; /* It will be aircraft dependent */ // cockpit->code = 1; /* It will be aircraft dependent */
// cockpit->status = 0; // cockpit->status = 0;
@ -279,9 +279,9 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
fgPanelInit(); fgPanelInit();
} }
fgPrintf( FG_COCKPIT, FG_INFO, FG_LOG( FG_COCKPIT, FG_INFO,
" Code %d Status %d\n", " Code " << ac_cockpit->code() << " Status "
ac_cockpit->code(), ac_cockpit->status() ); << ac_cockpit->status() );
return true; return true;
} }
@ -292,9 +292,9 @@ void fgCockpitUpdate( void ) {
pview = &current_view; pview = &current_view;
fgPrintf( FG_COCKPIT, FG_DEBUG, FG_LOG( FG_COCKPIT, FG_DEBUG,
"Cockpit: code %d status %d\n", "Cockpit: code " << ac_cockpit->code() << " status "
ac_cockpit->code(), ac_cockpit->status() ); << ac_cockpit->status() );
if ( current_options.get_hud_status() ) { if ( current_options.get_hud_status() ) {
// This will check the global hud linked list pointer. // This will check the global hud linked list pointer.
@ -310,6 +310,11 @@ void fgCockpitUpdate( void ) {
// $Log$ // $Log$
// Revision 1.22 1998/11/06 21:17:45 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.21 1998/11/02 23:04:02 curt // Revision 1.21 1998/11/02 23:04:02 curt
// HUD units now display in feet by default with meters being a command line // HUD units now display in feet by default with meters being a command line
// option. // option.

View file

@ -39,7 +39,7 @@
#endif #endif
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Math/fg_random.h> #include <Math/fg_random.h>
@ -150,7 +150,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
instr_item *HIptr; instr_item *HIptr;
int index; int index;
fgPrintf( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD\n" ); FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); // empty the HUD deque HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); // empty the HUD deque
@ -532,7 +532,7 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
instr_item *HIptr; instr_item *HIptr;
int index; int index;
fgPrintf( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD\n" ); FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); HUD_deque.erase( HUD_deque.begin(), HUD_deque.end());
@ -835,6 +835,11 @@ void fgUpdateHUD( void ) {
} }
// $Log$ // $Log$
// Revision 1.27 1998/11/06 21:17:47 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.26 1998/11/03 12:33:11 curt // Revision 1.26 1998/11/03 12:33:11 curt
// Display ft or m in mini-hud next to altitude. // Display ft or m in mini-hud next to altitude.
// //

View file

@ -8,7 +8,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/fg_random.h> #include <Math/fg_random.h>
#include <Math/mat3.h> #include <Math/mat3.h>

View file

@ -8,7 +8,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/fg_random.h> #include <Math/fg_random.h>
#include <Math/mat3.h> #include <Math/mat3.h>

View file

@ -8,7 +8,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/fg_random.h> #include <Math/fg_random.h>
#include <Math/mat3.h> #include <Math/mat3.h>

View file

@ -11,7 +11,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/fg_random.h> #include <Math/fg_random.h>
#include <Math/mat3.h> #include <Math/mat3.h>

View file

@ -8,7 +8,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/fg_random.h> #include <Math/fg_random.h>
#include <Math/mat3.h> #include <Math/mat3.h>

View file

@ -8,7 +8,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/fg_random.h> #include <Math/fg_random.h>
#include <Math/mat3.h> #include <Math/mat3.h>

View file

@ -8,7 +8,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/fg_random.h> #include <Math/fg_random.h>
#include <Math/mat3.h> #include <Math/mat3.h>

View file

@ -8,7 +8,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/fg_random.h> #include <Math/fg_random.h>
#include <Math/mat3.h> #include <Math/mat3.h>

View file

@ -42,7 +42,6 @@
#include <math.h> #include <math.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Main/views.hxx> #include <Main/views.hxx>
@ -404,8 +403,9 @@ CreatePointer(&pointer[i]);
// strcat(tpath, "arthor.rgb"); // strcat(tpath, "arthor.rgb");
// if ( (imag = ImageLoad(tpath)) == NULL ){ // if ( (imag = ImageLoad(tpath)) == NULL ){
// fgPrintf( FG_COCKPIT, FG_EXIT, // fgPrintf( FG_COCKPIT, FG_ALERT,
// "Error loading cockpit texture %s\n", tpath ); // "Error loading cockpit texture %s\n", tpath );
// exit(-1);
// } // }
xglPixelStorei(GL_UNPACK_ROW_LENGTH, 256); xglPixelStorei(GL_UNPACK_ROW_LENGTH, 256);
@ -726,6 +726,11 @@ pointer->vertices[19] = pointer->vertices[3];
/* $Log$ /* $Log$
/* Revision 1.9 1998/11/06 21:18:01 curt
/* Converted to new logstream debugging facility. This allows release
/* builds with no messages at all (and no performance impact) by using
/* the -DFG_NDEBUG flag.
/*
/* Revision 1.8 1998/10/16 23:27:37 curt /* Revision 1.8 1998/10/16 23:27:37 curt
/* C++-ifying. /* C++-ifying.
/* /*

View file

@ -27,7 +27,7 @@
#include "flight.hxx" #include "flight.hxx"
#include "LaRCsim.hxx" #include "LaRCsim.hxx"
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Flight/LaRCsim/ls_interface.h> #include <Flight/LaRCsim/ls_interface.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/fg_geodesy.hxx> #include <Math/fg_geodesy.hxx>
@ -41,7 +41,7 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt) {
double save_alt = 0.0; double save_alt = 0.0;
int result; int result;
fgPrintf(FG_FLIGHT,FG_INFO,"Initializing flight model\n"); FG_LOG( FG_FLIGHT ,FG_INFO, "Initializing flight model" );
if ( model == FG_SLEW ) { if ( model == FG_SLEW ) {
// fgSlewInit(dt); // fgSlewInit(dt);
@ -54,7 +54,7 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt) {
fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */ fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */
fgLaRCsimInit(dt); fgLaRCsimInit(dt);
fgPrintf( FG_FLIGHT, FG_INFO, "FG pos = %.2f\n", FG_Latitude ); FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << FG_Latitude );
fgLaRCsim_2_Flight(f); /* translate LaRCsim back to FG structure */ fgLaRCsim_2_Flight(f); /* translate LaRCsim back to FG structure */
/* but lets restore our original bogus altitude when we are done */ /* but lets restore our original bogus altitude when we are done */
@ -62,8 +62,8 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt) {
FG_Altitude = save_alt; FG_Altitude = save_alt;
} }
} else { } else {
fgPrintf( FG_FLIGHT, FG_WARN, FG_LOG( FG_FLIGHT, FG_WARN,
"Unimplemented flight model == %d\n", model ); "Unimplemented flight model == " << model );
} }
result = 1; result = 1;
@ -86,8 +86,8 @@ int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) {
} else if ( model == FG_LARCSIM ) { } else if ( model == FG_LARCSIM ) {
fgLaRCsimUpdate(f, multiloop); fgLaRCsimUpdate(f, multiloop);
} else { } else {
fgPrintf( FG_FLIGHT, FG_WARN, FG_LOG( FG_FLIGHT, FG_WARN,
"Unimplemented flight model == %d\n", model ); "Unimplemented flight model == " << model );
} }
end_elev = FG_Altitude; end_elev = FG_Altitude;
@ -121,6 +121,11 @@ void fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters) {
// $Log$ // $Log$
// Revision 1.3 1998/11/06 21:18:03 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.2 1998/10/16 23:27:40 curt // Revision 1.2 1998/10/16 23:27:40 curt
// C++-ifying. // C++-ifying.
// //

View file

@ -31,7 +31,7 @@
#endif #endif
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#if defined( ENABLE_LINUX_JOYSTICK ) #if defined( ENABLE_LINUX_JOYSTICK )
# include <Joystick/js.hxx> # include <Joystick/js.hxx>
@ -112,7 +112,7 @@ void joystick(unsigned int buttonMask, int js_x, int js_y, int js_z)
// Initialize the joystick(s) // Initialize the joystick(s)
int fgJoystickInit( void ) { int fgJoystickInit( void ) {
fgPrintf( FG_INPUT, FG_INFO, "Initializing joystick\n"); FG_LOG( FG_INPUT, FG_INFO, "Initializing joystick" );
#if defined( ENABLE_LINUX_JOYSTICK ) #if defined( ENABLE_LINUX_JOYSTICK )
@ -129,9 +129,9 @@ int fgJoystickInit( void ) {
js0->setDeadBand( 0, 0.1 ); js0->setDeadBand( 0, 0.1 );
js0->setDeadBand( 1, 0.1 ); js0->setDeadBand( 1, 0.1 );
fgPrintf ( FG_INPUT, FG_INFO, FG_LOG ( FG_INPUT, FG_INFO,
" Joystick 0 detected with %d axes\n", " Joystick 0 detected with " << js0->getNumAxes()
js0->getNumAxes() ); << " axes" );
} }
if ( js1->notWorking () ) { if ( js1->notWorking () ) {
@ -144,13 +144,13 @@ int fgJoystickInit( void ) {
js1->setDeadBand( 0, 0.1 ); js1->setDeadBand( 0, 0.1 );
js1->setDeadBand( 1, 0.1 ); js1->setDeadBand( 1, 0.1 );
fgPrintf ( FG_INPUT, FG_INFO, FG_LOG ( FG_INPUT, FG_INFO,
" Joystick 1 detected with %d axes\n", " Joystick 1 detected with " << js1->getNumAxes()
js1->getNumAxes() ); << " axes" );
} }
if ( js0->notWorking() && js1->notWorking() ) { if ( js0->notWorking() && js1->notWorking() ) {
fgPrintf ( FG_INPUT, FG_INFO, " No joysticks detected\n" ); FG_LOG ( FG_INPUT, FG_INFO, " No joysticks detected" );
return 0; return 0;
} }
@ -191,6 +191,11 @@ int fgJoystickRead( void ) {
// $Log$ // $Log$
// Revision 1.5 1998/11/06 21:18:04 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.4 1998/10/27 02:14:32 curt // Revision 1.4 1998/10/27 02:14:32 curt
// Changes to support GLUT joystick routines as fall back. // Changes to support GLUT joystick routines as fall back.
// //

View file

@ -40,7 +40,7 @@
#include <Astro/sky.hxx> #include <Astro/sky.hxx>
#include <Autopilot/autopilot.hxx> #include <Autopilot/autopilot.hxx>
#include <Cockpit/hud.hxx> #include <Cockpit/hud.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Objects/material.hxx> #include <Objects/material.hxx>
@ -81,11 +81,11 @@ void GLUTkey(unsigned char k, int x, int y) {
v = &current_view; v = &current_view;
w = &current_weather; w = &current_weather;
fgPrintf( FG_INPUT, FG_DEBUG, "Key hit = %d", k); FG_LOG( FG_INPUT, FG_DEBUG, "Key hit = " << k );
puKeyboard(k, PU_DOWN ); puKeyboard(k, PU_DOWN );
if ( GLUT_ACTIVE_ALT && glutGetModifiers() ) { if ( GLUT_ACTIVE_ALT && glutGetModifiers() ) {
fgPrintf( FG_INPUT, FG_DEBUG, " SHIFTED\n"); FG_LOG( FG_INPUT, FG_DEBUG, " SHIFTED" );
switch (k) { switch (k) {
case 1: // Ctrl-A key case 1: // Ctrl-A key
fgAPToggleAltitude(); fgAPToggleAltitude();
@ -173,7 +173,7 @@ void GLUTkey(unsigned char k, int x, int y) {
return; return;
} }
} else { } else {
fgPrintf( FG_INPUT, FG_DEBUG, "\n"); FG_LOG( FG_INPUT, FG_DEBUG, "" );
switch (k) { switch (k) {
case 50: // numeric keypad 2 case 50: // numeric keypad 2
controls.move_elevator(-0.05); controls.move_elevator(-0.05);
@ -230,16 +230,14 @@ void GLUTkey(unsigned char k, int x, int y) {
case 112: // p key case 112: // p key
t->pause = !t->pause; t->pause = !t->pause;
// printf position and attitude information // printf position and attitude information
fgPrintf( FG_INPUT, FG_INFO, FG_LOG( FG_INPUT, FG_INFO,
"Lon = %.4f Lat = %.4f Altitude = %.1f\n", "Lon = " << FG_Longitude * RAD_TO_DEG
FG_Longitude * RAD_TO_DEG, << " Lat = " << FG_Latitude * RAD_TO_DEG
FG_Latitude * RAD_TO_DEG, << " Altitude = " << FG_Altitude * FEET_TO_METER );
FG_Altitude * FEET_TO_METER); FG_LOG( FG_INPUT, FG_INFO,
fgPrintf( FG_INPUT, FG_INFO, "Heading = " << FG_Psi * RAD_TO_DEG
"Heading = %.2f Roll = %.2f Pitch = %.2f\n", << " Roll = " << FG_Phi * RAD_TO_DEG
FG_Psi * RAD_TO_DEG, << " Pitch = " << FG_Theta * RAD_TO_DEG );
FG_Phi * RAD_TO_DEG,
FG_Theta * RAD_TO_DEG);
return; return;
case 116: // t key case 116: // t key
t->warp_delta += 30; t->warp_delta += 30;
@ -263,8 +261,9 @@ void GLUTkey(unsigned char k, int x, int y) {
// if( fg_DebugOutput ) { // if( fg_DebugOutput ) {
// fclose( fg_DebugOutput ); // fclose( fg_DebugOutput );
// } // }
fgPrintf( FG_INPUT, FG_EXIT, FG_LOG( FG_INPUT, FG_ALERT,
"Program exiting normally at user request.\n"); "Program exiting normally at user request." );
exit(-1);
} }
} }
} }
@ -276,11 +275,11 @@ void GLUTspecialkey(int k, int x, int y) {
v = &current_view; v = &current_view;
fgPrintf( FG_INPUT, FG_DEBUG, "Special key hit = %d", k); FG_LOG( FG_INPUT, FG_DEBUG, "Special key hit = " << k );
puKeyboard(k + PU_KEY_GLUT_SPECIAL_OFFSET, PU_DOWN); puKeyboard(k + PU_KEY_GLUT_SPECIAL_OFFSET, PU_DOWN);
if ( GLUT_ACTIVE_SHIFT && glutGetModifiers() ) { if ( GLUT_ACTIVE_SHIFT && glutGetModifiers() ) {
fgPrintf( FG_INPUT, FG_DEBUG, " SHIFTED\n"); FG_LOG( FG_INPUT, FG_DEBUG, " SHIFTED" );
switch (k) { switch (k) {
case GLUT_KEY_END: // numeric keypad 1 case GLUT_KEY_END: // numeric keypad 1
v->goal_view_offset = FG_PI * 0.75; v->goal_view_offset = FG_PI * 0.75;
@ -308,23 +307,23 @@ void GLUTspecialkey(int k, int x, int y) {
return; return;
} }
} else { } else {
fgPrintf( FG_INPUT, FG_DEBUG, "\n"); FG_LOG( FG_INPUT, FG_DEBUG, "" );
switch (k) { switch (k) {
case GLUT_KEY_F8: // F8 toggles fog ... off fastest nicest... case GLUT_KEY_F8: // F8 toggles fog ... off fastest nicest...
current_options.cycle_fog(); current_options.cycle_fog();
if ( current_options.get_fog() == fgOPTIONS::FG_FOG_DISABLED ) { if ( current_options.get_fog() == fgOPTIONS::FG_FOG_DISABLED ) {
fgPrintf( FG_INPUT, FG_INFO, "Fog disabled\n" ); FG_LOG( FG_INPUT, FG_INFO, "Fog disabled" );
} else if ( current_options.get_fog() == } else if ( current_options.get_fog() ==
fgOPTIONS::FG_FOG_FASTEST ) fgOPTIONS::FG_FOG_FASTEST )
{ {
fgPrintf( FG_INPUT, FG_INFO, FG_LOG( FG_INPUT, FG_INFO,
"Fog enabled, hint set to fastest\n" ); "Fog enabled, hint set to fastest" );
} else if ( current_options.get_fog() == } else if ( current_options.get_fog() ==
fgOPTIONS::FG_FOG_NICEST ) fgOPTIONS::FG_FOG_NICEST )
{ {
fgPrintf( FG_INPUT, FG_INFO, FG_LOG( FG_INPUT, FG_INFO,
"Fog enabled, hint set to nicest\n" ); "Fog enabled, hint set to nicest" );
} }
return; return;
@ -333,14 +332,14 @@ void GLUTspecialkey(int k, int x, int y) {
current_options.get_textures() ? current_options.get_textures() ?
current_options.set_textures(false) : current_options.set_textures(false) :
current_options.set_textures(true); current_options.set_textures(true);
fgPrintf( FG_INPUT, FG_INFO, "Toggling texture\n" ); FG_LOG( FG_INPUT, FG_INFO, "Toggling texture" );
} else { } else {
fgPrintf( FG_INPUT, FG_INFO, FG_LOG( FG_INPUT, FG_INFO,
"No textures loaded, cannot toggle\n" ); "No textures loaded, cannot toggle" );
} }
return; return;
case GLUT_KEY_F10: // F10 toggles menu on and off... case GLUT_KEY_F10: // F10 toggles menu on and off...
fgPrintf(FG_INPUT, FG_INFO, "Invoking call back function"); FG_LOG(FG_INPUT, FG_INFO, "Invoking call back function");
hideMenuButton -> hideMenuButton ->
setValue ((int) !(hideMenuButton -> getValue() ) ); setValue ((int) !(hideMenuButton -> getValue() ) );
hideMenuButton -> invokeCallback(); hideMenuButton -> invokeCallback();
@ -387,6 +386,11 @@ void GLUTspecialkey(int k, int x, int y) {
// $Log$ // $Log$
// Revision 1.32 1998/11/06 21:18:06 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.31 1998/11/02 18:25:37 curt // Revision 1.31 1998/11/02 18:25:37 curt
// Check for __CYGWIN__ (b20) as well as __CYGWIN32__ (pre b20 compilers) // Check for __CYGWIN__ (b20) as well as __CYGWIN32__ (pre b20 compilers)
// Other misc. tweaks. // Other misc. tweaks.

View file

@ -62,7 +62,7 @@
#include <Autopilot/autopilot.hxx> #include <Autopilot/autopilot.hxx>
#include <Cockpit/cockpit.hxx> #include <Cockpit/cockpit.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <GUI/gui.h> #include <GUI/gui.h>
#include <Joystick/joystick.hxx> #include <Joystick/joystick.hxx>
#include <Math/fg_geodesy.hxx> #include <Math/fg_geodesy.hxx>
@ -468,8 +468,8 @@ static void fgMainLoop( void ) {
g = &general; g = &general;
t = &cur_time_params; t = &cur_time_params;
fgPrintf( FG_ALL, FG_DEBUG, "Running Main Loop\n"); FG_LOG( FG_ALL, FG_DEBUG, "Running Main Loop");
fgPrintf( FG_ALL, FG_DEBUG, "======= ==== ====\n"); FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
fgWeatherUpdate(); fgWeatherUpdate();
@ -492,9 +492,9 @@ static void fgMainLoop( void ) {
fgFlightModelSetAltitude( current_options.get_flight_model(), f, fgFlightModelSetAltitude( current_options.get_flight_model(), f,
scenery.cur_elev + alt_adjust_m ); scenery.cur_elev + alt_adjust_m );
fgPrintf( FG_ALL, FG_BULK, FG_LOG( FG_ALL, FG_BULK,
"<*> resetting altitude to %.0f meters\n", "<*> resetting altitude to "
FG_Altitude * FEET_TO_METER); << FG_Altitude * FEET_TO_METER << " meters" );
} }
FG_Runway_altitude = scenery.cur_elev * METER_TO_FEET; FG_Runway_altitude = scenery.cur_elev * METER_TO_FEET;
} }
@ -518,9 +518,9 @@ static void fgMainLoop( void ) {
// Get elapsed time for this past frame // Get elapsed time for this past frame
elapsed = fgGetTimeInterval(); elapsed = fgGetTimeInterval();
fgPrintf( FG_ALL, FG_BULK, FG_LOG( FG_ALL, FG_BULK,
"Time interval is = %d, previous remainder is = %d\n", "Time interval is = " << elapsed
elapsed, remainder); << ", previous remainder is = " << remainder );
// Calculate frame rate average // Calculate frame rate average
if ( elapsed > 0.0 ) { if ( elapsed > 0.0 ) {
@ -538,15 +538,15 @@ static void fgMainLoop( void ) {
} }
// Calculate model iterations needed for next frame // Calculate model iterations needed for next frame
fgPrintf( FG_ALL, FG_DEBUG, FG_LOG( FG_ALL, FG_DEBUG,
"--> Frame rate is = %.2f\n", g->frame_rate); "--> Frame rate is = " << g->frame_rate );
elapsed += remainder; elapsed += remainder;
multi_loop = (int)(((float)elapsed * 0.001) * DEFAULT_MODEL_HZ); multi_loop = (int)(((float)elapsed * 0.001) * DEFAULT_MODEL_HZ);
remainder = elapsed - ((multi_loop*1000) / DEFAULT_MODEL_HZ); remainder = elapsed - ((multi_loop*1000) / DEFAULT_MODEL_HZ);
fgPrintf( FG_ALL, FG_BULK, FG_LOG( FG_ALL, FG_BULK,
"Model iterations needed = %d, new remainder = %d\n", "Model iterations needed = " << multi_loop
multi_loop, remainder); << ", new remainder = " << remainder );
/* printf("right before fm - ground = %.2f runway = %.2f alt = %.2f\n", /* printf("right before fm - ground = %.2f runway = %.2f alt = %.2f\n",
scenery.cur_elev, scenery.cur_elev,
@ -587,7 +587,7 @@ static void fgMainLoop( void ) {
// redraw display // redraw display
fgRenderFrame(); fgRenderFrame();
fgPrintf( FG_ALL, FG_DEBUG, "\n"); FG_LOG( FG_ALL, FG_DEBUG, "" );
} }
@ -621,8 +621,8 @@ static void fgIdleFunction ( void ) {
"/Sounds/intro.mp3"; "/Sounds/intro.mp3";
string command = "(touch " + lockfile + "; mpg123 " + mp3file + string command = "(touch " + lockfile + "; mpg123 " + mp3file +
"> /dev/null 2>&1; /bin/rm " + lockfile + ") &"; "> /dev/null 2>&1; /bin/rm " + lockfile + ") &";
fgPrintf( FG_GENERAL, FG_INFO, FG_LOG( FG_GENERAL, FG_INFO,
"Starting intro music: %s\n", mp3file.c_str() ); "Starting intro music: " << mp3file );
system ( command.c_str() ); system ( command.c_str() );
} }
#endif #endif
@ -645,8 +645,9 @@ static void fgIdleFunction ( void ) {
// a subsystem to flight gear, its initialization call should // a subsystem to flight gear, its initialization call should
// located in this routine. // located in this routine.
if( !fgInitSubsystems()) { if( !fgInitSubsystems()) {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT,
"Subsystem initializations failed ...\n" ); "Subsystem initializations failed ..." );
exit(-1);
} }
idle_state++; idle_state++;
@ -674,14 +675,14 @@ static void fgIdleFunction ( void ) {
string lockfile = "/tmp/mpg123.running"; string lockfile = "/tmp/mpg123.running";
struct stat stat_buf; struct stat stat_buf;
fgPrintf( FG_GENERAL, FG_INFO, FG_LOG( FG_GENERAL, FG_INFO,
"Waiting for mpg123 player to finish ...\n" ); "Waiting for mpg123 player to finish ..." );
while ( stat(lockfile.c_str(), &stat_buf) == 0 ) { while ( stat(lockfile.c_str(), &stat_buf) == 0 ) {
// file exist, wait ... // file exist, wait ...
sleep(1); sleep(1);
fgPrintf( FG_GENERAL, FG_INFO, "."); FG_LOG( FG_GENERAL, FG_INFO, ".");
} }
fgPrintf( FG_GENERAL, FG_INFO, "\n"); FG_LOG( FG_GENERAL, FG_INFO, "");
} }
#endif // WIN32 #endif // WIN32
@ -833,10 +834,10 @@ int main( int argc, char **argv ) {
_control87(MCW_EM, MCW_EM); /* defined in float.h */ _control87(MCW_EM, MCW_EM); /* defined in float.h */
#endif #endif
// Initialize the debugging output system // Initialize the [old] debugging output system
fgInitDebug(); // fgInitDebug();
fgPrintf(FG_GENERAL, FG_INFO, "Flight Gear: Version %s\n\n", VERSION); FG_LOG( FG_GENERAL, FG_INFO, "Flight Gear: Version" << VERSION << endl );
// Attempt to locate and parse a config file // Attempt to locate and parse a config file
// First check fg_root // First check fg_root
@ -859,24 +860,28 @@ int main( int argc, char **argv ) {
// Something must have gone horribly wrong with the command // Something must have gone horribly wrong with the command
// line parsing or maybe the user just requested help ... :-) // line parsing or maybe the user just requested help ... :-)
current_options.usage(); current_options.usage();
fgPrintf( FG_GENERAL, FG_EXIT, "\nExiting ...\n"); FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
exit(-1);
} }
// Initialize the Window/Graphics environment. // Initialize the Window/Graphics environment.
if( !fgGlutInit(&argc, argv) ) { if( !fgGlutInit(&argc, argv) ) {
fgPrintf( FG_GENERAL, FG_EXIT, "GLUT initialization failed ...\n" ); FG_LOG( FG_GENERAL, FG_ALERT, "GLUT initialization failed ..." );
exit(-1);
} }
// Initialize the various GLUT Event Handlers. // Initialize the various GLUT Event Handlers.
if( !fgGlutInitEvents() ) { if( !fgGlutInitEvents() ) {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT,
"GLUT event handler initialization failed ...\n" ); "GLUT event handler initialization failed ..." );
exit(-1);
} }
// First do some quick general initializations // First do some quick general initializations
if( !fgInitGeneral()) { if( !fgInitGeneral()) {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT,
"General initializations failed ...\n" ); "General initializations failed ..." );
exit(-1);
} }
// Init the user interface (we need to do this before passing off // Init the user interface (we need to do this before passing off
@ -892,6 +897,11 @@ int main( int argc, char **argv ) {
// $Log$ // $Log$
// Revision 1.63 1998/11/06 21:18:08 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.62 1998/10/27 02:14:35 curt // Revision 1.62 1998/10/27 02:14:35 curt
// Changes to support GLUT joystick routines as fall back. // Changes to support GLUT joystick routines as fall back.
// //

View file

@ -49,7 +49,8 @@
#include <Astro/solarsystem.hxx> #include <Astro/solarsystem.hxx>
#include <Autopilot/autopilot.hxx> #include <Autopilot/autopilot.hxx>
#include <Cockpit/cockpit.hxx> #include <Cockpit/cockpit.hxx>
#include <Debug/fg_debug.h> // #include <Debug/fg_debug.h>
#include <Debug/logstream.hxx>
#include <Joystick/joystick.hxx> #include <Joystick/joystick.hxx>
#include <Math/fg_geodesy.hxx> #include <Math/fg_geodesy.hxx>
#include <Math/fg_random.h> #include <Math/fg_random.h>
@ -85,14 +86,15 @@ int fgInitPosition( void ) {
fgAIRPORTS airports; fgAIRPORTS airports;
fgAIRPORT a; fgAIRPORT a;
fgPrintf( FG_GENERAL, FG_INFO, FG_LOG( FG_GENERAL, FG_INFO,
"Attempting to set starting position from airport code %s.\n", "Attempting to set starting position from airport code "
id.c_str() ); << id );
airports.load("apt_simple"); airports.load("apt_simple");
if ( ! airports.search( id, &a ) ) { if ( ! airports.search( id, &a ) ) {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT,
"Failed to find %s in database.\n", id.c_str() ); "Failed to find " << id << " in database." );
exit(-1);
} else { } else {
FG_Longitude = a.longitude * DEG_TO_RAD; FG_Longitude = a.longitude * DEG_TO_RAD;
FG_Latitude = a.latitude * DEG_TO_RAD; FG_Latitude = a.latitude * DEG_TO_RAD;
@ -108,10 +110,11 @@ int fgInitPosition( void ) {
FG_Altitude = current_options.get_altitude() * METER_TO_FEET; FG_Altitude = current_options.get_altitude() * METER_TO_FEET;
FG_Runway_altitude = FG_Altitude - 3.758099; FG_Runway_altitude = FG_Altitude - 3.758099;
fgPrintf( FG_GENERAL, FG_INFO, FG_LOG( FG_GENERAL, FG_INFO,
"Initial position is: (%.4f, %.4f, %.2f)\n", "Initial position is: ("
FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, << (FG_Longitude * RAD_TO_DEG) << ", "
FG_Altitude * FEET_TO_METER); << (FG_Latitude * RAD_TO_DEG) << ", "
<< (FG_Altitude * FEET_TO_METER) << ")" );
return(1); return(1);
} }
@ -125,8 +128,11 @@ int fgInitGeneral( void ) {
g = &general; g = &general;
fgPrintf( FG_GENERAL, FG_INFO, "General Initialization\n" ); // set default log levels
fgPrintf( FG_GENERAL, FG_INFO, "======= ==============\n" ); fglog().setLogLevels( FG_ALL, FG_INFO );
FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" );
FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" );
g->glVendor = (char *)glGetString ( GL_VENDOR ); g->glVendor = (char *)glGetString ( GL_VENDOR );
g->glRenderer = (char *)glGetString ( GL_RENDERER ); g->glRenderer = (char *)glGetString ( GL_RENDERER );
@ -135,11 +141,12 @@ int fgInitGeneral( void ) {
root = current_options.get_fg_root(); root = current_options.get_fg_root();
if ( ! root.length() ) { if ( ! root.length() ) {
// No root path set? Then bail ... // No root path set? Then bail ...
fgPrintf( FG_GENERAL, FG_EXIT, "%s %s\n", FG_LOG( FG_GENERAL, FG_ALERT,
"Cannot continue without environment variable FG_ROOT", "Cannot continue without environment variable FG_ROOT"
"being defined."); << "being defined." );
exit(-1);
} }
fgPrintf( FG_GENERAL, FG_INFO, "FG_ROOT = %s\n\n", root.c_str() ); FG_LOG( FG_GENERAL, FG_INFO, "FG_ROOT = " << root << endl );
// prime the frame rate counter pump // prime the frame rate counter pump
for ( i = 0; i < FG_FRAME_RATE_HISTORY; i++ ) { for ( i = 0; i < FG_FRAME_RATE_HISTORY; i++ ) {
@ -166,8 +173,8 @@ int fgInitSubsystems( void )
t = &cur_time_params; t = &cur_time_params;
v = &current_view; v = &current_view;
fgPrintf( FG_GENERAL, FG_INFO, "Initialize Subsystems\n"); FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems");
fgPrintf( FG_GENERAL, FG_INFO, "========== ==========\n"); FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
// seed the random number generater // seed the random number generater
fg_srandom(); fg_srandom();
@ -184,15 +191,16 @@ int fgInitSubsystems( void )
if ( fgSceneryInit() ) { if ( fgSceneryInit() ) {
// Scenery initialized ok. // Scenery initialized ok.
} else { } else {
fgPrintf( FG_GENERAL, FG_EXIT, "Error in Scenery initialization!\n" ); FG_LOG( FG_GENERAL, FG_ALERT, "Error in Scenery initialization!" );
exit(-1);
} }
if( fgTileMgrInit() ) { if( fgTileMgrInit() ) {
// Load the local scenery data // Load the local scenery data
fgTileMgrUpdate(); fgTileMgrUpdate();
} else { } else {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
"Error in Tile Manager initialization!\n" ); exit(-1);
} }
// calculalate a cartesian point somewhere along the line between // calculalate a cartesian point somewhere along the line between
@ -212,10 +220,11 @@ int fgInitSubsystems( void )
FG_Altitude = FG_Runway_altitude + 3.758099; FG_Altitude = FG_Runway_altitude + 3.758099;
} }
fgPrintf( FG_GENERAL, FG_INFO, FG_LOG( FG_GENERAL, FG_INFO,
"Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n", "Updated position (after elevation adj): ("
FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG, << (FG_Latitude * RAD_TO_DEG) << ", "
FG_Altitude * FEET_TO_METER); << (FG_Longitude * RAD_TO_DEG) << ", "
<< (FG_Altitude * FEET_TO_METER) << ")" );
// end of thing that I just stuck in that I should probably move // end of thing that I just stuck in that I should probably move
// The following section sets up the flight model EOM parameters // The following section sets up the flight model EOM parameters
@ -264,20 +273,23 @@ int fgInitSubsystems( void )
fgTimeUpdate(f, t); fgTimeUpdate(f, t);
// Initialize view parameters // Initialize view parameters
FG_LOG( FG_GENERAL, FG_DEBUG, "Before v->init()");
v->Init(); v->Init();
FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
v->UpdateViewMath(f); v->UpdateViewMath(f);
v->UpdateWorldToEye(f); v->UpdateWorldToEye(f);
// Build the solar system // Build the solar system
//fgSolarSystemInit(*t); //fgSolarSystemInit(*t);
fgPrintf(FG_GENERAL, FG_INFO, "Building SolarSystem\n"); FG_LOG(FG_GENERAL, FG_INFO, "Building SolarSystem");
SolarSystem::theSolarSystem = new SolarSystem(t); SolarSystem::theSolarSystem = new SolarSystem(t);
// Initialize the Stars subsystem // Initialize the Stars subsystem
if( fgStarsInit() ) { if( fgStarsInit() ) {
// Stars initialized ok. // Stars initialized ok.
} else { } else {
fgPrintf( FG_GENERAL, FG_EXIT, "Error in Stars initialization!\n" ); FG_LOG( FG_GENERAL, FG_ALERT, "Error in Stars initialization!" );
exit(-1);
} }
// Initialize the planetary subsystem // Initialize the planetary subsystem
@ -319,7 +331,8 @@ int fgInitSubsystems( void )
if( fgCockpitInit( &current_aircraft )) { if( fgCockpitInit( &current_aircraft )) {
// Cockpit initialized ok. // Cockpit initialized ok.
} else { } else {
fgPrintf( FG_GENERAL, FG_EXIT, "Error in Cockpit initialization!\n" ); FG_LOG( FG_GENERAL, FG_ALERT, "Error in Cockpit initialization!" );
exit(-1);
} }
// Initialize the "sky" // Initialize the "sky"
@ -339,29 +352,35 @@ int fgInitSubsystems( void )
FG_Altitude = FG_Runway_altitude + 3.758099; FG_Altitude = FG_Runway_altitude + 3.758099;
} }
fgPrintf( FG_GENERAL, FG_INFO, FG_LOG( FG_GENERAL, FG_INFO,
"Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n", "Updated position (after elevation adj): ("
FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG, << (FG_Latitude * RAD_TO_DEG) << ", "
FG_Altitude * FEET_TO_METER); << (FG_Longitude * RAD_TO_DEG) << ", "
<< (FG_Altitude * FEET_TO_METER) << ")" );
// end of thing that I just stuck in that I should probably move // end of thing that I just stuck in that I should probably move
// Joystick support // Joystick support
if ( fgJoystickInit() ) { if ( fgJoystickInit() ) {
// Joystick initialized ok. // Joystick initialized ok.
} else { } else {
fgPrintf( FG_GENERAL, FG_ALERT, "Error in Joystick initialization!\n" ); FG_LOG( FG_GENERAL, FG_ALERT, "Error in Joystick initialization!" );
} }
// Autopilot init added here, by Jeff Goeke-Smith // Autopilot init added here, by Jeff Goeke-Smith
fgAPInit(&current_aircraft); fgAPInit(&current_aircraft);
fgPrintf(FG_GENERAL, FG_INFO,"\n"); FG_LOG( FG_GENERAL, FG_INFO, endl);
return(1); return(1);
} }
// $Log$ // $Log$
// Revision 1.47 1998/11/06 21:18:10 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.46 1998/10/27 02:14:38 curt // Revision 1.46 1998/10/27 02:14:38 curt
// Changes to support GLUT joystick routines as fall back. // Changes to support GLUT joystick routines as fall back.
// //

View file

@ -33,7 +33,7 @@
#include <string.h> #include <string.h>
#include <string> #include <string>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Flight/flight.hxx> #include <Flight/flight.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Misc/fgstream.hxx> #include <Misc/fgstream.hxx>
@ -312,16 +312,16 @@ fgOPTIONS::parse_flight_model( const string& fm ) {
// printf("flight model = %s\n", fm); // printf("flight model = %s\n", fm);
if ( fm == "slew" ) { if ( fm == "slew" ) {
return(FG_SLEW); return FG_SLEW;
} else if ( (fm == "larcsim") || (fm == "LaRCsim") ) { } else if ( (fm == "larcsim") || (fm == "LaRCsim") ) {
return(FG_LARCSIM); return FG_LARCSIM;
} else { } else {
fgPrintf( FG_GENERAL, FG_EXIT, "Unknown flight model = %s\n", FG_LOG( FG_GENERAL, FG_ALERT, "Unknown flight model = " << fm );
fm.c_str()); exit(-1);
} }
// we'll never get here, but it makes the compiler happy. // we'll never get here, but it makes the compiler happy.
return(-1); return -1;
} }
@ -437,12 +437,11 @@ int fgOPTIONS::parse_option( const string& arg ) {
} else if ( arg == "--hud-culled" ) { } else if ( arg == "--hud-culled" ) {
tris_or_culled = 1; tris_or_culled = 1;
} else { } else {
fgPrintf( FG_GENERAL, FG_EXIT, "Unknown option '%s'\n", FG_LOG( FG_GENERAL, FG_ALERT, "Unknown option '" << arg << "'" );
arg.c_str() ); return FG_OPTIONS_ERROR;
return(FG_OPTIONS_ERROR);
} }
return(FG_OPTIONS_OK); return FG_OPTIONS_OK;
} }
@ -451,10 +450,10 @@ int fgOPTIONS::parse_command_line( int argc, char **argv ) {
int i = 1; int i = 1;
int result; int result;
fgPrintf(FG_GENERAL, FG_INFO, "Processing command line arguments\n"); FG_LOG(FG_GENERAL, FG_INFO, "Processing command line arguments");
while ( i < argc ) { while ( i < argc ) {
fgPrintf(FG_GENERAL, FG_DEBUG, "argv[%d] = %s\n", i, argv[i]); FG_LOG( FG_GENERAL, FG_DEBUG, "argv[" << i << "] = " << argv[i] );
result = parse_option(argv[i]); result = parse_option(argv[i]);
if ( (result == FG_OPTIONS_HELP) || (result == FG_OPTIONS_ERROR) ) { if ( (result == FG_OPTIONS_HELP) || (result == FG_OPTIONS_ERROR) ) {
@ -474,8 +473,7 @@ int fgOPTIONS::parse_config_file( const string& path ) {
if ( !in ) if ( !in )
return(FG_OPTIONS_ERROR); return(FG_OPTIONS_ERROR);
fgPrintf( FG_GENERAL, FG_INFO, "Processing config file: %s\n", FG_LOG( FG_GENERAL, FG_INFO, "Processing config file: " << path );
path.c_str() );
in >> skipcomment; in >> skipcomment;
while ( !in.eof() ) while ( !in.eof() )
@ -484,9 +482,10 @@ int fgOPTIONS::parse_config_file( const string& path ) {
getline( in, line ); getline( in, line );
if ( parse_option( line ) == FG_OPTIONS_ERROR ) { if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT,
"Config file parse error: %s '%s'\n", "Config file parse error: " << path << " '"
path.c_str(), line.c_str() ); << line << "'" );
exit(-1);
} }
in >> skipcomment; in >> skipcomment;
} }
@ -573,6 +572,11 @@ fgOPTIONS::~fgOPTIONS( void ) {
// $Log$ // $Log$
// Revision 1.29 1998/11/06 21:18:12 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.28 1998/11/06 14:47:03 curt // Revision 1.28 1998/11/06 14:47:03 curt
// Changes to track Bernie's updates to fgstream. // Changes to track Bernie's updates to fgstream.
// //

View file

@ -36,7 +36,7 @@
#include <string.h> #include <string.h>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Objects/texload.h> #include <Objects/texload.h>
@ -52,7 +52,7 @@ void fgSplashInit ( void ) {
string tpath, fg_tpath; string tpath, fg_tpath;
int width, height; int width, height;
fgPrintf( FG_GENERAL, FG_INFO, "Initializing splash screen\n"); FG_LOG( FG_GENERAL, FG_INFO, "Initializing splash screen" );
#ifdef GL_VERSION_1_1 #ifdef GL_VERSION_1_1
xglGenTextures(1, &splash_texid); xglGenTextures(1, &splash_texid);
xglBindTexture(GL_TEXTURE_2D, splash_texid); xglBindTexture(GL_TEXTURE_2D, splash_texid);
@ -79,9 +79,9 @@ void fgSplashInit ( void ) {
if ( (splash_texbuf = if ( (splash_texbuf =
read_rgb_texture(fg_tpath.c_str(), &width, &height)) == NULL ) read_rgb_texture(fg_tpath.c_str(), &width, &height)) == NULL )
{ {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT,
"Error in loading splash screen texture %s\n", "Error in loading splash screen texture " << tpath );
tpath.c_str() ); exit(-1);
} }
} }
@ -148,6 +148,11 @@ void fgSplashUpdate ( double progress ) {
// $Log$ // $Log$
// Revision 1.7 1998/11/06 21:18:14 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.6 1998/10/17 01:34:25 curt // Revision 1.6 1998/10/17 01:34:25 curt
// C++ ifying ... // C++ ifying ...
// //

View file

@ -28,7 +28,7 @@
#endif #endif
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Math/mat3.h> #include <Math/mat3.h>
#include <Math/point3d.hxx> #include <Math/point3d.hxx>
@ -52,7 +52,7 @@ fgVIEW::fgVIEW( void ) {
// Initialize a view structure // Initialize a view structure
void fgVIEW::Init( void ) { void fgVIEW::Init( void ) {
fgPrintf( FG_VIEW, FG_INFO, "Initializing View parameters\n"); FG_LOG( FG_VIEW, FG_INFO, "Initializing View parameters" );
view_offset = 0.0; view_offset = 0.0;
goal_view_offset = 0.0; goal_view_offset = 0.0;
@ -287,10 +287,12 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
abs_view_pos = fgPolarToCart3d(p); abs_view_pos = fgPolarToCart3d(p);
view_pos = abs_view_pos - scenery.center; view_pos = abs_view_pos - scenery.center;
fgPrintf( FG_VIEW, FG_DEBUG, "Absolute view pos = %.4f, %.4f, %.4f\n", FG_LOG( FG_VIEW, FG_DEBUG, "Absolute view pos = "
abs_view_pos.x(), abs_view_pos.y(), abs_view_pos.z()); << abs_view_pos.x() << ", "
fgPrintf( FG_VIEW, FG_DEBUG, "Relative view pos = %.4f, %.4f, %.4f\n", << abs_view_pos.y() << ", "
view_pos.x(), view_pos.y(), view_pos.z()); << abs_view_pos.z() );
FG_LOG( FG_VIEW, FG_DEBUG, "Relative view pos = "
<< view_pos.x() << ", " << view_pos.y() << ", " << view_pos.z() );
// Derive the LOCAL aircraft rotation matrix (roll, pitch, yaw) // Derive the LOCAL aircraft rotation matrix (roll, pitch, yaw)
// from FG_T_local_to_body[3][3] // from FG_T_local_to_body[3][3]
@ -584,6 +586,11 @@ fgVIEW::~fgVIEW( void ) {
// $Log$ // $Log$
// Revision 1.25 1998/11/06 21:18:15 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.24 1998/10/18 01:17:19 curt // Revision 1.24 1998/10/18 01:17:19 curt
// Point3D tweaks. // Point3D tweaks.
// //

View file

@ -37,7 +37,7 @@
#include <string> #include <string>
#include "Include/fg_stl_config.h" #include "Include/fg_stl_config.h"
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Misc/fgstream.hxx> #include <Misc/fgstream.hxx>
#include <Main/views.hxx> #include <Main/views.hxx>
@ -117,8 +117,7 @@ operator >> ( istream& in, fgMATERIAL& m )
m.alpha = 0; m.alpha = 0;
else else
{ {
fgPrintf( FG_TERRAIN, FG_INFO, FG_LOG( FG_TERRAIN, FG_INFO, "Bad alpha value " << token );
"Bad alpha value '%s'\n", token.c_str() );
} }
} }
else if ( token[0] == '}' ) else if ( token[0] == '}' )
@ -177,10 +176,9 @@ fgMATERIAL::load_texture()
read_rgb_texture(fg_tpath.c_str(), &width, &height)) read_rgb_texture(fg_tpath.c_str(), &width, &height))
== NULL ) == NULL )
{ {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT,
"Error in loading texture %s\n", "Error in loading texture " << tpath );
tpath.c_str() ); exit(-1);
return;
} }
} }
@ -202,10 +200,9 @@ fgMATERIAL::load_texture()
read_alpha_texture(fg_tpath.c_str(), &width, &height)) read_alpha_texture(fg_tpath.c_str(), &width, &height))
== NULL ) == NULL )
{ {
fgPrintf( FG_GENERAL, FG_EXIT, FG_LOG( FG_GENERAL, FG_ALERT,
"Error in loading texture %s\n", "Error in loading texture " << tpath );
tpath.c_str() ); exit(-1);
return;
} }
} }
@ -278,9 +275,10 @@ fgMATERIAL_MGR::load_lib ( void )
// build the path name to the material db // build the path name to the material db
string mpath = current_options.get_fg_root() + "/materials"; string mpath = current_options.get_fg_root() + "/materials";
fg_gzifstream in( mpath ); fg_gzifstream in( mpath );
if ( ! in ) if ( ! in ) {
fgPrintf( FG_GENERAL, FG_EXIT, "Cannot open file: %s\n", FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << mpath );
mpath.c_str() ); exit(-1);
}
while ( ! in.eof() ) { while ( ! in.eof() ) {
// printf("%s", line); // printf("%s", line);
@ -357,6 +355,11 @@ fgMATERIAL_MGR::render_fragments()
// $Log$ // $Log$
// Revision 1.10 1998/11/06 21:18:17 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.9 1998/11/06 14:47:05 curt // Revision 1.9 1998/11/06 14:47:05 curt
// Changes to track Bernie's updates to fgstream. // Changes to track Bernie's updates to fgstream.
// //

View file

@ -48,7 +48,7 @@ extern "C" void *memset(void *, int, size_t);
using namespace std; using namespace std;
#endif #endif
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Include/fg_zlib.h> #include <Include/fg_zlib.h>
#include <Main/options.hxx> #include <Main/options.hxx>
@ -148,8 +148,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
in.open( path + ".obj" ); in.open( path + ".obj" );
if ( ! in ) if ( ! in )
{ {
fgPrintf( FG_TERRAIN, FG_ALERT, FG_LOG( FG_TERRAIN, FG_ALERT, "Cannot open file: " << path );
"Cannot open file: %s\n", path.c_str() );
return 0; return 0;
} }
} }
@ -198,8 +197,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
>> normals[vncount][2]; >> normals[vncount][2];
vncount++; vncount++;
} else { } else {
fgPrintf( FG_TERRAIN, FG_EXIT, FG_LOG( FG_TERRAIN, FG_ALERT,
"Read too many vertex normals ... dying :-(\n"); "Read too many vertex normals ... dying :-(" );
exit(-1);
} }
} }
else if ( token[0] == 'v' ) else if ( token[0] == 'v' )
@ -211,8 +211,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
>> t->nodes[t->ncount][2]; >> t->nodes[t->ncount][2];
t->ncount++; t->ncount++;
} else { } else {
fgPrintf( FG_TERRAIN, FG_EXIT, FG_LOG( FG_TERRAIN, FG_ALERT,
"Read too many nodes ... dying :-(\n"); "Read too many nodes ... dying :-(");
exit(-1);
} }
} }
else if ( token == "usemtl" ) else if ( token == "usemtl" )
@ -254,9 +255,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
// find this material in the properties list // find this material in the properties list
if ( ! material_mgr.find( material, fragment.material_ptr )) { if ( ! material_mgr.find( material, fragment.material_ptr )) {
fgPrintf( FG_TERRAIN, FG_ALERT, FG_LOG( FG_TERRAIN, FG_ALERT,
"Ack! unknown usemtl name = %s in %s\n", "Ack! unknown usemtl name = " << material
material.c_str(), path.c_str() ); << " in " << path );
} }
// initialize the fragment transformation matrix // initialize the fragment transformation matrix
@ -505,8 +506,8 @@ int fgObjLoad( const string& path, fgTILE *t) {
last2 = n2; last2 = n2;
} }
} else { } else {
fgPrintf( FG_TERRAIN, FG_WARN, "Unknown token in %s = %s\n", FG_LOG( FG_TERRAIN, FG_WARN, "Unknown token in "
path.c_str(), token.c_str() ); << path << " = " << token );
} }
// eat comments and blank lines before start of while loop so // eat comments and blank lines before start of while loop so
@ -543,8 +544,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
*/ */
stopwatch.stop(); stopwatch.stop();
fgPrintf( FG_TERRAIN, FG_INFO, "Loaded %s in %f seconds\n", FG_LOG( FG_TERRAIN, FG_INFO,
path.c_str(), stopwatch.elapsedSeconds() ); "Loaded " << path << " in "
<< stopwatch.elapsedSeconds() << " seconds" );
// printf("end of tile\n"); // printf("end of tile\n");
@ -553,6 +555,11 @@ int fgObjLoad( const string& path, fgTILE *t) {
// $Log$ // $Log$
// Revision 1.10 1998/11/06 21:18:18 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.9 1998/11/06 14:47:06 curt // Revision 1.9 1998/11/06 14:47:06 curt
// Changes to track Bernie's updates to fgstream. // Changes to track Bernie's updates to fgstream.
// //

View file

@ -36,7 +36,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Main/options.hxx> #include <Main/options.hxx>
// #include "obj.hxx" // #include "obj.hxx"
@ -61,7 +61,7 @@ int fgSceneryInit( void ) {
o = &current_options; o = &current_options;
fgPrintf(FG_TERRAIN, FG_INFO, "Initializing scenery subsystem\n"); FG_LOG( FG_TERRAIN, FG_INFO, "Initializing scenery subsystem" );
scenery.cur_elev = -9999; scenery.cur_elev = -9999;
@ -82,6 +82,11 @@ void fgSceneryRender( void ) {
// $Log$ // $Log$
// Revision 1.10 1998/11/06 21:18:20 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.9 1998/10/16 23:27:57 curt // Revision 1.9 1998/10/16 23:27:57 curt
// C++-ifying. // C++-ifying.
// //

View file

@ -35,7 +35,7 @@
#include <Airports/genapt.hxx> #include <Airports/genapt.hxx>
#include <Bucket/bucketutils.h> #include <Bucket/bucketutils.h>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Main/views.hxx> #include <Main/views.hxx>
#include <Objects/obj.hxx> #include <Objects/obj.hxx>
@ -59,7 +59,7 @@ fgTILECACHE::init( void )
{ {
int i; int i;
fgPrintf(FG_TERRAIN, FG_INFO, "Initializing the tile cache.\n"); FG_LOG( FG_TERRAIN, FG_INFO, "Initializing the tile cache." );
for ( i = 0; i < FG_TILE_CACHE_SIZE; i++ ) { for ( i = 0; i < FG_TILE_CACHE_SIZE; i++ ) {
tile_cache[i].used = 0; tile_cache[i].used = 0;
@ -78,8 +78,8 @@ fgTILECACHE::exists( fgBUCKET *p )
if ( tile_cache[i].tile_bucket.lat == p->lat ) { if ( tile_cache[i].tile_bucket.lat == p->lat ) {
if ( tile_cache[i].tile_bucket.x == p->x ) { if ( tile_cache[i].tile_bucket.x == p->x ) {
if ( tile_cache[i].tile_bucket.y == p->y ) { if ( tile_cache[i].tile_bucket.y == p->y ) {
fgPrintf( FG_TERRAIN, FG_DEBUG, FG_LOG( FG_TERRAIN, FG_DEBUG,
"TILE EXISTS in cache ... index = %d\n", i ); "TILE EXISTS in cache ... index = " << i );
return( i ); return( i );
} }
} }
@ -139,12 +139,12 @@ fgTILECACHE::entry_free( int index )
tile_cache[index].used = 0; tile_cache[index].used = 0;
// Update the bucket // Update the bucket
fgPrintf( FG_TERRAIN, FG_DEBUG, FG_LOG( FG_TERRAIN, FG_DEBUG,
"FREEING TILE = (%d %d %d %d)\n", "FREEING TILE = ("
tile_cache[index].tile_bucket.lon, << tile_cache[index].tile_bucket.lon << " "
tile_cache[index].tile_bucket.lat, << tile_cache[index].tile_bucket.lat << " "
tile_cache[index].tile_bucket.x, << tile_cache[index].tile_bucket.x << " "
tile_cache[index].tile_bucket.y ); << tile_cache[index].tile_bucket.y << ")" );
// Step through the fragment list, deleting the display list, then // Step through the fragment list, deleting the display list, then
// the fragment, until the list is empty. // the fragment, until the list is empty.
@ -188,14 +188,16 @@ fgTILECACHE::next_avail( void )
return(i); return(i);
} else { } else {
// calculate approximate distance from view point // calculate approximate distance from view point
fgPrintf( FG_TERRAIN, FG_DEBUG, FG_LOG( FG_TERRAIN, FG_DEBUG,
"DIST Abs view pos = %.4f, %.4f, %.4f\n", "DIST Abs view pos = "
v->abs_view_pos.x(), v->abs_view_pos.y(), << v->abs_view_pos.x() << ", "
v->abs_view_pos.z() ); << v->abs_view_pos.y() << ", "
fgPrintf( FG_TERRAIN, FG_DEBUG, << v->abs_view_pos.z() );
" ref point = %.4f, %.4f, %.4f\n", FG_LOG( FG_TERRAIN, FG_DEBUG,
tile_cache[i].center.x(), tile_cache[i].center.y(), " ref point = "
tile_cache[i].center.z()); << tile_cache[i].center.x() << ", "
<< tile_cache[i].center.y() << ", "
<< tile_cache[i].center.z() );
delta.setx( fabs(tile_cache[i].center.x() - v->abs_view_pos.x() ) ); delta.setx( fabs(tile_cache[i].center.x() - v->abs_view_pos.x() ) );
delta.sety( fabs(tile_cache[i].center.y() - v->abs_view_pos.y() ) ); delta.sety( fabs(tile_cache[i].center.y() - v->abs_view_pos.y() ) );
@ -210,7 +212,7 @@ fgTILECACHE::next_avail( void )
} }
dist = max + (med + min) / 4; dist = max + (med + min) / 4;
fgPrintf( FG_TERRAIN, FG_DEBUG, " distance = %.2f\n", dist); FG_LOG( FG_TERRAIN, FG_DEBUG, " distance = " << dist );
if ( dist > max_dist ) { if ( dist > max_dist ) {
max_dist = dist; max_dist = dist;
@ -234,6 +236,11 @@ fgTILECACHE::~fgTILECACHE( void ) {
// $Log$ // $Log$
// Revision 1.19 1998/11/06 21:18:21 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.18 1998/10/16 18:12:28 curt // Revision 1.18 1998/10/16 18:12:28 curt
// Fixed a bug in the conversion to Point3D. // Fixed a bug in the conversion to Point3D.
// //

View file

@ -36,7 +36,7 @@
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Bucket/bucketutils.h> #include <Bucket/bucketutils.h>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Main/views.hxx> #include <Main/views.hxx>
@ -78,7 +78,7 @@ int tiles[FG_LOCAL_X_Y];
// Initialize the Tile Manager subsystem // Initialize the Tile Manager subsystem
int fgTileMgrInit( void ) { int fgTileMgrInit( void ) {
fgPrintf( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem.\n"); FG_LOG( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem." );
// load default material library // load default material library
material_mgr.load_lib(); material_mgr.load_lib();
@ -93,8 +93,9 @@ void fgTileMgrLoadTile( fgBUCKET *p, int *index) {
c = &global_tile_cache; c = &global_tile_cache;
fgPrintf( FG_TERRAIN, FG_DEBUG, "Updating for bucket %d %d %d %d\n", FG_LOG( FG_TERRAIN, FG_DEBUG,
p->lon, p->lat, p->x, p->y); "Updating for bucket "
<< p->lon << " " << p->lat << " " << p->x << " " << p->y );
// if not in cache, load tile into the next available slot // if not in cache, load tile into the next available slot
if ( (*index = c->exists(p)) < 0 ) { if ( (*index = c->exists(p)) < 0 ) {
@ -102,7 +103,7 @@ void fgTileMgrLoadTile( fgBUCKET *p, int *index) {
c->fill_in(*index, p); c->fill_in(*index, p);
} }
fgPrintf( FG_TERRAIN, FG_DEBUG, "Selected cache index of %d\n", *index); FG_LOG( FG_TERRAIN, FG_DEBUG, "Selected cache index of " << *index);
} }
@ -128,16 +129,18 @@ int fgTileMgrUpdate( void ) {
if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) && if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) &&
(p1.x == p_last.x) && (p1.y == p_last.y) ) { (p1.x == p_last.x) && (p1.y == p_last.y) ) {
// same bucket as last time // same bucket as last time
fgPrintf( FG_TERRAIN, FG_DEBUG, "Same bucket as last time\n"); FG_LOG( FG_TERRAIN, FG_DEBUG, "Same bucket as last time" );
} else if ( p_last.lon == -1000 ) { } else if ( p_last.lon == -1000 ) {
// First time through, initialize the system and load all // First time through, initialize the system and load all
// relavant tiles // relavant tiles
fgPrintf( FG_TERRAIN, FG_INFO, " First time through ... "); FG_LOG( FG_TERRAIN, FG_INFO, " First time through ... " );
fgPrintf( FG_TERRAIN, FG_INFO, " Updating Tile list for %d,%d %d,%d\n", FG_LOG( FG_TERRAIN, FG_INFO,
p1.lon, p1.lat, p1.x, p1.y); " Updating Tile list for "
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n", << p1.lon << "," << p1.lat << " " << p1.x << "," << p1.y );
tile_diameter * tile_diameter); FG_LOG( FG_TERRAIN, FG_INFO, " Loading "
<< tile_diameter * tile_diameter
<< " tiles" );
// wipe/initialize tile cache // wipe/initialize tile cache
c->init(); c->init();
@ -157,13 +160,14 @@ int fgTileMgrUpdate( void ) {
// AT ULTRA HIGH SPEEDS THIS ASSUMPTION MAY NOT BE VALID IF // AT ULTRA HIGH SPEEDS THIS ASSUMPTION MAY NOT BE VALID IF
// THE AIRCRAFT CAN SKIP A TILE IN A SINGLE ITERATION. // THE AIRCRAFT CAN SKIP A TILE IN A SINGLE ITERATION.
fgPrintf( FG_TERRAIN, FG_INFO, "Updating Tile list for %d,%d %d,%d\n", FG_LOG( FG_TERRAIN, FG_INFO,
p1.lon, p1.lat, p1.x, p1.y); "Updating Tile list for "
<< p1.lon << "," << p1.lat << " " << p1.x << "," << p1.y );
if ( (p1.lon > p_last.lon) || if ( (p1.lon > p_last.lon) ||
( (p1.lon == p_last.lon) && (p1.x > p_last.x) ) ) { ( (p1.lon == p_last.lon) && (p1.x > p_last.x) ) ) {
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n", FG_LOG( FG_TERRAIN, FG_INFO,
tile_diameter); " Loading " << tile_diameter << "tiles" );
for ( j = 0; j < tile_diameter; j++ ) { for ( j = 0; j < tile_diameter; j++ ) {
// scrolling East // scrolling East
for ( i = 0; i < tile_diameter - 1; i++ ) { for ( i = 0; i < tile_diameter - 1; i++ ) {
@ -177,8 +181,8 @@ int fgTileMgrUpdate( void ) {
} }
} else if ( (p1.lon < p_last.lon) || } else if ( (p1.lon < p_last.lon) ||
( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) { ( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) {
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n", FG_LOG( FG_TERRAIN, FG_INFO,
tile_diameter); " Loading " << tile_diameter << "tiles" );
for ( j = 0; j < tile_diameter; j++ ) { for ( j = 0; j < tile_diameter; j++ ) {
// scrolling West // scrolling West
for ( i = tile_diameter - 1; i > 0; i-- ) { for ( i = tile_diameter - 1; i > 0; i-- ) {
@ -193,8 +197,8 @@ int fgTileMgrUpdate( void ) {
if ( (p1.lat > p_last.lat) || if ( (p1.lat > p_last.lat) ||
( (p1.lat == p_last.lat) && (p1.y > p_last.y) ) ) { ( (p1.lat == p_last.lat) && (p1.y > p_last.y) ) ) {
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n", FG_LOG( FG_TERRAIN, FG_INFO,
tile_diameter); " Loading " << tile_diameter << "tiles" );
for ( i = 0; i < tile_diameter; i++ ) { for ( i = 0; i < tile_diameter; i++ ) {
// scrolling North // scrolling North
for ( j = 0; j < tile_diameter - 1; j++ ) { for ( j = 0; j < tile_diameter - 1; j++ ) {
@ -208,8 +212,8 @@ int fgTileMgrUpdate( void ) {
} }
} else if ( (p1.lat < p_last.lat) || } else if ( (p1.lat < p_last.lat) ||
( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) { ( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) {
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n", FG_LOG( FG_TERRAIN, FG_INFO,
tile_diameter); " Loading " << tile_diameter << "tiles" );
for ( i = 0; i < tile_diameter; i++ ) { for ( i = 0; i < tile_diameter; i++ ) {
// scrolling South // scrolling South
for ( j = tile_diameter - 1; j > 0; j-- ) { for ( j = tile_diameter - 1; j > 0; j-- ) {
@ -436,10 +440,11 @@ double fgTileMgrCurElev( double lon, double lat, const Point3D& abs_view_pos ) {
earth_center = Point3D(0.0, 0.0, 0.0); earth_center = Point3D(0.0, 0.0, 0.0);
fgPrintf( FG_TERRAIN, FG_DEBUG, FG_LOG( FG_TERRAIN, FG_DEBUG,
"Pos = (%.2f, %.2f) Current bucket = %d %d %d %d Index = %ld\n", "Pos = (" << lon * RAD_TO_DEG << ", " << lat * RAD_TO_DEG
lon * RAD_TO_DEG, lat * RAD_TO_DEG, << " Current bucket = "
p.lon, p.lat, p.x, p.y, fgBucketGenIndex(&p) ); << p.lon << " " << p.lat << " " << p.x << " " << p.y
<< " Index = " << fgBucketGenIndex(&p) );
// calculate tile offset // calculate tile offset
// x = (t->offset.x = t->center.x - scenery.center.x); // x = (t->offset.x = t->center.x - scenery.center.x);
@ -594,8 +599,8 @@ void fgTileMgrRender( void ) {
mtl_ptr = frag_ptr->material_ptr; mtl_ptr = frag_ptr->material_ptr;
// printf(" lookup = %s\n", mtl_ptr->texture_name); // printf(" lookup = %s\n", mtl_ptr->texture_name);
if ( ! mtl_ptr->append_sort_list( frag_ptr ) ) { if ( ! mtl_ptr->append_sort_list( frag_ptr ) ) {
fgPrintf( FG_TERRAIN, FG_ALERT, FG_LOG( FG_TERRAIN, FG_ALERT,
"Overran material sorting array\n" ); "Overran material sorting array" );
} }
// xglCallList(frag_ptr->display_list); // xglCallList(frag_ptr->display_list);
@ -633,6 +638,11 @@ void fgTileMgrRender( void ) {
// $Log$ // $Log$
// Revision 1.42 1998/11/06 21:18:23 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.41 1998/10/18 01:17:23 curt // Revision 1.41 1998/10/18 01:17:23 curt
// Point3D tweaks. // Point3D tweaks.
// //

View file

@ -43,7 +43,7 @@
#include STL_ALGORITHM #include STL_ALGORITHM
#include STL_FUNCTIONAL #include STL_FUNCTIONAL
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include "event.hxx" #include "event.hxx"
@ -214,13 +214,13 @@ void fgEVENT_MGR::Process( void ) {
fg_timestamp cur_time; fg_timestamp cur_time;
unsigned int i, size; unsigned int i, size;
fgPrintf(FG_EVENT, FG_DEBUG, "Processing events\n"); FG_LOG( FG_EVENT, FG_DEBUG, "Processing events" );
// get the current time // get the current time
timestamp(&cur_time); timestamp(&cur_time);
fgPrintf( FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" Current timestamp = %ld\n", cur_time.seconds); " Current timestamp = " << cur_time.seconds );
// printf("Checking if anything is ready to move to the run queue\n"); // printf("Checking if anything is ready to move to the run queue\n");
@ -231,9 +231,9 @@ void fgEVENT_MGR::Process( void ) {
// e = *current++; // e = *current++;
e_ptr = &event_table[i]; e_ptr = &event_table[i];
if ( e_ptr->status == fgEVENT::FG_EVENT_READY ) { if ( e_ptr->status == fgEVENT::FG_EVENT_READY ) {
fgPrintf(FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" Item %d, current %d, next run @ %ld\n", " Item " << i << " current " << cur_time.seconds
i, cur_time.seconds, e_ptr->next_run.seconds); << " next run @ " << e_ptr->next_run.seconds );
if ( timediff(&cur_time, &(e_ptr->next_run)) <= 0) { if ( timediff(&cur_time, &(e_ptr->next_run)) <= 0) {
run_queue.push_back(e_ptr); run_queue.push_back(e_ptr);
e_ptr->status = fgEVENT::FG_EVENT_QUEUED; e_ptr->status = fgEVENT::FG_EVENT_QUEUED;
@ -258,6 +258,11 @@ fgEVENT_MGR::~fgEVENT_MGR( void ) {
// $Log$ // $Log$
// Revision 1.9 1998/11/06 21:18:24 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.8 1998/09/15 02:09:29 curt // Revision 1.8 1998/09/15 02:09:29 curt
// Include/fg_callback.hxx // Include/fg_callback.hxx
// Moved code inline to stop g++ 2.7 from complaining. // Moved code inline to stop g++ 2.7 from complaining.

View file

@ -53,7 +53,7 @@
#include <Astro/sky.hxx> #include <Astro/sky.hxx>
#include <Astro/solarsystem.hxx> #include <Astro/solarsystem.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Flight/flight.hxx> #include <Flight/flight.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Main/options.hxx> #include <Main/options.hxx>
@ -83,12 +83,12 @@ static void local_update_sky_and_lighting_params( void ) {
// Initialize the time dependent variables // Initialize the time dependent variables
void fgTimeInit(fgTIME *t) { void fgTimeInit(fgTIME *t) {
fgPrintf( FG_EVENT, FG_INFO, "Initializing Time\n"); FG_LOG( FG_EVENT, FG_INFO, "Initializing Time" );
t->gst_diff = -9999.0; t->gst_diff = -9999.0;
fgPrintf( FG_EVENT, FG_DEBUG, "time offset = %d\n", FG_LOG( FG_EVENT, FG_DEBUG,
current_options.get_time_offset() ); "time offset = " << current_options.get_time_offset() );
t->warp = current_options.get_time_offset(); t->warp = current_options.get_time_offset();
t->warp_delta = 0; t->warp_delta = 0;
@ -214,7 +214,7 @@ double utc_gst (double mjd) {
x /= 3600.0; x /= 3600.0;
gst = (1.0/SIDRATE)*hr + x; gst = (1.0/SIDRATE)*hr + x;
fgPrintf( FG_EVENT, FG_DEBUG, " gst => %.4f\n", gst); FG_LOG( FG_EVENT, FG_DEBUG, " gst => " << gst );
return(gst); return(gst);
} }
@ -303,17 +303,17 @@ time_t get_start_gmt(int year) {
long int start = mktime(&mt); long int start = mktime(&mt);
fgPrintf( FG_EVENT, FG_DEBUG, "start1 = %ld\n", start); FG_LOG( FG_EVENT, FG_DEBUG, "start1 = " << start );
// the ctime() call can screw up time progression on some versions // the ctime() call can screw up time progression on some versions
// of Linux // of Linux
// fgPrintf( FG_EVENT, FG_DEBUG, "start2 = %s", ctime(&start)); // fgPrintf( FG_EVENT, FG_DEBUG, "start2 = %s", ctime(&start));
fgPrintf( FG_EVENT, FG_DEBUG, "(tm_isdst = %d)\n", mt.tm_isdst); FG_LOG( FG_EVENT, FG_DEBUG, "(tm_isdst = " << mt.tm_isdst << ")" );
timezone = fix_up_timezone( timezone ); timezone = fix_up_timezone( timezone );
# if defined( TIMEZONE_OFFSET_WORKS ) # if defined( TIMEZONE_OFFSET_WORKS )
fgPrintf( FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
"start = %ld, timezone = %ld\n", start, timezone ); "start = " << start << ", timezone = " << timezone );
return( start - timezone ); return( start - timezone );
# else // ! defined( TIMEZONE_OFFSET_WORKS ) # else // ! defined( TIMEZONE_OFFSET_WORKS )
@ -321,22 +321,22 @@ time_t get_start_gmt(int year) {
if ( daylight > 0 ) { if ( daylight > 0 ) {
daylight = 1; daylight = 1;
} else if ( daylight < 0 ) { } else if ( daylight < 0 ) {
fgPrintf( FG_EVENT, FG_WARN, FG_LOG( FG_EVENT, FG_WARN,
"OOOPS, problem in fg_time.cxx, no daylight savings info.\n"); "OOOPS, problem in fg_time.cxx, no daylight savings info." );
} }
long int offset = -(timezone / 3600 - daylight); long int offset = -(timezone / 3600 - daylight);
fgPrintf( FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" Raw time zone offset = %ld\n", timezone); " Raw time zone offset = " << timezone );
fgPrintf( FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" Daylight Savings = %d\n", daylight); " Daylight Savings = " << daylight );
fgPrintf( FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" Local hours from GMT = %ld\n", offset); " Local hours from GMT = " << offset);
long int start_gmt = start - timezone + (daylight * 3600); long int start_gmt = start - timezone + (daylight * 3600);
fgPrintf( FG_EVENT, FG_DEBUG, " March 21 noon (CST) = %ld\n", start); FG_LOG( FG_EVENT, FG_DEBUG, " March 21 noon (CST) = " << start );
return ( start_gmt ); return ( start_gmt );
# endif // ! defined( TIMEZONE_OFFSET_WORKS ) # endif // ! defined( TIMEZONE_OFFSET_WORKS )
@ -354,17 +354,18 @@ double sidereal_course(fgTIME *t, double lng) {
now = t->cur_time; now = t->cur_time;
start_gmt = get_start_gmt(gmt->tm_year); start_gmt = get_start_gmt(gmt->tm_year);
fgPrintf(FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" COURSE: GMT = %d/%d/%2d %d:%02d:%02d\n", " COURSE: GMT = %d/%d/%2d %d:%02d:%02d\n"
gmt->tm_mon, gmt->tm_mday, gmt->tm_year, << gmt->tm_mon << "/" << gmt->tm_mday << "/" << gmt->tm_year
gmt->tm_hour, gmt->tm_min, gmt->tm_sec); << " "
<< gmt->tm_hour << ":" << gmt->tm_min << ":" << gmt->tm_sec );
fgPrintf( FG_EVENT, FG_DEBUG, " March 21 noon (GMT) = %ld\n", start_gmt); FG_LOG( FG_EVENT, FG_DEBUG, " March 21 noon (GMT) = " << start_gmt);
diff = (now - start_gmt) / (3600.0 * 24.0); diff = (now - start_gmt) / (3600.0 * 24.0);
fgPrintf( FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" Time since 3/21/%2d GMT = %.2f\n", gmt->tm_year, diff); " Time since 3/21/" << gmt->tm_year << " GMT = " << diff );
part = fmod(diff, 1.0); part = fmod(diff, 1.0);
days = diff - part; days = diff - part;
@ -376,9 +377,9 @@ double sidereal_course(fgTIME *t, double lng) {
lst += 24.0; lst += 24.0;
} }
fgPrintf( FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" days = %.1f hours = %.2f lon = %.2f lst = %.2f\n", " days = " << days << " hours = " << hours << " lon = "
days, hours, lng, lst); << lng << " lst = " << lst );
return(lst); return(lst);
} }
@ -388,14 +389,14 @@ double sidereal_course(fgTIME *t, double lng) {
void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) { void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
double gst_precise, gst_course; double gst_precise, gst_course;
fgPrintf( FG_EVENT, FG_BULK, "Updating time\n"); FG_LOG( FG_EVENT, FG_BULK, "Updating time" );
// get current Unix calendar time (in seconds) // get current Unix calendar time (in seconds)
t->warp += t->warp_delta; t->warp += t->warp_delta;
t->cur_time = time(NULL) + t->warp; t->cur_time = time(NULL) + t->warp;
fgPrintf( FG_EVENT, FG_BULK, FG_LOG( FG_EVENT, FG_BULK,
" Current Unix calendar time = %ld warp = %ld delta = %ld\n", " Current Unix calendar time = " << t->cur_time
t->cur_time, t->warp, t->warp_delta); << " warp = " << t->warp << " delta = " << t->warp_delta );
if ( t->warp_delta ) { if ( t->warp_delta ) {
// time is changing so force an update // time is changing so force an update
@ -404,10 +405,11 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
// get GMT break down for current time // get GMT break down for current time
t->gmt = gmtime(&t->cur_time); t->gmt = gmtime(&t->cur_time);
fgPrintf( FG_EVENT, FG_BULK, FG_LOG( FG_EVENT, FG_BULK,
" Current GMT = %d/%d/%2d %d:%02d:%02d\n", " Current GMT = " << t->gmt->tm_mon+1 << "/"
t->gmt->tm_mon+1, t->gmt->tm_mday, t->gmt->tm_year, << t->gmt->tm_mday << "/" << t->gmt->tm_year << " "
t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec); << t->gmt->tm_hour << ":" << t->gmt->tm_min << ":"
<< t->gmt->tm_sec );
// calculate modified Julian date // calculate modified Julian date
t->mjd = cal_mjd ((int)(t->gmt->tm_mon+1), (double)t->gmt->tm_mday, t->mjd = cal_mjd ((int)(t->gmt->tm_mon+1), (double)t->gmt->tm_mday,
@ -419,7 +421,7 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
// convert "back" to Julian date + partial day (as a fraction of one) // convert "back" to Julian date + partial day (as a fraction of one)
t->jd = t->mjd + MJD0; t->jd = t->mjd + MJD0;
fgPrintf( FG_EVENT, FG_BULK, " Current Julian Date = %.5f\n", t->jd); FG_LOG( FG_EVENT, FG_BULK, " Current Julian Date = " << t->jd );
// printf(" Current Longitude = %.3f\n", FG_Longitude * RAD_TO_DEG); // printf(" Current Longitude = %.3f\n", FG_Longitude * RAD_TO_DEG);
@ -427,7 +429,7 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
if ( t->gst_diff < -100.0 ) { if ( t->gst_diff < -100.0 ) {
// first time through do the expensive calculation & cheap // first time through do the expensive calculation & cheap
// calculation to get the difference. // calculation to get the difference.
fgPrintf( FG_EVENT, FG_INFO, " First time, doing precise gst\n"); FG_LOG( FG_EVENT, FG_INFO, " First time, doing precise gst" );
t->gst = gst_precise = sidereal_precise(t->mjd, 0.00); t->gst = gst_precise = sidereal_precise(t->mjd, 0.00);
gst_course = sidereal_course(t, 0.00); gst_course = sidereal_course(t, 0.00);
t->gst_diff = gst_precise - gst_course; t->gst_diff = gst_precise - gst_course;
@ -438,16 +440,21 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
t->gst = sidereal_course(t, 0.00) + t->gst_diff; t->gst = sidereal_course(t, 0.00) + t->gst_diff;
t->lst = sidereal_course(t, -(FG_Longitude * RAD_TO_DEG)) + t->gst_diff; t->lst = sidereal_course(t, -(FG_Longitude * RAD_TO_DEG)) + t->gst_diff;
} }
fgPrintf( FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" Current lon=0.00 Sidereal Time = %.3f\n", t->gst); " Current lon=0.00 Sidereal Time = " << t->gst );
fgPrintf( FG_EVENT, FG_DEBUG, FG_LOG( FG_EVENT, FG_DEBUG,
" Current LOCAL Sidereal Time = %.3f (%.3f) (diff = %.3f)\n", " Current LOCAL Sidereal Time = " << t->lst << " ("
t->lst, sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG)), << sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG))
t->gst_diff); << ") (diff = " << t->gst_diff << ")" );
} }
// $Log$ // $Log$
// Revision 1.21 1998/11/06 21:18:26 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.20 1998/11/02 18:25:38 curt // Revision 1.20 1998/11/02 18:25:38 curt
// Check for __CYGWIN__ (b20) as well as __CYGWIN32__ (pre b20 compilers) // Check for __CYGWIN__ (b20) as well as __CYGWIN32__ (pre b20 compilers)
// Other misc. tweaks. // Other misc. tweaks.

View file

@ -36,7 +36,7 @@
#include <string.h> #include <string.h>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Main/views.hxx> #include <Main/views.hxx>
@ -62,8 +62,8 @@ fgLIGHT::fgLIGHT( void ) {
void fgLIGHT::Init( void ) { void fgLIGHT::Init( void ) {
string path, ambient, diffuse, sky; string path, ambient, diffuse, sky;
fgPrintf( FG_EVENT, FG_INFO, FG_LOG( FG_EVENT, FG_INFO,
"Initializing Lighting interpolation tables.\n" ); "Initializing Lighting interpolation tables." );
// build the path name to the ambient lookup table // build the path name to the ambient lookup table
path = current_options.get_fg_root(); path = current_options.get_fg_root();
@ -99,21 +99,21 @@ void fgLIGHT::Update( void ) {
t = &cur_time_params; t = &cur_time_params;
v = &current_view; v = &current_view;
fgPrintf( FG_EVENT, FG_INFO, "Updating light parameters.\n" ); FG_LOG( FG_EVENT, FG_INFO, "Updating light parameters." );
// calculate lighting parameters based on sun's relative angle to // calculate lighting parameters based on sun's relative angle to
// local up // local up
deg = sun_angle * 180.0 / FG_PI; deg = sun_angle * 180.0 / FG_PI;
fgPrintf( FG_EVENT, FG_INFO, " Sun angle = %.2f.\n", deg ); FG_LOG( FG_EVENT, FG_INFO, " Sun angle = " << deg );
ambient = ambient_tbl->interpolate( deg ); ambient = ambient_tbl->interpolate( deg );
diffuse = diffuse_tbl->interpolate( deg ); diffuse = diffuse_tbl->interpolate( deg );
sky_brightness = sky_tbl->interpolate( deg ); sky_brightness = sky_tbl->interpolate( deg );
fgPrintf( FG_EVENT, FG_INFO, FG_LOG( FG_EVENT, FG_INFO,
" ambient = %.2f diffuse = %.2f sky = %.2f\n", " ambient = " << ambient << " diffuse = " << diffuse
ambient, diffuse, sky_brightness ); << " sky = " << sky_brightness );
// sky_brightness = 0.15; // used to force a dark sky (when testing) // sky_brightness = 0.15; // used to force a dark sky (when testing)
@ -152,7 +152,7 @@ void fgLIGHT::UpdateAdjFog( void ) {
f = current_aircraft.flight; f = current_aircraft.flight;
v = &current_view; v = &current_view;
fgPrintf( FG_EVENT, FG_DEBUG, "Updating adjusted fog parameters.\n" ); FG_LOG( FG_EVENT, FG_DEBUG, "Updating adjusted fog parameters." );
// set fog color (we'll try to match the sunset color in the // set fog color (we'll try to match the sunset color in the
// direction we are looking // direction we are looking
@ -212,6 +212,11 @@ fgLIGHT::~fgLIGHT( void ) {
// $Log$ // $Log$
// Revision 1.20 1998/11/06 21:18:27 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.19 1998/10/20 18:41:53 curt // Revision 1.19 1998/10/20 18:41:53 curt
// Tweaked sunrise/sunset colors. // Tweaked sunrise/sunset colors.
// //

View file

@ -34,12 +34,11 @@
#include <XGL/xgl.h> #include <XGL/xgl.h>
#include <math.h> #include <math.h>
#include <stdio.h>
#include "weather.hxx" #include "weather.hxx"
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h> #include <Debug/logstream.hxx>
#include <Math/fg_random.h> #include <Math/fg_random.h>
@ -53,7 +52,7 @@ void fgWeatherInit( void ) {
w = &current_weather; w = &current_weather;
printf("Initializing weather subsystem\n"); FG_LOG( FG_GENERAL, FG_INFO, "Initializing weather subsystem");
// Configure some wind // Configure some wind
// FG_V_north_airmass = 15; // ft/s =~ 10mph // FG_V_north_airmass = 15; // ft/s =~ 10mph
@ -101,12 +100,16 @@ void fgWeatherSetVisibility( float visibility ) {
// w->fog_density = -log(0.01 / w->visibility; // for GL_FOG_EXP // 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 w->fog_density = sqrt( -log(0.01) ) / w->visibility; // for GL_FOG_EXP2
xglFogf (GL_FOG_DENSITY, w->fog_density); xglFogf (GL_FOG_DENSITY, w->fog_density);
fgPrintf( FG_INPUT, FG_DEBUG, FG_LOG( FG_INPUT, FG_DEBUG, "Fog density = " << w->fog_density );
"Fog density = %.4f\n", w->fog_density);
} }
// $Log$ // $Log$
// Revision 1.2 1998/11/06 21:18:29 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.1 1998/10/17 01:34:36 curt // Revision 1.1 1998/10/17 01:34:36 curt
// C++ ifying ... // C++ ifying ...
// //