--User changes

-Further work on the About box.
 --Change qss files to make the text box in the About box be the same color as the one in the style dialog, so the link text is easier to see.
 --This requires reloading the qss file.

--Bug fixes
 -Pre/post assign method was wrong for Sphereblur, Concentric, RandCubes and PixelFlow.

--Code changes
 -Make Hypershift2 use MwcNextRange() instead of MwcNext() %.
 -Add m_HasPre to Xform similar to m_HasPost, to skip application of the affine if it's the ID matrix (in this case just assign the input x and y points). This gives a 5% speedup.
This commit is contained in:
Person
2018-09-18 20:49:38 -07:00
parent 0a3d41de36
commit 5f3a97e825
10 changed files with 76 additions and 26 deletions

View File

@ -4515,8 +4515,8 @@ public:
string cy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t oscX = GdoffsFosc(" << dx << ", 1);\n"
<< "\t\treal_t oscY = GdoffsFosc(" << dy << ", 1);\n"
<< "\t\treal_t oscX = GdoffsFosc_(" << dx << ", 1);\n"
<< "\t\treal_t oscY = GdoffsFosc_(" << dy << ", 1);\n"
<< "\t\treal_t inX = vIn.x + " << cx << ";\n"
<< "\t\treal_t inY = vIn.y + " << cy << ";\n"
<< "\t\treal_t outX;\n"
@ -4524,13 +4524,13 @@ public:
<< "\n"
<< "\t\tif (" << square << " != 0)\n"
<< "\t\t{\n"
<< "\t\t outX = GdoffsFlip(GdoffsFlip(inX, GdoffsFosc(inX, 4), oscX), GdoffsFosc(GdoffsFclp(" << b << " * inX), 4), oscX);\n"
<< "\t\t outY = GdoffsFlip(GdoffsFlip(inY, GdoffsFosc(inY, 4), oscX), GdoffsFosc(GdoffsFclp(" << b << " * inY), 4), oscX);\n"
<< "\t\t outX = GdoffsFlip(GdoffsFlip(inX, GdoffsFosc_(inX, 4), oscX), GdoffsFosc_(GdoffsFclp(" << b << " * inX), 4), oscX);\n"
<< "\t\t outY = GdoffsFlip(GdoffsFlip(inY, GdoffsFosc_(inY, 4), oscX), GdoffsFosc_(GdoffsFclp(" << b << " * inY), 4), oscX);\n"
<< "\t\t}\n"
<< "\t\telse\n"
<< "\t\t{\n"
<< "\t\t outX = GdoffsFlip(GdoffsFlip(inX, GdoffsFosc(inX, 4), oscX), GdoffsFosc(GdoffsFclp(" << b << " * inX), 4), oscX);\n"
<< "\t\t outY = GdoffsFlip(GdoffsFlip(inY, GdoffsFosc(inY, 4), oscY), GdoffsFosc(GdoffsFclp(" << b << " * inY), 4), oscY);\n"
<< "\t\t outX = GdoffsFlip(GdoffsFlip(inX, GdoffsFosc_(inX, 4), oscX), GdoffsFosc_(GdoffsFclp(" << b << " * inX), 4), oscX);\n"
<< "\t\t outY = GdoffsFlip(GdoffsFlip(inY, GdoffsFosc_(inY, 4), oscY), GdoffsFosc_(GdoffsFclp(" << b << " * inY), 4), oscY);\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.x = " << weight << " * outX;\n"
@ -4546,7 +4546,7 @@ public:
"inline real_t GdoffsFcip(real_t a) { return (real_t)((a < 0) ? -((int)(fabs(a)) + 1) : 0) + ((a > 1) ? ((int)(a)) : 0); }\n"
"inline real_t GdoffsFclp(real_t a) { return ((a < 0) ? -(fmod(fabs(a), 1)) : fmod(fabs(a), 1)); }\n"
"inline real_t GdoffsFscl(real_t a) { return GdoffsFclp((a + 1) / 2); }\n"
"inline real_t GdoffsFosc(real_t p, real_t a) { return GdoffsFscl(-1 * cos(p * a * M_2PI)); }\n"
"inline real_t GdoffsFosc_(real_t p, real_t a) { return GdoffsFscl(-1 * cos(p * a * M_2PI)); }\n"//Underscore added to name to prevent false detection with the global function Fosc() in TestGlobalFuncs() in EmberTester.
"inline real_t GdoffsFlip(real_t a, real_t b, real_t c) { return fma(c, (b - a), a); }\n"
"\n";
}

View File

@ -2214,7 +2214,7 @@ public:
<< "\t\treal_t x = rad * fx + " << shift << ";\n"
<< "\t\treal_t y = rad * fy;\n"
<< "\t\trad = " << weight << " * " << shift << " / Zeps(fma(x, x, SQR(y)));\n"
<< "\t\treal_t angle = ((MwcNext(mwc) % (int)" << p << ") * 2 + 1) * M_PI / " << p << ";\n"
<< "\t\treal_t angle = (MwcNextRange(mwc, (int)" << p << ") * 2 + 1) * M_PI / " << p << ";\n"
<< "\t\treal_t X = fma(rad, x, " << shift << ");\n"
<< "\t\treal_t Y = rad * y;\n"
<< "\t\treal_t cosa = cos(angle);\n"
@ -2287,9 +2287,9 @@ MAKEPREPOSTVAR(Panorama2, panorama2, PANORAMA2)
//MAKEPREPOSTPARVAR(Arcsinh, arcsinh, ARCSINH)
MAKEPREPOSTPARVAR(Helicoid, helicoid, HELICOID)
MAKEPREPOSTPARVAR(Helix, helix, HELIX)
MAKEPREPOSTPARVAR(Sphereblur, sphereblur, SPHEREBLUR)
MAKEPREPOSTPARVARASSIGN(Sphereblur, sphereblur, SPHEREBLUR, eVariationAssignType::ASSIGNTYPE_SUM)
MAKEPREPOSTPARVAR(Cpow3, cpow3, CPOW3)
MAKEPREPOSTPARVAR(Concentric, concentric, CONCENTRIC)
MAKEPREPOSTPARVARASSIGN(Concentric, concentric, CONCENTRIC, eVariationAssignType::ASSIGNTYPE_SUM)
MAKEPREPOSTPARVAR(Hypercrop, hypercrop, HYPERCROP)
MAKEPREPOSTPARVAR(Hypershift2, hypershift2, HYPERSHIFT2)
}

