Compare commits
8 Commits
RELEASE_0_
...
PRE_0_7_2_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa17d9ac9a | ||
|
|
ffe1d9485e | ||
|
|
71abebe837 | ||
|
|
ca07b64af0 | ||
|
|
2fde2ce581 | ||
|
|
cb0da2ca5e | ||
|
|
c0422839b9 | ||
|
|
862b884f02 |
@@ -22,8 +22,6 @@
|
||||
* $Id$
|
||||
**************************************************************************/
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
#include <Debug/logstream.hxx>
|
||||
|
||||
#ifdef FG_MATH_EXCEPTION_CLASH
|
||||
@@ -31,6 +29,10 @@
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* void CelestialBody::updatePosition(fgTIME *t, Star *ourSun)
|
||||
*
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
* $Id$
|
||||
**************************************************************************/
|
||||
|
||||
#include <FDM/flight.hxx>
|
||||
|
||||
#include <string.h>
|
||||
#include "moon.hxx"
|
||||
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <Main/options.hxx>
|
||||
@@ -37,6 +35,9 @@
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
#include <FDM/flight.hxx>
|
||||
|
||||
#include "moon.hxx"
|
||||
|
||||
/*************************************************************************
|
||||
* Moon::Moon(FGTime *t)
|
||||
@@ -156,27 +157,22 @@ void Moon::setHalo()
|
||||
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)
|
||||
{
|
||||
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+3) = (int)((double) 0x20 * (t*t));
|
||||
} else {
|
||||
*(p+3) = 0x00;
|
||||
}
|
||||
p += 4;
|
||||
}
|
||||
}
|
||||
@@ -353,7 +349,8 @@ void Moon::newImage()
|
||||
// Draw the halo...
|
||||
if (current_options.get_textures())
|
||||
{
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
// glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
|
||||
glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glBindTexture(GL_TEXTURE_2D, moon_halotexid);
|
||||
|
||||
@@ -72,9 +72,9 @@ static float middle_vertex[12][3];
|
||||
static float outer_vertex[12][3];
|
||||
static float bottom_vertex[12][3];
|
||||
|
||||
static float inner_color[12][4];
|
||||
static float middle_color[12][4];
|
||||
static float outer_color[12][4];
|
||||
static GLubyte inner_color[12][4];
|
||||
static GLubyte middle_color[12][4];
|
||||
static GLubyte outer_color[12][4];
|
||||
|
||||
|
||||
// Calculate the sky structure vertices
|
||||
@@ -168,19 +168,21 @@ void fgSkyColorsInit( void ) {
|
||||
// printf("sky = %.2f fog = %.2f diff = %.2f\n",
|
||||
// l->sky_color[j], l->fog_color[j], diff);
|
||||
|
||||
inner_color[i][j] = l->sky_color[j] - diff * 0.3;
|
||||
middle_color[i][j] = l->sky_color[j] - diff * 0.9 + middle_amt[j];
|
||||
outer_color[i][j] = l->fog_color[j] + outer_amt[j];
|
||||
inner_color[i][j] = (GLubyte)((l->sky_color[j] - diff * 0.3) * 255);
|
||||
middle_color[i][j] = (GLubyte)((l->sky_color[j] - diff * 0.9
|
||||
+ middle_amt[j]) * 255);
|
||||
outer_color[i][j] = (GLubyte)((l->fog_color[j] + outer_amt[j])
|
||||
* 255);
|
||||
|
||||
if ( inner_color[i][j] > 1.00 ) { inner_color[i][j] = 1.00; }
|
||||
if ( inner_color[i][j] < 0.10 ) { inner_color[i][j] = 0.10; }
|
||||
if ( middle_color[i][j] > 1.00 ) { middle_color[i][j] = 1.00; }
|
||||
if ( middle_color[i][j] < 0.10 ) { middle_color[i][j] = 0.10; }
|
||||
if ( outer_color[i][j] > 1.00 ) { outer_color[i][j] = 1.00; }
|
||||
if ( outer_color[i][j] < 0.10 ) { outer_color[i][j] = 0.10; }
|
||||
if ( inner_color[i][j] > 255 ) { inner_color[i][j] = 255; }
|
||||
if ( inner_color[i][j] < 25 ) { inner_color[i][j] = 25; }
|
||||
if ( middle_color[i][j] > 255 ) { middle_color[i][j] = 255; }
|
||||
if ( middle_color[i][j] < 25 ) { middle_color[i][j] = 25; }
|
||||
if ( outer_color[i][j] > 255 ) { outer_color[i][j] = 255; }
|
||||
if ( outer_color[i][j] < 25 ) { outer_color[i][j] = 25; }
|
||||
}
|
||||
inner_color[i][3] = middle_color[i][3] = outer_color[i][3] =
|
||||
l->sky_color[3];
|
||||
(GLubyte)(l->sky_color[3] * 255);
|
||||
|
||||
for ( j = 0; j < 3; j++ ) {
|
||||
outer_amt[j] -= outer_diff[j];
|
||||
@@ -212,19 +214,21 @@ void fgSkyColorsInit( void ) {
|
||||
// printf("sky = %.2f fog = %.2f diff = %.2f\n",
|
||||
// l->sky_color[j], l->fog_color[j], diff);
|
||||
|
||||
inner_color[i][j] = l->sky_color[j] - diff * 0.3;
|
||||
middle_color[i][j] = l->sky_color[j] - diff * 0.9 + middle_amt[j];
|
||||
outer_color[i][j] = l->fog_color[j] + outer_amt[j];
|
||||
inner_color[i][j] = (GLubyte)((l->sky_color[j] - diff * 0.3) * 255);
|
||||
middle_color[i][j] = (GLubyte)((l->sky_color[j] - diff * 0.9
|
||||
+ middle_amt[j]) * 255);
|
||||
outer_color[i][j] = (GLubyte)((l->fog_color[j] + outer_amt[j])
|
||||
* 255);
|
||||
|
||||
if ( inner_color[i][j] > 1.00 ) { inner_color[i][j] = 1.00; }
|
||||
if ( inner_color[i][j] < 0.10 ) { inner_color[i][j] = 0.10; }
|
||||
if ( middle_color[i][j] > 1.00 ) { middle_color[i][j] = 1.00; }
|
||||
if ( middle_color[i][j] < 0.10 ) { middle_color[i][j] = 0.10; }
|
||||
if ( outer_color[i][j] > 1.00 ) { outer_color[i][j] = 1.00; }
|
||||
if ( outer_color[i][j] < 0.15 ) { outer_color[i][j] = 0.15; }
|
||||
if ( inner_color[i][j] > 255 ) { inner_color[i][j] = 255; }
|
||||
if ( inner_color[i][j] < 25 ) { inner_color[i][j] = 25; }
|
||||
if ( middle_color[i][j] > 255 ) { middle_color[i][j] = 255; }
|
||||
if ( middle_color[i][j] < 25 ) { middle_color[i][j] = 25; }
|
||||
if ( outer_color[i][j] > 255 ) { outer_color[i][j] = 255; }
|
||||
if ( outer_color[i][j] < 35 ) { outer_color[i][j] = 35; }
|
||||
}
|
||||
inner_color[i][3] = middle_color[i][3] = outer_color[i][3] =
|
||||
l->sky_color[3];
|
||||
(GLubyte)(l->sky_color[3] * 255);
|
||||
|
||||
for ( j = 0; j < 3; j++ ) {
|
||||
outer_amt[j] += outer_diff[j];
|
||||
@@ -261,9 +265,10 @@ void fgSkyInit( void ) {
|
||||
void fgSkyRender( void ) {
|
||||
FGInterface *f;
|
||||
fgLIGHT *l;
|
||||
float inner_color[4];
|
||||
float middle_color[4];
|
||||
float outer_color[4];
|
||||
GLubyte sky_color[4];
|
||||
GLubyte inner_color[4];
|
||||
GLubyte middle_color[4];
|
||||
GLubyte outer_color[4];
|
||||
double diff;
|
||||
int i;
|
||||
|
||||
@@ -279,11 +284,12 @@ void fgSkyRender( void ) {
|
||||
// printf("sky = %.2f fog = %.2f diff = %.2f\n",
|
||||
// l->sky_color[j], l->adj_fog_color[j], diff);
|
||||
|
||||
inner_color[i] = l->sky_color[i] - diff * 0.3;
|
||||
middle_color[i] = l->sky_color[i] - diff * 0.9;
|
||||
outer_color[i] = l->adj_fog_color[i];
|
||||
inner_color[i] = (GLubyte)((l->sky_color[i] - diff * 0.3) * 255);
|
||||
middle_color[i] = (GLubyte)((l->sky_color[i] - diff * 0.9) * 255);
|
||||
outer_color[i] = (GLubyte)(l->adj_fog_color[i] * 255);
|
||||
}
|
||||
inner_color[3] = middle_color[3] = outer_color[3] = l->adj_fog_color[3];
|
||||
inner_color[3] = middle_color[3] = outer_color[3] =
|
||||
(GLubyte)(l->adj_fog_color[3] * 255);
|
||||
|
||||
xglPushMatrix();
|
||||
|
||||
@@ -302,36 +308,39 @@ void fgSkyRender( void ) {
|
||||
|
||||
// Draw inner/center section of sky*/
|
||||
xglBegin( GL_TRIANGLE_FAN );
|
||||
for ( i = 0; i < 4; i++ ) {
|
||||
sky_color[i] = (GLubyte)(l->sky_color[i] * 255);
|
||||
}
|
||||
xglColor4fv(l->sky_color);
|
||||
xglVertex3f(0.0, 0.0, CENTER_ELEV);
|
||||
for ( i = 11; i >= 0; i-- ) {
|
||||
xglColor4fv( inner_color );
|
||||
xglColor4ubv( inner_color );
|
||||
xglVertex3fv( inner_vertex[i] );
|
||||
}
|
||||
xglColor4fv( inner_color );
|
||||
xglColor4ubv( inner_color );
|
||||
xglVertex3fv( inner_vertex[11] );
|
||||
xglEnd();
|
||||
|
||||
// Draw the middle ring
|
||||
xglBegin( GL_TRIANGLE_STRIP );
|
||||
for ( i = 0; i < 12; i++ ) {
|
||||
xglColor4fv( middle_color );
|
||||
xglColor4ubv( middle_color );
|
||||
// printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
||||
// middle_color[i][0], middle_color[i][1], middle_color[i][2],
|
||||
// middle_color[i][3]);
|
||||
// xglColor4f(1.0, 0.0, 0.0, 1.0);
|
||||
xglVertex3fv( middle_vertex[i] );
|
||||
xglColor4fv( inner_color );
|
||||
xglColor4ubv( inner_color );
|
||||
// printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i,
|
||||
// inner_color[i][0], inner_color[i][1], inner_color[i][2],
|
||||
// inner_color[i][3]);
|
||||
// xglColor4f(0.0, 0.0, 1.0, 1.0);
|
||||
xglVertex3fv( inner_vertex[i] );
|
||||
}
|
||||
xglColor4fv( middle_color );
|
||||
xglColor4ubv( middle_color );
|
||||
// xglColor4f(1.0, 0.0, 0.0, 1.0);
|
||||
xglVertex3fv( middle_vertex[0] );
|
||||
xglColor4fv( inner_color );
|
||||
xglColor4ubv( inner_color );
|
||||
// xglColor4f(0.0, 0.0, 1.0, 1.0);
|
||||
xglVertex3fv( inner_vertex[0] );
|
||||
xglEnd();
|
||||
@@ -339,20 +348,20 @@ void fgSkyRender( void ) {
|
||||
// Draw the outer ring
|
||||
xglBegin( GL_TRIANGLE_STRIP );
|
||||
for ( i = 0; i < 12; i++ ) {
|
||||
xglColor4fv( outer_color );
|
||||
xglColor4ubv( outer_color );
|
||||
xglVertex3fv( outer_vertex[i] );
|
||||
xglColor4fv( middle_color );
|
||||
xglColor4ubv( middle_color );
|
||||
xglVertex3fv( middle_vertex[i] );
|
||||
}
|
||||
xglColor4fv( outer_color );
|
||||
xglColor4ubv( outer_color );
|
||||
xglVertex3fv( outer_vertex[0] );
|
||||
xglColor4fv( middle_color );
|
||||
xglColor4ubv( middle_color );
|
||||
xglVertex3fv( middle_vertex[0] );
|
||||
xglEnd();
|
||||
|
||||
// Draw the bottom skirt
|
||||
xglBegin( GL_TRIANGLE_STRIP );
|
||||
xglColor4fv( outer_color );
|
||||
xglColor4ubv( outer_color );
|
||||
for ( i = 0; i < 12; i++ ) {
|
||||
xglVertex3fv( bottom_vertex[i] );
|
||||
xglVertex3fv( outer_vertex[i] );
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include <ssg.h> // plib include
|
||||
#include <plib/ssg.h> // plib include
|
||||
|
||||
|
||||
class fgSky : ssgLeaf
|
||||
|
||||
@@ -116,26 +116,21 @@ void Star::setTexture()
|
||||
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)
|
||||
{
|
||||
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;
|
||||
} else {
|
||||
*(p+3) = 0x00;
|
||||
}
|
||||
}
|
||||
p += 4;
|
||||
}
|
||||
}
|
||||
@@ -235,10 +230,11 @@ void Star::newImage(void)
|
||||
xglTranslatef(0,60000,0);
|
||||
if (current_options.get_textures())
|
||||
{
|
||||
glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED
|
||||
glEnable(GL_BLEND); // BLEND ENABLED
|
||||
glEnable(GL_TEXTURE_2D); // TEXTURE ENABLED
|
||||
glEnable(GL_BLEND); // BLEND ENABLED
|
||||
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
// 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);
|
||||
|
||||
@@ -254,8 +250,8 @@ void Star::newImage(void)
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glDisable(GL_LIGHTING); //LIGHTING DISABLED
|
||||
glDisable(GL_BLEND); //BLEND DISABLED
|
||||
glDisable(GL_LIGHTING); // LIGHTING DISABLED
|
||||
glDisable(GL_BLEND); // BLEND DISABLED
|
||||
glPushMatrix();
|
||||
{
|
||||
xglRotatef(((RAD_TO_DEG * rightAscension)- 90.0), 0.0, 0.0, 1.0);
|
||||
@@ -265,7 +261,7 @@ void Star::newImage(void)
|
||||
gluSphere( SunObject, sun_size, 10, 10 );
|
||||
}
|
||||
glPopMatrix();
|
||||
glDisable(GL_TEXTURE_2D); // TEXTURE DISABLED
|
||||
glDisable(GL_BLEND); // BLEND DISABLED
|
||||
glDisable(GL_TEXTURE_2D); // TEXTURE DISABLED
|
||||
glDisable(GL_BLEND); // BLEND DISABLED
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
#include "stars.hxx"
|
||||
|
||||
FG_USING_STD(getline);
|
||||
// FG_USING_STD(getline);
|
||||
|
||||
#define EpochStart (631065600)
|
||||
#define DaysSinceEpoch(secs) (((secs)-EpochStart)*(1.0/(24*3600)))
|
||||
|
||||
Reference in New Issue
Block a user