Atmosphere.cpp   Atmosphere.cpp 
skipping to change at line 43 skipping to change at line 43
#include "StelToneReproducer.hpp" #include "StelToneReproducer.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
inline bool myisnan(double value) inline bool myisnan(double value)
{ {
return value != value; return value != value;
} }
Atmosphere::Atmosphere(void) :viewport(0,0,0,0),skyResolutionY(44), posGrid (NULL), colorGrid(NULL), indices(NULL), Atmosphere::Atmosphere(void) :viewport(0,0,0,0), posGrid(NULL), colorGrid(N ULL), indices(NULL),
averageLuminance(0.f), eclipseFac tor(1.f), lightPollutionLuminance(0) averageLuminance(0.f), eclipseFac tor(1.f), lightPollutionLuminance(0)
{ {
setFadeDuration(3.f); setFadeDuration(1.5f);
useShader = StelApp::getInstance().getUseGLShaders(); useShader = StelApp::getInstance().getUseGLShaders();
if (useShader) if (useShader)
{ {
QString filePath; qDebug() << "Use vertex shader for atmosphere rendering.";
try
{
filePath = StelFileMgr::findFile("data/shaders/xyYTo
RGB.glsl");
}
catch (std::runtime_error& e)
{
qFatal("Can't find data/shaders/xyYToRGB.glsl shader
file to load");
}
qDebug() << "Use vertex shader for atmosphere rendering: " <
< filePath;
QGLShader* vShader = new QGLShader(QGLShader::Vertex); QGLShader* vShader = new QGLShader(QGLShader::Vertex);
if (!vShader->compileSourceFile(filePath)) if (!vShader->compileSourceFile(":/shaders/xyYToRGB.glsl"))
{ {
qWarning() << "Error while compiling shader: " << vS hader->log(); qWarning() << "Error while compiling shader: " << vS hader->log();
useShader = false; useShader = false;
} }
if (!vShader->log().isEmpty()) if (!vShader->log().isEmpty())
{ {
qWarning() << "Warnings while compiling vertex shade r: " << vShader->log(); qWarning() << "Warnings while compiling vertex shade r: " << vShader->log();
} }
QGLShader* fShader = new QGLShader(QGLShader::Fragment); QGLShader* fShader = new QGLShader(QGLShader::Fragment);
if (!fShader->compileSourceCode( if (!fShader->compileSourceCode(
skipping to change at line 160 skipping to change at line 151
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();
if (posGrid) if (posGrid)
delete[] posGrid; delete[] posGrid;
if (colorGrid) if (colorGrid)
delete[] colorGrid; delete[] colorGrid;
if (indices) if (indices)
delete[] indices; delete[] indices;
skyResolutionY = StelApp::getInstance().getSettings()->value ("landscape/atmosphereybin", 44).toInt();
skyResolutionX = (int)floor(0.5+skyResolutionY*(0.5*sqrt(3.0 ))*prj->getViewportWidth()/prj->getViewportHeight()); skyResolutionX = (int)floor(0.5+skyResolutionY*(0.5*sqrt(3.0 ))*prj->getViewportWidth()/prj->getViewportHeight());
posGrid = new Vec2f[(1+skyResolutionX)*(1+skyResolutionY)]; posGrid = new Vec2f[(1+skyResolutionX)*(1+skyResolutionY)];
colorGrid = new Vec4f[(1+skyResolutionX)*(1+skyResolutionY)] ; colorGrid = new Vec4f[(1+skyResolutionX)*(1+skyResolutionY)] ;
float stepX = (float)prj->getViewportWidth() / (skyResolutio nX-0.5); float stepX = (float)prj->getViewportWidth() / (skyResolutio nX-0.5);
float stepY = (float)prj->getViewportHeight() / skyResolutio nY; float stepY = (float)prj->getViewportHeight() / skyResolutio nY;
float viewport_left = (float)prj->getViewportPosX(); float viewport_left = (float)prj->getViewportPosX();
float viewport_bottom = (float)prj->getViewportPosY(); float viewport_bottom = (float)prj->getViewportPosY();
for (int x=0; x<=skyResolutionX; ++x) for (int x=0; x<=skyResolutionX; ++x)
{ {
for(int y=0; y<=skyResolutionY; ++y) for(int y=0; y<=skyResolutionY; ++y)
 End of changes. 5 change blocks. 
16 lines changed or deleted 5 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/