1
0
Fork 0

C++ - ifing the code.

Starting a bit of reorganization of lighting code.
This commit is contained in:
curt 1998-04-22 13:25:39 +00:00
parent 73ed3c180e
commit 920eefd4a7
10 changed files with 139 additions and 107 deletions

View file

@ -35,16 +35,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <Debug/fg_debug.h>
#include <Main/GLUTkey.h>
#include <Main/views.h>
#include <Include/fg_constants.h>
#include <Aircraft/aircraft.h>
#include <Autopilot/autopilot.h> // Added autopilot.h to list, Jeff Goeke-Smith
#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Weather/weather.h>
#include "GLUTkey.hxx"
#include "views.hxx"
extern int show_hud; /* HUD state */
extern int displayInstruments;
@ -257,9 +256,13 @@ void GLUTspecialkey(int k, int x, int y) {
/* $Log$
/* Revision 1.33 1998/04/18 04:11:25 curt
/* Moved fg_debug to it's own library, added zlib support.
/* Revision 1.1 1998/04/22 13:25:40 curt
/* C++ - ifing the code.
/* Starting a bit of reorganization of lighting code.
/*
* Revision 1.33 1998/04/18 04:11:25 curt
* Moved fg_debug to it's own library, added zlib support.
*
* Revision 1.32 1998/04/14 02:21:01 curt
* Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith
* <jgoeke@voyager.net>

View file

@ -28,8 +28,8 @@
#define _GLUTKEY_H
#ifdef __cplusplus
extern "C" {
#ifndef __cplusplus
# error This library requires C++
#endif
@ -42,23 +42,23 @@ extern "C" {
#include <GL/glut.h>
#include <XGL/xgl.h>
/* Handle keyboard events */
void GLUTkey(unsigned char k, int x, int y);
void GLUTspecialkey(int k, int x, int y);
#ifdef __cplusplus
}
#endif
#endif /* _GLUTKEY_H */
/* $Log$
/* Revision 1.9 1998/04/21 17:02:36 curt
/* Prepairing for C++ integration.
/* Revision 1.1 1998/04/22 13:25:41 curt
/* C++ - ifing the code.
/* Starting a bit of reorganization of lighting code.
/*
* Revision 1.9 1998/04/21 17:02:36 curt
* Prepairing for C++ integration.
*
* Revision 1.8 1998/04/03 22:09:02 curt
* Converting to Gnu autoconf system.
*

View file

@ -40,35 +40,35 @@
# include <getopt.h>
#endif
#include <Debug/fg_debug.h>
#include <Main/GLUTkey.h>
#include <Main/fg_init.h>
#include <Main/fg_getopt.h>
#include <Main/views.h>
#include <Include/cmdargs.h> // Line to command line arguments
#include <Include/fg_constants.h> // for VERSION
#include <Include/general.h>
#include <Aircraft/aircraft.h>
#include <Astro/moon.h>
#include <Astro/planets.h>
#include <Astro/sky.h>
#include <Astro/stars.h>
#include <Astro/sun.h>
#include <Astro/moon.hxx>
#include <Astro/planets.hxx>
#include <Astro/sky.hxx>
#include <Astro/stars.hxx>
#include <Astro/sun.hxx>
#include <Cockpit/cockpit.h>
#include <Debug/fg_debug.h>
#include <Joystick/joystick.h>
#include <Math/fg_geodesy.h>
#include <Math/mat3.h>
#include <Math/polar.h>
#include <Scenery/scenery.h>
#include <Scenery/tilemgr.h>
#include <Scenery/tilemgr.hxx>
#include <Time/event.h>
#include <Time/fg_time.h>
#include <Time/fg_timer.h>
#include <Time/sunpos.h>
#include <Time/sunpos.hxx>
#include <Weather/weather.h>
#include "GLUTkey.hxx"
#include "fg_init.hxx"
#include "fg_getopt.h"
#include "views.hxx"
// This is a record containing global housekeeping information
fgGENERAL general;
@ -777,6 +777,10 @@ extern "C" {
// $Log$
// Revision 1.2 1998/04/22 13:25:41 curt
// C++ - ifing the code.
// Starting a bit of reorganization of lighting code.
//
// Revision 1.1 1998/04/21 17:02:39 curt
// Prepairing for C++ integration.
//

View file

@ -5,12 +5,12 @@ bin_PROGRAMS = fg
bin_SCRIPTS = runfg runfg.bat
fg_SOURCES = \
GLUTkey.c GLUTkey.h \
GLUTkey.cxx GLUTkey.hxx \
GLUTmain.cxx \
fg_config.h \
fg_getopt.c fg_getopt.h \
fg_init.c fg_init.h \
views.c views.h
fg_init.cxx fg_init.hxx \
views.cxx views.hxx
fg_LDADD = \
$(top_builddir)/Simulator/Aircraft/libAircraft.la \

View file

@ -78,12 +78,12 @@ bin_PROGRAMS = fg
bin_SCRIPTS = runfg runfg.bat
fg_SOURCES = \
GLUTkey.c GLUTkey.h \
GLUTkey.cxx GLUTkey.hxx \
GLUTmain.cxx \
fg_config.h \
fg_getopt.c fg_getopt.h \
fg_init.c fg_init.h \
views.c views.h
fg_init.cxx fg_init.hxx \
views.cxx views.hxx
fg_LDADD = \
$(top_builddir)/Simulator/Aircraft/libAircraft.la \

View file

@ -122,17 +122,23 @@ extern int getargs(int argc, char *argv[],int num_opt, Option ** optarr,
extern void print_desc(int num_opt, Option **optarr); // Not original code
#ifdef __cplusplus
}
#endif
#endif
/* $Log$
/* Revision 1.2 1998/04/21 17:02:41 curt
/* Prepairing for C++ integration.
/* Revision 1.3 1998/04/22 13:25:43 curt
/* C++ - ifing the code.
/* Starting a bit of reorganization of lighting code.
/*
* Revision 1.2 1998/04/21 17:02:41 curt
* Prepairing for C++ integration.
*
* Revision 1.1 1998/02/13 00:23:39 curt
* Initial revision.
*

View file

@ -26,34 +26,37 @@
**************************************************************************/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <Main/fg_init.h>
#include <Main/views.h>
#include <Include/cmdargs.h>
#include <Include/fg_constants.h>
#include <Include/general.h>
#include <Aircraft/aircraft.h>
#include <Astro/moon.h>
#include <Astro/planets.h>
#include <Astro/sky.h>
#include <Astro/stars.h>
#include <Astro/sun.h>
#include <Astro/moon.hxx>
#include <Astro/planets.hxx>
#include <Astro/sky.hxx>
#include <Astro/stars.hxx>
#include <Astro/sun.hxx>
#include <Autopilot/autopilot.h>
#include <Cockpit/cockpit.h>
#include <Debug/fg_debug.h>
#include <Joystick/joystick.h>
#include <Math/fg_random.h>
#include <Scenery/scenery.h>
#include <Scenery/tilemgr.h>
#include <Scenery/tilemgr.hxx>
#include <Time/event.h>
#include <Time/fg_time.h>
#include <Time/sunpos.h>
#include <Time/light.hxx>
#include <Time/sunpos.hxx>
#include <Weather/weather.h>
#include "fg_init.hxx"
#include "views.hxx"
extern int show_hud; /* HUD state */
extern int displayInstruments;
extern const char *default_root;
@ -121,8 +124,8 @@ int fgInitSubsystems( void ) {
* should really be read in from one or more files.
****************************************************************/
/* Must happen before any of the flight model or control
* parameters are set */
// Must happen before any of the flight model or control
// parameters are set
fgAircraftInit(); // In the future this might not be the case.
f = current_aircraft.flight;
@ -238,69 +241,76 @@ int fgInitSubsystems( void ) {
FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
FG_Altitude * FEET_TO_METER);
/* Initial Velocity */
// Initial Velocity
FG_V_north = 0.0 /* 7.287719E+00 */;
FG_V_east = 0.0 /* 1.521770E+03 */;
FG_V_down = 0.0 /* -1.265722E-05 */;
/* Initial Orientation */
// Initial Orientation
FG_Phi = -2.658474E-06;
FG_Theta = 7.401790E-03;
FG_Psi = 260.0 * DEG_TO_RAD;
FG_Psi = 270.0 * DEG_TO_RAD;
/* Initial Angular B rates */
// Initial Angular B rates
FG_P_body = 7.206685E-05;
FG_Q_body = 0.000000E+00;
FG_R_body = 9.492658E-05;
FG_Earth_position_angle = 0.000000E+00;
/* Mass properties and geometry values */
// Mass properties and geometry values
FG_Mass = 8.547270E+01;
FG_I_xx = 1.048000E+03;
FG_I_yy = 3.000000E+03;
FG_I_zz = 3.530000E+03;
FG_I_xz = 0.000000E+00;
/* CG position w.r.t. ref. point */
// CG position w.r.t. ref. point
FG_Dx_cg = 0.000000E+00;
FG_Dy_cg = 0.000000E+00;
FG_Dz_cg = 0.000000E+00;
/* Set initial position and slew parameters */
/* fgSlewInit(-398391.3, 120070.41, 244, 3.1415); */ /* GLOBE Airport */
/* fgSlewInit(-335340,162540, 15, 4.38); */
/* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
// Set initial position and slew parameters
// fgSlewInit(-398391.3, 120070.41, 244, 3.1415); // GLOBE Airport
// fgSlewInit(-335340,162540, 15, 4.38);
// fgSlewInit(-398673.28,120625.64, 53, 4.38);
/* Initialize the event manager */
// Initialize the event manager
fgEventInit();
/* Dump event stats every 60 seconds */
// Dump event stats every 60 seconds
fgEventRegister( "fgEventPrintStats()", fgEventPrintStats,
FG_EVENT_READY, 60000 );
/* Initialize "time" */
// Initialize "time"
fgTimeInit(t);
fgTimeUpdate(f, t);
/* fgViewUpdate() needs the sun in the right place, while
* fgUpdateSunPos() needs to know the view position. I'll get
* around this interdependency for now by calling fgUpdateSunPos()
* once, then moving on with normal initialization. */
// fgViewUpdate() needs the sun in the right place, while
// fgUpdateSunPos() needs to know the view position. I'll get
// around this interdependency for now by calling fgUpdateSunPos()
// once, then moving on with normal initialization.
fgUpdateSunPos();
/* Initialize view parameters */
// Initialize view parameters
fgViewInit(v);
fgViewUpdate(f, v, l);
/* Initialize the weather modeling subsystem */
// Initialize Lighting interpolation tables
fgLightInit();
// update the lighting parameters (based on sun angle)
fgEventRegister( "fgLightUpdate()", fgLightUpdate,
FG_EVENT_READY, 30000 );
// Initialize the weather modeling subsystem
fgWeatherInit();
/* update the weather for our current position */
// update the weather for our current position
fgEventRegister( "fgWeatherUpdate()", fgWeatherUpdate,
FG_EVENT_READY, 120000 );
/* Initialize the Cockpit subsystem */
// Initialize the Cockpit subsystem
if( fgCockpitInit( &current_aircraft )) {
// Cockpit initialized ok.
} else {
@ -348,10 +358,10 @@ int fgInitSubsystems( void ) {
// I'm just sticking this here for now, it should probably move
// eventually
// cur_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0,
// FG_Latitude * RAD_TO_DEG * 3600.0); */
// FG_Latitude * RAD_TO_DEG * 3600.0);
// fgPrintf( FG_GENERAL, FG_INFO,
// "True ground elevation is %.2f meters here.\n",
// cur_elev); */
// cur_elev);
cur_elev = FG_Runway_altitude * FEET_TO_METER;
if ( cur_elev > -9990.0 ) {
@ -367,10 +377,10 @@ int fgInitSubsystems( void ) {
FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
FG_Altitude * FEET_TO_METER);
/* end of thing that I just stuck in that I should probably move */
// end of thing that I just stuck in that I should probably move
/* Initialize the flight model subsystem data structures base on
* above values */
// Initialize the flight model subsystem data structures base on
// above values
fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ );
@ -387,7 +397,7 @@ int fgInitSubsystems( void ) {
fgPrintf( FG_GENERAL, FG_EXIT, "Error in Joystick initialization!\n" );
}
/// Autopilot init added here, by Jeff Goeke-Smith
// Autopilot init added here, by Jeff Goeke-Smith
fgAPInit(&current_aircraft);
// end added section;
@ -401,9 +411,13 @@ int fgInitSubsystems( void ) {
/* $Log$
/* Revision 1.56 1998/04/18 04:11:28 curt
/* Moved fg_debug to it's own library, added zlib support.
/* Revision 1.1 1998/04/22 13:25:44 curt
/* C++ - ifing the code.
/* Starting a bit of reorganization of lighting code.
/*
* Revision 1.56 1998/04/18 04:11:28 curt
* Moved fg_debug to it's own library, added zlib support.
*
* Revision 1.55 1998/04/14 02:21:03 curt
* Incorporated autopilot heading hold contributed by: Jeff Goeke-Smith
* <jgoeke@voyager.net>

View file

@ -28,8 +28,8 @@
#define _FG_INIT_H
#ifdef __cplusplus
extern "C" {
#ifndef __cplusplus
# error This library requires C++
#endif
@ -42,18 +42,17 @@ int fgInitGeneral ( void );
int fgInitSubsystems( void );
#ifdef __cplusplus
}
#endif
#endif /* _FG_INIT_H */
/* $Log$
/* Revision 1.4 1998/04/21 17:02:41 curt
/* Prepairing for C++ integration.
/* Revision 1.1 1998/04/22 13:25:44 curt
/* C++ - ifing the code.
/* Starting a bit of reorganization of lighting code.
/*
* Revision 1.4 1998/04/21 17:02:41 curt
* Prepairing for C++ integration.
*
* Revision 1.3 1998/02/12 21:59:50 curt
* Incorporated code changes contributed by Charlie Hotchkiss
* <chotchkiss@namg.us.anritsu.com>

View file

@ -24,18 +24,20 @@
**************************************************************************/
#include <Main/views.h>
#include <Include/fg_constants.h>
#include <config.h>
#include <Debug/fg_debug.h>
#include <Flight/flight.h>
#include <Include/fg_constants.h>
#include <Math/mat3.h>
#include <Math/polar.h>
#include <Math/vector.h>
#include <Scenery/scenery.h>
#include <Time/fg_time.h>
#include "views.hxx"
/* This is a record containing current view parameters */
struct fgVIEW current_view;
@ -50,7 +52,7 @@ void fgViewInit(struct fgVIEW *v) {
/* Update the view parameters */
void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, struct fgLIGHT *l) {
void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, fgLIGHT *l) {
MAT3vec vec, forward, v0, minus_z;
MAT3mat R, TMP, UP, LOCAL, VIEW;
double ntmp;
@ -188,9 +190,13 @@ void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, struct fgLIGHT *l) {
/* $Log$
/* Revision 1.16 1998/04/18 04:11:29 curt
/* Moved fg_debug to it's own library, added zlib support.
/* Revision 1.1 1998/04/22 13:25:45 curt
/* C++ - ifing the code.
/* Starting a bit of reorganization of lighting code.
/*
* Revision 1.16 1998/04/18 04:11:29 curt
* Moved fg_debug to it's own library, added zlib support.
*
* Revision 1.15 1998/02/20 00:16:24 curt
* Thursday's tweaks.
*

View file

@ -1,5 +1,5 @@
/**************************************************************************
* views.h -- data structures and routines for managing and view parameters.
* views.hxx -- data structures and routines for managing and view parameters.
*
* Written by Curtis Olson, started August 1997.
*
@ -28,8 +28,8 @@
#define _VIEWS_H
#ifdef __cplusplus
extern "C" {
#ifndef __cplusplus
# error This library requires C++
#endif
@ -37,6 +37,7 @@ extern "C" {
#include <Flight/flight.h>
#include <Math/mat3.h>
#include <Time/fg_time.h>
#include <Time/light.hxx>
/* Define a structure containing view information */
@ -90,21 +91,20 @@ extern struct fgVIEW current_view;
void fgViewInit(struct fgVIEW *v);
/* Update the view parameters */
void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, struct fgLIGHT *l);
void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, fgLIGHT *l);
#ifdef __cplusplus
}
#endif
#endif /* _VIEWS_H */
#endif /* _VIEWS_HXX */
/* $Log$
/* Revision 1.11 1998/04/21 17:02:42 curt
/* Prepairing for C++ integration.
/* Revision 1.1 1998/04/22 13:25:46 curt
/* C++ - ifing the code.
/* Starting a bit of reorganization of lighting code.
/*
* Revision 1.11 1998/04/21 17:02:42 curt
* Prepairing for C++ integration.
*
* Revision 1.10 1998/02/07 15:29:45 curt
* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
* <chotchkiss@namg.us.anritsu.com>