]> git.mxchange.org Git - flightgear.git/commitdiff
Incorporated sun, moon, and planet position and rendering code contributed
authorcurt <curt>
Sat, 25 Oct 1997 03:18:26 +0000 (03:18 +0000)
committercurt <curt>
Sat, 25 Oct 1997 03:18:26 +0000 (03:18 +0000)
by Durk Talsma.

Scenery/Makefile
Scenery/depend
Scenery/scenery.c
Scenery/stars.c
Scenery/stars.h

index c9088bd7fc32a35c01a312c87a5c714252d09c1c..ddb006d8b119e8d32f1581789acfa8fc6d26d826 100644 (file)
@@ -26,8 +26,9 @@
 
 TARGET = libScenery.a
 
-CFILES = chunkmgr.c common.c mesh.c scenery.c scanner.c parser.c geometry.c \
-       stars.c
+CFILES = chunkmgr.c common.c geometry.c mesh.c moon.c orbits.c parser.c \
+       planets.c scanner.c scenery.c stars.c sun.c
+
 OFILES = $(CFILES:.c=.o)
 
 
@@ -87,17 +88,33 @@ mesh.o:
 mesh2GL.o:
        $(CC) $(CFLAGS) -c mesh2GL.c -o $@
 
+moon.o:
+       $(CC) $(CFLAGS) -c moon.c -o $@
+
+orbits.o:
+       $(CC) $(CFLAGS) -c orbits.c -o $@
+
+planets.o:
+       $(CC) $(CFLAGS) -c planets.c -o $@
+
 scenery.o:
        $(CC) $(CFLAGS) -c scenery.c -o $@
 
 stars.c:
        $(CC) $(CFLAGS) -c starts.c -o $@
 
+sun.o:
+       $(CC) $(CFLAGS) -c sun.c -o $@
+
 geometry.o:
        $(CC) $(CFLAGS) -c geometry.c -o $@
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.21  1997/10/25 03:18:26  curt
+# Incorporated sun, moon, and planet position and rendering code contributed
+# by Durk Talsma.
+#
 # Revision 1.20  1997/09/22 14:44:21  curt
 # Continuing to try to align stars correctly.
 #
index faadb7fa8912dd3b0abe7729075ce5068e6205b0..8d0fe8a8d512a54a86232002271c3d046f7d2685 100644 (file)
@@ -4,17 +4,35 @@ geometry.o: geometry.c geometry.h mesh.h
 mesh.o: mesh.c ../constants.h ../types.h ../Math/fg_geodesy.h \
  ../Math/fg_random.h ../Math/mat3.h ../Math/polar.h ../Math/../types.h \
  mesh.h common.h scenery.h
+moon.o: moon.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 \
+ ../Time/../Flight/LaRCsim/../flight.h moon.h ../GLUT/views.h \
+ ../GLUT/../types.h ../GLUT/../Flight/flight.h ../GLUT/../Math/mat3.h \
+ ../general.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 \
+ ../Time/../Flight/LaRCsim/../flight.h ../general.h
 parser.o: parser.c parsevrml.h geometry.h common.h mesh.h scenery.h \
  ../types.h
+planets.o: planets.c ../Time/fg_time.h ../Time/../types.h \
+ ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
+ ../Time/../Flight/LaRCsim/ls_interface.h \
+ ../Time/../Flight/LaRCsim/../flight.h orbits.h planets.h sun.h
 scanner.o: scanner.c parser.h
 scenery.o: scenery.c ../general.h scenery.h ../types.h parsevrml.h \
  stars.h
-stars.o: stars.c stars.h ../constants.h ../general.h ../GLUT/views.h \
- ../GLUT/../types.h ../GLUT/../Flight/flight.h \
- ../GLUT/../Flight/Slew/slew.h \
- ../GLUT/../Flight/LaRCsim/ls_interface.h \
- ../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.h \
+stars.o: stars.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 \
+ ../Time/../Flight/LaRCsim/../flight.h planets.h stars.h \
+ ../constants.h ../general.h ../GLUT/views.h ../GLUT/../types.h \
+ ../GLUT/../Flight/flight.h ../GLUT/../Math/mat3.h \
  ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
  ../Aircraft/../Controls/controls.h \
