]> git.mxchange.org Git - simgear.git/blobdiff - Astro/sky.c
Updated fgGENERAL to a "type" of struct.
[simgear.git] / Astro / sky.c
index a7a7b098c6d38a66eaf9c344513363e069b2fab0..a3c14035c5d6aa00c3dd3c75a344ce09e94b9a39 100644 (file)
 */
 
 #include <GL/glut.h>
-#include "../XGL/xgl.h"
+#include <XGL/xgl.h>
 
-#include "sky.h"
+#include <Astro/sky.h>
 
-#include "../Time/event.h"
-#include "../Time/fg_time.h"
+#include <Time/event.h>
+#include <Time/fg_time.h>
+
+#include <Aircraft/aircraft.h>
+#include <Flight/flight.h>
+#include <Include/fg_constants.h>
+#include <Main/views.h>
+#include <Math/fg_random.h>
 
-#include "../Aircraft/aircraft.h"
-#include "../Flight/flight.h"
-#include "../Include/constants.h"
-#include "../Main/views.h"
-#include "../Math/fg_random.h"
 /*
-#include "../Include/general.h"
+#include <Include/general.h>
 */
 
 /* in meters of course */
 #define CENTER_ELEV   25000.0
+
 #define INNER_RADIUS  50000.0
 #define INNER_ELEV    20000.0
+
 #define MIDDLE_RADIUS 70000.0
 #define MIDDLE_ELEV    8000.0
+
 #define OUTER_RADIUS  80000.0
 #define OUTER_ELEV        0.0
 
+#define BOTTOM_RADIUS 50000.0
+#define BOTTOM_ELEV   -2000.0
+
 
 static float inner_vertex[12][3];
 static float middle_vertex[12][3];
 static float outer_vertex[12][3];
+static float bottom_vertex[12][3];
 
 static float inner_color[12][4];
 static float middle_color[12][4];
@@ -96,6 +104,9 @@ void fgSkyVerticesInit( void ) {
        outer_vertex[i][1] = sin((double)theta) * OUTER_RADIUS;
        outer_vertex[i][2] = OUTER_ELEV;
            
+       bottom_vertex[i][0] = cos((double)theta) * BOTTOM_RADIUS;
+       bottom_vertex[i][1] = sin((double)theta) * BOTTOM_RADIUS;
+       bottom_vertex[i][2] = BOTTOM_ELEV;
     }
 }
 
@@ -119,11 +130,11 @@ void fgSkyColorsInit( void ) {
     if ( (sun_angle > 80.0) && (sun_angle < 100.0) ) {
        /* 0.0 - 0.4 */
        outer_param[0] = (10.0 - fabs(90.0 - sun_angle)) / 25.0;
-       outer_param[1] = (10.0 - fabs(90.0 - sun_angle)) / 45.0;
+       outer_param[1] = (10.0 - fabs(90.0 - sun_angle)) / 35.0;
        outer_param[2] = 0.0;
 
-       middle_param[0] = (10.0 - fabs(90.0 - sun_angle)) / 40.0;
-       middle_param[1] = (10.0 - fabs(90.0 - sun_angle)) / 60.0;
+       middle_param[0] = (10.0 - fabs(90.0 - sun_angle)) / 20.0;
+       middle_param[1] = (10.0 - fabs(90.0 - sun_angle)) / 40.0;
        middle_param[2] = 0.0;
 
        outer_diff[0] = outer_param[0] / 6.0;
@@ -237,13 +248,13 @@ void fgSkyInit( void ) {
 
 /* Draw the Sky */
 void fgSkyRender( void ) {
-    struct fgFLIGHT *f;
+    fgFLIGHT *f;
     struct fgLIGHT *l;
     struct fgVIEW *v;
     float /* inner_color[4], middle_color[4], diff, */ east_dot, dot, angle;
     int i;
 
-    f = &current_aircraft.flight;
+    f = current_aircraft.flight;
     l = &cur_light_params;
     v = &current_view;
 
@@ -324,15 +335,53 @@ void fgSkyRender( void ) {
     xglVertex3fv( middle_vertex[0] );
     xglEnd();
 
+    /* Draw the bottom skirt */
+    xglBegin( GL_TRIANGLE_STRIP );
+    for ( i = 0; i < 12; i++ ) {
+       xglColor4fv( l->fog_color );
+       xglVertex3fv( bottom_vertex[i] );
+       xglColor4fv( outer_color[i] );
+       xglVertex3fv( outer_vertex[i] );
+    }
+    xglColor4fv( l->fog_color );
+    xglVertex3fv( bottom_vertex[0] );
+    xglColor4fv( outer_color[0] );
+    xglVertex3fv( outer_vertex[0] );
+    xglEnd();
+
     xglPopMatrix();
 }
 
 
 /* $Log$
-/* 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.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 <bleisch@chromatic.com> 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/
  *