Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package CalcMySky for openSUSE:Factory 
checked in at 2023-07-05 15:31:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/CalcMySky (Old)
 and      /work/SRC/openSUSE:Factory/.CalcMySky.new.23466 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "CalcMySky"

Wed Jul  5 15:31:19 2023 rev:3 rq:1096895 version:0.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/CalcMySky/CalcMySky.changes      2023-04-20 
15:16:01.162490993 +0200
+++ /work/SRC/openSUSE:Factory/.CalcMySky.new.23466/CalcMySky.changes   
2023-07-05 15:31:37.930947943 +0200
@@ -1,0 +2,9 @@
+Wed Jun 28 06:45:20 UTC 2023 - Paolo Stivanin <[email protected]>
+
+- Update to 0.3.1:
+  * on GPUs that compute mip maps of non-power-of-two textures poorly,
+    eclipsed atmosphere rendering now works as expected;
+  * atmosphere model examples now don't include Rayleigh phase function
+    in the texture, this change fixes a "round cap around zenith" artifact.
+
+-------------------------------------------------------------------

Old:
----
  CalcMySky-0.3.0.tar.gz

New:
----
  CalcMySky-0.3.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ CalcMySky.spec ++++++
--- /var/tmp/diff_new_pack.ChAcxT/_old  2023-07-05 15:31:41.006966191 +0200
+++ /var/tmp/diff_new_pack.ChAcxT/_new  2023-07-05 15:31:41.058966500 +0200
@@ -24,7 +24,7 @@
 %endif
 
 Name:           CalcMySky
-Version:        0.3.0
+Version:        0.3.1
 Release:        0
 Summary:        Software package that simulates scattering of light by the 
atmosphere
 License:        GPL-3.0-or-later

++++++ CalcMySky-0.3.0.tar.gz -> CalcMySky-0.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/CMakeLists.txt 
new/CalcMySky-0.3.1/CMakeLists.txt
--- old/CalcMySky-0.3.0/CMakeLists.txt  2023-03-28 21:00:36.000000000 +0200
+++ new/CalcMySky-0.3.1/CMakeLists.txt  2023-06-15 21:21:38.000000000 +0200
@@ -3,7 +3,7 @@
     cmake_policy(SET CMP0110 OLD)
 endif()
 
-set(staticProjectVersion 0.3.0)
+set(staticProjectVersion 0.3.1)
 project(CalcMySky VERSION ${staticProjectVersion} LANGUAGES CXX)
 set(CMAKE_FIND_USE_PACKAGE_REGISTRY false)
 
@@ -123,6 +123,7 @@
 add_library(version STATIC "${PROJECT_BINARY_DIR}/version.cpp")
 add_library(common STATIC
              common/EclipsedDoubleScatteringPrecomputer.cpp
+             common/TextureAverageComputer.cpp
              common/AtmosphereParameters.cpp
              common/Spectrum.cpp
              common/util.cpp)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/CalcMySky/main.cpp 
new/CalcMySky-0.3.1/CalcMySky/main.cpp
--- old/CalcMySky-0.3.0/CalcMySky/main.cpp      2023-03-28 21:00:36.000000000 
+0200
+++ new/CalcMySky-0.3.1/CalcMySky/main.cpp      2023-06-15 21:21:38.000000000 
+0200
@@ -25,6 +25,7 @@
 #include "shaders.hpp"
 #include "interpolation-guides.hpp"
 #include "../common/EclipsedDoubleScatteringPrecomputer.hpp"
+#include "../common/TextureAverageComputer.hpp"
 #include "../common/timing.hpp"
 
 QOpenGLFunctions_3_3_Core gl;
@@ -1237,6 +1238,10 @@
 
         const auto timeBegin=std::chrono::steady_clock::now();
 
