Landscape.cpp   Landscape.cpp 
skipping to change at line 518 skipping to change at line 518
if (!validLandscape) if (!validLandscape)
return; return;
if (drawGroundFirst) if (drawGroundFirst)
drawGround(core, painter); drawGround(core, painter);
drawDecor(core, painter, false); drawDecor(core, painter, false);
if (!drawGroundFirst) if (!drawGroundFirst)
drawGround(core, painter); drawGround(core, painter);
drawFog(core, painter); drawFog(core, painter);
// GZ: ALSO HERE - Self-luminous layer (Light pollution etc). This l // Self-luminous layer (Light pollution etc). This looks striking!
ooks striking! if (lightScapeBrightness>0.0f && illumFader.getInterstate())
if (lightScapeBrightness>0.0f && core->getSkyDrawer()->getFlagHasAtm
osphere())
{ {
glBlendFunc(GL_SRC_ALPHA, GL_ONE); glBlendFunc(GL_SRC_ALPHA, GL_ONE);
drawDecor(core, painter, true); // GZ: NEW drawDecor(core, painter, true);
} }
// If a horizon line also has been defined, draw it. // If a horizon line also has been defined, draw it.
if (horizonPolygon && (horizonPolygonLineColor[0] >= 0)) if (horizonPolygon && (horizonPolygonLineColor[0] >= 0))
{ {
//qDebug() << "drawing line"; //qDebug() << "drawing line";
StelProjector::ModelViewTranformP transfo = core->getAltAzMo delViewTransform(StelCore::RefractionOff); StelProjector::ModelViewTranformP transfo = core->getAltAzMo delViewTransform(StelCore::RefractionOff);
transfo->combine(Mat4d::zrotation(-angleRotateZOffset)); transfo->combine(Mat4d::zrotation(-angleRotateZOffset));
const StelProjectorP prj = core->getProjection(transfo); const StelProjectorP prj = core->getProjection(transfo);
painter.setProjector(prj); painter.setProjector(prj);
skipping to change at line 545 skipping to change at line 545
painter.drawSphericalRegion(horizonPolygon.data(), StelPaint er::SphericalPolygonDrawModeBoundary); painter.drawSphericalRegion(horizonPolygon.data(), StelPaint er::SphericalPolygonDrawModeBoundary);
} }
//else qDebug() << "no polygon defined"; //else qDebug() << "no polygon defined";
} }
// Draw the horizon fog // Draw the horizon fog
void LandscapeOldStyle::drawFog(StelCore* core, StelPainter& sPainter) cons t void LandscapeOldStyle::drawFog(StelCore* core, StelPainter& sPainter) cons t
{ {
if (!fogFader.getInterstate()) if (!fogFader.getInterstate())
return; return;
if(!landFader.getInterstate())
return;
if (!(core->getSkyDrawer()->getFlagHasAtmosphere()))
return;
const float vpos = (tanMode||calibrated) ? radius*std::tan(fogAngleS hift*M_PI/180.) : radius*std::sin(fogAngleShift*M_PI/180.); const float vpos = (tanMode||calibrated) ? radius*std::tan(fogAngleS hift*M_PI/180.) : radius*std::sin(fogAngleShift*M_PI/180.);
StelProjector::ModelViewTranformP transfo = core->getAltAzModelViewT ransform(StelCore::RefractionOff); StelProjector::ModelViewTranformP transfo = core->getAltAzModelViewT ransform(StelCore::RefractionOff);
if (calibrated) // new in V0.13: take proper care of the fog layer. This will work perfectly only for calibrated&&tanMode. if (calibrated) // new in V0.13: take proper care of the fog layer. This will work perfectly only for calibrated&&tanMode.
transfo->combine(Mat4d::zrotation(-(angleRotateZ+angleRotate ZOffset))); transfo->combine(Mat4d::zrotation(-(angleRotateZ+angleRotate ZOffset)));
transfo->combine(Mat4d::translation(Vec3d(0.,0.,vpos))); transfo->combine(Mat4d::translation(Vec3d(0.,0.,vpos)));
sPainter.setProjector(core->getProjection(transfo)); sPainter.setProjector(core->getProjection(transfo));
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
sPainter.setColor(fogFader.getInterstate()*(0.1f+0.1f*landscapeBrigh sPainter.setColor(landFader.getInterstate()*fogFader.getInterstate()
tness), *(0.1f+0.1f*landscapeBrightness),
fogFader.getInterstate()*(0.1f+0.1f*landscapeBrigh landFader.getInterstate()*fogFader.getInterstate()
tness), *(0.1f+0.1f*landscapeBrightness),
fogFader.getInterstate()*(0.1f+0.1f*landscapeBrigh landFader.getInterstate()*fogFader.getInterstate()
tness)); *(0.1f+0.1f*landscapeBrightness), landFader.getInterstate());
fogTex->bind(); fogTex->bind();
const float height = (calibrated? const float height = (calibrated?
radius*(std::tan((fogAltAngle+fogAngleShift) *M_PI/180.) - std::tan(fogAngleShift*M_PI/180.)) radius*(std::tan((fogAltAngle+fogAngleShift) *M_PI/180.) - std::tan(fogAngleShift*M_PI/180.))
: ((tanMode) ? radius*std::tan(fogAltAngle*M _PI/180.) : radius*std::sin(fogAltAngle*M_PI/180.))); : ((tanMode) ? radius*std::tan(fogAltAngle*M _PI/180.) : radius*std::sin(fogAltAngle*M_PI/180.)));
sPainter.sCylinder(radius, height, 64, 1); sPainter.sCylinder(radius, height, 64, 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
// Draw the side textures // Draw the side textures
void LandscapeOldStyle::drawDecor(StelCore* core, StelPainter& sPainter, co nst bool drawLight) const void LandscapeOldStyle::drawDecor(StelCore* core, StelPainter& sPainter, co nst bool drawLight) const
{ {
StelProjector::ModelViewTranformP transfo = core->getAltAzModelViewT ransform(StelCore::RefractionOff); StelProjector::ModelViewTranformP transfo = core->getAltAzModelViewT ransform(StelCore::RefractionOff);
transfo->combine(Mat4d::zrotation(-(angleRotateZ+angleRotateZOffset) )); transfo->combine(Mat4d::zrotation(-(angleRotateZ+angleRotateZOffset) ));
sPainter.setProjector(core->getProjection(transfo)); sPainter.setProjector(core->getProjection(transfo));
if (!landFader.getInterstate()) if (!landFader.getInterstate())
return; return;
if (drawLight) if (drawLight)
sPainter.setColor(lightScapeBrightness, lightScapeBrightness , lightScapeBrightness, landFader.getInterstate()); sPainter.setColor(illumFader.getInterstate()*lightScapeBrigh tness, illumFader.getInterstate()*lightScapeBrightness, illumFader.getInter state()*lightScapeBrightness, landFader.getInterstate());
else else
sPainter.setColor(landscapeBrightness, landscapeBrightness, landscapeBrightness, landFader.getInterstate()); sPainter.setColor(landscapeBrightness, landscapeBrightness, landscapeBrightness, landFader.getInterstate());
foreach (const LOSSide& side, precomputedSides) foreach (const LOSSide& side, precomputedSides)
{ {
if (side.light==drawLight) if (side.light==drawLight)
{ {
side.tex->bind(); side.tex->bind();
sPainter.drawSphericalTriangles(side.arr, true, NULL , false); sPainter.drawSphericalTriangles(side.arr, true, fals e, NULL, false);
} }
} }
} }
// Draw the ground // Draw the ground
void LandscapeOldStyle::drawGround(StelCore* core, StelPainter& sPainter) c onst void LandscapeOldStyle::drawGround(StelCore* core, StelPainter& sPainter) c onst
{ {
if (!landFader.getInterstate()) if (!landFader.getInterstate())
return; return;
const float vshift = radius * ((tanMode || calibrated) ? std::tan(gr oundAngleShift) : std::sin(groundAngleShift)); const float vshift = radius * ((tanMode || calibrated) ? std::tan(gr oundAngleShift) : std::sin(groundAngleShift));
skipping to change at line 723 skipping to change at line 727
StelProjector::ModelViewTranformP transfo = core->getAltAzModelViewT ransform(StelCore::RefractionOff); StelProjector::ModelViewTranformP transfo = core->getAltAzModelViewT ransform(StelCore::RefractionOff);
transfo->combine(Mat4d::zrotation(-angleRotateZOffset)); transfo->combine(Mat4d::zrotation(-angleRotateZOffset));
const StelProjectorP prj = core->getProjection(transfo); const StelProjectorP prj = core->getProjection(transfo);
StelPainter sPainter(prj); StelPainter sPainter(prj);
// Normal transparency mode for the transition blending // Normal transparency mode for the transition blending
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glEnable(GL_BLEND); glEnable(GL_BLEND);
//#ifdef GL_POLYGON_SMOOTH
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH. Anyway, Polygon smooth
ing makes the triangles visible. May be Interesting for debugging only.
//if (QOpenGLContext::currentContext()->format().renderableType()==Q
SurfaceFormat::OpenGL)
// glEnable(GL_POLYGON_SMOOTH);
//#endif
sPainter.setColor(landscapeBrightness*groundColor[0], landscapeBrigh tness*groundColor[1], landscapeBrightness*groundColor[2], landFader.getInte rstate()); sPainter.setColor(landscapeBrightness*groundColor[0], landscapeBrigh tness*groundColor[1], landscapeBrightness*groundColor[2], landFader.getInte rstate());
sPainter.drawSphericalRegion(horizonPolygon.data(), StelPainter::Sph ericalPolygonDrawModeFill); sPainter.drawSphericalRegion(horizonPolygon.data(), StelPainter::Sph ericalPolygonDrawModeFill);
//#ifdef GL_POLYGON_SMOOTH
//if (QOpenGLContext::currentContext()->format().renderableType()==Q
SurfaceFormat::OpenGL)
// glDisable(GL_POLYGON_SMOOTH);
//#endif
if (horizonPolygonLineColor[0] >= 0) if (horizonPolygonLineColor[0] >= 0)
{ {
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableTyp
e()==QSurfaceFormat::OpenGL)
glEnable(GL_LINE_SMOOTH);
#endif
sPainter.setColor(horizonPolygonLineColor[0], horizonPolygon LineColor[1], horizonPolygonLineColor[2], landFader.getInterstate()); sPainter.setColor(horizonPolygonLineColor[0], horizonPolygon LineColor[1], horizonPolygonLineColor[2], landFader.getInterstate());
sPainter.drawSphericalRegion(horizonPolygon.data(), StelPain ter::SphericalPolygonDrawModeBoundary); sPainter.drawSphericalRegion(horizonPolygon.data(), StelPain ter::SphericalPolygonDrawModeBoundary);
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableTyp
e()==QSurfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
} }
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
} }
float LandscapePolygonal::getOpacity(Vec3d azalt) const float LandscapePolygonal::getOpacity(Vec3d azalt) const
{ {
if (angleRotateZOffset!=0.0f) if (angleRotateZOffset!=0.0f)
azalt.transfo4d(Mat4d::zrotation(angleRotateZOffset)); azalt.transfo4d(Mat4d::zrotation(angleRotateZOffset));
if (horizonPolygon->contains(azalt) ) return 1.0f; else return 0 .0f; if (horizonPolygon->contains(azalt) ) return 1.0f; else return 0 .0f;
skipping to change at line 813 skipping to change at line 835
// Normal transparency mode // Normal transparency mode
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
sPainter.setColor(landscapeBrightness, landscapeBrightness, landscap eBrightness, landFader.getInterstate()); sPainter.setColor(landscapeBrightness, landscapeBrightness, landscap eBrightness, landFader.getInterstate());
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
sPainter.enableTexture2d(true); sPainter.enableTexture2d(true);
glEnable(GL_BLEND); glEnable(GL_BLEND);
mapTex->bind(); mapTex->bind();
sPainter.sSphereMap(radius,cols,rows,texFov,1); sPainter.sSphereMap(radius,cols,rows,texFov,1);
// NEW since 0.13: Fog also for fisheye... // NEW since 0.13: Fog also for fisheye...
if (mapTexFog) if ((mapTexFog) && (core->getSkyDrawer()->getFlagHasAtmosphere()))
{ {
//glBlendFunc(GL_ONE, GL_ONE); // GZ: Take blending mode as found in the old_style landscapes... //glBlendFunc(GL_ONE, GL_ONE); // GZ: Take blending mode as found in the old_style landscapes...
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); // GZ: better? glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); // GZ: better?
sPainter.setColor(fogFader.getInterstate()*(0.1f+0.1f*landsc sPainter.setColor(landFader.getInterstate()*fogFader.getInte
apeBrightness), rstate()*(0.1f+0.1f*landscapeBrightness),
fogFader.getInterstate()*(0.1f+0.1f*landsc landFader.getInterstate()*fogFader.getInte
apeBrightness), rstate()*(0.1f+0.1f*landscapeBrightness),
fogFader.getInterstate()*(0.1f+0.1f*landsc landFader.getInterstate()*fogFader.getInte
apeBrightness), fogFader.getInterstate()); rstate()*(0.1f+0.1f*landscapeBrightness), landFader.getInterstate());
mapTexFog->bind(); mapTexFog->bind();
sPainter.sSphereMap(radius,cols,rows,texFov,1); sPainter.sSphereMap(radius,cols,rows,texFov,1);
} }
if (mapTexIllum && lightScapeBrightness>0.0f && core->getSkyDrawer() ->getFlagHasAtmosphere()) if (mapTexIllum && lightScapeBrightness>0.0f && illumFader.getInters tate())
{ {
glBlendFunc(GL_SRC_ALPHA, GL_ONE); glBlendFunc(GL_SRC_ALPHA, GL_ONE);
sPainter.setColor(lightScapeBrightness, lightScapeBrightness sPainter.setColor(illumFader.getInterstate()*lightScapeBrigh
, lightScapeBrightness, landFader.getInterstate()); tness,
illumFader.getInterstate()*lightScapeBrigh
tness,
illumFader.getInterstate()*lightScapeBrigh
tness, landFader.getInterstate());
mapTexIllum->bind(); mapTexIllum->bind();
sPainter.sSphereMap(radius, cols, rows, texFov, 1); sPainter.sSphereMap(radius, cols, rows, texFov, 1);
} }
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
} }
float LandscapeFisheye::getOpacity(Vec3d azalt) const float LandscapeFisheye::getOpacity(Vec3d azalt) const
{ {
if (angleRotateZOffset!=0.0f) if (angleRotateZOffset!=0.0f)
skipping to change at line 967 skipping to change at line 991
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
sPainter.enableTexture2d(true); sPainter.enableTexture2d(true);
glEnable(GL_BLEND); glEnable(GL_BLEND);
mapTex->bind(); mapTex->bind();
// TODO: verify that this works correctly for custom projections [co mment not by GZ] // TODO: verify that this works correctly for custom projections [co mment not by GZ]
// seam is at East, except if angleRotateZ has been given. // seam is at East, except if angleRotateZ has been given.
sPainter.sSphere(radius, 1.0, cols, rows, 1, true, mapTexTop, mapTex Bottom); sPainter.sSphere(radius, 1.0, cols, rows, 1, true, mapTexTop, mapTex Bottom);
// Since 0.13: Fog also for sphericals... // Since 0.13: Fog also for sphericals...
if (mapTexFog) if ((mapTexFog) && (core->getSkyDrawer()->getFlagHasAtmosphere()))
{ {
//glBlendFunc(GL_ONE, GL_ONE); // GZ: blending mode as found glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
in the old_style landscapes... sPainter.setColor(landFader.getInterstate()*fogFader.getInte
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); // GZ: better? rstate()*(0.1f+0.1f*landscapeBrightness),
sPainter.setColor(fogFader.getInterstate()*(0.1f+0.1f*landsc landFader.getInterstate()*fogFader.getInte
apeBrightness), rstate()*(0.1f+0.1f*landscapeBrightness),
fogFader.getInterstate()*( landFader.getInterstate()*fogFader.getInte
0.1f+0.1f*landscapeBrightness), rstate()*(0.1f+0.1f*landscapeBrightness), landFader.getInterstate());
fogFader.getInterstate()*(
0.1f+0.1f*landscapeBrightness), fogFader.getInterstate());
mapTexFog->bind(); mapTexFog->bind();
sPainter.sSphere(radius, 1.0, cols, (int) ceil(rows*(fogTexT op-fogTexBottom)/(mapTexTop-mapTexBottom)), 1, true, fogTexTop, fogTexBotto m); sPainter.sSphere(radius, 1.0, cols, (int) ceil(rows*(fogTexT op-fogTexBottom)/(mapTexTop-mapTexBottom)), 1, true, fogTexTop, fogTexBotto m);
} }
// Self-luminous layer (Light pollution etc). This looks striking! // Self-luminous layer (Light pollution etc). This looks striking!
if (mapTexIllum && lightScapeBrightness>0.0f && core->getSkyDrawer() ->getFlagHasAtmosphere()) if (mapTexIllum && (lightScapeBrightness>0.0f) && illumFader.getInte rstate())
{ {
glBlendFunc(GL_SRC_ALPHA, GL_ONE); glBlendFunc(GL_SRC_ALPHA, GL_ONE);
sPainter.setColor(lightScapeBrightness, lightScapeBrightness sPainter.setColor(lightScapeBrightness*illumFader.getInterst
, lightScapeBrightness, landFader.getInterstate()); ate(),
lightScapeBrightness*illumFader.getInterst
ate(),
lightScapeBrightness*illumFader.getInterst
ate(), landFader.getInterstate());
mapTexIllum->bind(); mapTexIllum->bind();
sPainter.sSphere(radius, 1.0, cols, (int) ceil(rows*(illumTe xTop-illumTexBottom)/(mapTexTop-mapTexBottom)), 1, true, illumTexTop, illum TexBottom); sPainter.sSphere(radius, 1.0, cols, (int) ceil(rows*(illumTe xTop-illumTexBottom)/(mapTexTop-mapTexBottom)), 1, true, illumTexTop, illum TexBottom);
} }
//qDebug() << "before drawing line"; //qDebug() << "before drawing line";
// If a horizon line also has been defined, draw it. // If a horizon line also has been defined, draw it.
if (horizonPolygon && (horizonPolygonLineColor[0] >= 0)) if (horizonPolygon && (horizonPolygonLineColor[0] >= 0))
{ {
//qDebug() << "drawing line"; //qDebug() << "drawing line";
transfo = core->getAltAzModelViewTransform(StelCore::Refract ionOff); transfo = core->getAltAzModelViewTransform(StelCore::Refract ionOff);
 End of changes. 18 change blocks. 
36 lines changed or deleted 67 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/