1
0
Fork 0

Incorporated sun, moon, and planet position and rendering code contributed

by Durk Talsma.
This commit is contained in:
curt 1997-10-25 03:18:26 +00:00
parent c471211d30
commit 4c1650dd62
5 changed files with 86 additions and 20 deletions

View 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.
#

View 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

View 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.
*

View 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,6 +148,7 @@ 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) );
@ -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.
*

View 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.
*