+        // Initialize texture averager before anything to make it emit possible
+        // warnings not mixing them into computation status reports.
+        TextureAverageComputer{gl, 10, 10, GL_RGBA32F, 0};
+
         for(unsigned texIndex=0;texIndex<atmo.allWavelengths.size();++texIndex)
         {
             std::cerr << "Working on wavelengths " << 
atmo.allWavelengths[texIndex][0] << ", "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/ShowMySky/GLWidget.cpp 
new/CalcMySky-0.3.1/ShowMySky/GLWidget.cpp
--- old/CalcMySky-0.3.0/ShowMySky/GLWidget.cpp  2023-03-28 21:00:36.000000000 
+0200
+++ new/CalcMySky-0.3.1/ShowMySky/GLWidget.cpp  2023-06-15 21:21:38.000000000 
+0200
@@ -278,7 +278,10 @@
 
 vec3 sRGBTransferFunction(const vec3 c)
 {
-    return step(0.0031308,c)*(1.055*pow(c, 
vec3(1/2.4))-0.055)+step(-0.0031308,-c)*12.92*c;
+    vec3 s = step(vec3(0.0031308), c);
+    vec3 d = vec3(1) - s;
+    return s * (1.055*pow(c, vec3(1./2.4))-0.055) +
+               d *  12.92*c;
 }
 
 vec3 applyClipping(const vec3 c)
@@ -568,6 +571,7 @@
 
     if(!renderer->isReadyToRender()) return;
 
+    glFinish();
     const auto t0=std::chrono::steady_clock::now();
     renderer->draw(1, true);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/CalcMySky-0.3.0/common/EclipsedDoubleScatteringPrecomputer.cpp 
new/CalcMySky-0.3.1/common/EclipsedDoubleScatteringPrecomputer.cpp
--- old/CalcMySky-0.3.0/common/EclipsedDoubleScatteringPrecomputer.cpp  
2023-03-28 21:00:36.000000000 +0200
+++ new/CalcMySky-0.3.1/common/EclipsedDoubleScatteringPrecomputer.cpp  
2023-06-15 21:21:38.000000000 +0200
@@ -9,6 +9,7 @@
 #include <QOpenGLShaderProgram>
 
 #include "const.hpp"
+#include "TextureAverageComputer.hpp"
 #include "fourier-interpolation.hpp"
 #include "spline-interpolation.hpp"
 #include "timing.hpp"
@@ -22,28 +23,12 @@
 using std::exp;
 using std::log;
 
-static glm::vec4 sumTexels(QOpenGLFunctions_3_3_Core& gl, const GLuint 
textureToRead,
-                           const double texW, const double texH, const GLenum 
unusedTextureUnit)
+static glm::vec4 sumTexels(TextureAverageComputer& averager, const GLuint 
textureToRead,
+                           const float texW, const float texH, const GLuint 
unusedTextureUnitNum)
 {
-    gl.glActiveTexture(unusedTextureUnit);
-    gl.glBindTexture(GL_TEXTURE_2D, textureToRead);
-    gl.glGenerateMipmap(GL_TEXTURE_2D);
-    using namespace std;
-    // Formula from the glspec, "Mipmapping" subsection in section 3.8.11 
Texture Minification
-    const int totalMipmapLevels = 1+floor(log2(std::max(texW,texH)));
-    const int deepestLevel=totalMipmapLevels-1;
-#ifndef NDEBUG
-    // Sanity check
-    int deepestMipmapLevelWidth=-1, deepestMipmapLevelHeight=-1;
-    gl.glGetTexLevelParameteriv(GL_TEXTURE_2D, deepestLevel, GL_TEXTURE_WIDTH, 
&deepestMipmapLevelWidth);
-    gl.glGetTexLevelParameteriv(GL_TEXTURE_2D, deepestLevel, 
GL_TEXTURE_HEIGHT, &deepestMipmapLevelHeight);
-    assert(deepestMipmapLevelWidth==1);
-    assert(deepestMipmapLevelHeight==1);
-#endif
-
-    glm::vec4 pixel;
-    gl.glGetTexImage(GL_TEXTURE_2D, deepestLevel, GL_RGBA, GL_FLOAT, 
&pixel[0]);
-    return pixel * float(texW*texH); // deepest mipmap level is a mean, while 
we need the sum
+    const auto average = averager.getTextureAverage(textureToRead, 
unusedTextureUnitNum);
+    // We need the sum instead of the average
+    return texW*texH * average;
 }
 
 float EclipsedDoubleScatteringPrecomputer::cosZenithAngleOfHorizon(const float 
altitude) const
@@ -214,6 +199,8 @@
     
assert(elevationsBelowHorizon.size()==2*atmo.eclipsedDoubleScatteringNumberOfElevationPairsToSample);
     assert(azimuths.size()==nAzimuthPairsToSample);
 
+    TextureAverageComputer averager(gl, texW, texH, GL_RGBA32F, 
intermediateTextureTexUnitNum);
+
     const auto elevCount=elevationsAboveHorizon.size(); // for each direction: 
above and below horizon
     for(unsigned azimIndex=0; azimIndex<azimuths.size(); ++azimIndex)
     {
@@ -226,7 +213,7 @@
             gl.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
             // Extracting the pixel containing the sum - the integral over the 
view direction and scattering directions
-            const auto integral=sumTexels(gl, intermediateTextureName, texW, 
texH, GL_TEXTURE0+intermediateTextureTexUnitNum);
+            const auto integral=sumTexels(averager, intermediateTextureName, 
texW, texH, intermediateTextureTexUnitNum);
             for(unsigned i=0; i<VEC_ELEM_COUNT; ++i)
                 
samplesAboveHorizon[i][azimIndex*elevCount+elevIndex]=vec2(elev, integral[i]);
         }
@@ -238,7 +225,7 @@
             gl.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
             // Extracting the pixel containing the sum - the integral over the 
view direction and scattering directions
-            const auto integral=sumTexels(gl, intermediateTextureName, texW, 
texH, GL_TEXTURE0+intermediateTextureTexUnitNum);
+            const auto integral=sumTexels(averager, intermediateTextureName, 
texW, texH, intermediateTextureTexUnitNum);
             for(unsigned i=0; i<VEC_ELEM_COUNT; ++i)
                 
samplesBelowHorizon[i][azimIndex*elevCount+elevIndex]=vec2(elev, integral[i]);
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/common/TextureAverageComputer.cpp 
new/CalcMySky-0.3.1/common/TextureAverageComputer.cpp
--- old/CalcMySky-0.3.0/common/TextureAverageComputer.cpp       1970-01-01 
01:00:00.000000000 +0100
+++ new/CalcMySky-0.3.1/common/TextureAverageComputer.cpp       2023-06-15 
21:21:38.000000000 +0200
@@ -0,0 +1,225 @@
+#include "TextureAverageComputer.hpp"
+#include "util.hpp"
+#include <QOpenGLFunctions_3_3_Core>
+
+static bool isPOT(const int x)
+{
+    return roundDownToClosestPowerOfTwo(x) == x;
+}
+
+glm::vec4 TextureAverageComputer::getTextureAverageSimple(const GLuint 
texture, const int width, const int height,
+                                                          const GLuint 
unusedTextureUnitNum)
+{
+    // Get average value of the pixels as the value of the deepest mipmap level
+    gl.glActiveTexture(GL_TEXTURE0 + unusedTextureUnitNum);
+    gl.glBindTexture(GL_TEXTURE_2D, texture);
+    gl.glGenerateMipmap(GL_TEXTURE_2D);
+
+    using namespace std;
+    // Formula from the glspec, "Mipmapping" subsection in section 3.8.11 
Texture Minification
+    const auto totalMipmapLevels = 1+floor(log2(max(width,height)));
+    const auto deepestLevel=totalMipmapLevels-1;
+
+#ifndef NDEBUG
+    // Sanity check
+    int deepestMipmapLevelWidth=-1, deepestMipmapLevelHeight=-1;
+    gl.glGetTexLevelParameteriv(GL_TEXTURE_2D, deepestLevel, GL_TEXTURE_WIDTH, 
&deepestMipmapLevelWidth);
+    gl.glGetTexLevelParameteriv(GL_TEXTURE_2D, deepestLevel, 
GL_TEXTURE_HEIGHT, &deepestMipmapLevelHeight);
+    assert(deepestMipmapLevelWidth==1);
+    assert(deepestMipmapLevelHeight==1);
+#endif
+
+    glm::vec4 pixel;
+    gl.glGetTexImage(GL_TEXTURE_2D, deepestLevel, GL_RGBA, GL_FLOAT, 
&pixel[0]);
+    return pixel;
+}
+
+// Clobbers:
+// GL_ACTIVE_TEXTURE, GL_TEXTURE_BINDING_2D,
+// input texture's minification filter
+glm::vec4 TextureAverageComputer::getTextureAverageWithWorkaround(const GLuint 
texture, const GLuint unusedTextureUnitNum)
+{
+    GLint oldVAO=-1;
+    gl.glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &oldVAO);
+    GLint oldProgram=-1;
+    gl.glGetIntegerv(GL_CURRENT_PROGRAM, &oldProgram);
+    GLint oldViewport[4];
+    gl.glGetIntegerv(GL_VIEWPORT, oldViewport);
+    GLint oldFBO=-1;
+    gl.glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldFBO);
+
+    // Play it safe: we don't want to make the GPU struggle with very large 
textures
+    // if we happen to make them ~4 times larger. Instead round the dimensions 
down.
+    const auto potWidth  = roundDownToClosestPowerOfTwo(npotWidth);
+    const auto potHeight = roundDownToClosestPowerOfTwo(npotHeight);
+
+    gl.glActiveTexture(GL_TEXTURE0 + unusedTextureUnitNum);
+    gl.glBindTexture(GL_TEXTURE_2D, texture);
+    gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+    blitTexProgram->bind();
+    blitTexProgram->setUniformValue("tex", unusedTextureUnitNum);
+
+    gl.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, potFBO);
+    gl.glViewport(0,0,potWidth,potHeight);
+
+    gl.glBindVertexArray(vao);
+    gl.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+    gl.glBindVertexArray(oldVAO);
+
+    gl.glViewport(oldViewport[0], oldViewport[1], oldViewport[2], 
oldViewport[3]);
+    gl.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, oldFBO);
+
+    gl.glUseProgram(oldProgram);
+
+    return getTextureAverageSimple(potTex, potWidth, potHeight, 
unusedTextureUnitNum);
+}
+
+glm::vec4 TextureAverageComputer::getTextureAverage(const GLuint texture, 
const GLuint unusedTextureUnitNum)
+{
+    if(workaroundNeeded && !(isPOT(npotWidth) && isPOT(npotHeight)))
+        return getTextureAverageWithWorkaround(texture, unusedTextureUnitNum);
+    return getTextureAverageSimple(texture, npotWidth, npotHeight, 
unusedTextureUnitNum);
+}
+
+void TextureAverageComputer::init(const GLuint unusedTextureUnitNum)
+{
+    GLuint texture = -1;
+    gl.glGenTextures(1, &texture);
+    assert(texture>0);
+    gl.glActiveTexture(GL_TEXTURE0 + unusedTextureUnitNum);
+    gl.glBindTexture(GL_TEXTURE_2D, texture);
+
+    std::vector<glm::vec4> data;
+    for(int n=0; n<10; ++n)
+        data.emplace_back(1,1,1,1);
+    for(int n=0; n<10; ++n)
+        data.emplace_back(1,1,1,0);
+    for(int n=0; n<10; ++n)
+        data.emplace_back(1,1,0,0);
+    for(int n=0; n<10; ++n)
+        data.emplace_back(1,0,0,0);
+
+    constexpr int width = 63;
+    for(int n=data.size(); n<width; ++n)
+        data.emplace_back(0,0,0,0);
+
+    
gl.glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,data.size(),1,0,GL_RGBA,GL_FLOAT,&data[0][0]);
+    const auto mipmapAverage = getTextureAverageSimple(texture, width, 1, 
unusedTextureUnitNum);
+
+    const auto sum = std::accumulate(data.begin(), data.end(), 
glm::vec4(0,0,0,0));
+    const auto trueAverage = sum / float(data.size());
+    std::cerr << "Test texture true average: "
+              << trueAverage[0] << ", "
+              << trueAverage[1] << ", "
+              << trueAverage[2] << ", "
+              << trueAverage[3] << "\n";
+    std::cerr << "Test texture mipmap average: "
+              << mipmapAverage[0] << ", "
+              << mipmapAverage[1] << ", "
+              << mipmapAverage[2] << ", "
+              << mipmapAverage[3] << "\n";
+
+    const auto diff = mipmapAverage - trueAverage;
+    using std::abs;
+    const auto maxDiff = 
std::max({abs(diff[0]),abs(diff[1]),abs(diff[2]),abs(diff[3])});
+    workaroundNeeded = maxDiff >= 2./255.;
+
+    if(workaroundNeeded)
+    {
+        std::cerr << "WARNING: Mipmap average is unusable, will resize 
textures to "
+                     "power-of-two size when average value is required.\n";
+    }
+    else
+    {
+        std::cerr << "Mipmap average works correctly\n";
+    }
+
+    gl.glBindTexture(GL_TEXTURE_2D, 0);
+    gl.glDeleteTextures(1, &texture);
+
+    inited = true;
+}
+
+// Clobbers: GL_TEXTURE_BINDING_2D, GL_ARRAY_BUFFER_BINDING
+TextureAverageComputer::TextureAverageComputer(QOpenGLFunctions_3_3_Core& gl, 
const int texWidth, const int texHeight,
+                                               const GLenum internalFormat, 
const GLuint unusedTextureUnitNum)
+    : gl(gl)
+    , npotWidth(texWidth)
+    , npotHeight(texHeight)
+{
+    if(!inited) init(unusedTextureUnitNum);
+    if(!workaroundNeeded) return;
+    const auto potWidth  = roundDownToClosestPowerOfTwo(npotWidth);
+    const auto potHeight = roundDownToClosestPowerOfTwo(npotHeight);
+    if(potWidth == npotWidth && potHeight == npotHeight)
+        return;
+
+    GLint oldVAO=-1;
+    gl.glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &oldVAO);
+    GLint oldFBO=-1;
+    gl.glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldFBO);
+
+    gl.glGenFramebuffers(1, &potFBO);
+    gl.glGenTextures(1, &potTex);
+    gl.glActiveTexture(GL_TEXTURE0 + unusedTextureUnitNum);
+    gl.glBindTexture(GL_TEXTURE_2D, potTex);
+    
gl.glTexImage2D(GL_TEXTURE_2D,0,internalFormat,potWidth,potHeight,0,GL_RGBA,GL_UNSIGNED_BYTE,nullptr);
+    gl.glBindTexture(GL_TEXTURE_2D,0);
+    gl.glBindFramebuffer(GL_DRAW_FRAMEBUFFER,potFBO);
+    
gl.glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,potTex,0);
+    [[maybe_unused]] const auto 
status=gl.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
+    assert(status==GL_FRAMEBUFFER_COMPLETE);
+    gl.glBindFramebuffer(GL_DRAW_FRAMEBUFFER,0);
+
+    gl.glGenVertexArrays(1, &vao);
+    gl.glBindVertexArray(vao);
+    gl.glGenBuffers(1, &vbo);
+    gl.glBindBuffer(GL_ARRAY_BUFFER, vbo);
+    const GLfloat vertices[]=
+    {
+        -1, -1,
+         1, -1,
+        -1,  1,
+         1,  1,
+    };
+    gl.glBufferData(GL_ARRAY_BUFFER, sizeof vertices, vertices, 
GL_STATIC_DRAW);
+    constexpr GLuint attribIndex=0;
+    constexpr int coordsPerVertex=2;
+    gl.glVertexAttribPointer(attribIndex, coordsPerVertex, GL_FLOAT, false, 0, 
0);
+    gl.glEnableVertexAttribArray(attribIndex);
+
+    blitTexProgram.reset(new QOpenGLShaderProgram);
+    blitTexProgram->addShaderFromSourceCode(QOpenGLShader::Vertex, 1+R"(
+#version 330
+layout(location=0) in vec4 vertex;
+out vec2 texcoord;
+void main()
+{
+    gl_Position = vertex;
+    texcoord = vertex.st*0.5+vec2(0.5);
+}
+)");
+    blitTexProgram->addShaderFromSourceCode(QOpenGLShader::Fragment, 1+R"(
+#version 330
+in vec2 texcoord;
+out vec4 color;
+uniform sampler2D tex;
+void main()
+{
+    color = texture(tex, texcoord);
+}
+)");
+    blitTexProgram->link();
+
+    gl.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, oldFBO);
+    gl.glBindVertexArray(oldVAO);
+}
+
+TextureAverageComputer::~TextureAverageComputer()
+{
+    gl.glDeleteTextures(1, &potTex);
+    gl.glDeleteFramebuffers(1, &potFBO);
+    gl.glDeleteVertexArrays(1, &vao);
+    gl.glDeleteBuffers(1, &vbo);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/common/TextureAverageComputer.hpp 
new/CalcMySky-0.3.1/common/TextureAverageComputer.hpp
--- old/CalcMySky-0.3.0/common/TextureAverageComputer.hpp       1970-01-01 
01:00:00.000000000 +0100
+++ new/CalcMySky-0.3.1/common/TextureAverageComputer.hpp       2023-06-15 
21:21:38.000000000 +0200
@@ -0,0 +1,31 @@
+#ifndef INCLUDE_ONCE_386B7A49_CC0D_40CF_AC50_73493DF4B289
+#define INCLUDE_ONCE_386B7A49_CC0D_40CF_AC50_73493DF4B289
+
+#include <memory>
+#include <glm/glm.hpp>
+#include <QOpenGLContext>
+#include <QOpenGLShaderProgram>
+
+class QOpenGLFunctions_3_3_Core;
+class TextureAverageComputer
+{
+    QOpenGLFunctions_3_3_Core& gl;
+    std::unique_ptr<QOpenGLShaderProgram> blitTexProgram;
+    GLuint potFBO = 0;
+    GLuint potTex = 0;
+    GLuint vbo = 0, vao = 0;
+    GLint npotWidth, npotHeight;
+    static inline bool inited = false;
+    static inline bool workaroundNeeded = false;
+
+    void init(GLuint unusedTextureUnitNum);
+    glm::vec4 getTextureAverageSimple(GLuint texture, int width, int height, 
GLuint unusedTextureUnitNum);
+    glm::vec4 getTextureAverageWithWorkaround(GLuint texture, GLuint 
unusedTextureUnitNum);
+public:
+    glm::vec4 getTextureAverage(GLuint texture, GLuint unusedTextureUnitNum);
+    TextureAverageComputer(QOpenGLFunctions_3_3_Core&, int texW, int texH,
+                           GLenum internalFormat, GLuint unusedTextureUnitNum);
+    ~TextureAverageComputer();
+};
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/common/util.hpp 
new/CalcMySky-0.3.1/common/util.hpp
--- old/CalcMySky-0.3.0/common/util.hpp 2023-03-28 21:00:36.000000000 +0200
+++ new/CalcMySky-0.3.1/common/util.hpp 2023-06-15 21:21:38.000000000 +0200
@@ -136,4 +136,13 @@
 // Rounds each float to \p precision bits.
 void roundTexData(GLfloat* data, size_t size, int precision);
 
+inline int roundDownToClosestPowerOfTwo(const int x)
+{
+    if(x==0) return 1;
+    int shift=0;
+    for(auto v=x;v;v>>=1)
+        ++shift;
+    return 1<<(shift-1);
+}
+
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/doc/using_in_stellarium.md 
new/CalcMySky-0.3.1/doc/using_in_stellarium.md
--- old/CalcMySky-0.3.0/doc/using_in_stellarium.md      2023-03-28 
21:00:36.000000000 +0200
+++ new/CalcMySky-0.3.1/doc/using_in_stellarium.md      2023-06-15 
21:21:38.000000000 +0200
@@ -1,8 +1,8 @@
 # Using in Stellarium {#using-in-stellarium}
 
-As of this writing, upstream Stellarium doesn't have this feature merged (see 
upstream [issue #624](https://github.com/Stellarium/stellarium/issues/624)). To 
use the ShowMySky atmosphere model, you'll need to build Stellarium from 
[`showmysky` branch](https://github.com/10110111/Stellarium/tree/showmysky) of 
10110111's repository (unless you already have a binary installation of it — 
or the feature has finally been merged upstream).
+Stellarium supports ShowMySky atmosphere model since Stellarium v1.0. This 
model is available for machines capable of OpenGL 3.3.
 
-Having the ShowMySky-enabled version of Stellarium, launch it, and open the 
_View_ dialog (accessible via <kbd>F4</kbd> key), and click _Atmosphere 
settings_ button (next to _Atmosphere visualization_ checkbox). _Atmosphere 
Details_ dialog will open, where in the _Choose model_ combobox you can select 
either _Preetham_, which is the legacy atmosphere model, or _ShowMySky_, which 
is powered by this library.
+Having installed a ShowMySky-enabled version of Stellarium, launch it, open 
the _View_ dialog (accessible via <kbd>F4</kbd> key), and click _Atmosphere 
settings_ button (next to _Atmosphere visualization_ checkbox). _Atmosphere 
Details_ dialog will open, where in the _Choose model_ combobox you can select 
either _Preetham_, which is the legacy atmosphere model, or _ShowMySky_, which 
is powered by this library.
 
 Having chosen _ShowMySky_ atmosphere, select a path to the atmosphere model 
data directory in the _Path to data_ field. The model data directory must 
contain `params.atmo` file. If it doesn't, it's not a model directory, or some 
files are missing. The path field marks the path in red if there's no 
`params.atmo` file in this directory, or the directory is not accessible.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/examples/mars.atmo 
new/CalcMySky-0.3.1/examples/mars.atmo
--- old/CalcMySky-0.3.0/examples/mars.atmo      2023-03-28 21:00:36.000000000 
+0200
+++ new/CalcMySky-0.3.1/examples/mars.atmo      2023-06-15 21:21:38.000000000 
+0200
@@ -65,7 +65,7 @@
     # computed from refractive index of CO2, see the formula at 
https://physics.stackexchange.com/a/652760/21441
     cross section at 1 um: 0.0897172 fm^2
     angstrom exponent: 4
-    phase function type: smooth
+    phase function type: achromatic
 }
 Scatterer "dust":
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/examples/sample-small-size.atmo 
new/CalcMySky-0.3.1/examples/sample-small-size.atmo
--- old/CalcMySky-0.3.0/examples/sample-small-size.atmo 2023-03-28 
21:00:36.000000000 +0200
+++ new/CalcMySky-0.3.1/examples/sample-small-size.atmo 2023-06-15 
21:21:38.000000000 +0200
@@ -61,7 +61,7 @@
     ```
     cross section at 1 um: 0.04022 fm^2
     angstrom exponent: 4
-    phase function type: smooth
+    phase function type: achromatic
     needs interpolation guides
 }
 Scatterer "aerosols": # Mie scattering
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/examples/sample.atmo 
new/CalcMySky-0.3.1/examples/sample.atmo
--- old/CalcMySky-0.3.0/examples/sample.atmo    2023-03-28 21:00:36.000000000 
+0200
+++ new/CalcMySky-0.3.1/examples/sample.atmo    2023-06-15 21:21:38.000000000 
+0200
@@ -61,7 +61,7 @@
     ```
     cross section at 1 um: 0.04022 fm^2
     angstrom exponent: 4
-    phase function type: smooth
+    phase function type: achromatic
 }
 Scatterer "aerosols": # Mie scattering
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/CalcMySky-0.3.0/examples/with-external-spectra-weighted.atmo 
new/CalcMySky-0.3.1/examples/with-external-spectra-weighted.atmo
--- old/CalcMySky-0.3.0/examples/with-external-spectra-weighted.atmo    
2023-03-28 21:00:36.000000000 +0200
+++ new/CalcMySky-0.3.1/examples/with-external-spectra-weighted.atmo    
2023-06-15 21:21:38.000000000 +0200
@@ -62,7 +62,7 @@
     ```
     cross section at 1 um: 0.04022 fm^2
     angstrom exponent: 4
-    phase function type: smooth
+    phase function type: achromatic
 }
 Scatterer "aerosols": # Mie scattering
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CalcMySky-0.3.0/examples/with-external-spectra.atmo 
new/CalcMySky-0.3.1/examples/with-external-spectra.atmo
--- old/CalcMySky-0.3.0/examples/with-external-spectra.atmo     2023-03-28 
21:00:36.000000000 +0200
+++ new/CalcMySky-0.3.1/examples/with-external-spectra.atmo     2023-06-15 
21:21:38.000000000 +0200
@@ -61,7 +61,7 @@
     ```
     cross section at 1 um: 0.04022 fm^2
     angstrom exponent: 4
-    phase function type: smooth
+    phase function type: achromatic
 }
 Scatterer "aerosols": # Mie scattering
 {

Reply via email to