StelSkyDrawer.cpp   StelSkyDrawer.cpp 
skipping to change at line 69 skipping to change at line 69
starRelativeScale(1.f), starRelativeScale(1.f),
starAbsoluteScaleF(1.f), starAbsoluteScaleF(1.f),
starLinearScale(19.569f), starLinearScale(19.569f),
limitMagnitude(-100.f), limitMagnitude(-100.f),
limitLuminance(0.f), limitLuminance(0.f),
customStarMagLimit(0.0), customStarMagLimit(0.0),
customNebulaMagLimit(0.0), customNebulaMagLimit(0.0),
customPlanetMagLimit(0.0), customPlanetMagLimit(0.0),
bortleScaleIndex(3), bortleScaleIndex(3),
inScale(1.f), inScale(1.f),
starShaderProgram(NULL), starShaderProgram(Q_NULLPTR),
starShaderVars(StarShaderVars()), starShaderVars(StarShaderVars()),
nbPointSources(0), nbPointSources(0),
maxPointSources(1000), maxPointSources(1000),
maxLum(0.f), maxLum(0.f),
oldLum(-1.f), oldLum(-1.f),
flagLuminanceAdaptation(false), flagLuminanceAdaptation(false),
big3dModelHaloRadius(150.f) big3dModelHaloRadius(150.f)
{ {
setObjectName("StelSkyDrawer"); setObjectName("StelSkyDrawer");
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
skipping to change at line 145 skipping to change at line 145
{ {
static const unsigned char texElems[] = {0, 0, 255, 0, 255, 255, 0, 0, 255, 255, 0, 255}; static const unsigned char texElems[] = {0, 0, 255, 0, 255, 255, 0, 0, 255, 255, 0, 255};
unsigned char* elem = &textureCoordArray[i*6*2]; unsigned char* elem = &textureCoordArray[i*6*2];
memcpy(elem, texElems, 12); memcpy(elem, texElems, 12);
} }
} }
StelSkyDrawer::~StelSkyDrawer() StelSkyDrawer::~StelSkyDrawer()
{ {
delete[] vertexArray; delete[] vertexArray;
vertexArray = NULL; vertexArray = Q_NULLPTR;
delete[] textureCoordArray; delete[] textureCoordArray;
textureCoordArray = NULL; textureCoordArray = Q_NULLPTR;
delete starShaderProgram; delete starShaderProgram;
starShaderProgram = NULL; starShaderProgram = Q_NULLPTR;
} }
// Init parameters from config file // Init parameters from config file
void StelSkyDrawer::init() void StelSkyDrawer::init()
{ {
initializeOpenGLFunctions(); initializeOpenGLFunctions();
// Load star texture no mipmap: // Load star texture no mipmap:
texHalo = StelApp::getInstance().getTextureManager().createTexture(S telFileMgr::getInstallationDir()+"/textures/star16x16.png"); texHalo = StelApp::getInstance().getTextureManager().createTexture(S telFileMgr::getInstallationDir()+"/textures/star16x16.png");
texBigHalo = StelApp::getInstance().getTextureManager().createTextur e(StelFileMgr::getInstallationDir()+"/textures/haloLune.png"); texBigHalo = StelApp::getInstance().getTextureManager().createTextur e(StelFileMgr::getInstallationDir()+"/textures/haloLune.png");
skipping to change at line 328 skipping to change at line 328
{ {
return -0.92103f*(mag + 12.12331f) + lnfovFactor; return -0.92103f*(mag + 12.12331f) + lnfovFactor;
} }
float StelSkyDrawer::pointSourceLuminanceToMag(float lum) float StelSkyDrawer::pointSourceLuminanceToMag(float lum)
{ {
return (std::log(lum) - lnfovFactor)/-0.92103f - 12.12331f; return (std::log(lum) - lnfovFactor)/-0.92103f - 12.12331f;
} }
// Compute the luminance for an extended source with the given surface brig htness in Vmag/arcmin^2 // Compute the luminance for an extended source with the given surface brig htness in Vmag/arcmin^2
float StelSkyDrawer::surfacebrightnessToLuminance(float sb) float StelSkyDrawer::surfaceBrightnessToLuminance(float sb)
{ {
return 2.f*2025000.f*std::exp(-0.92103f*(sb + 12.12331f))/(1.f/60.f* 1.f/60.f); return 2.f*2025000.f*std::exp(-0.92103f*(sb + 12.12331f))/(1.f/60.f* 1.f/60.f);
} }
// Compute the surface brightness from the luminance of an extended source // Compute the surface brightness from the luminance of an extended source
float StelSkyDrawer::luminanceToSurfacebrightness(float lum) float StelSkyDrawer::luminanceToSurfacebrightness(float lum)
{ {
return std::log(lum*(1.f/60.f*1.f/60.f)/(2.f*2025000.f))/-0.92103f - 12.12331f; return std::log(lum*(1.f/60.f*1.f/60.f)/(2.f*2025000.f))/-0.92103f - 12.12331f;
} }
skipping to change at line 429 skipping to change at line 429
} }
// Draw a point source halo. // Draw a point source halo.
bool StelSkyDrawer::drawPointSource(StelPainter* sPainter, const Vec3f& v, const RCMag& rcMag, const Vec3f& color, bool checkInScreen, float twinkleFa ctor) bool StelSkyDrawer::drawPointSource(StelPainter* sPainter, const Vec3f& v, const RCMag& rcMag, const Vec3f& color, bool checkInScreen, float twinkleFa ctor)
{ {
Q_ASSERT(sPainter); Q_ASSERT(sPainter);
if (rcMag.radius<=0.f) if (rcMag.radius<=0.f)
return false; return false;
// Why do we need Vec3d here? Try with Vec3f win.
// Vec3d win;
// if (!(checkInScreen ? sPainter->getProjector()->projectCheck(Vec3d(v
[0],v[1],v[2]), win) : sPainter->getProjector()->project(Vec3d(v[0],v[1],v[
2]), win)))
// return false;
Vec3f win; Vec3f win;
if (!(checkInScreen ? sPainter->getProjector()->projectCheck(v, win) : sPainter->getProjector()->project(v, win))) if (!(checkInScreen ? sPainter->getProjector()->projectCheck(v, win) : sPainter->getProjector()->project(v, win)))
return false; return false;
const float radius = rcMag.radius; const float radius = rcMag.radius;
// Random coef for star twinkling. twinkleFactor can introduce heigh t-dependent twinkling. // Random coef for star twinkling. twinkleFactor can introduce heigh t-dependent twinkling.
const float tw = (flagStarTwinkle && (flagHasAtmosphere || flagForce dTwinkle)) ? (1.f-twinkleFactor*twinkleAmount*qrand()/RAND_MAX)*rcMag.lumin ance : rcMag.luminance; const float tw = (flagStarTwinkle && (flagHasAtmosphere || flagForce dTwinkle)) ? (1.f-twinkleFactor*twinkleAmount*qrand()/RAND_MAX)*rcMag.lumin ance : rcMag.luminance;
// If the rmag is big, draw a big halo // If the rmag is big, draw a big halo
if (radius>MAX_LINEAR_RADIUS+5.f) if (radius>MAX_LINEAR_RADIUS+5.f)
skipping to change at line 687 skipping to change at line 683
bortleScaleIndex = bIndex; bortleScaleIndex = bIndex;
emit bortleScaleIndexChanged(bortleScaleIndex); emit bortleScaleIndexChanged(bortleScaleIndex);
// GZ: I moved this block to update() // GZ: I moved this block to update()
// These value have been calibrated by hand, looking at the faintest star in stellarium at around 40 deg FOV // These value have been calibrated by hand, looking at the faintest star in stellarium at around 40 deg FOV
// They should roughly match the scale described at http://e n.wikipedia.org/wiki/Bortle_Dark-Sky_Scale // They should roughly match the scale described at http://e n.wikipedia.org/wiki/Bortle_Dark-Sky_Scale
// static const float bortleToInScale[9] = {2.45, 1.55, 1.0, 0.63, 0.40, 0.24, 0.23, 0.145, 0.09}; // static const float bortleToInScale[9] = {2.45, 1.55, 1.0, 0.63, 0.40, 0.24, 0.23, 0.145, 0.09};
// setInputScale(bortleToInScale[bIndex-1]); // setInputScale(bortleToInScale[bIndex-1]);
} }
} }
float StelSkyDrawer::getNELMFromBortleScale() const
{
float nelm = 0.f;
switch (getBortleScaleIndex()) {
case 1:
nelm = 7.8f; // Class 1 = NELM 7.6–8.0; average NELM
is 7.8
break;
case 2:
nelm = 7.3f; // Class 2 = NELM 7.1–7.5; average NELM
is 7.3
break;
case 3:
nelm = 6.8f; // Class 3 = NELM 6.6–7.0; average NELM
is 6.8
break;
case 4:
nelm = 6.3f; // Class 4 = NELM 6.1–6.5; average NELM
is 6.3
break;
case 5:
nelm = 5.8f; // Class 5 = NELM 5.6–6.0; average NELM
is 5.8
break;
case 6:
nelm = 5.3f; // Class 6 = NELM 5.1-5.5; average NELM
is 5.3
break;
case 7:
nelm = 4.8f; // Class 7 = NELM 4.6–5.0; average NELM
is 4.8
break;
case 8:
nelm = 4.3f; // Class 8 = NELM 4.1–4.5; average NELM
is 4.3
break;
case 9:
nelm = 4.0f; // Class 8 = NELM 4.0
break;
}
return nelm;
}
// New colors // New colors
Vec3f StelSkyDrawer::colorTable[128] = { Vec3f StelSkyDrawer::colorTable[128] = {
Vec3f(0.602745,0.713725,1.000000), Vec3f(0.602745,0.713725,1.000000),
Vec3f(0.604902,0.715294,1.000000), Vec3f(0.604902,0.715294,1.000000),
Vec3f(0.607059,0.716863,1.000000), Vec3f(0.607059,0.716863,1.000000),
Vec3f(0.609215,0.718431,1.000000), Vec3f(0.609215,0.718431,1.000000),
Vec3f(0.611372,0.720000,1.000000), Vec3f(0.611372,0.720000,1.000000),
Vec3f(0.613529,0.721569,1.000000), Vec3f(0.613529,0.721569,1.000000),
Vec3f(0.635490,0.737255,1.000000), Vec3f(0.635490,0.737255,1.000000),
Vec3f(0.651059,0.749673,1.000000), Vec3f(0.651059,0.749673,1.000000),
 End of changes. 7 change blocks. 
11 lines changed or deleted 48 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/