#include "moon.hxx"
+
/*************************************************************************
* Moon::Moon(FGTime *t)
* Public constructor for class Moon. Initializes the orbital elements and
0.054900, 0.000000,
115.3654, 13.0649929509, t)
{
+#if 0
int width, height;
FG_LOG( FG_GENERAL, FG_INFO, "Initializing Moon Texture");
GL_RGBA, GL_UNSIGNED_BYTE,
moon_halotexbuf);
moonObject = gluNewQuadric();
+#endif
}
+Moon::Moon() :
+ CelestialBody(125.1228, -0.0529538083,
+ 5.1454, 0.00000,
+ 318.0634, 0.1643573223,
+ 60.266600, 0.000000,
+ 0.054900, 0.000000,
+ 115.3654, 13.0649929509)
+{
+}
+
+
Moon::~Moon()
{
- //delete moonObject;
- delete moon_texbuf;
- delete moon_halotexbuf;
+ //delete moonObject;
+ // delete moon_texbuf;
+ // delete moon_halotexbuf;
}
+#if 0
static int texWidth = 256; /* 64x64 is plenty */
void Moon::setHalo()
// GL_UNSIGNED_BYTE, textureBuf);
//free(textureBuf);
}
+#endif
/*****************************************************************************
r += (-0.58 * cos(M - 2*D)
-0.46 * cos(2*D)
);
- FG_LOG(FG_GENERAL, FG_INFO, "Running moon update");
+ // 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);
}
+#if 0
/************************************************************************
* void Moon::newImage()
*
{
}
}
+#endif
* $Id$
**************************************************************************/
+
#ifdef __BORLANDC__
# define exception c_exception
#endif
#include "star.hxx"
+
/*************************************************************************
* Star::Star(FGTime *t)
* Public constructor for class Star
Star::~Star()
{
-#if 0
- //delete SunObject;
- delete [] sun_texbuf;
-#endif
-}
-
-
-
-#if 0
-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;
-
- *p = 0xff;
- *(p+1) = 0xff;
- *(p+2) = 0xff;
-
- 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+3) = (int)((double) 0xff * (t*t));
- } else {
- *(p+3) = 0x00;
- }
- p += 4;
- }
- }
- //gluBuild2DMipmaps(GL_TEXTURE_2D, 1, texWidth, texWidth,
- // GL_LUMINANCE,
- // GL_UNSIGNED_BYTE, textureBuf);
- //free(textureBuf);
}
-#endif
/*************************************************************************
- * void Jupiter::updatePosition(FGTime *t, Star *ourSun)
+ * void Star::updatePosition(FGTime *t, Star *ourSun)
*
* calculates the current position of our sun.
*************************************************************************/
rightAscension = atan2 (ye, xe);
declination = atan2 (ze, sqrt (xe*xe + ye*ye));
}
-
-
-#if 0
-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 = 550;
-
- // 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);
- if (current_options.get_textures())
- {
- glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED
- glEnable(GL_BLEND); // BLEND ENABLED
-
- // glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glBlendFunc ( GL_SRC_ALPHA, 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();
- }
- xglDisable(GL_TEXTURE_2D); // TEXTURE DISABLED
- xglDisable(GL_BLEND); // BLEND DISABLED
- }
-
- glPopMatrix();
- glDisable(GL_LIGHTING); // LIGHTING DISABLED
- glDisable(GL_BLEND); // BLEND DISABLED
- 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);
- xglColor4fv(amb);
- xglTranslatef(0,60000,0);
- gluSphere( SunObject, sun_size, 10, 10 );
- }
- glPopMatrix();
- glDisable(GL_TEXTURE_2D); // TEXTURE DISABLED
- glDisable(GL_BLEND); // BLEND DISABLED
- }
-}
-#endif