--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.
This commit is contained in:
Person
2019-12-27 21:04:41 -08:00
parent 35d4eb3464
commit 0b0405382f
25 changed files with 192 additions and 148 deletions

View File

@ -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<T>::epsilon()//Apoplugin.h uses -20, but it's more mathematically correct to do it this way.

View File

@ -43,7 +43,7 @@ void RendererBase::ChangeVal(std::function<void(void)> 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;

View File

@ -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";
}
}
}

View File

@ -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<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& 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<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& 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<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& 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<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& 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();

View File

@ -56,12 +56,12 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T theta = helper.m_PrecalcAtanyx;
T t = (rand.Frand01<T>() * m_Thickness) * (1 / std::cos(m_N * theta)) - m_Holes;
T t = (!m_ThicknessWeight ? m_Weight : m_ThicknessWeight * rand.Frand01<T>()) / 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<T>(&m_N, prefix + "epispiral_n", 6));
m_Params.push_back(ParamWithName<T>(&m_Thickness, prefix + "epispiral_thickness"));
m_Params.push_back(ParamWithName<T>(&m_Holes, prefix + "epispiral_holes", 1));
m_Params.push_back(ParamWithName<T>(true, &m_ThicknessWeight, prefix + "epispiral_thickness_weight")); //Precalc.
m_Params.push_back(ParamWithName<T>(true, &m_HolesWeight, prefix + "epispiral_holes_weight"));
}
private:
T m_N;
T m_Thickness;
T m_Holes;
T m_ThicknessWeight;//Precalc.
T m_HolesWeight;
};
/// <summary>
@ -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 <typename T>
class OrthoVariation : public ParametricVariation<T>
{
public:
OrthoVariation(T weight = 1.0) : ParametricVariation<T>("ortho", eVariationId::VAR_ORTHO, weight, true, false, false, false, true)
OrthoVariation(T weight = 1.0) : ParametricVariation<T>("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"

View File

@ -1390,7 +1390,7 @@ template <typename T>
class CropNVariation : public ParametricVariation<T>
{
public:
CropNVariation(T weight = 1.0) : ParametricVariation<T>("cropn", eVariationId::VAR_CROPN, weight, true, true, false, false, true)
CropNVariation(T weight = 1.0) : ParametricVariation<T>("cropn", eVariationId::VAR_CROPN, weight, true, true, true, false, true)
{
Init();
}
@ -1413,8 +1413,8 @@ public:
else
{
T rdc = xr + (rand.Frand01<T>() * 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 <typename T>
class Blob2Variation : public ParametricVariation<T>
{
public:
Blob2Variation(T weight = 1.0) : ParametricVariation<T>("blob2", eVariationId::VAR_BLOB2, weight, true, true, false, false, true)
Blob2Variation(T weight = 1.0) : ParametricVariation<T>("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"

View File

@ -2512,7 +2512,7 @@ template <typename T>
class FourthVariation : public ParametricVariation<T>
{
public:
FourthVariation(T weight = 1.0) : ParametricVariation<T>("fourth", eVariationId::VAR_FOURTH, weight, true, true, false, false, true)
FourthVariation(T weight = 1.0) : ParametricVariation<T>("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 <typename T>
class SpherivoidVariation : public ParametricVariation<T>
{
public:
SpherivoidVariation(T weight = 1.0) : ParametricVariation<T>("spherivoid", eVariationId::VAR_SPHERIVOID, weight, true, true, false, false, true)
SpherivoidVariation(T weight = 1.0) : ParametricVariation<T>("spherivoid", eVariationId::VAR_SPHERIVOID, weight, true, true, true, false, false)
{
Init();
}
@ -2846,8 +2846,8 @@ public:
const T phi = std::acos(Clamp<T>(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<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& 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();

View File

@ -5446,7 +5446,7 @@ protected:
m_Params.push_back(ParamWithName<T>(&m_Roundstr, prefix + "smartshape_roundstr"));
m_Params.push_back(ParamWithName<T>(&m_Roundwidth, prefix + "smartshape_roundwidth", 1));
m_Params.push_back(ParamWithName<T>(&m_Distortion, prefix + "smartshape_distortion", 1));
m_Params.push_back(ParamWithName<T>(&m_Compensation, prefix + "smartshape_compensation", 1, eParamType::INTEGER, 0, 1));
m_Params.push_back(ParamWithName<T>(&m_Compensation, prefix + "smartshape_compensation", 0, eParamType::INTEGER, 0, 1));
m_Params.push_back(ParamWithName<T>(true, &m_Alpha, prefix + "smartshape_alpha"));//Precalc.
m_Params.push_back(ParamWithName<T>(true, &m_AlphaCoeff, prefix + "smartshape_alphacoeff"));
m_Params.push_back(ParamWithName<T>(true, &m_RoundCoeff, prefix + "smartshape_roundcoeff"));

View File

@ -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);
}
}
}

View File

@ -235,6 +235,11 @@ XmlToEmber<T>::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<T>::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<T>::ParseEmberElement(xmlNode* emberNode, Ember<T>& 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;
}

View File

@ -149,8 +149,8 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& 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())

View File

@ -58,7 +58,7 @@
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Fractorium 1.0.0.17&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;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.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://fractorium.com&quot;&gt;&lt;span style=&quot; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;fractorium.com&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Fractorium 1.0.0.18&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;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.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://fractorium.com&quot;&gt;&lt;span style=&quot; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;fractorium.com&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
@ -79,7 +79,7 @@
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
<set>Qt::NoTextInteraction</set>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">

View File

@ -111,26 +111,30 @@ FinalRenderEmberController<T>::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<void*>(&currentStripForProgress);//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<void*>(&currentStripForProgress);//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<T>::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);