Changes contributed by Durk Talsma:
Here's a few changes I made to fg-0.58 this weekend. Included are the following features: - Sun and moon have a halo - The moon has a light vector, moon_angle, etc. etc. so that we can have some moonlight during the night. - Lot's of small changes tweakes, including some stuff Norman Vine sent me earlier.
This commit is contained in:
parent
4ce1ff5f2a
commit
33726fc21b
14 changed files with 541 additions and 218 deletions
|
@ -77,7 +77,10 @@ void CelestialBody::updatePosition(fgTIME *t, Star *ourSun)
|
|||
xg = xh + ourSun->getxs();
|
||||
yg = yh + ourSun->getys();
|
||||
zg = zh;
|
||||
|
||||
|
||||
lonEcl = atan2(yh, xh);
|
||||
latEcl = atan2(zh, sqrt(xh*xh+yh*yh));
|
||||
|
||||
xe = xg;
|
||||
ye = yg * cos(ecl) - zg * sin(ecl);
|
||||
ze = yg * sin(ecl) + zg * cos(ecl);
|
||||
|
@ -167,3 +170,8 @@ double CelestialBody::fgCalcEccAnom(double M, double e)
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ protected: // make the data protected, in order to give the inherit
|
|||
double rightAscension, declination;
|
||||
double r, R, s, FV;
|
||||
double magnitude;
|
||||
double lonEcl, latEcl;
|
||||
|
||||
double fgCalcEccAnom(double M, double e);
|
||||
double fgCalcActTime(fgTIME *t);
|
||||
|
@ -73,6 +74,8 @@ public:
|
|||
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);
|
||||
};
|
||||
|
||||
|
@ -168,6 +171,15 @@ inline void CelestialBody::getPos(double* ra, double* dec, double* magn)
|
|||
*magn = magnitude;
|
||||
}
|
||||
|
||||
inline double CelestialBody::getLon()
|
||||
{
|
||||
return lonEcl;
|
||||
}
|
||||
|
||||
inline double CelestialBody::getLat()
|
||||
{
|
||||
return latEcl;
|
||||
}
|
||||
|
||||
#endif // _CELESTIALBODY_H_
|
||||
|
||||
|
|
215
Astro/moon.cxx
215
Astro/moon.cxx
|
@ -23,21 +23,19 @@
|
|||
* (Log is kept at end of this file)
|
||||
**************************************************************************/
|
||||
|
||||
#include <FDM/flight.hxx>
|
||||
|
||||
#include <string.h>
|
||||
#include "moon.hxx"
|
||||
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <Objects/texload.h>
|
||||
#include <FDM/flight.hxx>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
# define exception c_exception
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
#include "moon.hxx"
|
||||
|
||||
static GLuint moon_texid;
|
||||
static GLubyte *moon_texbuf;
|
||||
|
||||
/*************************************************************************
|
||||
* Moon::Moon(fgTIME *t)
|
||||
|
@ -97,7 +95,95 @@ Moon::Moon(fgTIME *t) :
|
|||
0,
|
||||
GL_RGB, GL_UNSIGNED_BYTE,
|
||||
moon_texbuf);
|
||||
|
||||
// setup the halo texture
|
||||
FG_LOG( FG_GENERAL, FG_INFO, "Initializing Moon Texture");
|
||||
#ifdef GL_VERSION_1_1
|
||||
xglGenTextures(1, &moon_halotexid);
|
||||
xglBindTexture(GL_TEXTURE_2D, moon_halotexid);
|
||||
#elif GL_EXT_texture_object
|
||||
xglGenTexturesEXT(1, &moon_halotexid);
|
||||
xglBindTextureEXT(GL_TEXTURE_2D, moon_halotexid);
|
||||
#else
|
||||
# error port me
|
||||
#endif
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
setHalo();
|
||||
glTexImage2D( GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
256, 256,
|
||||
0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
moon_halotexbuf);
|
||||
moonObject = gluNewQuadric();
|
||||
}
|
||||
|
||||
Moon::~Moon()
|
||||
{
|
||||
//delete moonObject;
|
||||
delete moon_texbuf;
|
||||
delete moon_halotexbuf;
|
||||
}
|
||||
|
||||
|
||||
static int texWidth = 256; /* 64x64 is plenty */
|
||||
|
||||
void Moon::setHalo()
|
||||
{
|
||||
int texSize;
|
||||
//void *textureBuf;
|
||||
GLubyte *p;
|
||||
int i,j;
|
||||
double radius;
|
||||
|
||||
texSize = texWidth*texWidth;
|
||||
|
||||
moon_halotexbuf = new GLubyte[texSize*4];
|
||||
if (!moon_halotexbuf)
|
||||
return; // Ugly!
|
||||
|
||||
p = moon_halotexbuf;
|
||||
|
||||
radius = (double)(texWidth / 2);
|
||||
|
||||
for (i=0; i < texWidth; i++) {
|
||||
for (j=0; j < texWidth; j++) {
|
||||
double x, y, d;
|
||||
|
||||
x = fabs((double)(i - (texWidth / 2)));
|
||||
y = fabs((double)(j - (texWidth / 2)));
|
||||
|
||||
d = sqrt((x * x) + (y * y));
|
||||
if (d < radius)
|
||||
{
|
||||
double t = 1.0 - (d / radius); // t is 1.0 at center, 0.0 at edge */
|
||||
// inverse square looks nice
|
||||
*p = (int)((double)0xff * (t * t));
|
||||
*(p+1) = (int)((double) 0xff * (t*t));
|
||||
*(p+2) = (int)((double) 0xff * (t*t));
|
||||
*(p+3) = 0x11;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = 0x00;
|
||||
*(p+1) = 0x00;
|
||||
*(p+2) = 0x00;
|
||||
*(p+3) = 0x11;
|
||||
}
|
||||
p += 4;
|
||||
}
|
||||
}
|
||||
//gluBuild2DMipmaps(GL_TEXTURE_2D, 1, texWidth, texWidth,
|
||||
// GL_LUMINANCE,
|
||||
// GL_UNSIGNED_BYTE, textureBuf);
|
||||
//free(textureBuf);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* void Moon::updatePosition(fgTIME *t, Star *ourSun)
|
||||
* this member function calculates the actual topocentric position (i.e.)
|
||||
|
@ -107,7 +193,7 @@ Moon::Moon(fgTIME *t) :
|
|||
void Moon::updatePosition(fgTIME *t, Star *ourSun)
|
||||
{
|
||||
double
|
||||
eccAnom, ecl, lonecl, latecl, actTime,
|
||||
eccAnom, ecl, actTime,
|
||||
xv, yv, v, r, xh, yh, zh, xg, yg, zg, xe, ye, ze,
|
||||
Ls, Lm, D, F, mpar, gclat, rho, HA, g,
|
||||
geoRa, geoDec;
|
||||
|
@ -136,8 +222,8 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
|
|||
zh = r * (sin(v+w) * sin(i));
|
||||
|
||||
// calculate the ecliptic latitude and longitude here
|
||||
lonecl = atan2 (yh, xh);
|
||||
latecl = atan2(zh, sqrt(xh*xh + yh*yh));
|
||||
lonEcl = atan2 (yh, xh);
|
||||
latEcl = atan2(zh, sqrt(xh*xh + yh*yh));
|
||||
|
||||
/* Calculate a number of perturbatioin, i.e. disturbances caused by the
|
||||
* gravitational infuence of the sun and the other major planets.
|
||||
|
@ -147,7 +233,7 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
|
|||
D = Lm - Ls;
|
||||
F = Lm - N;
|
||||
|
||||
lonecl += DEG_TO_RAD * (-1.274 * sin (M - 2*D)
|
||||
lonEcl += DEG_TO_RAD * (-1.274 * sin (M - 2*D)
|
||||
+0.658 * sin (2*D)
|
||||
-0.186 * sin(ourSun->getM())
|
||||
-0.059 * sin(2*M - 2*D)
|
||||
|
@ -160,7 +246,7 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
|
|||
-0.015 * sin(2*F - 2*D)
|
||||
+0.011 * sin(M - 4*D)
|
||||
);
|
||||
latecl += DEG_TO_RAD * (-0.173 * sin(F-2*D)
|
||||
latEcl += DEG_TO_RAD * (-0.173 * sin(F-2*D)
|
||||
-0.055 * sin(M - F - 2*D)
|
||||
-0.046 * sin(M + F - 2*D)
|
||||
+0.033 * sin(F + 2*D)
|
||||
|
@ -170,9 +256,9 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
|
|||
-0.46 * cos(2*D)
|
||||
);
|
||||
FG_LOG(FG_GENERAL, FG_INFO, "Running moon update");
|
||||
xg = r * cos(lonecl) * cos(latecl);
|
||||
yg = r * sin(lonecl) * cos(latecl);
|
||||
zg = r * sin(latecl);
|
||||
xg = r * cos(lonEcl) * cos(latEcl);
|
||||
yg = r * sin(lonEcl) * cos(latEcl);
|
||||
zg = r * sin(latEcl);
|
||||
|
||||
xe = xg;
|
||||
ye = yg * cos(ecl) -zg * sin(ecl);
|
||||
|
@ -185,7 +271,7 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
|
|||
// topocentric ra and dec. i.e. the position as seen from the
|
||||
// surface of the earth, instead of the center of the earth
|
||||
|
||||
// First calculates the moon's parrallax, that is, the apparent size of the
|
||||
// First calculate the moon's parrallax, that is, the apparent size of the
|
||||
// (equatorial) radius of the earth, as seen from the moon
|
||||
mpar = asin ( 1 / r);
|
||||
gclat = f->get_Latitude() - 0.003358 *
|
||||
|
@ -202,7 +288,7 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
|
|||
|
||||
|
||||
/************************************************************************
|
||||
* void Moon::newImage(float ra, float dec)
|
||||
* void Moon::newImage()
|
||||
*
|
||||
* This function regenerates a new visual image of the moon, which is added to
|
||||
* solarSystem display list.
|
||||
|
@ -211,24 +297,93 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
|
|||
*
|
||||
* return value: none
|
||||
**************************************************************************/
|
||||
void Moon::newImage(float ra, float dec)
|
||||
void Moon::newImage()
|
||||
{
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glBindTexture(GL_TEXTURE_2D, moon_texid);
|
||||
fgLIGHT *l = &cur_light_params;
|
||||
float moon_angle = l->moon_angle;
|
||||
|
||||
/*double x_2, x_4, x_8, x_10;
|
||||
GLfloat ambient;
|
||||
GLfloat amb[4];*/
|
||||
int moonSize = 750;
|
||||
|
||||
//xglRotatef(-90, 0.0, 0.0, 1.0);
|
||||
xglRotatef(((RAD_TO_DEG * ra)- 90.0), 0.0, 0.0, 1.0);
|
||||
xglRotatef((RAD_TO_DEG * dec), 1.0, 0.0, 0.0);
|
||||
GLfloat moonColor[4] = {0.85, 0.75, 0.35, 1.0};
|
||||
GLfloat black[4] = {0.0, 0.0,0.0,1.0};
|
||||
GLfloat white[4] = {1.0, 1.0,1.0,1.0};
|
||||
|
||||
if( moon_angle*RAD_TO_DEG < 100 )
|
||||
{
|
||||
/*
|
||||
x_2 = moon_angle * moon_angle;
|
||||
x_4 = x_2 * x_2;
|
||||
x_8 = x_4 * x_4;
|
||||
x_10 = x_8 * x_2;
|
||||
ambient = (float)(0.4 * pow (1.1, - x_10 / 30.0));
|
||||
if (ambient < 0.3) ambient = 0.3;
|
||||
if (ambient > 1.0) ambient = 1.0;
|
||||
|
||||
amb[0] = ((ambient * 6.0) - 1.0); // minimum value = 0.8
|
||||
amb[1] = ((ambient * 11.0) - 3.0); // minimum value = 0.3
|
||||
amb[2] = ((ambient * 12.0) - 3.6); // minimum value = 0.0
|
||||
amb[3] = 1.00;
|
||||
|
||||
if (amb[0] > 1.0) amb[0] = 1.0;
|
||||
if (amb[1] > 1.0) amb[1] = 1.0;
|
||||
if (amb[2] > 1.0) amb[2] = 1.0;
|
||||
xglColor3fv(amb);
|
||||
xglColor3f(1.0, 1.0, 1.0); */
|
||||
xglPushMatrix();
|
||||
{
|
||||
//xglRotatef(-90, 0.0, 0.0, 1.0);
|
||||
xglRotatef(((RAD_TO_DEG * rightAscension)- 90.0), 0.0, 0.0, 1.0);
|
||||
xglRotatef((RAD_TO_DEG * declination), 1.0, 0.0, 0.0);
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO,
|
||||
"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();
|
||||
|
||||
xglEnable(GL_LIGHTING); // LIGHTING ENABLED
|
||||
xglEnable( GL_LIGHT0 );
|
||||
// set lighting parameters
|
||||
xglLightfv(GL_LIGHT0, GL_AMBIENT, white );
|
||||
xglLightfv(GL_LIGHT0, GL_DIFFUSE, white );
|
||||
xglEnable( GL_CULL_FACE );
|
||||
xglMaterialfv(GL_FRONT, GL_AMBIENT, black);
|
||||
xglMaterialfv(GL_FRONT, GL_DIFFUSE, moonColor);
|
||||
|
||||
//glEnable(GL_TEXTURE_2D);
|
||||
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 );
|
||||
gluSphere(moonObject, moonSize, 12, 12 );
|
||||
glDisable(GL_TEXTURE_2D); // TEXTURE DISABLED
|
||||
glDisable(GL_BLEND); // BLEND DISABLED
|
||||
}
|
||||
xglPopMatrix();
|
||||
glDisable(GL_LIGHTING); // LIGHTING DISABLED
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO,
|
||||
"Ra = (" << (RAD_TO_DEG *ra)
|
||||
<< "), Dec= (" << (RAD_TO_DEG *dec) << ")" );
|
||||
xglTranslatef(0.0, 58600.0, 0.0);
|
||||
Object = gluNewQuadric();
|
||||
gluQuadricTexture( Object, GL_TRUE );
|
||||
gluSphere( Object, 1367, 12, 12 );
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,13 +38,19 @@ class Moon : public CelestialBody
|
|||
private:
|
||||
void TexInit(); // This should move to the constructor eventually.
|
||||
|
||||
GLUquadricObj *Object;
|
||||
GLUquadricObj *moonObject;
|
||||
GLuint Sphere;
|
||||
GLuint moon_texid;
|
||||
GLuint moon_halotexid;
|
||||
GLubyte *moon_texbuf;
|
||||
GLubyte *moon_halotexbuf;
|
||||
|
||||
void setHalo();
|
||||
public:
|
||||
Moon ( fgTIME *t);
|
||||
~Moon();
|
||||
void updatePosition(fgTIME *t, Star *ourSun);
|
||||
void newImage(float, float);
|
||||
void newImage();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <XGL/xgl.h>
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <Time/sunpos.hxx>
|
||||
#include <Time/moonpos.hxx>
|
||||
#include "solarsystem.hxx"
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -69,10 +70,9 @@ SolarSystem::SolarSystem(fgTIME *t)
|
|||
displayList = 0;
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
the destructor for class SolarSystem;
|
||||
danger: Huge Explosions ahead! (-:))
|
||||
------------------------------------------------------------------------*/
|
||||
/**************************************************************************
|
||||
* the destructor for class SolarSystem;
|
||||
**************************************************************************/
|
||||
SolarSystem::~SolarSystem()
|
||||
{
|
||||
delete ourSun;
|
||||
|
@ -84,7 +84,6 @@ SolarSystem::~SolarSystem()
|
|||
delete saturn;
|
||||
delete uranus;
|
||||
delete neptune;
|
||||
//delete pluto;
|
||||
}
|
||||
/****************************************************************************
|
||||
* void SolarSystem::rebuild()
|
||||
|
@ -97,19 +96,19 @@ SolarSystem::~SolarSystem()
|
|||
***************************************************************************/
|
||||
void SolarSystem::rebuild()
|
||||
{
|
||||
fgLIGHT *l = &cur_light_params;
|
||||
//fgLIGHT *l = &cur_light_params;
|
||||
fgTIME *t = &cur_time_params;
|
||||
float x, y, z;
|
||||
// float xx, yy,zz;
|
||||
double sun_angle;
|
||||
//float x, y, z;
|
||||
//double sun_angle;
|
||||
double ra, dec;
|
||||
double x_2, x_4, x_8, x_10;
|
||||
//double x_2, x_4, x_8, x_10;*/
|
||||
double magnitude;
|
||||
GLfloat ambient;
|
||||
GLfloat amb[4];
|
||||
GLfloat moonColor[4] = {0.85, 0.75, 0.35, 1.0};
|
||||
GLfloat black[4] = {0.0, 0.0,0.0,1.0};
|
||||
GLfloat white[4] = {1.0, 1.0,1.0,1.0};
|
||||
//GLfloat ambient;
|
||||
//GLfloat amb[4];
|
||||
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
|
||||
// Step 1: update all the positions
|
||||
ourSun->updatePosition(t);
|
||||
|
@ -123,75 +122,28 @@ void SolarSystem::rebuild()
|
|||
neptune->updatePosition(t, ourSun);
|
||||
|
||||
fgUpdateSunPos(); // get the right sun angle (especially important when
|
||||
// running for the first time.
|
||||
// running for the first time).
|
||||
fgUpdateMoonPos();
|
||||
|
||||
if (displayList)
|
||||
xglDeleteLists(displayList, 1);
|
||||
|
||||
displayList = xglGenLists(1);
|
||||
|
||||
// Step 2: rebuild the display list
|
||||
xglNewList( displayList, GL_COMPILE);
|
||||
{
|
||||
// Step 2a: Add the moon...
|
||||
xglEnable( GL_LIGHTING );
|
||||
xglEnable( GL_LIGHT0 );
|
||||
// set lighting parameters
|
||||
xglLightfv(GL_LIGHT0, GL_AMBIENT, white );
|
||||
xglLightfv(GL_LIGHT0, GL_DIFFUSE, white );
|
||||
xglEnable( GL_CULL_FACE );
|
||||
|
||||
// Enable blending, in order to effectively eliminate the dark side of the
|
||||
// moon
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
earthsMoon->getPos(&ra, &dec);
|
||||
xglMaterialfv(GL_FRONT, GL_AMBIENT, black);
|
||||
xglMaterialfv(GL_FRONT, GL_DIFFUSE, moonColor);
|
||||
xglPushMatrix();
|
||||
{
|
||||
earthsMoon->newImage(ra,dec);
|
||||
}
|
||||
xglPopMatrix();
|
||||
glDisable(GL_BLEND);
|
||||
xglDisable(GL_LIGHTING);
|
||||
|
||||
// Not that it is preferred to draw the moon first, and the sun next, in order to mime a
|
||||
// solar eclipse. This is yet untested though...
|
||||
|
||||
earthsMoon->newImage();
|
||||
// Step 2b: Add the sun
|
||||
sun_angle = l->sun_angle;
|
||||
x_2 = sun_angle * sun_angle;
|
||||
x_4 = x_2 * x_2;
|
||||
x_8 = x_4 * x_4;
|
||||
x_10 = x_8 * x_2;
|
||||
ambient = (0.4 * pow (1.1, - x_10 / 30.0));
|
||||
if (ambient < 0.3) ambient = 0.3;
|
||||
if (ambient > 1.0) ambient = 1.0;
|
||||
|
||||
amb[0] = ((ambient * 6.0) - 1.0); // minimum value = 0.8
|
||||
amb[1] = ((ambient * 11.0) - 3.0); // minimum value = 0.3
|
||||
amb[2] = ((ambient * 12.0) - 3.6); // minimum value = 0.0
|
||||
amb[3] = 1.00;
|
||||
|
||||
if (amb[0] > 1.0) amb[0] = 1.0;
|
||||
if (amb[1] > 1.0) amb[1] = 1.0;
|
||||
if (amb[2] > 1.0) amb[2] = 1.0;
|
||||
|
||||
sun_angle = l->sun_angle * RAD_TO_DEG;
|
||||
if ( sun_angle < 100 ) {
|
||||
ourSun->getPos(&ra, &dec);
|
||||
double cos_dec = cos(dec) * 60000.0;
|
||||
x = cos(ra) * cos_dec;
|
||||
y = sin(ra) * cos_dec;
|
||||
z = sin(dec) * 60000.0;
|
||||
xglPushMatrix();
|
||||
{
|
||||
double sun_size = 1400.0;
|
||||
xglTranslatef(x,y,z);
|
||||
xglColor3fv(amb);
|
||||
glutSolidSphere(sun_size, 10, 10);
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
} else {
|
||||
// sun angle > 100, no need to draw sun
|
||||
}
|
||||
//xglPushMatrix();
|
||||
//{
|
||||
ourSun->newImage();
|
||||
//}
|
||||
//xglPopMatrix();
|
||||
// Step 2c: Add the planets
|
||||
xglBegin(GL_POINTS);
|
||||
mercury->getPos(&ra, &dec, &magnitude);addPlanetToList(ra, dec, magnitude);
|
||||
|
|
|
@ -62,21 +62,26 @@ private:
|
|||
|
||||
public:
|
||||
SolarSystem(fgTIME *t);
|
||||
Star *getSun();
|
||||
CelestialBody *getSun();
|
||||
CelestialBody *getMoon();
|
||||
~SolarSystem();
|
||||
|
||||
static SolarSystem *theSolarSystem; // thanks to Bernie Bright!
|
||||
void rebuild();
|
||||
friend void solarSystemRebuild();
|
||||
void draw();
|
||||
|
||||
};
|
||||
|
||||
inline Star * SolarSystem::getSun()
|
||||
inline CelestialBody* SolarSystem::getSun()
|
||||
{
|
||||
return ourSun;
|
||||
}
|
||||
|
||||
inline CelestialBody* SolarSystem::getMoon()
|
||||
{
|
||||
return earthsMoon;
|
||||
}
|
||||
|
||||
inline void SolarSystem::draw()
|
||||
{
|
||||
xglCallList(displayList);
|
||||
|
|
186
Astro/star.cxx
186
Astro/star.cxx
|
@ -27,7 +27,9 @@
|
|||
# define exception c_exception
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
#include <Time/sunpos.hxx>
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <Time/light.hxx>
|
||||
#include "star.hxx"
|
||||
|
||||
/*************************************************************************
|
||||
|
@ -47,6 +49,100 @@ Star::Star(fgTIME *t) :
|
|||
0.016709, -1.151E-9,
|
||||
356.0470, 0.98560025850, t)
|
||||
{
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, "Initializing Sun Texture");
|
||||
#ifdef GL_VERSION_1_1
|
||||
xglGenTextures(1, &sun_texid);
|
||||
xglBindTexture(GL_TEXTURE_2D, sun_texid);
|
||||
#elif GL_EXT_texture_object
|
||||
xglGenTexturesEXT(1, &sun_texid);
|
||||
xglBindTextureEXT(GL_TEXTURE_2D, sun_texid);
|
||||
#else
|
||||
# error port me
|
||||
#endif
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
setTexture();
|
||||
glTexImage2D( GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
256, 256,
|
||||
0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
sun_texbuf);
|
||||
|
||||
SunObject = gluNewQuadric();
|
||||
if(SunObject == NULL)
|
||||
{
|
||||
printf("gluNewQuadric(SunObject) failed !\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//SunList = 0;
|
||||
distance = 0.0;
|
||||
}
|
||||
|
||||
Star::~Star()
|
||||
{
|
||||
//delete SunObject;
|
||||
delete [] sun_texbuf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int texWidth = 256; /* 64x64 is plenty */
|
||||
|
||||
void Star::setTexture()
|
||||
{
|
||||
int texSize;
|
||||
//void *textureBuf;
|
||||
GLubyte *p;
|
||||
int i,j;
|
||||
double radius;
|
||||
|
||||
texSize = texWidth*texWidth;
|
||||
|
||||
sun_texbuf = new GLubyte[texSize*4];
|
||||
if (!sun_texbuf)
|
||||
return; // Ugly!
|
||||
|
||||
p = sun_texbuf;
|
||||
|
||||
radius = (double)(texWidth / 2);
|
||||
|
||||
for (i=0; i < texWidth; i++) {
|
||||
for (j=0; j < texWidth; j++) {
|
||||
double x, y, d;
|
||||
|
||||
x = fabs((double)(i - (texWidth / 2)));
|
||||
y = fabs((double)(j - (texWidth / 2)));
|
||||
|
||||
d = sqrt((x * x) + (y * y));
|
||||
if (d < radius)
|
||||
{
|
||||
double t = 1.0 - (d / radius); // t is 1.0 at center, 0.0 at edge */
|
||||
// inverse square looks nice
|
||||
*p = (int)((double)0xff * (t * t));
|
||||
*(p+1) = (int)((double) 0xff * (t*t));
|
||||
*(p+2) = (int)((double) 0xff * (t*t));
|
||||
*(p+3) = (int)((double) 0xff * (t*t));
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = 0x00;
|
||||
*(p+1) = 0x00;
|
||||
*(p+2) = 0x00;
|
||||
*(p+3) = 0x00;
|
||||
}
|
||||
p += 4;
|
||||
}
|
||||
}
|
||||
//gluBuild2DMipmaps(GL_TEXTURE_2D, 1, texWidth, texWidth,
|
||||
// GL_LUMINANCE,
|
||||
// GL_UNSIGNED_BYTE, textureBuf);
|
||||
//free(textureBuf);
|
||||
}
|
||||
/*************************************************************************
|
||||
* void Jupiter::updatePosition(fgTIME *t, Star *ourSun)
|
||||
|
@ -71,12 +167,13 @@ void Star::updatePosition(fgTIME *t)
|
|||
v = atan2 (yv, xv); // the sun's true anomaly
|
||||
distance = r = sqrt (xv*xv + yv*yv); // and its distance
|
||||
|
||||
longitude = v + w; // the sun's true longitude
|
||||
|
||||
lonEcl = v + w; // the sun's true longitude
|
||||
latEcl = 0;
|
||||
|
||||
// convert the sun's true longitude to ecliptic rectangular
|
||||
// geocentric coordinates (xs, ys)
|
||||
xs = r * cos (longitude);
|
||||
ys = r * sin (longitude);
|
||||
xs = r * cos (lonEcl);
|
||||
ys = r * sin (lonEcl);
|
||||
|
||||
// convert ecliptic coordinates to equatorial rectangular
|
||||
// geocentric coordinates
|
||||
|
@ -90,6 +187,85 @@ void Star::updatePosition(fgTIME *t)
|
|||
declination = atan2 (ze, sqrt (xe*xe + ye*ye));
|
||||
}
|
||||
|
||||
void Star::newImage(void)
|
||||
{
|
||||
/*static float stars[3];
|
||||
stars[0] = 0.0;
|
||||
stars[1] = 0.0;
|
||||
stars[2] = 1.0;*/
|
||||
|
||||
fgLIGHT *l = &cur_light_params;
|
||||
float sun_angle = l->sun_angle;
|
||||
|
||||
if( sun_angle*RAD_TO_DEG < 100 ) { // else no need to draw sun
|
||||
|
||||
|
||||
double x_2, x_4, x_8, x_10;
|
||||
GLfloat ambient;
|
||||
GLfloat amb[4];
|
||||
int sun_size = 750;
|
||||
|
||||
// daily variation sun gets larger near horizon
|
||||
/*if(sun_angle*RAD_TO_DEG > 84.0 && sun_angle*RAD_TO_DEG < 95)
|
||||
{
|
||||
double sun_grow = 9*fabs(94-sun_angle*RAD_TO_DEG);
|
||||
sun_size = (int)(sun_size + sun_size * cos(sun_grow*DEG_TO_RAD));
|
||||
}*/
|
||||
x_2 = sun_angle * sun_angle;
|
||||
x_4 = x_2 * x_2;
|
||||
x_8 = x_4 * x_4;
|
||||
x_10 = x_8 * x_2;
|
||||
ambient = (float)(0.4 * pow (1.1, - x_10 / 30.0));
|
||||
if (ambient < 0.3) ambient = 0.3;
|
||||
if (ambient > 1.0) ambient = 1.0;
|
||||
|
||||
amb[0] = ((ambient * 6.0) - 1.0); // minimum value = 0.8
|
||||
amb[1] = ((ambient * 11.0) - 3.0); // minimum value = 0.3
|
||||
amb[2] = ((ambient * 12.0) - 3.6); // minimum value = 0.0
|
||||
amb[3] = 1.00;
|
||||
|
||||
if (amb[0] > 1.0) amb[0] = 1.0;
|
||||
if (amb[1] > 1.0) amb[1] = 1.0;
|
||||
if (amb[2] > 1.0) amb[2] = 1.0;
|
||||
xglColor3fv(amb);
|
||||
glPushMatrix();
|
||||
{
|
||||
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);
|
||||
|
||||
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();
|
||||
}
|
||||
glPopMatrix();
|
||||
xglDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_BLEND);
|
||||
glPushMatrix();
|
||||
{
|
||||
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,58600,0);
|
||||
gluSphere( SunObject, sun_size, 10, 10 );
|
||||
}
|
||||
glPopMatrix();
|
||||
glDisable(GL_TEXTURE_2D); // TEXTURE DISABLED
|
||||
glDisable(GL_BLEND); // BLEND DISABLED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -32,19 +32,26 @@
|
|||
class Star : public CelestialBody
|
||||
{
|
||||
private:
|
||||
double longitude; // the sun's true longitude
|
||||
//double longitude; // the sun's true longitude - this is depreciated by
|
||||
// CelestialBody::lonEcl
|
||||
double xs, ys; // the sun's rectangular geocentric coordinates
|
||||
double distance; // the sun's distance to the earth
|
||||
|
||||
GLUquadricObj *SunObject;
|
||||
GLuint sun_texid;
|
||||
GLubyte *sun_texbuf;
|
||||
|
||||
void setTexture();
|
||||
public:
|
||||
Star (fgTIME *t);
|
||||
~Star();
|
||||
void updatePosition(fgTIME *t);
|
||||
double getM();
|
||||
double getw();
|
||||
double getLon();
|
||||
//double getLon();
|
||||
double getxs();
|
||||
double getys();
|
||||
double getDistance();
|
||||
void newImage();
|
||||
};
|
||||
|
||||
|
||||
|
@ -59,11 +66,6 @@ inline double Star::getw()
|
|||
return w;
|
||||
}
|
||||
|
||||
inline double Star::getLon()
|
||||
{
|
||||
return longitude;
|
||||
}
|
||||
|
||||
inline double Star::getxs()
|
||||
{
|
||||
return xs;
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include <Time/fg_time.hxx>
|
||||
#include <Time/light.hxx>
|
||||
#include <Time/sunpos.hxx>
|
||||
#include <Time/moonpos.hxx>
|
||||
#include <Weather/weather.hxx>
|
||||
|
||||
#include "fg_init.hxx"
|
||||
|
@ -341,8 +342,11 @@ int fgInitSubsystems( void )
|
|||
// so it can calculate local relative sun angle and a few other
|
||||
// things for correctly orienting the sky.
|
||||
fgUpdateSunPos();
|
||||
fgUpdateMoonPos();
|
||||
global_events.Register( "fgUpdateSunPos()", fgUpdateSunPos,
|
||||
fgEVENT::FG_EVENT_READY, 60000);
|
||||
global_events.Register( "fgUpdateMoonPos()", fgUpdateMoonPos,
|
||||
fgEVENT::FG_EVENT_READY, 60000);
|
||||
|
||||
// Initialize Lighting interpolation tables
|
||||
l->Init();
|
||||
|
@ -408,6 +412,17 @@ int fgInitSubsystems( void )
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.71 1999/03/22 02:08:13 curt
|
||||
// Changes contributed by Durk Talsma:
|
||||
//
|
||||
// Here's a few changes I made to fg-0.58 this weekend. Included are the
|
||||
// following features:
|
||||
// - Sun and moon have a halo
|
||||
// - The moon has a light vector, moon_angle, etc. etc. so that we can have
|
||||
// some moonlight during the night.
|
||||
// - Lot's of small changes tweakes, including some stuff Norman Vine sent
|
||||
// me earlier.
|
||||
//
|
||||
// Revision 1.70 1999/03/11 23:09:49 curt
|
||||
// When "Help" is selected from the menu check to see if netscape is running.
|
||||
// If so, command it to go to the flight gear user guide url. Otherwise
|
||||
|
|
|
@ -106,6 +106,13 @@ public:
|
|||
// surface direction to go to head towards sun
|
||||
MAT3vec surface_to_sun;
|
||||
|
||||
// vector in cartesian coordinates from current position to the
|
||||
// postion on the earth's surface the moon is directly over
|
||||
MAT3vec to_moon;
|
||||
|
||||
// surface direction to go to head towards moon
|
||||
MAT3vec surface_to_moon;
|
||||
|
||||
// surface vector heading south
|
||||
MAT3vec surface_south;
|
||||
|
||||
|
@ -217,6 +224,18 @@ public:
|
|||
surface_to_sun[1] = y;
|
||||
surface_to_sun[2] = z;
|
||||
}
|
||||
inline double *get_to_moon() { return to_moon; }
|
||||
inline void set_to_moon( double x, double y, double z) {
|
||||
to_moon[0] = x;
|
||||
to_moon[1] = y;
|
||||
to_moon[2] = z;
|
||||
}
|
||||
inline double *get_surface_to_moon() { return surface_to_moon; }
|
||||
inline void set_surface_to_moon( double x, double y, double z) {
|
||||
surface_to_moon[0] = x;
|
||||
surface_to_moon[1] = y;
|
||||
surface_to_moon[2] = z;
|
||||
}
|
||||
inline double *get_surface_south() { return surface_south; }
|
||||
inline double *get_surface_east() { return surface_east; }
|
||||
inline double *get_local_up() { return local_up; }
|
||||
|
@ -232,6 +251,17 @@ extern FGView current_view;
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.22 1999/03/22 02:08:15 curt
|
||||
// Changes contributed by Durk Talsma:
|
||||
//
|
||||
// Here's a few changes I made to fg-0.58 this weekend. Included are the
|
||||
// following features:
|
||||
// - Sun and moon have a halo
|
||||
// - The moon has a light vector, moon_angle, etc. etc. so that we can have
|
||||
// some moonlight during the night.
|
||||
// - Lot's of small changes tweakes, including some stuff Norman Vine sent
|
||||
// me earlier.
|
||||
//
|
||||
// Revision 1.21 1999/02/05 21:29:15 curt
|
||||
// Modifications to incorporate Jon S. Berndts flight model code.
|
||||
//
|
||||
|
|
|
@ -13,6 +13,7 @@ libTime_a_SOURCES = \
|
|||
fg_time.cxx fg_time.hxx \
|
||||
fg_timer.cxx fg_timer.hxx \
|
||||
light.cxx light.hxx \
|
||||
moonpos.cxx moonpos.hxx \
|
||||
sunpos.cxx sunpos.hxx \
|
||||
timestamp.hxx
|
||||
|
||||
|
|
|
@ -80,6 +80,34 @@ public:
|
|||
// wanted to travel towards the sun.
|
||||
double sun_rotation;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Have the same for the moon. Useful for having some light at night
|
||||
// and stuff. I (Durk) also want to use this for adding similar
|
||||
// coloring effects to the moon as I did to the sun.
|
||||
///////////////////////////////////////////////////////////
|
||||
// position of the moon in various forms
|
||||
|
||||
// in geocentric coordinates
|
||||
double moon_lon, moon_gc_lat;
|
||||
|
||||
// in cartesian coordiantes
|
||||
Point3D fg_moonpos;
|
||||
|
||||
// (in view coordinates)
|
||||
GLfloat moon_vec[4];
|
||||
|
||||
// inverse (in view coordinates)
|
||||
GLfloat moon_vec_inv[4];
|
||||
|
||||
// the angle between the moon and the local horizontal (in radians)
|
||||
double moon_angle;
|
||||
|
||||
// the rotation around our vertical axis of the moon (relative to
|
||||
// due south with positive numbers going in the counter clockwise
|
||||
// direction.) This is the direction we'd need to face if we
|
||||
// wanted to travel towards the sun.
|
||||
double moon_rotation;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Derived lighting values
|
||||
|
||||
|
@ -123,6 +151,17 @@ extern fgLIGHT cur_light_params;
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.9 1999/03/22 02:08:17 curt
|
||||
// Changes contributed by Durk Talsma:
|
||||
//
|
||||
// Here's a few changes I made to fg-0.58 this weekend. Included are the
|
||||
// following features:
|
||||
// - Sun and moon have a halo
|
||||
// - The moon has a light vector, moon_angle, etc. etc. so that we can have
|
||||
// some moonlight during the night.
|
||||
// - Lot's of small changes tweakes, including some stuff Norman Vine sent
|
||||
// me earlier.
|
||||
//
|
||||
// Revision 1.8 1998/10/16 00:56:10 curt
|
||||
// Converted to Point3D class.
|
||||
//
|
||||
|
|
107
Time/sunpos.cxx
107
Time/sunpos.cxx
|
@ -68,105 +68,12 @@
|
|||
extern SolarSystem *solarSystem;
|
||||
|
||||
#undef E
|
||||
|
||||
|
||||
/*
|
||||
* the epoch upon which these astronomical calculations are based is
|
||||
* 1990 january 0.0, 631065600 seconds since the beginning of the
|
||||
* "unix epoch" (00:00:00 GMT, Jan. 1, 1970)
|
||||
*
|
||||
* given a number of seconds since the start of the unix epoch,
|
||||
* DaysSinceEpoch() computes the number of days since the start of the
|
||||
* astronomical epoch (1990 january 0.0)
|
||||
*/
|
||||
|
||||
#define EpochStart (631065600)
|
||||
#define DaysSinceEpoch(secs) (((secs)-EpochStart)*(1.0/(24*3600)))
|
||||
|
||||
/*
|
||||
* assuming the apparent orbit of the sun about the earth is circular,
|
||||
* the rate at which the orbit progresses is given by RadsPerDay --
|
||||
* FG_2PI radians per orbit divided by 365.242191 days per year:
|
||||
*/
|
||||
|
||||
#define RadsPerDay (FG_2PI/365.242191)
|
||||
|
||||
/*
|
||||
* details of sun's apparent orbit at epoch 1990.0 (after
|
||||
* duffett-smith, table 6, section 46)
|
||||
*
|
||||
* Epsilon_g (ecliptic longitude at epoch 1990.0) 279.403303 degrees
|
||||
* OmegaBar_g (ecliptic longitude of perigee) 282.768422 degrees
|
||||
* Eccentricity (eccentricity of orbit) 0.016713
|
||||
*/
|
||||
|
||||
#define Epsilon_g (279.403303*(FG_2PI/360))
|
||||
#define OmegaBar_g (282.768422*(FG_2PI/360))
|
||||
#define Eccentricity (0.016713)
|
||||
|
||||
/*
|
||||
* MeanObliquity gives the mean obliquity of the earth's axis at epoch
|
||||
* 1990.0 (computed as 23.440592 degrees according to the method given
|
||||
* in duffett-smith, section 27)
|
||||
*/
|
||||
#define MeanObliquity (23.440592*(FG_2PI/360))
|
||||
|
||||
/* static double solve_keplers_equation(double); */
|
||||
/* static double sun_ecliptic_longitude(time_t); */
|
||||
static void ecliptic_to_equatorial(double, double, double *, double *);
|
||||
static double julian_date(int, int, int);
|
||||
static double GST(time_t);
|
||||
|
||||
/*
|
||||
* solve Kepler's equation via Newton's method
|
||||
* (after duffett-smith, section 47)
|
||||
*/
|
||||
/*
|
||||
static double solve_keplers_equation(double M) {
|
||||
double E;
|
||||
double delta;
|
||||
|
||||
E = M;
|
||||
while (1) {
|
||||
delta = E - Eccentricity*sin(E) - M;
|
||||
if (fabs(delta) <= 1e-10) break;
|
||||
E -= delta / (1 - Eccentricity*cos(E));
|
||||
}
|
||||
|
||||
return E;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* compute ecliptic longitude of sun (in radians) (after
|
||||
* duffett-smith, section 47) */
|
||||
/*
|
||||
static double sun_ecliptic_longitude(time_t ssue) {
|
||||
// time_t ssue; // seconds since unix epoch
|
||||
double D, N;
|
||||
double M_sun, E;
|
||||
double v;
|
||||
|
||||
D = DaysSinceEpoch(ssue);
|
||||
|
||||
N = RadsPerDay * D;
|
||||
N = fmod(N, FG_2PI);
|
||||
if (N < 0) N += FG_2PI;
|
||||
|
||||
M_sun = N + Epsilon_g - OmegaBar_g;
|
||||
if (M_sun < 0) M_sun += FG_2PI;
|
||||
|
||||
E = solve_keplers_equation(M_sun);
|
||||
v = 2 * atan(sqrt((1+Eccentricity)/(1-Eccentricity)) * tan(E/2));
|
||||
|
||||
return (v + OmegaBar_g);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* convert from ecliptic to equatorial coordinates (after
|
||||
* duffett-smith, section 27) */
|
||||
|
||||
static void ecliptic_to_equatorial(double lambda, double beta,
|
||||
double *alpha, double *delta) {
|
||||
/* double lambda; ecliptic longitude */
|
||||
|
@ -315,7 +222,8 @@ static void fgSunPositionGST(double gst, double *lon, double *lat) {
|
|||
/* ecliptic_to_equatorial(lambda, 0.0, &alpha, &delta); */
|
||||
//ecliptic_to_equatorial (solarPosition.lonSun, 0.0, &alpha, &delta);
|
||||
ecliptic_to_equatorial( SolarSystem::theSolarSystem->getSun()->getLon(),
|
||||
0.0, &alpha, &delta );
|
||||
SolarSystem::theSolarSystem->getSun()->getLat(),
|
||||
&alpha, &delta );
|
||||
|
||||
// tmp = alpha - (FG_2PI/24)*GST(ssue);
|
||||
tmp = alpha - (FG_2PI/24)*gst;
|
||||
|
@ -434,6 +342,17 @@ void fgUpdateSunPos( void ) {
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.21 1999/03/22 02:08:18 curt
|
||||
// Changes contributed by Durk Talsma:
|
||||
//
|
||||
// Here's a few changes I made to fg-0.58 this weekend. Included are the
|
||||
// following features:
|
||||
// - Sun and moon have a halo
|
||||
// - The moon has a light vector, moon_angle, etc. etc. so that we can have
|
||||
// some moonlight during the night.
|
||||
// - Lot's of small changes tweakes, including some stuff Norman Vine sent
|
||||
// me earlier.
|
||||
//
|
||||
// Revision 1.20 1999/02/26 22:10:11 curt
|
||||
// Added initial support for native SGI compilers.
|
||||
//
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
/* update the cur_time_params structure with the current sun position */
|
||||
void fgUpdateSunPos( void );
|
||||
|
||||
/* update the cur_time_params structure with the current moon position */
|
||||
void fgUpdateMoonPos( void );
|
||||
|
||||
void fgSunPosition(time_t ssue, double *lon, double *lat);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue