* return value: none
*
*************************************************************************/
-void CelestialBody::updatePosition(fgTIME *t, Star *ourSun)
+void CelestialBody::updatePosition(FGTime *t, Star *ourSun)
{
double eccAnom, v, ecl, actTime,
xv, yv, xh, yh, zh, xg, yg, zg, xe, ye, ze;
double lonEcl, latEcl;
double fgCalcEccAnom(double M, double e);
- double fgCalcActTime(fgTIME *t);
- void updateOrbElements(fgTIME *t);
+ double fgCalcActTime(FGTime *t);
+ void updateOrbElements(FGTime *t);
public:
CelestialBody(double Nf, double Ns,
double wf, double ws,
double af, double as,
double ef, double es,
- double Mf, double Ms, fgTIME *t);
+ double Mf, double Ms, FGTime *t);
void getPos(double *ra, double *dec);
void getPos(double *ra, double *dec, double *magnitude);
double getLon();
double getLat();
- void updatePosition(fgTIME *t, Star *ourSun);
+ void updatePosition(FGTime *t, Star *ourSun);
};
/*****************************************************************************
double wf, double ws,
double af, double as,
double ef, double es,
- double Mf, double Ms, fgTIME *t)
+ double Mf, double Ms, FGTime *t)
{
NFirst = Nf; NSec = Ns;
iFirst = If; iSec = Is;
};
/****************************************************************************
- * inline void CelestialBody::updateOrbElements(fgTIME *t)
+ * inline void CelestialBody::updateOrbElements(FGTime *t)
* given the current time, this private member calculates the actual
* orbital elements
*
- * Arguments: fgTIME *t: the current time:
+ * Arguments: FGTime *t: the current time:
*
* return value: none
***************************************************************************/
-inline void CelestialBody::updateOrbElements(fgTIME *t)
+inline void CelestialBody::updateOrbElements(FGTime *t)
{
double actTime = fgCalcActTime(t);
M = DEG_TO_RAD * (MFirst + (MSec * actTime));
a = aFirst + (aSec * actTime);
}
/*****************************************************************************
- * inline double CelestialBody::fgCalcActTime(fgTIME *t)
+ * inline double CelestialBody::fgCalcActTime(FGTime *t)
* this private member function returns the offset in days from the epoch for
* wich the orbital elements are calculated (Jan, 1st, 2000).
*
*
* return value: the (fractional) number of days until Jan 1, 2000.
****************************************************************************/
-inline double CelestialBody::fgCalcActTime(fgTIME *t)
+inline double CelestialBody::fgCalcActTime(FGTime *t)
{
- return (t->mjd - 36523.5);
+ return (t->getMjd() - 36523.5);
}
/*****************************************************************************
#include "jupiter.hxx"
/*************************************************************************
- * Jupiter::Jupiter(fgTIME *t)
+ * Jupiter::Jupiter(FGTime *t)
* Public constructor for class Jupiter
* Argument: The current time.
* the hard coded orbital elements for Jupiter are passed to
* CelestialBody::CelestialBody();
************************************************************************/
-Jupiter::Jupiter(fgTIME *t) :
+Jupiter::Jupiter(FGTime *t) :
CelestialBody(100.4542, 2.7685400E-5,
1.3030, -1.557E-7,
273.8777, 1.6450500E-5,
}
/*************************************************************************
- * void Jupiter::updatePosition(fgTIME *t, Star *ourSun)
+ * void Jupiter::updatePosition(FGTime *t, Star *ourSun)
*
* calculates the current position of Jupiter, by calling the base class,
* CelestialBody::updatePosition(); The current magnitude is calculated using
* a Jupiter specific equation
*************************************************************************/
-void Jupiter::updatePosition(fgTIME *t, Star *ourSun)
+void Jupiter::updatePosition(FGTime *t, Star *ourSun)
{
CelestialBody::updatePosition(t, ourSun);
magnitude = -9.25 + 5*log10( r*R ) + 0.014 * FV;
class Jupiter : public CelestialBody
{
public:
- Jupiter (fgTIME *t);
- void updatePosition(fgTIME *t, Star *ourSun);
+ Jupiter (FGTime *t);
+ void updatePosition(FGTime *t, Star *ourSun);
};
#endif // _JUPITER_HXX_
#include "mars.hxx"
/*************************************************************************
- * Mars::Mars(fgTIME *t)
+ * Mars::Mars(FGTime *t)
* Public constructor for class Mars
* Argument: The current time.
* the hard coded orbital elements for Mars are passed to
* CelestialBody::CelestialBody();
************************************************************************/
-Mars::Mars(fgTIME *t) :
+Mars::Mars(FGTime *t) :
CelestialBody(49.55740, 2.1108100E-5,
1.8497, -1.78E-8,
286.5016, 2.9296100E-5,
{
}
/*************************************************************************
- * void Mars::updatePosition(fgTIME *t, Star *ourSun)
+ * void Mars::updatePosition(FGTime *t, Star *ourSun)
*
* calculates the current position of Mars, by calling the base class,
* CelestialBody::updatePosition(); The current magnitude is calculated using
* a Mars specific equation
*************************************************************************/
-void Mars::updatePosition(fgTIME *t, Star *ourSun)
+void Mars::updatePosition(FGTime *t, Star *ourSun)
{
CelestialBody::updatePosition(t, ourSun);
magnitude = -1.51 + 5*log10( r*R ) + 0.016 * FV;
class Mars : public CelestialBody
{
public:
- Mars ( fgTIME *t);
- void updatePosition(fgTIME *t, Star *ourSun);
+ Mars ( FGTime *t);
+ void updatePosition(FGTime *t, Star *ourSun);
};
#endif // _MARS_HXX_
#include "mercury.hxx"
/*************************************************************************
- * Mercury::Mercury(fgTIME *t)
+ * Mercury::Mercury(FGTime *t)
* Public constructor for class Mercury
* Argument: The current time.
* the hard coded orbital elements for Mercury are passed to
* CelestialBody::CelestialBody();
************************************************************************/
-Mercury::Mercury(fgTIME *t) :
+Mercury::Mercury(FGTime *t) :
CelestialBody (48.33130, 3.2458700E-5,
7.0047, 5.00E-8,
29.12410, 1.0144400E-5,
{
}
/*************************************************************************
- * void Mercury::updatePosition(fgTIME *t, Star *ourSun)
+ * void Mercury::updatePosition(FGTime *t, Star *ourSun)
*
* calculates the current position of Mercury, by calling the base class,
* CelestialBody::updatePosition(); The current magnitude is calculated using
* a Mercury specific equation
*************************************************************************/
-void Mercury::updatePosition(fgTIME *t, Star *ourSun)
+void Mercury::updatePosition(FGTime *t, Star *ourSun)
{
CelestialBody::updatePosition(t, ourSun);
magnitude = -0.36 + 5*log10( r*R ) + 0.027 * FV + 2.2E-13 * pow(FV, 6);
class Mercury : public CelestialBody
{
public:
- Mercury ( fgTIME *t);
- void updatePosition(fgTIME *t, Star* ourSun);
+ Mercury ( FGTime *t);
+ void updatePosition(FGTime *t, Star* ourSun);
};
#endif // _MERURY_HXX_
#include <Debug/logstream.hxx>
#include <Objects/texload.h>
+#include <Main/options.hxx>
#ifdef __BORLANDC__
# define exception c_exception
/*************************************************************************
- * Moon::Moon(fgTIME *t)
+ * Moon::Moon(FGTime *t)
* Public constructor for class Moon. Initializes the orbital elements and
* sets up the moon texture.
* Argument: The current time.
* the hard coded orbital elements for Moon are passed to
* CelestialBody::CelestialBody();
************************************************************************/
-Moon::Moon(fgTIME *t) :
+Moon::Moon(FGTime *t) :
CelestialBody(125.1228, -0.0529538083,
5.1454, 0.00000,
318.0634, 0.1643573223,
/*****************************************************************************
- * void Moon::updatePosition(fgTIME *t, Star *ourSun)
+ * void Moon::updatePosition(FGTime *t, Star *ourSun)
* this member function calculates the actual topocentric position (i.e.)
* the position of the moon as seen from the current position on the surface
* of the moon.
****************************************************************************/
-void Moon::updatePosition(fgTIME *t, Star *ourSun)
+void Moon::updatePosition(FGTime *t, Star *ourSun)
{
double
eccAnom, ecl, actTime,
if (geoRa < 0)
geoRa += (2*FG_PI);
- HA = t->lst - (3.8197186 * geoRa);
+ HA = t->getLst() - (3.8197186 * geoRa);
g = atan (tan(gclat) / cos ((HA / 3.8197186)));
rightAscension = geoRa - mpar * rho * cos(gclat) * sin(HA) / cos (geoDec);
declination = geoDec - mpar * rho * sin (gclat) * sin (g - geoDec) / sin(g);
"Ra = (" << (RAD_TO_DEG *rightAscension)
<< "), Dec= (" << (RAD_TO_DEG *declination) << ")" );
xglTranslatef(0.0, 58600.0, 0.0);
-
- glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED
- glEnable(GL_BLEND); // BLEND ENABLED
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glBindTexture(GL_TEXTURE_2D, moon_halotexid);
-
- glBegin(GL_QUADS);
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-5000, 0.0, -5000);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 5000, 0.0, -5000);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 5000, 0.0, 5000);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-5000, 0.0, 5000);
- glEnd();
+ glEnable(GL_BLEND); // BLEND ENABLED
+
+ if (current_options.get_textures())
+ {
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ glBindTexture(GL_TEXTURE_2D, moon_halotexid);
+
+ glBegin(GL_QUADS);
+ glTexCoord2f(0.0f, 0.0f); glVertex3f(-5000, 0.0, -5000);
+ glTexCoord2f(1.0f, 0.0f); glVertex3f( 5000, 0.0, -5000);
+ glTexCoord2f(1.0f, 1.0f); glVertex3f( 5000, 0.0, 5000);
+ glTexCoord2f(0.0f, 1.0f); glVertex3f(-5000, 0.0, 5000);
+ glEnd();
+ }
xglEnable(GL_LIGHTING); // LIGHTING ENABLED
xglEnable( GL_LIGHT0 );
glBlendFunc(GL_ONE, GL_ONE);
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glBindTexture(GL_TEXTURE_2D, moon_texid);
- //glDisable(GL_LIGHTING); // LIGHTING DISABLED
-
- gluQuadricTexture(moonObject, GL_TRUE );
+ if (current_options.get_textures())
+ {
+ glBindTexture(GL_TEXTURE_2D, moon_texid);
+ //glDisable(GL_LIGHTING); // LIGHTING DISABLED
+ gluQuadricTexture(moonObject, GL_TRUE );
+ }
gluSphere(moonObject, moonSize, 12, 12 );
glDisable(GL_TEXTURE_2D); // TEXTURE DISABLED
glDisable(GL_BLEND); // BLEND DISABLED
void setHalo();
public:
- Moon ( fgTIME *t);
+ Moon ( FGTime *t);
~Moon();
- void updatePosition(fgTIME *t, Star *ourSun);
+ void updatePosition(FGTime *t, Star *ourSun);
void newImage();
};
#include "neptune.hxx"
/*************************************************************************
- * Neptune::Neptune(fgTIME *t)
+ * Neptune::Neptune(FGTime *t)
* Public constructor for class Neptune
* Argument: The current time.
* the hard coded orbital elements for Neptune are passed to
* CelestialBody::CelestialBody();
************************************************************************/
-Neptune::Neptune(fgTIME *t) :
+Neptune::Neptune(FGTime *t) :
CelestialBody(131.7806, 3.0173000E-5,
1.7700, -2.550E-7,
272.8461, -6.027000E-6,
{
}
/*************************************************************************
- * void Neptune::updatePosition(fgTIME *t, Star *ourSun)
+ * void Neptune::updatePosition(FGTime *t, Star *ourSun)
*
* calculates the current position of Neptune, by calling the base class,
* CelestialBody::updatePosition(); The current magnitude is calculated using
* a Neptune specific equation
*************************************************************************/
-void Neptune::updatePosition(fgTIME *t, Star *ourSun)
+void Neptune::updatePosition(FGTime *t, Star *ourSun)
{
CelestialBody::updatePosition(t, ourSun);
magnitude = -6.90 + 5*log10 (r*R) + 0.001 *FV;
class Neptune : public CelestialBody
{
public:
- Neptune ( fgTIME *t);
- void updatePosition(fgTIME *t, Star *ourSun);
+ Neptune ( FGTime *t);
+ void updatePosition(FGTime *t, Star *ourSun);
};
#endif // _NEPTUNE_HXX_
class Pluto : public CelestialBody
{
public:
- Pluto ( fgTIME t);
+ Pluto ( FGTime t);
};
#endif // _PLUTO_HXX_
#include "saturn.hxx"
/*************************************************************************
- * Saturn::Saturn(fgTIME *t)
+ * Saturn::Saturn(FGTime *t)
* Public constructor for class Saturn
* Argument: The current time.
* the hard coded orbital elements for Saturn are passed to
* CelestialBody::CelestialBody();
************************************************************************/
-Saturn::Saturn(fgTIME *t) :
+Saturn::Saturn(FGTime *t) :
CelestialBody(113.6634, 2.3898000E-5,
2.4886, -1.081E-7,
339.3939, 2.9766100E-5,
}
/*************************************************************************
- * void Saturn::updatePosition(fgTIME *t, Star *ourSun)
+ * void Saturn::updatePosition(FGTime *t, Star *ourSun)
*
* calculates the current position of Saturn, by calling the base class,
* CelestialBody::updatePosition(); The current magnitude is calculated using
* a Saturn specific equation
*************************************************************************/
-void Saturn::updatePosition(fgTIME *t, Star *ourSun)
+void Saturn::updatePosition(FGTime *t, Star *ourSun)
{
CelestialBody::updatePosition(t, ourSun);
class Saturn : public CelestialBody
{
public:
- Saturn ( fgTIME *t);
- void updatePosition(fgTIME *t, Star *ourSun);
+ Saturn ( FGTime *t);
+ void updatePosition(FGTime *t, Star *ourSun);
};
#endif // _SATURN_HXX_
/***************************************************************************
* default constructor for class SolarSystem:
* or course there can only be one way to create an entire solar system -:) )
- * the fgTIME argument is needed to properly initialize the the current orbital
+ * the FGTime argument is needed to properly initialize the the current orbital
* elements
*************************************************************************/
-SolarSystem::SolarSystem(fgTIME *t)
+SolarSystem::SolarSystem(FGTime *t)
{
if (theSolarSystem)
{
void SolarSystem::rebuild()
{
//fgLIGHT *l = &cur_light_params;
- fgTIME *t = &cur_time_params;
+ FGTime *t = FGTime::cur_time_params;
//float x, y, z;
//double sun_angle;
double ra, dec;
public:
- SolarSystem(fgTIME *t);
+ SolarSystem(FGTime *t);
CelestialBody *getSun();
CelestialBody *getMoon();
~SolarSystem();
#include <Time/sunpos.hxx>
#include <Debug/logstream.hxx>
#include <Time/light.hxx>
+#include <Main/options.hxx>
#include "star.hxx"
/*************************************************************************
- * Star::Star(fgTIME *t)
+ * Star::Star(FGTime *t)
* Public constructor for class Star
* Argument: The current time.
* the hard coded orbital elements our sun are passed to
* note that the word sun is avoided, in order to prevent some compilation
* problems on sun systems
************************************************************************/
-Star::Star(fgTIME *t) :
+Star::Star(FGTime *t) :
CelestialBody (0.000000, 0.0000000000,
0.0000, 0.00000,
282.9404, 4.7093500E-5,
//free(textureBuf);
}
/*************************************************************************
- * void Jupiter::updatePosition(fgTIME *t, Star *ourSun)
+ * void Jupiter::updatePosition(FGTime *t, Star *ourSun)
*
* calculates the current position of our sun.
*************************************************************************/
-void Star::updatePosition(fgTIME *t)
+void Star::updatePosition(FGTime *t)
{
double
actTime, eccAnom,
xglRotatef(((RAD_TO_DEG * rightAscension)- 90.0), 0.0, 0.0, 1.0);
xglRotatef((RAD_TO_DEG * declination), 1.0, 0.0, 0.0);
xglTranslatef(0,60000,0);
-
- glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED
- glEnable(GL_BLEND); // BLEND ENABLED
-
- //glEnable(GL_TEXTURE_2D);
- //glEnable(GL_BLEND);
- //glDisable(GL_LIGHTING);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glBindTexture(GL_TEXTURE_2D, sun_texid);
+ if (current_options.get_textures())
+ {
+ glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED
+ glEnable(GL_BLEND); // BLEND ENABLED
+
+ //glEnable(GL_TEXTURE_2D);
+ //glEnable(GL_BLEND);
+ //glDisable(GL_LIGHTING);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ glBindTexture(GL_TEXTURE_2D, sun_texid);
- glBegin(GL_QUADS);
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-5000, 0.0, -5000);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 5000, 0.0, -5000);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 5000, 0.0, 5000);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-5000, 0.0, 5000);
- glEnd();
+ glBegin(GL_QUADS);
+ glTexCoord2f(0.0f, 0.0f); glVertex3f(-5000, 0.0, -5000);
+ glTexCoord2f(1.0f, 0.0f); glVertex3f( 5000, 0.0, -5000);
+ glTexCoord2f(1.0f, 1.0f); glVertex3f( 5000, 0.0, 5000);
+ glTexCoord2f(0.0f, 1.0f); glVertex3f(-5000, 0.0, 5000);
+ glEnd();
+ }
+ xglDisable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
}
glPopMatrix();
- xglDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
glPushMatrix();
{
xglRotatef(((RAD_TO_DEG * rightAscension)- 90.0), 0.0, 0.0, 1.0);
glDisable(GL_BLEND); // BLEND DISABLED
}
}
-
-
-
-
void setTexture();
public:
- Star (fgTIME *t);
+ Star (FGTime *t);
~Star();
- void updatePosition(fgTIME *t);
+ void updatePosition(FGTime *t);
double getM();
double getw();
//double getLon();
void fgStarsRender( void ) {
FGInterface *f;
fgLIGHT *l;
- fgTIME *t;
+ FGTime *t;
int i;
f = current_aircraft.fdm_state;
l = &cur_light_params;
- t = &cur_time_params;
+ t = FGTime::cur_time_params;
// FG_PI_2 + 0.1 is about 6 degrees after sundown and before sunrise
// Draw the Stars
void fgStarsRender( void );
-// [no longer used?] extern struct OrbElements pltOrbElements[9];
-extern fgTIME cur_time_params;
+// [no longer used?] extern FGTime cur_time_params;
#endif // _STARS_HXX
#include "uranus.hxx"
/*************************************************************************
- * Uranus::Uranus(fgTIME *t)
+ * Uranus::Uranus(FGTime *t)
* Public constructor for class Uranus
* Argument: The current time.
* the hard coded orbital elements for Uranus are passed to
* CelestialBody::CelestialBody();
************************************************************************/
-Uranus::Uranus(fgTIME *t) :
+Uranus::Uranus(FGTime *t) :
CelestialBody(74.00050, 1.3978000E-5,
0.7733, 1.900E-8,
96.66120, 3.0565000E-5,
}
/*************************************************************************
- * void Uranus::updatePosition(fgTIME *t, Star *ourSun)
+ * void Uranus::updatePosition(FGTime *t, Star *ourSun)
*
* calculates the current position of Uranus, by calling the base class,
* CelestialBody::updatePosition(); The current magnitude is calculated using
* a Uranus specific equation
*************************************************************************/
-void Uranus::updatePosition(fgTIME *t, Star *ourSun)
+void Uranus::updatePosition(FGTime *t, Star *ourSun)
{
CelestialBody::updatePosition(t, ourSun);
magnitude = -7.15 + 5*log10( r*R) + 0.001 * FV;
class Uranus : public CelestialBody
{
public:
- Uranus ( fgTIME *t);
- void updatePosition(fgTIME *t, Star *ourSun);
+ Uranus ( FGTime *t);
+ void updatePosition(FGTime *t, Star *ourSun);
};
#endif // _URANUS_HXX_
#include "venus.hxx"
/*************************************************************************
- * Venus::Venus(fgTIME *t)
+ * Venus::Venus(FGTime *t)
* Public constructor for class Venus
* Argument: The current time.
* the hard coded orbital elements for Venus are passed to
* CelestialBody::CelestialBody();
************************************************************************/
-Venus::Venus(fgTIME *t) :
+Venus::Venus(FGTime *t) :
CelestialBody(76.67990, 2.4659000E-5,
3.3946, 2.75E-8,
54.89100, 1.3837400E-5,
}
/*************************************************************************
- * void Venus::updatePosition(fgTIME *t, Star *ourSun)
+ * void Venus::updatePosition(FGTime *t, Star *ourSun)
*
* calculates the current position of Venus, by calling the base class,
* CelestialBody::updatePosition(); The current magnitude is calculated using
* a Venus specific equation
*************************************************************************/
-void Venus::updatePosition(fgTIME *t, Star *ourSun)
+void Venus::updatePosition(FGTime *t, Star *ourSun)
{
CelestialBody::updatePosition(t, ourSun);
magnitude = -4.34 + 5*log10( r*R ) + 0.013 * FV + 4.2E-07 * pow(FV,3);
class Venus : public CelestialBody
{
public:
- Venus ( fgTIME *t);
- void updatePosition(fgTIME *t, Star *ourSun);
+ Venus ( FGTime *t);
+ void updatePosition(FGTime *t, Star *ourSun);
};
#endif // _VENUS_HXX_
#!/bin/sh
-WINDOW=NO
+WINDOW=YES
if [ $WINDOW = "YES" ]; then
# in a window (slow hack)
// Handle keyboard events
void GLUTkey(unsigned char k, int x, int y) {
FGInterface *f;
- fgTIME *t;
+ FGTime *t;
FGView *v;
FGWeather *w;
float fov, tmp;
static bool winding_ccw = true;
f = current_aircraft.fdm_state;
- t = &cur_time_params;
+ t = FGTime::cur_time_params;
v = ¤t_view;
w = ¤t_weather;
fgHUDInit2(¤t_aircraft);
return;
case 77: // M key
- t->warp -= 60;
+ t->adjust_warp(-60);
local_update_sky_and_lighting_params();
return;
case 84: // T key
- t->warp_delta -= 30;
+ t->adjust_warp_delta(-30);
local_update_sky_and_lighting_params();
return;
case 87: // W key
fgHUDInit(¤t_aircraft); // normal HUD
return;
case 109: // m key
- t->warp += 60;
+ t->adjust_warp (+60);
local_update_sky_and_lighting_params();
return;
case 112: // p key
- t->pause = !t->pause;
+ t->togglePauseMode();
// printf position and attitude information
FG_LOG( FG_INPUT, FG_INFO,
"Lon = " << f->get_Longitude() * RAD_TO_DEG
<< " Pitch = " << f->get_Theta() * RAD_TO_DEG );
return;
case 116: // t key
- t->warp_delta += 30;
+ t->adjust_warp_delta (+30);
local_update_sky_and_lighting_params();
return;
case 120: // X key
// Update all Visuals (redraws anything graphics related)
static void fgRenderFrame( void ) {
fgLIGHT *l = &cur_light_params;
- fgTIME *t = &cur_time_params;
+ FGTime *t = FGTime::cur_time_params;
FGView *v = ¤t_view;
double angle;
xglTranslatef( view_pos.x(), view_pos.y(), view_pos.z() );
// Rotate based on gst (sidereal time)
// note: constant should be 15.041085, Curt thought it was 15
- angle = t->gst * 15.041085;
+ angle = t->getGst() * 15.041085;
// printf("Rotating astro objects by %.2f degrees\n",angle);
xglRotatef( angle, 0.0, 0.0, -1.0 );
void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
FGInterface *f = current_aircraft.fdm_state;
fgLIGHT *l = &cur_light_params;
- fgTIME *t = &cur_time_params;
+ FGTime *t = FGTime::cur_time_params;
FGView *v = ¤t_view;
int i;
multi_loop = DEFAULT_MULTILOOP;
}
- if ( !t->pause ) {
+ if ( !t->getPause() ) {
// run Autopilot system
fgAPRun();
// for the next move and update the display?
static void fgMainLoop( void ) {
FGInterface *f;
- fgTIME *t;
+ FGTime *t;
static long remainder = 0;
long elapsed, multi_loop;
// int i;
static int frames = 0;
f = current_aircraft.fdm_state;
- t = &cur_time_params;
+ t = FGTime::cur_time_params;
FG_LOG( FG_ALL, FG_DEBUG, "Running Main Loop");
FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
f->get_Altitude() * FEET_TO_METER); */
// update "time"
- fgTimeUpdate(f, t);
+ t->update(f);
// Get elapsed time (in usec) for this past frame
elapsed = fgGetTimeInterval();
<< ", previous remainder is = " << remainder );
// Calculate frame rate average
- if ( (t->cur_time != last_time) && (last_time > 0) ) {
+ if ( (t->get_cur_time() != last_time) && (last_time > 0) ) {
general.set_frame_rate( frames );
FG_LOG( FG_ALL, FG_DEBUG,
"--> Frame rate is = " << general.get_frame_rate() );
frames = 0;
}
- last_time = t->cur_time;
+ last_time = t->get_cur_time();
++frames;
/* old fps calculation
// we never actually get here ... but just in case ... :-)
return(0);
}
-
-
}
#endif
- return ( 1 );
+ return 1;
}
// Returns non-zero if a problem encountered.
int fgInitSubsystems( void )
{
+ FGTime::cur_time_params = new FGTime();
+
FGInterface *f; // assigned later
fgLIGHT *l = &cur_light_params;
- fgTIME *t = &cur_time_params;
+ FGTime *t = FGTime::cur_time_params;
FGView *v = ¤t_view;
FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems");
fgEVENT::FG_EVENT_READY, 60000 );
// Initialize the time dependent variables
- fgTimeInit(t);
- fgTimeUpdate(f, t);
+ t->init();
+ t->update(f);
// Initialize view parameters
FG_LOG( FG_GENERAL, FG_DEBUG, "Before v->init()");
return(1);
}
-
-
int deg;
double min;
FGInterface *f;
- fgTIME *t;
+ FGTime *t;
+
+ f = current_aircraft.fdm_state;
+ t = FGTime::cur_time_params;
// run once every two seconds
- if ( p->last_time == cur_time_params.cur_time ) {
+ if ( p->last_time == t->get_cur_time() ) {
return;
}
- p->last_time = cur_time_params.cur_time;
- if ( cur_time_params.cur_time % 2 != 0 ) {
+ p->last_time = t->get_cur_time();
+ if ( t->get_cur_time() % 2 != 0 ) {
return;
}
- f = current_aircraft.fdm_state;
- t = &cur_time_params;
-
char utc[10];
sprintf( utc, "%02d%02d%02d",
- t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec );
+ t->getGmt()->tm_hour, t->getGmt()->tm_min, t->getGmt()->tm_sec );
char lat[20];
double latd = f->get_Latitude() * RAD_TO_DEG;
sprintf( altitude_ft, "%02d", (int)f->get_Altitude() );
char date[10];
- sprintf( date, "%02d%02d%02d",
- t->gmt->tm_mday, t->gmt->tm_mon+1, t->gmt->tm_year );
+ sprintf( date, "%02d%02d%02d", t->getGmt()->tm_mday,
+ t->getGmt()->tm_mon+1, t->getGmt()->tm_year );
// $GPRMC,HHMMSS,A,DDMM.MMM,N,DDDMM.MMM,W,XXX.X,XXX.X,DDMMYY,XXX.X,E*XX
sprintf( rmc, "GPRMC,%s,A,%s,%s,%s,%s,%s,0.000,E",
int deg;
double min;
FGInterface *f;
- fgTIME *t;
+ FGTime *t;
+
+ f = current_aircraft.fdm_state;
+ t = FGTime::cur_time_params;
// run once per second
- if ( p->last_time == cur_time_params.cur_time ) {
+ if ( p->last_time == t->get_cur_time() ) {
return;
}
- p->last_time = cur_time_params.cur_time;
- if ( cur_time_params.cur_time % 2 != 0 ) {
+ p->last_time = t->get_cur_time();
+ if ( t->get_cur_time() % 2 != 0 ) {
return;
}
- f = current_aircraft.fdm_state;
- t = &cur_time_params;
-
char utc[10];
sprintf( utc, "%02d%02d%02d",
- t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec );
+ t->getGmt()->tm_hour, t->getGmt()->tm_min, t->getGmt()->tm_sec );
char lat[20];
double latd = f->get_Latitude() * RAD_TO_DEG;
sprintf( altitude_ft, "%02d", (int)f->get_Altitude() );
char date[10];
- sprintf( date, "%02d%02d%02d",
- t->gmt->tm_mday, t->gmt->tm_mon+1, t->gmt->tm_year );
+ sprintf( date, "%02d%02d%02d", t->getGmt()->tm_mday,
+ t->getGmt()->tm_mon+1, t->getGmt()->tm_year );
// $GPRMC,HHMMSS,A,DDMM.MMM,N,DDDMM.MMM,W,XXX.X,XXX.X,DDMMYY,XXX.X,E*XX
sprintf( rmc, "GPRMC,%s,A,%s,%s,%s,%s,%s,000.0,E",
}
}
}
-
-
#define DEGHR(x) ((x)/15.)
#define RADHR(x) DEGHR(x*RAD_TO_DEG)
+
// #define MK_TIME_IS_GMT 0 // default value
// #define TIME_ZONE_OFFSET_WORK 0 // default value
-fgTIME cur_time_params;
+FGTime::FGTime()
+{
+ if (cur_time_params) {
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "Error: only one instance of FGTime allowed" );
+ exit(-1);
+ }
+ cur_time_params = this;
+}
-// Force an update of the sky and lighting parameters
-static void local_update_sky_and_lighting_params( void ) {
- // fgSunInit();
- SolarSystem::theSolarSystem->rebuild();
- cur_light_params.Update();
- fgSkyColorsInit();
+
+FGTime::~FGTime()
+{
}
// Initialize the time dependent variables
-void fgTimeInit(fgTIME *t) {
+void FGTime::init()
+{
FG_LOG( FG_EVENT, FG_INFO, "Initializing Time" );
-
- t->gst_diff = -9999.0;
-
+ gst_diff = -9999.0;
FG_LOG( FG_EVENT, FG_DEBUG,
"time offset = " << current_options.get_time_offset() );
-
- t->warp = current_options.get_time_offset();
- t->warp_delta = 0;
-
- t->pause = current_options.get_pause();
+ warp = current_options.get_time_offset();
+ warp_delta = 0;
+ pause = current_options.get_pause();
}
// modified Julian date (number of days elapsed since 1900 jan 0.5),
// mjd. Adapted from Xephem.
-double cal_mjd (int mn, double dy, int yr) {
- static double last_mjd, last_dy;
- double mjd;
- static int last_mn, last_yr;
+void FGTime::cal_mjd (int mn, double dy, int yr)
+{
+ //static double last_mjd, last_dy;
+ //double mjd;
+ //static int last_mn, last_yr;
int b, d, m, y;
long c;
-
+
if (mn == last_mn && yr == last_yr && dy == last_dy) {
mjd = last_mjd;
- return(mjd);
+ //return(mjd);
}
-
+
m = mn;
y = (yr < 0) ? yr + 1 : yr;
if (mn < 3) {
m += 12;
y -= 1;
}
-
+
if (yr < 1582 || (yr == 1582 && (mn < 10 || (mn == 10 && dy < 15)))) {
b = 0;
} else {
a = y/100;
b = 2 - a + a/4;
}
-
+
if (y < 0) {
c = (long)((365.25*y) - 0.75) - 694025L;
} else {
c = (long)(365.25*y) - 694025L;
}
-
+
d = (int)(30.6001*(m+1));
-
+
mjd = b + c + d + dy - 0.5;
-
+
last_mn = mn;
last_dy = dy;
last_yr = yr;
last_mjd = mjd;
-
- return(mjd);
+
+ //return(mjd);
}
-// given an mjd, return greenwich mean sidereal time, gst
-
-double utc_gst (double mjd) {
- double gst;
+// given an mjd, calculate greenwich mean sidereal time, gst
+void FGTime::utc_gst ()
+{
double day = floor(mjd-0.5)+0.5;
double hr = (mjd-day)*24.0;
double T, x;
gst = (1.0/SIDRATE)*hr + x;
FG_LOG( FG_EVENT, FG_DEBUG, " gst => " << gst );
-
- return(gst);
}
-// given Julian Date and Longitude (decimal degrees West) compute and
-// return Local Sidereal Time, in decimal hours.
+// given Julian Date and Longitude (decimal degrees West) compute
+// Local Sidereal Time, in decimal hours.
//
// Provided courtesy of ecdowney@noao.edu (Elwood Downey)
-//
-double sidereal_precise (double mjd, double lng) {
+double FGTime::sidereal_precise (double lng)
+{
double gst;
- double lst;
+ double lstTmp;
/* printf ("Current Lst on JD %13.5f at %8.4f degrees West: ",
mjd + MJD0, lng); */
lng *= DEG_TO_RAD;
// compute LST and print
- gst = utc_gst (mjd);
- lst = gst - RADHR (lng);
- lst -= 24.0*floor(lst/24.0);
+ //gst = utc_gst ();
+ utc_gst();
+ lstTmp = gst - RADHR (lng);
+ lstTmp -= 24.0*floor(lst/24.0);
// printf ("%7.4f\n", lst);
// that's all
- return (lst);
+ return (lstTmp);
}
-// Fix up timezone if using ftime()
-long int fix_up_timezone( long int timezone_orig ) {
-#if !defined( HAVE_GETTIMEOFDAY ) && defined( HAVE_FTIME )
- // ftime() needs a little extra help finding the current timezone
- struct timeb current;
- ftime(¤t);
- return( current.timezone * 60 );
-#else
- return( timezone_orig );
-#endif
+// return a courser but cheaper estimate of sidereal time
+double FGTime::sidereal_course(double lng)
+{
+ //struct tm *gmt;
+ //double lstTmp;
+ time_t start_gmt, now;
+ double diff, part, days, hours, lstTmp;
+ char tbuf[64];
+
+ //gmt = t->gmt;
+ //now = t->cur_time;
+ now = cur_time;
+ start_gmt = get_start_gmt(gmt->tm_year);
+
+ FG_LOG( FG_EVENT, FG_DEBUG, " COURSE: GMT = " << format_time(gmt, tbuf) );
+ FG_LOG( FG_EVENT, FG_DEBUG, " March 21 noon (GMT) = " << start_gmt );
+
+ diff = (now - start_gmt) / (3600.0 * 24.0);
+
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Time since 3/21/" << gmt->tm_year << " GMT = " << diff );
+
+ part = fmod(diff, 1.0);
+ days = diff - part;
+ hours = gmt->tm_hour + gmt->tm_min/60.0 + gmt->tm_sec/3600.0;
+
+ lstTmp = (days - lng)/15.0 + hours - 12;
+
+ while ( lstTmp < 0.0 ) {
+ lstTmp += 24.0;
+ }
+
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " days = " << days << " hours = " << hours << " lon = "
+ << lng << " lst = " << lstTmp );
+
+ return(lstTmp);
}
+// Update time variables such as gmt, julian date, and sidereal time
+void FGTime::update(FGInterface *f)
+{
+ double gst_precise, gst_course;
+
+ FG_LOG( FG_EVENT, FG_DEBUG, "Updating time" );
+
+ // get current Unix calendar time (in seconds)
+ warp += warp_delta;
+ cur_time = time(NULL) + warp;
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Current Unix calendar time = " << cur_time
+ << " warp = " << warp << " delta = " << warp_delta );
+
+ if ( warp_delta ) {
+ // time is changing so force an update
+ local_update_sky_and_lighting_params();
+ }
+
+ // get GMT break down for current time
+ gmt = gmtime(&cur_time);
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Current GMT = " << gmt->tm_mon+1 << "/"
+ << gmt->tm_mday << "/" << gmt->tm_year << " "
+ << gmt->tm_hour << ":" << gmt->tm_min << ":"
+ << gmt->tm_sec );
+
+ // calculate modified Julian date
+ // t->mjd = cal_mjd ((int)(t->gmt->tm_mon+1), (double)t->gmt->tm_mday,
+ // (int)(t->gmt->tm_year + 1900));
+ cal_mjd ((int)(gmt->tm_mon+1), (double)gmt->tm_mday,
+ (int)(gmt->tm_year + 1900));
+
+ // add in partial day
+ mjd += (gmt->tm_hour / 24.0) + (gmt->tm_min / (24.0 * 60.0)) +
+ (gmt->tm_sec / (24.0 * 60.0 * 60.0));
+
+ // convert "back" to Julian date + partial day (as a fraction of one)
+ jd = mjd + MJD0;
+ FG_LOG( FG_EVENT, FG_DEBUG, " Current Julian Date = " << jd );
+
+ // printf(" Current Longitude = %.3f\n", FG_Longitude * RAD_TO_DEG);
+
+ // Calculate local side real time
+ if ( gst_diff < -100.0 ) {
+ // first time through do the expensive calculation & cheap
+ // calculation to get the difference.
+ FG_LOG( FG_EVENT, FG_INFO, " First time, doing precise gst" );
+ gst_precise = gst = sidereal_precise(0.00);
+ gst_course = sidereal_course(0.00);
+
+ gst_diff = gst_precise - gst_course;
+
+ lst = sidereal_course(-(f->get_Longitude() * RAD_TO_DEG)) + gst_diff;
+ } else {
+ // course + difference should drift off very slowly
+ gst = sidereal_course( 0.00 ) + gst_diff;
+ lst = sidereal_course( -(f->get_Longitude() * RAD_TO_DEG)) + gst_diff;
+ }
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Current lon=0.00 Sidereal Time = " << gst );
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Current LOCAL Sidereal Time = " << lst << " ("
+ << sidereal_precise(-(f->get_Longitude() * RAD_TO_DEG))
+ << ") (diff = " << gst_diff << ")" );
+}
+
+
+/******************************************************************
+ * The following are some functions that were included as FGTime
+ * members, although they currenty don't make used of any of the
+ * class's variables. Maybe this'll change in the future
+ *****************************************************************/
+
// Return time_t for Sat Mar 21 12:00:00 GMT
//
// I believe the mktime() has a SYSV vs. BSD behavior difference.
// If you are having problems with incorrectly positioned astronomical
// bodies, this is a really good place to start looking.
-time_t get_start_gmt(int year) {
+time_t FGTime::get_start_gmt(int year) {
struct tm mt;
// For now we assume that if daylight is not defined in
# endif // ! defined ( MK_TIME_IS_GMT )
}
-static char*
-format_time( const struct tm* p, char* buf )
+// Fix up timezone if using ftime()
+long int FGTime::fix_up_timezone( long int timezone_orig )
+{
+#if !defined( HAVE_GETTIMEOFDAY ) && defined( HAVE_FTIME )
+ // ftime() needs a little extra help finding the current timezone
+ struct timeb current;
+ ftime(¤t);
+ return( current.timezone * 60 );
+#else
+ return( timezone_orig );
+#endif
+}
+
+
+char* FGTime::format_time( const struct tm* p, char* buf )
{
sprintf( buf, "%d/%d/%2d %d:%02d:%02d",
p->tm_mon, p->tm_mday, p->tm_year,
return buf;
}
-// return a courser but cheaper estimate of sidereal time
-double sidereal_course(fgTIME *t, double lng) {
- struct tm *gmt;
- time_t start_gmt, now;
- double diff, part, days, hours, lst;
- char tbuf[64];
-
- gmt = t->gmt;
- now = t->cur_time;
- start_gmt = get_start_gmt(gmt->tm_year);
-
- FG_LOG( FG_EVENT, FG_DEBUG, " COURSE: GMT = " << format_time(gmt, tbuf) );
- FG_LOG( FG_EVENT, FG_DEBUG, " March 21 noon (GMT) = " << start_gmt );
-
- diff = (now - start_gmt) / (3600.0 * 24.0);
-
- FG_LOG( FG_EVENT, FG_DEBUG,
- " Time since 3/21/" << gmt->tm_year << " GMT = " << diff );
-
- part = fmod(diff, 1.0);
- days = diff - part;
- hours = gmt->tm_hour + gmt->tm_min/60.0 + gmt->tm_sec/3600.0;
-
- lst = (days - lng)/15.0 + hours - 12;
-
- while ( lst < 0.0 ) {
- lst += 24.0;
- }
-
- FG_LOG( FG_EVENT, FG_DEBUG,
- " days = " << days << " hours = " << hours << " lon = "
- << lng << " lst = " << lst );
-
- return(lst);
-}
-
-
-// Update time variables such as gmt, julian date, and sidereal time
-void fgTimeUpdate(FGInterface *f, fgTIME *t) {
- double gst_precise, gst_course;
-
- FG_LOG( FG_EVENT, FG_DEBUG, "Updating time" );
-
- // get current Unix calendar time (in seconds)
- t->warp += t->warp_delta;
- t->cur_time = time(NULL) + t->warp;
- FG_LOG( FG_EVENT, FG_DEBUG,
- " Current Unix calendar time = " << t->cur_time
- << " warp = " << t->warp << " delta = " << t->warp_delta );
-
- if ( t->warp_delta ) {
- // time is changing so force an update
- local_update_sky_and_lighting_params();
- }
-
- // get GMT break down for current time
- t->gmt = gmtime(&t->cur_time);
- FG_LOG( FG_EVENT, FG_DEBUG,
- " Current GMT = " << t->gmt->tm_mon+1 << "/"
- << t->gmt->tm_mday << "/" << t->gmt->tm_year << " "
- << t->gmt->tm_hour << ":" << t->gmt->tm_min << ":"
- << t->gmt->tm_sec );
-
- // calculate modified Julian date
- t->mjd = cal_mjd ((int)(t->gmt->tm_mon+1), (double)t->gmt->tm_mday,
- (int)(t->gmt->tm_year + 1900));
-
- // add in partial day
- t->mjd += (t->gmt->tm_hour / 24.0) + (t->gmt->tm_min / (24.0 * 60.0)) +
- (t->gmt->tm_sec / (24.0 * 60.0 * 60.0));
-
- // convert "back" to Julian date + partial day (as a fraction of one)
- t->jd = t->mjd + MJD0;
- FG_LOG( FG_EVENT, FG_DEBUG, " Current Julian Date = " << t->jd );
-
- // printf(" Current Longitude = %.3f\n", FG_Longitude * RAD_TO_DEG);
-
- // Calculate local side real time
- if ( t->gst_diff < -100.0 ) {
- // first time through do the expensive calculation & cheap
- // calculation to get the difference.
- FG_LOG( FG_EVENT, FG_INFO, " First time, doing precise gst" );
- t->gst = gst_precise = sidereal_precise(t->mjd, 0.00);
- gst_course = sidereal_course(t, 0.00);
- t->gst_diff = gst_precise - gst_course;
- t->lst =
- sidereal_course(t, -(f->get_Longitude() * RAD_TO_DEG)) + t->gst_diff;
- } else {
- // course + difference should drift off very slowly
- t->gst = sidereal_course(t, 0.00) + t->gst_diff;
- t->lst = sidereal_course(t, -(f->get_Longitude() * RAD_TO_DEG)) +
- t->gst_diff;
- }
- FG_LOG( FG_EVENT, FG_DEBUG,
- " Current lon=0.00 Sidereal Time = " << t->gst );
- FG_LOG( FG_EVENT, FG_DEBUG,
- " Current LOCAL Sidereal Time = " << t->lst << " ("
- << sidereal_precise(t->mjd, -(f->get_Longitude() * RAD_TO_DEG))
- << ") (diff = " << t->gst_diff << ")" );
+// Force an update of the sky and lighting parameters
+void FGTime::local_update_sky_and_lighting_params( void ) {
+ // fgSunInit();
+ SolarSystem::theSolarSystem->rebuild();
+ cur_light_params.Update();
+ fgSkyColorsInit();
}
+FGTime* FGTime::cur_time_params = 0;
-//
// fg_time.hxx -- data structures and routines for managing time related stuff.
//
// Written by Curtis Olson, started August 1997.
// Define a structure containing global time parameters
-typedef struct {
- // the date/time in various forms
+class FGTime {
+
+private:
+
// Unix "calendar" time in seconds
time_t cur_time;
// modified Julian date
double mjd;
+ double last_mjd, last_dy;
+ int last_mn, last_yr;
+
// side real time at prime meridian
double gst;
double lst;
// the difference between the precise sidereal time algorithm
- // result and the course result.
- // course + diff has good accuracy for the short term
+ // result and the course result. course + diff has good accuracy
+ // for the short term
double gst_diff;
// An offset in seconds from the true time. Allows us to adjust
// How much to change the value of warp each iteration. Allows us
// to make time progress faster than normal.
- long int warp_delta;
+ long int warp_delta;
- // Paused (0 = no, 1 = yes)
- int pause;
-} fgTIME;
+ // Paused?
+ bool pause;
+
+ void local_update_sky_and_lighting_params( void );
-extern fgTIME cur_time_params;
+public:
+ FGTime();
+ ~FGTime();
-// Update time variables such as gmt, julian date, and sidereal time
-void fgTimeInit(fgTIME *t);
+ inline double getMjd() const { return mjd; };
+ inline double getLst() const { return lst; };
+ inline double getGst() const { return gst; };
+ inline time_t get_cur_time() const { return cur_time; };
+ inline struct tm* getGmt()const { return gmt; };
+ inline bool getPause() const { return pause; };
+
+ void adjust_warp(int val) { warp += val; };
+ void adjust_warp_delta(int val) { warp_delta += val; };
+ void togglePauseMode() { pause = !pause; };
+ // Initialize the time dependent variables
+ void init();
-// Update the time dependent variables
-void fgTimeUpdate(FGInterface *f, fgTIME *t);
+ // Update the time dependent variables
+ void update(FGInterface *f);
+ void cal_mjd (int mn, double dy, int yr);
+ void utc_gst();
+ double sidereal_precise (double lng);
+ double sidereal_course(double lng);
+ static FGTime *cur_time_params;
-#endif // _FG_TIME_HXX
+ // Some other stuff which were changed to FGTime members on
+ // questionable grounds -:)
+ time_t get_start_gmt(int year);
+ char* format_time( const struct tm* p, char* buf );
+ long int fix_up_timezone( long int timezone_orig );
+};
+#endif // _FG_TIME_HXX
// update lighting parameters based on current sun position
void fgLIGHT::Update( void ) {
FGInterface *f;
- fgTIME *t;
+ FGTime *t;
// if the 4th field is 0.0, this specifies a direction ...
GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
// base sky color
double deg, ambient, diffuse, sky_brightness;
f = current_aircraft.fdm_state;
- t = &cur_time_params;
+ t = FGTime::cur_time_params;
FG_LOG( FG_EVENT, FG_INFO, "Updating light parameters." );
// update the cur_time_params structure with the current moon position
void fgUpdateMoonPos( void ) {
fgLIGHT *l;
- fgTIME *t;
+ FGTime *t;
FGView *v;
MAT3vec nup, nmoon, v0, surface_to_moon;
Point3D p, rel_moonpos;
double ntmp;
l = &cur_light_params;
- t = &cur_time_params;
+ t = FGTime::cur_time_params;
v = ¤t_view;
FG_LOG( FG_EVENT, FG_INFO, " Updating Moon position" );
// (not sure why there was two)
// fgMoonPosition(t->cur_time, &l->moon_lon, &moon_gd_lat);
- fgMoonPositionGST(t->gst, &l->moon_lon, &moon_gd_lat);
+ fgMoonPositionGST(t->getGst(), &l->moon_lon, &moon_gd_lat);
fgGeodToGeoc(moon_gd_lat, 0.0, &sl_radius, &l->moon_gc_lat);
p = Point3D( l->moon_lon, l->moon_gc_lat, sl_radius );
l->fg_moonpos = fgPolarToCart3d(p);
- FG_LOG( FG_EVENT, FG_INFO, " t->cur_time = " << t->cur_time );
+ FG_LOG( FG_EVENT, FG_INFO, " t->cur_time = " << t->get_cur_time() );
FG_LOG( FG_EVENT, FG_INFO,
" Moon Geodetic lat = " << moon_gd_lat
<< " Geocentric lat = " << l->moon_gc_lat );
// update the cur_time_params structure with the current sun position
void fgUpdateSunPos( void ) {
fgLIGHT *l;
- fgTIME *t;
+ FGTime *t;
FGView *v;
MAT3vec nup, nsun, v0, surface_to_sun;
Point3D p, rel_sunpos;
double ntmp;
l = &cur_light_params;
- t = &cur_time_params;
+ t = FGTime::cur_time_params;
v = ¤t_view;
FG_LOG( FG_EVENT, FG_INFO, " Updating Sun position" );
// (not sure why there was two)
// fgSunPosition(t->cur_time, &l->sun_lon, &sun_gd_lat);
- fgSunPositionGST(t->gst, &l->sun_lon, &sun_gd_lat);
+ fgSunPositionGST(t->getGst(), &l->sun_lon, &sun_gd_lat);
fgGeodToGeoc(sun_gd_lat, 0.0, &sl_radius, &l->sun_gc_lat);
p = Point3D( l->sun_lon, l->sun_gc_lat, sl_radius );
l->fg_sunpos = fgPolarToCart3d(p);
- FG_LOG( FG_EVENT, FG_INFO, " t->cur_time = " << t->cur_time );
+ FG_LOG( FG_EVENT, FG_INFO, " t->cur_time = " << t->get_cur_time() );
FG_LOG( FG_EVENT, FG_INFO,
" Sun Geodetic lat = " << sun_gd_lat
<< " Geocentric lat = " << l->sun_gc_lat );