View File

@ -1657,6 +1657,6 @@ MAKEPREPOSTPARVAR(DCLinear, dc_linear, DC_LINEAR)
MAKEPREPOSTPARVAR(DCTriangle, dc_triangle, DC_TRIANGLE)
MAKEPREPOSTPARVAR(DCZTransl, dc_ztransl, DC_ZTRANSL)
MAKEPREPOSTPARVAR(DCPerlin, dc_perlin, DC_PERLIN)
MAKEPREPOSTPARVAR(RandCubes, randCubes, RAND_CUBES)
MAKEPREPOSTPARVARASSIGN(PixelFlow, pixel_flow, PIXEL_FLOW, eVariationAssignType::ASSIGNTYPE_SUM)
MAKEPREPOSTPARVARASSIGN(RandCubes, randCubes, RAND_CUBES, eVariationAssignType::ASSIGNTYPE_SUM)
MAKEPREPOSTPARVAR(PixelFlow, pixel_flow, PIXEL_FLOW)
}

View File

@ -88,6 +88,7 @@ public:
m_Post.D(pd);
m_Post.E(pe);
m_Post.F(pf);
m_HasPre = !m_Affine.IsID();
m_HasPost = !m_Post.IsID();
m_HasPreOrRegularVars = PreVariationCount() > 0 || VariationCount() > 0;
CacheColorVals();//Init already called this, but must call again since color was assigned above.
@ -155,6 +156,7 @@ public:
m_Animate = T(xform.m_Animate);
m_Opacity = T(xform.m_Opacity);
CacheColorVals();
m_HasPre = xform.HasPre();
m_HasPost = xform.HasPost();
m_HasPreOrRegularVars = xform.PreVariationCount() > 0 || xform.VariationCount() > 0;
m_Wind[0] = T(xform.m_Wind[0]);
@ -262,6 +264,7 @@ public:
m_NeedPrecalcAngles = false;
m_NeedPrecalcAtanXY = false;
m_NeedPrecalcAtanYX = false;
m_HasPre = false;
m_HasPost = false;
m_HasPreOrRegularVars = false;
m_ParentEmber = nullptr;
@ -605,8 +608,17 @@ public:
//Compute the pre affine portion of the transform.
//These x, y values are what get passed to the variations below.
//Note that they are not changed after this, except in the case of pre_ variations.
iterHelper.m_TransX = (m_Affine.A() * inPoint->m_X) + (m_Affine.B() * inPoint->m_Y) + m_Affine.C();
iterHelper.m_TransY = (m_Affine.D() * inPoint->m_X) + (m_Affine.E() * inPoint->m_Y) + m_Affine.F();
if (m_HasPre)
{
iterHelper.m_TransX = (m_Affine.A() * inPoint->m_X) + (m_Affine.B() * inPoint->m_Y) + m_Affine.C();
iterHelper.m_TransY = (m_Affine.D() * inPoint->m_X) + (m_Affine.E() * inPoint->m_Y) + m_Affine.F();
}
else
{
iterHelper.m_TransX = inPoint->m_X;
iterHelper.m_TransY = inPoint->m_Y;
}
iterHelper.m_TransZ = inPoint->m_Z;
//Apply pre_ variations, these don't affect outPoint, only iterHelper.m_TransX, Y, Z.
@ -786,6 +798,7 @@ public:
inline bool NeedPrecalcAtanXY() const { return m_NeedPrecalcAtanXY; }
inline bool NeedPrecalcAtanYX() const { return m_NeedPrecalcAtanYX; }
inline bool NeedAnyPrecalc() const { return NeedPrecalcSumSquares() || NeedPrecalcSqrtSumSquares() || NeedPrecalcAngles() || NeedPrecalcAtanXY() || NeedPrecalcAtanYX(); }
bool HasPre() const { return m_HasPre; }
bool HasPost() const { return m_HasPost; }
size_t PreVariationCount() const { return m_PreVariations.size(); }
size_t VariationCount() const { return m_Variations.size(); }
@ -812,6 +825,7 @@ public:
m_NeedPrecalcAngles = false;
m_NeedPrecalcAtanXY = false;
m_NeedPrecalcAtanYX = false;
m_HasPre = !m_Affine.IsID();
m_HasPost = !m_Post.IsID();
m_HasPreOrRegularVars = PreVariationCount() > 0 || VariationCount() > 0;
@ -1184,6 +1198,7 @@ public:
private:
vector<Variation<T>*> m_PreVariations;//The list of pre variations to call when applying this xform.
vector<Variation<T>*> m_Variations;//The list of variations to call when applying this xform.
bool m_HasPre;//Whether a pre affine transform is present.
bool m_HasPost;//Whether a post affine transform is present.
public: