|
47 | 47 | #include "ConstellationMgr.hpp" |
48 | 48 | #include "Planet.hpp" |
49 | 49 | #include "StelUtils.hpp" |
| 50 | +#include "SolarSystem.hpp" |
50 | 51 |
|
51 | 52 | #include <QTextStream> |
52 | 53 | #include <QFile> |
@@ -1271,6 +1272,20 @@ void StarMgr::draw(StelCore* core) |
1271 | 1272 |
|
1272 | 1273 | // Prepare a table for storing precomputed RCMag for all ZoneArrays |
1273 | 1274 | RCMag rcmag_table[RCMAG_TABLE_SIZE]; |
| 1275 | + |
| 1276 | + // Try to filter away stars hidden by the Moon! |
| 1277 | + bool filterMoon=false; |
| 1278 | + PlanetP moon = GETSTELMODULE(SolarSystem)->getMoon(); |
| 1279 | + Vec3d moonPos=moon->getJ2000EquatorialPos(core); |
| 1280 | + const double moonRadius = moon->getEquatorialRadius() * moon->getSphereScale(); |
| 1281 | + double angularSize = atan2(moonRadius, moonPos.length()); |
| 1282 | + moonPos.normalize(); |
| 1283 | + SphericalCap moonCap(moonPos, cos(angularSize)); |
| 1284 | + for (auto cap : viewportCaps) |
| 1285 | + { |
| 1286 | + if (cap.intersects(moonCap)) |
| 1287 | + filterMoon=true; |
| 1288 | + } |
1274 | 1289 |
|
1275 | 1290 | // Draw all the stars of all the selected zones |
1276 | 1291 | for (const auto* z : gridLevels) |
@@ -1314,9 +1329,9 @@ void StarMgr::draw(StelCore* core) |
1314 | 1329 | int zone; |
1315 | 1330 |
|
1316 | 1331 | for (GeodesicSearchInsideIterator it1(*geodesic_search_result,z->level);(zone = it1.next()) >= 0;) |
1317 | | - z->draw(&sPainter, zone, true, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, flagDesignations, viewportCaps, withAberration, velf); |
| 1332 | + z->draw(&sPainter, zone, true, rcmag_table, limitMagIndex, core, maxMagStarName, names_brightness, flagDesignations, viewportCaps, withAberration, velf, filterMoon, moonCap); |
1318 | 1333 | for (GeodesicSearchBorderIterator it1(*geodesic_search_result,z->level);(zone = it1.next()) >= 0;) |
1319 | | - z->draw(&sPainter, zone, false, rcmag_table, limitMagIndex, core, maxMagStarName,names_brightness, flagDesignations, viewportCaps, withAberration, velf); |
| 1334 | + z->draw(&sPainter, zone, false, rcmag_table, limitMagIndex, core, maxMagStarName,names_brightness, flagDesignations, viewportCaps, withAberration, velf, filterMoon, moonCap); |
1320 | 1335 | } |
1321 | 1336 | exit_loop: |
1322 | 1337 |
|
|
0 commit comments