Incorporated sun, moon, and planet position and rendering code contributed
by Durk Talsma.
This commit is contained in:
parent
c471211d30
commit
4c1650dd62
5 changed files with 86 additions and 20 deletions
|
@ -26,8 +26,9 @@
|
||||||
|
|
||||||
TARGET = libScenery.a
|
TARGET = libScenery.a
|
||||||
|
|
||||||
CFILES = chunkmgr.c common.c mesh.c scenery.c scanner.c parser.c geometry.c \
|
CFILES = chunkmgr.c common.c geometry.c mesh.c moon.c orbits.c parser.c \
|
||||||
stars.c
|
planets.c scanner.c scenery.c stars.c sun.c
|
||||||
|
|
||||||
OFILES = $(CFILES:.c=.o)
|
OFILES = $(CFILES:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,17 +88,33 @@ mesh.o:
|
||||||
mesh2GL.o:
|
mesh2GL.o:
|
||||||
$(CC) $(CFLAGS) -c mesh2GL.c -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:
|
scenery.o:
|
||||||
$(CC) $(CFLAGS) -c scenery.c -o $@
|
$(CC) $(CFLAGS) -c scenery.c -o $@
|
||||||
|
|
||||||
stars.c:
|
stars.c:
|
||||||
$(CC) $(CFLAGS) -c starts.c -o $@
|
$(CC) $(CFLAGS) -c starts.c -o $@
|
||||||
|
|
||||||
|
sun.o:
|
||||||
|
$(CC) $(CFLAGS) -c sun.c -o $@
|
||||||
|
|
||||||
geometry.o:
|
geometry.o:
|
||||||
$(CC) $(CFLAGS) -c geometry.c -o $@
|
$(CC) $(CFLAGS) -c geometry.c -o $@
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $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
|
# Revision 1.20 1997/09/22 14:44:21 curt
|
||||||
# Continuing to try to align stars correctly.
|
# Continuing to try to align stars correctly.
|
||||||
#
|
#
|
||||||
|
|
|
@ -4,17 +4,35 @@ geometry.o: geometry.c geometry.h mesh.h
|
||||||
mesh.o: mesh.c ../constants.h ../types.h ../Math/fg_geodesy.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 \
|
../Math/fg_random.h ../Math/mat3.h ../Math/polar.h ../Math/../types.h \
|
||||||
mesh.h common.h scenery.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 \
|
parser.o: parser.c parsevrml.h geometry.h common.h mesh.h scenery.h \
|
||||||
../types.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
|
scanner.o: scanner.c parser.h
|
||||||
scenery.o: scenery.c ../general.h scenery.h ../types.h parsevrml.h \
|
scenery.o: scenery.c ../general.h scenery.h ../types.h parsevrml.h \
|
||||||
stars.h
|
stars.h
|
||||||
stars.o: stars.c stars.h ../constants.h ../general.h ../GLUT/views.h \
|
stars.o: stars.c orbits.h ../Time/fg_time.h ../Time/../types.h \
|
||||||
../GLUT/../types.h ../GLUT/../Flight/flight.h \
|
../Time/../Flight/flight.h ../Time/../Flight/Slew/slew.h \
|
||||||
../GLUT/../Flight/Slew/slew.h \
|
../Time/../Flight/LaRCsim/ls_interface.h \
|
||||||
../GLUT/../Flight/LaRCsim/ls_interface.h \
|
../Time/../Flight/LaRCsim/../flight.h planets.h stars.h \
|
||||||
../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.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/aircraft.h ../Aircraft/../Flight/flight.h \
|
||||||
../Aircraft/../Controls/controls.h \
|
../Aircraft/../Controls/controls.h \
|
||||||
../Aircraft/../Controls/../limits.h ../Time/fg_time.h \
|
../Aircraft/../Controls/../limits.h
|
||||||
../Time/../types.h ../Time/../Flight/flight.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
|
||||||
|
|
|
@ -82,15 +82,20 @@ void fgSceneryRender() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glCallList(mesh_hack);
|
glCallList(mesh_hack);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
fgStarsRender();
|
fgStarsRender();
|
||||||
|
|
||||||
|
fgMoonRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.19 1997/09/05 14:17:30 curt
|
/* Revision 1.20 1997/10/25 03:18:27 curt
|
||||||
/* More tweaking with stars.
|
/* 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
|
* Revision 1.18 1997/09/05 01:35:59 curt
|
||||||
* Working on getting stars right.
|
* Working on getting stars right.
|
||||||
*
|
*
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
|
|
||||||
#include <GL/glut.h>
|
#include <GL/glut.h>
|
||||||
|
|
||||||
|
#include "orbits.h"
|
||||||
|
#include "planets.h"
|
||||||
#include "stars.h"
|
#include "stars.h"
|
||||||
|
|
||||||
#include "../constants.h"
|
#include "../constants.h"
|
||||||
|
@ -57,13 +59,14 @@ static GLint stars[FG_STAR_LEVELS];
|
||||||
void fgStarsInit() {
|
void fgStarsInit() {
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
struct GENERAL *g;
|
struct GENERAL *g;
|
||||||
|
struct CelestialCoord pltPos;
|
||||||
char path[1024];
|
char path[1024];
|
||||||
char line[256], name[256];
|
char line[256], name[256];
|
||||||
char *front, *end;
|
char *front, *end;
|
||||||
double right_ascension, declination, magnitude;
|
double right_ascension, declination, magnitude;
|
||||||
double ra_save, decl_save;
|
double ra_save, decl_save;
|
||||||
double ra_save1, decl_save1;
|
double ra_save1, decl_save1;
|
||||||
int count, i, max_stars;
|
int count, i, j, max_stars;
|
||||||
|
|
||||||
g = &general;
|
g = &general;
|
||||||
|
|
||||||
|
@ -145,6 +148,7 @@ void fgStarsInit() {
|
||||||
name, right_ascension, declination, magnitude); */
|
name, right_ascension, declination, magnitude); */
|
||||||
|
|
||||||
glColor3f( magnitude, magnitude, magnitude );
|
glColor3f( magnitude, magnitude, magnitude );
|
||||||
|
/*glColor3f(0,0,0);*/
|
||||||
glVertex3f( 190000.0 * cos(right_ascension) * cos(declination),
|
glVertex3f( 190000.0 * cos(right_ascension) * cos(declination),
|
||||||
190000.0 * sin(right_ascension) * cos(declination),
|
190000.0 * sin(right_ascension) * cos(declination),
|
||||||
190000.0 * sin(declination) );
|
190000.0 * sin(declination) );
|
||||||
|
@ -156,9 +160,22 @@ void fgStarsInit() {
|
||||||
|
|
||||||
fclose(fd);
|
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();
|
glEnd();
|
||||||
|
|
||||||
|
|
||||||
glBegin(GL_LINE_LOOP);
|
glBegin(GL_LINE_LOOP);
|
||||||
glColor3f(1.0, 0.0, 0.0);
|
glColor3f(1.0, 0.0, 0.0);
|
||||||
glVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save-0.2),
|
glVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save-0.2),
|
||||||
|
@ -254,9 +271,13 @@ void fgStarsRender() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.12 1997/09/23 00:29:43 curt
|
/* Revision 1.13 1997/10/25 03:18:28 curt
|
||||||
/* Tweaks to get things to compile with gcc-win32.
|
/* 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
|
* Revision 1.11 1997/09/22 14:44:21 curt
|
||||||
* Continuing to try to align stars correctly.
|
* Continuing to try to align stars correctly.
|
||||||
*
|
*
|
||||||
|
|
|
@ -37,15 +37,20 @@ void fgStarsInit();
|
||||||
|
|
||||||
/* Draw the Stars */
|
/* Draw the Stars */
|
||||||
void fgStarsRender();
|
void fgStarsRender();
|
||||||
|
extern struct OrbElements pltOrbElements[9];
|
||||||
|
extern struct fgTIME cur_time_params;
|
||||||
|
|
||||||
#endif /* STARS_H */
|
#endif /* STARS_H */
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.5 1997/09/18 16:20:09 curt
|
/* Revision 1.6 1997/10/25 03:18:29 curt
|
||||||
/* At dusk/dawn add/remove stars in stages.
|
/* 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
|
* Revision 1.4 1997/09/05 01:36:00 curt
|
||||||
* Working on getting stars right.
|
* Working on getting stars right.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue