|
44 | 44 | #include "ConstellationMgr.hpp" |
45 | 45 | #include "Planet.hpp" |
46 | 46 | #include "StelUtils.hpp" |
| 47 | +#include "SolarSystem.hpp" |
47 | 48 |
|
48 | 49 | #include <QTextStream> |
49 | 50 | #include <QFile> |
@@ -1312,6 +1313,20 @@ void StarMgr::draw(StelCore* core) |
1312 | 1313 |
|
1313 | 1314 | // Prepare a table for storing precomputed RCMag for all ZoneArrays |
1314 | 1315 | RCMag rcmag_table[RCMAG_TABLE_SIZE]; |
| 1316 | + |
| 1317 | + // Try to filter away stars hidden by the Moon! |
| 1318 | + bool filterMoon=false; |
| 1319 | + PlanetP moon = GETSTELMODULE(SolarSystem)->getMoon(); |
| 1320 | + Vec3d moonPos=moon->getJ2000EquatorialPos(core); |
| 1321 | + const double moonRadius = moon->getEquatorialRadius() * moon->getSphereScale(); |
| 1322 | + double angularSize = atan2(moonRadius, moonPos.norm()); |
| 1323 | + moonPos.normalize(); |
| 1324 | + SphericalCap moonCap(moonPos, cos(angularSize)); |
| 1325 | + for (auto cap : viewportCaps) |
| 1326 | + { |
| 1327 | + if (cap.intersects(moonCap)) |
| 1328 | + filterMoon=true; |
| 1329 | + } |
1315 | 1330 |
|
1316 | 1331 | // Draw all the stars of all the selected zones |
1317 | 1332 | for (const auto* z : qAsConst(gridLevels)) |
@@ -1355,9 +1370,9 @@ void StarMgr::draw(StelCore* core) |
1355 | 1370 | int zone; |
1356 | 1371 |
|
1357 | 1372 | for (GeodesicSearchInsideIterator it1(*geodesic_search_result,z->level);(zone = it1.next()) >= 0;) |
1358 | | - z->draw(&sPainter, zone, true, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, velf); |
| 1373 | + z->draw(&sPainter, zone, true, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, viewportCaps, withAberration, velf, filterMoon, moonCap); |
1359 | 1374 | for (GeodesicSearchBorderIterator it1(*geodesic_search_result,z->level);(zone = it1.next()) >= 0;) |
1360 | | - z->draw(&sPainter, zone, false, rcmag_table, limitMagIndex, core, maxMagStarName,names_brightness, viewportCaps, withAberration, velf); |
| 1375 | + z->draw(&sPainter, zone, false, rcmag_table, limitMagIndex, core, maxMagStarName,names_brightness, viewportCaps, withAberration, velf, filterMoon, moonCap); |
1361 | 1376 | } |
1362 | 1377 | exit_loop: |
1363 | 1378 |
|
|
0 commit comments