StelSkyDrawer.cpp   StelSkyDrawer.cpp 
skipping to change at line 54 skipping to change at line 54
#include <QStringList> #include <QStringList>
#include <QSettings> #include <QSettings>
#include <QDebug> #include <QDebug>
#include <QtGlobal> #include <QtGlobal>
// The 0.025 corresponds to the maximum eye resolution in degree // The 0.025 corresponds to the maximum eye resolution in degree
#define EYE_RESOLUTION (0.25f) #define EYE_RESOLUTION (0.25f)
#define MAX_LINEAR_RADIUS 8.f #define MAX_LINEAR_RADIUS 8.f
StelSkyDrawer::StelSkyDrawer(StelCore* acore) : core(acore), flagHasAtmosph ere(true), starsShaderProgram(NULL) StelSkyDrawer::StelSkyDrawer(StelCore* acore) : core(acore), starsShaderPro gram(NULL)
{ {
eye = core->getToneReproducer(); eye = core->getToneReproducer();
inScale = 1.f; inScale = 1.f;
bortleScaleIndex = 3; bortleScaleIndex = 3;
limitMagnitude = -100.f; limitMagnitude = -100.f;
limitLuminance = 0; limitLuminance = 0;
oldLum=-1.f; oldLum=-1.f;
maxLum = 0.f; maxLum = 0.f;
setMaxAdaptFov(180.f); setMaxAdaptFov(180.f);
skipping to change at line 76 skipping to change at line 76
starAbsoluteScaleF = 1.f; starAbsoluteScaleF = 1.f;
starRelativeScale = 1.f; starRelativeScale = 1.f;
starLinearScale = 19.569f; starLinearScale = 19.569f;
big3dModelHaloRadius = 150.f; big3dModelHaloRadius = 150.f;
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
initColorTableFromConfigFile(conf); initColorTableFromConfigFile(conf);
setFlagHasAtmosphere(conf->value("landscape/flag_atmosphere", true). toBool());
setTwinkleAmount(conf->value("stars/star_twinkle_amount",0.3).toFloa t()); setTwinkleAmount(conf->value("stars/star_twinkle_amount",0.3).toFloa t());
setFlagTwinkle(conf->value("stars/flag_star_twinkle",true).toBool()) ; setFlagTwinkle(conf->value("stars/flag_star_twinkle",true).toBool()) ;
setFlagPointStar(conf->value("stars/flag_point_star",false).toBool() ); setFlagPointStar(conf->value("stars/flag_point_star",false).toBool() );
setMaxAdaptFov(conf->value("stars/mag_converter_max_fov",70.0).toFlo at()); setMaxAdaptFov(conf->value("stars/mag_converter_max_fov",70.0).toFlo at());
setMinAdaptFov(conf->value("stars/mag_converter_min_fov",0.1).toFloa t()); setMinAdaptFov(conf->value("stars/mag_converter_min_fov",0.1).toFloa t());
setFlagLuminanceAdaptation(conf->value("viewing/use_luminance_adapta tion",true).toBool()); setFlagLuminanceAdaptation(conf->value("viewing/use_luminance_adapta tion",true).toBool());
bool ok=true; bool ok=true;
setBortleScale(conf->value("stars/init_bortle_scale",3).toInt(&ok)); setBortleScale(conf->value("stars/init_bortle_scale",3).toInt(&ok));
skipping to change at line 429 skipping to change at line 430
} }
} }
// Finalize the drawing of point sources // Finalize the drawing of point sources
void StelSkyDrawer::postDrawPointSource(StelPainter* sPainter) void StelSkyDrawer::postDrawPointSource(StelPainter* sPainter)
{ {
Q_ASSERT(sPainter); Q_ASSERT(sPainter);
if (nbPointSources==0) if (nbPointSources==0)
return; return;
texHalo->bind(); texHalo->bind();
sPainter->enableTexture2d(true); sPainter->enableTexture2d(true);
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_BLEND); glEnable(GL_BLEND);
if (useShader) if (useShader)
{ {
Q_ASSERT(starsShaderProgram); Q_ASSERT(starsShaderProgram);
#ifndef USE_OPENGL_ES2 #ifndef USE_OPENGL_ES2
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
skipping to change at line 487 skipping to change at line 487
glDrawArrays(GL_TRIANGLES, 0, nbPointSources*6); glDrawArrays(GL_TRIANGLES, 0, nbPointSources*6);
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
#endif #endif
} }
nbPointSources = 0; nbPointSources = 0;
} }
static Vec3f win; static Vec3d win;
// Draw a point source halo. // Draw a point source halo.
bool StelSkyDrawer::drawPointSource(StelPainter* sPainter, const Vec3f& v, const float rcMag[2], const Vec3f& color, bool checkInScreen) bool StelSkyDrawer::drawPointSource(StelPainter* sPainter, const Vec3d& v, const float rcMag[2], const Vec3f& color, bool checkInScreen)
{ {
Q_ASSERT(sPainter); Q_ASSERT(sPainter);
if (rcMag[0]<=0.f) if (rcMag[0]<=0.f)
return false; return false;
// TODO: compute Vec3f v_refr (position including refraction) --> NO : This is done in ZoneArray! // TODO: compute Vec3f v_refr (position including refraction) --> NO : This is done in ZoneArray!
if (!(checkInScreen ? sPainter->getProjector()->projectCheck(v, win) : sPainter->getProjector()->project(v, win))) if (!(checkInScreen ? sPainter->getProjector()->projectCheck(v, win) : sPainter->getProjector()->project(v, win)))
return false; return false;
skipping to change at line 550 skipping to change at line 550
{ {
// Store the drawing instructions in the vertex arra ys // Store the drawing instructions in the vertex arra ys
Vec2f* v = &(verticesGrid[nbPointSources*6]); Vec2f* v = &(verticesGrid[nbPointSources*6]);
v->set(win[0]-radius,win[1]-radius); ++v; v->set(win[0]-radius,win[1]-radius); ++v;
v->set(win[0]+radius,win[1]-radius); ++v; v->set(win[0]+radius,win[1]-radius); ++v;
v->set(win[0]+radius,win[1]+radius); ++v; v->set(win[0]+radius,win[1]+radius); ++v;
v->set(win[0]-radius,win[1]-radius); ++v; v->set(win[0]-radius,win[1]-radius); ++v;
v->set(win[0]+radius,win[1]+radius); ++v; v->set(win[0]+radius,win[1]+radius); ++v;
v->set(win[0]-radius,win[1]+radius); ++v; v->set(win[0]-radius,win[1]+radius); ++v;
win = color; Vec3f w = color;
win*=tw; w = color;
w*=tw;
Vec3f* cv = &(colorGrid[nbPointSources*6]); Vec3f* cv = &(colorGrid[nbPointSources*6]);
*cv = win; ++cv; *cv = w; ++cv;
*cv = win; ++cv; *cv = w; ++cv;
*cv = win; ++cv; *cv = w; ++cv;
*cv = win; ++cv; *cv = w; ++cv;
*cv = win; ++cv; *cv = w; ++cv;
*cv = win; ++cv; *cv = w; ++cv;
win = Vec3d(w[0],w[1],w[2]);
} }
} }
#endif #endif
++nbPointSources; ++nbPointSources;
if (nbPointSources>=maxPointSources) if (nbPointSources>=maxPointSources)
{ {
// Flush the buffer (draw all buffered stars) // Flush the buffer (draw all buffered stars)
postDrawPointSource(sPainter); postDrawPointSource(sPainter);
} }
return true; return true;
} }
// Terminate drawing of a 3D model, draw the halo // Terminate drawing of a 3D model, draw the halo
void StelSkyDrawer::postDrawSky3dModel(StelPainter* painter, const Vec3f& v , float illuminatedArea, float mag, const Vec3f& color) void StelSkyDrawer::postDrawSky3dModel(StelPainter* painter, const Vec3d& v , float illuminatedArea, float mag, const Vec3f& color)
{ {
const float pixPerRad = painter->getProjector()->getPixelPerRadAtCen ter(); const float pixPerRad = painter->getProjector()->getPixelPerRadAtCen ter();
// Assume a disk shape // Assume a disk shape
float pixRadius = std::sqrt(illuminatedArea/(60.*60.)*M_PI/180.*M_PI /180.*(pixPerRad*pixPerRad))/M_PI; float pixRadius = std::sqrt(illuminatedArea/(60.*60.)*M_PI/180.*M_PI /180.*(pixPerRad*pixPerRad))/M_PI;
bool noStarHalo = false; bool noStarHalo = false;
if (mag<-15.f) if (mag<-15.f)
{ {
// Sun, halo size varies in function of the magnitude becaus e sun as seen from pluto should look dimmer // Sun, halo size varies in function of the magnitude becaus e sun as seen from pluto should look dimmer
 End of changes. 8 change blocks. 
13 lines changed or deleted 15 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/