MilkyWay.cpp   MilkyWay.cpp 
skipping to change at line 47 skipping to change at line 47
MilkyWay::MilkyWay() : color(1.f, 1.f, 1.f) MilkyWay::MilkyWay() : color(1.f, 1.f, 1.f)
{ {
setObjectName("MilkyWay"); setObjectName("MilkyWay");
fader = new LinearFader(); fader = new LinearFader();
} }
MilkyWay::~MilkyWay() MilkyWay::~MilkyWay()
{ {
delete fader; delete fader;
fader = NULL; fader = NULL;
delete vertexArray;
vertexArray = NULL;
} }
void MilkyWay::init() void MilkyWay::init()
{ {
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
Q_ASSERT(conf); Q_ASSERT(conf);
setTexture("milkyway.png"); tex = StelApp::getInstance().getTextureManager().createTexture("text ures/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.).toDouble()) setIntensity(conf->value("astro/milky_way_intensity",1.f).toFloat())
; ;
}
void MilkyWay::setTexture(const QString& texFile) vertexArray = new StelVertexArray(StelPainter::computeSphereNoLight(
{ 1.f,1.f,20,20,1));
tex = StelApp::getInstance().getTextureManager().createTexture(texFi
le);
} }
void MilkyWay::update(double deltaTime) {fader->update((int)(deltaTime*1000 ));} void MilkyWay::update(double deltaTime) {fader->update((int)(deltaTime*1000 ));}
void MilkyWay::setFlagShow(bool b){*fader = b;} void MilkyWay::setFlagShow(bool b){*fader = b;}
bool MilkyWay::getFlagShow(void) const {return *fader;} bool MilkyWay::getFlagShow() const {return *fader;}
void MilkyWay::draw(StelCore* core) void MilkyWay::draw(StelCore* core)
{ {
StelNavigator* nav = core->getNavigator(); StelNavigator* nav = core->getNavigator();
const StelProjectorP prj = core->getProjection(nav->getJ2000ModelVie wMat()* const StelProjectorP prj = core->getProjection(nav->getJ2000ModelVie wMat()*
Mat4d::xrotation(M_PI/180*23)* Mat4d::xrotation(M_PI/180*23)*
Mat4d::yrotation(M_PI/180*120)* Mat4d::yrotation(M_PI/180*120)*
Mat4d::zrotation(M_PI/180*7)); Mat4d::zrotation(M_PI/180*7));
StelToneReproducer* eye = core->getToneReproducer(); StelToneReproducer* eye = core->getToneReproducer();
Q_ASSERT(tex); // A texture must be loaded before calling this Q_ASSERT(tex); // A texture must be loaded before calling this
// This RGB color corresponds to the night blue scotopic color = 0.2 5, 0.25 in xyY mode. // This RGB color corresponds to the night blue scotopic color = 0.2 5, 0.25 in xyY mode.
// since milky way is always seen white RGB value in the texture (1. 0,1.0,1.0) // since milky way is always seen white RGB value in the texture (1. 0,1.0,1.0)
Vec3f c; Vec3f c;
if (StelApp::getInstance().getVisionModeNight()) if (StelApp::getInstance().getVisionModeNight())
c = Vec3f(0.34165, 0, 0); c = Vec3f(0.34165f, 0.f, 0.f);
else else
c = Vec3f(0.34165, 0.429666, 0.63586); c = Vec3f(0.34165f, 0.429666f, 0.63586f);
float lum = core->getSkyDrawer()->surfacebrightnessToLuminance(13.5) ; float lum = core->getSkyDrawer()->surfacebrightnessToLuminance(13.5f );
// 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 // Bound a maximum luminance
aLum = qMin(0.38, aLum*2.); 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;
if (c[0]<0) c[0]=0; if (c[0]<0) c[0]=0;
if (c[1]<0) c[1]=0; if (c[1]<0) c[1]=0;
if (c[2]<0) c[2]=0; if (c[2]<0) c[2]=0;
StelPainter sPainter(prj); StelPainter sPainter(prj);
sPainter.setColor(c[0],c[1],c[2]); sPainter.setColor(c[0],c[1],c[2]);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
sPainter.enableTexture2d(true); sPainter.enableTexture2d(true);
glDisable(GL_BLEND); glDisable(GL_BLEND);
tex->bind(); tex->bind();
sPainter.sSphere(1.,1.0,20,20,1); sPainter.drawStelVertexArray(*vertexArray);
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
} }
 End of changes. 10 change blocks. 
14 lines changed or deleted 14 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/