Browse Source

experimenting with bigger max zoom

Nicolas Winkler 4 years ago
parent
commit
c7d6fd9f68

+ 24 - 3
include/EscapeTimeVisualWidget.h

@@ -2,14 +2,12 @@
 #define ESCAPETIMEVISUALWIDGET_H
 
 #include <QOpenGLWidget>
+#include <QOpenGLShaderProgram>
 #include "Bitmap.h"
 #include "Gradient.h"
 
-class QOpenGLShaderProgram;
-
 class EscapeTimeVisualWidget;
 
-
 class ETVImage
 {
     GLuint textureId;
@@ -27,6 +25,29 @@ public:
               float tw = 1.0f, float th = 1.0f);
 };
 
+class RenderTextureProgram :
+    public QOpenGLShaderProgram
+{
+    int vertexLoc;
+    int texCoordsLoc;
+    int colorLocation;
+    int texLoc;
+    int gradLoc;
+    int gradientScalerLoc;
+    int maxIterationsLoc;
+public:
+    inline RenderTextureProgram(QObject* parent) :
+        QOpenGLShaderProgram{ parent } {}
+
+    virtual bool link(void) override;
+
+    inline int getVertexLoc(void) const         { return vertexLoc; }
+    inline int getTexCoordsLoc(void) const      { return texCoordsLoc; }
+    inline int getTexLoc(void) const            { return texLoc; }
+    inline int getGradLoc(void) const           { return gradLoc; }
+    inline int getGradientScalerLoc(void) const { return gradientScalerLoc; }
+    inline int getMaxIterationsLoc(void) const  { return maxIterationsLoc; }
+};
 
 class EscapeTimeVisualWidget :
     public QOpenGLWidget

+ 14 - 0
libmandel/include/Fixed.h

@@ -105,6 +105,11 @@ struct Fixed512
             496, boost::multiprecision::backends::digit_base_2, void, boost::int16_t, -16382, 16383>,
             boost::multiprecision::et_off>;
 
+    using Float2048 = boost::multiprecision::number<
+        boost::multiprecision::backends::cpp_bin_float<
+            2016, boost::multiprecision::backends::digit_base_2, std::allocator<void>, boost::int32_t, -16777214, 16777215>,
+            boost::multiprecision::et_off>;
+
     inline Fixed512(const Float256& val)
     {
         body = Once{ val * boost::multiprecision::pow(Float256{ 2 }, 512 - 32) };
@@ -115,6 +120,11 @@ struct Fixed512
         body = Once{ val * boost::multiprecision::pow(Float512{ 2 }, 512 - 32) };
     }
 
+    inline Fixed512(const Float2048& val)
+    {
+        body = Once{ val * boost::multiprecision::pow(Float2048{ 2 }, 512 - 32) };
+    }
+
     inline Fixed512(double val)
     {
         body = Once{ boost::multiprecision::pow(Float512{ 2 }, 512 - 32) * val };
@@ -128,6 +138,10 @@ struct Fixed512
         return boost::multiprecision::pow(Float512{ 0.5 }, 512 - 32) * Float512{ body };
     }
 
