]> git.mxchange.org Git - flightgear.git/commitdiff
First stab at sky dome actually starting to look reasonable. :-)
authorcurt <curt>
Thu, 18 Dec 1997 23:32:28 +0000 (23:32 +0000)
committercurt <curt>
Thu, 18 Dec 1997 23:32:28 +0000 (23:32 +0000)
Main/GLUTmain.c
Main/fg_init.c
Scenery/astro.c
Scenery/obj.c
Scenery/sky.c
Simulator/Makefile

index 6a7a3119b3786dc8b63ade8ae6c83569191cbb43..49a121b632bc8eec7ccd54b4511b35665e2508bb 100644 (file)
@@ -221,7 +221,7 @@ static void fgUpdateVisuals( void ) {
     /* update view volume parameters */
     fgUpdateViewParams();
 
-    xglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+    xglClear( /* GL_COLOR_BUFFER_BIT | */ GL_DEPTH_BUFFER_BIT );
 
     /* Tell GL we are switching to model view parameters */
     xglMatrixMode(GL_MODELVIEW);
@@ -230,15 +230,15 @@ static void fgUpdateVisuals( void ) {
     /* draw sky */
     fgSkyRender();
 
+    /* draw astronomical objects */
+    /* fgAstroRender(); */
+    
     /* draw scenery */
     fgSceneryRender();
 
-    /* draw astronomical objects */
-    fgAstroRender();
-
     /* display HUD */
-    if( show_hud )
-       fgCockpitUpdate();
+    /* if( show_hud )
+       fgCockpitUpdate(); */
 
     #ifdef GLUT
       xglutSwapBuffers();
@@ -484,7 +484,7 @@ static void fgReshape( int width, int height ) {
 
     fgUpdateViewParams();
     
-    xglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+    /* xglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); */
 }
 
 
@@ -569,9 +569,12 @@ int main( int argc, char *argv[] ) {
 
 
 /* $Log$
-/* Revision 1.34  1997/12/17 23:13:34  curt
-/* Began working on rendering a sky.
+/* Revision 1.35  1997/12/18 23:32:32  curt
+/* First stab at sky dome actually starting to look reasonable. :-)
 /*
+ * Revision 1.34  1997/12/17 23:13:34  curt
+ * Began working on rendering a sky.
+ *
  * Revision 1.33  1997/12/15 23:54:45  curt
  * Add xgl wrappers for debugging.
  * Generate terrain normals on the fly.
index cc58abc7b4cca872b41b675173dc3e20d4c50593..3883337844234ff0e6fd451a703d02d5ce069321 100644 (file)
@@ -171,11 +171,13 @@ void fgInitSubsystems( void ) {
     fgWeatherInit();
 
     /* Initialize the Cockpit subsystem */
+    /*
     if( fgCockpitInit( current_aircraft ) == NULL )
     {
        printf( "Error in Cockpit initialization!\n" );
        exit( 1 );
     }
+    */
 
     /* Initialize Astronomical Objects */
     fgAstroInit();
@@ -222,9 +224,12 @@ void fgInitSubsystems( void ) {
 
 
 /* $Log$
-/* Revision 1.19  1997/12/17 23:13:36  curt
-/* Began working on rendering a sky.
+/* Revision 1.20  1997/12/18 23:32:33  curt
+/* First stab at sky dome actually starting to look reasonable. :-)
 /*
+ * Revision 1.19  1997/12/17 23:13:36  curt
+ * Began working on rendering a sky.
+ *
  * Revision 1.18  1997/12/15 23:54:49  curt
  * Add xgl wrappers for debugging.
  * Generate terrain normals on the fly.
index 411fd6b1493aef8aa57557446476c9a48e0693a5..4e1558e748eaf5e5eb579e819b2685d1f3b73a41 100644 (file)
@@ -91,7 +91,7 @@ void fgAstroRender() {
     xglDisable( GL_FOG );
 
     /* set the sun position */
-    xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec_inv );
+    /* xglLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec_inv ); */
 
     xglPushMatrix();
 
@@ -122,10 +122,13 @@ void fgAstroRender() {
 
 
 /* $Log$
-/* Revision 1.8  1997/12/15 23:54:57  curt
-/* Add xgl wrappers for debugging.
-/* Generate terrain normals on the fly.
+/* Revision 1.9  1997/12/18 23:32:35  curt
+/* First stab at sky dome actually starting to look reasonable. :-)
 /*
+ * Revision 1.8  1997/12/15 23:54:57  curt
+ * Add xgl wrappers for debugging.
+ * Generate terrain normals on the fly.
+ *
  * Revision 1.7  1997/12/15 20:59:09  curt
  * Misc. tweaks.
  *
index 54624d496c37630948d46b083e0da913e65b68e8..9a294e9c2da53f0ef59fd3191d12f6b6dddb1b3b 100644 (file)
@@ -316,6 +316,8 @@ GLint fgObjLoad(char *path) {
     xglEnd();
     */
 
+    xglFrontFace ( GL_CCW );
+
     xglEndList();
 
     fclose(f);
@@ -325,9 +327,12 @@ GLint fgObjLoad(char *path) {
 
 
 /* $Log$
-/* Revision 1.12  1997/12/17 23:13:47  curt
-/* Began working on rendering the sky.
+/* Revision 1.13  1997/12/18 23:32:36  curt
+/* First stab at sky dome actually starting to look reasonable. :-)
 /*
+ * Revision 1.12  1997/12/17 23:13:47  curt
+ * Began working on rendering the sky.
+ *
  * Revision 1.11  1997/12/15 23:55:01  curt
  * Add xgl wrappers for debugging.
  * Generate terrain normals on the fly.
index 046d36be069983b9e8b4388702c6892ae28d5677..ef81c8b53e6f5299836314d059eda14aad24dd29 100644 (file)
 #include "../Flight/flight.h"
 #include "../Include/constants.h"
 #include "../Main/views.h"
+#include "../Math/fg_random.h"
 /*
 #include "../Include/general.h"
 */
 
 /* in meters of course */
 #define INNER_RADIUS  50000.0
-#define INNER_ELEV    8000.0 /* was 20000 */
+#define INNER_ELEV    20000.0
 #define MIDDLE_RADIUS 70000.0
-#define MIDDLE_ELEV   10000.0
+#define MIDDLE_ELEV    4000.0
 #define OUTER_RADIUS  80000.0
 #define OUTER_ELEV        0.0
 
 
-static GLint sky;  /* sky display list */
 static float sky_center[12][3];
 static float sky_middle[12][3];
 static float sky_outer[12][3];
@@ -67,62 +67,32 @@ static float sky_outer[12][3];
 /* (Re)generate the display list */
 void fgSkyInit() {
     struct fgLIGHT *l;
-    static int dl_exists = 0;
     float theta;
     int i;
 
     l = &cur_light_params;
 
-    if ( dl_exists ) {
-       xglDeleteLists(sky, 1);
-    } else {
-       dl_exists = 1;
+    printf("Generating the sky dome vertices.\n");
 
-       /* first time through, calculate sky vertices */
-       for ( i = 0; i < 12; i++ ) {
-           theta = (i * 30.0) * DEG_TO_RAD;
-
-           sky_center[i][0] = cos(theta) * INNER_RADIUS;
-           sky_center[i][1] = sin(theta) * INNER_RADIUS;
-           sky_center[i][2] = INNER_ELEV;
-           
-           printf(" %.2f %.2f\n", cos(theta) * INNER_RADIUS, 
-                  sin(theta) * INNER_RADIUS);
-
-           sky_middle[i][0] = cos((double)theta) * MIDDLE_RADIUS;
-           sky_middle[i][1] = sin((double)theta) * MIDDLE_RADIUS;
-           sky_middle[i][2] = MIDDLE_ELEV;
+    for ( i = 0; i < 12; i++ ) {
+       theta = (i * 30.0) * DEG_TO_RAD;
+       
+       sky_center[i][0] = cos(theta) * INNER_RADIUS;
+       sky_center[i][1] = sin(theta) * INNER_RADIUS;
+       sky_center[i][2] = INNER_ELEV;
+       
+       printf(" %.2f %.2f\n", cos(theta) * INNER_RADIUS, 
+              sin(theta) * INNER_RADIUS);
+
+       sky_middle[i][0] = cos((double)theta) * MIDDLE_RADIUS;
+       sky_middle[i][1] = sin((double)theta) * MIDDLE_RADIUS;
+       sky_middle[i][2] = MIDDLE_ELEV;
            
-           sky_outer[i][0] = cos((double)theta) * OUTER_RADIUS;
-           sky_outer[i][1] = sin((double)theta) * OUTER_RADIUS;
-           sky_outer[i][2] = OUTER_ELEV;
+       sky_outer[i][0] = cos((double)theta) * OUTER_RADIUS;
+       sky_outer[i][1] = sin((double)theta) * OUTER_RADIUS;
+       sky_outer[i][2] = OUTER_ELEV;
            
-       }
     }
-
-    printf("Creating the sky\n");
-
-    sky = xglGenLists(1);
-    xglNewList(sky, GL_COMPILE );
-
-    /* xglMaterialfv(GL_FRONT, GL_AMBIENT, l->scene_clear);
-       xglMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color); */
-
-    /* Draw inner section */
-    xglBegin( GL_TRIANGLE_FAN );
-
-    xglColor3f(0.0, 0.0, 1.0);
-    xglVertex3f(0.0, 0.0, INNER_ELEV);
-
-    xglColor3f(0.2, 0.2, 1.0);
-    for ( i = 0; i < 12; i++ ) {
-       xglVertex3fv( sky_center[i] );
-    }
-    xglVertex3fv( sky_center[0] );
-
-    xglEnd();
-
-    xglEndList();
 }
 
 
@@ -130,26 +100,16 @@ void fgSkyInit() {
 void fgSkyRender() {
     struct fgFLIGHT *f;
     struct fgVIEW *v;
-    /*
-    struct fgLIGHT *l;
-    struct fgTIME *t;
     int i;
-    */
 
     f = &current_aircraft.flight;
     v = &current_view;
-    /*
-    l = &cur_light_params;
-    t = &cur_time_params;
-    */
-
-    /* FG_PI_2 + 0.1 is about 6 degrees after sundown and before sunrise */
-
-    /* t->sun_angle = 3.0; */ /* to force stars to be drawn (for testing) */
 
     printf("Rendering the sky.\n");
 
     xglDisable( GL_LIGHTING );
+    xglDisable( GL_CULL_FACE );
+    xglShadeModel( GL_SMOOTH );
 
     xglPushMatrix();
 
@@ -158,23 +118,61 @@ void fgSkyRender() {
     /* printf("  Translated to %.2f %.2f %.2f\n", 
           v->cur_zero_elev.x, v->cur_zero_elev.y, v->cur_zero_elev.z ); */
 
+    /* Rotate to proper orientation */
     printf("  lon = %.2f  lat = %.2f\n", FG_Longitude * RAD_TO_DEG,
           FG_Latitude * RAD_TO_DEG);
     xglRotatef( FG_Longitude * RAD_TO_DEG, 0.0, 0.0, 1.0 );
     xglRotatef( 90.0 - FG_Latitude * RAD_TO_DEG, 0.0, 1.0, 0.0 );
 
-    xglCallList( sky );
+    /* xglMaterialfv(GL_FRONT, GL_AMBIENT, l->scene_clear);
+       xglMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color); */
+
+    /* Draw inner/center section of sky*/
+    xglBegin( GL_TRIANGLE_FAN );
+    xglColor4f(0.0, 0.0, 1.0, 1.0);
+    xglVertex3f(0.0, 0.0, INNER_ELEV);
+    xglColor4f(0.2, 0.2, 0.8, 1.0);
+    for ( i = 0; i < 12; i++ ) {
+       xglVertex3fv( sky_center[i] );
+    }
+    xglVertex3fv( sky_center[0] );
+    xglEnd();
+
+    /* Draw the middle ring */
+    xglBegin( GL_TRIANGLE_STRIP );
+    for ( i = 0; i < 12; i++ ) {
+       xglVertex3fv( sky_middle[i] );
+       xglVertex3fv( sky_center[i] );
+    }
+    xglVertex3fv( sky_middle[0] );
+    xglVertex3fv( sky_center[0] );
+    xglEnd();
+
+    /* Draw the outer ring */
+    xglBegin( GL_TRIANGLE_STRIP );
+    for ( i = 0; i < 12; i++ ) {
+       xglVertex3fv( sky_outer[i] );
+       xglVertex3fv( sky_middle[i] );
+    }
+    xglVertex3fv( sky_outer[0] );
+    xglVertex3fv( sky_middle[0] );
+    xglEnd();
 
     xglPopMatrix();
 
+    xglShadeModel( GL_FLAT ); 
+    xglEnable( GL_CULL_FACE );
     xglEnable( GL_LIGHTING );
 }
 
 
 /* $Log$
-/* Revision 1.2  1997/12/18 04:07:03  curt
-/* Worked on properly translating and positioning the sky dome.
+/* 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.)
index da1b08d68eb2df36d5e4bcc98c5f316fcdb7a161..d7db37b685a82325454e8e3cc02ff5bf2b5ba9f5 100644 (file)
@@ -78,25 +78,29 @@ scenery-zip:
        zip -r scenery-$(FG_VERSION).zip FlightGear/Scenery)
 
 bin-tar: all
-       cp Main/fg-$(FG_VERSION) runfg ..
+       cp Main/fg-$(FG_VERSION) README runfg ..
        $(RM) -f ../fg$(FG_VERSION_MAJOR)
        $(LN) ../fg-$(FG_VERSION) ../fg$(FG_VERSION_MAJOR)
        (cd ../..; \
        $(TAR) cvzf bin-$(FG_VERSION).tar.gz FlightGear/fgtop \
        FlightGear/fg-$(FG_VERSION) FlightGear/fg$(FG_VERSION_MAJOR) \
-       FlightGear/runfg FlightGear/COPYING FlightGear/Docs FlightGear/Thanks)
+       FlightGear/runfg FlightGear/COPYING FlightGear/Docs FlightGear/README \
+       FlightGear/Thanks)
 
 bin-zip: 
-       cp Main/fg$(FG_VERSION_MAJOR).exe Main/cygwin.dll runfg.bat ..
+       cp Main/fg$(FG_VERSION_MAJOR).exe Main/cygwin.dll README runfg.bat ..
        (cd ../..; \
        zip -r bin-$(FG_VERSION).zip FlightGear/fgtop \
        FlightGear/fg$(FG_VERSION_MAJOR).exe FlightGear/runfg.bat \
        FlightGear/cygwin.dll FlightGear/COPYING FlightGear/Docs \
-       FlightGear/Thanks)
+       FlightGear/README FlightGear/Thanks)
 
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.34  1997/12/18 23:32:28  curt
+# First stab at sky dome actually starting to look reasonable. :-)
+#
 # Revision 1.33  1997/12/17 23:13:17  curt
 # Changes and tweaks to go to version 0.19 (Plus tweaks to Solaris support)
 #