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