LandscapeMgr.cpp   LandscapeMgr.cpp 
skipping to change at line 119 skipping to change at line 119
sPainter.setColor(color[0],color[1],color[2],fader.getInterstate()); sPainter.setColor(color[0],color[1],color[2],fader.getInterstate());
glEnable(GL_BLEND); glEnable(GL_BLEND);
sPainter.enableTexture2d(true); sPainter.enableTexture2d(true);
// Normal transparency mode // Normal transparency mode
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Vec3f pos; Vec3f pos;
Vec3f xy; Vec3f xy;
float shift = sPainter.getFontMetrics().width(sNorth)/2; float shift = sPainter.getFontMetrics().width(sNorth)/2.;
if (core->getProjection(StelCore::FrameJ2000)->getMaskType() == Stel Projector::MaskDisk) if (core->getProjection(StelCore::FrameJ2000)->getMaskType() == Stel Projector::MaskDisk)
shift = 0; shift = 0;
// N for North // N for North
pos.set(-1.f, 0.f, 0.f); pos.set(-1.f, 0.f, 0.f);
if (prj->project(pos,xy)) sPainter.drawText(xy[0], xy[1], d[0], 0., -shift, -shift, false); if (prj->project(pos,xy)) sPainter.drawText(xy[0], xy[1], d[0], 0., -shift, -shift, false);
// S for South // S for South
pos.set(1.f, 0.f, 0.f); pos.set(1.f, 0.f, 0.f);
if (prj->project(pos,xy)) sPainter.drawText(xy[0], xy[1], d[1], 0., -shift, -shift, false); if (prj->project(pos,xy)) sPainter.drawText(xy[0], xy[1], d[1], 0., -shift, -shift, false);
skipping to change at line 294 skipping to change at line 294
// Brightness can't be over 1.f (see https://bugs.launchpad.net/stel larium/+bug/1115364) // Brightness can't be over 1.f (see https://bugs.launchpad.net/stel larium/+bug/1115364)
if (landscapeBrightness>0.95) if (landscapeBrightness>0.95)
landscapeBrightness = 0.95; landscapeBrightness = 0.95;
if (core->getCurrentLocation().planetName.contains("Sun")) if (core->getCurrentLocation().planetName.contains("Sun"))
{ {
// NOTE: Simple workaround for brightness of landscape when observing from the Sun. // NOTE: Simple workaround for brightness of landscape when observing from the Sun.
landscape->setBrightness(1.f, 0.0f); landscape->setBrightness(1.f, 0.0f);
} }
else else
{ float lightscapeBrightness=0.0f; {
float lightscapeBrightness=0.0f;
// light pollution layer is mixed in at -3...-8 degrees. // light pollution layer is mixed in at -3...-8 degrees.
if (sunPos[2]<-0.14f) lightscapeBrightness=1.0f; float sunAlt = sunPos[2];
else if (sunPos[2]<-0.05f) lightscapeBrightness = 1.0f-(sunP if (sunAlt<-0.14f)
os[2]+0.14)/(-0.05+0.14); lightscapeBrightness=1.0f;
landscape->setBrightness(landscapeBrightness, lightscapeBrig else
htness); {
if (sunAlt<-0.05f)
lightscapeBrightness = 1.0f-(sunAlt+0.14)/(-
0.05+0.14);
}
if (sunAlt<=0.f && !atmosphere->getFlagShow() && !getFlagLan
dscapeUseMinimalBrightness())
landscape->setBrightness(0.f, 0.f);
else
landscape->setBrightness(landscapeBrightness, lights
capeBrightness);
} }
} }
void LandscapeMgr::draw(StelCore* core) void LandscapeMgr::draw(StelCore* core)
{ {
// Draw the atmosphere // Draw the atmosphere
atmosphere->draw(core); atmosphere->draw(core);
// Draw the landscape // Draw the landscape
landscape->draw(core); landscape->draw(core);
skipping to change at line 369 skipping to change at line 379
void LandscapeMgr::setStelStyle(const QString& section) void LandscapeMgr::setStelStyle(const QString& section)
{ {
// Load colors from config file // Load colors from config file
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
QString defaultColor = conf->value(section+"/default_color").toStrin g(); QString defaultColor = conf->value(section+"/default_color").toStrin g();
setColorCardinalPoints(StelUtils::strToVec3f(conf->value(section+"/c ardinal_color", defaultColor).toString())); setColorCardinalPoints(StelUtils::strToVec3f(conf->value(section+"/c ardinal_color", defaultColor).toString()));
} }
bool LandscapeMgr::setCurrentLandscapeID(const QString& id) bool LandscapeMgr::setCurrentLandscapeID(const QString& id, const double ch angeLocationDuration)
{ {
if (id.isEmpty()) if (id.isEmpty())
return false; return false;
// We want to lookup the landscape ID (dir) from the name. // We want to lookup the landscape ID (dir) from the name.
Landscape* newLandscape = createFromFile(StelFileMgr::findFile("land scapes/" + id + "/landscape.ini"), id); Landscape* newLandscape = createFromFile(StelFileMgr::findFile("land scapes/" + id + "/landscape.ini"), id);
if (!newLandscape) if (!newLandscape)
{ {
qWarning() << "ERROR while loading default landscape " << "l andscapes/" + id + "/landscape.ini"; qWarning() << "ERROR while loading default landscape " << "l andscapes/" + id + "/landscape.ini";
skipping to change at line 396 skipping to change at line 406
newLandscape->setFlagShow(landscape->getFlagShow()); newLandscape->setFlagShow(landscape->getFlagShow());
newLandscape->setFlagShowFog(landscape->getFlagShowFog()); newLandscape->setFlagShowFog(landscape->getFlagShowFog());
newLandscape->setFlagShowIllumination(landscape->getFlagShow Illumination()); newLandscape->setFlagShowIllumination(landscape->getFlagShow Illumination());
delete landscape; delete landscape;
landscape = newLandscape; landscape = newLandscape;
} }
currentLandscapeID = id; currentLandscapeID = id;
if (getFlagLandscapeSetsLocation() && landscape->hasLocation()) if (getFlagLandscapeSetsLocation() && landscape->hasLocation())
{ {
StelApp::getInstance().getCore()->moveObserverTo(landscape-> getLocation()); StelApp::getInstance().getCore()->moveObserverTo(landscape-> getLocation(), changeLocationDuration);
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->getDefa ultBortleIndex()); setAtmosphereBortleLightPollution(landscape->getDefa ultBortleIndex());
skipping to change at line 434 skipping to change at line 444
// International altitude formula found in Wikipedia . // International altitude formula found in Wikipedia .
double alt=landscape->getLocation().altitude; double alt=landscape->getLocation().altitude;
double p=1013.25*std::pow(1-(0.0065*alt)/288.15, 5.2 55); double p=1013.25*std::pow(1-(0.0065*alt)/288.15, 5.2 55);
drawer->setAtmospherePressure(p); drawer->setAtmospherePressure(p);
} }
} }
// else qDebug() << "Will not set new location; Landscape location: planet: " << landscape->getLocation().planetName << "name: " << landscape-> getLocation().name; // else qDebug() << "Will not set new location; Landscape location: planet: " << landscape->getLocation().planetName << "name: " << landscape-> getLocation().name;
return true; return true;
} }
bool LandscapeMgr::setCurrentLandscapeName(const QString& name) bool LandscapeMgr::setCurrentLandscapeName(const QString& name, const doubl e changeLocationDuration)
{ {
if (name.isEmpty()) if (name.isEmpty())
return false; return false;
QMap<QString,QString> nameToDirMap = getNameToDirMap(); QMap<QString,QString> nameToDirMap = getNameToDirMap();
if (nameToDirMap.find(name)!=nameToDirMap.end()) if (nameToDirMap.find(name)!=nameToDirMap.end())
{ {
return setCurrentLandscapeID(nameToDirMap[name]); return setCurrentLandscapeID(nameToDirMap[name], changeLocat ionDuration);
} }
else else
{ {
qWarning() << "Can't find a landscape with name=" << name << endl; qWarning() << "Can't find a landscape with name=" << name << endl;
return false; return false;
} }
} }
// Change the default landscape to the landscape with the ID specified. // Change the default landscape to the landscape with the ID specified.
bool LandscapeMgr::setDefaultLandscapeID(const QString& id) bool LandscapeMgr::setDefaultLandscapeID(const QString& id)
skipping to change at line 551 skipping to change at line 561
bool LandscapeMgr::getFlagAtmosphereAutoEnable() const bool LandscapeMgr::getFlagAtmosphereAutoEnable() const
{ {
return flagAtmosphereAutoEnabling; return flagAtmosphereAutoEnabling;
} }
/********************************************************************* /*********************************************************************
Retrieve list of the names of all the available landscapes Retrieve list of the names of all the available landscapes
*********************************************************************/ *********************************************************************/
QStringList LandscapeMgr::getAllLandscapeNames() const QStringList LandscapeMgr::getAllLandscapeNames() const
{ {
QMap<QString,QString> nameToDirMap = getNameToDirMap(); return getNameToDirMap().keys();
QStringList result;
// We just look over the map of names to IDs and extract the keys
foreach (QString i, nameToDirMap.keys())
{
result += i;
}
return result;
} }
QStringList LandscapeMgr::getAllLandscapeIDs() const QStringList LandscapeMgr::getAllLandscapeIDs() const
{ {
QMap<QString,QString> nameToDirMap = getNameToDirMap(); return getNameToDirMap().values();
QStringList result;
// We just look over the map of names to IDs and extract the keys
foreach (QString i, nameToDirMap.values())
{
result += i;
}
return result;
} }
QStringList LandscapeMgr::getUserLandscapeIDs() const QStringList LandscapeMgr::getUserLandscapeIDs() const
{ {
QMap<QString,QString> nameToDirMap = getNameToDirMap();
QStringList result; QStringList result;
foreach (QString id, nameToDirMap.values()) foreach (QString id, getNameToDirMap().values())
{ {
if(!packagedLandscapeIDs.contains(id)) if(!packagedLandscapeIDs.contains(id))
{ {
result += id; result.append(id);
} }
} }
return result; return result;
} }
QString LandscapeMgr::getCurrentLandscapeName() const QString LandscapeMgr::getCurrentLandscapeName() const
{ {
return landscape->getName(); return landscape->getName();
} }
 End of changes. 12 change blocks. 
32 lines changed or deleted 26 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/