1998-10-17 07:26:44 +08:00
|
|
|
// sky.cxx -- model sky with an upside down "bowl"
|
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started December 1997.
|
|
|
|
//
|
|
|
|
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
// (Log is kept at end of this file)
|
1997-12-18 07:14:30 +08:00
|
|
|
|
|
|
|
|
1998-04-24 08:45:00 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
1998-04-04 05:50:53 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_WINDOWS_H
|
1997-12-18 07:14:30 +08:00
|
|
|
# include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include <GL/glut.h>
|
1998-01-20 03:26:51 +08:00
|
|
|
#include <XGL/xgl.h>
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
#include <Aircraft/aircraft.hxx>
|
1998-11-07 05:17:31 +08:00
|
|
|
#include <Debug/logstream.hxx>
|
1999-02-02 05:33:23 +08:00
|
|
|
#include <FDM/flight.hxx>
|
1998-01-27 08:47:41 +08:00
|
|
|
#include <Include/fg_constants.h>
|
1998-04-22 21:21:26 +08:00
|
|
|
#include <Main/views.hxx>
|
1998-01-20 03:26:51 +08:00
|
|
|
#include <Math/fg_random.h>
|
1998-04-24 08:45:00 +08:00
|
|
|
#include <Time/event.hxx>
|
|
|
|
#include <Time/fg_time.hxx>
|
1998-04-22 21:21:26 +08:00
|
|
|
|
|
|
|
#include "sky.hxx"
|
|
|
|
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// in meters of course
|
1997-12-20 07:34:03 +08:00
|
|
|
#define CENTER_ELEV 25000.0
|
1998-01-26 23:54:28 +08:00
|
|
|
|
1997-12-18 07:14:30 +08:00
|
|
|
#define INNER_RADIUS 50000.0
|
1997-12-19 07:32:28 +08:00
|
|
|
#define INNER_ELEV 20000.0
|
1998-01-26 23:54:28 +08:00
|
|
|
|
1997-12-18 07:14:30 +08:00
|
|
|
#define MIDDLE_RADIUS 70000.0
|
1997-12-20 07:34:03 +08:00
|
|
|
#define MIDDLE_ELEV 8000.0
|
1998-01-26 23:54:28 +08:00
|
|
|
|
1997-12-18 07:14:30 +08:00
|
|
|
#define OUTER_RADIUS 80000.0
|
|
|
|
#define OUTER_ELEV 0.0
|
|
|
|
|
1998-01-26 23:54:28 +08:00
|
|
|
#define BOTTOM_RADIUS 50000.0
|
|
|
|
#define BOTTOM_ELEV -2000.0
|
|
|
|
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1997-12-23 07:45:45 +08:00
|
|
|
static float inner_vertex[12][3];
|
|
|
|
static float middle_vertex[12][3];
|
|
|
|
static float outer_vertex[12][3];
|
1998-01-26 23:54:28 +08:00
|
|
|
static float bottom_vertex[12][3];
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1997-12-23 07:45:45 +08:00
|
|
|
static float inner_color[12][4];
|
|
|
|
static float middle_color[12][4];
|
|
|
|
static float outer_color[12][4];
|
|
|
|
|
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// Calculate the sky structure vertices
|
1998-01-20 02:40:15 +08:00
|
|
|
void fgSkyVerticesInit( void ) {
|
1997-12-18 07:14:30 +08:00
|
|
|
float theta;
|
|
|
|
int i;
|
|
|
|
|
1998-11-07 05:17:31 +08:00
|
|
|
FG_LOG(FG_ASTRO, FG_INFO, " Generating the sky dome vertices.");
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1997-12-19 07:32:28 +08:00
|
|
|
for ( i = 0; i < 12; i++ ) {
|
|
|
|
theta = (i * 30.0) * DEG_TO_RAD;
|
|
|
|
|
1997-12-23 07:45:45 +08:00
|
|
|
inner_vertex[i][0] = cos(theta) * INNER_RADIUS;
|
|
|
|
inner_vertex[i][1] = sin(theta) * INNER_RADIUS;
|
|
|
|
inner_vertex[i][2] = INNER_ELEV;
|
1997-12-19 07:32:28 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// printf(" %.2f %.2f\n", cos(theta) * INNER_RADIUS,
|
|
|
|
// sin(theta) * INNER_RADIUS);
|
1997-12-19 07:32:28 +08:00
|
|
|
|
1997-12-23 07:45:45 +08:00
|
|
|
middle_vertex[i][0] = cos((double)theta) * MIDDLE_RADIUS;
|
|
|
|
middle_vertex[i][1] = sin((double)theta) * MIDDLE_RADIUS;
|
|
|
|
middle_vertex[i][2] = MIDDLE_ELEV;
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1997-12-23 07:45:45 +08:00
|
|
|
outer_vertex[i][0] = cos((double)theta) * OUTER_RADIUS;
|
|
|
|
outer_vertex[i][1] = sin((double)theta) * OUTER_RADIUS;
|
|
|
|
outer_vertex[i][2] = OUTER_ELEV;
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1998-01-26 23:54:28 +08:00
|
|
|
bottom_vertex[i][0] = cos((double)theta) * BOTTOM_RADIUS;
|
|
|
|
bottom_vertex[i][1] = sin((double)theta) * BOTTOM_RADIUS;
|
|
|
|
bottom_vertex[i][2] = BOTTOM_ELEV;
|
1997-12-18 07:14:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// (Re)calculate the sky colors at each vertex
|
1998-01-20 02:40:15 +08:00
|
|
|
void fgSkyColorsInit( void ) {
|
1998-04-26 13:10:00 +08:00
|
|
|
fgLIGHT *l;
|
1998-07-23 05:39:21 +08:00
|
|
|
double sun_angle, diff;
|
|
|
|
double outer_param[3], outer_amt[3], outer_diff[3];
|
|
|
|
double middle_param[3], middle_amt[3], middle_diff[3];
|
1997-12-23 07:45:45 +08:00
|
|
|
int i, j;
|
|
|
|
|
|
|
|
l = &cur_light_params;
|
|
|
|
|
1998-11-07 05:17:31 +08:00
|
|
|
FG_LOG( FG_ASTRO, FG_INFO,
|
|
|
|
" Generating the sky colors for each vertex." );
|
1997-12-23 07:45:45 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// setup for the possibility of sunset effects
|
1997-12-23 07:45:45 +08:00
|
|
|
sun_angle = l->sun_angle * RAD_TO_DEG;
|
1998-08-13 05:40:44 +08:00
|
|
|
// fgPrintf( FG_ASTRO, FG_INFO,
|
|
|
|
// " Sun angle in degrees = %.2f\n", sun_angle);
|
1997-12-23 07:45:45 +08:00
|
|
|
|
|
|
|
if ( (sun_angle > 80.0) && (sun_angle < 100.0) ) {
|
1998-10-17 07:26:44 +08:00
|
|
|
// 0.0 - 0.4
|
1998-10-21 02:28:30 +08:00
|
|
|
outer_param[0] = (10.0 - fabs(90.0 - sun_angle)) / 20.0;
|
|
|
|
outer_param[1] = (10.0 - fabs(90.0 - sun_angle)) / 40.0;
|
|
|
|
outer_param[2] = -(10.0 - fabs(90.0 - sun_angle)) / 30.0;
|
|
|
|
// outer_param[2] = 0.0;
|
1997-12-23 07:45:45 +08:00
|
|
|
|
1998-10-21 02:28:30 +08:00
|
|
|
middle_param[0] = (10.0 - fabs(90.0 - sun_angle)) / 40.0;
|
|
|
|
middle_param[1] = (10.0 - fabs(90.0 - sun_angle)) / 80.0;
|
1997-12-23 12:58:38 +08:00
|
|
|
middle_param[2] = 0.0;
|
|
|
|
|
|
|
|
outer_diff[0] = outer_param[0] / 6.0;
|
|
|
|
outer_diff[1] = outer_param[1] / 6.0;
|
|
|
|
outer_diff[2] = outer_param[2] / 6.0;
|
|
|
|
|
|
|
|
middle_diff[0] = middle_param[0] / 6.0;
|
|
|
|
middle_diff[1] = middle_param[1] / 6.0;
|
|
|
|
middle_diff[2] = middle_param[2] / 6.0;
|
1997-12-23 07:45:45 +08:00
|
|
|
} else {
|
1997-12-23 12:58:38 +08:00
|
|
|
outer_param[0] = outer_param[1] = outer_param[2] = 0.0;
|
|
|
|
middle_param[0] = middle_param[1] = middle_param[2] = 0.0;
|
|
|
|
|
|
|
|
outer_diff[0] = outer_diff[1] = outer_diff[2] = 0.0;
|
|
|
|
middle_diff[0] = middle_diff[1] = middle_diff[2] = 0.0;
|
1997-12-23 07:45:45 +08:00
|
|
|
}
|
1998-10-17 07:26:44 +08:00
|
|
|
// printf(" outer_red_param = %.2f outer_red_diff = %.2f\n",
|
|
|
|
// outer_red_param, outer_red_diff);
|
1997-12-23 07:45:45 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// calculate transition colors between sky and fog
|
1997-12-23 12:58:38 +08:00
|
|
|
for ( j = 0; j < 3; j++ ) {
|
|
|
|
outer_amt[j] = outer_param[j];
|
|
|
|
middle_amt[j] = middle_param[j];
|
|
|
|
}
|
1997-12-23 07:45:45 +08:00
|
|
|
|
|
|
|
for ( i = 0; i < 6; i++ ) {
|
|
|
|
for ( j = 0; j < 3; j++ ) {
|
|
|
|
diff = l->sky_color[j] - l->fog_color[j];
|
1997-12-23 12:58:38 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// printf("sky = %.2f fog = %.2f diff = %.2f\n",
|
|
|
|
// l->sky_color[j], l->fog_color[j], diff);
|
1998-04-24 08:45:00 +08:00
|
|
|
|
1997-12-23 07:45:45 +08:00
|
|
|
inner_color[i][j] = l->sky_color[j] - diff * 0.3;
|
1997-12-23 12:58:38 +08:00
|
|
|
middle_color[i][j] = l->sky_color[j] - diff * 0.9 + middle_amt[j];
|
|
|
|
outer_color[i][j] = l->fog_color[j] + outer_amt[j];
|
|
|
|
|
1998-04-24 08:45:00 +08:00
|
|
|
if ( inner_color[i][j] > 1.00 ) { inner_color[i][j] = 1.00; }
|
|
|
|
if ( inner_color[i][j] < 0.10 ) { inner_color[i][j] = 0.10; }
|
1997-12-30 21:06:56 +08:00
|
|
|
if ( middle_color[i][j] > 1.00 ) { middle_color[i][j] = 1.00; }
|
|
|
|
if ( middle_color[i][j] < 0.10 ) { middle_color[i][j] = 0.10; }
|
|
|
|
if ( outer_color[i][j] > 1.00 ) { outer_color[i][j] = 1.00; }
|
|
|
|
if ( outer_color[i][j] < 0.10 ) { outer_color[i][j] = 0.10; }
|
1997-12-23 07:45:45 +08:00
|
|
|
}
|
|
|
|
inner_color[i][3] = middle_color[i][3] = outer_color[i][3] =
|
|
|
|
l->sky_color[3];
|
|
|
|
|
1997-12-23 12:58:38 +08:00
|
|
|
for ( j = 0; j < 3; j++ ) {
|
|
|
|
outer_amt[j] -= outer_diff[j];
|
|
|
|
middle_amt[j] -= middle_diff[j];
|
|
|
|
}
|
1997-12-23 07:45:45 +08:00
|
|
|
|
1997-12-31 04:47:34 +08:00
|
|
|
/*
|
1997-12-23 07:45:45 +08:00
|
|
|
printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0],
|
|
|
|
inner_color[i][1], inner_color[i][2], inner_color[i][3]);
|
|
|
|
printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
|
|
|
middle_color[i][0], middle_color[i][1], middle_color[i][2],
|
|
|
|
middle_color[i][3]);
|
|
|
|
printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
|
|
|
outer_color[i][0], outer_color[i][1], outer_color[i][2],
|
|
|
|
outer_color[i][3]);
|
1997-12-31 04:47:34 +08:00
|
|
|
*/
|
1997-12-23 07:45:45 +08:00
|
|
|
}
|
|
|
|
|
1997-12-23 12:58:38 +08:00
|
|
|
for ( j = 0; j < 3; j++ ) {
|
|
|
|
outer_amt[j] = 0.0;
|
|
|
|
middle_amt[j] = 0.0;
|
|
|
|
}
|
1997-12-23 07:45:45 +08:00
|
|
|
|
|
|
|
for ( i = 6; i < 12; i++ ) {
|
|
|
|
|
|
|
|
for ( j = 0; j < 3; j++ ) {
|
|
|
|
diff = l->sky_color[j] - l->fog_color[j];
|
1997-12-23 12:58:38 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// printf("sky = %.2f fog = %.2f diff = %.2f\n",
|
|
|
|
// l->sky_color[j], l->fog_color[j], diff);
|
1998-04-24 08:45:00 +08:00
|
|
|
|
1997-12-23 07:45:45 +08:00
|
|
|
inner_color[i][j] = l->sky_color[j] - diff * 0.3;
|
1997-12-23 12:58:38 +08:00
|
|
|
middle_color[i][j] = l->sky_color[j] - diff * 0.9 + middle_amt[j];
|
|
|
|
outer_color[i][j] = l->fog_color[j] + outer_amt[j];
|
|
|
|
|
1998-04-24 08:45:00 +08:00
|
|
|
if ( inner_color[i][j] > 1.00 ) { inner_color[i][j] = 1.00; }
|
|
|
|
if ( inner_color[i][j] < 0.10 ) { inner_color[i][j] = 0.10; }
|
1997-12-30 21:06:56 +08:00
|
|
|
if ( middle_color[i][j] > 1.00 ) { middle_color[i][j] = 1.00; }
|
|
|
|
if ( middle_color[i][j] < 0.10 ) { middle_color[i][j] = 0.10; }
|
|
|
|
if ( outer_color[i][j] > 1.00 ) { outer_color[i][j] = 1.00; }
|
|
|
|
if ( outer_color[i][j] < 0.15 ) { outer_color[i][j] = 0.15; }
|
1997-12-23 07:45:45 +08:00
|
|
|
}
|
|
|
|
inner_color[i][3] = middle_color[i][3] = outer_color[i][3] =
|
|
|
|
l->sky_color[3];
|
|
|
|
|
1997-12-23 12:58:38 +08:00
|
|
|
for ( j = 0; j < 3; j++ ) {
|
|
|
|
outer_amt[j] += outer_diff[j];
|
|
|
|
middle_amt[j] += middle_diff[j];
|
|
|
|
}
|
1997-12-23 07:45:45 +08:00
|
|
|
|
1997-12-31 04:47:34 +08:00
|
|
|
/*
|
1997-12-23 07:45:45 +08:00
|
|
|
printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0],
|
|
|
|
inner_color[i][1], inner_color[i][2], inner_color[i][3]);
|
|
|
|
printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
|
|
|
middle_color[i][0], middle_color[i][1], middle_color[i][2],
|
|
|
|
middle_color[i][3]);
|
|
|
|
printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
|
|
|
outer_color[i][0], outer_color[i][1], outer_color[i][2],
|
|
|
|
outer_color[i][3]);
|
1997-12-31 04:47:34 +08:00
|
|
|
*/
|
1997-12-23 07:45:45 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// Initialize the sky structure and colors
|
1998-01-20 02:40:15 +08:00
|
|
|
void fgSkyInit( void ) {
|
1998-11-07 05:17:31 +08:00
|
|
|
FG_LOG( FG_ASTRO, FG_INFO, "Initializing the sky" );
|
1997-12-31 04:47:34 +08:00
|
|
|
|
1997-12-23 07:45:45 +08:00
|
|
|
fgSkyVerticesInit();
|
1997-12-31 04:47:34 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// regester fgSkyColorsInit() as an event to be run periodically
|
1998-05-23 22:07:14 +08:00
|
|
|
global_events.Register( "fgSkyColorsInit()", fgSkyColorsInit,
|
1998-08-29 21:07:16 +08:00
|
|
|
fgEVENT::FG_EVENT_READY, 30000);
|
1997-12-23 07:45:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// Draw the Sky
|
1998-01-20 02:40:15 +08:00
|
|
|
void fgSkyRender( void ) {
|
1999-02-06 05:28:09 +08:00
|
|
|
FGInterface *f;
|
1998-04-26 13:10:00 +08:00
|
|
|
fgLIGHT *l;
|
1998-08-13 05:40:44 +08:00
|
|
|
float inner_color[4];
|
|
|
|
float middle_color[4];
|
|
|
|
float outer_color[4];
|
|
|
|
double diff;
|
1997-12-18 07:14:30 +08:00
|
|
|
int i;
|
|
|
|
|
1998-12-05 23:53:59 +08:00
|
|
|
f = current_aircraft.fdm_state;
|
1997-12-20 07:34:03 +08:00
|
|
|
l = &cur_light_params;
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// printf("Rendering the sky.\n");
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1998-08-13 05:40:44 +08:00
|
|
|
// calculate the proper colors
|
|
|
|
for ( i = 0; i < 3; i++ ) {
|
|
|
|
diff = l->sky_color[i] - l->adj_fog_color[i];
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// printf("sky = %.2f fog = %.2f diff = %.2f\n",
|
|
|
|
// l->sky_color[j], l->adj_fog_color[j], diff);
|
1998-08-13 05:40:44 +08:00
|
|
|
|
|
|
|
inner_color[i] = l->sky_color[i] - diff * 0.3;
|
|
|
|
middle_color[i] = l->sky_color[i] - diff * 0.9;
|
|
|
|
outer_color[i] = l->adj_fog_color[i];
|
1997-12-22 12:14:28 +08:00
|
|
|
}
|
1998-08-22 09:18:59 +08:00
|
|
|
inner_color[3] = middle_color[3] = outer_color[3] = l->adj_fog_color[3];
|
1998-08-13 05:40:44 +08:00
|
|
|
|
|
|
|
xglPushMatrix();
|
1997-12-22 12:14:28 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// Translate to view position
|
1998-12-10 02:50:12 +08:00
|
|
|
Point3D zero_elev = current_view.get_cur_zero_elev();
|
|
|
|
xglTranslatef( zero_elev.x(), zero_elev.y(), zero_elev.z() );
|
1998-10-17 07:26:44 +08:00
|
|
|
// printf(" Translated to %.2f %.2f %.2f\n",
|
1998-12-10 02:50:12 +08:00
|
|
|
// zero_elev.x, zero_elev.y, zero_elev.z );
|
1997-12-18 12:07:02 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// Rotate to proper orientation
|
|
|
|
// printf(" lon = %.2f lat = %.2f\n", FG_Longitude * RAD_TO_DEG,
|
|
|
|
// FG_Latitude * RAD_TO_DEG);
|
1998-12-03 09:15:35 +08:00
|
|
|
xglRotatef( f->get_Longitude() * RAD_TO_DEG, 0.0, 0.0, 1.0 );
|
|
|
|
xglRotatef( 90.0 - f->get_Latitude() * RAD_TO_DEG, 0.0, 1.0, 0.0 );
|
1998-07-23 05:39:21 +08:00
|
|
|
xglRotatef( l->sun_rotation * RAD_TO_DEG, 0.0, 0.0, 1.0 );
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// Draw inner/center section of sky*/
|
1997-12-19 07:32:28 +08:00
|
|
|
xglBegin( GL_TRIANGLE_FAN );
|
1997-12-20 07:34:03 +08:00
|
|
|
xglColor4fv(l->sky_color);
|
|
|
|
xglVertex3f(0.0, 0.0, CENTER_ELEV);
|
1999-02-03 04:13:29 +08:00
|
|
|
for ( i = 11; i >= 0; i-- ) {
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( inner_color );
|
1997-12-23 07:45:45 +08:00
|
|
|
xglVertex3fv( inner_vertex[i] );
|
1997-12-19 07:32:28 +08:00
|
|
|
}
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( inner_color );
|
1999-02-02 05:09:00 +08:00
|
|
|
xglVertex3fv( inner_vertex[11] );
|
1997-12-19 07:32:28 +08:00
|
|
|
xglEnd();
|
|
|
|
|
1998-04-24 08:45:00 +08:00
|
|
|
// Draw the middle ring
|
1997-12-19 07:32:28 +08:00
|
|
|
xglBegin( GL_TRIANGLE_STRIP );
|
|
|
|
for ( i = 0; i < 12; i++ ) {
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( middle_color );
|
1998-10-17 07:26:44 +08:00
|
|
|
// printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
|
|
|
// middle_color[i][0], middle_color[i][1], middle_color[i][2],
|
|
|
|
// middle_color[i][3]);
|
1998-04-24 08:45:00 +08:00
|
|
|
// xglColor4f(1.0, 0.0, 0.0, 1.0);
|
1997-12-23 07:45:45 +08:00
|
|
|
xglVertex3fv( middle_vertex[i] );
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( inner_color );
|
1998-10-17 07:26:44 +08:00
|
|
|
// printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
|
|
|
// inner_color[i][0], inner_color[i][1], inner_color[i][2],
|
|
|
|
// inner_color[i][3]);
|
1998-04-24 08:45:00 +08:00
|
|
|
// xglColor4f(0.0, 0.0, 1.0, 1.0);
|
1997-12-23 07:45:45 +08:00
|
|
|
xglVertex3fv( inner_vertex[i] );
|
1997-12-19 07:32:28 +08:00
|
|
|
}
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( middle_color );
|
1998-04-24 08:45:00 +08:00
|
|
|
// xglColor4f(1.0, 0.0, 0.0, 1.0);
|
1997-12-23 07:45:45 +08:00
|
|
|
xglVertex3fv( middle_vertex[0] );
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( inner_color );
|
1998-04-24 08:45:00 +08:00
|
|
|
// xglColor4f(0.0, 0.0, 1.0, 1.0);
|
1997-12-23 07:45:45 +08:00
|
|
|
xglVertex3fv( inner_vertex[0] );
|
1997-12-19 07:32:28 +08:00
|
|
|
xglEnd();
|
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// Draw the outer ring
|
1997-12-19 07:32:28 +08:00
|
|
|
xglBegin( GL_TRIANGLE_STRIP );
|
|
|
|
for ( i = 0; i < 12; i++ ) {
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( outer_color );
|
1997-12-23 07:45:45 +08:00
|
|
|
xglVertex3fv( outer_vertex[i] );
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( middle_color );
|
1997-12-23 07:45:45 +08:00
|
|
|
xglVertex3fv( middle_vertex[i] );
|
1997-12-19 07:32:28 +08:00
|
|
|
}
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( outer_color );
|
1997-12-23 07:45:45 +08:00
|
|
|
xglVertex3fv( outer_vertex[0] );
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( middle_color );
|
1997-12-23 07:45:45 +08:00
|
|
|
xglVertex3fv( middle_vertex[0] );
|
1997-12-19 07:32:28 +08:00
|
|
|
xglEnd();
|
1997-12-18 07:14:30 +08:00
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// Draw the bottom skirt
|
1998-01-26 23:54:28 +08:00
|
|
|
xglBegin( GL_TRIANGLE_STRIP );
|
1998-08-13 05:40:44 +08:00
|
|
|
xglColor4fv( outer_color );
|
1998-01-26 23:54:28 +08:00
|
|
|
for ( i = 0; i < 12; i++ ) {
|
|
|
|
xglVertex3fv( bottom_vertex[i] );
|
|
|
|
xglVertex3fv( outer_vertex[i] );
|
|
|
|
}
|
|
|
|
xglVertex3fv( bottom_vertex[0] );
|
|
|
|
xglVertex3fv( outer_vertex[0] );
|
|
|
|
xglEnd();
|
1998-03-10 06:47:25 +08:00
|
|
|
|
1997-12-18 07:14:30 +08:00
|
|
|
xglPopMatrix();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-10-17 07:26:44 +08:00
|
|
|
// $Log$
|
1999-02-06 05:28:09 +08:00
|
|
|
// Revision 1.21 1999/02/05 21:28:50 curt
|
|
|
|
// Modifications to incorporate Jon S. Berndts flight model code.
|
|
|
|
//
|
1999-02-03 04:13:29 +08:00
|
|
|
// Revision 1.20 1999/02/02 20:13:29 curt
|
|
|
|
// MSVC++ portability changes by Bernie Bright:
|
|
|
|
//
|
|
|
|
// Lib/Serial/serial.[ch]xx: Initial Windows support - incomplete.
|
|
|
|
// Simulator/Astro/stars.cxx: typo? included <stdio> instead of <cstdio>
|
|
|
|
// Simulator/Cockpit/hud.cxx: Added Standard headers
|
|
|
|
// Simulator/Cockpit/panel.cxx: Redefinition of default parameter
|
|
|
|
// Simulator/Flight/flight.cxx: Replaced cout with FG_LOG. Deleted <stdio.h>
|
|
|
|
// Simulator/Main/fg_init.cxx:
|
|
|
|
// Simulator/Main/GLUTmain.cxx:
|
|
|
|
// Simulator/Main/options.hxx: Shuffled <fg_serial.hxx> dependency
|
|
|
|
// Simulator/Objects/material.hxx:
|
|
|
|
// Simulator/Time/timestamp.hxx: VC++ friend kludge
|
|
|
|
// Simulator/Scenery/tile.[ch]xx: Fixed using std::X declarations
|
|
|
|
// Simulator/Main/views.hxx: Added a constant
|
|
|
|
//
|
1999-02-02 05:33:23 +08:00
|
|
|
// Revision 1.19 1999/02/01 21:33:26 curt
|
|
|
|
// Renamed FlightGear/Simulator/Flight to FlightGear/Simulator/FDM since
|
|
|
|
// Jon accepted my offer to do this and thought it was a good idea.
|
|
|
|
//
|
1999-02-02 05:09:00 +08:00
|
|
|
// Revision 1.18 1999/02/01 21:09:00 curt
|
|
|
|
// Bug fix in vertex order of inner disk (fan) of the sky dome.
|
|
|
|
//
|
1998-12-10 02:50:12 +08:00
|
|
|
// Revision 1.17 1998/12/09 18:50:12 curt
|
|
|
|
// Converted "class fgVIEW" to "class FGView" and updated to make data
|
|
|
|
// members private and make required accessor functions.
|
|
|
|
//
|
1998-12-05 23:53:59 +08:00
|
|
|
// Revision 1.16 1998/12/05 15:54:03 curt
|
|
|
|
// Renamed class fgFLIGHT to class FGState as per request by JSB.
|
|
|
|
//
|
1998-12-03 09:15:35 +08:00
|
|
|
// Revision 1.15 1998/12/03 01:15:36 curt
|
|
|
|
// Converted fgFLIGHT to a class.
|
|
|
|
// Tweaks for Sun portability.
|
|
|
|
//
|
1998-11-07 05:17:31 +08:00
|
|
|
// 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.
|
|
|
|
//
|
1998-10-21 02:28:30 +08:00
|
|
|
// Revision 1.13 1998/10/20 18:28:30 curt
|
|
|
|
// Tweaked sunset/sunrise colors.
|
|
|
|
//
|
1998-10-17 07:26:44 +08:00
|
|
|
// Revision 1.12 1998/10/16 23:27:18 curt
|
|
|
|
// C++-ifying.
|
|
|
|
//
|
|
|
|
// Revision 1.11 1998/10/16 00:52:19 curt
|
|
|
|
// Converted to Point3D class.
|
|
|
|
//
|
|
|
|
// Revision 1.10 1998/08/29 13:07:16 curt
|
|
|
|
// Rewrite of event manager thanks to Bernie Bright.
|
|
|
|
//
|
|
|
|
// Revision 1.9 1998/08/22 01:18:59 curt
|
|
|
|
// Minor tweaks to avoid using unitialized memory.
|
|
|
|
//
|
|
|
|
// Revision 1.8 1998/08/12 21:40:44 curt
|
|
|
|
// Sky now tracks adjusted fog color so it blends well with terrain.
|
|
|
|
//
|
|
|
|
// Revision 1.7 1998/07/22 21:39:21 curt
|
|
|
|
// Lower skirt tracks adjusted fog color, not fog color.
|
|
|
|
//
|
|
|
|
// Revision 1.6 1998/05/23 14:07:14 curt
|
|
|
|
// Use new C++ events class.
|
|
|
|
//
|
|
|
|
// Revision 1.5 1998/04/28 01:19:02 curt
|
|
|
|
// Type-ified fgTIME and fgVIEW
|
|
|
|
//
|
|
|
|
// Revision 1.4 1998/04/26 05:10:01 curt
|
|
|
|
// "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd.
|
|
|
|
//
|
|
|
|
// Revision 1.3 1998/04/25 22:06:25 curt
|
|
|
|
// Edited cvs log messages in source files ... bad bad bad!
|
|
|
|
//
|
|
|
|
// Revision 1.2 1998/04/24 00:45:03 curt
|
|
|
|
// Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
|
|
|
|
// Fixed a bug when generating sky colors.
|
|
|
|
//
|
|
|
|
// Revision 1.1 1998/04/22 13:21:32 curt
|
|
|
|
// C++ - ifing the code a bit.
|
|
|
|
//
|
|
|
|
// Revision 1.9 1998/04/03 21:52:50 curt
|
|
|
|
// Converting to Gnu autoconf system.
|
|
|
|
//
|
|
|
|
// Revision 1.8 1998/03/09 22:47:25 curt
|
|
|
|
// Incorporated Durk's updates.
|
|
|
|
//
|
|
|
|
// Revision 1.7 1998/02/19 13:05:49 curt
|
|
|
|
// Incorporated some HUD tweaks from Michelle America.
|
|
|
|
// Tweaked the sky's sunset/rise colors.
|
|
|
|
// Other misc. tweaks.
|
|
|
|
//
|
|
|
|
// Revision 1.6 1998/02/07 15:29:32 curt
|
|
|
|
// Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
|
|
|
|
// <chotchkiss@namg.us.anritsu.com>
|
|
|
|
//
|
|
|
|
// Revision 1.5 1998/01/27 00:47:48 curt
|
|
|
|
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
|
|
|
|
// system and commandline/config file processing code.
|
|
|
|
//
|
|
|
|
// Revision 1.4 1998/01/26 15:54:28 curt
|
|
|
|
// Added a "skirt" to try to help hide gaps between scenery and sky. This will
|
|
|
|
// have to be revisited in the future.
|
|
|
|
//
|
|
|
|
// Revision 1.3 1998/01/19 19:26:59 curt
|
|
|
|
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
|
|
|
|
// This should simplify things tremendously.
|
|
|
|
//
|
|
|
|
// Revision 1.2 1998/01/19 18:40:17 curt
|
|
|
|
// Tons of little changes to clean up the code and to remove fatal errors
|
|
|
|
// when building with the c++ compiler.
|
|
|
|
//
|
|
|
|
// Revision 1.1 1998/01/07 03:16:19 curt
|
|
|
|
// Moved from .../Src/Scenery/ to .../Src/Astro/
|
|
|
|
//
|
|
|
|
// Revision 1.11 1997/12/30 22:22:38 curt
|
|
|
|
// Further integration of event manager.
|
|
|
|
//
|
|
|
|
// Revision 1.10 1997/12/30 20:47:53 curt
|
|
|
|
// Integrated new event manager with subsystem initializations.
|
|
|
|
//
|
|
|
|
// Revision 1.9 1997/12/30 13:06:57 curt
|
|
|
|
// A couple lighting tweaks ...
|
|
|
|
//
|
|
|
|
// Revision 1.8 1997/12/23 04:58:38 curt
|
|
|
|
// Tweaked the sky coloring a bit to build in structures to allow finer rgb
|
|
|
|
// control.
|
|
|
|
//
|
|
|
|
// Revision 1.7 1997/12/22 23:45:48 curt
|
|
|
|
// First stab at sunset/sunrise sky glow effects.
|
|
|
|
//
|
|
|
|
// Revision 1.6 1997/12/22 04:14:34 curt
|
|
|
|
// Aligned sky with sun so dusk/dawn effects can be correct relative to the sun.
|
|
|
|
//
|
|
|
|
// Revision 1.5 1997/12/19 23:34:59 curt
|
|
|
|
// Lot's of tweaking with sky rendering and lighting.
|
|
|
|
//
|
|
|
|
// Revision 1.4 1997/12/19 16:45:02 curt
|
|
|
|
// Working on scene rendering order and options.
|
|
|
|
//
|
|
|
|
// Revision 1.3 1997/12/18 23:32:36 curt
|
|
|
|
// First stab at sky dome actually starting to look reasonable. :-)
|
|
|
|
//
|
|
|
|
// Revision 1.2 1997/12/18 04:07:03 curt
|
|
|
|
// Worked on properly translating and positioning the sky dome.
|
|
|
|
//
|
|
|
|
// Revision 1.1 1997/12/17 23:14:30 curt
|
|
|
|
// Initial revision.
|
|
|
|
// Begin work on rendering the sky. (Rather than just using a clear screen.)
|
|
|
|
//
|
|
|
|
|