1
0
Fork 0

Fix apparent size of Moon and Sun (too large by a factor of two)

This commit is contained in:
Eatdirt 2021-01-07 23:19:51 +01:00 committed by James Turner
parent c51379db8c
commit e385fa4ecc

View file

@ -593,16 +593,29 @@ FGRenderer::setupView( void )
Ephemeris* ephemerisSub = globals->get_subsystem<Ephemeris>(); Ephemeris* ephemerisSub = globals->get_subsystem<Ephemeris>();
// The sun and moon diameters are scaled down numbers of the // The sun and moon radius are scaled down numbers of the actual
// actual diameters. This was needed to fit both the sun and the // diameters. This is needed to fit both the sun and the moon
// moon within the distance to the far clip plane. // within the distance to the far clip plane.
// Moon diameter: 3,476 kilometers //
// Sun diameter: 1,390,000 kilometers // Their distance to the observer is specified in FGRendered::updateSky() and
// set to 40000 for the Moon semi-mayor axis, 50000 for the mean
// Earth-Sun distance (1AU). The location of the stars is
// specified below in the call to sky->build() (80000).
//
// Mean Moon radius: 1,737.4 kilometers
// Moon Semi-mayor axis: 384,399 km
// => Rendered Moon radius = 1,737.4 / 384,399 * 40000 = 232.5
//
// Photosphere Sun radius: 695,700 kilometers
// 1UA = 149,597,870.700 km
// => Rendered Sun radius = 695,700/149,597,870.700 * 50000 = 180.8
//
osg::ref_ptr<simgear::SGReaderWriterOptions> opt; osg::ref_ptr<simgear::SGReaderWriterOptions> opt;
opt = simgear::SGReaderWriterOptions::fromPath(globals->get_fg_root()); opt = simgear::SGReaderWriterOptions::fromPath(globals->get_fg_root());
opt->setPropertyNode(globals->get_props()); opt->setPropertyNode(globals->get_props());
_sky->build( 80000.0, 80000.0, _sky->build( 80000.0, 80000.0,
463.3, 361.6, 232.5, 180.8,
*ephemerisSub->data(), *ephemerisSub->data(),
fgGetNode("/environment", true), fgGetNode("/environment", true),
opt.get()); opt.get());
@ -847,11 +860,8 @@ FGRenderer::updateSky()
FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting")); FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
// The sun and moon distances are scaled down versions // The sun and moon distances are scaled down versions of the
// of the actual distance to get both the moon and the sun // actual distance. See FGRenderer::setupView() for more details.
// within the range of the far clip plane.
// Moon distance: 384,467 kilometers
// Sun distance: 150,000,000 kilometers
double sun_horiz_eff, moon_horiz_eff; double sun_horiz_eff, moon_horiz_eff;
if (_horizon_effect->getBoolValue()) { if (_horizon_effect->getBoolValue()) {