From 0b0405382f512f53bcd4cd78975984a7b091be9b Mon Sep 17 00:00:00 2001 From: Person Date: Fri, 27 Dec 2019 21:04:41 -0800 Subject: [PATCH] --Bug fixes -Fix variations: blob2 (broken on CPU), epispiral, hole. -Fix reading variations from Apophysis: supershape. -Bump render was broken. --Code changes -Flip precalc sina/cosa and apply everywhere by flipping the usage. Flam3 had these reversed and it made the code confusing to read. --- .../Installer/FractoriumInstaller.wixproj | 2 +- Builds/MSVC/Installer/Product.wxs | 4 +- Builds/MSVC/VS2017/Ember.rc | Bin 4522 -> 4522 bytes Builds/MSVC/VS2017/EmberAnimate.rc | 8 +- Builds/MSVC/VS2017/EmberCL.rc | Bin 4548 -> 4548 bytes Builds/MSVC/VS2017/EmberGenome.rc | 8 +- Builds/MSVC/VS2017/EmberRender.rc | 8 +- Builds/MSVC/VS2017/Fractorium.rc | Bin 4490 -> 4490 bytes Builds/QtCreator/defaults.pri | 2 +- Data/Fractorium.spec | 2 +- Data/control.package | 2 +- Source/Ember/EmberDefines.h | 2 +- Source/Ember/RendererBase.cpp | 2 +- Source/Ember/Variation.h | 10 +-- Source/Ember/Variations01.h | 70 +++++++++--------- Source/Ember/Variations02.h | 60 +++++++++------ Source/Ember/Variations03.h | 52 ++++++------- Source/Ember/Variations04.h | 28 +++---- Source/Ember/Variations07.h | 2 +- Source/Ember/Xform.h | 4 +- Source/Ember/XmlToEmber.cpp | 29 +++++++- Source/EmberCL/IterOpenCLKernelCreator.cpp | 4 +- Source/Fractorium/AboutDialog.ui | 4 +- .../Fractorium/FinalRenderEmberController.cpp | 31 ++++---- debian/changelog | 6 ++ 25 files changed, 192 insertions(+), 148 deletions(-) diff --git a/Builds/MSVC/Installer/FractoriumInstaller.wixproj b/Builds/MSVC/Installer/FractoriumInstaller.wixproj index 44c6b42..73c6783 100644 --- a/Builds/MSVC/Installer/FractoriumInstaller.wixproj +++ b/Builds/MSVC/Installer/FractoriumInstaller.wixproj @@ -6,7 +6,7 @@ 3.7 {c8096c47-e358-438c-a520-146d46b0637d} 2.0 - Fractorium_1.0.0.17 + Fractorium_1.0.0.18 Package $(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets diff --git a/Builds/MSVC/Installer/Product.wxs b/Builds/MSVC/Installer/Product.wxs index df5b1d0..59da13c 100644 --- a/Builds/MSVC/Installer/Product.wxs +++ b/Builds/MSVC/Installer/Product.wxs @@ -1,6 +1,6 @@ - + @@ -13,7 +13,7 @@ - + wH(%o3#>i-~xs#WX1pq%4 B4E6v3 delta 46 zcmeBD?o!@xj)T#B@_7zRR&xek2Cm8doT8hRIA<^c1q->wH(%o3#>i;Cxs#WX1pq#{ B4DtW~ diff --git a/Builds/QtCreator/defaults.pri b/Builds/QtCreator/defaults.pri index 02969d1..c63ca04 100644 --- a/Builds/QtCreator/defaults.pri +++ b/Builds/QtCreator/defaults.pri @@ -1,4 +1,4 @@ -VERSION = 1.0.0.17 +VERSION = 1.0.0.18 win32:CONFIG += skip_target_version_ext CONFIG += c++14 diff --git a/Data/Fractorium.spec b/Data/Fractorium.spec index bde296e..583c92a 100644 --- a/Data/Fractorium.spec +++ b/Data/Fractorium.spec @@ -2,7 +2,7 @@ %define buildroot %{_topdir}/BUILDROOT Name: Fractorium -Version: 1.0.0.17 +Version: 1.0.0.18 Release: 1 Summary: A fractal flame editor with GPU support diff --git a/Data/control.package b/Data/control.package index 4848a0e..d5fe40d 100644 --- a/Data/control.package +++ b/Data/control.package @@ -8,7 +8,7 @@ Homepage: http://fractorium.com/ Vcs-Git: https://bitbucket.org/mfeemster/fractorium Vcs-Browser: https://bitbucket.org/mfeemster/fractorium Package: Fractorium -Version: 1.0.0.17 +Version: 1.0.0.18 Architecture: amd64 Description: A fractal flame editor with GPU support Fractorium diff --git a/Source/Ember/EmberDefines.h b/Source/Ember/EmberDefines.h index cebebc5..5652d02 100644 --- a/Source/Ember/EmberDefines.h +++ b/Source/Ember/EmberDefines.h @@ -37,7 +37,7 @@ static void sincos(float x, float* s, float* c) namespace EmberNs { -#define EMBER_VERSION "1.0.0.17" +#define EMBER_VERSION "1.0.0.18" //#define FLAM3_COMPAT 1//Uncomment this if you want full compatibility with flam3 regarding some of the trig-based variations in Variations01.h #define EPS6 T(1e-6) #define EPS std::numeric_limits::epsilon()//Apoplugin.h uses -20, but it's more mathematically correct to do it this way. diff --git a/Source/Ember/RendererBase.cpp b/Source/Ember/RendererBase.cpp index 07eda77..aa07e1e 100644 --- a/Source/Ember/RendererBase.cpp +++ b/Source/Ember/RendererBase.cpp @@ -43,7 +43,7 @@ void RendererBase::ChangeVal(std::function func, eProcessAction acti //new and old quality values. else if (action == eProcessAction::KEEP_ITERATING) { - if (m_ProcessState == eProcessState::ACCUM_DONE && TemporalSamples() == 1) + if ((m_ProcessState == eProcessState::ACCUM_DONE || m_ProcessState == eProcessState::ITER_STARTED) && TemporalSamples() == 1) { m_ProcessState = eProcessState::ITER_STARTED; m_ProcessAction = eProcessAction::KEEP_ITERATING; diff --git a/Source/Ember/Variation.h b/Source/Ember/Variation.h index 573b1c4..095dd78 100644 --- a/Source/Ember/Variation.h +++ b/Source/Ember/Variation.h @@ -1349,8 +1349,8 @@ public: T m_TransX, m_TransY, m_TransZ;//Translated point gotten by applying the affine transform to the input point gotten from the output of the previous iteration (excluding final). T m_PrecalcSumSquares;//Precalculated value of the sum of the squares of the translated point. T m_PrecalcSqrtSumSquares;//Precalculated value of the square root of m_PrecalcSumSquares. - T m_PrecalcSina;//Precalculated value of m_TransX / m_PrecalcSqrtSumSquares. T m_PrecalcCosa;//Precalculated value of m_TransY / m_PrecalcSqrtSumSquares. + T m_PrecalcSina;//Precalculated value of m_TransX / m_PrecalcSqrtSumSquares. T m_PrecalcAtanxy;//Precalculated value of atan2(m_TransX, m_TransY). T m_PrecalcAtanyx;//Precalculated value of atan2(m_TransY, m_TransX). v4T In, Out; @@ -1489,8 +1489,8 @@ public: if (m_NeedPrecalcAngles) { - iteratorHelper.m_PrecalcSina = iteratorHelper.In.x / iteratorHelper.m_PrecalcSqrtSumSquares; - iteratorHelper.m_PrecalcCosa = iteratorHelper.In.y / iteratorHelper.m_PrecalcSqrtSumSquares; + iteratorHelper.m_PrecalcSina = iteratorHelper.In.y / Zeps(iteratorHelper.m_PrecalcSqrtSumSquares); + iteratorHelper.m_PrecalcCosa = iteratorHelper.In.x / Zeps(iteratorHelper.m_PrecalcSqrtSumSquares); } } } @@ -1520,8 +1520,8 @@ public: if (m_NeedPrecalcAngles) { - ss << "\tprecalcSina = vIn.x / precalcSqrtSumSquares;\n"; - ss << "\tprecalcCosa = vIn.y / precalcSqrtSumSquares;\n"; + ss << "\tprecalcSina = vIn.y / Zeps(precalcSqrtSumSquares);\n"; + ss << "\tprecalcCosa = vIn.x / Zeps(precalcSqrtSumSquares);\n"; } } } diff --git a/Source/Ember/Variations01.h b/Source/Ember/Variations01.h index 546664b..6e31e6a 100644 --- a/Source/Ember/Variations01.h +++ b/Source/Ember/Variations01.h @@ -564,8 +564,8 @@ public: { T r = Zeps(helper.m_PrecalcSqrtSumSquares); T r1 = m_Weight / r; - helper.Out.x = r1 * (helper.m_PrecalcCosa + std::sin(r)); - helper.Out.y = r1 * (helper.m_PrecalcSina - std::cos(r)); + helper.Out.x = r1 * (helper.m_PrecalcSina + std::sin(r));//Intentionally flipped. + helper.Out.y = r1 * (helper.m_PrecalcCosa - std::cos(r)); helper.Out.z = m_Weight * helper.In.z; } @@ -578,8 +578,8 @@ public: << "\t\treal_t r = Zeps(precalcSqrtSumSquares);\n" << "\t\treal_t r1 = " << weight << " / r;\n" << "\n" - << "\t\tvOut.x = r1 * (precalcCosa + sin(r));\n" - << "\t\tvOut.y = r1 * (precalcSina - cos(r));\n" + << "\t\tvOut.x = r1 * (precalcSina + sin(r));\n" + << "\t\tvOut.y = r1 * (precalcCosa - cos(r));\n" << "\t\tvOut.z = " << weight << " * vIn.z;\n" << "\t}\n"; return ss.str(); @@ -609,8 +609,8 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = Zeps(helper.m_PrecalcSqrtSumSquares); - helper.Out.x = m_Weight * helper.m_PrecalcSina / r; - helper.Out.y = m_Weight * helper.m_PrecalcCosa * r; + helper.Out.x = m_Weight * helper.m_PrecalcCosa / r;//Flipped from flam3 because flam3 had them erroneously flipped. + helper.Out.y = m_Weight * helper.m_PrecalcSina * r; helper.Out.z = m_Weight * helper.In.z; } @@ -622,8 +622,8 @@ public: ss << "\t{\n" << "\t\treal_t r = Zeps(precalcSqrtSumSquares);\n" << "\n" - << "\t\tvOut.x = " << weight << " * precalcSina / r;\n" - << "\t\tvOut.y = " << weight << " * precalcCosa * r;\n" + << "\t\tvOut.x = " << weight << " * precalcCosa / r;\n" + << "\t\tvOut.y = " << weight << " * precalcSina * r;\n" << "\t\tvOut.z = " << weight << " * vIn.z;\n" << "\t}\n"; return ss.str(); @@ -652,8 +652,8 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { - helper.Out.x = m_Weight * helper.m_PrecalcSina * std::cos(helper.m_PrecalcSqrtSumSquares); - helper.Out.y = m_Weight * helper.m_PrecalcCosa * std::sin(helper.m_PrecalcSqrtSumSquares); + helper.Out.x = m_Weight * helper.m_PrecalcCosa * std::cos(helper.m_PrecalcSqrtSumSquares);//Flipped from flam3 because flam3 had them erroneously flipped. + helper.Out.y = m_Weight * helper.m_PrecalcSina * std::sin(helper.m_PrecalcSqrtSumSquares); helper.Out.z = DefaultZ(helper); } @@ -663,8 +663,8 @@ public: string weight = WeightDefineString(); intmax_t varIndex = IndexInXform(); ss << "\t{\n" - << "\t\tvOut.x = " << weight << " * precalcSina * cos(precalcSqrtSumSquares);\n" - << "\t\tvOut.y = " << weight << " * precalcCosa * sin(precalcSqrtSumSquares);\n" + << "\t\tvOut.x = " << weight << " * precalcCosa * cos(precalcSqrtSumSquares);\n" + << "\t\tvOut.y = " << weight << " * precalcSina * sin(precalcSqrtSumSquares);\n" << "\t\tvOut.z = " << DefaultZCl() << "\t}\n"; return ss.str(); @@ -1050,9 +1050,9 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { - T r = m_Weight * std::pow(helper.m_PrecalcSqrtSumSquares, helper.m_PrecalcSina); - helper.Out.x = r * helper.m_PrecalcCosa; - helper.Out.y = r * helper.m_PrecalcSina; + T r = m_Weight * std::pow(helper.m_PrecalcSqrtSumSquares, helper.m_PrecalcCosa);//Flipped from flam3. + helper.Out.x = r * helper.m_PrecalcSina;//Intentionally flipped. + helper.Out.y = r * helper.m_PrecalcCosa; helper.Out.z = DefaultZ(helper); } @@ -1062,10 +1062,10 @@ public: string weight = WeightDefineString(); intmax_t varIndex = IndexInXform(); ss << "\t{\n" - << "\t\treal_t r = " << weight << " * pow(precalcSqrtSumSquares, precalcSina);\n" + << "\t\treal_t r = " << weight << " * pow(precalcSqrtSumSquares, precalcCosa);\n" << "\n" - << "\t\tvOut.x = r * precalcCosa;\n" - << "\t\tvOut.y = r * precalcSina;\n" + << "\t\tvOut.x = r * precalcSina;\n" + << "\t\tvOut.y = r * precalcCosa;\n" << "\t\tvOut.z = " << DefaultZCl() << "\t}\n"; return ss.str(); @@ -1140,8 +1140,8 @@ public: T dx = Zeps(m_Xform->m_Affine.C() * m_Xform->m_Affine.C()); T r = helper.m_PrecalcSqrtSumSquares; r = m_Weight * (fmod(r + dx, 2 * dx) - dx + r * (1 - dx)); - helper.Out.x = r * helper.m_PrecalcCosa; - helper.Out.y = r * helper.m_PrecalcSina; + helper.Out.x = r * helper.m_PrecalcSina;//Intentionally flipped, also flipped from flam3 because flam3 had them erroneously flipped. + helper.Out.y = r * helper.m_PrecalcCosa; helper.Out.z = DefaultZ(helper); } @@ -1155,8 +1155,8 @@ public: << "\t\treal_t r = precalcSqrtSumSquares;\n" << "\n" << "\t\tr = " << weight << " * (fmod(r + dx, 2 * dx) + fma(r, ((real_t)(1.0) - dx), -dx));\n" - << "\t\tvOut.x = r * precalcCosa;\n" - << "\t\tvOut.y = r * precalcSina;\n" + << "\t\tvOut.x = r * precalcSina;\n" + << "\t\tvOut.y = r * precalcCosa;\n" << "\t\tvOut.z = " << DefaultZCl() << "\t}\n"; return ss.str(); @@ -1253,8 +1253,8 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = helper.m_PrecalcSqrtSumSquares * (m_BlobLow + m_BlobDiff * (T(0.5) + T(0.5) * std::sin(m_BlobWaves * helper.m_PrecalcAtanxy))); - helper.Out.x = m_Weight * helper.m_PrecalcSina * r; - helper.Out.y = m_Weight * helper.m_PrecalcCosa * r; + helper.Out.x = m_Weight * helper.m_PrecalcCosa * r;//Flipped from flam3 because flam3 had them erroneously flipped. + helper.Out.y = m_Weight * helper.m_PrecalcSina * r; helper.Out.z = DefaultZ(helper); } @@ -1263,17 +1263,17 @@ public: ostringstream ss, ss2; intmax_t i = 0, varIndex = IndexInXform(); ss2 << "_" << XformIndexInEmber() << "]"; - string index = ss2.str(); - string weight = WeightDefineString(); - string blobLow = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string blobHigh = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string index = ss2.str(); + string weight = WeightDefineString(); + string blobLow = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string blobHigh = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string blobWaves = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string blobDiff = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string blobDiff = "parVars[" + ToUpper(m_Params[i++].Name()) + index; ss << "\t{\n" << "\t\treal_t r = precalcSqrtSumSquares * fma(" << blobDiff << ", fma((real_t)(0.5), sin(" << blobWaves << " * precalcAtanxy), (real_t)(0.5)), " << blobLow << ");\n" << "\n" - << "\t\tvOut.x = " << weight << " * precalcSina * r;\n" - << "\t\tvOut.y = " << weight << " * precalcCosa * r;\n" + << "\t\tvOut.x = " << weight << " * precalcCosa * r;\n" + << "\t\tvOut.y = " << weight << " * precalcSina * r;\n" << "\t\tvOut.z = " << DefaultZCl() << "\t}\n"; return ss.str(); @@ -1523,8 +1523,8 @@ public: { T r = helper.m_PrecalcSqrtSumSquares; r += -2 * m_Rings2Val2 * int((r + m_Rings2Val2) / (2 * m_Rings2Val2)) + r * (1 - m_Rings2Val2); - helper.Out.x = m_Weight * helper.m_PrecalcSina * r; - helper.Out.y = m_Weight * helper.m_PrecalcCosa * r; + helper.Out.x = m_Weight * helper.m_PrecalcCosa * r;//Flipped from flam3 because flam3 had them erroneously flipped. + helper.Out.y = m_Weight * helper.m_PrecalcSina * r; helper.Out.z = m_Weight * helper.In.z; } @@ -1542,8 +1542,8 @@ public: << "\n" << "\t\tr += fma((real_t)(-2.0) * " << rings2Val2 << ", (real_t)(int)((r + " << rings2Val2 << ") / ((real_t)(2.0) * " << rings2Val2 << ")), r * ((real_t)(1.0) - " << rings2Val2 << "));\n" //<< "\t\tr += -(real_t)(2.0) * " << rings2Val2 << " * (int)((r + " << rings2Val2 << ") / ((real_t)(2.0) * " << rings2Val2 << ")) + r * ((real_t)(1.0) - " << rings2Val2 << ");\n" - << "\t\tvOut.x = (" << weight << " * precalcSina * r);\n" - << "\t\tvOut.y = (" << weight << " * precalcCosa * r);\n" + << "\t\tvOut.x = (" << weight << " * precalcCosa * r);\n" + << "\t\tvOut.y = (" << weight << " * precalcSina * r);\n" << "\t\tvOut.z = " << weight << " * vIn.z;\n" << "\t}\n"; return ss.str(); diff --git a/Source/Ember/Variations02.h b/Source/Ember/Variations02.h index 54a65ce..3d7b76d 100644 --- a/Source/Ember/Variations02.h +++ b/Source/Ember/Variations02.h @@ -56,12 +56,12 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T theta = helper.m_PrecalcAtanyx; - T t = (rand.Frand01() * m_Thickness) * (1 / std::cos(m_N * theta)) - m_Holes; + T t = (!m_ThicknessWeight ? m_Weight : m_ThicknessWeight * rand.Frand01()) / std::cos(m_N * theta) - m_HolesWeight; if (std::abs(t) != 0) { - helper.Out.x = m_Weight * t * std::cos(theta); - helper.Out.y = m_Weight * t * std::sin(theta); + helper.Out.x = t * std::cos(theta); + helper.Out.y = t * std::sin(theta); } else { @@ -77,19 +77,21 @@ public: ostringstream ss, ss2; intmax_t i = 0, varIndex = IndexInXform(); ss2 << "_" << XformIndexInEmber() << "]"; - string index = ss2.str(); - string weight = WeightDefineString(); - string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string thickness = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string holes = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string index = ss2.str(); + string weight = WeightDefineString(); + string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string thickness = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string holes = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string thicknessweight = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string holesweight = "parVars[" + ToUpper(m_Params[i++].Name()) + index; ss << "\t{\n" << "\t\treal_t theta = precalcAtanyx;\n" - << "\t\treal_t t = (MwcNext01(mwc) * " << thickness << ") * (1 / cos(" << n << " * theta)) - " << holes << ";\n" + << "\t\treal_t t = (!" << thicknessweight << " ? " << weight << " : MwcNext01(mwc) * " << thicknessweight << ") / cos(" << n << " * theta) - " << holesweight << ";\n" << "\n" << "\t\tif (fabs(t) != 0)\n" << "\t\t{\n" - << "\t\t\tvOut.x = " << weight << " * t * cos(theta);\n" - << "\t\t\tvOut.y = " << weight << " * t * sin(theta);\n" + << "\t\t\tvOut.x = t * cos(theta);\n" + << "\t\t\tvOut.y = t * sin(theta);\n" << "\t\t}\n" << "\t\telse\n" << "\t\t{\n" @@ -101,6 +103,12 @@ public: return ss.str(); } + virtual void Precalc() override + { + m_ThicknessWeight = m_Thickness * m_Weight; + m_HolesWeight = m_Holes * m_Weight; + } + protected: void Init() { @@ -109,12 +117,16 @@ protected: m_Params.push_back(ParamWithName(&m_N, prefix + "epispiral_n", 6)); m_Params.push_back(ParamWithName(&m_Thickness, prefix + "epispiral_thickness")); m_Params.push_back(ParamWithName(&m_Holes, prefix + "epispiral_holes", 1)); + m_Params.push_back(ParamWithName(true, &m_ThicknessWeight, prefix + "epispiral_thickness_weight")); //Precalc. + m_Params.push_back(ParamWithName(true, &m_HolesWeight, prefix + "epispiral_holes_weight")); } private: T m_N; T m_Thickness; T m_Holes; + T m_ThicknessWeight;//Precalc. + T m_HolesWeight; }; /// @@ -179,16 +191,16 @@ public: ostringstream ss, ss2; intmax_t i = 0, varIndex = IndexInXform(); ss2 << "_" << XformIndexInEmber() << "]"; - string index = ss2.str(); - string weight = WeightDefineString(); - string bwrapsCellsize = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string bwrapsSpace = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string bwrapsGain = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string index = ss2.str(); + string weight = WeightDefineString(); + string bwrapsCellsize = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string bwrapsSpace = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string bwrapsGain = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string bwrapsInnerTwist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string bwrapsOuterTwist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string g2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string r2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string rfactor = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string g2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string r2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string rfactor = "parVars[" + ToUpper(m_Params[i++].Name()) + index; ss << "\t{\n" << "\t\tif (" << bwrapsCellsize << " == 0)\n" << "\t\t{\n" @@ -4161,7 +4173,7 @@ template class OrthoVariation : public ParametricVariation { public: - OrthoVariation(T weight = 1.0) : ParametricVariation("ortho", eVariationId::VAR_ORTHO, weight, true, false, false, false, true) + OrthoVariation(T weight = 1.0) : ParametricVariation("ortho", eVariationId::VAR_ORTHO, weight, true, true, true, false, false) { Init(); } @@ -4204,8 +4216,8 @@ public: else { r = 1 / std::sqrt(r); - ts = std::sin(helper.m_PrecalcAtanyx); - tc = std::cos(helper.m_PrecalcAtanyx); + ts = helper.m_PrecalcSina; + tc = helper.m_PrecalcCosa; x = r * tc; y = r * ts; @@ -4296,8 +4308,8 @@ public: << "\t\telse\n" << "\t\t{\n" << "\t\t r = 1 / sqrt(r);\n" - << "\t\t ts = sin(precalcAtanyx);\n" - << "\t\t tc = cos(precalcAtanyx);\n" + << "\t\t ts = precalcSina;\n" + << "\t\t tc = precalcCosa;\n" << "\t\t x = r * tc;\n" << "\t\t y = r * ts;\n" << "\t\t real_t x2 = SQR(x);\n" diff --git a/Source/Ember/Variations03.h b/Source/Ember/Variations03.h index 3ed273b..72b49a1 100644 --- a/Source/Ember/Variations03.h +++ b/Source/Ember/Variations03.h @@ -1390,7 +1390,7 @@ template class CropNVariation : public ParametricVariation { public: - CropNVariation(T weight = 1.0) : ParametricVariation("cropn", eVariationId::VAR_CROPN, weight, true, true, false, false, true) + CropNVariation(T weight = 1.0) : ParametricVariation("cropn", eVariationId::VAR_CROPN, weight, true, true, true, false, true) { Init(); } @@ -1413,8 +1413,8 @@ public: else { T rdc = xr + (rand.Frand01() * T(0.5) * m_ScatterDist); - helper.Out.x = m_Weight * rdc * std::cos(helper.m_PrecalcAtanyx); - helper.Out.y = m_Weight * rdc * std::sin(helper.m_PrecalcAtanyx); + helper.Out.x = m_Weight * rdc * helper.m_PrecalcCosa; + helper.Out.y = m_Weight * rdc * helper.m_PrecalcSina; } } else @@ -1431,14 +1431,14 @@ public: ostringstream ss, ss2; intmax_t i = 0, varIndex = IndexInXform(); ss2 << "_" << XformIndexInEmber() << "]"; - string index = ss2.str(); - string weight = WeightDefineString(); - string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string index = ss2.str(); + string weight = WeightDefineString(); + string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string scatterDist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string zero = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string workPower = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string alpha = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string zero = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string workPower = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string alpha = "parVars[" + ToUpper(m_Params[i++].Name()) + index; ss << "\t{\n" << "\t\treal_t xang = (precalcAtanyx + MPI) / " << alpha << ";\n" << "\n" @@ -1457,8 +1457,8 @@ public: << "\t\t {\n" << "\t\t real_t rdc = fma(MwcNext01(mwc), (real_t)(0.5) * " << scatterDist << ", xr);\n" << "\n" - << "\t\t vOut.x = " << weight << " * rdc * cos(precalcAtanyx);\n" - << "\t\t vOut.y = " << weight << " * rdc * sin(precalcAtanyx);\n" + << "\t\t vOut.x = " << weight << " * rdc * precalcCosa;\n" + << "\t\t vOut.y = " << weight << " * rdc * precalcSina;\n" << "\t\t }\n" << "\t\t}\n" << "\t\telse\n" @@ -1574,7 +1574,7 @@ template class Blob2Variation : public ParametricVariation { public: - Blob2Variation(T weight = 1.0) : ParametricVariation("blob2", eVariationId::VAR_BLOB2, weight, true, true, false, false, true) + Blob2Variation(T weight = 1.0) : ParametricVariation("blob2", eVariationId::VAR_BLOB2, weight, true, true, true, false, true) { Init(); } @@ -1599,8 +1599,8 @@ public: delta = std::exp(m_Prescale * std::log(delta * positive)) * m_Postscale * positive; T rad = m_Radius + (helper.m_PrecalcSqrtSumSquares - m_Radius) * delta; - helper.Out.x = m_Weight * rad * std::cos(helper.m_PrecalcAtanyx); - helper.Out.y = m_Weight * rad * std::sin(helper.m_PrecalcAtanyx); + helper.Out.x = m_Weight * rad * helper.m_PrecalcCosa; + helper.Out.y = m_Weight * rad * helper.m_PrecalcSina; helper.Out.z = m_Weight * helper.In.z; //helper.m_TransZ += m_Weight * outPoint.m_Z;//Original had this which is probably wrong. } @@ -1611,16 +1611,16 @@ public: ostringstream ss, ss2; intmax_t i = 0, varIndex = IndexInXform(); ss2 << "_" << XformIndexInEmber() << "]"; - string index = ss2.str(); - string weight = WeightDefineString(); - string mode = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string prescale = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string index = ss2.str(); + string weight = WeightDefineString(); + string mode = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string prescale = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string postscale = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string symmetry = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string comp = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - string dataHelp = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string symmetry = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string comp = "parVars[" + ToUpper(m_Params[i++].Name()) + index; + string dataHelp = "parVars[" + ToUpper(m_Params[i++].Name()) + index; ss << "\t{\n" << "\t\tif (precalcSqrtSumSquares < " << radius << ")\n" << "\t\t{\n" @@ -1639,8 +1639,8 @@ public: << "\n" << "\t\t real_t rad = fma(precalcSqrtSumSquares - " << radius << ", delta, " << radius << ");\n" << "\n" - << "\t\t vOut.x = " << weight << " * rad * cos(precalcAtanyx);\n" - << "\t\t vOut.y = " << weight << " * rad * sin(precalcAtanyx);\n" + << "\t\t vOut.x = " << weight << " * rad * precalcCosa;\n" + << "\t\t vOut.y = " << weight << " * rad * precalcSina;\n" << "\t\t vOut.z = " << weight << " * vIn.z;\n" //<< "\t\t transZ += " << weight << " * outPoint->m_Z;\n"//Original had this which is probably wrong. << "\t\t}\n" diff --git a/Source/Ember/Variations04.h b/Source/Ember/Variations04.h index 0d79095..bfcc946 100644 --- a/Source/Ember/Variations04.h +++ b/Source/Ember/Variations04.h @@ -2512,7 +2512,7 @@ template class FourthVariation : public ParametricVariation { public: - FourthVariation(T weight = 1.0) : ParametricVariation("fourth", eVariationId::VAR_FOURTH, weight, true, true, false, false, true) + FourthVariation(T weight = 1.0) : ParametricVariation("fourth", eVariationId::VAR_FOURTH, weight, true, true, true, false, false) { Init(); } @@ -2524,8 +2524,8 @@ public: if (helper.In.x > 0 && helper.In.y > 0)//Quadrant IV: spherical. { T r = 1 / helper.m_PrecalcSqrtSumSquares; - helper.Out.x = m_Weight * r * std::cos(helper.m_PrecalcAtanyx); - helper.Out.y = m_Weight * r * std::sin(helper.m_PrecalcAtanyx); + helper.Out.x = m_Weight * r * helper.m_PrecalcCosa; + helper.Out.y = m_Weight * r * helper.m_PrecalcSina; } else if (helper.In.x > 0 && helper.In.y < 0)//Quadrant I: loonie. { @@ -2590,8 +2590,8 @@ public: << "\t\t{\n" << "\t\t real_t r = 1 / precalcSqrtSumSquares;\n" << "\n" - << "\t\t vOut.x = " << weight << " * r * cos(precalcAtanyx);\n" - << "\t\t vOut.y = " << weight << " * r * sin(precalcAtanyx);\n" + << "\t\t vOut.x = " << weight << " * r * precalcCosa;\n" + << "\t\t vOut.y = " << weight << " * r * precalcSina;\n" << "\t\t}\n" << "\t\telse if (vIn.x > 0 && vIn.y < 0)\n" << "\t\t{\n" @@ -2833,7 +2833,7 @@ template class SpherivoidVariation : public ParametricVariation { public: - SpherivoidVariation(T weight = 1.0) : ParametricVariation("spherivoid", eVariationId::VAR_SPHERIVOID, weight, true, true, false, false, true) + SpherivoidVariation(T weight = 1.0) : ParametricVariation("spherivoid", eVariationId::VAR_SPHERIVOID, weight, true, true, true, false, false) { Init(); } @@ -2846,8 +2846,8 @@ public: const T phi = std::acos(Clamp(helper.In.z / zr, -1, 1)); const T ps = std::sin(phi); const T pc = std::cos(phi); - helper.Out.x = m_Weight * std::cos(helper.m_PrecalcAtanyx) * ps * (zr + m_Radius); - helper.Out.y = m_Weight * std::sin(helper.m_PrecalcAtanyx) * ps * (zr + m_Radius); + helper.Out.x = m_Weight * helper.m_PrecalcCosa * ps * (zr + m_Radius); + helper.Out.y = m_Weight * helper.m_PrecalcSina * ps * (zr + m_Radius); helper.Out.z = m_Weight * pc * (zr + m_Radius); } @@ -2865,8 +2865,8 @@ public: << "\t\tconst real_t ps = sin(phi);\n" << "\t\tconst real_t pc = cos(phi);\n" << "\n" - << "\t\tvOut.x = " << weight << " * cos(precalcAtanyx) * ps * (zr + " << radius << ");\n" - << "\t\tvOut.y = " << weight << " * sin(precalcAtanyx) * ps * (zr + " << radius << ");\n" + << "\t\tvOut.x = " << weight << " * precalcCosa * ps * (zr + " << radius << ");\n" + << "\t\tvOut.y = " << weight << " * precalcSina * ps * (zr + " << radius << ");\n" << "\t\tvOut.z = " << weight << " * pc * (zr + " << radius << ");\n" << "\t}\n"; return ss.str(); @@ -5407,8 +5407,8 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = helper.m_PrecalcSqrtSumSquares * (m_BlobLow + m_BlobDiff * (T(0.5) + T(0.5) * std::sin(m_BlobWaves * helper.m_PrecalcAtanxy))); - helper.Out.x = m_Weight * helper.m_PrecalcSina * r; - helper.Out.y = m_Weight * helper.m_PrecalcCosa * r; + helper.Out.x = m_Weight * helper.m_PrecalcCosa * r;//Flipped from original JWildfire plugin which did atan2(x, y) then sin, cos. + helper.Out.y = m_Weight * helper.m_PrecalcSina * r;//Here we do atan(y, x) then cos, sin. helper.Out.z = m_Weight * std::sin(m_BlobWaves * helper.m_PrecalcAtanxy) * r; } @@ -5426,8 +5426,8 @@ public: ss << "\t{\n" << "\t\treal_t r = precalcSqrtSumSquares * fma(" << blobDiff << ", fma((real_t)(0.5), sin(" << blobWaves << " * precalcAtanxy), (real_t)(0.5)), " << blobLow << ");\n" << "\n" - << "\t\tvOut.x = " << weight << " * (precalcSina * r);\n" - << "\t\tvOut.y = " << weight << " * (precalcCosa * r);\n" + << "\t\tvOut.x = " << weight << " * (precalcCosa * r);\n" + << "\t\tvOut.y = " << weight << " * (precalcSina * r);\n" << "\t\tvOut.z = " << weight << " * (sin(" << blobWaves << " * precalcAtanxy) * r);\n" << "\t}\n"; return ss.str(); diff --git a/Source/Ember/Variations07.h b/Source/Ember/Variations07.h index 1b7fae4..ad7810d 100644 --- a/Source/Ember/Variations07.h +++ b/Source/Ember/Variations07.h @@ -5446,7 +5446,7 @@ protected: m_Params.push_back(ParamWithName(&m_Roundstr, prefix + "smartshape_roundstr")); m_Params.push_back(ParamWithName(&m_Roundwidth, prefix + "smartshape_roundwidth", 1)); m_Params.push_back(ParamWithName(&m_Distortion, prefix + "smartshape_distortion", 1)); - m_Params.push_back(ParamWithName(&m_Compensation, prefix + "smartshape_compensation", 1, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Compensation, prefix + "smartshape_compensation", 0, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(true, &m_Alpha, prefix + "smartshape_alpha"));//Precalc. m_Params.push_back(ParamWithName(true, &m_AlphaCoeff, prefix + "smartshape_alphacoeff")); m_Params.push_back(ParamWithName(true, &m_RoundCoeff, prefix + "smartshape_roundcoeff")); diff --git a/Source/Ember/Xform.h b/Source/Ember/Xform.h index 77af5db..3b12db0 100644 --- a/Source/Ember/Xform.h +++ b/Source/Ember/Xform.h @@ -874,8 +874,8 @@ public: if (m_NeedPrecalcAngles) { - helper.m_PrecalcSina = helper.m_TransX / Zeps(helper.m_PrecalcSqrtSumSquares); - helper.m_PrecalcCosa = helper.m_TransY / Zeps(helper.m_PrecalcSqrtSumSquares); + helper.m_PrecalcCosa = helper.m_TransX / Zeps(helper.m_PrecalcSqrtSumSquares); + helper.m_PrecalcSina = helper.m_TransY / Zeps(helper.m_PrecalcSqrtSumSquares); } } } diff --git a/Source/Ember/XmlToEmber.cpp b/Source/Ember/XmlToEmber.cpp index fda90b3..a2d3d84 100644 --- a/Source/Ember/XmlToEmber.cpp +++ b/Source/Ember/XmlToEmber.cpp @@ -235,6 +235,11 @@ XmlToEmber::XmlToEmber() { "sshape_roundwidth", "smartshape_roundwidth" }, { "sshape_distortion", "smartshape_distortion" }, { "sshape_compensation", "smartshape_compensation" }, + { "post_sshape_power", "post_smartshape_power" }, + { "post_sshape_roundstr", "post_smartshape_roundstr" }, + { "post_sshape_roundwidth", "post_smartshape_roundwidth" }, + { "post_sshape_distortion", "post_smartshape_distortion" }, + { "post_sshape_compensation", "post_smartshape_compensation" }, { "mult_x", "unicorngaloshen_mult_x" }, { "mult_y", "unicorngaloshen_mult_y" }, { "sine", "unicorngaloshen_sine" }, @@ -347,6 +352,24 @@ XmlToEmber::XmlToEmber() }; m_BadVariationNames.push_back(make_pair(make_pair(string("post_scrop"), string("post_smartcrop")), badParams)); badParams = + { + "sshape_power", + "sshape_roundstr", + "sshape_roundwidth", + "sshape_distortion", + "sshape_compensation" + }; + m_BadVariationNames.push_back(make_pair(make_pair(string("sshape"), string("smartshape")), badParams)); + badParams = + { + "post_sshape_power", + "post_sshape_roundstr", + "post_sshape_roundwidth", + "post_sshape_distortion", + "post_sshape_compensation" + }; + m_BadVariationNames.push_back(make_pair(make_pair(string("post_sshape"), string("post_smartshape")), badParams)); + badParams = { "radial_gaussian_angle" }; @@ -2168,9 +2191,9 @@ bool XmlToEmber::ParseEmberElement(xmlNode* emberNode, Ember& currentEmber if (!fromEmber && !newLinear) currentEmber.Flatten(m_FlattenNames); - for (i = 0; i < currentEmber.XformCount(); i++) - if (soloXform >= 0 && i != soloXform) - currentEmber.GetXform(i)->m_Opacity = 0;//Will calc the cached adjusted viz value later. + if (soloXform >= 0) + for (i = 0; i < currentEmber.XformCount(); i++) + currentEmber.GetXform(i)->m_Opacity = T(i == soloXform);//Will calc the cached adjusted viz value later. return true; } diff --git a/Source/EmberCL/IterOpenCLKernelCreator.cpp b/Source/EmberCL/IterOpenCLKernelCreator.cpp index 34b1e30..61b4d0b 100644 --- a/Source/EmberCL/IterOpenCLKernelCreator.cpp +++ b/Source/EmberCL/IterOpenCLKernelCreator.cpp @@ -149,8 +149,8 @@ string IterOpenCLKernelCreator::CreateIterKernelString(const Ember& ember, if (xform->NeedPrecalcAngles()) { - xformFuncs << "\tprecalcSina = transX / Zeps(precalcSqrtSumSquares);\n"; - xformFuncs << "\tprecalcCosa = transY / Zeps(precalcSqrtSumSquares);\n"; + xformFuncs << "\tprecalcCosa = transX / Zeps(precalcSqrtSumSquares);\n"; + xformFuncs << "\tprecalcSina = transY / Zeps(precalcSqrtSumSquares);\n"; } if (xform->NeedPrecalcAtanXY()) diff --git a/Source/Fractorium/AboutDialog.ui b/Source/Fractorium/AboutDialog.ui index ce680f5..1b06e76 100644 --- a/Source/Fractorium/AboutDialog.ui +++ b/Source/Fractorium/AboutDialog.ui @@ -58,7 +58,7 @@ QFrame::NoFrame - <html><head/><body><p align="center"><span style=" font-size:10pt;">Fractorium 1.0.0.17</span></p><p align="center"><span style=" font-size:10pt;">A Qt-based fractal flame editor which uses a C++ re-write of the flam3 algorithm named Ember and a GPU capable version named EmberCL which implements a portion of the cuburn algorithm in OpenCL.</span></p><p align="center"><a href="http://fractorium.com"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">fractorium.com</span></a></p></body></html> + <html><head/><body><p align="center"><span style=" font-size:10pt;">Fractorium 1.0.0.18</span></p><p align="center"><span style=" font-size:10pt;">A Qt-based fractal flame editor which uses a C++ re-write of the flam3 algorithm named Ember and a GPU capable version named EmberCL which implements a portion of the cuburn algorithm in OpenCL.</span></p><p align="center"><a href="http://fractorium.com"><span style=" font-size:10pt; text-decoration: underline; color:#0000ff;">fractorium.com</span></a></p></body></html> Qt::RichText @@ -79,7 +79,7 @@ true - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + Qt::NoTextInteraction diff --git a/Source/Fractorium/FinalRenderEmberController.cpp b/Source/Fractorium/FinalRenderEmberController.cpp index 202a731..f43a64a 100644 --- a/Source/Fractorium/FinalRenderEmberController.cpp +++ b/Source/Fractorium/FinalRenderEmberController.cpp @@ -111,26 +111,30 @@ FinalRenderEmberController::FinalRenderEmberController(FractoriumFinalRenderD m_GuiState = m_FinalRenderDialog->State();//Cache render settings from the GUI before running. size_t i = 0; bool doAll = m_GuiState.m_DoAll && m_EmberFile.Size() > 1; + bool isBump = !doAll && m_IsQualityBump && m_GuiState.m_Strips == 1;//Should never get called with m_IsQualityBump otherwise, but check one last time to be safe. size_t currentStripForProgress = 0;//Sort of a hack to get the strip value to the progress function. QString path = doAll ? ComposePath(QString::fromStdString(m_EmberFile.m_Embers.begin()->m_Name)) : ComposePath(Name()); QString backup = path + "_backup.flame"; - - //Save backup Xml. - if (doAll) - m_XmlWriter.Save(backup.toStdString().c_str(), m_EmberFile.m_Embers, 0, true, false, true, false, false); - else - m_XmlWriter.Save(backup.toStdString().c_str(), *m_Ember, 0, true, false, true, false, false); - m_FinishedImageCount.store(0); Pause(false); - SyncGuiToRenderer(); - FirstOrDefaultRenderer()->m_ProgressParameter = reinterpret_cast(¤tStripForProgress);//When animating, only the first (primary) device has a progress parameter. - m_GuiState.m_Strips = VerifyStrips(m_Ember->m_FinalRasH, m_GuiState.m_Strips, - [&](const string & s) { Output(QString::fromStdString(s)); }, //Greater than height. - [&](const string & s) { Output(QString::fromStdString(s)); }, //Mod height != 0. - [&](const string & s) { Output(QString::fromStdString(s) + "\n"); }); //Final strips value to be set. ResetProgress(); + if (!isBump) + { + //Save backup Xml. + if (doAll) + m_XmlWriter.Save(backup.toStdString().c_str(), m_EmberFile.m_Embers, 0, true, false, true, false, false); + else + m_XmlWriter.Save(backup.toStdString().c_str(), *m_Ember, 0, true, false, true, false, false); + + SyncGuiToRenderer(); + FirstOrDefaultRenderer()->m_ProgressParameter = reinterpret_cast(¤tStripForProgress);//When animating, only the first (primary) device has a progress parameter. + m_GuiState.m_Strips = VerifyStrips(m_Ember->m_FinalRasH, m_GuiState.m_Strips, + [&](const string & s) { Output(QString::fromStdString(s)); }, //Greater than height. + [&](const string & s) { Output(QString::fromStdString(s)); }, //Mod height != 0. + [&](const string & s) { Output(QString::fromStdString(s) + "\n"); }); //Final strips value to be set. + } + //The rendering process is different between doing a single image, and doing multiple. if (doAll) { @@ -291,7 +295,6 @@ FinalRenderEmberController::FinalRenderEmberController(FractoriumFinalRenderD } else if (m_Renderer.get())//Render a single image. { - bool isBump = m_IsQualityBump && m_GuiState.m_Strips == 1;//Should never get called with m_IsQualityBump otherwise, but check one last time to be safe. m_ImageCount = 1; m_Ember->m_TemporalSamples = 1; m_Renderer->SetEmber(*m_Ember, isBump ? eProcessAction::KEEP_ITERATING : eProcessAction::FULL_RENDER); diff --git a/debian/changelog b/debian/changelog index 7d66622..a55f384 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +fractorium (1.0.0.18-0ubuntu1) bionic; urgency=low + + * release 1.0.0.18 + + -- Matt Feemster Wed, 25 Dec 2019 20:20:20 -0700 + fractorium (1.0.0.17a-0ubuntu1) bionic; urgency=low * release 1.0.0.17