- ../Aircraft/../Controls/../limits.h ../Time/fg_time.h \
- ../Time/../types.h ../Time/../Flight/flight.h
+ ../Aircraft/../Controls/../limits.h
+sun.o: sun.c ../Time/fg_time.h ../Time/../types.h \
+ ../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
+ ../Time/../Flight/LaRCsim/ls_interface.h \
+ ../Time/../Flight/LaRCsim/../flight.h orbits.h
index 989004c96a75e1950429c85dfac1407fd766e212..c70a5b6cdb0127c20d721722b329af5a06fc0092 100644 (file)
@@ -82,15 +82,20 @@ void fgSceneryRender() {
     glPushMatrix();
     glCallList(mesh_hack);
     glPopMatrix();
-
     fgStarsRender();
+
+    fgMoonRender();
 }
 
 
 /* $Log$
-/* Revision 1.19  1997/09/05 14:17:30  curt
-/* More tweaking with stars.
+/* Revision 1.20  1997/10/25 03:18:27  curt
+/* Incorporated sun, moon, and planet position and rendering code contributed
+/* by Durk Talsma.
 /*
+ * Revision 1.19  1997/09/05 14:17:30  curt
+ * More tweaking with stars.
+ *
  * Revision 1.18  1997/09/05 01:35:59  curt
  * Working on getting stars right.
  *
index c6e889c041909f145aab21a8f8296b957f7a12ce..a330b068a9e64d4546e83ac919ce7c55ffad6a93 100644 (file)
@@ -35,6 +35,8 @@
 
 #include <GL/glut.h>
 
+#include "orbits.h"
+#include "planets.h"
 #include "stars.h"
 
 #include "../constants.h"
@@ -57,13 +59,14 @@ static GLint stars[FG_STAR_LEVELS];
 void fgStarsInit() {
     FILE *fd;
     struct GENERAL *g;
+    struct CelestialCoord pltPos;
     char path[1024];
     char line[256], name[256];
     char *front, *end;
     double right_ascension, declination, magnitude;
     double ra_save, decl_save;
     double ra_save1, decl_save1;
-    int count, i, max_stars;
+    int count, i, j, max_stars;
 
     g = &general;
 
@@ -145,10 +148,11 @@ void fgStarsInit() {
                       name, right_ascension, declination, magnitude); */
 
                glColor3f( magnitude, magnitude, magnitude );
+               /*glColor3f(0,0,0);*/
                glVertex3f( 190000.0 * cos(right_ascension) * cos(declination),
                            190000.0 * sin(right_ascension) * cos(declination),
                            190000.0 * sin(declination) );
-
+               
                count++;
            } /* if valid line */
 
@@ -156,9 +160,22 @@ void fgStarsInit() {
 
        fclose(fd);
 
+       /* Add the planets to all four display lists */
+       for ( j = 2; j < 9; j++ ) {
+           pltPos = fgCalculatePlanet(pltOrbElements[j], 
+                                      pltOrbElements[0], cur_time_params);
+           printf("Planet found at %f (ra), %f (dec)\n", 
+                  pltPos.RightAscension, pltPos.Declination);
+           /* give the planets a temporary color, for testing purposes */
+           glColor3f( 1.0, 0.0, 0.0);
+           glVertex3f( 190000.0 * cos(pltPos.RightAscension) * 
+                       cos(pltPos.Declination),
+                       190000.0 * sin(pltPos.RightAscension) * 
+                       cos(pltPos.Declination),
+                       190000.0 * sin(pltPos.Declination) );
+       }
        glEnd();
 
-
        glBegin(GL_LINE_LOOP);
         glColor3f(1.0, 0.0, 0.0);
        glVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save-0.2),
@@ -254,9 +271,13 @@ void fgStarsRender() {
 
 
 /* $Log$
-/* Revision 1.12  1997/09/23 00:29:43  curt
-/* Tweaks to get things to compile with gcc-win32.
+/* Revision 1.13  1997/10/25 03:18:28  curt
+/* Incorporated sun, moon, and planet position and rendering code contributed
+/* by Durk Talsma.
 /*
+ * Revision 1.12  1997/09/23 00:29:43  curt
+ * Tweaks to get things to compile with gcc-win32.
+ *
  * Revision 1.11  1997/09/22 14:44:21  curt
  * Continuing to try to align stars correctly.
  *
index 55899a047c5286e39da7ecf6174fe180110dc9a9..740eb05feb2b172ab34646900921e314516c0075 100644 (file)
@@ -37,15 +37,20 @@ void fgStarsInit();
 
 /* Draw the Stars */
 void fgStarsRender();
-
+extern struct OrbElements pltOrbElements[9];
+extern struct fgTIME cur_time_params;
 
 #endif /* STARS_H */
 
 
 /* $Log$
-/* Revision 1.5  1997/09/18 16:20:09  curt
-/* At dusk/dawn add/remove stars in stages.
+/* Revision 1.6  1997/10/25 03:18:29  curt
+/* Incorporated sun, moon, and planet position and rendering code contributed
+/* by Durk Talsma.
 /*
+ * Revision 1.5  1997/09/18 16:20:09  curt
+ * At dusk/dawn add/remove stars in stages.
+ *
  * Revision 1.4  1997/09/05 01:36:00  curt
  * Working on getting stars right.
  *