LandscapeMgr.cpp   LandscapeMgr.cpp 
skipping to change at line 242 skipping to change at line 242
// qDebug() << "Atmosphere lum=" << atmosphere->getAverageLuminance() < < " ground lum=" << groundLuminance; // qDebug() << "Atmosphere lum=" << atmosphere->getAverageLuminance() < < " ground lum=" << groundLuminance;
// qDebug() << "Adapted Atmosphere lum=" << eye->adaptLuminance(atmosph ere->getAverageLuminance()) << " Adapted ground lum=" << eye->adaptLuminanc e(groundLuminance); // qDebug() << "Adapted Atmosphere lum=" << eye->adaptLuminance(atmosph ere->getAverageLuminance()) << " Adapted ground lum=" << eye->adaptLuminanc e(groundLuminance);
// compute global ground brightness in a simplistic way, directly in RGB // compute global ground brightness in a simplistic way, directly in RGB
float landscapeBrightness = 0; float landscapeBrightness = 0;
sunPos.normalize(); sunPos.normalize();
moonPos.normalize(); moonPos.normalize();
// We define the brigthness zero when the sun is 8 degrees below the horizon. // We define the brigthness zero when the sun is 8 degrees below the horizon.
float sinSunAngleRad = sin(qMin(M_PI_2, asin(sunPos[2])+8.*M_PI/180. )); float sinSunAngleRad = sin(qMin(M_PI_2, asin(sunPos[2])+8.*M_PI/180. ));
float initBrightness = getInitialLandscapeBrightness();
if(sinSunAngleRad < -0.1/1.5 ) if(sinSunAngleRad < -0.1/1.5 )
landscapeBrightness = 0.01; landscapeBrightness = initBrightness;
else else
landscapeBrightness = (0.01 + 1.5*(sinSunAngleRad+0.1/1.5)); landscapeBrightness = (initBrightness + 1.5*(sinSunAngleRad+ 0.1/1.5));
if (moonPos[2] > -0.1/1.5) if (moonPos[2] > -0.1/1.5)
landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->get VMagnitude(core, true),0.)*moonPos[2]; landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->get VMagnitude(core, true),0.)*moonPos[2];
// TODO make this more generic for non-atmosphere planets // TODO make this more generic for non-atmosphere planets
if(atmosphere->getFadeIntensity() == 1) if(atmosphere->getFadeIntensity() == 1)
{ {
// If the atmosphere is on, a solar eclipse might darken the sky // If the atmosphere is on, a solar eclipse might darken the sky
// otherwise we just use the sun position calculation above // otherwise we just use the sun position calculation above
landscapeBrightness *= (atmosphere->getRealDisplayIntensityF actor()+0.1); landscapeBrightness *= (atmosphere->getRealDisplayIntensityF actor()+0.1);
} }
// TODO: should calculate dimming with solar eclipse even without at mosphere on // TODO: should calculate dimming with solar eclipse even without at mosphere on
landscape->setBrightness(landscapeBrightness+0.05); if (core->getCurrentLocation().planetName.contains("Sun"))
{
// NOTE: Simple workaround for brightness of landscape when
observing from the Sun.
landscape->setBrightness(1.f);
}
else
landscape->setBrightness(landscapeBrightness+0.05);
} }
void LandscapeMgr::draw(StelCore* core, class StelRenderer* renderer) void LandscapeMgr::draw(StelCore* core, class StelRenderer* renderer)
{ {
// Draw the atmosphere // Draw the atmosphere
atmosphere->draw(core, renderer); atmosphere->draw(core, renderer);
// Draw the landscape // Draw the landscape
landscape->draw(core, renderer); landscape->draw(core, renderer);
skipping to change at line 291 skipping to change at line 298
defaultLandscapeID = conf->value("init_location/landscape_name").toS tring(); defaultLandscapeID = conf->value("init_location/landscape_name").toS tring();
setCurrentLandscapeID(defaultLandscapeID); setCurrentLandscapeID(defaultLandscapeID);
setFlagLandscape(conf->value("landscape/flag_landscape", conf->value ("landscape/flag_ground", true).toBool()).toBool()); setFlagLandscape(conf->value("landscape/flag_landscape", conf->value ("landscape/flag_ground", true).toBool()).toBool());
setFlagFog(conf->value("landscape/flag_fog",true).toBool()); setFlagFog(conf->value("landscape/flag_fog",true).toBool());
setFlagAtmosphere(conf->value("landscape/flag_atmosphere", true).toB ool()); setFlagAtmosphere(conf->value("landscape/flag_atmosphere", true).toB ool());
setAtmosphereFadeDuration(conf->value("landscape/atmosphere_fade_dur ation",0.5).toFloat()); setAtmosphereFadeDuration(conf->value("landscape/atmosphere_fade_dur ation",0.5).toFloat());
setAtmosphereLightPollutionLuminance(conf->value("viewing/light_poll ution_luminance",0.0).toFloat()); setAtmosphereLightPollutionLuminance(conf->value("viewing/light_poll ution_luminance",0.0).toFloat());
cardinalsPoints = new Cardinals(); cardinalsPoints = new Cardinals();
cardinalsPoints->setFlagShow(conf->value("viewing/flag_cardinal_poin ts",true).toBool()); cardinalsPoints->setFlagShow(conf->value("viewing/flag_cardinal_poin ts",true).toBool());
setFlagLandscapeSetsLocation(conf->value("landscape/flag_landscape_s ets_location",false).toBool()); setFlagLandscapeSetsLocation(conf->value("landscape/flag_landscape_s ets_location",false).toBool());
// Set initial brightness for landscape. This feature has been added
for folks which say "landscape is super dark, please add light". --AW
setInitialLandscapeBrightness(conf->value("landscape/initial_brightn
ess", 0.01).toFloat());
bool ok =true; bool ok =true;
setAtmosphereBortleLightPollution(conf->value("landscape/init_bortle _scale",3).toInt(&ok)); setAtmosphereBortleLightPollution(conf->value("stars/init_bortle_sca le",3).toInt(&ok));
if (!ok) if (!ok)
{ {
conf->setValue("landscape/init_bortle_scale",3); conf->setValue("stars/init_bortle_scale",3);
setAtmosphereBortleLightPollution(3); setAtmosphereBortleLightPollution(3);
ok = true; ok = true;
} }
StelApp *app = &StelApp::getInstance(); StelApp *app = &StelApp::getInstance();
connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n())); connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT( setStelStyle(const QString&))); connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT( setStelStyle(const QString&)));
} }
void LandscapeMgr::setStelStyle(const QString& section) void LandscapeMgr::setStelStyle(const QString& section)
{ {
skipping to change at line 352 skipping to change at line 361
if (getFlagLandscapeSetsLocation()) if (getFlagLandscapeSetsLocation())
{ {
StelApp::getInstance().getCore()->moveObserverTo(landscape-> getLocation()); StelApp::getInstance().getCore()->moveObserverTo(landscape-> getLocation());
// GZ Patch: allow change in fog, extinction, refraction par ameters and light pollution // GZ Patch: allow change in fog, extinction, refraction par ameters and light pollution
//QSettings* conf = StelApp::getInstance().getSettings(); //QSettings* conf = StelApp::getInstance().getSettings();
//Q_ASSERT(conf); //Q_ASSERT(conf);
StelSkyDrawer* drawer=StelApp::getInstance().getCore()->getS kyDrawer(); StelSkyDrawer* drawer=StelApp::getInstance().getCore()->getS kyDrawer();
if (landscape->getDefaultFogSetting() >-1) if (landscape->getDefaultFogSetting() >-1)
{ {
setFlagFog((bool) landscape->getDefaultFogSetting()) ; setFlagFog((bool) landscape->getDefaultFogSetting()) ;
landscape->setFlagShowFog((bool) landscape->getDefau ltFogSetting()); landscape->setFlagShowFog((bool) landscape->getDefau ltFogSetting());
} }
if (landscape->getDefaultBortleIndex() > 0) if (landscape->getDefaultBortleIndex() > 0)
{ {
setAtmosphereBortleLightPollution(landscape->getDefaultB setAtmosphereBortleLightPollution(landscape->getDefa
ortleIndex()); ultBortleIndex());
// TODO: HOWTO make the GUI aware of the new value? drawer->setBortleScale(landscape->getDefaultBortleIn
// conf->setValue("landscape/init_bortle_scale", landsca dex());
pe->getDefaultBortleIndex()); }
}
if (landscape->getDefaultAtmosphericExtinction() >= 0.0) if (landscape->getDefaultAtmosphericExtinction() >= 0.0)
{ {
drawer->setExtinctionCoefficient(landscape->getDefaultAt drawer->setExtinctionCoefficient(landscape->getDefau
mosphericExtinction()); ltAtmosphericExtinction());
} }
if (landscape->getDefaultAtmosphericTemperature() > -273.15) if (landscape->getDefaultAtmosphericTemperature() > -273.15)
{ {
drawer->setAtmosphereTemperature(landscape->getDefaultAt drawer->setAtmosphereTemperature(landscape->getDefau
mosphericTemperature()); ltAtmosphericTemperature());
} }
if (landscape->getDefaultAtmosphericPressure() >= 0.0) if (landscape->getDefaultAtmosphericPressure() >= 0.0)
{ {
drawer->setAtmospherePressure(landscape->getDefaultAtmos drawer->setAtmospherePressure(landscape->getDefaultA
phericPressure()); tmosphericPressure());
} }
else if (landscape->getDefaultAtmosphericPressure() == -1.0) else if (landscape->getDefaultAtmosphericPressure() == -1.0)
{ {
// compute standard pressure for standard atmosphere in // compute standard pressure for standard atmosphere
given altitude if landscape.ini coded as atmospheric_pressure=-1 in given altitude if landscape.ini coded as atmospheric_pressure=-1
// International altitude formula found in Wikipedia. // International altitude formula found in Wikipedia
double alt=landscape->getLocation().altitude; .
double p=1013.25*std::pow(1-(0.0065*alt)/288.15, 5.255); double alt=landscape->getLocation().altitude;
drawer->setAtmospherePressure(p); double p=1013.25*std::pow(1-(0.0065*alt)/288.15, 5.2
} 55);
drawer->setAtmospherePressure(p);
}
} }
return true; return true;
} }
bool LandscapeMgr::setCurrentLandscapeName(const QString& name) bool LandscapeMgr::setCurrentLandscapeName(const QString& name)
{ {
if (name.isEmpty()) if (name.isEmpty())
return false; return false;
QMap<QString,QString> nameToDirMap = getNameToDirMap(); QMap<QString,QString> nameToDirMap = getNameToDirMap();
 End of changes. 14 change blocks. 
34 lines changed or deleted 47 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/