From: curt Date: Sat, 27 May 2000 06:40:55 +0000 (+0000) Subject: First quick hack at panel shading. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=febc9cf0b26b27809f0fc7d5ea7bd1951c47af40;p=flightgear.git First quick hack at panel shading. --- diff --git a/Thanks b/Thanks index 13420f7af..80e348818 100644 --- a/Thanks +++ b/Thanks @@ -107,6 +107,10 @@ Oscar Everitt them to our little project. +Bruce Finney + MSVC5 compatibility. + + Jean-loup Gailly and Mark Adler Authors of the zlib library. Used for on-the-fly compression and decompression routines. diff --git a/src/Airports/simple.cxx b/src/Airports/simple.cxx index e9a04b9fb..70c59ba94 100644 --- a/src/Airports/simple.cxx +++ b/src/Airports/simple.cxx @@ -56,7 +56,10 @@ FGAirports::FGAirports( const string& file ) { // open the specified database readonly storage = new c4_Storage( file.c_str(), false ); - // need to do something about error handling here! + if ( !storage->Strategy().IsValid() ) { + FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << file ); + exit(-1); + } vAirport = new c4_View; *vAirport = diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx index 96e2b90f1..4bdc291e2 100644 --- a/src/Cockpit/panel.cxx +++ b/src/Cockpit/panel.cxx @@ -132,7 +132,12 @@ FGPanel::update () const glEnable(GL_BLEND); glEnable(GL_ALPHA_TEST); glEnable(GL_COLOR_MATERIAL); - glColor4f(1.0, 1.0, 1.0, 1.0); + // glColor4f(1.0, 1.0, 1.0, 1.0); + if ( cur_light_params.sun_angle * RAD_TO_DEG < 95.0 ) { + glColor4fv( cur_light_params.scene_diffuse ); + } else { + glColor4f(0.7, 0.2, 0.2, 1.0); + } glBindTexture(GL_TEXTURE_2D, _bg->getHandle()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); @@ -558,7 +563,11 @@ FGTexturedLayer::draw () const transform(); glBindTexture(GL_TEXTURE_2D, _texture->getHandle()); glBegin(GL_POLYGON); - + if ( cur_light_params.sun_angle * RAD_TO_DEG < 95.0 ) { + glColor4fv( cur_light_params.scene_diffuse ); + } else { + glColor4f(0.7, 0.2, 0.2, 1.0); + } glTexCoord2f(_texX1, _texY1); glVertex2f(-w2, -h2); glTexCoord2f(_texX2, _texY1); glVertex2f(w2, -h2); glTexCoord2f(_texX2, _texY2); glVertex2f(w2, h2); diff --git a/src/FDM/UIUCModel/uiuc_aircraftdir.h b/src/FDM/UIUCModel/uiuc_aircraftdir.h index 940aedd21..ad55d3f3c 100644 --- a/src/FDM/UIUCModel/uiuc_aircraftdir.h +++ b/src/FDM/UIUCModel/uiuc_aircraftdir.h @@ -70,8 +70,8 @@ typedef struct { - string aircraft_dir; - #define aircraft_dir aircraftdir_->aircraft_dir + string real_aircraft_dir; + #define aircraft_dir aircraftdir_->real_aircraft_dir } AIRCRAFTDIR; diff --git a/src/Time/light.cxx b/src/Time/light.cxx index 06c40ccb3..b7c4a6b81 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -137,10 +137,12 @@ void fgLIGHT::Update( void ) { scene_ambient[0] = white[0] * ambient; scene_ambient[1] = white[1] * ambient; scene_ambient[2] = white[2] * ambient; + scene_ambient[3] = 1.0; scene_diffuse[0] = white[0] * diffuse; scene_diffuse[1] = white[1] * diffuse; scene_diffuse[2] = white[2] * diffuse; + scene_diffuse[3] = 1.0; // set sky color sky_color[0] = base_sky_color[0] * sky_brightness; diff --git a/src/Time/light.hxx b/src/Time/light.hxx index 0466f033e..ab8e93bc8 100644 --- a/src/Time/light.hxx +++ b/src/Time/light.hxx @@ -113,10 +113,10 @@ public: // Derived lighting values // ambient component - GLfloat scene_ambient[3]; + GLfloat scene_ambient[4]; // diffuse component - GLfloat scene_diffuse[3]; + GLfloat scene_diffuse[4]; // fog color GLfloat fog_color[4];