}
-
-// generate the directional white light environment texture map
-static int gen_white_light_map() {
- const int env_tex_res = 32;
- int half_res = env_tex_res / 2;
- unsigned char env_map[env_tex_res][env_tex_res][4];
- GLuint tex_name;
-
- for ( int i = 0; i < env_tex_res; ++i ) {
- for ( int j = 0; j < env_tex_res; ++j ) {
- double x = (i - half_res) / (double)half_res;
- double y = (j - half_res) / (double)half_res;
- double dist = sqrt(x*x + y*y);
- if ( dist > 1.0 ) { dist = 1.0; }
- double bright = cos( dist * SGD_PI_2 );
- if ( bright < 0.3 ) { bright = 0.3; }
- env_map[i][j][0] = 235;
- env_map[i][j][1] = 235;
- env_map[i][j][2] = 215; // slight yellow tint
- env_map[i][j][3] = (int)(bright * 255);
- }
- }
-
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
- glGenTextures( 1, &tex_name );
- glBindTexture( GL_TEXTURE_2D, tex_name );
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, env_tex_res, env_tex_res, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, env_map);
-
- return tex_name;
-}
-
-
-// generate the medium intensity directional white light environment
-// texture map
-static int gen_white_light_medium_map() {
- const int env_tex_res = 32;
- int half_res = env_tex_res / 2;
- unsigned char env_map[env_tex_res][env_tex_res][4];
- GLuint tex_name;
-
- for ( int i = 0; i < env_tex_res; ++i ) {
- for ( int j = 0; j < env_tex_res; ++j ) {
- double x = (i - half_res) / (double)half_res;
- double y = (j - half_res) / (double)half_res;
- double dist = sqrt(x*x + y*y);
- if ( dist > 1.0 ) { dist = 1.0; }
- double bright = cos( dist * SGD_PI_2 );
- if ( bright < 0.3 ) { bright = 0.3; }
- env_map[i][j][0] = 235;
- env_map[i][j][1] = 235;
- env_map[i][j][2] = 215; // slight yellow tint
- env_map[i][j][3] = (int)(bright * 205);
- }
- }
-
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
- glGenTextures( 1, &tex_name );
- glBindTexture( GL_TEXTURE_2D, tex_name );
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, env_tex_res, env_tex_res, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, env_map);
-
- return tex_name;
-}
-
-
-// generate the low intensity directional white light environment
-// texture map
-static int gen_white_light_low_map() {
- const int env_tex_res = 32;
- int half_res = env_tex_res / 2;
- unsigned char env_map[env_tex_res][env_tex_res][4];
- GLuint tex_name;
-
- for ( int i = 0; i < env_tex_res; ++i ) {
- for ( int j = 0; j < env_tex_res; ++j ) {
- double x = (i - half_res) / (double)half_res;
- double y = (j - half_res) / (double)half_res;
- double dist = sqrt(x*x + y*y);
- if ( dist > 1.0 ) { dist = 1.0; }
- double bright = cos( dist * SGD_PI_2 );
- if ( bright < 0.3 ) { bright = 0.3; }
- env_map[i][j][0] = 235;
- env_map[i][j][1] = 235;
- env_map[i][j][2] = 215; // slight yellow tint
- env_map[i][j][3] = (int)(bright * 155);
- }
- }
-
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
- glGenTextures( 1, &tex_name );
- glBindTexture( GL_TEXTURE_2D, tex_name );
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, env_tex_res, env_tex_res, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, env_map);
-
- return tex_name;
-}
-
-
-// generate the directional yellow light environment texture map
-static int gen_yellow_light_map() {
- const int env_tex_res = 32;
- int half_res = env_tex_res / 2;
- unsigned char env_map[env_tex_res][env_tex_res][4];
- GLuint tex_name;
-
- for ( int i = 0; i < env_tex_res; ++i ) {
- for ( int j = 0; j < env_tex_res; ++j ) {
- double x = (i - half_res) / (double)half_res;
- double y = (j - half_res) / (double)half_res;
- double dist = sqrt(x*x + y*y);
- if ( dist > 1.0 ) { dist = 1.0; }
- double bright = cos( dist * SGD_PI_2 );
- if ( bright < 0.3 ) { bright = 0.3; }
- env_map[i][j][0] = 235;
- env_map[i][j][1] = 235;
- env_map[i][j][2] = 20;
- env_map[i][j][3] = (int)(bright * 255);
- }
- }
-
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
- glGenTextures( 1, &tex_name );
- glBindTexture( GL_TEXTURE_2D, tex_name );
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, env_tex_res, env_tex_res, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, env_map);
-
- return tex_name;
-}
-
-
-// generate the medium intensity directional yellow light environment
-// texture map
-static int gen_yellow_light_medium_map() {
- const int env_tex_res = 32;
- int half_res = env_tex_res / 2;
- unsigned char env_map[env_tex_res][env_tex_res][4];
- GLuint tex_name;
-
- for ( int i = 0; i < env_tex_res; ++i ) {
- for ( int j = 0; j < env_tex_res; ++j ) {
- double x = (i - half_res) / (double)half_res;
- double y = (j - half_res) / (double)half_res;
- double dist = sqrt(x*x + y*y);
- if ( dist > 1.0 ) { dist = 1.0; }
- double bright = cos( dist * SGD_PI_2 );
- if ( bright < 0.3 ) { bright = 0.3; }
- env_map[i][j][0] = 235;
- env_map[i][j][1] = 235;
- env_map[i][j][2] = 20;
- env_map[i][j][3] = (int)(bright * 205);
- }
- }
-
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
- glGenTextures( 1, &tex_name );
- glBindTexture( GL_TEXTURE_2D, tex_name );
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, env_tex_res, env_tex_res, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, env_map);
-
- return tex_name;
-}
-
-
-// generate the low intensity directional yellow light environment
-// texture map
-static int gen_yellow_light_low_map() {
- const int env_tex_res = 32;
- int half_res = env_tex_res / 2;
- unsigned char env_map[env_tex_res][env_tex_res][4];
- GLuint tex_name;
-
- for ( int i = 0; i < env_tex_res; ++i ) {
- for ( int j = 0; j < env_tex_res; ++j ) {
- double x = (i - half_res) / (double)half_res;
- double y = (j - half_res) / (double)half_res;
- double dist = sqrt(x*x + y*y);
- if ( dist > 1.0 ) { dist = 1.0; }
- double bright = cos( dist * SGD_PI_2 );
- if ( bright < 0.3 ) { bright = 0.3; }
- env_map[i][j][0] = 235;
- env_map[i][j][1] = 235;
- env_map[i][j][2] = 20;
- env_map[i][j][3] = (int)(bright * 155);
- }
- }
-
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
- glGenTextures( 1, &tex_name );
- glBindTexture( GL_TEXTURE_2D, tex_name );
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, env_tex_res, env_tex_res, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, env_map);
-
- return tex_name;
-}
-
-
-// generate the directional red light environment texture map
-static int gen_red_light_map() {
- const int env_tex_res = 32;
- int half_res = env_tex_res / 2;
- unsigned char env_map[env_tex_res][env_tex_res][4];
- GLuint tex_name;
-
- for ( int i = 0; i < env_tex_res; ++i ) {
- for ( int j = 0; j < env_tex_res; ++j ) {
- double x = (i - half_res) / (double)half_res;
- double y = (j - half_res) / (double)half_res;
- double dist = sqrt(x*x + y*y);
- if ( dist > 1.0 ) { dist = 1.0; }
- double bright = cos( dist * SGD_PI_2 );
- if ( bright < 0.3 ) { bright = 0.3; }
- env_map[i][j][0] = 235;
- env_map[i][j][1] = 20;
- env_map[i][j][2] = 20;
- env_map[i][j][3] = (int)(bright * 255);
- }
- }
-
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
- glGenTextures( 1, &tex_name );
- glBindTexture( GL_TEXTURE_2D, tex_name );
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, env_tex_res, env_tex_res, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, env_map);
-
- return tex_name;
-}
-
-
// generate the directional vasi light environment texture map
static int gen_vasi_light_map() {
const int env_tex_res = 256;