StelSkyImageTile.cpp   StelSkyImageTile.cpp 
skipping to change at line 242 skipping to change at line 242
else else
{ {
// The subtiles should not be displayed because their resolu tion is too high // The subtiles should not be displayed because their resolu tion is too high
scheduleChildsDeletion(); scheduleChildsDeletion();
} }
} }
// Draw the image on the screen. // Draw the image on the screen.
bool StelSkyImageTile::drawTile(StelCore* core, StelRenderer* renderer, Ste lProjectorP projector) bool StelSkyImageTile::drawTile(StelCore* core, StelRenderer* renderer, Ste lProjectorP projector)
{ {
StelSkyDrawer* drawer = core->getSkyDrawer();
Extinction extinction=core->getSkyDrawer()->getExtinction();
const bool withExtinction=(drawer->getFlagHasAtmosphere() && extinct
ion.getExtinctionCoefficient()>=0.01f);
tex->bind(); tex->bind();
if (!texFader) if (!texFader)
{ {
texFader = new QTimeLine(1000, this); texFader = new QTimeLine(1000, this);
texFader->start(); texFader->start();
} }
// Draw the real texture for this image // Draw the real texture for this image
const float ad_lum = const float ad_lum =
skipping to change at line 277 skipping to change at line 281
else else
{ {
renderer->setBlendMode(BlendMode_None); renderer->setBlendMode(BlendMode_None);
color.set(ad_lum,ad_lum,ad_lum, 1.); color.set(ad_lum,ad_lum,ad_lum, 1.);
} }
color[0] = std::min(color[0], 1.0f); color[0] = std::min(color[0], 1.0f);
color[1] = std::min(color[1], 1.0f); color[1] = std::min(color[1], 1.0f);
color[2] = std::min(color[2], 1.0f); color[2] = std::min(color[2], 1.0f);
color[3] = std::min(color[3], 1.0f); color[3] = std::min(color[3], 1.0f);
renderer->setGlobalColor(color); // color is the pre-extinction color
foreach (const SphericalRegionP& poly, skyConvexPolygons) foreach (const SphericalRegionP& poly, skyConvexPolygons)
{ {
Vec4f extinctedColor=color;
if (withExtinction)
{
Vec3d bary= poly->getPointInside(); // This is a J00
0.0 vector that points "somewhere" in the first triangle.
Vec3d altAz = core->j2000ToAltAz(bary, StelCore::Ref
ractionOn);
float extinctionMagnitude=0.0f;
extinction.forward(&(altAz[2]), &extinctionMagnitude
);
// compute a simple factor from magnitude loss.
float extinctionFactor=pow(0.4, extinctionMagnitude)
; // drop of one magnitude: factor 2.5 or 40%
extinctedColor[0]*=fabs(extinctionFactor);
extinctedColor[1]*=fabs(extinctionFactor);
extinctedColor[2]*=fabs(extinctionFactor);
}
renderer->setGlobalColor(extinctedColor);
// GZ: this was the original code now.
poly->drawFill(renderer, SphericalRegion::DrawParams(&(*proj ector))); poly->drawFill(renderer, SphericalRegion::DrawParams(&(*proj ector)));
} }
#ifdef DEBUG_STELSKYIMAGE_TILE #ifdef DEBUG_STELSKYIMAGE_TILE
color.set(1.0,0.5,0.5,1.0); color.set(1.0,0.5,0.5,1.0);
renderer->setGlobalColor(color); renderer->setGlobalColor(color);
foreach (const SphericalRegionP& poly, skyConvexPolygons) foreach (const SphericalRegionP& poly, skyConvexPolygons)
{ {
Vec3d win; Vec3d win;
Vec3d bary = poly->getPointInside(); Vec3d bary = poly->getPointInside();
projector->project(bary, win); projector->project(bary, win);
renderer->drawText(TextParams(win[0], win[1], getAbsoluteIma geURI())); renderer->drawText(TextParams(win[0], win[1], getAbsoluteIma geURI()));
poly->drawOutline(renderer, SphericalRegion::DrawParams(&(pr ojector))); poly->drawOutline(renderer, SphericalRegion::DrawParams(&(*p rojector)));
} }
#endif #endif
if (!alphaBlend) if (!alphaBlend)
{ {
renderer->setBlendMode(BlendMode_Add); // Revert renderer->setBlendMode(BlendMode_Add); // Revert
} }
return true; return true;
} }
 End of changes. 4 change blocks. 
2 lines changed or deleted 28 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/