1
0
Fork 0

First quick hack at panel shading.

This commit is contained in:
curt 2000-05-27 06:40:55 +00:00
parent d4d10fad6b
commit febc9cf0b2
6 changed files with 25 additions and 7 deletions

4
Thanks
View file

@ -107,6 +107,10 @@ Oscar Everitt <bigoc@premier.net>
them to our little project.
Bruce Finney <bfinney@gte.net>
MSVC5 compatibility.
Jean-loup Gailly and Mark Adler <zlib@gzip.org>
Authors of the zlib library. Used for on-the-fly compression and
decompression routines.

View file

@ -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 =

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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];