Atmosphere.cpp   Atmosphere.cpp 
skipping to change at line 205 skipping to change at line 205
// determine luminance falloff during solar eclipses // determine luminance falloff during solar eclipses
_sunPos.normalize(); _sunPos.normalize();
moonPos.normalize(); moonPos.normalize();
float separation_angle = std::acos(_sunPos.dot(moonPos)); // angle between them float separation_angle = std::acos(_sunPos.dot(moonPos)); // angle between them
// qDebug("touch at %f\tnow at %f (%f)\n", touch_angle, separation_a ngle, separation_angle/touch_angle); // qDebug("touch at %f\tnow at %f (%f)\n", touch_angle, separation_a ngle, separation_angle/touch_angle);
// bright stars should be visible at total eclipse // bright stars should be visible at total eclipse
// TODO: correct for atmospheric diffusion // TODO: correct for atmospheric diffusion
// TODO: use better coverage function (non-linear) // TODO: use better coverage function (non-linear)
// because of above issues, this algorithm darkens more quickly than reality // because of above issues, this algorithm darkens more quickly than reality
if (separation_angle < touch_angle) // Note: On Earth only, else moon would brighten other planets' atmo
spheres (LP:1673283)
if ((core->getCurrentLocation().planetName=="Earth") && (separation_
angle < touch_angle))
{ {
float dark_angle = moon_angular_size - sun_angular_size; float dark_angle = moon_angular_size - sun_angular_size;
float min = 0.0001f; // so bright stars show up at total ec lipse float min = 0.0001f; // so bright stars show up at total ec lipse
if (dark_angle < 0.f) if (dark_angle < 0.f)
{ {
// annular eclipse // annular eclipse
float asun = sun_angular_size*sun_angular_size; float asun = sun_angular_size*sun_angular_size;
min = (asun - moon_angular_size*moon_angular_size)/a sun; // minimum proportion of sun uncovered min = (asun - moon_angular_size*moon_angular_size)/a sun; // minimum proportion of sun uncovered
dark_angle *= -1; dark_angle *= -1;
} }
skipping to change at line 342 skipping to change at line 343
{ {
if (StelApp::getInstance().getVisionModeNight()) if (StelApp::getInstance().getVisionModeNight())
return; return;
StelToneReproducer* eye = core->getToneReproducer(); StelToneReproducer* eye = core->getToneReproducer();
if (!fader.getInterstate()) if (!fader.getInterstate())
return; return;
StelPainter sPainter(core->getProjection2d()); StelPainter sPainter(core->getProjection2d());
glBlendFunc(GL_ONE, GL_ONE); sPainter.setBlending(true, GL_ONE, GL_ONE);
sPainter.enableTexture2d(false);
glEnable(GL_BLEND);
const float atm_intensity = fader.getInterstate(); const float atm_intensity = fader.getInterstate();
atmoShaderProgram->bind(); atmoShaderProgram->bind();
float a, b, c; float a, b, c;
eye->getShadersParams(a, b, c); eye->getShadersParams(a, b, c);
atmoShaderProgram->setUniformValue(shaderAttribLocations.alphaWaOver AlphaDa, a); atmoShaderProgram->setUniformValue(shaderAttribLocations.alphaWaOver AlphaDa, a);
atmoShaderProgram->setUniformValue(shaderAttribLocations.oneOverGamm a, b); atmoShaderProgram->setUniformValue(shaderAttribLocations.oneOverGamm a, b);
atmoShaderProgram->setUniformValue(shaderAttribLocations.term2TimesO neOverMaxdLpOneOverGamma, c); atmoShaderProgram->setUniformValue(shaderAttribLocations.term2TimesO neOverMaxdLpOneOverGamma, c);
atmoShaderProgram->setUniformValue(shaderAttribLocations.brightnessS cale, atm_intensity); atmoShaderProgram->setUniformValue(shaderAttribLocations.brightnessS cale, atm_intensity);
skipping to change at line 386 skipping to change at line 385
atmoShaderProgram->setAttributeBuffer(shaderAttribLocations.skyColor , GL_FLOAT, 0, 4, 0); atmoShaderProgram->setAttributeBuffer(shaderAttribLocations.skyColor , GL_FLOAT, 0, 4, 0);
colorGridBuffer.release(); colorGridBuffer.release();
atmoShaderProgram->enableAttributeArray(shaderAttribLocations.skyCol or); atmoShaderProgram->enableAttributeArray(shaderAttribLocations.skyCol or);
posGridBuffer.bind(); posGridBuffer.bind();
atmoShaderProgram->setAttributeBuffer(shaderAttribLocations.skyVerte x, GL_FLOAT, 0, 2, 0); atmoShaderProgram->setAttributeBuffer(shaderAttribLocations.skyVerte x, GL_FLOAT, 0, 2, 0);
posGridBuffer.release(); posGridBuffer.release();
atmoShaderProgram->enableAttributeArray(shaderAttribLocations.skyVer tex); atmoShaderProgram->enableAttributeArray(shaderAttribLocations.skyVer tex);
// And draw everything at once // And draw everything at once
indicesBuffer.bind(); indicesBuffer.bind();
int shift=0; std::size_t shift=0;
for (int y=0;y<skyResolutionY;++y) for (int y=0;y<skyResolutionY;++y)
{ {
glDrawElements(GL_TRIANGLE_STRIP, (skyResolutionX+1)*2, GL_U NSIGNED_SHORT, reinterpret_cast<void*>(shift)); sPainter.glFuncs()->glDrawElements(GL_TRIANGLE_STRIP, (skyRe solutionX+1)*2, GL_UNSIGNED_SHORT, reinterpret_cast<void*>(shift));
shift += (skyResolutionX+1)*2*2; shift += (skyResolutionX+1)*2*2;
} }
indicesBuffer.release(); indicesBuffer.release();
atmoShaderProgram->disableAttributeArray(shaderAttribLocations.skyVe rtex); atmoShaderProgram->disableAttributeArray(shaderAttribLocations.skyVe rtex);
atmoShaderProgram->disableAttributeArray(shaderAttribLocations.skyCo lor); atmoShaderProgram->disableAttributeArray(shaderAttribLocations.skyCo lor);
atmoShaderProgram->release(); atmoShaderProgram->release();
// GZ: debug output // GZ: debug output
//const StelProjectorP prj = core->getProjection(StelCore::FrameEqui noxEqu); //const StelProjectorP prj = core->getProjection(StelCore::FrameEqui noxEqu);
//StelPainter painter(prj); //StelPainter painter(prj);
 End of changes. 4 change blocks. 
6 lines changed or deleted 7 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/