Atmosphere.cpp   Atmosphere.cpp 
skipping to change at line 42 skipping to change at line 42
inline bool myisnan(double value) inline bool myisnan(double value)
{ {
return value != value; return value != value;
} }
Atmosphere::Atmosphere(void) Atmosphere::Atmosphere(void)
: viewport(0,0,0,0) : viewport(0,0,0,0)
, skyResolutionY(44) , skyResolutionY(44)
, skyResolutionX(44) , skyResolutionX(44)
, posGrid(NULL) , posGrid(Q_NULLPTR)
, posGridBuffer(QOpenGLBuffer::VertexBuffer) , posGridBuffer(QOpenGLBuffer::VertexBuffer)
, indicesBuffer(QOpenGLBuffer::IndexBuffer) , indicesBuffer(QOpenGLBuffer::IndexBuffer)
, colorGrid(NULL) , colorGrid(Q_NULLPTR)
, colorGridBuffer(QOpenGLBuffer::VertexBuffer) , colorGridBuffer(QOpenGLBuffer::VertexBuffer)
, averageLuminance(0.f) , averageLuminance(0.f)
, overrideAverageLuminance(false) , overrideAverageLuminance(false)
, eclipseFactor(1.f) , eclipseFactor(1.f)
, lightPollutionLuminance(0) , lightPollutionLuminance(0)
{ {
setFadeDuration(1.5f); setFadeDuration(1.5f);
QOpenGLShader vShader(QOpenGLShader::Vertex); QOpenGLShader vShader(QOpenGLShader::Vertex);
if (!vShader.compileSourceFile(":/shaders/xyYToRGB.glsl")) if (!vShader.compileSourceFile(":/shaders/xyYToRGB.glsl"))
skipping to change at line 109 skipping to change at line 109
shaderAttribLocations.Ey = atmoShaderProgram->uniformLocation("Ey"); shaderAttribLocations.Ey = atmoShaderProgram->uniformLocation("Ey");
shaderAttribLocations.projectionMatrix = atmoShaderProgram->uniformL ocation("projectionMatrix"); shaderAttribLocations.projectionMatrix = atmoShaderProgram->uniformL ocation("projectionMatrix");
shaderAttribLocations.skyVertex = atmoShaderProgram->attributeLocati on("skyVertex"); shaderAttribLocations.skyVertex = atmoShaderProgram->attributeLocati on("skyVertex");
shaderAttribLocations.skyColor = atmoShaderProgram->attributeLocatio n("skyColor"); shaderAttribLocations.skyColor = atmoShaderProgram->attributeLocatio n("skyColor");
atmoShaderProgram->release(); atmoShaderProgram->release();
} }
Atmosphere::~Atmosphere(void) Atmosphere::~Atmosphere(void)
{ {
delete [] posGrid; delete [] posGrid;
posGrid = NULL; posGrid = Q_NULLPTR;
delete[] colorGrid; delete[] colorGrid;
colorGrid = NULL; colorGrid = Q_NULLPTR;
delete atmoShaderProgram; delete atmoShaderProgram;
atmoShaderProgram = NULL; atmoShaderProgram = Q_NULLPTR;
} }
void Atmosphere::computeColor(double JD, Vec3d _sunPos, Vec3d moonPos, floa t moonPhase, void Atmosphere::computeColor(double JD, Vec3d _sunPos, Vec3d moonPos, floa t moonPhase, float moonMagnitude,
StelCore* core, f loat latitude, float altitude, float temperature, float relativeHumidity) StelCore* core, f loat latitude, float altitude, float temperature, float relativeHumidity)
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz, StelCore::RefractionOff); const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz, StelCore::RefractionOff);
if (viewport != prj->getViewport()) if (viewport != prj->getViewport())
{ {
// The viewport changed: update the number of point of the g rid // The viewport changed: update the number of point of the g rid
viewport = prj->getViewport(); viewport = prj->getViewport();
delete[] colorGrid; delete[] colorGrid;
delete [] posGrid; delete [] posGrid;
skyResolutionY = StelApp::getInstance().getSettings()->value ("landscape/atmosphereybin", 44).toInt(); skyResolutionY = StelApp::getInstance().getSettings()->value ("landscape/atmosphereybin", 44).toInt();
skipping to change at line 175 skipping to change at line 175
} }
indicesBuffer.destroy(); indicesBuffer.destroy();
//indicesBuffer = QOpenGLBuffer(QOpenGLBuffer::IndexBuffer); //indicesBuffer = QOpenGLBuffer(QOpenGLBuffer::IndexBuffer);
Q_ASSERT(indicesBuffer.type()==QOpenGLBuffer::IndexBuffer); Q_ASSERT(indicesBuffer.type()==QOpenGLBuffer::IndexBuffer);
indicesBuffer.setUsagePattern(QOpenGLBuffer::StaticDraw); indicesBuffer.setUsagePattern(QOpenGLBuffer::StaticDraw);
indicesBuffer.create(); indicesBuffer.create();
indicesBuffer.bind(); indicesBuffer.bind();
indicesBuffer.allocate(indices, (skyResolutionX+1)*skyResolu tionY*2*2); indicesBuffer.allocate(indices, (skyResolutionX+1)*skyResolu tionY*2*2);
indicesBuffer.release(); indicesBuffer.release();
delete[] indices; delete[] indices;
indices=NULL; indices=Q_NULLPTR;
colorGridBuffer.destroy(); colorGridBuffer.destroy();
colorGridBuffer.setUsagePattern(QOpenGLBuffer::DynamicDraw); colorGridBuffer.setUsagePattern(QOpenGLBuffer::DynamicDraw);
colorGridBuffer.create(); colorGridBuffer.create();
colorGridBuffer.bind(); colorGridBuffer.bind();
colorGridBuffer.allocate(colorGrid, (1+skyResolutionX)*(1+sk yResolutionY)*4*4); colorGridBuffer.allocate(colorGrid, (1+skyResolutionX)*(1+sk yResolutionY)*4*4);
colorGridBuffer.release(); colorGridBuffer.release();
} }
if (myisnan(_sunPos.length())) if (myisnan(_sunPos.length()))
skipping to change at line 253 skipping to change at line 253
moon_pos[2] = moonPos[2]; moon_pos[2] = moonPos[2];
sky.setParamsv(sunPos, 5.f); sky.setParamsv(sunPos, 5.f);
skyb.setLocation(latitude * M_PI/180., altitude, temperature, relati veHumidity); skyb.setLocation(latitude * M_PI/180., altitude, temperature, relati veHumidity);
skyb.setSunMoon(moon_pos[2], sunPos[2]); skyb.setSunMoon(moon_pos[2], sunPos[2]);
// Calculate the date from the julian day. // Calculate the date from the julian day.
int year, month, day; int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day); StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
skyb.setDate(year, month, moonPhase); skyb.setDate(year, month, moonPhase, moonMagnitude);
// Variables used to compute the average sky luminance // Variables used to compute the average sky luminance
float sum_lum = 0.f; float sum_lum = 0.f;
Vec3d point(1., 0., 0.); Vec3d point(1., 0., 0.);
float lumi; float lumi;
// Compute the sky color for every point above the ground // Compute the sky color for every point above the ground
for (int i=0; i<(1+skyResolutionX)*(1+skyResolutionY); ++i) for (int i=0; i<(1+skyResolutionX)*(1+skyResolutionY); ++i)
{ {
 End of changes. 8 change blocks. 
8 lines changed or deleted 8 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/