Merged in Durk's changes ...
This commit is contained in:
parent
96068a55c9
commit
ed729a630e
13 changed files with 334 additions and 111 deletions
|
@ -18,3 +18,13 @@ hud.o: hud.c hud.h ../Aircraft/aircraft.h \
|
||||||
../Scenery/scenery.h ../Scenery/../Include/types.h ../Math/mat3.h \
|
../Scenery/scenery.h ../Scenery/../Include/types.h ../Math/mat3.h \
|
||||||
../Math/polar.h ../Math/../Include/types.h ../Time/fg_timer.h \
|
../Math/polar.h ../Math/../Include/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/../Include/limits.h ../Flight/flight.h \
|
||||||
|
../Controls/controls.h ../Include/constants.h ../Scenery/mesh.h \
|
||||||
|
../Scenery/scenery.h ../Scenery/../Include/types.h ../Math/mat3.h \
|
||||||
|
../Math/polar.h ../Math/../Include/types.h ../Time/fg_timer.h \
|
||||||
|
../Math/fg_random.h ../Weather/weather.h
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HUD_H
|
||||||
|
#define HUD_H
|
||||||
|
|
||||||
|
|
||||||
#include "../Aircraft/aircraft.h"
|
#include "../Aircraft/aircraft.h"
|
||||||
#include "../Flight/flight.h"
|
#include "../Flight/flight.h"
|
||||||
#include "../Controls/controls.h"
|
#include "../Controls/controls.h"
|
||||||
|
@ -225,11 +229,17 @@ void fgUpdateHUD();
|
||||||
void fgUpdateHUD2( struct HUD *hud );
|
void fgUpdateHUD2( struct HUD *hud );
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HUD_H */
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.2 1997/12/10 22:37:40 curt
|
/* Revision 1.3 1997/12/30 16:36:41 curt
|
||||||
/* Prepended "fg" on the name of all global structures that didn't have it yet.
|
/* Merged in Durk's changes ...
|
||||||
/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.2 1997/12/10 22:37:40 curt
|
||||||
|
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
||||||
|
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
||||||
|
*
|
||||||
* Revision 1.1 1997/08/29 18:03:22 curt
|
* Revision 1.1 1997/08/29 18:03:22 curt
|
||||||
* Initial revision.
|
* Initial revision.
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern int show_hud; /* HUD state */
|
extern int show_hud; /* HUD state */
|
||||||
|
extern int displayInstruments;
|
||||||
|
|
||||||
|
|
||||||
/* Handle keyboard events */
|
/* Handle keyboard events */
|
||||||
|
@ -86,6 +87,9 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
case 72: /* H key */
|
case 72: /* H key */
|
||||||
show_hud = !show_hud;
|
show_hud = !show_hud;
|
||||||
return;
|
return;
|
||||||
|
case 87: /* W key */
|
||||||
|
displayInstruments = !displayInstruments;
|
||||||
|
return;
|
||||||
case 90: /* Z key */
|
case 90: /* Z key */
|
||||||
w->visibility /= 1.10;
|
w->visibility /= 1.10;
|
||||||
xglFogf(GL_FOG_END, w->visibility);
|
xglFogf(GL_FOG_END, w->visibility);
|
||||||
|
@ -225,10 +229,13 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.23 1997/12/15 23:54:44 curt
|
/* Revision 1.24 1997/12/30 16:36:46 curt
|
||||||
/* Add xgl wrappers for debugging.
|
/* Merged in Durk's changes ...
|
||||||
/* Generate terrain normals on the fly.
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.23 1997/12/15 23:54:44 curt
|
||||||
|
* Add xgl wrappers for debugging.
|
||||||
|
* Generate terrain normals on the fly.
|
||||||
|
*
|
||||||
* Revision 1.22 1997/12/10 22:37:45 curt
|
* Revision 1.22 1997/12/10 22:37:45 curt
|
||||||
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
* Prepended "fg" on the name of all global structures that didn't have it yet.
|
||||||
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
|
||||||
|
|
|
@ -62,6 +62,7 @@ struct fgGENERAL general;
|
||||||
|
|
||||||
/* view parameters */
|
/* view parameters */
|
||||||
static GLfloat win_ratio = 1.0;
|
static GLfloat win_ratio = 1.0;
|
||||||
|
static GLint winWidth, winHeight;
|
||||||
|
|
||||||
/* temporary hack */
|
/* temporary hack */
|
||||||
/* pointer to scenery structure */
|
/* pointer to scenery structure */
|
||||||
|
@ -75,6 +76,9 @@ int use_signals = 0;
|
||||||
/* Yet another hack. This one used by the HUD code. Michele */
|
/* Yet another hack. This one used by the HUD code. Michele */
|
||||||
int show_hud;
|
int show_hud;
|
||||||
|
|
||||||
|
/* Yet another other hack. Used for my prototype instrument code. (Durk) */
|
||||||
|
int displayInstruments;
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* fgInitVisuals() -- Initialize various GL/view parameters
|
* fgInitVisuals() -- Initialize various GL/view parameters
|
||||||
|
@ -135,10 +139,22 @@ static void fgUpdateViewParams() {
|
||||||
|
|
||||||
fgViewUpdate(f, v, l);
|
fgViewUpdate(f, v, l);
|
||||||
|
|
||||||
|
if (displayInstruments)
|
||||||
|
{
|
||||||
|
xglViewport(0, (GLint)(winHeight / 2 ) , (GLint)winWidth, (GLint)winHeight / 2);
|
||||||
|
/* Tell GL we are about to modify the projection parameters */
|
||||||
|
xglMatrixMode(GL_PROJECTION);
|
||||||
|
xglLoadIdentity();
|
||||||
|
gluPerspective(55.0, 2.0/win_ratio, 1.0, 100000.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xglViewport(0, 0 , (GLint)winWidth, (GLint) winHeight);
|
||||||
/* Tell GL we are about to modify the projection parameters */
|
/* Tell GL we are about to modify the projection parameters */
|
||||||
xglMatrixMode(GL_PROJECTION);
|
xglMatrixMode(GL_PROJECTION);
|
||||||
xglLoadIdentity();
|
xglLoadIdentity();
|
||||||
gluPerspective(55.0, 1.0/win_ratio, 1.0, 100000.0);
|
gluPerspective(55.0, 1.0/win_ratio, 1.0, 100000.0);
|
||||||
|
}
|
||||||
|
|
||||||
xglMatrixMode(GL_MODELVIEW);
|
xglMatrixMode(GL_MODELVIEW);
|
||||||
xglLoadIdentity();
|
xglLoadIdentity();
|
||||||
|
@ -215,6 +231,47 @@ static void fgUpdateViewParams() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Draw a basic instrument panel
|
||||||
|
************************************************************************/
|
||||||
|
static void fgUpdateInstrViewParams() {
|
||||||
|
xglViewport(0, 0 , (GLint)winWidth, (GLint)winHeight / 2);
|
||||||
|
|
||||||
|
xglMatrixMode(GL_PROJECTION);
|
||||||
|
xglPushMatrix();
|
||||||
|
|
||||||
|
xglLoadIdentity();
|
||||||
|
gluOrtho2D(0, 640, 0, 480);
|
||||||
|
xglMatrixMode(GL_MODELVIEW);
|
||||||
|
xglPushMatrix();
|
||||||
|
xglLoadIdentity();
|
||||||
|
|
||||||
|
xglColor3f(1.0, 1.0, 1.0);
|
||||||
|
xglIndexi(7);
|
||||||
|
|
||||||
|
xglDisable(GL_DEPTH_TEST);
|
||||||
|
xglDisable(GL_LIGHTING);
|
||||||
|
|
||||||
|
xglLineWidth(1);
|
||||||
|
xglColor3f (0.5, 0.5, 0.5);
|
||||||
|
|
||||||
|
xglBegin(GL_QUADS);
|
||||||
|
xglVertex2f(0.0, 0.00);
|
||||||
|
xglVertex2f(0.0, 480.0);
|
||||||
|
xglVertex2f(640.0,480.0);
|
||||||
|
xglVertex2f(640.0, 0.0);
|
||||||
|
xglEnd();
|
||||||
|
|
||||||
|
xglRectf(0.0,0.0, 640, 480);
|
||||||
|
xglEnable(GL_DEPTH_TEST);
|
||||||
|
xglEnable(GL_LIGHTING);
|
||||||
|
xglMatrixMode(GL_PROJECTION);
|
||||||
|
xglPopMatrix();
|
||||||
|
xglMatrixMode(GL_MODELVIEW);
|
||||||
|
xglPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Update all Visuals (redraws anything graphics related)
|
* Update all Visuals (redraws anything graphics related)
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -291,8 +348,14 @@ static void fgRenderFrame( void ) {
|
||||||
fgSceneryRender();
|
fgSceneryRender();
|
||||||
|
|
||||||
/* display HUD */
|
/* display HUD */
|
||||||
/* if( show_hud )
|
/* if( show_hud ) {
|
||||||
fgCockpitUpdate(); */
|
fgCockpitUpdate();
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* display instruments */
|
||||||
|
if (displayInstruments) {
|
||||||
|
fgUpdateInstrViewParams();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GLUT
|
#ifdef GLUT
|
||||||
xglutSwapBuffers();
|
xglutSwapBuffers();
|
||||||
|
@ -533,8 +596,11 @@ static void fgReshape( int width, int height ) {
|
||||||
win_ratio = (GLfloat) height / (GLfloat) width;
|
win_ratio = (GLfloat) height / (GLfloat) width;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inform gl of our view window size */
|
winWidth = width;
|
||||||
xglViewport(0, 0, (GLint)width, (GLint)height);
|
winHeight = height;
|
||||||
|
|
||||||
|
/* Inform gl of our view window size (now handled elsewhere) */
|
||||||
|
/* xglViewport(0, 0, (GLint)width, (GLint)height); */
|
||||||
|
|
||||||
fgUpdateViewParams();
|
fgUpdateViewParams();
|
||||||
|
|
||||||
|
@ -623,9 +689,12 @@ int main( int argc, char *argv[] ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.41 1997/12/30 13:06:56 curt
|
/* Revision 1.42 1997/12/30 16:36:47 curt
|
||||||
/* A couple lighting tweaks ...
|
/* Merged in Durk's changes ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.41 1997/12/30 13:06:56 curt
|
||||||
|
* A couple lighting tweaks ...
|
||||||
|
*
|
||||||
* Revision 1.40 1997/12/30 01:38:37 curt
|
* Revision 1.40 1997/12/30 01:38:37 curt
|
||||||
* Switched back to per vertex normals and smooth shading for terrain.
|
* Switched back to per vertex normals and smooth shading for terrain.
|
||||||
*
|
*
|
||||||
|
|
|
@ -37,6 +37,7 @@ fg_init.o: fg_init.c fg_init.h views.h ../Include/types.h \
|
||||||
../Scenery/scenery.h ../Scenery/../Include/types.h ../Scenery/sky.h \
|
../Scenery/scenery.h ../Scenery/../Include/types.h ../Scenery/sky.h \
|
||||||
../Scenery/stars.h ../Scenery/sun.h ../Time/sunpos.h \
|
../Scenery/stars.h ../Scenery/sun.h ../Time/sunpos.h \
|
||||||
../Weather/weather.h
|
../Weather/weather.h
|
||||||
|
probdemo.o: probdemo.c ../XGL/xgl.h
|
||||||
views.o: views.c views.h ../Include/types.h ../Flight/flight.h \
|
views.o: views.c views.h ../Include/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 ../Math/mat3.h ../Time/fg_time.h \
|
../Flight/LaRCsim/../flight.h ../Math/mat3.h ../Time/fg_time.h \
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern int show_hud; /* HUD state */
|
extern int show_hud; /* HUD state */
|
||||||
|
extern int displayInstruments;
|
||||||
|
|
||||||
|
|
||||||
/* General house keeping initializations */
|
/* General house keeping initializations */
|
||||||
|
@ -228,15 +229,21 @@ void fgInitSubsystems( void ) {
|
||||||
/* To HUD or not to HUD */
|
/* To HUD or not to HUD */
|
||||||
show_hud = 1;
|
show_hud = 1;
|
||||||
|
|
||||||
|
/* Let's show the instrument panel */
|
||||||
|
displayInstruments = 1;
|
||||||
|
|
||||||
/* Joystick support */
|
/* Joystick support */
|
||||||
fgJoystickInit( 0 );
|
fgJoystickInit( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.22 1997/12/19 23:34:05 curt
|
/* Revision 1.23 1997/12/30 16:36:50 curt
|
||||||
/* Lot's of tweaking with sky rendering and lighting.
|
/* Merged in Durk's changes ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.22 1997/12/19 23:34:05 curt
|
||||||
|
* Lot's of tweaking with sky rendering and lighting.
|
||||||
|
*
|
||||||
* Revision 1.21 1997/12/19 16:45:00 curt
|
* Revision 1.21 1997/12/19 16:45:00 curt
|
||||||
* Working on scene rendering order and options.
|
* Working on scene rendering order and options.
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "orbits.h"
|
#include "orbits.h"
|
||||||
#include "moon.h"
|
#include "moon.h"
|
||||||
|
|
||||||
|
#include "../Aircraft/aircraft.h"
|
||||||
#include "../Include/general.h"
|
#include "../Include/general.h"
|
||||||
#include "../Main/views.h"
|
#include "../Main/views.h"
|
||||||
#include "../Time/fg_time.h"
|
#include "../Time/fg_time.h"
|
||||||
|
@ -149,14 +150,21 @@ struct CelestialCoord fgCalculateMoon(struct OrbElements params,
|
||||||
struct fgTIME t)
|
struct fgTIME t)
|
||||||
{
|
{
|
||||||
struct CelestialCoord
|
struct CelestialCoord
|
||||||
result;
|
geocCoord, topocCoord;
|
||||||
|
|
||||||
|
|
||||||
double
|
double
|
||||||
eccAnom, ecl, lonecl, latecl, actTime,
|
eccAnom, ecl, lonecl, latecl, actTime,
|
||||||
xv, yv, v, r, xh, yh, zh, xg, yg, zg, xe, ye, ze,
|
xv, yv, v, r, xh, yh, zh, xg, yg, zg, xe, ye, ze,
|
||||||
Ls, Lm, D, F;
|
Ls, Lm, D, F, mpar, gclat, rho, HA, g;
|
||||||
|
|
||||||
/* calculate the angle between ecliptic and equatorial coordinate system */
|
struct fgAIRCRAFT *a;
|
||||||
|
struct fgFLIGHT *f;
|
||||||
|
|
||||||
|
a = ¤t_aircraft;
|
||||||
|
f = &a->flight;
|
||||||
|
|
||||||
|
/* calculate the angle between ecliptic and equatorial coordinate system */
|
||||||
actTime = fgCalcActTime(t);
|
actTime = fgCalcActTime(t);
|
||||||
ecl = fgDegToRad(23.4393 - 3.563E-7 * actTime); // in radians of course
|
ecl = fgDegToRad(23.4393 - 3.563E-7 * actTime); // in radians of course
|
||||||
|
|
||||||
|
@ -219,9 +227,32 @@ struct CelestialCoord fgCalculateMoon(struct OrbElements params,
|
||||||
ye = yg * cos(ecl) - zg * sin(ecl);
|
ye = yg * cos(ecl) - zg * sin(ecl);
|
||||||
ze = yg * sin(ecl) + zg * cos(ecl);
|
ze = yg * sin(ecl) + zg * cos(ecl);
|
||||||
|
|
||||||
result.RightAscension = atan2(ye, xe);
|
|
||||||
result.Declination = atan2(ze, sqrt(xe*xe + ye*ye));
|
|
||||||
return result;
|
|
||||||
|
geocCoord.RightAscension = atan2(ye, xe);
|
||||||
|
geocCoord.Declination = atan2(ze, sqrt(xe*xe + ye*ye));
|
||||||
|
|
||||||
|
/* New since 25 december 1997 */
|
||||||
|
/* Calculate the moon's topocentric position instead of it's geocentric! */
|
||||||
|
|
||||||
|
mpar = asin( 1 / r); /* calculate the moon's parrallax, i.e. the apparent size of the
|
||||||
|
(equatorial) radius of the Earth, as seen from the moon */
|
||||||
|
gclat = FG_Latitude - 0.083358 * sin (2 * fgDegToRad( FG_Latitude));
|
||||||
|
rho = 0.99883 + 0.00167 * cos(2 * fgDegToRad(FG_Latitude));
|
||||||
|
|
||||||
|
if (geocCoord.RightAscension < 0)
|
||||||
|
geocCoord.RightAscension += (2*M_PI);
|
||||||
|
|
||||||
|
HA = t.lst - (3.8197186 * geocCoord.RightAscension);
|
||||||
|
|
||||||
|
g = atan (tan(gclat) / cos( (HA / 3.8197186)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
topocCoord.RightAscension = geocCoord.RightAscension - mpar * rho * cos(gclat) * sin(HA) / cos(geocCoord.Declination);
|
||||||
|
topocCoord.Declination = geocCoord.Declination - mpar * rho * sin(gclat) * sin(g - geocCoord.Declination) / sin(g);
|
||||||
|
return topocCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
struct SunPos {
|
struct SunPos {
|
||||||
double xs;
|
double xs;
|
||||||
double ys;
|
double ys;
|
||||||
|
double dist;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OrbElements {
|
struct OrbElements {
|
||||||
|
@ -63,6 +64,7 @@ struct CelestialCoord {
|
||||||
double RightAscension;
|
double RightAscension;
|
||||||
double Declination;
|
double Declination;
|
||||||
double distance;
|
double distance;
|
||||||
|
double magnitude;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +81,10 @@ void fgSolarSystemUpdate(struct OrbElements *planets, struct fgTIME t);
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/10/25 03:16:10 curt
|
/* Revision 1.2 1997/12/30 16:36:52 curt
|
||||||
/* Initial revision of code contributed by Durk Talsma.
|
/* Merged in Durk's changes ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/10/25 03:16:10 curt
|
||||||
|
* Initial revision of code contributed by Durk Talsma.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
|
struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
|
||||||
struct OrbElements theSun,
|
struct OrbElements theSun,
|
||||||
struct fgTIME t)
|
struct fgTIME t, int idx)
|
||||||
{
|
{
|
||||||
struct CelestialCoord
|
struct CelestialCoord
|
||||||
result;
|
result;
|
||||||
|
@ -40,7 +40,7 @@ struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
|
||||||
SolarPosition;
|
SolarPosition;
|
||||||
|
|
||||||
double
|
double
|
||||||
eccAnom, r, v, ecl, actTime,
|
eccAnom, r, v, ecl, actTime, R, s, ir, Nr, B, FV, ring_magn,
|
||||||
xv, yv, xh, yh, zh, xg, yg, zg, xe, ye, ze;
|
xv, yv, xh, yh, zh, xg, yg, zg, xe, ye, ze;
|
||||||
|
|
||||||
actTime = fgCalcActTime(t);
|
actTime = fgCalcActTime(t);
|
||||||
|
@ -78,17 +78,68 @@ struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
|
||||||
xe = xg;
|
xe = xg;
|
||||||
ye = yg * cos(ecl) - zg * sin(ecl);
|
ye = yg * cos(ecl) - zg * sin(ecl);
|
||||||
ze = yg * sin(ecl) + zg * cos(ecl);
|
ze = yg * sin(ecl) + zg * cos(ecl);
|
||||||
|
|
||||||
result.RightAscension = atan2(ye,xe);
|
result.RightAscension = atan2(ye,xe);
|
||||||
result.Declination = atan2(ze, sqrt(xe*xe + ye*ye));
|
result.Declination = atan2(ze, sqrt(xe*xe + ye*ye));
|
||||||
|
|
||||||
|
|
||||||
|
/* Let's calculate the brightness of the planet */
|
||||||
|
R = sqrt ( xg*xg + yg*yg + zg*zg);
|
||||||
|
s = SolarPosition.dist;
|
||||||
|
FV = acos( (r*r + R*R - s*s) / (2*r*R));
|
||||||
|
FV *= 57.29578; /* convert radians to degrees */
|
||||||
|
switch(idx)
|
||||||
|
{
|
||||||
|
case 2: /* mercury */
|
||||||
|
result.magnitude = -0.36 + 5*log10( r*R ) + 0.027 * FV + 2.2E-13 * pow(FV, 6);
|
||||||
|
break;
|
||||||
|
case 3: /*venus */
|
||||||
|
result.magnitude = -4.34 + 5*log10( r*R ) + 0.013 * FV + 4.2E-07 * pow(FV,3);
|
||||||
|
break;
|
||||||
|
case 4: /* mars */
|
||||||
|
result.magnitude = -1.51 + 5*log10( r*R ) + 0.016 * FV;
|
||||||
|
break;
|
||||||
|
case 5: /* Jupiter */
|
||||||
|
result.magnitude = -9.25 + 5*log10( r*R ) + 0.014 * FV;
|
||||||
|
break;
|
||||||
|
case 6: /* Saturn */
|
||||||
|
|
||||||
|
ir = 0.4897394;
|
||||||
|
Nr = 2.9585076 + 6.6672E-7*actTime;
|
||||||
|
|
||||||
|
B = asin ( sin (result.Declination) * cos(ir) - cos(result.Declination) * sin (ir) * sin (result.RightAscension - Nr));
|
||||||
|
ring_magn = -2.6 * sin (abs(B)) + 1.2 * pow(sin(B),2);
|
||||||
|
result.magnitude = -9.0 + 5*log10( r*R ) + 0.044 * FV + ring_magn;
|
||||||
|
break;
|
||||||
|
case 7: /* Uranus */
|
||||||
|
result.magnitude = -7.15 + 5*log10( r*R) + 0.001 * FV;
|
||||||
|
break;
|
||||||
|
case 8: /* Neptune */
|
||||||
|
result.magnitude = -6.90 + 5*log10 (r*R) + 0.001 *FV;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("index %d out of range !!!!\n", idx);
|
||||||
|
}
|
||||||
|
printf("Geocentric dist %f\n"
|
||||||
|
"Heliocentric dist %f\n"
|
||||||
|
"Distance to the sun %f\n"
|
||||||
|
"Phase angle %f\n"
|
||||||
|
"Brightness %f\n", R, r, s, FV, result.magnitude);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.2 1997/12/12 21:41:29 curt
|
/* Revision 1.3 1997/12/30 16:36:52 curt
|
||||||
/* More light/material property tweaking ... still a ways off.
|
/* Merged in Durk's changes ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.2 1997/12/12 21:41:29 curt
|
||||||
|
* More light/material property tweaking ... still a ways off.
|
||||||
|
*
|
||||||
* Revision 1.1 1997/10/25 03:16:10 curt
|
* Revision 1.1 1997/10/25 03:16:10 curt
|
||||||
* Initial revision of code contributed by Durk Talsma.
|
* Initial revision of code contributed by Durk Talsma.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,15 +29,18 @@
|
||||||
|
|
||||||
struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
|
struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
|
||||||
struct OrbElements theSun,
|
struct OrbElements theSun,
|
||||||
struct fgTIME t);
|
struct fgTIME t, int idx);
|
||||||
|
|
||||||
#endif /* PLANETS_H */
|
#endif /* PLANETS_H */
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.2 1997/12/12 21:41:30 curt
|
/* Revision 1.3 1997/12/30 16:36:53 curt
|
||||||
/* More light/material property tweaking ... still a ways off.
|
/* Merged in Durk's changes ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.2 1997/12/12 21:41:30 curt
|
||||||
|
* More light/material property tweaking ... still a ways off.
|
||||||
|
*
|
||||||
* Revision 1.1 1997/10/25 03:16:11 curt
|
* Revision 1.1 1997/10/25 03:16:11 curt
|
||||||
* Initial revision of code contributed by Durk Talsma.
|
* Initial revision of code contributed by Durk Talsma.
|
||||||
*
|
*
|
||||||
|
|
|
@ -167,11 +167,24 @@ void fgStarsInit() {
|
||||||
/* Add the planets to all four display lists */
|
/* Add the planets to all four display lists */
|
||||||
for ( j = 2; j < 9; j++ ) {
|
for ( j = 2; j < 9; j++ ) {
|
||||||
pltPos = fgCalculatePlanet(pltOrbElements[j],
|
pltPos = fgCalculatePlanet(pltOrbElements[j],
|
||||||
pltOrbElements[0], cur_time_params);
|
pltOrbElements[0], cur_time_params, j);
|
||||||
printf("Planet found at %f (ra), %f (dec)\n",
|
printf("Planet found at %f (ra), %f (dec)\n",
|
||||||
pltPos.RightAscension, pltPos.Declination);
|
pltPos.RightAscension, pltPos.Declination);
|
||||||
/* give the planets a temporary color, for testing purposes */
|
/* give the planets a temporary color, for testing purposes */
|
||||||
xglColor3f( 1.0, 0.0, 0.0);
|
/* xglColor3f( 1.0, 0.0, 0.0); */
|
||||||
|
|
||||||
|
/* scale magnitudes to (0.0 - 1.0) */
|
||||||
|
magnitude = (0.0 - pltPos.magnitude) / 5.0 + 1.0;
|
||||||
|
|
||||||
|
/* scale magnitudes again so they look ok */
|
||||||
|
if ( magnitude > 1.0 ) { magnitude = 1.0; }
|
||||||
|
if ( magnitude < 0.0 ) { magnitude = 0.0; }
|
||||||
|
magnitude =
|
||||||
|
magnitude * 0.7 + (((FG_STAR_LEVELS - 1) - i) * 0.1);
|
||||||
|
|
||||||
|
|
||||||
|
xglColor3f(magnitude, magnitude, magnitude);
|
||||||
|
|
||||||
xglVertex3f( 50000.0 * cos(pltPos.RightAscension) *
|
xglVertex3f( 50000.0 * cos(pltPos.RightAscension) *
|
||||||
cos(pltPos.Declination),
|
cos(pltPos.Declination),
|
||||||
50000.0 * sin(pltPos.RightAscension) *
|
50000.0 * sin(pltPos.RightAscension) *
|
||||||
|
@ -265,9 +278,12 @@ void fgStarsRender() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.21 1997/12/19 23:35:00 curt
|
/* Revision 1.22 1997/12/30 16:36:53 curt
|
||||||
/* Lot's of tweaking with sky rendering and lighting.
|
/* Merged in Durk's changes ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.21 1997/12/19 23:35:00 curt
|
||||||
|
* Lot's of tweaking with sky rendering and lighting.
|
||||||
|
*
|
||||||
* Revision 1.20 1997/12/15 23:55:03 curt
|
* Revision 1.20 1997/12/15 23:55:03 curt
|
||||||
* Add xgl wrappers for debugging.
|
* Add xgl wrappers for debugging.
|
||||||
* Generate terrain normals on the fly.
|
* Generate terrain normals on the fly.
|
||||||
|
|
|
@ -60,6 +60,7 @@ struct SunPos fgCalcSunPos(struct OrbElements params)
|
||||||
coordinates (xs, ys) */
|
coordinates (xs, ys) */
|
||||||
solarPosition.xs = r * cos(lonSun);
|
solarPosition.xs = r * cos(lonSun);
|
||||||
solarPosition.ys = r * sin(lonSun);
|
solarPosition.ys = r * sin(lonSun);
|
||||||
|
solarPosition.dist = r;
|
||||||
return solarPosition;
|
return solarPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,23 +127,27 @@ void fgSunInit() {
|
||||||
void fgSunRender() {
|
void fgSunRender() {
|
||||||
struct fgVIEW *v;
|
struct fgVIEW *v;
|
||||||
struct fgTIME *t;
|
struct fgTIME *t;
|
||||||
GLfloat color[4] = { 0.85, 0.65, 0.05, 1.0 };
|
struct fgLIGHT *l;
|
||||||
/* double x_2, x_4, x_8, x_10; */
|
/* GLfloat color[4] = { 0.85, 0.65, 0.05, 1.0 }; */
|
||||||
/* GLfloat ambient; */
|
GLfloat color[4] = { 1.00, 1.00, 1.00, 1.00 };
|
||||||
/* GLfloat amb[3], diff[3]; */
|
double x_2, x_4, x_8, x_10;
|
||||||
|
GLfloat ambient;
|
||||||
|
GLfloat amb[3], diff[3];
|
||||||
|
|
||||||
|
|
||||||
t = &cur_time_params;
|
t = &cur_time_params;
|
||||||
v = ¤t_view;
|
v = ¤t_view;
|
||||||
|
l = &cur_light_params;
|
||||||
|
|
||||||
/* x_2 = t->sun_angle * t->sun_angle;
|
x_2 = l->sun_angle * l->sun_angle;
|
||||||
x_4 = x_2 * x_2;
|
x_4 = x_2 * x_2;
|
||||||
x_8 = x_4 * x_4;
|
x_8 = x_4 * x_4;
|
||||||
x_10 = x_8 * x_2; */
|
x_10 = x_8 * x_2;
|
||||||
|
|
||||||
/* ambient = (0.4 * pow(1.1, -x_10 / 30.0));
|
ambient = (0.4 * pow(1.1, -x_10 / 30.0));
|
||||||
if ( ambient < 0.3 ) ambient = 0.3;
|
if ( ambient < 0.3 ) ambient = 0.3;
|
||||||
if ( ambient > 1.0 ) ambient = 1.0;
|
if ( ambient > 1.0 ) ambient = 1.0;
|
||||||
|
|
||||||
amb[0] = 0.50 + ((ambient * 6.66) - 1.6);
|
amb[0] = 0.50 + ((ambient * 6.66) - 1.6);
|
||||||
amb[1] = 0.00 + ((ambient * 6.66) - 1.6);
|
amb[1] = 0.00 + ((ambient * 6.66) - 1.6);
|
||||||
amb[2] = 0.00 + ((ambient * 6.66) - 1.6);
|
amb[2] = 0.00 + ((ambient * 6.66) - 1.6);
|
||||||
|
@ -155,34 +160,40 @@ void fgSunRender() {
|
||||||
diff[0] = 0.0;
|
diff[0] = 0.0;
|
||||||
diff[1] = 0.0;
|
diff[1] = 0.0;
|
||||||
diff[2] = 0.0;
|
diff[2] = 0.0;
|
||||||
diff[3] = 0.0; */
|
diff[3] = 1.0;
|
||||||
|
|
||||||
/* set lighting parameters */
|
/* set lighting parameters */
|
||||||
/* xglLightfv(GL_LIGHT0, GL_AMBIENT, color );
|
xglLightfv(GL_LIGHT0, GL_AMBIENT, color );
|
||||||
xglLightfv(GL_LIGHT0, GL_DIFFUSE, color );
|
xglLightfv(GL_LIGHT0, GL_DIFFUSE, color );
|
||||||
xglMaterialfv(GL_FRONT, GL_AMBIENT, amb);
|
xglMaterialfv(GL_FRONT, GL_AMBIENT, amb);
|
||||||
xglMaterialfv(GL_FRONT, GL_DIFFUSE, diff); */
|
xglMaterialfv(GL_FRONT, GL_DIFFUSE, diff);
|
||||||
|
xglMaterialfv(GL_FRONT, GL_SHININESS, diff);
|
||||||
|
xglMaterialfv(GL_FRONT, GL_EMISSION, diff);
|
||||||
|
xglMaterialfv(GL_FRONT, GL_SPECULAR, diff);
|
||||||
|
|
||||||
xglDisable( GL_LIGHTING );
|
/* xglDisable( GL_LIGHTING ); */
|
||||||
|
|
||||||
xglPushMatrix();
|
xglPushMatrix();
|
||||||
xglTranslatef(xSun, ySun, zSun);
|
xglTranslatef(xSun, ySun, zSun);
|
||||||
xglScalef(1400, 1400, 1400);
|
xglScalef(1400, 1400, 1400);
|
||||||
|
|
||||||
xglColor4f(0.85, 0.65, 0.05, 1.0);
|
xglColor3f(0.85, 0.65, 0.05);
|
||||||
|
|
||||||
xglCallList(sun_obj);
|
xglCallList(sun_obj);
|
||||||
|
|
||||||
xglPopMatrix();
|
xglPopMatrix();
|
||||||
|
|
||||||
xglEnable( GL_LIGHTING );
|
/* xglEnable( GL_LIGHTING ); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.8 1997/12/19 23:35:00 curt
|
/* Revision 1.9 1997/12/30 16:36:54 curt
|
||||||
/* Lot's of tweaking with sky rendering and lighting.
|
/* Merged in Durk's changes ...
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.8 1997/12/19 23:35:00 curt
|
||||||
|
* Lot's of tweaking with sky rendering and lighting.
|
||||||
|
*
|
||||||
* Revision 1.7 1997/12/17 23:12:16 curt
|
* Revision 1.7 1997/12/17 23:12:16 curt
|
||||||
* Fixed so moon and sun display lists aren't recreate periodically.
|
* Fixed so moon and sun display lists aren't recreate periodically.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
event.o: event.c event.h
|
||||||
fg_time.o: fg_time.c fg_time.h ../Include/types.h ../Flight/flight.h \
|
fg_time.o: fg_time.c fg_time.h ../Include/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 ../Include/constants.h \
|
../Flight/LaRCsim/../flight.h ../Include/constants.h \
|
||||||
../Time/fg_time.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 ../Include/types.h ../Include/constants.h
|
scheduler.o: scheduler.c
|
||||||
|
sidereal.o: sidereal.c ../Include/constants.h
|
||||||
sunpos.o: sunpos.c sunpos.h ../Include/types.h fg_time.h \
|
sunpos.o: sunpos.c sunpos.h ../Include/types.h fg_time.h \
|
||||||
../Flight/flight.h ../Flight/Slew/slew.h \
|
../Flight/flight.h ../Flight/Slew/slew.h \
|
||||||
../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
|
../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
|
||||||
|
|
Loading…
Reference in a new issue