]> git.mxchange.org Git - flightgear.git/commitdiff
Working on new scenery subsystem.
authorcurt <curt>
Thu, 30 Oct 1997 12:38:35 +0000 (12:38 +0000)
committercurt <curt>
Thu, 30 Oct 1997 12:38:35 +0000 (12:38 +0000)
Cockpit/depend
Main/GLUTmain.c
Main/fg_init.c
Scenery/depend
Scenery/mesh.c
Scenery/obj.c
Scenery/stars.c
Simulator/Makefile
Time/depend

index 04135f2bae96bc6e1ee5e04eb348d76cffe6c328..a271456de9289405b642c5e1ece4c5cad90bf0dd 100644 (file)
@@ -18,3 +18,13 @@ hud.o: hud.c hud.h ../Aircraft/aircraft.h \
  ../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \
  ../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \
  ../Math/fg_random.h ../Weather/weather.h
+test.o: test.c test.h ../Aircraft/aircraft.h \
+ ../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
+ ../Aircraft/../Flight/LaRCsim/ls_interface.h \
+ ../Aircraft/../Flight/LaRCsim/../flight.h \
+ ../Aircraft/../Controls/controls.h \
+ ../Aircraft/../Controls/../limits.h ../Flight/flight.h \
+ ../Controls/controls.h ../constants.h ../Scenery/mesh.h \
+ ../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \
+ ../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \
+ ../Math/fg_random.h ../Weather/weather.h
index 7ecd89eab0978e8e9cce1288c6c8fdb8470cf755..9338ffab616cd938efa72bea57fabbb8348cbdd7 100644 (file)
@@ -143,7 +143,8 @@ static void fgUpdateViewParams() {
     struct VIEW *v;
     double x_2, x_4, x_8, x_10;
     double ambient, diffuse, sky;
-    GLfloat color[4] = { 1.0, 1.0, 0.50, 1.0 };
+    /* GLfloat color[4] = { 1.0, 1.0, 0.50, 1.0 };*/
+    GLfloat color[4] = { 1.0, 0.0, 0.00, 1.0 };
     GLfloat amb[3], diff[3], fog[4], clear[4];
 
     f = &current_aircraft.flight;
@@ -577,9 +578,12 @@ int main( int argc, char *argv[] ) {
 
 
 /* $Log$
-/* Revision 1.21  1997/09/23 00:29:38  curt
-/* Tweaks to get things to compile with gcc-win32.
+/* Revision 1.22  1997/10/30 12:38:41  curt
+/* Working on new scenery subsystem.
 /*
+ * Revision 1.21  1997/09/23 00:29:38  curt
+ * Tweaks to get things to compile with gcc-win32.
+ *
  * Revision 1.20  1997/09/22 14:44:19  curt
  * Continuing to try to align stars correctly.
  *
index 6d16f99e10f97e71475adb6fb4409887b7ef6084..620c4e88c21e3fecbe374039fe436cdfcea1bbbe 100644 (file)
@@ -101,7 +101,7 @@ void fgInitSubsystems( void ) {
     FG_Longitude = ( -398391.28 / 3600.0 ) * DEG_TO_RAD;
     FG_Latitude  = (  120070.41 / 3600.0 ) * DEG_TO_RAD;
     FG_Altitude = FG_Runway_altitude + 3.758099;
-    /* FG_Altitude = 20000; */
+    FG_Altitude = 20000;
     
     /* Initial Position north of the city of Globe */
     /* FG_Longitude = ( -398673.28 / 3600.0 ) * DEG_TO_RAD; */
@@ -224,9 +224,12 @@ void fgInitSubsystems( void ) {
 
 
 /* $Log$
-/* Revision 1.10  1997/10/25 03:24:23  curt
-/* Incorporated sun, moon, and star positioning code contributed by Durk Talsma.
+/* Revision 1.11  1997/10/30 12:38:42  curt
+/* Working on new scenery subsystem.
 /*
+ * Revision 1.10  1997/10/25 03:24:23  curt
+ * Incorporated sun, moon, and star positioning code contributed by Durk Talsma.
+ *
  * Revision 1.9  1997/09/23 00:29:39  curt
  * Tweaks to get things to compile with gcc-win32.
  *
index 0feaa8bc9485e3d6dfa5d8ed0b2a64aded4e6c1c..7fca180de00d03c1b5923f5d27cb0317afcab7ed 100644 (file)
@@ -9,7 +9,8 @@ moon.o: moon.c orbits.h ../Time/fg_time.h ../Time/../types.h \
  ../Time/../Flight/LaRCsim/../flight.h moon.h ../Main/views.h \
  ../Main/../types.h ../Main/../Flight/flight.h ../Main/../Math/mat3.h \
  ../general.h
-obj.o: obj.c obj.h
+obj.o: obj.c obj.h scenery.h ../types.h ../constants.h \
+ ../Math/fg_geodesy.h ../Math/polar.h ../Math/../types.h
 orbits.o: orbits.c orbits.h ../Time/fg_time.h ../Time/../types.h \
  ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
  ../Time/../Flight/LaRCsim/ls_interface.h \
index 6b36d36d92314746fb7bfdc7932d6a7f8b7dd64f..595c23287a7d2356b894a9dc8257ebfb1ed5d9fc 100644 (file)
@@ -274,7 +274,8 @@ double mesh_altitude(double lon, double lat) {
 GLint mesh_to_OpenGL(struct MESH *m) {
     GLint mesh;
     /* static GLfloat color[4] = { 0.5, 0.4, 0.25, 1.0 }; */ /* dark desert */
-    static GLfloat color[4] = { 0.5, 0.5, 0.25, 1.0 };
+    /* static GLfloat color[4] = { 0.5, 0.5, 0.25, 1.0 }; */
+    static GLfloat color[4] = { 1.0, 0.0, 0.0, 1.0 };
     double centerx, centery;
     double randx, randy;
 
@@ -395,9 +396,12 @@ GLint mesh_to_OpenGL(struct MESH *m) {
 
 
 /* $Log$
-/* Revision 1.22  1997/10/28 21:00:21  curt
-/* Changing to new terrain format.
+/* Revision 1.23  1997/10/30 12:38:44  curt
+/* Working on new scenery subsystem.
 /*
+ * Revision 1.22  1997/10/28 21:00:21  curt
+ * Changing to new terrain format.
+ *
  * Revision 1.21  1997/08/27 03:30:27  curt
  * Changed naming scheme of basic shared structures.
  *
index ea92cffa28422105ad255d0a62cfc9cb868598aa..3955f09f98e609fb26adb3c9f059f9be7a66198a 100644 (file)
@@ -32,6 +32,7 @@
 #include <GL/glut.h>
 
 #include "obj.h"
+#include "scenery.h"
 
 #include "../constants.h"
 #include "../types.h"
@@ -50,18 +51,18 @@ struct fgCartesianPoint geod_to_cart(float geod[3]) {
     struct fgCartesianPoint p;
     double gc_lon, gc_lat, sl_radius;
 
-    printf("A geodetic point is (%.2f, %.2f, %.2f)\n", 
-          geod[0], geod[1], geod[2]);
+    /* printf("A geodetic point is (%.2f, %.2f, %.2f)\n", 
+          geod[0], geod[1], geod[2]); */
 
     gc_lon = geod[0]*ARCSEC_TO_RAD;
     fgGeodToGeoc(geod[1]*ARCSEC_TO_RAD, geod[2], &sl_radius, &gc_lat);
 
-    printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon, 
-          gc_lat, sl_radius+geod[2]);
+    /* printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon, 
+          gc_lat, sl_radius+geod[2]); */
 
     p = fgPolarToCart(gc_lon, gc_lat, sl_radius+geod[2]);
     
-    printf("A cart point is (%.8f, %.8f, %.8f)\n", p.x, p.y, p.z);
+    /* printf("A cart point is (%.8f, %.8f, %.8f)\n", p.x, p.y, p.z); */
 
     return(p);
 }
@@ -71,10 +72,10 @@ struct fgCartesianPoint geod_to_cart(float geod[3]) {
 GLint fgObjLoad(char *path) {
     char line[256];
     static GLfloat color[4] = { 0.5, 0.5, 0.25, 1.0 };
-    struct fgCartesianPoint p1, p2, p3;
+    struct fgCartesianPoint p1, p2, p3, p4, ref;
     GLint area;
     FILE *f;
-    int first, ncount, n1, n2, n3;
+    int first, ncount, n1, n2, n3, n4;
 
     if ( (f = fopen(path, "r")) == NULL ) {
        printf("Cannot open file: %s\n", path);
@@ -98,9 +99,14 @@ GLint fgObjLoad(char *path) {
        } else if ( line[0] == 'v' ) {
            /* node (vertex) */
            if ( ncount < MAXNODES ) {
-               printf("vertex = %s", line);
+               /* printf("vertex = %s", line); */
                sscanf(line, "v %f %f %f\n", 
                       &nodes[ncount][0], &nodes[ncount][1], &nodes[ncount][2]);
+               if ( ncount == 1 ) {
+                   /* first node becomes the reference point */
+                   ref = geod_to_cart(nodes[ncount]);
+                   scenery.center = ref;
+               }
                ncount++;
            } else {
                printf("Read too many nodes ... dying :-(\n");
@@ -109,11 +115,14 @@ GLint fgObjLoad(char *path) {
        } else if ( line[0] == 't' ) {
            /* start a new triangle strip */
 
+           n1 = n2 = n3 = n4 = 0;
+
            if ( !first ) {
                /* close out the previous structure and start the next */
-               first = 0;
                glEnd();
                glBegin(GL_TRIANGLE_STRIP);
+           } else {
+               first = 0;
            }
 
            printf("new tri strip = %s", line);
@@ -122,6 +131,17 @@ GLint fgObjLoad(char *path) {
            p1 = geod_to_cart(nodes[n1]);
            p2 = geod_to_cart(nodes[n2]);
            p3 = geod_to_cart(nodes[n3]);
+
+            glNormal3d(0.0, 0.0, -1.0);
+
+           glVertex3d(p1.x - ref.x, p1.y - ref.y, p1.z - ref.z);
+           glVertex3d(p2.x - ref.x, p2.y - ref.y, p2.z - ref.z);
+           glVertex3d(p3.x - ref.x, p3.y - ref.y, p3.z - ref.z);
+
+           if ( n4 > 0 ) {
+               p4 = geod_to_cart(nodes[n4]);
+               glVertex3d(p4.x - ref.x, p4.y - ref.y, p4.z - ref.z);
+           }
        } else if ( line[0] == 'q' ) {
            /* continue a triangle strip */
            n1 = n2 = 0;
@@ -129,6 +149,14 @@ GLint fgObjLoad(char *path) {
            printf("continued tri strip = %s", line);
            sscanf(line, "q %d %d\n", &n1, &n2);
            printf("read %d %d\n", n1, n2);
+
+           p1 = geod_to_cart(nodes[n1]);
+           glVertex3d(p1.x - ref.x, p1.y - ref.y, p1.z - ref.z);
+
+           if ( n2 > 0 ) {
+               p2 = geod_to_cart(nodes[n2]);
+               glVertex3d(p2.x - ref.x, p2.y - ref.y, p2.z - ref.z);
+           }
        } else {
            printf("Unknown line in %s = %s\n", path, line);
        }
@@ -144,7 +172,10 @@ GLint fgObjLoad(char *path) {
 
 
 /* $Log$
-/* Revision 1.1  1997/10/28 21:14:54  curt
-/* Initial revision.
+/* Revision 1.2  1997/10/30 12:38:45  curt
+/* Working on new scenery subsystem.
 /*
+ * Revision 1.1  1997/10/28 21:14:54  curt
+ * Initial revision.
+ *
  */
index a645500c397c0de0a01d215ac724a61163616910..4c3f985b3d59638262de74f1e7c6ef5a5b217d8e 100644 (file)
@@ -41,7 +41,6 @@
 
 #include "../constants.h"
 #include "../general.h"
-
 #include "../Aircraft/aircraft.h"
 #include "../Main/views.h"
 #include "../Time/fg_time.h"
@@ -271,9 +270,12 @@ void fgStarsRender() {
 
 
 /* $Log$
-/* Revision 1.14  1997/10/28 21:00:22  curt
-/* Changing to new terrain format.
+/* Revision 1.15  1997/10/30 12:38:45  curt
+/* Working on new scenery subsystem.
 /*
+ * Revision 1.14  1997/10/28 21:00:22  curt
+ * Changing to new terrain format.
+ *
  * Revision 1.13  1997/10/25 03:18:28  curt
  * Incorporated sun, moon, and planet position and rendering code contributed
  * by Durk Talsma.
index 8c77fe352910ee7b66e662275e7a6663375059a0..109decca9c0aa9a99f4b39b2dc3490bd5200ea77 100644 (file)
@@ -28,8 +28,7 @@ include make.inc
 
 
 SUBSUBDIRS = Flight/LaRCsim Flight/Slew
-SUBDIRS = Aircraft Cockpit Controls Flight Joystick Math Scenery \
-       Time Weather
+SUBDIRS = Aircraft Cockpit Controls Flight Joystick Math Scenery Time Weather
 MAIN = Main
 
 
@@ -93,6 +92,9 @@ bin-zip:
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.29  1997/10/30 12:38:35  curt
+# Working on new scenery subsystem.
+#
 # Revision 1.28  1997/10/28 19:35:40  curt
 # Organizational changes.
 #
index c73ae5e357fd04b8120726ebf737c41534952a8b..b6739f0e6882d30435edd650771b8422b33c11f2 100644 (file)
@@ -2,7 +2,7 @@ fg_time.o: fg_time.c fg_time.h ../types.h ../Flight/flight.h \
  ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
  ../Flight/LaRCsim/../flight.h ../constants.h ../Time/fg_time.h
 fg_timer.o: fg_timer.c fg_timer.h
-sptest.o: sptest.c sunpos.h ../types.h ../constants.h
+sidereal.o: sidereal.c ../constants.h
 sunpos.o: sunpos.c sunpos.h ../types.h fg_time.h ../Flight/flight.h \
  ../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
  ../Flight/LaRCsim/../flight.h ../constants.h ../Main/views.h \