diff options
author | Georg Zotti <Georg.Zotti@univie.ac.at> | 2019-12-20 21:14:27 +0100 |
---|---|---|
committer | Georg Zotti <Georg.Zotti@univie.ac.at> | 2019-12-20 21:14:27 +0100 |
commit | bb31d25e47c0f774803c5f6e6c2ac49445037f79 (patch) | |
tree | 3413129d678e7cd5144629aba4407c84025a8f04 | |
parent | 641a05c2d3ae277d7c7ffa39ebce26b49b1020cb (diff) |
A very preliminary fix for discussion. (Partial fix of #389)avoid-sun-streak
This removes the whole comet from the screen in Orthographic projection,
when its head is on the wrong hemisphere, but also (wrongly) when its
head is just off screen.
It does not remove the tail that extends to the wrong hemisphere.
-rw-r--r-- | src/core/modules/Comet.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/modules/Comet.cpp b/src/core/modules/Comet.cpp index cf4cc9eec9..222f4eccb4 100644 --- a/src/core/modules/Comet.cpp +++ b/src/core/modules/Comet.cpp @@ -552,6 +552,18 @@ void Comet::draw(StelCore* core, float maxMagLabels, const QFont& planetNameFont const float screenSz = static_cast<float>(getAngularSize(core))*M_PI_180f*prj->getPixelPerRadAtCenter(); const float viewport_left = prj->getViewportPosX(); const float viewport_bottom = prj->getViewportPosY(); + + // For some stupid reason comets appear also on the wrong side of the globe in Orthographic view. We must exclude them. + // This is only a partial fix: we switch off the comet when it is behind the edge of the sphere, but also + // when the head is just off screen. But better than a ghost image. TODO: Find a better test that keeps the comet visible when just off-screen. + if ((core->getCurrentProjectionType()==StelCore::ProjectionOrthographic) && !(prj->projectCheck(Vec3f(0.f), screenPos))) + return; + + //setExtraInfoString(QString("InView: %1 %2\n").arg(check).arg(StelUtils::vec3fToStr(screenPos))); + //Vec3d unDir; + //bool un=prj->unProject(960., 600., unDir); // prelim. test: use center position of screen. + //addToExtraInfoString(QString("Unprojected: %1 %2\n").arg(un).arg(unDir.toString())); + if (prj->project(Vec3f(0.), screenPos) && screenPos[1] > viewport_bottom - screenSz && screenPos[1] < viewport_bottom + prj->getViewportHeight()+screenSz |