]> git.mxchange.org Git - flightgear.git/commitdiff
Working on getting stars right.
authorcurt <curt>
Fri, 5 Sep 1997 01:35:53 +0000 (01:35 +0000)
committercurt <curt>
Fri, 5 Sep 1997 01:35:53 +0000 (01:35 +0000)
Main/GLUTmain.c
Scenery/scenery.c
Scenery/stars.c
Scenery/stars.h
Time/sunpos.c

index 2f74301ea4a3e883eecd85887d0843ff92bec848..7bbca9367026a204a95009a8e89f1f8b5ae84a28 100644 (file)
@@ -154,7 +154,7 @@ static void fgUpdateViewParams() {
     /* Tell GL we are about to modify the projection parameters */
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
-    gluPerspective(45.0, 1.0/win_ratio, 1.0, 200000.0);
+    gluPerspective(100.0, 1.0/win_ratio, 1.0, 200000.0);
 
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
@@ -555,9 +555,12 @@ int main( int argc, char *argv[] ) {
 
 
 /* $Log$
-/* Revision 1.13  1997/09/04 02:17:34  curt
-/* Shufflin' stuff.
+/* Revision 1.14  1997/09/05 01:35:53  curt
+/* Working on getting stars right.
 /*
+ * Revision 1.13  1997/09/04 02:17:34  curt
+ * Shufflin' stuff.
+ *
  * Revision 1.12  1997/08/27 21:32:24  curt
  * Restructured view calculation code.  Added stars.
  *
index d1a4c38c71fd5950834cbc47850ddf0a946e5ede..c7d5fa4806aa194805fa075932a9ee10c88a23b0 100644 (file)
@@ -80,7 +80,7 @@ void fgSceneryUpdate(double lon, double lat, double elev) {
 /* Render out the current scene */
 void fgSceneryRender() {
     glPushMatrix();
-    glCallList(mesh_hack);
+    /* glCallList(mesh_hack); */
     glPopMatrix();
 
     fgStarsRender();
@@ -88,9 +88,12 @@ void fgSceneryRender() {
 
 
 /* $Log$
-/* Revision 1.17  1997/08/29 17:55:27  curt
-/* Worked on properly aligning the stars.
+/* Revision 1.18  1997/09/05 01:35:59  curt
+/* Working on getting stars right.
 /*
+ * Revision 1.17  1997/08/29 17:55:27  curt
+ * Worked on properly aligning the stars.
+ *
  * Revision 1.16  1997/08/27 21:32:29  curt
  * Restructured view calculation code.  Added stars.
  *
index 9d665d4b0e32bcc7a5773978e2b3072a7ae05f0e..7a5bdfc69b7a58b3fbfb0ab603e03ddec23bf921 100644 (file)
@@ -57,8 +57,11 @@ void fgStarsInit() {
     struct GENERAL *g;
     char path[1024];
     char line[256], name[256];
-    char *tmp_ptr;
+    char *front, *end;
     double right_ascension, declination, magnitude;
+    double ra_save, decl_save;
+    double ra_save1, decl_save1;
+    double ra_save2, decl_save2;
     GLfloat mag[4] = {0.0, 0.0, 0.0, 1.0};
     int count;
 
@@ -84,36 +87,105 @@ void fgStarsInit() {
     /* read in each line of the file */
     count = 0;
     while ( (fgets(line, 256, fd) != NULL) && (count < FG_MAX_STARS) ) {
-       tmp_ptr = line;
-       
+       front = line;
+
+       /* printf("Read line = %s", front); */
+
        /* advance to first non-whitespace character */
-       while ( (tmp_ptr[0] == ' ') || (tmp_ptr[0] == '\t') ) {
-           tmp_ptr++;
+       while ( (front[0] == ' ') || (front[0] == '\t') ) {
+           front++;
        }
 
-       if ( tmp_ptr[0] == '#' ) {
+       /* printf("Line length (after trimming) = %d\n", strlen(front)); */
+
+       if ( front[0] == '#' ) {
            /* comment */
-       } else if ( strlen(tmp_ptr) == 0 ) {
+       } else if ( strlen(front) <= 1 ) {
            /* blank line */
        } else {
            /* star data line */
-           fscanf(fd, "%s %lf %lf %lf\n", 
-                  name, &right_ascension, &declination, &magnitude);
-           /* printf("Found star: %d %s, %.3f %.3f %.3f\n", count,
-              name, right_ascension, declination, magnitude); */
-           count++;
+
+           /* get name */
+           end = front;
+           while ( end[0] != ',' ) {
+               end++;
+           }
+           end[0] = '\0';
+           strcpy(name, front);
+           front = end;
+           front++;
+
+           sscanf(front, "%lf,%lf,%lf\n", 
+                  &right_ascension, &declination, &magnitude);
+
+           if ( strcmp(name, "Deneb") == 0 ) {
+               printf("\n*** Marking %s\n\n", name);
+               ra_save = right_ascension;
+               decl_save = declination;
+           }
+
+           if ( strcmp(name, "Alderamin") == 0 ) {
+               printf("\n*** Marking %s\n\n", name);
+               ra_save1 = right_ascension;
+               decl_save1 = declination;
+           }
+
+           /* scale magnitudes to (0.0 - 1.0) */
+           magnitude = (-1.46 - magnitude) / 10.0 + 1.0;
+
+           /* scale magnitudes again so they look ok */
            magnitude = magnitude * 0.8 + 0.2;
            mag[0] = mag[1] = mag[2] = magnitude;
+
+           printf("Found star: %d %s, %.3f %.3f %.3f\n", count,
+              name, right_ascension, declination, magnitude);
+
            glColor3f( mag[0], mag[1], mag[2] );
            glVertex3f( 190000.0 * sin(right_ascension) * cos(declination),
                        190000.0 * cos(right_ascension) * cos(declination),
                        190000.0 * sin(declination) );
 
+           count++;
        } /* if valid line */
 
     } /* while */
 
+    fclose(fd);
+
+    glEnd();
+
+    glBegin(GL_LINE_LOOP);
+        glColor3f(1.0, 0.0, 0.0);
+       glVertex3f( 190000.0 * sin(ra_save-0.2) * cos(decl_save-0.2),
+                   190000.0 * cos(ra_save-0.2) * cos(decl_save-0.2),
+                   190000.0 * sin(decl_save-0.2) );
+       glVertex3f( 190000.0 * sin(ra_save+0.2) * cos(decl_save-0.2),
+                   190000.0 * cos(ra_save+0.2) * cos(decl_save-0.2),
+                   190000.0 * sin(decl_save-0.2) );
+       glVertex3f( 190000.0 * sin(ra_save+0.2) * cos(decl_save+0.2),
+                   190000.0 * cos(ra_save+0.2) * cos(decl_save+0.2),
+                   190000.0 * sin(decl_save+0.2) );
+       glVertex3f( 190000.0 * sin(ra_save-0.2) * cos(decl_save+0.2),
+                   190000.0 * cos(ra_save-0.2) * cos(decl_save+0.2),
+                   190000.0 * sin(decl_save+0.2) );
     glEnd();
+
+    glBegin(GL_LINE_LOOP);
+        glColor3f(0.0, 1.0, 0.0);
+       glVertex3f( 190000.0 * sin(ra_save1-0.2) * cos(decl_save1-0.2),
+                   190000.0 * cos(ra_save1-0.2) * cos(decl_save1-0.2),
+                   190000.0 * sin(decl_save1-0.2) );
+       glVertex3f( 190000.0 * sin(ra_save1+0.2) * cos(decl_save1-0.2),
+                   190000.0 * cos(ra_save1+0.2) * cos(decl_save1-0.2),
+                   190000.0 * sin(decl_save1-0.2) );
+       glVertex3f( 190000.0 * sin(ra_save1+0.2) * cos(decl_save1+0.2),
+                   190000.0 * cos(ra_save1+0.2) * cos(decl_save1+0.2),
+                   190000.0 * sin(decl_save1+0.2) );
+       glVertex3f( 190000.0 * sin(ra_save1-0.2) * cos(decl_save1+0.2),
+                   190000.0 * cos(ra_save1-0.2) * cos(decl_save1+0.2),
+                   190000.0 * sin(decl_save1+0.2) );
+    glEnd();
+       
     glEndList();
 }
 
@@ -148,9 +220,12 @@ void fgStarsRender() {
 
 
 /* $Log$
-/* Revision 1.4  1997/09/04 02:17:38  curt
-/* Shufflin' stuff.
+/* Revision 1.5  1997/09/05 01:35:59  curt
+/* Working on getting stars right.
 /*
+ * Revision 1.4  1997/09/04 02:17:38  curt
+ * Shufflin' stuff.
+ *
  * Revision 1.3  1997/08/29 17:55:28  curt
  * Worked on properly aligning the stars.
  *
index 9e8e2d1f0b6397c40ddc69ed908b1f0246d739e3..493f6854d8f90f01872f53a9dc2c470bf1f7fca5 100644 (file)
@@ -28,8 +28,8 @@
 #define STARS_H
 
 
-#define FG_MAX_STARS 1000
-
+#define FG_MAX_STARS 500
+#define FG_MIN_STAR_MAG 0.738750 /* magnitude of weakest star we'll display */
 
 /* Initialize the Star Management Subsystem */
 void fgStarsInit();
@@ -42,9 +42,12 @@ void fgStarsRender();
 
 
 /* $Log$
-/* Revision 1.3  1997/08/29 17:55:28  curt
-/* Worked on properly aligning the stars.
+/* Revision 1.4  1997/09/05 01:36:00  curt
+/* Working on getting stars right.
 /*
+ * Revision 1.3  1997/08/29 17:55:28  curt
+ * Worked on properly aligning the stars.
+ *
  * Revision 1.2  1997/08/27 21:32:30  curt
  * Restructured view calculation code.  Added stars.
  *
index 186e6cfa99b716a70cd4c183d516c8eb3eb0b8f1..477ca6d299777fe24123b165294717f3320c4c6c 100644 (file)
@@ -271,6 +271,7 @@ void fgUpdateSunPos(struct fgCartesianPoint scenery_center) {
     v = &current_view;
 
     time_warp += 200; /* increase this to make the world spin real fast */
+    time_warp = 3600*10; /* increase this to make the world spin real fast */
 
     fgSunPosition(time(NULL) + time_warp, &t->sun_lon, &sun_gd_lat);
 
@@ -303,9 +304,12 @@ void fgUpdateSunPos(struct fgCartesianPoint scenery_center) {
 
 
 /* $Log$
-/* Revision 1.7  1997/09/04 02:17:40  curt
-/* Shufflin' stuff.
+/* Revision 1.8  1997/09/05 01:36:04  curt
+/* Working on getting stars right.
 /*
+ * Revision 1.7  1997/09/04 02:17:40  curt
+ * Shufflin' stuff.
+ *
  * Revision 1.6  1997/08/27 03:30:37  curt
  * Changed naming scheme of basic shared structures.
  *