MilkyWay.cpp   MilkyWay.cpp 
skipping to change at line 37 skipping to change at line 37
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelToneReproducer.hpp" #include "StelToneReproducer.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include "StelMovementMgr.hpp"
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
// Class which manages the displaying of the Milky Way // Class which manages the displaying of the Milky Way
MilkyWay::MilkyWay() MilkyWay::MilkyWay()
: color(1.f, 1.f, 1.f) : color(1.f, 1.f, 1.f)
, intensity(1.) , intensity(1.)
, intensityFovScale(1.0f)
, intensityMinFov(0.25f) // when zooming in further, MilkyWay is no
longer visible.
, intensityMaxFov(2.5f) // when zooming out further, MilkyWay is ful
ly visible (when enabled).
, vertexArray() , vertexArray()
{ {
setObjectName("MilkyWay"); setObjectName("MilkyWay");
fader = new LinearFader(); fader = new LinearFader();
} }
MilkyWay::~MilkyWay() MilkyWay::~MilkyWay()
{ {
delete fader; delete fader;
fader = NULL; fader = Q_NULLPTR;
delete vertexArray; delete vertexArray;
vertexArray = NULL; vertexArray = Q_NULLPTR;
} }
void MilkyWay::init() void MilkyWay::init()
{ {
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
Q_ASSERT(conf); Q_ASSERT(conf);
tex = StelApp::getInstance().getTextureManager().createTexture(StelF ileMgr::getInstallationDir()+"/textures/milkyway.png"); tex = StelApp::getInstance().getTextureManager().createTexture(StelF ileMgr::getInstallationDir()+"/textures/milkyway.png");
setFlagShow(conf->value("astro/flag_milky_way").toBool()); setFlagShow(conf->value("astro/flag_milky_way").toBool());
setIntensity(conf->value("astro/milky_way_intensity",1.f).toFloat()) ; setIntensity(conf->value("astro/milky_way_intensity",1.f).toFloat()) ;
skipping to change at line 81 skipping to change at line 85
vertexArray->colors.resize(vertexArray->vertex.length()); vertexArray->colors.resize(vertexArray->vertex.length());
vertexArray->colors.fill(Vec3f(1.0, 0.3, 0.9)); vertexArray->colors.fill(Vec3f(1.0, 0.3, 0.9));
QString displayGroup = N_("Display Options"); QString displayGroup = N_("Display Options");
addAction("actionShow_MilkyWay", displayGroup, N_("Milky Way"), "fla gMilkyWayDisplayed", "M"); addAction("actionShow_MilkyWay", displayGroup, N_("Milky Way"), "fla gMilkyWayDisplayed", "M");
} }
void MilkyWay::update(double deltaTime) void MilkyWay::update(double deltaTime)
{ {
fader->update((int)(deltaTime*1000)); fader->update((int)(deltaTime*1000));
//calculate FOV fade value, linear fade between intensityMaxFov and
intensityMinFov
double fov = StelApp::getInstance().getCore()->getMovementMgr()->get
CurrentFov();
intensityFovScale = qBound(0.0,(fov - intensityMinFov) / (intensityM
axFov - intensityMinFov),1.0);
} }
/************************************************************************* /*************************************************************************
Reimplementation of the getCallOrder method Reimplementation of the getCallOrder method
*************************************************************************/ *************************************************************************/
double MilkyWay::getCallOrder(StelModuleActionName actionName) const double MilkyWay::getCallOrder(StelModuleActionName actionName) const
{ {
if (actionName==StelModule::ActionDraw) if (actionName==StelModule::ActionDraw)
return 1; return 1;
return 0; return 0;
} }
void MilkyWay::setFlagShow(bool b){*fader = b; emit milkyWayDisplayedChange void MilkyWay::setFlagShow(bool b)
d(b);} {
if (*fader != b)
{
*fader = b;
emit milkyWayDisplayedChanged(b);
}
}
bool MilkyWay::getFlagShow() const {return *fader;} bool MilkyWay::getFlagShow() const {return *fader;}
void MilkyWay::draw(StelCore* core) void MilkyWay::draw(StelCore* core)
{ {
if (!getFlagShow()) if (!getFlagShow())
return; return;
StelProjector::ModelViewTranformP transfo = core->getJ2000ModelViewT ransform(); StelProjector::ModelViewTranformP transfo = core->getJ2000ModelViewT ransform();
const StelProjectorP prj = core->getProjection(transfo); // GZ: Mayb e this can now be simplified? const StelProjectorP prj = core->getProjection(transfo); // GZ: Mayb e this can now be simplified?
skipping to change at line 124 skipping to change at line 139
// The new texture (V0.13.1) is quite blue to start with. It is bett er to apply white color for it. // The new texture (V0.13.1) is quite blue to start with. It is bett er to apply white color for it.
//Vec3f c = Vec3f(1.0f, 1.0f, 1.0f); //Vec3f c = Vec3f(1.0f, 1.0f, 1.0f);
// Still better: Re-activate the configurable color! // Still better: Re-activate the configurable color!
Vec3f c = color; Vec3f c = color;
// We must also adjust milky way to light pollution. // We must also adjust milky way to light pollution.
// Is there any way to calibrate this? // Is there any way to calibrate this?
int bortle=drawer->getBortleScaleIndex(); int bortle=drawer->getBortleScaleIndex();
//aLum*=(11.0f-bortle)*0.1f; //aLum*=(11.0f-bortle)*0.1f;
float lum = drawer->surfacebrightnessToLuminance(12.f+0.15*bortle); // was 11.5; Source? How to calibrate the new texture? float lum = drawer->surfaceBrightnessToLuminance(12.f+0.15*bortle); // was 11.5; Source? How to calibrate the new texture?
// Get the luminance scaled between 0 and 1 // Get the luminance scaled between 0 and 1
float aLum =eye->adaptLuminanceScaled(lum*fader->getInterstate()); float aLum =eye->adaptLuminanceScaled(lum*fader->getInterstate());
// Bound a maximum luminance. GZ: Is there any reference/reason, or just trial and error? // Bound a maximum luminance. GZ: Is there any reference/reason, or just trial and error?
aLum = qMin(0.38f, aLum*2.f); aLum = qMin(0.38f, aLum*2.f);
// intensity of 1.0 is "proper", but allow boost for dim screens // intensity of 1.0 is "proper", but allow boost for dim screens
c*=aLum*intensity; c*=aLum*intensity*intensityFovScale;
// TODO: Find an even better balance with sky brightness, MW should be hard to see during Full Moon and at least somewhat reduced in smaller ph ases. // TODO: Find an even better balance with sky brightness, MW should be hard to see during Full Moon and at least somewhat reduced in smaller ph ases.
// adapt brightness by atmospheric brightness. This block developed for ZodiacalLight, hopefully similarly applicable... // adapt brightness by atmospheric brightness. This block developed for ZodiacalLight, hopefully similarly applicable...
const float atmLum = GETSTELMODULE(LandscapeMgr)->getAtmosphereAvera geLuminance(); const float atmLum = GETSTELMODULE(LandscapeMgr)->getAtmosphereAvera geLuminance();
// 10cd/m^2 at sunset, 3.3 at civil twilight (sun at -6deg). 0.0145 sun at -12, 0.0004 sun at -18, 0.01 at Full Moon!? // 10cd/m^2 at sunset, 3.3 at civil twilight (sun at -6deg). 0.0145 sun at -12, 0.0004 sun at -18, 0.01 at Full Moon!?
//qDebug() << "AtmLum: " << atmLum; //qDebug() << "AtmLum: " << atmLum;
float atmFactor=qMax(0.35f, 50.0f*(0.02f-atmLum)); // keep visible i n twilight, but this is enough for some effect with the moon. float atmFactor=qMax(0.35f, 50.0f*(0.02f-atmLum)); // keep visible i n twilight, but this is enough for some effect with the moon.
c*=atmFactor*atmFactor; c*=atmFactor*atmFactor;
if (c[0]<0) c[0]=0; if (c[0]<0) c[0]=0;
 End of changes. 8 change blocks. 
6 lines changed or deleted 25 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/