+    inline operator Float2048(void) const {
+        return boost::multiprecision::pow(Float2048{ 0.5 }, 512 - 32) * Float2048{ body };
+    }
+
     inline Fixed512& operator += (const Fixed512& other) {
         body += other.body;
         return *this;

+ 5 - 0
libmandel/include/Real.h

@@ -11,6 +11,11 @@ namespace mnd
             496, boost::multiprecision::backends::digit_base_2, void, boost::int16_t, -16382, 16383>,
             boost::multiprecision::et_off>;
 
+    using Float2048 = boost::multiprecision::number<
+        boost::multiprecision::backends::cpp_bin_float<
+            2016, boost::multiprecision::backends::digit_base_2, std::allocator<void>, boost::int32_t, -16777214, 16777215>,
+            boost::multiprecision::et_off>;
+
     using Real = Float512;
     using Integer = boost::multiprecision::int512_t;
 

+ 0 - 24
libmandel/include/Types.h

@@ -71,30 +71,6 @@ namespace mnd
 #endif
 
     using DoubleDouble = mnd::LightDoubleDouble;
-    //using QuadDouble = qd_real;
-
-    /*inline DoubleDouble abs(const DoubleDouble& x) { return ::abs(x); }
-    inline DoubleDouble sqrt(const DoubleDouble& x) { return ::sqrt(x); }
-    inline DoubleDouble floor(const DoubleDouble& x) { return ::floor(x); }
-    inline DoubleDouble log(const DoubleDouble& x) { return ::log(x); }
-    inline DoubleDouble log2(const DoubleDouble& x) { return ::log(x) / ::log(DoubleDouble(2.0)); }
-    inline DoubleDouble pow(const DoubleDouble& x, const DoubleDouble& y) { return ::pow(x, y); }
-    inline DoubleDouble atan2(const DoubleDouble& y, const DoubleDouble& x) { return ::atan2(y, x); }
-    inline DoubleDouble cos(const DoubleDouble& x) { return ::cos(x); }
-    inline DoubleDouble sin(const DoubleDouble& x) { return ::sin(x); }
-    inline DoubleDouble exp(const DoubleDouble& x) { return ::exp(x); }*/
-
-
-    /*inline QuadDouble abs(const QuadDouble& x) { return ::abs(x); }
-    inline QuadDouble sqrt(const QuadDouble& x) { return ::sqrt(x); }
-    inline QuadDouble floor(const QuadDouble& x) { return ::floor(x); }
-    inline QuadDouble log(const QuadDouble& x) { return ::log(x); }
-    inline QuadDouble log2(const QuadDouble& x) { return ::log(x) / ::log(QuadDouble(2.0)); }
-    inline QuadDouble pow(const QuadDouble& x, const QuadDouble& y) { return ::pow(x, y); }
-    inline QuadDouble atan2(const QuadDouble& y, const QuadDouble& x) { return ::atan2(y, x); }
-    inline QuadDouble cos(const QuadDouble& x) { return ::cos(x); }
-    inline QuadDouble sin(const QuadDouble& x) { return ::sin(x); }
-    inline QuadDouble exp(const QuadDouble& x) { return ::exp(x); }*/
 
     inline double abs(double x) { return ::abs(x); }
     inline float abs(float x) { return ::abs(x); }

+ 2 - 2
libmandel/src/IterationCompilerCl.cpp

@@ -197,7 +197,7 @@ namespace mnd
             return "mul("s + a + ", " + b + ")";
         }
         static std::string div(const std::string& a, const std::string& b) {
-            return "div("s + a + ") / (" + b + ")";
+            return "div("s + a + ", " + b + ")";
         }
         static std::string atan2(const std::string& a, const std::string& b) {
             return "atan2("s + a + ", " + b + ")";
@@ -255,7 +255,7 @@ namespace mnd
             return "mul("s + a + ", " + b + ")";
         }
         static std::string div(const std::string& a, const std::string& b) {
-            return "div("s + a + ") / (" + b + ")";
+            return "div("s + a + ", " + b + ")";
         }
         static std::string atan2(const std::string& a, const std::string& b) {
             return "atan2("s + a + ", " + b + ")";

+ 14 - 0
src/EscapeTimeVisualWidget.cpp

@@ -160,6 +160,20 @@ void ETVImage::draw(float x, float y, float w, float h,
 }
 
 
+bool RenderTextureProgram::link(void)
+{
+    QOpenGLShaderProgram::link();
+    bool bound = this->bind();
+    vertexLoc = this->attributeLocation("vertex");
+    texCoordsLoc = this->attributeLocation("texCoord");
+    colorLocation = this->uniformLocation("color");
+    texLoc = this->uniformLocation("tex");
+    gradLoc = this->uniformLocation("gradient");
+    gradientScalerLoc = this->uniformLocation("gradientScaler");
+    maxIterationsLoc = this->uniformLocation("maxIterations");
+
+}
+
 EscapeTimeVisualWidget::EscapeTimeVisualWidget(QWidget* parent) :
     QOpenGLWidget{ parent },
     gradientTextureId{ 0 },

+ 6 - 2
src/FractalWidgetUtils.cpp

@@ -115,8 +115,12 @@ void CalcJob::run(void)
 size_t IndexPairHash::operator()(const std::pair<GridIndex, GridIndex>& p) const
 {
     const auto& [a, b] = p;
-    size_t truncA = std::hash<GridIndex>{}(a);
-    size_t truncB = std::hash<GridIndex>{}(b);
+    const int64_t a_short = int64_t(a);
+    const int64_t b_short = int64_t(a);
+    //size_t truncA = std::hash<GridIndex>{}(a);
+    //size_t truncB = std::hash<GridIndex>{}(b);
+    size_t truncA = a_short;
+    size_t truncB = b_short;
     boost::hash_combine(truncA, truncB);
     return truncA;
 }