mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-02-23 13:31:31 -05:00
--User changes
-Add buttons to copy and paste affine transforms. -Show xform names on the column headers of the xaos table. -Add a color-coded third column to the variations tree which shows any properties of each variation which are non-standard. -Draw a transparent circle over hovered xforms. -Change how xforms respond to dragging. Rotate only is now the default, and scale will only happen with shift. --Optionally do scale and rotate when holding shift, via a setting in the options dialog. --Bug fixes -Snapping when dragging was wrong sometimes. -The program would very rarely crash on startup due to some values being in an uninitialized state. --Code changes -Change almost every variation to use fma() in OpenCL when doing computations of the form a * b + c. This provides a slight speedup, mostly in double precision mode. -Also apply fma() to affine calcs. -Cleanup of OpenGL affine drawing code. -Separate the concept of hovering and selecting xforms.
This commit is contained in:
parent
dee4304bf2
commit
15fdc860b8
@ -13,7 +13,7 @@
|
|||||||
<!--
|
<!--
|
||||||
Change this for every release.
|
Change this for every release.
|
||||||
-->
|
-->
|
||||||
<?define ProductCode="{0F7914AA-B53C-414F-B5A0-1DC3C205499C}"?>
|
<?define ProductCode="{4F4DD452-456A-4995-ABE8-7968DF33F661}"?>
|
||||||
|
|
||||||
<Product Id="$(var.ProductCode)" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
|
<Product Id="$(var.ProductCode)" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
|
||||||
<Package
|
<Package
|
||||||
|
@ -547,7 +547,7 @@ bool PaletteList<T>::Save(const string& filename)
|
|||||||
os << " source_colors=\"";
|
os << " source_colors=\"";
|
||||||
|
|
||||||
for (auto& sc : pal.m_SourceColors)//Need to clamp these each from 0 to 1. Use our custom clamp funcs.//TODO
|
for (auto& sc : pal.m_SourceColors)//Need to clamp these each from 0 to 1. Use our custom clamp funcs.//TODO
|
||||||
os << sc.first << "," << sc.second.r << "," << sc.second.g << "," << sc.second.b << " ";
|
os << Clamp<T>(sc.first, 0, 1) << "," << Clamp<T>(sc.second.r, 0, 1) << "," << Clamp<T>(sc.second.g, 0, 1) << "," << Clamp<T>(sc.second.b, 0, 1) << " ";
|
||||||
|
|
||||||
os << "\"";
|
os << "\"";
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,11 @@ Renderer<T, bucketT>::Renderer()
|
|||||||
//Use a very large number regardless of the size of the output pixels. This should be sufficient granularity, even though
|
//Use a very large number regardless of the size of the output pixels. This should be sufficient granularity, even though
|
||||||
//it's technically less than the number of distinct values representable by a 32-bit float.
|
//it's technically less than the number of distinct values representable by a 32-bit float.
|
||||||
m_Csa.resize(size_t(CURVES_LENGTH));
|
m_Csa.resize(size_t(CURVES_LENGTH));
|
||||||
|
//Ensure the renderer at least has sane values for the camera upon startup.
|
||||||
|
//This is needed because due to timing/threading disconnects, the GUI can use the camera
|
||||||
|
//values before the render has started, which will lead to corrupt values.
|
||||||
|
Ember<T> ember;
|
||||||
|
SetEmber(ember, eProcessAction::NOTHING, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -160,8 +160,8 @@ public:
|
|||||||
<< "\t\treal_t c1 = sin(precalcSumSquares);\n"
|
<< "\t\treal_t c1 = sin(precalcSumSquares);\n"
|
||||||
<< "\t\treal_t c2 = cos(precalcSumSquares);\n"
|
<< "\t\treal_t c2 = cos(precalcSumSquares);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (c1 * vIn.x - c2 * vIn.y);\n"
|
<< "\t\tvOut.x = " << weight << " * fma(c1, vIn.x, -(c2 * vIn.y));\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (c2 * vIn.x + c1 * vIn.y);\n"
|
<< "\t\tvOut.y = " << weight << " * fma(c2, vIn.x, c1 * vIn.y);\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -711,8 +711,8 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t c10 = xform->m_B;\n"
|
<< "\t\treal_t c10 = xform->m_B;\n"
|
||||||
<< "\t\treal_t c11 = xform->m_E;\n"
|
<< "\t\treal_t c11 = xform->m_E;\n"
|
||||||
<< "\t\treal_t nx = vIn.x + c10 * sin(vIn.y * " << dx2 << ");\n"
|
<< "\t\treal_t nx = fma(c10, sin(vIn.y * " << dx2 << "), vIn.x);\n"
|
||||||
<< "\t\treal_t ny = vIn.y + c11 * sin(vIn.x * " << dy2 << ");\n"
|
<< "\t\treal_t ny = fma(c11, sin(vIn.x * " << dy2 << "), vIn.y);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (" << weight << " * nx);\n"
|
<< "\t\tvOut.x = (" << weight << " * nx);\n"
|
||||||
<< "\t\tvOut.y = (" << weight << " * ny);\n"
|
<< "\t\tvOut.y = (" << weight << " * ny);\n"
|
||||||
@ -824,8 +824,8 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t dx = tan(3 * vIn.y);\n"
|
<< "\t\treal_t dx = tan(3 * vIn.y);\n"
|
||||||
<< "\t\treal_t dy = tan(3 * vIn.x);\n"
|
<< "\t\treal_t dy = tan(3 * vIn.x);\n"
|
||||||
<< "\t\treal_t nx = vIn.x + xform->m_C * sin(dx);\n"
|
<< "\t\treal_t nx = fma(xform->m_C, sin(dx), vIn.x);\n"
|
||||||
<< "\t\treal_t ny = vIn.y + xform->m_F * sin(dy);\n"
|
<< "\t\treal_t ny = fma(xform->m_F, sin(dy), vIn.y);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * nx;\n"
|
<< "\t\tvOut.x = " << weight << " * nx;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * ny;\n"
|
<< "\t\tvOut.y = " << weight << " * ny;\n"
|
||||||
@ -1003,7 +1003,7 @@ public:
|
|||||||
<< "\t\treal_t dx = Zeps(xform->m_C * xform->m_C);\n"
|
<< "\t\treal_t dx = Zeps(xform->m_C * xform->m_C);\n"
|
||||||
<< "\t\treal_t r = precalcSqrtSumSquares;\n"
|
<< "\t\treal_t r = precalcSqrtSumSquares;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tr = " << weight << " * (fmod(r + dx, 2 * dx) - dx + r * (1 - dx));\n"
|
<< "\t\tr = " << weight << " * (fmod(r + dx, 2 * dx) + fma(r, (1 - dx), -dx));\n"
|
||||||
<< "\t\tvOut.x = r * precalcCosa;\n"
|
<< "\t\tvOut.x = r * precalcCosa;\n"
|
||||||
<< "\t\tvOut.y = r * precalcSina;\n"
|
<< "\t\tvOut.y = r * precalcSina;\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
@ -1119,10 +1119,10 @@ public:
|
|||||||
string blobWaves = "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"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = precalcSqrtSumSquares * (" << blobLow << " + " << blobDiff << " * ((real_t)(0.5) + (real_t)(0.5) * sin(" << blobWaves << " * precalcAtanxy)));\n"
|
<< "\t\treal_t r = precalcSqrtSumSquares * fma(" << blobDiff << ", fma((real_t)(0.5), sin(" << blobWaves << " * precalcAtanxy), (real_t)(0.5)), " << blobLow << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (" << weight << " * precalcSina * r);\n"
|
<< "\t\tvOut.x = " << weight << " * precalcSina * r;\n"
|
||||||
<< "\t\tvOut.y = (" << weight << " * precalcCosa * r);\n"
|
<< "\t\tvOut.y = " << weight << " * precalcCosa * r;\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -1389,7 +1389,8 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = precalcSqrtSumSquares;\n"
|
<< "\t\treal_t r = precalcSqrtSumSquares;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tr += -(real_t)(2.0) * " << rings2Val2 << " * (int)((r + " << rings2Val2 << ") / ((real_t)(2.0) * " << rings2Val2 << ")) + r * ((real_t)(1.0) - " << rings2Val2 << ");\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.x = (" << weight << " * precalcSina * r);\n"
|
||||||
<< "\t\tvOut.y = (" << weight << " * precalcCosa * r);\n"
|
<< "\t\tvOut.y = (" << weight << " * precalcCosa * r);\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
@ -1485,7 +1486,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t denom = (real_t)(0.25) * precalcSumSquares + 1;\n"
|
<< "\t\treal_t denom = fma((real_t)(0.25), precalcSumSquares, (real_t)(1.0));\n"
|
||||||
<< "\t\treal_t r = " << weight << " / denom;\n"
|
<< "\t\treal_t r = " << weight << " / denom;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * vIn.x;\n"
|
<< "\t\tvOut.x = r * vIn.x;\n"
|
||||||
@ -1687,7 +1688,7 @@ public:
|
|||||||
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tint tRnd = (int)(" << rn << " * MwcNext01(mwc));\n"
|
<< "\t\tint tRnd = (int)(" << rn << " * MwcNext01(mwc));\n"
|
||||||
<< "\t\treal_t tempr = (precalcAtanyx + M_2PI * tRnd) / " << power << ";\n"
|
<< "\t\treal_t tempr = fma(M_2PI, (real_t)tRnd, precalcAtanyx) / " << power << ";\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cos(tempr);\n"
|
<< "\t\tvOut.x = r * cos(tempr);\n"
|
||||||
@ -1782,9 +1783,9 @@ public:
|
|||||||
<< "\t\treal_t tempr, r;\n"
|
<< "\t\treal_t tempr, r;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif ((rnd & 1) == 0)\n"
|
<< "\t\tif ((rnd & 1) == 0)\n"
|
||||||
<< "\t\t tempr = (M_2PI * rnd + precalcAtanyx) / " << power << ";\n"
|
<< "\t\t tempr = fma(M_2PI, (real_t)rnd, precalcAtanyx) / " << power << ";\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t tempr = (M_2PI * rnd - precalcAtanyx) / " << power << ";\n"
|
<< "\t\t tempr = fma(M_2PI, (real_t)rnd, -precalcAtanyx) / " << power << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tr = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
<< "\t\tr = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -1958,11 +1959,11 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t rndG = " << weight << " * (MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) - (real_t)(2.0));\n"
|
<< "\t\treal_t rndG = " << weight << " * (MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) - (real_t)(2.0));\n"
|
||||||
<< "\t\treal_t ra = precalcSqrtSumSquares;\n"
|
<< "\t\treal_t ra = precalcSqrtSumSquares;\n"
|
||||||
<< "\t\treal_t tempa = precalcAtanyx + " << spin << " * rndG;\n"
|
<< "\t\treal_t tempa = fma(" << spin << ", rndG, precalcAtanyx);\n"
|
||||||
<< "\t\treal_t rz = " << zoom << " * rndG - 1;\n"
|
<< "\t\treal_t rz = fma(" << zoom << ", rndG, -1.0);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = ra * cos(tempa) + rz * vIn.x;\n"
|
<< "\t\tvOut.x = fma(ra, cos(tempa), rz * vIn.x);\n"
|
||||||
<< "\t\tvOut.y = ra * sin(tempa) + rz * vIn.y;\n"
|
<< "\t\tvOut.y = fma(ra, sin(tempa), rz * vIn.y);\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2030,8 +2031,8 @@ public:
|
|||||||
string thickness = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string thickness = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string pi2Slices = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string pi2Slices = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tint sl = (int)(MwcNext01(mwc) * " << slices << " + (real_t)(0.5));\n"
|
<< "\t\tint sl = (int)(fma(MwcNext01(mwc), " << slices << ", (real_t)(0.5)));\n"
|
||||||
<< "\t\treal_t a = " << rotation << " + " << pi2Slices << " * (sl + " << thickness << " * MwcNext01(mwc));\n"
|
<< "\t\treal_t a = fma(" << pi2Slices << ", fma(" << thickness << ", MwcNext01(mwc), sl), " << rotation << ");\n"
|
||||||
<< "\t\treal_t r = " << weight << " * MwcNext01(mwc);\n"
|
<< "\t\treal_t r = " << weight << " * MwcNext01(mwc);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cos(a);\n"
|
<< "\t\tvOut.x = r * cos(a);\n"
|
||||||
@ -2132,7 +2133,7 @@ public:
|
|||||||
<< "\t\tif (phi > (real_t)(0.5) * " << csides << ")\n"
|
<< "\t\tif (phi > (real_t)(0.5) * " << csides << ")\n"
|
||||||
<< "\t\t phi -= " << csides << ";\n"
|
<< "\t\t phi -= " << csides << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t amp = (" << corners << " * (1 / cos(phi) - 1) + " << circle << ") * " << weight << " * rFactor;\n"
|
<< "\t\treal_t amp = fma(" << corners << ", (1 / cos(phi) - 1), " << circle << ") * " << weight << " * rFactor;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = amp * vIn.x;\n"
|
<< "\t\tvOut.x = amp * vIn.x;\n"
|
||||||
<< "\t\tvOut.y = amp * vIn.y;\n"
|
<< "\t\tvOut.y = amp * vIn.y;\n"
|
||||||
@ -2218,12 +2219,12 @@ public:
|
|||||||
string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string c22 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c22 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t re = (real_t)(1.0) + " << c1 << " * vIn.x + " << c2 << " * (SQR(vIn.x) - SQR(vIn.y));\n"
|
<< "\t\treal_t re = (real_t)(1.0) + " << c1 << " * vIn.x + " << c2 << " * fma(vIn.x, vIn.x, -SQR(vIn.y));\n"
|
||||||
<< "\t\treal_t im = " << c1 << " * vIn.y + " << c22 << " * vIn.x * vIn.y;\n"
|
<< "\t\treal_t im = fma(" << c1 << ", vIn.y, " << c22 << " * vIn.x * vIn.y);\n"
|
||||||
<< "\t\treal_t r = " << weight << " / Zeps(SQR(re) + SQR(im));\n"
|
<< "\t\treal_t r = " << weight << " / Zeps(fma(re, re, SQR(im)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (vIn.x * re + vIn.y * im) * r;\n"
|
<< "\t\tvOut.x = fma(vIn.x, re, vIn.y * im) * r;\n"
|
||||||
<< "\t\tvOut.y = (vIn.y * re - vIn.x * im) * r;\n"
|
<< "\t\tvOut.y = fma(vIn.y, re, -(vIn.x * im)) * r;\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2303,12 +2304,12 @@ public:
|
|||||||
<< "\t\tif (" << x << " == 0)\n"
|
<< "\t\tif (" << x << " == 0)\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * vIn.x;\n"
|
<< "\t\t vOut.x = " << weight << " * vIn.x;\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t vOut.x = (" << weight << " * ((2 * floor(vIn.x / " << x << ") + 1) * " << x << " - vIn.x));\n"
|
<< "\t\t vOut.x = " << weight << " * fma(fma((real_t)(2.0), floor(vIn.x / " << x << "), 1), " << x << ", -vIn.x);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << y << " == 0)\n"
|
<< "\t\tif (" << y << " == 0)\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * vIn.y;\n"
|
<< "\t\t vOut.y = " << weight << " * vIn.y;\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t vOut.y = (" << weight << " * ((2 * floor(vIn.y / " << y << ") + 1) * " << y << " - vIn.y));\n"
|
<< "\t\t vOut.y = " << weight << " * fma(fma((real_t)(2.0), floor(vIn.y / " << y << "), 1), " << y << ", -vIn.y);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -2511,7 +2512,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t u = 1 / Zeps(tan(precalcSqrtSumSquares)) + (" << weight << " * SQR(M_2_PI));\n";
|
<< "\t\treal_t u = fma(" << weight << ", SQR(M_2_PI), 1 / Zeps(tan(precalcSqrtSumSquares)));\n";
|
||||||
|
|
||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
ss << "\t\toutPoint->m_X = outPoint->m_Y = 0;\n";
|
ss << "\t\toutPoint->m_X = outPoint->m_Y = 0;\n";
|
||||||
@ -2732,7 +2733,7 @@ public:
|
|||||||
T r = rand.Frand01<T>() * m_Weight * helper.m_PrecalcSqrtSumSquares;
|
T r = rand.Frand01<T>() * m_Weight * helper.m_PrecalcSqrtSumSquares;
|
||||||
T sinr, cosr, diff;
|
T sinr, cosr, diff;
|
||||||
sincos(r, &sinr, &cosr);
|
sincos(r, &sinr, &cosr);
|
||||||
diff = std::log10(sinr * sinr) + cosr;
|
diff = std::log10(SQR(sinr)) + cosr;
|
||||||
|
|
||||||
if (BadVal(diff))
|
if (BadVal(diff))
|
||||||
diff = -30.0;
|
diff = -30.0;
|
||||||
@ -2751,7 +2752,7 @@ public:
|
|||||||
<< "\t\treal_t r = MwcNext01(mwc) * " << weight << " * precalcSqrtSumSquares;\n"
|
<< "\t\treal_t r = MwcNext01(mwc) * " << weight << " * precalcSqrtSumSquares;\n"
|
||||||
<< "\t\treal_t sinr = sin(r);\n"
|
<< "\t\treal_t sinr = sin(r);\n"
|
||||||
<< "\t\treal_t cosr = cos(r);\n"
|
<< "\t\treal_t cosr = cos(r);\n"
|
||||||
<< "\t\treal_t diff = log10(sinr * sinr) + cosr;\n"
|
<< "\t\treal_t diff = log10(SQR(sinr)) + cosr;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (BadVal(diff))\n"
|
<< "\t\tif (BadVal(diff))\n"
|
||||||
<< "\t\t diff = -(real_t)(30.0);\n"
|
<< "\t\t diff = -(real_t)(30.0);\n"
|
||||||
@ -2951,7 +2952,7 @@ public:
|
|||||||
<< "\t\tt1 = pow(t1, " << n2 << ");\n"
|
<< "\t\tt1 = pow(t1, " << n2 << ");\n"
|
||||||
<< "\t\treal_t t2 = fabs(sin(theta));\n"
|
<< "\t\treal_t t2 = fabs(sin(theta));\n"
|
||||||
<< "\t\tt2 = pow(t2, " << n3 << ");\n"
|
<< "\t\tt2 = pow(t2, " << n3 << ");\n"
|
||||||
<< "\t\treal_t r = " << weight << " * ((" << rnd << " * MwcNext01(mwc) + ((real_t)(1.0) - " << rnd << ") * precalcSqrtSumSquares) - " << holes << ") * pow(t1 + t2, " << pNeg1N1 << ") / precalcSqrtSumSquares;\n"
|
<< "\t\treal_t r = " << weight << " * (fma(" << rnd << ", MwcNext01(mwc), ((real_t)(1.0) - " << rnd << ") * precalcSqrtSumSquares) - " << holes << ") * pow(t1 + t2, " << pNeg1N1 << ") / precalcSqrtSumSquares;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * vIn.x;\n"
|
<< "\t\tvOut.x = r * vIn.x;\n"
|
||||||
<< "\t\tvOut.y = r * vIn.y;\n"
|
<< "\t\tvOut.y = r * vIn.y;\n"
|
||||||
@ -3102,7 +3103,7 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t z = Zeps(precalcSqrtSumSquares);\n"
|
<< "\t\treal_t z = Zeps(precalcSqrtSumSquares);\n"
|
||||||
<< "\t\treal_t ct = vIn.x / precalcSqrtSumSquares;\n"
|
<< "\t\treal_t ct = vIn.x / precalcSqrtSumSquares;\n"
|
||||||
<< "\t\treal_t r = " << weight << " * (MwcNext01(mwc) - " << holes << ") * " << eccentricity << " / (1 + " << eccentricity << " * ct) / z;\n"
|
<< "\t\treal_t r = " << weight << " * (MwcNext01(mwc) - " << holes << ") * " << eccentricity << " / fma(" << eccentricity << ", ct, 1) / z;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * vIn.x;\n"
|
<< "\t\tvOut.x = r * vIn.x;\n"
|
||||||
<< "\t\tvOut.y = r * vIn.y;\n"
|
<< "\t\tvOut.y = r * vIn.y;\n"
|
||||||
@ -3510,8 +3511,8 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (MwcNext01(mwc) >= (real_t)(0.75))\n"
|
<< "\t\tif (MwcNext01(mwc) >= (real_t)(0.75))\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * (real_t)(0.5) + roundX);\n"
|
<< "\t\t vOut.x = " << weight << " * fma(offsetX, (real_t)(0.5), roundX);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * (real_t)(0.5) + roundY);\n"
|
<< "\t\t vOut.y = " << weight << " * fma(offsetY, (real_t)(0.5), roundY);\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -3519,26 +3520,26 @@ public:
|
|||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t if (offsetX >= (real_t)(0.0))\n"
|
<< "\t\t if (offsetX >= (real_t)(0.0))\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * (real_t)(0.5) + roundX + (real_t)(0.25));\n"
|
<< "\t\t vOut.x = " << weight << " * fma(offsetX, (real_t)(0.5), roundX + (real_t)(0.25));\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * (real_t)(0.5) + roundY + (real_t)(0.25) * offsetY / offsetX);\n"
|
<< "\t\t vOut.y = " << weight << " * (fma(offsetY, (real_t)(0.5), roundY) + (real_t)(0.25) * offsetY / offsetX);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * (real_t)(0.5) + roundX - (real_t)(0.25));\n"
|
<< "\t\t vOut.x = " << weight << " * fma(offsetX, (real_t)(0.5), roundX - (real_t)(0.25));\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * (real_t)(0.5) + roundY - (real_t)(0.25) * offsetY / offsetX);\n"
|
<< "\t\t vOut.y = " << weight << " * (fma(offsetY, (real_t)(0.5), roundY) - (real_t)(0.25) * offsetY / offsetX);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t if (offsetY >= (real_t)(0.0))\n"
|
<< "\t\t if (offsetY >= (real_t)(0.0))\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * (real_t)(0.5) + roundY + (real_t)(0.25));\n"
|
<< "\t\t vOut.y = " << weight << " * fma(offsetY, (real_t)(0.5), roundY + (real_t)(0.25));\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * (real_t)(0.5) + roundX + offsetX / offsetY * (real_t)(0.25));\n"
|
<< "\t\t vOut.x = " << weight << " * (fma(offsetX, (real_t)(0.5), roundX) + offsetX / offsetY * (real_t)(0.25));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * (real_t)(0.5) + roundY - (real_t)(0.25));\n"
|
<< "\t\t vOut.y = " << weight << " * fma(offsetY, (real_t)(0.5), roundY - (real_t)(0.25));\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * (real_t)(0.5) + roundX - offsetX / offsetY * (real_t)(0.25));\n"
|
<< "\t\t vOut.x = " << weight << " * (fma(offsetX, (real_t)(0.5), roundX) - offsetX / offsetY * (real_t)(0.25));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -3578,7 +3579,7 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t wx = " << weight << " * (real_t)(1.3029400317411197908970256609023);\n"
|
<< "\t\treal_t wx = " << weight << " * (real_t)(1.3029400317411197908970256609023);\n"
|
||||||
<< "\t\treal_t y2 = vIn.y * (real_t)(2.0);\n"
|
<< "\t\treal_t y2 = vIn.y * (real_t)(2.0);\n"
|
||||||
<< "\t\treal_t r = wx * sqrt(fabs(vIn.y * vIn.x) / Zeps(SQR(vIn.x) + SQR(y2)));\n"
|
<< "\t\treal_t r = wx * sqrt(fabs(vIn.y * vIn.x) / Zeps(fma(vIn.x, vIn.x, SQR(y2))));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * vIn.x;\n"
|
<< "\t\tvOut.x = r * vIn.x;\n"
|
||||||
<< "\t\tvOut.y = r * y2;\n"
|
<< "\t\tvOut.y = r * y2;\n"
|
||||||
@ -3684,25 +3685,25 @@ public:
|
|||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t y *= 2;\n"
|
<< "\t\t y *= 2;\n"
|
||||||
<< "\t\t x = -(2 * x + 1);\n"
|
<< "\t\t x = -fma((real_t)(2.0), x, (real_t)(1.0));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t if (x >= 0)\n"
|
<< "\t\t if (x >= 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t y = -(2 * y + 1);\n"
|
<< "\t\t y = -fma((real_t)(2.0), y, (real_t)(1.0));\n"
|
||||||
<< "\t\t x *= 2;\n"
|
<< "\t\t x *= 2;\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t y = -(2 * y + 1);\n"
|
<< "\t\t y = -fma((real_t)(2.0), y, (real_t)(1.0));\n"
|
||||||
<< "\t\t x = -(2 * x + 1);\n"
|
<< "\t\t x = -fma((real_t)(2.0), x, (real_t)(1.0));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (dx + x * " << size << ");\n"
|
<< "\t\tvOut.x = " << weight << " * fma(x, " << size << ", dx);\n"
|
||||||
<< "\t\tvOut.y = -(" << weight << " * (dy + y * " << size << "));\n"
|
<< "\t\tvOut.y = -(" << weight << " * fma(y, " << size << ", dy));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -3766,8 +3767,8 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t a = precalcAtanyx;\n"
|
<< "\t\treal_t a = precalcAtanyx;\n"
|
||||||
<< "\t\treal_t lnr = (real_t)(0.5) * log(precalcSumSquares);\n"
|
<< "\t\treal_t lnr = (real_t)(0.5) * log(precalcSumSquares);\n"
|
||||||
<< "\t\treal_t angle = " << c << " * a + " << d << " * lnr + " << ang << " * floor(" << power << " * MwcNext01(mwc));\n"
|
<< "\t\treal_t angle = fma(" << c << ", a, fma(" << d << ", lnr, " << ang << " * floor(" << power << " * MwcNext01(mwc))));\n"
|
||||||
<< "\t\treal_t m = " << weight << " * exp(" << c << " * lnr - " << d << " * a);\n"
|
<< "\t\treal_t m = " << weight << " * exp(fma(" << c << ", lnr, -(" << d << " * a)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = m * cos(angle);\n"
|
<< "\t\tvOut.x = m * cos(angle);\n"
|
||||||
<< "\t\tvOut.y = m * sin(angle);\n"
|
<< "\t\tvOut.y = m * sin(angle);\n"
|
||||||
@ -3849,8 +3850,8 @@ public:
|
|||||||
string xLengthV = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string xLengthV = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string yLengthV = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string yLengthV = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * vIn.x + " << xAmpV << " * exp(-vIn.y * vIn.y * " << xLengthV << ");\n"
|
<< "\t\tvOut.x = fma(" << weight << ", vIn.x, " << xAmpV << " * exp(-vIn.y * vIn.y * " << xLengthV << "));\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * vIn.y + " << yAmpV << " * exp(-vIn.x * vIn.x * " << yLengthV << ");\n"
|
<< "\t\tvOut.y = fma(" << weight << ", vIn.y, " << yAmpV << " * exp(-vIn.x * vIn.x * " << yLengthV << "));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -4152,8 +4153,8 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t a = precalcAtanyx;\n"
|
<< "\t\treal_t a = precalcAtanyx;\n"
|
||||||
<< "\t\treal_t lnr = (real_t)(0.5) * log(precalcSumSquares);\n"
|
<< "\t\treal_t lnr = (real_t)(0.5) * log(precalcSumSquares);\n"
|
||||||
<< "\t\treal_t m = " << weight << " * exp(" << c << " * lnr - " << d << " * a);\n"
|
<< "\t\treal_t m = " << weight << " * exp(fma(" << c << ", lnr, -(" << d << " * a)));\n"
|
||||||
<< "\t\treal_t n = " << c << " * a + " << d << " * lnr;\n"
|
<< "\t\treal_t n = fma(" << c << ", a, " << d << " * lnr);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = m * cos(n);\n"
|
<< "\t\tvOut.x = m * cos(n);\n"
|
||||||
<< "\t\tvOut.y = m * sin(n);\n"
|
<< "\t\tvOut.y = m * sin(n);\n"
|
||||||
@ -4303,21 +4304,21 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t x = vIn.x - " << x << ";\n"
|
<< "\t\treal_t x = vIn.x - " << x << ";\n"
|
||||||
<< "\t\treal_t y = vIn.y + " << y << ";\n"
|
<< "\t\treal_t y = vIn.y + " << y << ";\n"
|
||||||
<< "\t\treal_t r = sqrt(x * x + y * y);\n"
|
<< "\t\treal_t r = sqrt(fma(x, x, SQR(y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (r < " << weight << ")\n"
|
<< "\t\tif (r < " << weight << ")\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t real_t a = atan2(y, x) + " << spin << " + " << twist << " * (" << weight << " - r);\n"
|
<< "\t\t real_t a = fma(" << twist << ", " << weight << " - r, atan2(y, x) + " << spin << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (r * cos(a) + " << x << ");\n"
|
<< "\t\t vOut.x = " << weight << " * fma(r, cos(a), " << x << ");\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (r * sin(a) - " << y << ");\n"
|
<< "\t\t vOut.y = " << weight << " * fma(r, sin(a), -" << y << ");\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t r = (real_t)(1.0) + " << space << " / Zeps(r);\n"
|
<< "\t\t r = (real_t)(1.0) + " << space << " / Zeps(r);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (r * x + " << x << ");\n"
|
<< "\t\t vOut.x = " << weight << " * fma(r, x, " << x << ");\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (r * y - " << y << ");\n"
|
<< "\t\t vOut.y = " << weight << " * fma(r, y, -" << y << ");\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
@ -4592,9 +4593,9 @@ public:
|
|||||||
<< "\t\treal_t t;\n"
|
<< "\t\treal_t t;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << damping << " == (real_t)(0.0))\n"
|
<< "\t\tif (" << damping << " == (real_t)(0.0))\n"
|
||||||
<< "\t\t t = " << amplitude << " * cos(" << tpf << " * vIn.x) + " << separation << ";\n"
|
<< "\t\t t = fma(" << amplitude << ", cos(" << tpf << " * vIn.x), " << separation << ");\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t t = " << amplitude << " * exp(-fabs(vIn.x) * " << damping << ") * cos(" << tpf << " * vIn.x) + " << separation << ";\n"
|
<< "\t\t t = fma(" << amplitude << ", exp(-fabs(vIn.x) * " << damping << ") * cos(" << tpf << " * vIn.x), " << separation << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (fabs(vIn.y) <= t)\n"
|
<< "\t\tif (fabs(vIn.y) <= t)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -4735,8 +4736,8 @@ public:
|
|||||||
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x + " << x << " * sin(tan(vIn.y * " << c << ")));\n"
|
<< "\t\tvOut.x = " << weight << " * fma(" << x << ", sin(tan(vIn.y * " << c << ")), vIn.x);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (vIn.y + " << y << " * sin(tan(vIn.x * " << c << ")));\n"
|
<< "\t\tvOut.y = " << weight << " * fma(" << y << ", sin(tan(vIn.x * " << c << ")), vIn.y);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -4876,14 +4877,14 @@ public:
|
|||||||
string yy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string yy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tif (vIn.x > (real_t)(0.0))\n"
|
<< "\t\tif (vIn.x > (real_t)(0.0))\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (sqrt(vIn.x * vIn.x + " << xx << ") - vIn.x * " << xInside << ");\n"
|
<< "\t\t vOut.x = " << weight << " * (sqrt(fma(vIn.x, vIn.x, " << xx << ")) - vIn.x * " << xInside << ");\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t vOut.x = -(" << weight << " * (sqrt(vIn.x * vIn.x + " << xx << ") + vIn.x * " << xInside << "));\n"
|
<< "\t\t vOut.x = -(" << weight << " * fma(vIn.x, " << xInside << ", sqrt(fma(vIn.x, vIn.x, " << xx << "))));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (vIn.y > (real_t)(0.0))\n"
|
<< "\t\tif (vIn.y > (real_t)(0.0))\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (sqrt(vIn.y * vIn.y + " << yy << ") - vIn.y * " << yInside << ");\n"
|
<< "\t\t vOut.y = " << weight << " * (sqrt(fma(vIn.y, vIn.y, " << yy << ")) - vIn.y * " << yInside << ");\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t vOut.y = -(" << weight << " * (sqrt(vIn.y * vIn.y + " << yy << ") + vIn.y * " << yInside << "));\n"
|
<< "\t\t vOut.y = -(" << weight << " * fma(vIn.y, " << yInside << ", sqrt(fma(vIn.y, vIn.y, " << yy << "))));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -5122,8 +5123,8 @@ public:
|
|||||||
<< "\t\treal_t roundx = (real_t)(int)(vIn.x >= 0 ? (vIn.x + (real_t)(0.5)) : (vIn.x - (real_t)(0.5)));\n"
|
<< "\t\treal_t roundx = (real_t)(int)(vIn.x >= 0 ? (vIn.x + (real_t)(0.5)) : (vIn.x - (real_t)(0.5)));\n"
|
||||||
<< "\t\treal_t offsetx = vIn.x - roundx;\n"
|
<< "\t\treal_t offsetx = vIn.x - roundx;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (offsetx * ((real_t)(1.0) - " << space << ") + roundx);\n"
|
<< "\t\tvOut.x = " << weight << " * fma(offsetx, (real_t)(1.0) - " << space << ", roundx);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (vIn.y + offsetx * offsetx * " << warp << ");\n"
|
<< "\t\tvOut.y = " << weight << " * fma(SQR(offsetx), " << warp << ", vIn.y);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -5189,10 +5190,10 @@ public:
|
|||||||
string compFac = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string compFac = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = precalcSqrtSumSquares;\n"
|
<< "\t\treal_t r = precalcSqrtSumSquares;\n"
|
||||||
<< "\t\treal_t a = precalcAtanyx + " << swirl << " * r;\n"
|
<< "\t\treal_t a = fma(" << swirl << ", r, precalcAtanyx);\n"
|
||||||
<< "\t\treal_t c = floor((" << count << " * a + MPI) * M1PI * (real_t)(0.5));\n"
|
<< "\t\treal_t c = floor(fma(" << count << ", a, MPI) * M1PI * (real_t)(0.5));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\ta = a * " << compFac << " + c * " << angle << ";\n"
|
<< "\t\ta = fma(a, " << compFac << ", c * " << angle << ");\n"
|
||||||
<< "\t\tr = " << weight << " * (r + " << hole << ");\n"
|
<< "\t\tr = " << weight << " * (r + " << hole << ");\n"
|
||||||
<< "\t\tvOut.x = r * cos(a);\n"
|
<< "\t\tvOut.x = r * cos(a);\n"
|
||||||
<< "\t\tvOut.y = r * sin(a);\n"
|
<< "\t\tvOut.y = r * sin(a);\n"
|
||||||
@ -5277,10 +5278,10 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
||||||
<< "\t\tint tRand = (int)(" << rn << " * MwcNext01(mwc));\n"
|
<< "\t\tint tRand = (int)(" << rn << " * MwcNext01(mwc));\n"
|
||||||
<< "\t\treal_t a = (precalcAtanyx + M_2PI * tRand) / " << power << ";\n"
|
<< "\t\treal_t a = fma(M_2PI, (real_t)tRand, precalcAtanyx) / " << power << ";\n"
|
||||||
<< "\t\treal_t c = floor((" << count << " * a + MPI) * M1PI * (real_t)(0.5));\n"
|
<< "\t\treal_t c = floor(fma(" << count << ", a, MPI) * M1PI * (real_t)(0.5));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\ta = a * " << cf << " + c * " << angle << ";\n"
|
<< "\t\ta = fma(a, " << cf << ", c * " << angle << ");\n"
|
||||||
<< "\t\tvOut.x = r * cos(a);\n"
|
<< "\t\tvOut.x = r * cos(a);\n"
|
||||||
<< "\t\tvOut.y = r * sin(a);\n"
|
<< "\t\tvOut.y = r * sin(a);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
@ -5368,10 +5369,10 @@ public:
|
|||||||
string compfac = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string compfac = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = (real_t)(1.0) / Zeps(precalcSqrtSumSquares);\n"
|
<< "\t\treal_t r = (real_t)(1.0) / Zeps(precalcSqrtSumSquares);\n"
|
||||||
<< "\t\treal_t a = precalcAtanyx + " << swirl << " * r;\n"
|
<< "\t\treal_t a = fma(" << swirl << ", r, precalcAtanyx);\n"
|
||||||
<< "\t\treal_t c = floor((" << count << " * a + MPI) * " << c12pi << "); \n"
|
<< "\t\treal_t c = floor(fma(" << count << ", a, MPI) * " << c12pi << "); \n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\ta = a * " << compfac << " + c * " << angle << ";\n"
|
<< "\t\ta = fma(a, " << compfac << ", c * " << angle << ");\n"
|
||||||
<< "\t\treal_t temp = " << weight << " * (r + " << hole << ");\n"
|
<< "\t\treal_t temp = " << weight << " * (r + " << hole << ");\n"
|
||||||
<< "\t\tvOut.x = temp * cos(a);\n"
|
<< "\t\tvOut.x = temp * cos(a);\n"
|
||||||
<< "\t\tvOut.y = temp * sin(a);\n"
|
<< "\t\tvOut.y = temp * sin(a);\n"
|
||||||
@ -5534,9 +5535,9 @@ public:
|
|||||||
string freqZ = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string freqZ = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string scaleZ = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string scaleZ = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x + " << scaleX << " * sin(vIn.y * " << freqX << "));\n"
|
<< "\t\tvOut.x = " << weight << " * fma(" << scaleX << ", sin(vIn.y * " << freqX << "), vIn.x);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (vIn.y + " << scaleY << " * sin(vIn.x * " << freqY << "));\n"
|
<< "\t\tvOut.y = " << weight << " * fma(" << scaleY << ", sin(vIn.x * " << freqY << "), vIn.y);\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * (vIn.z + " << scaleZ << " * sin(precalcSqrtSumSquares * " << freqZ << "));\n"
|
<< "\t\tvOut.z = " << weight << " * fma(" << scaleZ << ", sin(precalcSqrtSumSquares * " << freqZ << "), vIn.z);\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -6235,10 +6236,10 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t s = sin(" << freq << " * vIn.x);\n"
|
<< "\t\treal_t s = sin(" << freq << " * vIn.x);\n"
|
||||||
<< "\t\treal_t t = sin(" << freq << " * vIn.y);\n"
|
<< "\t\treal_t t = sin(" << freq << " * vIn.y);\n"
|
||||||
<< "\t\treal_t dy = vIn.y + " << augerWeight << " * (" << scale << " * s / Zeps((real_t)(2.0) + fabs(vIn.y) * s));\n"
|
<< "\t\treal_t dy = fma(" << augerWeight << ", " << scale << " * s / Zeps(fma(fabs(vIn.y), s, (real_t)(2.0))), vIn.y);\n"
|
||||||
<< "\t\treal_t dx = vIn.x + " << augerWeight << " * (" << scale << " * t / Zeps((real_t)(2.0) + fabs(vIn.x) * t));\n"
|
<< "\t\treal_t dx = fma(" << augerWeight << ", " << scale << " * t / Zeps(fma(fabs(vIn.x), t, (real_t)(2.0))), vIn.x);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x + " << symmetry << " * (dx - vIn.x));\n"
|
<< "\t\tvOut.x = " << weight << " * fma(" << symmetry << ", (dx - vIn.x), vIn.x);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * dy;\n"
|
<< "\t\tvOut.y = " << weight << " * dy;\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -6320,12 +6321,12 @@ public:
|
|||||||
<< "\t\treal_t xpw = vIn.x + " << weight << ";\n"
|
<< "\t\treal_t xpw = vIn.x + " << weight << ";\n"
|
||||||
<< "\t\treal_t xmw = vIn.x - " << weight << ";\n"
|
<< "\t\treal_t xmw = vIn.x - " << weight << ";\n"
|
||||||
<< "\t\treal_t yy = SQR(vIn.y);\n"
|
<< "\t\treal_t yy = SQR(vIn.y);\n"
|
||||||
<< "\t\treal_t frac = sqrt(yy + SQR(xmw));\n"
|
<< "\t\treal_t frac = sqrt(fma(xmw, xmw, yy));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (frac == (real_t)(0.0))\n"
|
<< "\t\tif (frac == (real_t)(0.0))\n"
|
||||||
<< "\t\t frac = (real_t)(1.0);\n"
|
<< "\t\t frac = (real_t)(1.0);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t avgr = " << weight << " * (" << spr << " * sqrt(sqrt(yy + SQR(xpw)) / frac));\n"
|
<< "\t\treal_t avgr = " << weight << " * (" << spr << " * sqrt(sqrt(fma(xpw, xpw, yy)) / frac));\n"
|
||||||
<< "\t\treal_t avga = (atan2(vIn.y, xmw) - atan2(vIn.y, xpw)) * (real_t)(0.5);\n"
|
<< "\t\treal_t avga = (atan2(vIn.y, xmw) - atan2(vIn.y, xpw)) * (real_t)(0.5);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = avgr * cos(avga);\n"
|
<< "\t\tvOut.x = avgr * cos(avga);\n"
|
||||||
|
@ -214,17 +214,17 @@ public:
|
|||||||
<< "\t\t lx *= " << g2 << ";\n"
|
<< "\t\t lx *= " << g2 << ";\n"
|
||||||
<< "\t\t ly *= " << g2 << ";\n"
|
<< "\t\t ly *= " << g2 << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t real_t r = " << rfactor << " / Zeps((SQR(lx) + SQR(ly)) / 4 + 1);\n"
|
<< "\t\t real_t r = " << rfactor << " / Zeps(fma(lx, lx, SQR(ly)) / 4 + 1);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t lx *= r;\n"
|
<< "\t\t lx *= r;\n"
|
||||||
<< "\t\t ly *= r;\n"
|
<< "\t\t ly *= r;\n"
|
||||||
<< "\t\t r = (SQR(lx) + SQR(ly)) / " << r2 << ";\n"
|
<< "\t\t r = fma(lx, lx, SQR(ly)) / " << r2 << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t real_t theta = " << bwrapsInnerTwist << " * (1 - r) + " << bwrapsOuterTwist << " * r;\n"
|
<< "\t\t real_t theta = fma(" << bwrapsInnerTwist << ", (1 - r), " << bwrapsOuterTwist << " * r);\n"
|
||||||
<< "\t\t real_t s = sin(theta);\n"
|
<< "\t\t real_t s = sin(theta);\n"
|
||||||
<< "\t\t real_t c = cos(theta);\n"
|
<< "\t\t real_t c = cos(theta);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vx = cx + c * lx + s * ly;\n"
|
<< "\t\t vx = fma(s, ly, fma(c, lx, cx));\n"
|
||||||
<< "\t\t vy = cy - s * lx + c * ly;\n"
|
<< "\t\t vy = cy - s * lx + c * ly;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * vx;\n"
|
<< "\t\t vOut.x = " << weight << " * vx;\n"
|
||||||
@ -344,8 +344,8 @@ public:
|
|||||||
ss2 << "_" << XformIndexInEmber() << "]";
|
ss2 << "_" << XformIndexInEmber() << "]";
|
||||||
string index = ss2.str();
|
string index = ss2.str();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t x = 2 * MwcNext01(mwc) - 1;\n"
|
<< "\t\treal_t x = fma((real_t)(2.0), MwcNext01(mwc), -(real_t)(1.0));\n"
|
||||||
<< "\t\treal_t y = 2 * MwcNext01(mwc) - 1;\n"
|
<< "\t\treal_t y = fma((real_t)(2.0), MwcNext01(mwc), -(real_t)(1.0));\n"
|
||||||
<< "\t\treal_t absx = x;\n"
|
<< "\t\treal_t absx = x;\n"
|
||||||
<< "\t\treal_t absy = y;\n"
|
<< "\t\treal_t absy = y;\n"
|
||||||
<< "\t\treal_t side, perimeter;\n"
|
<< "\t\treal_t side, perimeter;\n"
|
||||||
@ -361,16 +361,16 @@ public:
|
|||||||
<< "\t\t if (x >= absy)\n"
|
<< "\t\t if (x >= absy)\n"
|
||||||
<< "\t\t perimeter = absx + y;\n"
|
<< "\t\t perimeter = absx + y;\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t perimeter = 5 * absx - y;\n"
|
<< "\t\t perimeter = fma((real_t)(5.0), absx, -y);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t side = absx;\n"
|
<< "\t\t side = absx;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t if (y >= absx)\n"
|
<< "\t\t if (y >= absx)\n"
|
||||||
<< "\t\t perimeter = 3 * absy - x;\n"
|
<< "\t\t perimeter = fma((real_t)(3.0), absy, -x);\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t perimeter = 7 * absy + x;\n"
|
<< "\t\t perimeter = fma((real_t)(7.0), absy, x);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t side = absy;\n"
|
<< "\t\t side = absy;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -421,10 +421,10 @@ public:
|
|||||||
string blurZoomX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string blurZoomX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string blurZoomY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string blurZoomY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t z = 1 + " << blurZoomLength << " * MwcNext01(mwc);\n"
|
<< "\t\treal_t z = fma(" << blurZoomLength << ", MwcNext01(mwc), 1);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * ((vIn.x - " << blurZoomX << ") * z + " << blurZoomX << ");\n"
|
<< "\t\tvOut.x = " << weight << " * fma((vIn.x - " << blurZoomX << "), z, " << blurZoomX << ");\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * ((vIn.y - " << blurZoomY << ") * z - " << blurZoomY << ");\n"
|
<< "\t\tvOut.y = " << weight << " * fma((vIn.y - " << blurZoomY << "), z, -" << blurZoomY << ");\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -484,8 +484,8 @@ public:
|
|||||||
<< "\t\treal_t x = floor(vIn.x * " << invSize << ");\n"
|
<< "\t\treal_t x = floor(vIn.x * " << invSize << ");\n"
|
||||||
<< "\t\treal_t y = floor(vIn.y * " << invSize << ");\n"
|
<< "\t\treal_t y = floor(vIn.y * " << invSize << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << v << " * (x + " << blurPixelizeScale << " * (MwcNext01(mwc) - (real_t)(0.5)) + (real_t)(0.5));\n"
|
<< "\t\tvOut.x = " << v << " * fma(" << blurPixelizeScale << ", (MwcNext01(mwc) - (real_t)(0.5)), x + (real_t)(0.5));\n"
|
||||||
<< "\t\tvOut.y = " << v << " * (y + " << blurPixelizeScale << " * (MwcNext01(mwc) - (real_t)(0.5)) + (real_t)(0.5));\n"
|
<< "\t\tvOut.y = " << v << " * fma(" << blurPixelizeScale << ", (MwcNext01(mwc) - (real_t)(0.5)), y + (real_t)(0.5));\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -588,12 +588,12 @@ public:
|
|||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t if (x < " << x0_ << ")\n"
|
<< "\t\t if (x < " << x0_ << ")\n"
|
||||||
<< "\t\t x = " << x0_ << " + MwcNext01(mwc) * " << w << ";\n"
|
<< "\t\t x = fma(MwcNext01(mwc), " << w << ", " << x0_ << ");\n"
|
||||||
<< "\t\t else if (x > " << x1_ << ")\n"
|
<< "\t\t else if (x > " << x1_ << ")\n"
|
||||||
<< "\t\t x = " << x1_ << " - MwcNext01(mwc) * " << w << ";\n"
|
<< "\t\t x = " << x1_ << " - MwcNext01(mwc) * " << w << ";\n"
|
||||||
<< "\t\t\n"
|
<< "\t\t\n"
|
||||||
<< "\t\t if (y < " << y0_ << ")\n"
|
<< "\t\t if (y < " << y0_ << ")\n"
|
||||||
<< "\t\t y = " << y0_ << " + MwcNext01(mwc) * " << h << ";\n"
|
<< "\t\t y = fma(MwcNext01(mwc), " << h << ", " << y0_ << ");\n"
|
||||||
<< "\t\t else if (y > " << y1_ << ")\n"
|
<< "\t\t else if (y > " << y1_ << ")\n"
|
||||||
<< "\t\t y = " << y1_ << " - MwcNext01(mwc) * " << h << ";\n"
|
<< "\t\t y = " << y1_ << " - MwcNext01(mwc) * " << h << ";\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -727,7 +727,7 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t x = vIn.x * " << scale << ";\n"
|
<< "\t\treal_t x = vIn.x * " << scale << ";\n"
|
||||||
<< "\t\treal_t y = vIn.y * " << scale << ";\n"
|
<< "\t\treal_t y = vIn.y * " << scale << ";\n"
|
||||||
<< "\t\treal_t r = sqrt(SQR(x) + SQR(y));\n"
|
<< "\t\treal_t r = sqrt(fma(x, x, SQR(y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (r <= 1)\n"
|
<< "\t\tif (r <= 1)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -739,7 +739,7 @@ public:
|
|||||||
<< "\t\t if (" << bcbw << " != 0)\n"
|
<< "\t\t if (" << bcbw << " != 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t real_t ang = atan2(y, x);\n"
|
<< "\t\t real_t ang = atan2(y, x);\n"
|
||||||
<< "\t\t real_t omega = ((real_t)(0.2) * " << bcbw << " * MwcNext01(mwc)) + 1;\n"
|
<< "\t\t real_t omega = fma((real_t)(0.2) * " << bcbw << ", MwcNext01(mwc), (real_t)(1.0));\n"
|
||||||
<< "\t\t real_t px = omega * cos(ang);\n"
|
<< "\t\t real_t px = omega * cos(ang);\n"
|
||||||
<< "\t\t real_t py = omega * sin(ang);\n"
|
<< "\t\t real_t py = omega * sin(ang);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -810,8 +810,8 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = " << blurLinearLength << " * MwcNext01(mwc);\n"
|
<< "\t\treal_t r = " << blurLinearLength << " * MwcNext01(mwc);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x + r * " << c << ");\n"
|
<< "\t\tvOut.x = " << weight << " * fma(r, " << c << ", vIn.x);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (vIn.y + r * " << s << ");\n"
|
<< "\t\tvOut.y = " << weight << " * fma(r, " << s << ", vIn.y);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -1162,7 +1162,7 @@ public:
|
|||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r2 = " << weight << " / Zeps(precalcSumSquares + SQR(vIn.z));\n"
|
<< "\t\treal_t r2 = " << weight << " / Zeps(fma(vIn.z, vIn.z, precalcSumSquares));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r2 * vIn.x;\n"
|
<< "\t\tvOut.x = r2 * vIn.x;\n"
|
||||||
<< "\t\tvOut.y = r2 * vIn.y;\n"
|
<< "\t\tvOut.y = r2 * vIn.y;\n"
|
||||||
@ -1215,12 +1215,12 @@ public:
|
|||||||
string c2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string c2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r2 = precalcSumSquares + SQR(vIn.z);\n"
|
<< "\t\treal_t r2 = fma(vIn.z, vIn.z, precalcSumSquares);\n"
|
||||||
<< "\t\treal_t r = " << weight << " / Zeps(r2 * " << c2 << " + " << c2x << " * vIn.x - " << c2y << " * vIn.y + " << c2z << " * vIn.z + (real_t)(1.0));\n"
|
<< "\t\treal_t r = " << weight << " / Zeps(r2 * " << c2 << " + " << c2x << " * vIn.x - " << c2y << " * vIn.y + " << c2z << " * vIn.z + (real_t)(1.0));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * (vIn.x + " << cx << " * r2);\n"
|
<< "\t\tvOut.x = r * fma(" << cx << ", r2, vIn.x);\n"
|
||||||
<< "\t\tvOut.y = r * (vIn.y - " << cy << " * r2);\n"
|
<< "\t\tvOut.y = r * (vIn.y - " << cy << " * r2);\n"
|
||||||
<< "\t\tvOut.z = r * (vIn.z + " << cz << " * r2);\n"
|
<< "\t\tvOut.z = r * fma(" << cz << ", r2, vIn.z);\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -1407,8 +1407,8 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (MwcNext01(mwc) >= " << cr << ")\n"
|
<< "\t\tif (MwcNext01(mwc) >= " << cr << ")\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * " << absc << " + roundX);\n"
|
<< "\t\t vOut.x = " << weight << " * fma(offsetX, " << absc << ", roundX);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * " << absc << " + roundY);\n"
|
<< "\t\t vOut.y = " << weight << " * fma(offsetY, " << absc << ", roundY);\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -1416,26 +1416,26 @@ public:
|
|||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t if (offsetX >= 0)\n"
|
<< "\t\t if (offsetX >= 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * " << absc << " + roundX + " << cl << ");\n"
|
<< "\t\t vOut.x = " << weight << " * fma(offsetX, " << absc << ", roundX + " << cl << ");\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * " << absc << " + roundY + " << cl << " * offsetY / offsetX);\n"
|
<< "\t\t vOut.y = " << weight << " * (fma(offsetY, " << absc << ", roundY) + " << cl << " * offsetY / offsetX);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * " << absc << " + roundX - " << cl << ");\n"
|
<< "\t\t vOut.x = " << weight << " * fma(offsetX, " << absc << ", roundX - " << cl << ");\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * " << absc << " + roundY - " << cl << " * offsetY / offsetX);\n"
|
<< "\t\t vOut.y = " << weight << " * (fma(offsetY, " << absc << ", roundY) - " << cl << " * offsetY / offsetX);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t if(offsetY >= 0)\n"
|
<< "\t\t if(offsetY >= 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * " << absc << " + roundY + " << cl << ");\n"
|
<< "\t\t vOut.y = " << weight << " * fma(offsetY, " << absc << ", roundY + " << cl << ");\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * " << absc << " + roundX + offsetX / offsetY * " << cl << ");\n"
|
<< "\t\t vOut.x = " << weight << " * (fma(offsetX, " << absc << ", roundX) + offsetX / offsetY * " << cl << ");\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (offsetY * " << absc << " + roundY - " << cl << ");\n"
|
<< "\t\t vOut.y = " << weight << " * fma(offsetY, " << absc << ", roundY - " << cl << ");\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (offsetX * " << absc << " + roundX - offsetX / offsetY * " << cl << ");\n"
|
<< "\t\t vOut.x = " << weight << " * (fma(offsetX, " << absc << ", roundX) - offsetX / offsetY * " << cl << ");\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -1717,21 +1717,21 @@ public:
|
|||||||
<< "\t\t if (vIn.x >= absy)\n"
|
<< "\t\t if (vIn.x >= absy)\n"
|
||||||
<< "\t\t perimeter = absx + vIn.y;\n"
|
<< "\t\t perimeter = absx + vIn.y;\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t perimeter = 5 * absx - vIn.y;\n"
|
<< "\t\t perimeter = fma((real_t)(5.0), absx, -vIn.y);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t side = absx;\n"
|
<< "\t\t side = absx;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t if (vIn.y >= absx)\n"
|
<< "\t\t if (vIn.y >= absx)\n"
|
||||||
<< "\t\t perimeter = 3 * absy - vIn.x;\n"
|
<< "\t\t perimeter = fma((real_t)(3.0), absy, -vIn.x);\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t perimeter = 7 * absy + vIn.x;\n"
|
<< "\t\t perimeter = fma((real_t)(7.0), absy, vIn.x);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t side = absy;\n"
|
<< "\t\t side = absy;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t r = " << vvar4pi << " * side + " << hole << ";\n"
|
<< "\t\treal_t r = fma(" << vvar4pi << ", side, " << hole << ");\n"
|
||||||
<< "\t\treal_t val = MPI4 * perimeter / side - MPI4;\n"
|
<< "\t\treal_t val = MPI4 * perimeter / side - MPI4;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cos(val);\n"
|
<< "\t\tvOut.x = r * cos(val);\n"
|
||||||
@ -1826,16 +1826,16 @@ public:
|
|||||||
<< "\t\t if (vIn.x >= absy)\n"
|
<< "\t\t if (vIn.x >= absy)\n"
|
||||||
<< "\t\t perimeter = absx + vIn.y;\n"
|
<< "\t\t perimeter = absx + vIn.y;\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t perimeter = 5 * absx - vIn.y;\n"
|
<< "\t\t perimeter = fma((real_t)(5.0), absx, -vIn.y);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t side = absx;\n"
|
<< "\t\t side = absx;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t if (vIn.y >= absx)\n"
|
<< "\t\t if (vIn.y >= absx)\n"
|
||||||
<< "\t\t perimeter = 3 * absy - vIn.x;\n"
|
<< "\t\t perimeter = fma((real_t)(3.0), absy, -vIn.x);\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t perimeter = 7 * absy + vIn.x;\n"
|
<< "\t\t perimeter = fma((real_t)(7.0), absy, vIn.x);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t side = absy;\n"
|
<< "\t\t side = absy;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -1908,8 +1908,8 @@ public:
|
|||||||
string fr = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string fr = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string vv2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string vv2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t x = (real_t)(0.5) * vIn.x + (real_t)(0.5);\n"
|
<< "\t\treal_t x = fma((real_t)(0.5), vIn.x, (real_t)(0.5));\n"
|
||||||
<< "\t\treal_t y = (real_t)(0.5) * vIn.y + (real_t)(0.5);\n"
|
<< "\t\treal_t y = fma((real_t)(0.5), vIn.y, (real_t)(0.5));\n"
|
||||||
<< "\t\treal_t bx = Fabsmod(" << fr << " * x);\n"
|
<< "\t\treal_t bx = Fabsmod(" << fr << " * x);\n"
|
||||||
<< "\t\treal_t by = Fabsmod(" << fr << " * y);\n"
|
<< "\t\treal_t by = Fabsmod(" << fr << " * y);\n"
|
||||||
<< "\t\treal_t oscnapx = Foscn(" << amountX << ", " << px << ");\n"
|
<< "\t\treal_t oscnapx = Foscn(" << amountX << ", " << px << ");\n"
|
||||||
@ -1986,7 +1986,7 @@ public:
|
|||||||
{
|
{
|
||||||
T s, c;
|
T s, c;
|
||||||
T avgr = m_Weight * (std::sqrt(SQR(helper.In.y) + SQR(helper.In.x + 1)) / std::sqrt(SQR(helper.In.y) + SQR(helper.In.x - 1)));
|
T avgr = m_Weight * (std::sqrt(SQR(helper.In.y) + SQR(helper.In.x + 1)) / std::sqrt(SQR(helper.In.y) + SQR(helper.In.x - 1)));
|
||||||
T avga = (atan2(helper.In.y, helper.In.x - 1) - std::atan2(helper.In.y, helper.In.x + 1)) / 2;
|
T avga = (std::atan2(helper.In.y, helper.In.x - 1) - std::atan2(helper.In.y, helper.In.x + 1)) / 2;
|
||||||
sincos(avga, &s, &c);
|
sincos(avga, &s, &c);
|
||||||
helper.Out.x = avgr * c;
|
helper.Out.x = avgr * c;
|
||||||
helper.Out.y = avgr * s;
|
helper.Out.y = avgr * s;
|
||||||
@ -1999,8 +1999,10 @@ public:
|
|||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t avgr = " << weight << " * (sqrt(SQR(vIn.y) + SQR(vIn.x + 1)) / sqrt(SQR(vIn.y) + SQR(vIn.x - 1)));\n"
|
<< "\t\treal_t xp1 = vIn.x + (real_t)(1.0);\n"
|
||||||
<< "\t\treal_t avga = (atan2(vIn.y, vIn.x - 1) - atan2(vIn.y, vIn.x + 1)) / 2;\n"
|
<< "\t\treal_t xm1 = vIn.x - (real_t)(1.0);\n"
|
||||||
|
<< "\t\treal_t avgr = " << weight << " * (sqrt(fma(vIn.y, vIn.y, SQR(xp1))) / sqrt(fma(vIn.y, vIn.y, SQR(xm1))));\n"
|
||||||
|
<< "\t\treal_t avga = (atan2(vIn.y, xm1) - atan2(vIn.y, xp1)) / 2;\n"
|
||||||
<< "\t\treal_t s = sin(avga);\n"
|
<< "\t\treal_t s = sin(avga);\n"
|
||||||
<< "\t\treal_t c = cos(avga);\n"
|
<< "\t\treal_t c = cos(avga);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -2049,8 +2051,8 @@ public:
|
|||||||
string k = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string k = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string t = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string t = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t expor = exp(vIn.x * " << k << " - vIn.y * " << t << ");\n"
|
<< "\t\treal_t expor = exp(fma(vIn.x, " << k << ", -(vIn.y * " << t << ")));\n"
|
||||||
<< "\t\treal_t temp = vIn.x * " << t << " + vIn.y * " << k << ";\n"
|
<< "\t\treal_t temp = fma(vIn.x, " << t << ", (vIn.y * " << k << "));\n"
|
||||||
<< "\t\treal_t snv = sin(temp);\n"
|
<< "\t\treal_t snv = sin(temp);\n"
|
||||||
<< "\t\treal_t csv = cos(temp);\n"
|
<< "\t\treal_t csv = cos(temp);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -2199,7 +2201,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t a = M_2PI / (precalcSqrtSumSquares + 1);\n"
|
<< "\t\treal_t a = M_2PI / (precalcSqrtSumSquares + 1);\n"
|
||||||
<< "\t\treal_t r = (precalcAtanyx * M1PI + 1) * (real_t)(0.5);\n"
|
<< "\t\treal_t r = fma(precalcAtanyx, M1PI, (real_t)(1.0)) * (real_t)(0.5);\n"
|
||||||
<< "\t\treal_t s = sin(a);\n"
|
<< "\t\treal_t s = sin(a);\n"
|
||||||
<< "\t\treal_t c = cos(a);\n"
|
<< "\t\treal_t c = cos(a);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -2252,11 +2254,11 @@ public:
|
|||||||
<< "\t\treal_t temp = vIn.y * " << natLog << ";\n"
|
<< "\t\treal_t temp = vIn.y * " << natLog << ";\n"
|
||||||
<< "\t\treal_t snum1 = sin(temp);\n"
|
<< "\t\treal_t snum1 = sin(temp);\n"
|
||||||
<< "\t\treal_t cnum1 = cos(temp);\n"
|
<< "\t\treal_t cnum1 = cos(temp);\n"
|
||||||
<< "\t\ttemp = (vIn.x * MPI + vIn.y * " << natLog << ") * -(real_t)(1.0);\n"
|
<< "\t\ttemp = fma(vIn.x, MPI, vIn.y * " << natLog << ") * -(real_t)(1.0);\n"
|
||||||
<< "\t\treal_t snum2 = sin(temp);\n"
|
<< "\t\treal_t snum2 = sin(temp);\n"
|
||||||
<< "\t\treal_t cnum2 = cos(temp);\n"
|
<< "\t\treal_t cnum2 = cos(temp);\n"
|
||||||
<< "\t\treal_t eradius1 = exp(vIn.x * " << natLog << ");\n"
|
<< "\t\treal_t eradius1 = exp(vIn.x * " << natLog << ");\n"
|
||||||
<< "\t\treal_t eradius2 = exp((vIn.x * " << natLog << " - vIn.y * MPI) * -(real_t)(1.0));\n"
|
<< "\t\treal_t eradius2 = exp(fma(vIn.x, " << natLog << ", -(vIn.y * MPI)) * -(real_t)(1.0));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (eradius1 * cnum1 - eradius2 * cnum2) * " << five << ";\n"
|
<< "\t\tvOut.x = " << weight << " * (eradius1 * cnum1 - eradius2 * cnum2) * " << five << ";\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (eradius1 * snum1 - eradius2 * snum2) * " << five << ";\n"
|
<< "\t\tvOut.y = " << weight << " * (eradius1 * snum1 - eradius2 * snum2) * " << five << ";\n"
|
||||||
@ -2328,14 +2330,14 @@ public:
|
|||||||
<< "\t\treal_t temp = vIn.y * " << natLog << ";\n"
|
<< "\t\treal_t temp = vIn.y * " << natLog << ";\n"
|
||||||
<< "\t\treal_t snum1 = sin(temp);\n"
|
<< "\t\treal_t snum1 = sin(temp);\n"
|
||||||
<< "\t\treal_t cnum1 = cos(temp);\n"
|
<< "\t\treal_t cnum1 = cos(temp);\n"
|
||||||
<< "\t\ttemp = (vIn.x * MPI + vIn.y * " << natLog << ") * -1;\n"
|
<< "\t\ttemp = fma(vIn.x, MPI, vIn.y * " << natLog << ") * -1;\n"
|
||||||
<< "\t\treal_t snum2 = sin(temp);\n"
|
<< "\t\treal_t snum2 = sin(temp);\n"
|
||||||
<< "\t\treal_t cnum2 = cos(temp);\n"
|
<< "\t\treal_t cnum2 = cos(temp);\n"
|
||||||
<< "\t\treal_t eradius1 = " << sc << " * exp(" << sc2 << " * (vIn.x * " << natLog << "));\n"
|
<< "\t\treal_t eradius1 = " << sc << " * exp(" << sc2 << " * (vIn.x * " << natLog << "));\n"
|
||||||
<< "\t\treal_t eradius2 = " << sc << " * exp(" << sc2 << " * ((vIn.x * " << natLog << " - vIn.y * MPI) * -1));\n"
|
<< "\t\treal_t eradius2 = " << sc << " * exp(" << sc2 << " * (fma(vIn.x, " << natLog << ", -(vIn.y * MPI)) * -1));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (eradius1 * cnum1 - eradius2 * cnum2) * " << five << ";\n"
|
<< "\t\tvOut.x = " << weight << " * fma(eradius1, cnum1, -(eradius2 * cnum2)) * " << five << ";\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (eradius1 * snum1 - eradius2 * snum2) * " << five << ";\n"
|
<< "\t\tvOut.y = " << weight << " * fma(eradius1, snum1, -(eradius2 * snum2)) * " << five << ";\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2403,14 +2405,14 @@ public:
|
|||||||
{
|
{
|
||||||
if (rand.Frand01<T>() > T(0.5))
|
if (rand.Frand01<T>() > T(0.5))
|
||||||
{
|
{
|
||||||
d = std::sqrt(r + helper.In.x);
|
d = Zeps(std::sqrt(r + helper.In.x));
|
||||||
helper.Out.x = -(m_V2 * d);
|
helper.Out.x = -(m_V2 * d);
|
||||||
helper.Out.y = -(m_V2 / d * helper.In.y);
|
helper.Out.y = -(m_V2 / d * helper.In.y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d = r + helper.In.x;
|
d = r + helper.In.x;
|
||||||
r = m_Weight / std::sqrt(r * (SQR(helper.In.y) + SQR(d)));
|
r = m_Weight / Zeps(std::sqrt(r * (SQR(helper.In.y) + SQR(d))));
|
||||||
helper.Out.x = -(r * d);
|
helper.Out.x = -(r * d);
|
||||||
helper.Out.y = r * helper.In.y;
|
helper.Out.y = r * helper.In.y;
|
||||||
}
|
}
|
||||||
@ -2441,7 +2443,7 @@ public:
|
|||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t d = r + vIn.x;\n"
|
<< "\t\t d = r + vIn.x;\n"
|
||||||
<< "\t\t r = " << weight << " / sqrt(r * (SQR(vIn.y) + SQR(d)));\n"
|
<< "\t\t r = " << weight << " / sqrt(r * fma(vIn.y, vIn.y, SQR(d)));\n"
|
||||||
<< "\t\t vOut.x = r * d;\n"
|
<< "\t\t vOut.x = r * d;\n"
|
||||||
<< "\t\t vOut.y = r * vIn.y;\n"
|
<< "\t\t vOut.y = r * vIn.y;\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
@ -2457,7 +2459,7 @@ public:
|
|||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t d = r + vIn.x;\n"
|
<< "\t\t d = r + vIn.x;\n"
|
||||||
<< "\t\t r = " << weight << " / sqrt(r * (SQR(vIn.y) + SQR(d)));\n"
|
<< "\t\t r = " << weight << " / sqrt(r * fma(vIn.y, vIn.y, SQR(d)));\n"
|
||||||
<< "\t\t vOut.x = -(r * d);\n"
|
<< "\t\t vOut.x = -(r * d);\n"
|
||||||
<< "\t\t vOut.y = r * vIn.y;\n"
|
<< "\t\t vOut.y = r * vIn.y;\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
@ -2473,6 +2475,11 @@ public:
|
|||||||
m_V2 = m_Weight * std::sqrt(T(2)) / 2;
|
m_V2 = m_Weight * std::sqrt(T(2)) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
|
{
|
||||||
|
return vector<string> { "Zeps" };
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
@ -2685,7 +2692,7 @@ public:
|
|||||||
<< "\t\tif (" << inside << " != 0)\n"
|
<< "\t\tif (" << inside << " != 0)\n"
|
||||||
<< "\t\t r = " << weight << " * delta / (precalcSqrtSumSquares + delta);\n"
|
<< "\t\t r = " << weight << " * delta / (precalcSqrtSumSquares + delta);\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t r = " << weight << " * precalcSqrtSumSquares + delta;\n"
|
<< "\t\t r = fma(" << weight << ", precalcSqrtSumSquares, delta);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * precalcCosa;\n"
|
<< "\t\tvOut.x = r * precalcCosa;\n"
|
||||||
<< "\t\tvOut.y = r * precalcSina;\n"
|
<< "\t\tvOut.y = r * precalcSina;\n"
|
||||||
@ -2749,12 +2756,12 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t a = vIn.x + " << real << ";\n"
|
<< "\t\treal_t a = vIn.x + " << real << ";\n"
|
||||||
<< "\t\treal_t b = vIn.y - " << imag << ";\n"
|
<< "\t\treal_t b = vIn.y - " << imag << ";\n"
|
||||||
<< "\t\treal_t c = " << real << " * vIn.x - " << imag << " * vIn.y + 1;\n"
|
<< "\t\treal_t c = fma(" << real << ", vIn.x, -(" << imag << " * vIn.y)) + 1;\n"
|
||||||
<< "\t\treal_t d = " << real << " * vIn.y + " << imag << " * vIn.x;\n"
|
<< "\t\treal_t d = fma(" << real << ", vIn.y, " << imag << " * vIn.x);\n"
|
||||||
<< "\t\treal_t vr = " << weight << " / (SQR(c) + SQR(d));\n"
|
<< "\t\treal_t vr = " << weight << " / fma(c, c, SQR(d));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = vr * (a * c + b * d);\n"
|
<< "\t\tvOut.x = vr * fma(a, c, b * d);\n"
|
||||||
<< "\t\tvOut.y = vr * (b * c - a * d);\n"
|
<< "\t\tvOut.y = vr * fma(b, c, -(a * d));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2846,12 +2853,12 @@ public:
|
|||||||
<< "\t\treal_t im = " << r << " * sina;\n"
|
<< "\t\treal_t im = " << r << " * sina;\n"
|
||||||
<< "\t\treal_t a = vIn.x + re;\n"
|
<< "\t\treal_t a = vIn.x + re;\n"
|
||||||
<< "\t\treal_t b = vIn.y - im;\n"
|
<< "\t\treal_t b = vIn.y - im;\n"
|
||||||
<< "\t\treal_t c = re * vIn.x - im * vIn.y + 1;\n"
|
<< "\t\treal_t c = fma(re, vIn.x, -(im * vIn.y)) + 1;\n"
|
||||||
<< "\t\treal_t d = re * vIn.y + im * vIn.x;\n"
|
<< "\t\treal_t d = fma(re, vIn.y, im * vIn.x);\n"
|
||||||
<< "\t\treal_t vr = " << weight << " / (SQR(c) + SQR(d));\n"
|
<< "\t\treal_t vr = " << weight << " / fma(c, c, SQR(d));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = vr * (a * c + b * d);\n"
|
<< "\t\tvOut.x = vr * fma(a, c, b * d);\n"
|
||||||
<< "\t\tvOut.y = vr * (b * c - a * d);\n"
|
<< "\t\tvOut.y = vr * fma(b, c, -(a * d));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2935,15 +2942,15 @@ public:
|
|||||||
<< "\t\treal_t b = vIn.y;\n"
|
<< "\t\treal_t b = vIn.y;\n"
|
||||||
<< "\t\treal_t c = " << r << " * vIn.x + 1;\n"
|
<< "\t\treal_t c = " << r << " * vIn.x + 1;\n"
|
||||||
<< "\t\treal_t d = " << r << " * vIn.y;\n"
|
<< "\t\treal_t d = " << r << " * vIn.y;\n"
|
||||||
<< "\t\treal_t x = (a * c + b * d);\n"
|
<< "\t\treal_t x = fma(a, c, b * d);\n"
|
||||||
<< "\t\treal_t y = (b * c - a * d);\n"
|
<< "\t\treal_t y = fma(b, c, -(a * d));\n"
|
||||||
<< "\t\treal_t vr = " << weight << " / (SQR(c) + SQR(d));\n"
|
<< "\t\treal_t vr = " << weight << " / fma(c, c, SQR(d));\n"
|
||||||
<< "\t\treal_t temp = MwcNext(mwc) * " << pa << ";\n"
|
<< "\t\treal_t temp = MwcNext(mwc) * " << pa << ";\n"
|
||||||
<< "\t\treal_t sina = sin(temp);\n"
|
<< "\t\treal_t sina = sin(temp);\n"
|
||||||
<< "\t\treal_t cosa = cos(temp);\n"
|
<< "\t\treal_t cosa = cos(temp);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = vr * (x * cosa + y * sina);\n"
|
<< "\t\tvOut.x = vr * fma(x, cosa, y * sina);\n"
|
||||||
<< "\t\tvOut.y = vr * (y * cosa - x * sina);\n"
|
<< "\t\tvOut.y = vr * fma(y, cosa, -(x * sina));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -3029,10 +3036,10 @@ public:
|
|||||||
<< "\t\treal_t r2 = precalcSumSquares + vIn.z;\n"
|
<< "\t\treal_t r2 = precalcSumSquares + vIn.z;\n"
|
||||||
<< "\t\treal_t x2cx = " << c2x << " * vIn.x;\n"
|
<< "\t\treal_t x2cx = " << c2x << " * vIn.x;\n"
|
||||||
<< "\t\treal_t y2cy = " << c2y << " * vIn.y;\n"
|
<< "\t\treal_t y2cy = " << c2y << " * vIn.y;\n"
|
||||||
<< "\t\treal_t d = " << weight << " / Zeps(" << c2 << " * r2 + x2cx - y2cy + 1);\n"
|
<< "\t\treal_t d = " << weight << " / Zeps(fma(" << c2 << ", r2, (x2cx - y2cy) + 1));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = d * (vIn.x * " << s2x << " - " << cx << "* ( y2cy - r2 - 1));\n"
|
<< "\t\tvOut.x = d * fma(vIn.x, " << s2x << ", -(" << cx << " * (y2cy - r2 - 1)));\n"
|
||||||
<< "\t\tvOut.y = d * (vIn.y * " << s2y << " + " << cy << "* (-x2cx - r2 - 1));\n"
|
<< "\t\tvOut.y = d * fma(vIn.y, " << s2y << ", " << cy << " * (-x2cx - r2 - 1));\n"
|
||||||
<< "\t\tvOut.z = d * (vIn.z * " << s2z << ");\n"
|
<< "\t\tvOut.z = d * (vIn.z * " << s2z << ");\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -3148,15 +3155,15 @@ public:
|
|||||||
<< "\t\treal_t temp = MwcNext(mwc) * " << pa << ";\n"
|
<< "\t\treal_t temp = MwcNext(mwc) * " << pa << ";\n"
|
||||||
<< "\t\treal_t cx = " << r << " * cos(temp);\n"
|
<< "\t\treal_t cx = " << r << " * cos(temp);\n"
|
||||||
<< "\t\treal_t cy = " << r << " * sin(temp);\n"
|
<< "\t\treal_t cy = " << r << " * sin(temp);\n"
|
||||||
<< "\t\treal_t s2x = 1 + SQR(cx) - SQR(cy);\n"
|
<< "\t\treal_t s2x = fma(cx, cx, (real_t)(1.0)) - SQR(cy);\n"
|
||||||
<< "\t\treal_t s2y = 1 + SQR(cy) - SQR(cx);\n"
|
<< "\t\treal_t s2y = fma(cy, cy, (real_t)(1.0)) - SQR(cx);\n"
|
||||||
<< "\t\treal_t r2 = precalcSumSquares + SQR(vIn.z);\n"
|
<< "\t\treal_t r2 = precalcSumSquares + SQR(vIn.z);\n"
|
||||||
<< "\t\treal_t x2cx = 2 * cx * vIn.x;\n"
|
<< "\t\treal_t x2cx = 2 * cx * vIn.x;\n"
|
||||||
<< "\t\treal_t y2cy = 2 * cy * vIn.x;\n"
|
<< "\t\treal_t y2cy = 2 * cy * vIn.x;\n"
|
||||||
<< "\t\treal_t d = " << weight << " / Zeps(" << c2 << " * r2 + x2cx - y2cy + 1);\n"
|
<< "\t\treal_t d = " << weight << " / Zeps(fma(" << c2 << ", r2, (x2cx - y2cy) + 1)); \n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = d * (vIn.x * s2x - cx * ( y2cy - r2 - 1));\n"
|
<< "\t\tvOut.x = d * fma(vIn.x, s2x, -(cx * (y2cy - r2 - 1)));\n"
|
||||||
<< "\t\tvOut.y = d * (vIn.y * s2y + cy * (-x2cx - r2 - 1));\n"
|
<< "\t\tvOut.y = d * fma(vIn.y, s2y, cy * (-x2cx - r2 - 1));\n"
|
||||||
<< "\t\tvOut.z = d * (vIn.z * " << s2z << ");\n"
|
<< "\t\tvOut.z = d * (vIn.z * " << s2z << ");\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -3254,15 +3261,15 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r2 = precalcSumSquares + SQR(vIn.z);\n"
|
<< "\t\treal_t r2 = precalcSumSquares + SQR(vIn.z);\n"
|
||||||
<< "\t\treal_t x2cx = " << c2x << " * vIn.x;\n"
|
<< "\t\treal_t x2cx = " << c2x << " * vIn.x;\n"
|
||||||
<< "\t\treal_t x = vIn.x * " << s2x << " - " << cx << " * (-r2 - 1);\n"
|
<< "\t\treal_t x = fma(vIn.x, " << s2x << ", -(" << cx << " * (-r2 - 1)));\n"
|
||||||
<< "\t\treal_t y = vIn.y * " << s2y << ";\n"
|
<< "\t\treal_t y = vIn.y * " << s2y << ";\n"
|
||||||
<< "\t\treal_t vr = " << weight << " / (" << c2 << " * r2 + x2cx + 1);\n"
|
<< "\t\treal_t vr = " << weight << " / fma(" << c2 << ", r2, x2cx + 1);\n"
|
||||||
<< "\t\treal_t temp = MwcNext(mwc) * " << pa << ";\n"
|
<< "\t\treal_t temp = MwcNext(mwc) * " << pa << ";\n"
|
||||||
<< "\t\treal_t sina = sin(temp);\n"
|
<< "\t\treal_t sina = sin(temp);\n"
|
||||||
<< "\t\treal_t cosa = cos(temp);\n"
|
<< "\t\treal_t cosa = cos(temp);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = vr * (x * cosa + y * sina);\n"
|
<< "\t\tvOut.x = vr * fma(x, cosa, y * sina);\n"
|
||||||
<< "\t\tvOut.y = vr * (y * cosa - x * sina);\n"
|
<< "\t\tvOut.y = vr * fma(y, cosa, -(x * sina));\n"
|
||||||
<< "\t\tvOut.z = vr * (vIn.z * " << s2z << ");\n"
|
<< "\t\tvOut.z = vr * (vIn.z * " << s2z << ");\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -3397,7 +3404,7 @@ public:
|
|||||||
{
|
{
|
||||||
T x = m_A * helper.In.x + m_B * helper.In.y + m_E;
|
T x = m_A * helper.In.x + m_B * helper.In.y + m_E;
|
||||||
T y = m_C * helper.In.x + m_D * helper.In.y + m_F;
|
T y = m_C * helper.In.x + m_D * helper.In.y + m_F;
|
||||||
T angle = (atan2(y, x) + M_2PI * rand.Rand(int(m_AbsN))) / m_Power;
|
T angle = (std::atan2(y, x) + M_2PI * rand.Rand(int(m_AbsN))) / m_Power;
|
||||||
T sina = std::sin(angle);
|
T sina = std::sin(angle);
|
||||||
T cosa = std::cos(angle);
|
T cosa = std::cos(angle);
|
||||||
T r = m_Weight * std::pow(SQR(x) + SQR(y), m_Cn);
|
T r = m_Weight * std::pow(SQR(x) + SQR(y), m_Cn);
|
||||||
@ -3424,12 +3431,12 @@ public:
|
|||||||
string absn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string absn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t x = " << a << " * vIn.x + " << b << " * vIn.y + " << e << ";\n"
|
<< "\t\treal_t x = fma(" << a << ", vIn.x, fma(" << b << ", vIn.y, " << e << "));\n"
|
||||||
<< "\t\treal_t y = " << c << " * vIn.x + " << d << " * vIn.y + " << f << ";\n"
|
<< "\t\treal_t y = fma(" << c << ", vIn.x, fma(" << d << ", vIn.y, " << f << "));\n"
|
||||||
<< "\t\treal_t angle = (atan2(y, x) + M_2PI * MwcNextRange(mwc, (uint)" << absn << ")) / " << power << ";\n"
|
<< "\t\treal_t angle = fma(M_2PI, (real_t)MwcNextRange(mwc, (uint)" << absn << "), atan2(y, x)) / " << power << ";\n"
|
||||||
<< "\t\treal_t sina = sin(angle);\n"
|
<< "\t\treal_t sina = sin(angle);\n"
|
||||||
<< "\t\treal_t cosa = cos(angle);\n"
|
<< "\t\treal_t cosa = cos(angle);\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(SQR(x) + SQR(y), " << cn << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(fma(x, x, SQR(y)), " << cn << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cosa;\n"
|
<< "\t\tvOut.x = r * cosa;\n"
|
||||||
<< "\t\tvOut.y = r * sina;\n"
|
<< "\t\tvOut.y = r * sina;\n"
|
||||||
@ -3515,7 +3522,7 @@ public:
|
|||||||
string invPower = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string invPower = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string invPower2Pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string invPower2Pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t a = precalcAtanyx * " << invPower << " + MwcNext(mwc) * " << invPower2Pi << ";\n"
|
<< "\t\treal_t a = fma(precalcAtanyx, " << invPower << ", MwcNext(mwc) * " << invPower2Pi << ");\n"
|
||||||
<< "\t\treal_t sina = sin(a);\n"
|
<< "\t\treal_t sina = sin(a);\n"
|
||||||
<< "\t\treal_t cosa = cos(a);\n"
|
<< "\t\treal_t cosa = cos(a);\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << halfInvPower << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << halfInvPower << ");\n"
|
||||||
@ -3599,12 +3606,12 @@ public:
|
|||||||
<< "\t\treal_t sina = sin(angle);\n"
|
<< "\t\treal_t sina = sin(angle);\n"
|
||||||
<< "\t\treal_t cosa = cos(angle);\n"
|
<< "\t\treal_t cosa = cos(angle);\n"
|
||||||
<< "\t\treal_t r = " << cp << " * pow(precalcSumSquares, " << p2 << ");\n"
|
<< "\t\treal_t r = " << cp << " * pow(precalcSumSquares, " << p2 << ");\n"
|
||||||
<< "\t\treal_t re = r * cosa + 1;\n"
|
<< "\t\treal_t re = fma(r, cosa, (real_t)(1.0));\n"
|
||||||
<< "\t\treal_t im = r * sina;\n"
|
<< "\t\treal_t im = r * sina;\n"
|
||||||
<< "\t\treal_t r1 = " << vp << " / (SQR(re) + SQR(im));\n"
|
<< "\t\treal_t r1 = " << vp << " / fma(re, re, SQR(im));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r1 * (vIn.x * re + vIn.y * im);\n"
|
<< "\t\tvOut.x = r1 * fma(vIn.x, re, vIn.y * im);\n"
|
||||||
<< "\t\tvOut.y = r1 * (vIn.y * re - vIn.x * im);\n"
|
<< "\t\tvOut.y = r1 * fma(vIn.y, re, -(vIn.x * im));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -3693,10 +3700,10 @@ public:
|
|||||||
<< "\t\treal_t sina = sin(angle);\n"
|
<< "\t\treal_t sina = sin(angle);\n"
|
||||||
<< "\t\treal_t cosa = cos(angle);\n"
|
<< "\t\treal_t cosa = cos(angle);\n"
|
||||||
<< "\t\treal_t r = " << c << " * pow(precalcSumSquares, " << p2 << ");\n"
|
<< "\t\treal_t r = " << c << " * pow(precalcSumSquares, " << p2 << ");\n"
|
||||||
<< "\t\treal_t re = r * cosa + 1;\n"
|
<< "\t\treal_t re = fma(r, cosa, (real_t)(1.0));\n"
|
||||||
<< "\t\treal_t im = r * sina;\n"
|
<< "\t\treal_t im = r * sina;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tr = pow(SQR(re) + SQR(im), " << invp << ");\n"
|
<< "\t\tr = pow(fma(re, re, SQR(im)), " << invp << ");\n"
|
||||||
<< "\t\tangle = atan2(im, re) * " << invp2 << ";\n"
|
<< "\t\tangle = atan2(im, re) * " << invp2 << ";\n"
|
||||||
<< "\t\tsina = sin(angle);\n"
|
<< "\t\tsina = sin(angle);\n"
|
||||||
<< "\t\tcosa = cos(angle);\n"
|
<< "\t\tcosa = cos(angle);\n"
|
||||||
@ -3705,8 +3712,8 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t r1 = " << vp << " / SQR(r);\n"
|
<< "\t\treal_t r1 = " << vp << " / SQR(r);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r1 * (vIn.x * re + vIn.y * im);\n"
|
<< "\t\tvOut.x = r1 * fma(vIn.x, re, vIn.y * im);\n"
|
||||||
<< "\t\tvOut.y = r1 * (vIn.y * re - vIn.x * im);\n"
|
<< "\t\tvOut.y = r1 * fma(vIn.y, re, -(vIn.x * im));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -3793,12 +3800,12 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t x = (" << isOdd << " != 0) ? vIn.x : " << vvar << " * precalcAtanxy;\n"
|
<< "\t\treal_t x = (" << isOdd << " != 0) ? vIn.x : " << vvar << " * precalcAtanxy;\n"
|
||||||
<< "\t\treal_t y = (" << isOdd << " != 0) ? vIn.y : " << vvar2 << " * log(precalcSumSquares);\n"
|
<< "\t\treal_t y = (" << isOdd << " != 0) ? vIn.y : " << vvar2 << " * log(precalcSumSquares);\n"
|
||||||
<< "\t\treal_t angle = (atan2(y, x) + M_2PI * MwcNextRange(mwc, (uint)" << absn << ")) / " << nnz << ";\n"
|
<< "\t\treal_t angle = fma(M_2PI, MwcNextRange(mwc, (uint)" << absn << "), atan2(y, x)) / " << nnz << ";\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(SQR(x) + SQR(y), " << cn << ") * ((" << isOdd << " == 0) ? 1 : " << parity << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(fma(x, x, SQR(y)), " << cn << ") * ((" << isOdd << " == 0) ? 1 : " << parity << ");\n"
|
||||||
<< "\t\treal_t sina = sin(angle) * r;\n"
|
<< "\t\treal_t sina = sin(angle) * r;\n"
|
||||||
<< "\t\treal_t cosa = cos(angle) * r;\n"
|
<< "\t\treal_t cosa = cos(angle) * r;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tx = (" << isOdd << " != 0) ? cosa : (" << vvar2 << " * log(SQR(cosa) + SQR(sina)));\n"
|
<< "\t\tx = (" << isOdd << " != 0) ? cosa : (" << vvar2 << " * log(fma(cosa, cosa, SQR(sina))));\n"
|
||||||
<< "\t\ty = (" << isOdd << " != 0) ? sina : (" << vvar << " * atan2(cosa, sina));\n"
|
<< "\t\ty = (" << isOdd << " != 0) ? sina : (" << vvar << " * atan2(cosa, sina));\n"
|
||||||
<< "\t\tvOut.x = x;\n"
|
<< "\t\tvOut.x = x;\n"
|
||||||
<< "\t\tvOut.y = y;\n"
|
<< "\t\tvOut.y = y;\n"
|
||||||
@ -3872,7 +3879,7 @@ public:
|
|||||||
if (helper.In.x >= 0)
|
if (helper.In.x >= 0)
|
||||||
{
|
{
|
||||||
xo = (r + 1) / Zeps(2 * helper.In.x);
|
xo = (r + 1) / Zeps(2 * helper.In.x);
|
||||||
ro = std::sqrt(SQR(helper.In.x - xo) + SQR(helper.In.y));
|
ro = std::sqrt(Sqr(helper.In.x - xo) + SQR(helper.In.y));
|
||||||
theta = std::atan2(T(1), ro);
|
theta = std::atan2(T(1), ro);
|
||||||
a = fmod(m_In * theta + std::atan2(helper.In.y, xo - helper.In.x) + theta, 2 * theta) - theta;
|
a = fmod(m_In * theta + std::atan2(helper.In.y, xo - helper.In.x) + theta, 2 * theta) - theta;
|
||||||
sincos(a, &s, &c);
|
sincos(a, &s, &c);
|
||||||
@ -3882,7 +3889,7 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
xo = -(r + 1) / (2 * helper.In.x);
|
xo = -(r + 1) / (2 * helper.In.x);
|
||||||
ro = std::sqrt(SQR(-helper.In.x - xo) + SQR(helper.In.y));
|
ro = std::sqrt(Sqr(-helper.In.x - xo) + SQR(helper.In.y));
|
||||||
theta = std::atan2(T(1), ro);
|
theta = std::atan2(T(1), ro);
|
||||||
a = fmod(m_In * theta + std::atan2(helper.In.y, xo + helper.In.x) + theta, 2 * theta) - theta;
|
a = fmod(m_In * theta + std::atan2(helper.In.y, xo + helper.In.x) + theta, 2 * theta) - theta;
|
||||||
sincos(a, &s, &c);
|
sincos(a, &s, &c);
|
||||||
@ -3901,7 +3908,7 @@ public:
|
|||||||
if (x >= 0)
|
if (x >= 0)
|
||||||
{
|
{
|
||||||
xo = (SQR(x) + SQR(y) + 1) / Zeps(2 * x);
|
xo = (SQR(x) + SQR(y) + 1) / Zeps(2 * x);
|
||||||
ro = std::sqrt(SQR(x - xo) + SQR(y));
|
ro = std::sqrt(Sqr(x - xo) + SQR(y));
|
||||||
theta = std::atan2(T(1), ro);
|
theta = std::atan2(T(1), ro);
|
||||||
a = fmod(m_Out * theta + std::atan2(y, xo - x) + theta, 2 * theta) - theta;
|
a = fmod(m_Out * theta + std::atan2(y, xo - x) + theta, 2 * theta) - theta;
|
||||||
sincos(a, &s, &c);
|
sincos(a, &s, &c);
|
||||||
@ -3916,7 +3923,7 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
xo = -(SQR(x) + SQR(y) + 1) / (2 * x);
|
xo = -(SQR(x) + SQR(y) + 1) / (2 * x);
|
||||||
ro = std::sqrt(SQR(-x - xo) + SQR(y));
|
ro = std::sqrt(Sqr(-x - xo) + SQR(y));
|
||||||
theta = std::atan2(T(1), ro);
|
theta = std::atan2(T(1), ro);
|
||||||
a = fmod(m_Out * theta + std::atan2(y, xo + x) + theta, 2 * theta) - theta;
|
a = fmod(m_Out * theta + std::atan2(y, xo + x) + theta, 2 * theta) - theta;
|
||||||
sincos(a, &s, &c);
|
sincos(a, &s, &c);
|
||||||
@ -3954,12 +3961,14 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (r < 1)\n"
|
<< "\t\tif (r < 1)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
|
<< "\t\t real_t y2 = SQR(vIn.y);\n"
|
||||||
<< "\t\t if (vIn.x >= 0)\n"
|
<< "\t\t if (vIn.x >= 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t xo = (r + 1) / Zeps(2 * vIn.x);\n"
|
<< "\t\t xo = (r + 1) / Zeps(2 * vIn.x);\n"
|
||||||
<< "\t\t ro = sqrt(SQR(vIn.x - xo) + SQR(vIn.y));\n"
|
<< "\t\t real_t xmx = vIn.x - xo;\n"
|
||||||
|
<< "\t\t ro = sqrt(fma(xmx, xmx, y2));\n"
|
||||||
<< "\t\t theta = atan2(1, ro);\n"
|
<< "\t\t theta = atan2(1, ro);\n"
|
||||||
<< "\t\t a = fmod(" << in << " * theta + atan2(vIn.y, xo - vIn.x) + theta, 2 * theta) - theta;\n"
|
<< "\t\t a = fmod(fma(" << in << ", theta, atan2(vIn.y, xo - vIn.x) + theta), 2 * theta) - theta;\n"
|
||||||
<< "\t\t s = sin(a);\n"
|
<< "\t\t s = sin(a);\n"
|
||||||
<< "\t\t c = cos(a);\n"
|
<< "\t\t c = cos(a);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -3969,9 +3978,10 @@ public:
|
|||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t xo = - (r + 1) / (2 * vIn.x);\n"
|
<< "\t\t xo = - (r + 1) / (2 * vIn.x);\n"
|
||||||
<< "\t\t ro = sqrt(SQR(-vIn.x - xo) + SQR(vIn.y));\n"
|
<< "\t\t real_t mxmx = -vIn.x - xo;\n"
|
||||||
|
<< "\t\t ro = sqrt(fma(mxmx, mxmx, y2));\n"
|
||||||
<< "\t\t theta = atan2(1 , ro);\n"
|
<< "\t\t theta = atan2(1 , ro);\n"
|
||||||
<< "\t\t a = fmod(" << in << " * theta + atan2(vIn.y, xo + vIn.x) + theta, 2 * theta) - theta;\n"
|
<< "\t\t a = fmod(fma(" << in << ", theta, atan2(vIn.y, xo + vIn.x) + theta), 2 * theta) - theta;\n"
|
||||||
<< "\t\t s = sin(a);\n"
|
<< "\t\t s = sin(a);\n"
|
||||||
<< "\t\t c = cos(a);\n"
|
<< "\t\t c = cos(a);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -3986,13 +3996,17 @@ public:
|
|||||||
<< "\t\t tc = cos(precalcAtanyx);\n"
|
<< "\t\t tc = cos(precalcAtanyx);\n"
|
||||||
<< "\t\t x = r * tc;\n"
|
<< "\t\t x = r * tc;\n"
|
||||||
<< "\t\t y = r * ts;\n"
|
<< "\t\t y = r * ts;\n"
|
||||||
|
<< "\t\t real_t x2 = SQR(x);\n"
|
||||||
|
<< "\t\t real_t y2 = SQR(y);\n"
|
||||||
|
<< "\t\t real_t x2y2 = x2 + y2;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (x >= 0)\n"
|
<< "\t\t if (x >= 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t xo = (SQR(x) + SQR(y) + 1) / Zeps(2 * x);\n"
|
<< "\t\t xo = (x2y2 + 1) / Zeps(2 * x);\n"
|
||||||
<< "\t\t ro = sqrt(SQR(x - xo) + SQR(y));\n"
|
<< "\t\t real_t xmx = x - xo;\n"
|
||||||
|
<< "\t\t ro = sqrt(fma(xmx, xmx, y2));\n"
|
||||||
<< "\t\t theta = atan2(1, ro);\n"
|
<< "\t\t theta = atan2(1, ro);\n"
|
||||||
<< "\t\t a = fmod(" << out << " * theta + atan2(y, xo - x) + theta, 2 * theta) - theta;\n"
|
<< "\t\t a = fmod(fma(" << out << ", theta, atan2(y, xo - x) + theta), 2 * theta) - theta;\n"
|
||||||
<< "\t\t s = sin(a);\n"
|
<< "\t\t s = sin(a);\n"
|
||||||
<< "\t\t c = cos(a);\n"
|
<< "\t\t c = cos(a);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -4001,17 +4015,18 @@ public:
|
|||||||
<< "\t\t theta = atan2(y, x);\n"
|
<< "\t\t theta = atan2(y, x);\n"
|
||||||
<< "\t\t ts = sin(theta);\n"
|
<< "\t\t ts = sin(theta);\n"
|
||||||
<< "\t\t tc = cos(theta);\n"
|
<< "\t\t tc = cos(theta);\n"
|
||||||
<< "\t\t r = 1 / sqrt(SQR(x) + SQR(y));\n"
|
<< "\t\t r = 1 / sqrt(fma(x, x, SQR(y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * r * tc;\n"
|
<< "\t\t vOut.x = " << weight << " * r * tc;\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * r * ts;\n"
|
<< "\t\t vOut.y = " << weight << " * r * ts;\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t xo = - (SQR(x) + SQR(y) + 1) / (2 * x);\n"
|
<< "\t\t xo = -(x2y2 + 1) / (2 * x);\n"
|
||||||
<< "\t\t ro = sqrt(SQR(-x - xo) + SQR(y));\n"
|
<< "\t\t real_t mxmx = -x - xo;\n"
|
||||||
|
<< "\t\t ro = sqrt(fma(mxmx, mxmx, y2));\n"
|
||||||
<< "\t\t theta = atan2(1 , ro);\n"
|
<< "\t\t theta = atan2(1 , ro);\n"
|
||||||
<< "\t\t a = fmod(" << out << " * theta + atan2(y, xo + x) + theta, 2 * theta) - theta;\n"
|
<< "\t\t a = fmod(fma(" << out << ", theta, atan2(y, xo + x) + theta), 2 * theta) - theta;\n"
|
||||||
<< "\t\t s = sin(a);\n"
|
<< "\t\t s = sin(a);\n"
|
||||||
<< "\t\t c = cos(a);\n"
|
<< "\t\t c = cos(a);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -4020,7 +4035,7 @@ public:
|
|||||||
<< "\t\t theta = atan2(y, x);\n"
|
<< "\t\t theta = atan2(y, x);\n"
|
||||||
<< "\t\t ts = sin(theta);\n"
|
<< "\t\t ts = sin(theta);\n"
|
||||||
<< "\t\t tc = cos(theta);\n"
|
<< "\t\t tc = cos(theta);\n"
|
||||||
<< "\t\t r = 1 / sqrt(SQR(x) + SQR(y));\n"
|
<< "\t\t r = 1 / sqrt(fma(x, x, SQR(y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = -(" << weight << " * r * tc);\n"
|
<< "\t\t vOut.x = -(" << weight << " * r * tc);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * r * ts;\n"
|
<< "\t\t vOut.y = " << weight << " * r * ts;\n"
|
||||||
@ -4067,10 +4082,18 @@ public:
|
|||||||
|
|
||||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||||
{
|
{
|
||||||
T x = m_C1x + (SQR(m_C1r) * (helper.In.x - m_C1x)) / Zeps(Sqr(helper.In.x - m_C1x) + Sqr(helper.In.y - m_C1y));
|
T xmc1x = helper.In.x - m_C1x;
|
||||||
T y = m_C1y + (SQR(m_C1r) * (helper.In.y - m_C1y)) / Zeps(Sqr(helper.In.x - m_C1x) + Sqr(helper.In.y - m_C1y));
|
T ymc1y = helper.In.y - m_C1y;
|
||||||
helper.Out.x = m_C2x + (SQR(m_C2r) * (x - m_C2x)) / Zeps(Sqr(x - m_C2x) + Sqr(y - m_C2y));
|
T den = Zeps(SQR(xmc1x) + SQR(ymc1y));
|
||||||
helper.Out.y = m_C2y + (SQR(m_C2r) * (y - m_C2y)) / Zeps(Sqr(x - m_C2x) + Sqr(y - m_C2y));
|
T c1r2 = SQR(m_C1r);
|
||||||
|
T x = m_C1x + (c1r2 * xmc1x) / den;
|
||||||
|
T y = m_C1y + (c1r2 * ymc1y) / den;
|
||||||
|
T xmc2x = x - m_C2x;
|
||||||
|
T ymc2y = y - m_C2y;
|
||||||
|
T c2r2 = SQR(m_C2r);
|
||||||
|
den = Zeps(SQR(xmc2x) + SQR(ymc2y));
|
||||||
|
helper.Out.x = m_C2x + (c2r2 * xmc2x) / den;
|
||||||
|
helper.Out.y = m_C2y + (c2r2 * ymc2y) / den;
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4092,11 +4115,19 @@ public:
|
|||||||
string c1d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c1d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string c2d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c2d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t x = " << c1x << " + (SQR(" << c1r << ") * (vIn.x - " << c1x << ")) / Zeps(Sqr(vIn.x - " << c1x << ") + Sqr(vIn.y - " << c1y << "));\n"
|
<< "\t\treal_t xmc1x = vIn.x - " << c1x << ";\n"
|
||||||
<< "\t\treal_t y = " << c1y << " + (SQR(" << c1r << ") * (vIn.y - " << c1y << ")) / Zeps(Sqr(vIn.x - " << c1x << ") + Sqr(vIn.y - " << c1y << "));\n"
|
<< "\t\treal_t ymc1y = vIn.y - " << c1y << ";\n"
|
||||||
|
<< "\t\treal_t den = Zeps(fma(xmc1x, xmc1x, SQR(ymc1y)));\n"
|
||||||
|
<< "\t\treal_t c1r2 = SQR(" << c1r << ");\n"
|
||||||
|
<< "\t\treal_t x = " << c1x << " + (c1r2 * xmc1x) / den;\n"
|
||||||
|
<< "\t\treal_t y = " << c1y << " + (c1r2 * ymc1y) / den;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << c2x << " + (SQR(" << c2r << ") * (x - " << c2x << ")) / Zeps(Sqr(x - " << c2x << ") + Sqr(y - " << c2y << "));\n"
|
<< "\t\treal_t xmc2x = x - " << c2x << ";\n"
|
||||||
<< "\t\tvOut.y = " << c2y << " + (SQR(" << c2r << ") * (y - " << c2y << ")) / Zeps(Sqr(x - " << c2x << ") + Sqr(y - " << c2y << "));\n"
|
<< "\t\treal_t ymc2y = y - " << c2y << ";\n"
|
||||||
|
<< "\t\treal_t c2r2 = SQR(" << c2r << ");\n"
|
||||||
|
<< "\t\tden = Zeps(fma(xmc2x, xmc2x, SQR(ymc2y)));\n"
|
||||||
|
<< "\t\tvOut.x = " << c2x << " + (c2r2 * xmc2x) / den;\n"
|
||||||
|
<< "\t\tvOut.y = " << c2y << " + (c2r2 * ymc2y) / den;\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -4195,16 +4226,16 @@ public:
|
|||||||
string s2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string s2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string s2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string s2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r2 = precalcSumSquares + SQR(vIn.z);\n"
|
<< "\t\treal_t r2 = fma(vIn.z, vIn.z, precalcSumSquares);\n"
|
||||||
<< "\t\treal_t x2cx = " << c2x << " * vIn.x;\n"
|
<< "\t\treal_t x2cx = " << c2x << " * vIn.x;\n"
|
||||||
<< "\t\treal_t y2cy = " << c2y << " * vIn.y;\n"
|
<< "\t\treal_t y2cy = " << c2y << " * vIn.y;\n"
|
||||||
<< "\t\treal_t z2cz = " << c2z << " * vIn.z;\n"
|
<< "\t\treal_t z2cz = " << c2z << " * vIn.z;\n"
|
||||||
<< "\t\treal_t val = Zeps(" << c2 << " * r2 - x2cx - y2cy - z2cz + (real_t)(1.0));\n"
|
<< "\t\treal_t val = Zeps(" << c2 << " * r2 - x2cx - y2cy - z2cz + (real_t)(1.0));\n"
|
||||||
<< "\t\treal_t d = " << weight << " / val;\n"
|
<< "\t\treal_t d = " << weight << " / val;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = d * (vIn.x * " << s2x << " + " << cx << " * (y2cy + z2cz - r2 - (real_t)(1.0)));\n"
|
<< "\t\tvOut.x = d * fma(vIn.x, " << s2x << ", " << cx << " * (y2cy + z2cz - r2 - (real_t)(1.0)));\n"
|
||||||
<< "\t\tvOut.y = d * (vIn.y * " << s2y << " + " << cy << " * (x2cx + z2cz - r2 - (real_t)(1.0)));\n"
|
<< "\t\tvOut.y = d * fma(vIn.y, " << s2y << ", " << cy << " * (x2cx + z2cz - r2 - (real_t)(1.0)));\n"
|
||||||
<< "\t\tvOut.z = d * (vIn.z * " << s2z << " + " << cz << " * (y2cy + x2cx - r2 - (real_t)(1.0)));\n"
|
<< "\t\tvOut.z = d * fma(vIn.z, " << s2z << ", " << cz << " * (y2cy + x2cx - r2 - (real_t)(1.0)));\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -4305,8 +4336,8 @@ public:
|
|||||||
<< "\t\treal_t yp = pow(fabs(" << weight << ") * fabs(vIn.y), " << powy << ");\n"
|
<< "\t\treal_t yp = pow(fabs(" << weight << ") * fabs(vIn.y), " << powy << ");\n"
|
||||||
<< "\t\treal_t zp = " << weight << " * vIn.z;\n"
|
<< "\t\treal_t zp = " << weight << " * vIn.z;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = xp * Sign(vIn.x) + " << lcx << " * vIn.x + " << scx << ";\n"
|
<< "\t\tvOut.x = fma(xp, Sign(vIn.x), fma(" << lcx << ", vIn.x, " << scx << "));\n"
|
||||||
<< "\t\tvOut.y = yp * Sign(vIn.y) + " << lcy << " * vIn.y + " << scy << ";\n"
|
<< "\t\tvOut.y = fma(yp, Sign(vIn.y), fma(" << lcy << ", vIn.y, " << scy << "));\n"
|
||||||
<< "\t\tvOut.z = zp;\n"
|
<< "\t\tvOut.z = zp;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -4460,16 +4491,16 @@ public:
|
|||||||
<< "\t\treal_t xcb = vIn.x * vIn.x * vIn.x;\n"
|
<< "\t\treal_t xcb = vIn.x * vIn.x * vIn.x;\n"
|
||||||
<< "\t\treal_t ycb = vIn.y * vIn.y * vIn.y;\n"
|
<< "\t\treal_t ycb = vIn.y * vIn.y * vIn.y;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t tr = " << t3 << " * (xcb - 3 * vIn.x * ysqr) + " << t2 << " * (xsqr - ysqr) + " << t1 << " * vIn.x + " << tc << ";\n"
|
<< "\t\treal_t tr = fma(" << t3 << ", (xcb - 3 * vIn.x * ysqr), fma(" << t2 << ", (xsqr - ysqr), fma(" << t1 << ", vIn.x, " << tc << ")));\n"
|
||||||
<< "\t\treal_t ti = " << t3 << " * (3 * xsqr * vIn.y - ycb) + " << t2 << " * 2 * vIn.x * vIn.y + " << t1 << " * vIn.y;\n"
|
<< "\t\treal_t ti = fma(" << t3 << ", (3 * xsqr * vIn.y - ycb), fma(" << t2 << " * 2, vIn.x * vIn.y, " << t1 << " * vIn.y));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t br = " << b3 << " * (xcb - 3 * vIn.x * ysqr) + " << b2 << " * (xsqr - ysqr) + " << b1 << " * vIn.x + " << bc << ";\n"
|
<< "\t\treal_t br = fma(" << b3 << ", (xcb - 3 * vIn.x * ysqr), fma(" << b2 << ", (xsqr - ysqr), fma(" << b1 << ", vIn.x, " << bc << ")));\n"
|
||||||
<< "\t\treal_t bi = " << b3 << " * (3 * xsqr * vIn.y - ycb) + " << b2 << " * 2 * vIn.x * vIn.y + " << b1 << " * vIn.y;\n"
|
<< "\t\treal_t bi = fma(" << b3 << ", (3 * xsqr * vIn.y - ycb), fma(" << b2 << ", 2 * vIn.x * vIn.y, " << b1 << " * vIn.y));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t r3den = 1 / Zeps(br * br + bi * bi);\n"
|
<< "\t\treal_t r3den = 1 / Zeps(fma(br, br, bi * bi));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (tr * br + ti * bi) * r3den;\n"
|
<< "\t\tvOut.x = " << weight << " * fma(tr, br, ti * bi) * r3den;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (ti * br - tr * bi) * r3den;\n"
|
<< "\t\tvOut.y = " << weight << " * fma(ti, br, -(tr * bi)) * r3den;\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -4571,23 +4602,23 @@ public:
|
|||||||
string pxa = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string pxa = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string pixa = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string pixa = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t x = (vIn.x * " << s << ") - " << centerx << ";\n"
|
<< "\t\treal_t x = fma(vIn.x, " << s << ", -" << centerx << ");\n"
|
||||||
<< "\t\treal_t y = (vIn.y * " << s << ") + " << centery << ";\n"
|
<< "\t\treal_t y = fma(vIn.y, " << s << ", " << centery << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t d = max(EPS, sqrt(SQR(x) * SQR(y)));\n"
|
<< "\t\treal_t d = max(EPS, sqrt(SQR(x) * SQR(y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t nx = x / d;\n"
|
<< "\t\treal_t nx = x / d;\n"
|
||||||
<< "\t\treal_t ny = y / d;\n"
|
<< "\t\treal_t ny = y / d;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t wave = cos(" << f << " * d - " << vxp << ");\n"
|
<< "\t\treal_t wave = cos(fma(" << f << ", d, -" << vxp << "));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t d1 = wave * " << pxa << " + d;\n"
|
<< "\t\treal_t d1 = fma(wave, " << pxa << ", d);\n"
|
||||||
<< "\t\treal_t d2 = wave * " << pixa << " + d;\n"
|
<< "\t\treal_t d2 = fma(wave, " << pixa << ", d);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t u1 = " << centerx << " + nx * d1;\n"
|
<< "\t\treal_t u1 = fma(nx, d1, " << centerx << ");\n"
|
||||||
<< "\t\treal_t v1 = -" << centery << " + ny * d1;\n"
|
<< "\t\treal_t v1 = fma(ny, d1, -" << centery << ");\n"
|
||||||
<< "\t\treal_t u2 = " << centerx << " + nx * d2;\n"
|
<< "\t\treal_t u2 = fma(nx, d2, " << centerx << ");\n"
|
||||||
<< "\t\treal_t v2 = -" << centery << " + ny * d2;\n"
|
<< "\t\treal_t v2 = fma(ny, d2, -" << centery << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * Lerp(u1, u2, " << p << ") * " << is << ";\n"
|
<< "\t\tvOut.x = " << weight << " * Lerp(u1, u2, " << p << ") * " << is << ";\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * Lerp(v1, v2, " << p << ") * " << is << ";\n"
|
<< "\t\tvOut.y = " << weight << " * Lerp(v1, v2, " << p << ") * " << is << ";\n"
|
||||||
@ -4932,8 +4963,8 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tresult /= divident;\n"
|
<< "\t\tresult /= divident;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * vIn.x + result;\n"
|
<< "\t\tvOut.x = fma(" << weight << ", vIn.x, result);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * vIn.y + result;\n"
|
<< "\t\tvOut.y = fma(" << weight << ", vIn.y, result);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -5102,7 +5133,7 @@ public:
|
|||||||
string absn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string absn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t angle = (precalcAtanyx + M_2PI * MwcNextRange(mwc, (uint)" << absn << ")) / " << power << ";\n"
|
<< "\t\treal_t angle = fma(M_2PI, (real_t)MwcNextRange(mwc, (uint)" << absn << "), precalcAtanyx) / " << power << ";\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
||||||
<< "\t\treal_t sina = sin(angle);\n"
|
<< "\t\treal_t sina = sin(angle);\n"
|
||||||
<< "\t\treal_t cosa = cos(angle);\n"
|
<< "\t\treal_t cosa = cos(angle);\n"
|
||||||
@ -5110,8 +5141,8 @@ public:
|
|||||||
<< "\t\treal_t yn = r * sina;\n"
|
<< "\t\treal_t yn = r * sina;\n"
|
||||||
<< "\t\treal_t siny = sin(" << freqX << " * yn);\n"
|
<< "\t\treal_t siny = sin(" << freqX << " * yn);\n"
|
||||||
<< "\t\treal_t sinx = sin(" << freqY << " * xn);\n"
|
<< "\t\treal_t sinx = sin(" << freqY << " * xn);\n"
|
||||||
<< "\t\treal_t dx = xn + (real_t)(0.5) * (" << scaleX << " * siny + fabs(xn) * " << incX << " * siny);\n"
|
<< "\t\treal_t dx = fma((real_t)(0.5), fma(" << scaleX << ", siny, fabs(xn) * " << incX << " * siny), xn);\n"
|
||||||
<< "\t\treal_t dy = yn + (real_t)(0.5) * (" << scaleY << " * sinx + fabs(yn) * " << incY << " * sinx);\n"
|
<< "\t\treal_t dy = fma((real_t)(0.5), fma(" << scaleY << ", sinx, fabs(yn) * " << incY << " * sinx), yn);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * dx;\n"
|
<< "\t\tvOut.x = " << weight << " * dx;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * dy;\n"
|
<< "\t\tvOut.y = " << weight << " * dy;\n"
|
||||||
@ -5217,8 +5248,10 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t bx = 4 / r2_4;\n"
|
<< "\t\treal_t bx = 4 / r2_4;\n"
|
||||||
<< "\t\treal_t by = " << rat << " / r2_4;\n"
|
<< "\t\treal_t by = " << rat << " / r2_4;\n"
|
||||||
<< "\t\treal_t x = " << cosa << " * (bx * vIn.x) - " << sina << " * (by * vIn.y);\n"
|
<< "\t\treal_t bxx = bx * vIn.x;\n"
|
||||||
<< "\t\treal_t y = " << sina << " * (bx * vIn.x) + " << cosa << " * (by * vIn.y);\n"
|
<< "\t\treal_t byy = by * vIn.y;\n"
|
||||||
|
<< "\t\treal_t x = fma(" << cosa << ", bxx, -(" << sina << " * byy));\n"
|
||||||
|
<< "\t\treal_t y = fma(" << sina << ", bxx, " << cosa << " * byy);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (x > 0)\n"
|
<< "\t\tif (x > 0)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -5311,16 +5344,16 @@ public:
|
|||||||
string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t dot00 = SQR(" << a << ") + SQR(" << b << ");\n"
|
<< "\t\treal_t dot00 = fma(" << a << ", " << a << ", SQR(" << b << "));\n"
|
||||||
<< "\t\treal_t dot01 = " << a << " * " << c << " + " << b << " * " << d << ";\n"
|
<< "\t\treal_t dot01 = fma(" << a << ", " << c << ", " << b << " * " << d << ");\n"
|
||||||
<< "\t\treal_t dot02 = " << a << " * vIn.x + " << b << " * vIn.y;\n"
|
<< "\t\treal_t dot02 = fma(" << a << ", vIn.x, " << b << " * vIn.y);\n"
|
||||||
<< "\t\treal_t dot11 = SQR(" << c << ") + SQR(" << d << ");\n"
|
<< "\t\treal_t dot11 = fma(" << c << ", " << c << ", SQR(" << d << "));\n"
|
||||||
<< "\t\treal_t dot12 = " << c << " * vIn.x + " << d << " * vIn.y;\n"
|
<< "\t\treal_t dot12 = fma(" << c << ", vIn.x, " << d << " * vIn.y);\n"
|
||||||
<< "\t\treal_t invDenom = (real_t)(1.0) / Zeps(dot00 * dot11 - dot01 * dot01);\n"
|
<< "\t\treal_t invDenom = (real_t)(1.0) / Zeps(fma(dot00, dot11, -(dot01 * dot01)));\n"
|
||||||
<< "\t\treal_t u = (dot11 * dot02 - dot01 * dot12) * invDenom;\n"
|
<< "\t\treal_t u = fma(dot11, dot02, -(dot01 * dot12)) * invDenom;\n"
|
||||||
<< "\t\treal_t v = (dot00 * dot12 - dot01 * dot02) * invDenom;\n"
|
<< "\t\treal_t v = fma(dot00, dot12, -(dot01 * dot02)) * invDenom;\n"
|
||||||
<< "\t\treal_t um = sqrt(SQR(u) + SQR(vIn.x)) * Sign(u);\n"
|
<< "\t\treal_t um = sqrt(fma(u, u, SQR(vIn.x))) * Sign(u);\n"
|
||||||
<< "\t\treal_t vm = sqrt(SQR(v) + SQR(vIn.y)) * Sign(v);\n"
|
<< "\t\treal_t vm = sqrt(fma(v, v, SQR(vIn.y))) * Sign(v);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * um;\n"
|
<< "\t\tvOut.x = " << weight << " * um;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * vm;\n"
|
<< "\t\tvOut.y = " << weight << " * vm;\n"
|
||||||
@ -5566,8 +5599,8 @@ public:
|
|||||||
<< "\t\t a -= " << fullSpread << ";\n"
|
<< "\t\t a -= " << fullSpread << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t lnr2 = log(precalcSumSquares);\n"
|
<< "\t\treal_t lnr2 = log(precalcSumSquares);\n"
|
||||||
<< "\t\treal_t r = " << weight << " * exp(" << halfC << " * lnr2 - " << d << " * a);\n"
|
<< "\t\treal_t r = " << weight << " * exp(fma(" << halfC << ", lnr2, -(" << d << " * a)));\n"
|
||||||
<< "\t\treal_t temp = " << c << " * a + " << halfD << " * lnr2 + " << ang << " * MwcNext(mwc);\n"
|
<< "\t\treal_t temp = fma(" << c << ", a, fma(" << halfD << ", lnr2, " << ang << " * MwcNext(mwc)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cos(temp);\n"
|
<< "\t\tvOut.x = r * cos(temp);\n"
|
||||||
<< "\t\tvOut.y = r * sin(temp);\n"
|
<< "\t\tvOut.y = r * sin(temp);\n"
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
string effect = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string effect = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t temp = 1 / Zeps(cos(vIn.y)) + " << effect << " * MPI;\n"
|
<< "\t\treal_t temp = fma(" << effect << ", MPI, 1 / Zeps(cos(vIn.y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (tanh(vIn.x) * temp);\n"
|
<< "\t\tvOut.x = " << weight << " * (tanh(vIn.x) * temp);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (tanh(vIn.y) * temp);\n"
|
<< "\t\tvOut.y = " << weight << " * (tanh(vIn.y) * temp);\n"
|
||||||
@ -204,7 +204,7 @@ public:
|
|||||||
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t u = sqrt(ClampGte(Zeps(" << a << ") * SQR(vIn.x) + Zeps(" << b << ") * SQR(vIn.y), (real_t)(0.0)));\n"
|
<< "\t\treal_t u = sqrt(ClampGte(fma(Zeps(" << a << "), SQR(vIn.x), Zeps(" << b << ") * SQR(vIn.y)), (real_t)(0.0)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = cos(u) * tan(vIn.x) * " << weight << ";\n"
|
<< "\t\tvOut.x = cos(u) * tan(vIn.x) * " << weight << ";\n"
|
||||||
<< "\t\tvOut.y = sin(u) * tan(vIn.y) * " << weight << ";\n"
|
<< "\t\tvOut.y = sin(u) * tan(vIn.y) * " << weight << ";\n"
|
||||||
@ -245,8 +245,10 @@ public:
|
|||||||
|
|
||||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||||
{
|
{
|
||||||
helper.Out.x = m_Weight * (helper.In.x - ((SQR(helper.In.x) * helper.In.x) / 3)) + helper.In.x * SQR(helper.In.y);
|
T inxsq = SQR(helper.In.x);
|
||||||
helper.Out.y = m_Weight * (helper.In.y - ((SQR(helper.In.y) * helper.In.y) / 3)) + helper.In.y * SQR(helper.In.x);
|
T inysq = SQR(helper.In.y);
|
||||||
|
helper.Out.x = m_Weight * (helper.In.x - ((inxsq * helper.In.x) / 3)) + helper.In.x * inysq;
|
||||||
|
helper.Out.y = m_Weight * (helper.In.y - ((inysq * helper.In.y) / 3)) + helper.In.y * inxsq;
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,8 +258,8 @@ public:
|
|||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x - ((SQR(vIn.x) * vIn.x) / 3)) + vIn.x * SQR(vIn.y);\n"
|
<< "\t\tvOut.x = fma(" << weight << ", (vIn.x - ((SQR(vIn.x) * vIn.x) / 3)), vIn.x * SQR(vIn.y));\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (vIn.y - ((SQR(vIn.y) * vIn.y) / 3)) + vIn.y * SQR(vIn.x);\n"
|
<< "\t\tvOut.y = fma(" << weight << ", (vIn.y - ((SQR(vIn.y) * vIn.y) / 3)), vIn.y * SQR(vIn.x));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -302,7 +304,7 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = Zeps(pow(precalcSqrtSumSquares, " << dist << "));\n"
|
<< "\t\treal_t r = Zeps(pow(precalcSqrtSumSquares, " << dist << "));\n"
|
||||||
<< "\t\tint n = floor(" << power << " * MwcNext01(mwc));\n"
|
<< "\t\tint n = floor(" << power << " * MwcNext01(mwc));\n"
|
||||||
<< "\t\treal_t alpha = precalcAtanyx + n * M_2PI / Zeps(floor(" << power << "));\n"
|
<< "\t\treal_t alpha = fma(n, M_2PI / Zeps(floor(" << power << ")), precalcAtanyx);\n"
|
||||||
<< "\t\treal_t sina = sin(alpha);\n"
|
<< "\t\treal_t sina = sin(alpha);\n"
|
||||||
<< "\t\treal_t cosa = cos(alpha);\n"
|
<< "\t\treal_t cosa = cos(alpha);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -377,12 +379,12 @@ public:
|
|||||||
<< "\t\treal_t sin45 = sin(45 * DEG_2_RAD);\n"
|
<< "\t\treal_t sin45 = sin(45 * DEG_2_RAD);\n"
|
||||||
<< "\t\treal_t cos45 = cos(45 * DEG_2_RAD);\n"
|
<< "\t\treal_t cos45 = cos(45 * DEG_2_RAD);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = ((" << rotate << " * vIn.x) * cos45 - vIn.y * sin45 + " << lineUp << ") + " << x << ";\n"
|
<< "\t\tvOut.x = fma(" << rotate << " * vIn.x, cos45, -(vIn.y * sin45) + " << lineUp << ") + " << x << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (vIn.y > 0)\n"
|
<< "\t\tif (vIn.y > 0)\n"
|
||||||
<< "\t\t vOut.y = ((" << rotate << " * vIn.y) * cos45 + vIn.x * sin45 + " << pull << " + " << lineUp << ") + " << y << ";\n"
|
<< "\t\t vOut.y = fma(" << rotate << " * vIn.y, cos45, fma(vIn.x, sin45, " << pull << " + " << lineUp << ")) + " << y << ";\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t vOut.y = (" << rotate << " * vIn.y) * cos45 + vIn.x * sin45 - " << pull << " - " << lineUp << ";\n"
|
<< "\t\t vOut.y = fma(" << rotate << " * vIn.y, cos45, fma(vIn.x, sin45, -" << pull << " - " << lineUp << "));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -444,8 +446,9 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = SQR(alpha) * helper.In.x;
|
auto a2 = SQR(alpha);
|
||||||
y = SQR(alpha) * helper.In.y;
|
x = a2 * helper.In.x;
|
||||||
|
y = a2 * helper.In.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
z = Sqr(x - m_X1) + Sqr(y - m_Y1);
|
z = Sqr(x - m_X1) + Sqr(y - m_Y1);
|
||||||
@ -501,8 +504,9 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t x = SQR(alpha) * vIn.x;\n"
|
<< "\t\t real_t a2 = SQR(alpha);\n"
|
||||||
<< "\t\t y = SQR(alpha) * vIn.y;\n"
|
<< "\t\t x = a2 * vIn.x;\n"
|
||||||
|
<< "\t\t y = a2 * vIn.y;\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t z = Sqr(x - " << x1 << ") + Sqr(y - " << y1 << ");\n"
|
<< "\t\t z = Sqr(x - " << x1 << ") + Sqr(y - " << y1 << ");\n"
|
||||||
@ -540,8 +544,8 @@ public:
|
|||||||
" real_t sinPhi = sin(phi);\n"
|
" real_t sinPhi = sin(phi);\n"
|
||||||
" real_t cosPhi = cos(phi);\n"
|
" real_t cosPhi = cos(phi);\n"
|
||||||
"\n"
|
"\n"
|
||||||
" *x = r * cosPhi + *x1;\n"
|
" *x = fma(r, cosPhi, *x1);\n"
|
||||||
" *y = r * sinPhi + *y1;\n"
|
" *y = fma(r, sinPhi, *y1);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n";
|
"\n";
|
||||||
}
|
}
|
||||||
@ -693,7 +697,7 @@ public:
|
|||||||
"void GlynnSim2Circle(__constant real_t* radius, __constant real_t* thickness, __constant real_t* phi10, __constant real_t* delta, __constant real_t* gamma, uint2* mwc, real_t* x, real_t* y)\n"
|
"void GlynnSim2Circle(__constant real_t* radius, __constant real_t* thickness, __constant real_t* phi10, __constant real_t* delta, __constant real_t* gamma, uint2* mwc, real_t* x, real_t* y)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" real_t r = *radius + *thickness - *gamma * MwcNext01(mwc);\n"
|
" real_t r = *radius + *thickness - *gamma * MwcNext01(mwc);\n"
|
||||||
" real_t phi = *phi10 + *delta * MwcNext01(mwc);\n"
|
" real_t phi = fma(*delta, MwcNext01(mwc), *phi10);\n"
|
||||||
" real_t sinPhi = sin(phi);\n"
|
" real_t sinPhi = sin(phi);\n"
|
||||||
" real_t cosPhi = cos(phi);\n"
|
" real_t cosPhi = cos(phi);\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -967,12 +971,12 @@ public:
|
|||||||
<< "\t\tf -= angle;\n"
|
<< "\t\tf -= angle;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t x = f * " << length << ";\n"
|
<< "\t\treal_t x = f * " << length << ";\n"
|
||||||
<< "\t\treal_t z = sqrt(1 + SQR(x) - 2 * x * cos(" << alpha << "));\n"
|
<< "\t\treal_t z = sqrt(fma(x, x, (real_t)(1.0)) - 2 * x * cos(" << alpha << "));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (((int)angle) & 1)\n"
|
<< "\t\tif (((int)angle) & 1)\n"
|
||||||
<< "\t\t angle = M_2PI / " << power << " * (((int)angle) / 2) + asin(sin(" << alpha << ") * x / z);\n"
|
<< "\t\t angle = fma(M_2PI / " << power << ", (real_t)(((int)angle) / 2), asin(sin(" << alpha << ") * x / z));\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t angle = M_2PI / " << power << " * (((int)angle) / 2) - asin(sin(" << alpha << ") * x / z);\n"
|
<< "\t\t angle = fma(M_2PI / " << power << ", (real_t)(((int)angle) / 2), -asin(sin(" << alpha << ") * x / z));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tz *= sqrt(MwcNext01(mwc));\n"
|
<< "\t\tz *= sqrt(MwcNext01(mwc));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -1145,9 +1149,9 @@ public:
|
|||||||
<< "\t\tif (coeff != 0 && " << power << " != 1)\n"
|
<< "\t\tif (coeff != 0 && " << power << " != 1)\n"
|
||||||
<< "\t\t coeff = exp(log(coeff) * " << power << ");\n"
|
<< "\t\t coeff = exp(log(coeff) * " << power << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (transX + vIn.x * coeff);\n"
|
<< "\t\tvOut.x = " << weight << " * fma(vIn.x, coeff, transX);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (transY + vIn.y * coeff);\n"
|
<< "\t\tvOut.y = " << weight << " * fma(vIn.y, coeff, transY);\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * (transZ + vIn.z * coeff);\n"
|
<< "\t\tvOut.z = " << weight << " * fma(vIn.z, coeff, transZ);\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -1236,7 +1240,7 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t real_t rdc = xr + (MwcNext01(mwc) * (real_t)(0.5) * " << scatterDist << ");\n"
|
<< "\t\t real_t rdc = fma(MwcNext01(mwc), (real_t)(0.5) * " << scatterDist << ", xr);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * rdc * cos(precalcAtanyx);\n"
|
<< "\t\t vOut.x = " << weight << " * rdc * cos(precalcAtanyx);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * rdc * sin(precalcAtanyx);\n"
|
<< "\t\t vOut.y = " << weight << " * rdc * sin(precalcAtanyx);\n"
|
||||||
@ -1318,7 +1322,7 @@ public:
|
|||||||
string alpha = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string alpha = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t xang = (precalcAtanyx + M_3PI + " << alpha << " / 2) / " << alpha << ";\n"
|
<< "\t\treal_t xang = (precalcAtanyx + M_3PI + " << alpha << " / 2) / " << alpha << ";\n"
|
||||||
<< "\t\treal_t zang = ((xang - (int)xang) * " << width << " + (int)xang) * " << alpha << " - MPI - " << alpha << " / 2 * " << width << ";\n"
|
<< "\t\treal_t zang = fma((xang - (int)xang) * " << width << " + (int)xang, " << alpha << ", -MPI) - " << alpha << " / 2 * " << width << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * precalcSqrtSumSquares * cos(zang);\n"
|
<< "\t\tvOut.x = " << weight << " * precalcSqrtSumSquares * cos(zang);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * precalcSqrtSumSquares * sin(zang);\n"
|
<< "\t\tvOut.y = " << weight << " * precalcSqrtSumSquares * sin(zang);\n"
|
||||||
@ -1418,7 +1422,7 @@ public:
|
|||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t delta = exp(" << prescale << " * log(delta * positive)) * " << postscale << " * positive;\n"
|
<< "\t\t delta = exp(" << prescale << " * log(delta * positive)) * " << postscale << " * positive;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t real_t rad = " << radius << " + (precalcSqrtSumSquares - " << radius << ") * delta;\n"
|
<< "\t\t real_t rad = fma(precalcSqrtSumSquares - " << radius << ", delta, " << radius << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * rad * cos(precalcAtanyx);\n"
|
<< "\t\t vOut.x = " << weight << " * rad * cos(precalcAtanyx);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * rad * sin(precalcAtanyx);\n"
|
<< "\t\t vOut.y = " << weight << " * rad * sin(precalcAtanyx);\n"
|
||||||
@ -1497,9 +1501,9 @@ public:
|
|||||||
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t z = vIn.z / " << absn << ";\n"
|
<< "\t\treal_t z = vIn.z / " << absn << ";\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares + SQR(z), " << cn << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(fma(z, z, precalcSumSquares), " << cn << ");\n"
|
||||||
<< "\t\treal_t tmp = r * precalcSqrtSumSquares;\n"
|
<< "\t\treal_t tmp = r * precalcSqrtSumSquares;\n"
|
||||||
<< "\t\treal_t ang = (precalcAtanyx + M_2PI * MwcNextRange(mwc, (uint)" << absn << ")) / " << n << ";\n"
|
<< "\t\treal_t ang = fma(M_2PI, (real_t)MwcNextRange(mwc, (uint)" << absn << "), precalcAtanyx) / " << n << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = tmp * cos(ang);\n"
|
<< "\t\tvOut.x = tmp * cos(ang);\n"
|
||||||
<< "\t\tvOut.y = tmp * sin(ang);\n"
|
<< "\t\tvOut.y = tmp * sin(ang);\n"
|
||||||
@ -1573,7 +1577,7 @@ public:
|
|||||||
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << ");\n"
|
||||||
<< "\t\treal_t temp = (precalcAtanyx + M_2PI * MwcNextRange(mwc, (uint)" << absn << ")) / " << n << ";\n"
|
<< "\t\treal_t temp = fma(M_2PI, (real_t)MwcNextRange(mwc, (uint)" << absn << "), precalcAtanyx) / " << n << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cos(temp);\n"
|
<< "\t\tvOut.x = r * cos(temp);\n"
|
||||||
<< "\t\tvOut.y = r * sin(temp);\n"
|
<< "\t\tvOut.y = r * sin(temp);\n"
|
||||||
@ -1817,7 +1821,7 @@ public:
|
|||||||
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = " << weight << " / Zeps(precalcSumSquares + SQR(vIn.z));\n"
|
<< "\t\treal_t r = " << weight << " / Zeps(fma(vIn.z, vIn.z, precalcSumSquares));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = vIn.x * r * " << x << ";\n"
|
<< "\t\tvOut.x = vIn.x * r * " << x << ";\n"
|
||||||
<< "\t\tvOut.y = vIn.y * r * " << y << ";\n"
|
<< "\t\tvOut.y = vIn.y * r * " << y << ";\n"
|
||||||
@ -1865,8 +1869,10 @@ public:
|
|||||||
{
|
{
|
||||||
T t = (m_TMax - m_TMin) * rand.Frand01<T>() + m_TMin;
|
T t = (m_TMax - m_TMin) * rand.Frand01<T>() + m_TMin;
|
||||||
T y = (m_YMax - m_YMin) * rand.Frand01<T>() + m_YMin;
|
T y = (m_YMax - m_YMin) * rand.Frand01<T>() + m_YMin;
|
||||||
T x1 = (m_A + m_B) * std::cos(t) - m_C1 * std::cos((m_A + m_B) / m_B * t);
|
T ab = m_A + m_B;
|
||||||
T y1 = (m_A + m_B) * std::sin(t) - m_C2 * std::sin((m_A + m_B) / m_B * t);
|
T abdivbt = ab / m_B * t;
|
||||||
|
T x1 = ab * std::cos(t) - m_C1 * std::cos(abdivbt);
|
||||||
|
T y1 = ab * std::sin(t) - m_C2 * std::sin(abdivbt);
|
||||||
helper.Out.x = m_Weight * (x1 + m_D * std::cos(t) + y);
|
helper.Out.x = m_Weight * (x1 + m_D * std::cos(t) + y);
|
||||||
helper.Out.y = m_Weight * (y1 + m_D * std::sin(t) + y);
|
helper.Out.y = m_Weight * (y1 + m_D * std::sin(t) + y);
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
@ -1889,13 +1895,15 @@ public:
|
|||||||
string c1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t t = (" << tmax << " - " << tmin << ") * MwcNext01(mwc) + " << tmin << ";\n"
|
<< "\t\treal_t t = fma(" << tmax << " - " << tmin << ", MwcNext01(mwc), " << tmin << ");\n"
|
||||||
<< "\t\treal_t y = (" << ymax << " - " << ymin << ") * MwcNext01(mwc) + " << ymin << ";\n"
|
<< "\t\treal_t y = fma(" << ymax << " - " << ymin << ", MwcNext01(mwc), " << ymin << ");\n"
|
||||||
<< "\t\treal_t x1 = (" << a << " + " << b << ") * cos(t) - " << c1 << " * cos((" << a << " + " << b << ") / " << b << " * t);\n"
|
<< "\t\treal_t ab = " << a << " + " << b << ";\n"
|
||||||
<< "\t\treal_t y1 = (" << a << " + " << b << ") * sin(t) - " << c2 << " * sin((" << a << " + " << b << ") / " << b << " * t);\n"
|
<< "\t\treal_t abdivbt = ab / " << b << " * t;\n"
|
||||||
|
<< "\t\treal_t x1 = fma(ab, cos(t), -(" << c1 << " * cos(abdivbt)));\n"
|
||||||
|
<< "\t\treal_t y1 = fma(ab, sin(t), -(" << c2 << " * sin(abdivbt)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (x1 + " << d << " * cos(t) + y);\n"
|
<< "\t\tvOut.x = " << weight << " * fma(" << d << ", cos(t), x1 + y);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (y1 + " << d << " * sin(t) + y);\n"
|
<< "\t\tvOut.y = " << weight << " * fma(" << d << ", sin(t), y1 + y);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2003,7 +2011,7 @@ public:
|
|||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t e = 1 / precalcSumSquares + SQR(M2PI);\n"
|
<< "\t\treal_t e = fma(M2PI, M2PI, 1 / precalcSumSquares);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (" << weight << " / precalcSumSquares * vIn.x / e);\n"
|
<< "\t\tvOut.x = " << weight << " * (" << weight << " / precalcSumSquares * vIn.x / e);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (" << weight << " / precalcSumSquares * vIn.y / e);\n"
|
<< "\t\tvOut.y = " << weight << " * (" << weight << " / precalcSumSquares * vIn.y / e);\n"
|
||||||
@ -2011,6 +2019,11 @@ public:
|
|||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
|
{
|
||||||
|
return vector<string> { "Zeps" };
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -2122,8 +2135,8 @@ public:
|
|||||||
ss
|
ss
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t d = precalcSumSquares + SQR(tempTz);\n"
|
<< "\t\treal_t d = fma(tempTz, tempTz, precalcSumSquares);\n"
|
||||||
<< "\t\treal_t e = 1 / d + SQR(M2PI);\n"
|
<< "\t\treal_t e = fma(M2PI, M2PI, 1 / d);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (" << weight << " / d * vIn.x / e);\n"
|
<< "\t\tvOut.x = " << weight << " * (" << weight << " / d * vIn.x / e);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (" << weight << " / d * vIn.y / e);\n"
|
<< "\t\tvOut.y = " << weight << " * (" << weight << " / d * vIn.y / e);\n"
|
||||||
@ -2324,17 +2337,17 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (isXY & 1)\n"
|
<< "\t\tif (isXY & 1)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t dx = -" << x << " + " << rand << " * MwcNext01(mwc);\n"
|
<< "\t\t dx = fma(" << rand << ", MwcNext01(mwc), -" << x << ");\n"
|
||||||
<< "\t\t dy = -" << y << ";\n"
|
<< "\t\t dy = -" << y << ";\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t dx = " << x << ";\n"
|
<< "\t\t dx = " << x << ";\n"
|
||||||
<< "\t\t dy = " << y << " + " << rand << " * MwcNext01(mwc);\n"
|
<< "\t\t dy = fma(" << rand << ", MwcNext01(mwc), " << y << ");\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (sin(vIn.x) * r + dx);\n"
|
<< "\t\tvOut.x = " << weight << " * fma(sin(vIn.x), r, dx);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (sin(vIn.y) * r + dy);\n"
|
<< "\t\tvOut.y = " << weight << " * fma(sin(vIn.y), r, dy);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2412,7 +2425,7 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t preX = vIn.x * (" << xDistort << " + 1);\n"
|
<< "\t\treal_t preX = vIn.x * (" << xDistort << " + 1);\n"
|
||||||
<< "\t\treal_t preY = vIn.y * (" << yDistort << " + 1);\n"
|
<< "\t\treal_t preY = vIn.y * (" << yDistort << " + 1);\n"
|
||||||
<< "\t\treal_t temp = atan2(preY, preX) * " << invN << " + MwcNext(mwc) * " << inv2PiN << ";\n"
|
<< "\t\treal_t temp = fma(atan2(preY, preX), " << invN << ", MwcNext(mwc) * " << inv2PiN << ");\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cN << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cN << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cos(temp);\n"
|
<< "\t\tvOut.x = r * cos(temp);\n"
|
||||||
@ -2496,14 +2509,14 @@ public:
|
|||||||
string reD = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string reD = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string imD = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string imD = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t uRe = " << reA << " * vIn.x - " << imA << " * vIn.y + " << reB << ";\n"
|
<< "\t\treal_t uRe = fma(" << reA << ", vIn.x, -(" << imA << " * vIn.y) + " << reB << ");\n"
|
||||||
<< "\t\treal_t uIm = " << reA << " * vIn.y + " << imA << " * vIn.x + " << imB << ";\n"
|
<< "\t\treal_t uIm = fma(" << reA << ", vIn.y, fma(" << imA << ", vIn.x, " << imB << "));\n"
|
||||||
<< "\t\treal_t vRe = " << reC << " * vIn.x - " << imC << " * vIn.y + " << reD << ";\n"
|
<< "\t\treal_t vRe = fma(" << reC << ", vIn.x, -(" << imC << " * vIn.y) + " << reD << ");\n"
|
||||||
<< "\t\treal_t vIm = " << reC << " * vIn.y + " << imC << " * vIn.x + " << imD << ";\n"
|
<< "\t\treal_t vIm = fma(" << reC << ", vIn.y, fma(" << imC << ", vIn.x, " << imD << "));\n"
|
||||||
<< "\t\treal_t vDenom = Zeps(vRe * vRe + vIm * vIm);\n"
|
<< "\t\treal_t vDenom = Zeps(fma(vRe, vRe, SQR(vIm)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (uRe * vRe + uIm * vIm) / vDenom;\n"
|
<< "\t\tvOut.x = " << weight << " * fma(uRe, vRe, uIm * vIm) / vDenom;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (uIm * vRe - uRe * vIm) / vDenom;\n"
|
<< "\t\tvOut.y = " << weight << " * fma(uIm, vRe, -(uRe * vIm)) / vDenom;\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2603,19 +2616,19 @@ public:
|
|||||||
<< "\t\treal_t alpha = precalcAtanyx * " << power << ";\n"
|
<< "\t\treal_t alpha = precalcAtanyx * " << power << ";\n"
|
||||||
<< "\t\treal_t x = r * cos(alpha);\n"
|
<< "\t\treal_t x = r * cos(alpha);\n"
|
||||||
<< "\t\treal_t y = r * sin(alpha);\n"
|
<< "\t\treal_t y = r * sin(alpha);\n"
|
||||||
<< "\t\treal_t reU = " << reA << " * x - " << imA << " * y + " << reB << ";\n"
|
<< "\t\treal_t reU = fma(" << reA << ", x, -(" << imA << " * y) + " << reB << ");\n"
|
||||||
<< "\t\treal_t imU = " << reA << " * y + " << imA << " * x + " << imB << ";\n"
|
<< "\t\treal_t imU = fma(" << reA << ", y, fma(" << imA << ", x, " << imB << "));\n"
|
||||||
<< "\t\treal_t reV = " << reC << " * x - " << imC << " * y + " << reD << ";\n"
|
<< "\t\treal_t reV = fma(" << reC << ", x, -(" << imC << " * y) + " << reD << ");\n"
|
||||||
<< "\t\treal_t imV = " << reC << " * y + " << imC << " * x + " << imD << ";\n"
|
<< "\t\treal_t imV = fma(" << reC << ", y, fma(" << imC << ", x, " << imD << "));\n"
|
||||||
<< "\t\treal_t radV = reV * reV + imV * imV;\n"
|
<< "\t\treal_t radV = fma(reV, reV, SQR(imV));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tx = (reU * reV + imU * imV) / radV;\n"
|
<< "\t\tx = fma(reU, reV, imU * imV) / radV;\n"
|
||||||
<< "\t\ty = (imU * reV - reU * imV) / radV;\n"
|
<< "\t\ty = fma(imU, reV, -(reU * imV)) / radV;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tz = (real_t)(1.0) / z;\n"
|
<< "\t\tz = (real_t)(1.0) / z;\n"
|
||||||
<< "\t\tr = pow(sqrt(SQR(x) + SQR(y)), z);\n"
|
<< "\t\tr = pow(sqrt(fma(x, x, SQR(y))), z);\n"
|
||||||
<< "\t\tn = (int)floor(" << power << " * MwcNext01(mwc));\n"
|
<< "\t\tn = (int)floor(" << power << " * MwcNext01(mwc));\n"
|
||||||
<< "\t\talpha = (atan2(y, x) + n * M_2PI) / floor(" << power << ");\n"
|
<< "\t\talpha = fma((real_t)n, M_2PI, atan2(y, x)) / floor(" << power << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * r * cos(alpha);\n"
|
<< "\t\tvOut.x = " << weight << " * r * cos(alpha);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * r * sin(alpha);\n"
|
<< "\t\tvOut.y = " << weight << " * r * sin(alpha);\n"
|
||||||
@ -2770,20 +2783,20 @@ public:
|
|||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t deltaS = (s + " << rectY << ") / (2 * " << rectY << ");\n"
|
<< "\t\t deltaS = (s + " << rectY << ") / (2 * " << rectY << ");\n"
|
||||||
<< "\t\t deltaS -= floor(deltaS);\n"
|
<< "\t\t deltaS -= floor(deltaS);\n"
|
||||||
<< "\t\t s = 2 * " << width << " * deltaS - " << width << ";\n"
|
<< "\t\t s = fma((real_t)(2.0) * " << width << ", deltaS, -" << width << ");\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tmx = (" << radius << " + s * cos(t / 2)) * cos(t);\n"
|
<< "\t\tmx = fma(s, cos(t / 2), " << radius << ") * cos(t);\n"
|
||||||
<< "\t\tmy = (" << radius << " + s * cos(t / 2)) * sin(t);\n"
|
<< "\t\tmy = fma(s, cos(t / 2), " << radius << ") * sin(t);\n"
|
||||||
<< "\t\tmz = s * sin(t / 2);\n"
|
<< "\t\tmz = s * sin(t / 2);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\trx = mx;\n"
|
<< "\t\trx = mx;\n"
|
||||||
<< "\t\try = my * " << rotyCos << " + mz * " << rotySin << ";\n"
|
<< "\t\try = fma(my, " << rotyCos << ", mz * " << rotySin << ");\n"
|
||||||
<< "\t\trz = mz * " << rotyCos << " - my * " << rotySin << ";\n"
|
<< "\t\trz = fma(mz, " << rotyCos << ", -(my * " << rotySin << "));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tmx = rx * " << rotxCos << " - rz * " << rotxSin << ";\n"
|
<< "\t\tmx = fma(rx, " << rotxCos << ", -(rz * " << rotxSin << "));\n"
|
||||||
<< "\t\tmy = ry;\n"
|
<< "\t\tmy = ry;\n"
|
||||||
<< "\t\tmz = rz * " << rotxCos << " + rx * " << rotxSin << ";\n"
|
<< "\t\tmz = fma(rz, " << rotxCos << ", rx * " << rotxSin << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * mx;\n"
|
<< "\t\tvOut.x = " << weight << " * mx;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * my;\n"
|
<< "\t\tvOut.y = " << weight << " * my;\n"
|
||||||
@ -2870,13 +2883,13 @@ public:
|
|||||||
string d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string d = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string e = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string e = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t t = (" << max << " - " << min << ") * MwcNext01(mwc) + " << min << ";\n"
|
<< "\t\treal_t t = fma(" << max << " - " << min << ", MwcNext01(mwc), " << min << ");\n"
|
||||||
<< "\t\treal_t y = MwcNext01(mwc) - (real_t)(0.5);\n"
|
<< "\t\treal_t y = MwcNext01(mwc) - (real_t)(0.5);\n"
|
||||||
<< "\t\treal_t x1 = sin(" << a << " * t + " << d << ");\n"
|
<< "\t\treal_t x1 = sin(fma(" << a << ", t, " << d << "));\n"
|
||||||
<< "\t\treal_t y1 = sin(" << b << " * t);\n"
|
<< "\t\treal_t y1 = sin(" << b << " * t);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (x1 + " << c << " * t + " << e << " * y);\n"
|
<< "\t\tvOut.x = " << weight << " * fma(" << c << ", t, fma(" << e << ", y, x1));\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (y1 + " << c << " * t + " << e << " * y);\n"
|
<< "\t\tvOut.y = " << weight << " * fma(" << c << ", t, fma(" << e << ", y, y1));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -3100,11 +3113,11 @@ public:
|
|||||||
<< "\t\treal_t cx = cos(vIn.x);\n"
|
<< "\t\treal_t cx = cos(vIn.x);\n"
|
||||||
<< "\t\treal_t sy = sin(vIn.y);\n"
|
<< "\t\treal_t sy = sin(vIn.y);\n"
|
||||||
<< "\t\treal_t cy = cos(vIn.y);\n"
|
<< "\t\treal_t cy = cos(vIn.y);\n"
|
||||||
<< "\t\treal_t ir = " << invTimesR << " + (" << oneMinusInv << " * (" << r << " * cos(" << n << " * vIn.x)));\n"
|
<< "\t\treal_t ir = fma(" << oneMinusInv << ", " << r << " * cos(" << n << " * vIn.x), " << invTimesR << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (cx * (ir + sy));\n"
|
<< "\t\tvOut.x = " << weight << " * (cx * (ir + sy));\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (sx * (ir + sy));\n"
|
<< "\t\tvOut.y = " << weight << " * (sx * (ir + sy));\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * (" << sor << " * cy) + (" << oneMinusSor << " * vIn.y);\n"
|
<< "\t\tvOut.z = fma(" << weight << ", " << sor << " * cy, " << oneMinusSor << " * vIn.y);\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -3207,18 +3220,18 @@ public:
|
|||||||
<< "\t\t alt = (int)(a * " << knpi << ");\n"
|
<< "\t\t alt = (int)(a * " << knpi << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if ((alt & 1) == 0)\n"
|
<< "\t\t if ((alt & 1) == 0)\n"
|
||||||
<< "\t\t a = alt * " << pikn << " + fmod(" << kakn << " + a, " << pikn << ");\n"
|
<< "\t\t a = fma((real_t)alt, " << pikn << ", fmod(" << kakn << " + a, " << pikn << "));\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t a = alt * " << pikn << " + fmod(-" << kakn << " + a, " << pikn << ");\n"
|
<< "\t\t a = fma((real_t)alt, " << pikn << ", fmod(-" << kakn << " + a, " << pikn << "));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t alt = (int)(-a * " << knpi << ");\n"
|
<< "\t\t alt = (int)(-a * " << knpi << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if ((alt & 1) == 1)\n"
|
<< "\t\t if ((alt & 1) == 1)\n"
|
||||||
<< "\t\t a = -(alt * " << pikn << " + fmod(-" << kakn << " - a, " << pikn << "));\n"
|
<< "\t\t a = -fma((real_t)alt, " << pikn << ", fmod(-" << kakn << " - a, " << pikn << "));\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t a = -(alt * " << pikn << " + fmod(" << kakn << " - a, " << pikn << "));\n"
|
<< "\t\t a = -fma((real_t)alt, " << pikn << ", fmod(" << kakn << " - a, " << pikn << "));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cos(a);\n"
|
<< "\t\tvOut.x = r * cos(a);\n"
|
||||||
@ -3275,13 +3288,15 @@ public:
|
|||||||
|
|
||||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||||
{
|
{
|
||||||
T tau = T(0.5) * (std::log(Sqr(helper.In.x + 1) + SQR(helper.In.y)) - std::log(Sqr(helper.In.x - 1) + SQR(helper.In.y)));
|
T xp1 = helper.In.x + 1;
|
||||||
T sigma = T(M_PI) - std::atan2(helper.In.y, helper.In.x + 1) - std::atan2(helper.In.y, 1 - helper.In.x);
|
T inysq = SQR(helper.In.y);
|
||||||
|
T tau = T(0.5) * (std::log(SQR(xp1) + inysq) - std::log(Sqr(helper.In.x - 1) + inysq));
|
||||||
|
T sigma = T(M_PI) - std::atan2(helper.In.y, xp1) - std::atan2(helper.In.y, 1 - helper.In.x);
|
||||||
|
|
||||||
if (tau < m_Radius && -tau < m_Radius)
|
if (tau < m_Radius && -tau < m_Radius)
|
||||||
tau = fmod(tau + m_Radius + m_Distance * m_Radius, 2 * m_Radius) - m_Radius;
|
tau = fmod(tau + m_Radius + m_Distance * m_Radius, 2 * m_Radius) - m_Radius;
|
||||||
|
|
||||||
T temp = std::cosh(tau) - std::cos(sigma);
|
T temp = Zeps(std::cosh(tau) - std::cos(sigma));
|
||||||
helper.Out.x = m_Weight * std::sinh(tau) / temp;
|
helper.Out.x = m_Weight * std::sinh(tau) / temp;
|
||||||
helper.Out.y = m_Weight * std::sin(sigma) / temp;
|
helper.Out.y = m_Weight * std::sin(sigma) / temp;
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
@ -3297,13 +3312,16 @@ public:
|
|||||||
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t tau = (real_t)(0.5) * (log(Sqr(vIn.x + (real_t)(1.0)) + SQR(vIn.y)) - log(Sqr(vIn.x - (real_t)(1.0)) + SQR(vIn.y)));\n"
|
<< "\t\treal_t xp1 = vIn.x + (real_t)(1.0);\n"
|
||||||
<< "\t\treal_t sigma = MPI - atan2(vIn.y, vIn.x + (real_t)(1.0)) - atan2(vIn.y, (real_t)(1.0) - vIn.x);\n"
|
<< "\t\treal_t xm1 = vIn.x - (real_t)(1.0);\n"
|
||||||
|
<< "\t\treal_t inysq = SQR(vIn.y);\n"
|
||||||
|
<< "\t\treal_t tau = (real_t)(0.5) * (log(fma(xp1, xp1, inysq)) - log(fma(xm1, xm1, inysq)));\n"
|
||||||
|
<< "\t\treal_t sigma = MPI - atan2(vIn.y, xp1) - atan2(vIn.y, (real_t)(1.0) - vIn.x);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (tau < " << radius << " && -tau < " << radius << ")\n"
|
<< "\t\tif (tau < " << radius << " && -tau < " << radius << ")\n"
|
||||||
<< "\t\t tau = fmod(tau + " << radius << " + " << dist << " * " << radius << ", (real_t)(2.0) * " << radius << ") - " << radius << ";\n"
|
<< "\t\t tau = fmod(fma(" << dist << ", " << radius << ", tau + " << radius << "), (real_t)(2.0) * " << radius << ") - " << radius << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t temp = cosh(tau) - cos(sigma);\n"
|
<< "\t\treal_t temp = Zeps(cosh(tau) - cos(sigma));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * sinh(tau) / temp;\n"
|
<< "\t\tvOut.x = " << weight << " * sinh(tau) / temp;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * sin(sigma) / temp;\n"
|
<< "\t\tvOut.y = " << weight << " * sin(sigma) / temp;\n"
|
||||||
@ -3314,7 +3332,7 @@ public:
|
|||||||
|
|
||||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
{
|
{
|
||||||
return vector<string> { "Sqr" };
|
return vector<string> { "Sqr", "Zeps" };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -3347,10 +3365,12 @@ public:
|
|||||||
|
|
||||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||||
{
|
{
|
||||||
T tau = T(0.5) * (std::log(Sqr(helper.In.x + 1) + SQR(helper.In.y)) - std::log(Sqr(helper.In.x - 1) + SQR(helper.In.y)));
|
T xp1 = helper.In.x + 1;
|
||||||
T sigma = T(M_PI) - std::atan2(helper.In.y, helper.In.x + 1) - std::atan2(helper.In.y, 1 - helper.In.x);
|
T inysq = SQR(helper.In.y);
|
||||||
sigma = sigma + tau * m_Out + m_In / tau;
|
T tau = T(0.5) * (std::log(SQR(xp1) + inysq) - std::log(Sqr(helper.In.x - 1) + inysq));
|
||||||
T temp = std::cosh(tau) - std::cos(sigma);
|
T sigma = T(M_PI) - std::atan2(helper.In.y, xp1) - std::atan2(helper.In.y, 1 - helper.In.x);
|
||||||
|
sigma = sigma + tau * m_Out + m_In / Zeps(tau);
|
||||||
|
T temp = Zeps(std::cosh(tau) - std::cos(sigma));
|
||||||
helper.Out.x = m_Weight * std::sinh(tau) / temp;
|
helper.Out.x = m_Weight * std::sinh(tau) / temp;
|
||||||
helper.Out.y = m_Weight * std::sin(sigma) / temp;
|
helper.Out.y = m_Weight * std::sin(sigma) / temp;
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
@ -3366,12 +3386,15 @@ public:
|
|||||||
string in = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string in = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string out = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string out = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t tau = (real_t)(0.5) * (log(Sqr(vIn.x + (real_t)(1.0)) + SQR(vIn.y)) - log(Sqr(vIn.x - (real_t)(1.0)) + SQR(vIn.y)));\n"
|
<< "\t\treal_t xp1 = vIn.x + (real_t)(1.0);\n"
|
||||||
<< "\t\treal_t sigma = MPI - atan2(vIn.y, vIn.x + (real_t)(1.0)) - atan2(vIn.y, (real_t)(1.0) - vIn.x);\n"
|
<< "\t\treal_t xm1 = vIn.x - (real_t)(1.0);\n"
|
||||||
|
<< "\t\treal_t inysq = SQR(vIn.y);\n"
|
||||||
|
<< "\t\treal_t tau = (real_t)(0.5) * (log(fma(xp1, xp1, inysq)) - log(fma(xm1, xm1, inysq)));\n"
|
||||||
|
<< "\t\treal_t sigma = MPI - atan2(vIn.y, xp1) - atan2(vIn.y, (real_t)(1.0) - vIn.x);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tsigma = sigma + tau * " << out << " + " << in << " / tau;\n"
|
<< "\t\tsigma = sigma + tau * " << out << " + " << in << " / Zeps(tau);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t temp = cosh(tau) - cos(sigma);\n"
|
<< "\t\treal_t temp = Zeps(cosh(tau) - cos(sigma));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * sinh(tau) / temp;\n"
|
<< "\t\tvOut.x = " << weight << " * sinh(tau) / temp;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * sin(sigma) / temp;\n"
|
<< "\t\tvOut.y = " << weight << " * sin(sigma) / temp;\n"
|
||||||
@ -3382,7 +3405,7 @@ public:
|
|||||||
|
|
||||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
{
|
{
|
||||||
return vector<string> { "Sqr" };
|
return vector<string> { "Sqr", "Zeps" };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -3415,8 +3438,10 @@ public:
|
|||||||
|
|
||||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||||
{
|
{
|
||||||
T tau = T(0.5) * (std::log(Sqr(helper.In.x + 1) + SQR(helper.In.y)) - std::log(Sqr(helper.In.x - 1) + SQR(helper.In.y))) / m_Power + m_Move;
|
T xp1 = helper.In.x + 1;
|
||||||
T sigma = T(M_PI) - std::atan2(helper.In.y, helper.In.x + 1) - std::atan2(helper.In.y, 1 - helper.In.x) + m_Rotate;
|
T inysq = SQR(helper.In.y);
|
||||||
|
T tau = T(0.5) * (std::log(Sqr(xp1) + inysq) - std::log(Sqr(helper.In.x - 1) + inysq)) / m_Power + m_Move;
|
||||||
|
T sigma = T(M_PI) - std::atan2(helper.In.y, xp1) - std::atan2(helper.In.y, 1 - helper.In.x) + m_Rotate;
|
||||||
sigma = sigma / m_Power + M_2PI / m_Power * Floor<T>(rand.Frand01<T>() * m_Power);
|
sigma = sigma / m_Power + M_2PI / m_Power * Floor<T>(rand.Frand01<T>() * m_Power);
|
||||||
|
|
||||||
if (helper.In.x >= 0)
|
if (helper.In.x >= 0)
|
||||||
@ -3424,7 +3449,7 @@ public:
|
|||||||
else
|
else
|
||||||
tau -= m_Split;
|
tau -= m_Split;
|
||||||
|
|
||||||
T temp = std::cosh(tau) - std::cos(sigma);
|
T temp = Zeps(std::cosh(tau) - std::cos(sigma));
|
||||||
helper.Out.x = m_Weight * std::sinh(tau) / temp;
|
helper.Out.x = m_Weight * std::sinh(tau) / temp;
|
||||||
helper.Out.y = m_Weight * std::sin(sigma) / temp;
|
helper.Out.y = m_Weight * std::sin(sigma) / temp;
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
@ -3442,7 +3467,10 @@ public:
|
|||||||
string move = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string move = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string split = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string split = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t tau = (real_t)(0.5) * (log(Sqr(vIn.x + (real_t)(1.0)) + SQR(vIn.y)) - log(Sqr(vIn.x - (real_t)(1.0)) + SQR(vIn.y))) / " << power << " + " << move << ";\n"
|
<< "\t\treal_t xp1 = vIn.x + (real_t)(1.0);\n"
|
||||||
|
<< "\t\treal_t xm1 = vIn.x - (real_t)(1.0);\n"
|
||||||
|
<< "\t\treal_t inysq = SQR(vIn.y);\n"
|
||||||
|
<< "\t\treal_t tau = (real_t)(0.5) * (log(fma(xp1, xp1, inysq)) - log(fma(xm1, xm1, inysq))) / " << power << " + " << move << ";\n"
|
||||||
<< "\t\treal_t sigma = MPI - atan2(vIn.y, vIn.x + (real_t)(1.0)) - atan2(vIn.y, (real_t)(1.0) - vIn.x) + " << rotate << ";\n"
|
<< "\t\treal_t sigma = MPI - atan2(vIn.y, vIn.x + (real_t)(1.0)) - atan2(vIn.y, (real_t)(1.0) - vIn.x) + " << rotate << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tsigma = sigma / " << power << " + M_2PI / " << power << " * floor(MwcNext01(mwc) * " << power << ");\n"
|
<< "\t\tsigma = sigma / " << power << " + M_2PI / " << power << " * floor(MwcNext01(mwc) * " << power << ");\n"
|
||||||
@ -3452,7 +3480,7 @@ public:
|
|||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t tau -= " << split << ";\n"
|
<< "\t\t tau -= " << split << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t temp = cosh(tau) - cos(sigma);\n"
|
<< "\t\treal_t temp = Zeps(cosh(tau) - cos(sigma));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * sinh(tau) / temp;\n"
|
<< "\t\tvOut.x = " << weight << " * sinh(tau) / temp;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * sin(sigma) / temp;\n"
|
<< "\t\tvOut.y = " << weight << " * sin(sigma) / temp;\n"
|
||||||
@ -3463,7 +3491,7 @@ public:
|
|||||||
|
|
||||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
{
|
{
|
||||||
return vector<string> { "Sqr" };
|
return vector<string> { "Sqr", "Zeps" };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -3500,8 +3528,10 @@ public:
|
|||||||
|
|
||||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||||
{
|
{
|
||||||
T tau = T(0.5) * (std::log(Sqr(helper.In.x + 1) + SQR(helper.In.y)) - std::log(Sqr(helper.In.x - 1) + SQR(helper.In.y)));
|
T xp1 = helper.In.x + 1;
|
||||||
T sigma = T(M_PI) - std::atan2(helper.In.y, helper.In.x + 1) - std::atan2(helper.In.y, 1 - helper.In.x);
|
T inysq = SQR(helper.In.y);
|
||||||
|
T tau = T(0.5) * (std::log(Sqr(xp1) + inysq) - std::log(Sqr(helper.In.x - 1) + inysq));
|
||||||
|
T sigma = T(M_PI) - std::atan2(helper.In.y, xp1) - std::atan2(helper.In.y, 1 - helper.In.x);
|
||||||
int alt = int(sigma * m_CnPi);
|
int alt = int(sigma * m_CnPi);
|
||||||
|
|
||||||
if ((alt & 1) == 0)
|
if ((alt & 1) == 0)
|
||||||
@ -3509,7 +3539,7 @@ public:
|
|||||||
else
|
else
|
||||||
sigma = alt * m_PiCn + fmod(sigma - m_CaCn, m_PiCn);
|
sigma = alt * m_PiCn + fmod(sigma - m_CaCn, m_PiCn);
|
||||||
|
|
||||||
T temp = std::cosh(tau) - std::cos(sigma);
|
T temp = Zeps(std::cosh(tau) - std::cos(sigma));
|
||||||
helper.Out.x = m_Weight * std::sinh(tau) / temp;
|
helper.Out.x = m_Weight * std::sinh(tau) / temp;
|
||||||
helper.Out.y = m_Weight * std::sin(sigma) / temp;
|
helper.Out.y = m_Weight * std::sin(sigma) / temp;
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
@ -3529,16 +3559,19 @@ public:
|
|||||||
string caCn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string caCn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string piCn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string piCn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t tau = (real_t)(0.5) * (log(Sqr(vIn.x + (real_t)(1.0)) + SQR(vIn.y)) - log(Sqr(vIn.x - (real_t)(1.0)) + SQR(vIn.y)));\n"
|
<< "\t\treal_t xp1 = vIn.x + (real_t)(1.0);\n"
|
||||||
<< "\t\treal_t sigma = MPI - atan2(vIn.y, vIn.x + (real_t)(1.0)) - atan2(vIn.y, (real_t)(1.0) - vIn.x);\n"
|
<< "\t\treal_t xm1 = vIn.x - (real_t)(1.0);\n"
|
||||||
|
<< "\t\treal_t inysq = SQR(vIn.y);\n"
|
||||||
|
<< "\t\treal_t tau = (real_t)(0.5) * (log(fma(xp1, xp1, inysq)) - log(fma(xm1, xm1, inysq)));\n"
|
||||||
|
<< "\t\treal_t sigma = MPI - atan2(vIn.y, xp1) - atan2(vIn.y, (real_t)(1.0) - vIn.x);\n"
|
||||||
<< "\t\tint alt = (int)(sigma * " << cnPi << ");\n"
|
<< "\t\tint alt = (int)(sigma * " << cnPi << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif ((alt & 1) == 0)\n"
|
<< "\t\tif ((alt & 1) == 0)\n"
|
||||||
<< "\t\t sigma = alt * " << piCn << " + fmod(sigma + " << caCn << ", " << piCn << ");\n"
|
<< "\t\t sigma = fma(alt, " << piCn << ", fmod(sigma + " << caCn << ", " << piCn << "));\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t sigma = alt * " << piCn << " + fmod(sigma - " << caCn << ", " << piCn << ");\n"
|
<< "\t\t sigma = fma(alt, " << piCn << ", fmod(sigma - " << caCn << ", " << piCn << "));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t temp = cosh(tau) - cos(sigma);\n"
|
<< "\t\treal_t temp = Zeps(cosh(tau) - cos(sigma));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * sinh(tau) / temp;\n"
|
<< "\t\tvOut.x = " << weight << " * sinh(tau) / temp;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * sin(sigma) / temp;\n"
|
<< "\t\tvOut.y = " << weight << " * sin(sigma) / temp;\n"
|
||||||
@ -3549,7 +3582,7 @@ public:
|
|||||||
|
|
||||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
{
|
{
|
||||||
return vector<string> { "Sqr" };
|
return vector<string> { "Sqr", "Zeps" };
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Precalc() override
|
virtual void Precalc() override
|
||||||
@ -3642,11 +3675,11 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (fabs(vIn.y) <= " << weight << ")\n"
|
<< "\t\tif (fabs(vIn.y) <= " << weight << ")\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t c2 = sqrt(SQR(" << weight << ") - SQR(vIn.y));\n"
|
<< "\t\t c2 = sqrt(fma(" << weight << ", " << weight << ", - SQR(vIn.y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (fabs(vIn.x) <= c2)\n"
|
<< "\t\t if (fabs(vIn.x) <= c2)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t x = vIn.x + " << shift << " * " << weight << ";\n"
|
<< "\t\t x = fma(" << shift << ", " << weight << ", vIn.x);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (fabs(x) >= c2)\n"
|
<< "\t\t if (fabs(x) >= c2)\n"
|
||||||
<< "\t\t vOut.x = -(" << weight << " * vIn.x);\n"
|
<< "\t\t vOut.x = -(" << weight << " * vIn.x);\n"
|
||||||
|
@ -234,18 +234,18 @@ public:
|
|||||||
<< "\t\t s = x;\n"
|
<< "\t\t s = x;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (vIn.x > 0)\n"
|
<< "\t\t if (vIn.x > 0)\n"
|
||||||
<< "\t\t p = s + vIn.y + s * " << out4 << ";\n"
|
<< "\t\t p = fma(s, " << out4 << ", s + vIn.y);\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t p = 5 * s - vIn.y + s * " << out4 << ";\n"
|
<< "\t\t p = fma((real_t)(5.0), s, fma(s, " << out4 << ", -vIn.y));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t s = y;\n"
|
<< "\t\t s = y;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (vIn.y > 0)\n"
|
<< "\t\t if (vIn.y > 0)\n"
|
||||||
<< "\t\t p = 3 * s - vIn.x + s * " << out4 << ";\n"
|
<< "\t\t p = fma((real_t)(3.0), s, fma(s, " << out4 << ", -vIn.x));\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t p = 7 * s + vIn.x + s * " << out4 << ";\n"
|
<< "\t\t p = fma((real_t)(7.0), s, fma(s, " << out4 << ", vIn.x));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t p = fmod(p, s * 8);\n"
|
<< "\t\t p = fmod(p, s * 8);\n"
|
||||||
@ -253,25 +253,25 @@ public:
|
|||||||
<< "\t\t if (p <= 2 * s)\n"
|
<< "\t\t if (p <= 2 * s)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t x2 = s + " << space << ";\n"
|
<< "\t\t x2 = s + " << space << ";\n"
|
||||||
<< "\t\t y2 = -(1 * s - p);\n"
|
<< "\t\t y2 = -fma((real_t)(1.0), s, -p);\n"
|
||||||
<< "\t\t y2 = y2 + y2 / s * " << space << ";\n"
|
<< "\t\t y2 = y2 + y2 / s * " << space << ";\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else if (p <= 4 * s)\n"
|
<< "\t\t else if (p <= 4 * s)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t y2 = s + " << space << ";\n"
|
<< "\t\t y2 = s + " << space << ";\n"
|
||||||
<< "\t\t x2 = (3 * s - p);\n"
|
<< "\t\t x2 = fma((real_t)(3.0), s, -p);\n"
|
||||||
<< "\t\t x2 = x2 + x2 / s * " << space << ";\n"
|
<< "\t\t x2 = x2 + x2 / s * " << space << ";\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else if (p <= 6 * s)\n"
|
<< "\t\t else if (p <= 6 * s)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t x2 = -(s + " << space << ");\n"
|
<< "\t\t x2 = -(s + " << space << ");\n"
|
||||||
<< "\t\t y2 = (5 * s - p);\n"
|
<< "\t\t y2 = fma((real_t)(5.0), s, -p);\n"
|
||||||
<< "\t\t y2 = y2 + y2 / s * " << space << ";\n"
|
<< "\t\t y2 = y2 + y2 / s * " << space << ";\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t y2 = -(s + " << space << ");\n"
|
<< "\t\t y2 = -(s + " << space << ");\n"
|
||||||
<< "\t\t x2 = -(7 * s - p);\n"
|
<< "\t\t x2 = -fma((real_t)(7.0), s, -p);\n"
|
||||||
<< "\t\t x2 = x2 + x2 / s * " << space << ";\n"
|
<< "\t\t x2 = x2 + x2 / s * " << space << ";\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -285,18 +285,18 @@ public:
|
|||||||
<< "\t\t s = x;\n"
|
<< "\t\t s = x;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (vIn.x > 0)\n"
|
<< "\t\t if (vIn.x > 0)\n"
|
||||||
<< "\t\t p = s + vIn.y + s * " << in4 << ";\n"
|
<< "\t\t p = fma(s, " << in4 << ", s + vIn.y);\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t p = 5 * s - vIn.y + s * " << in4 << ";\n"
|
<< "\t\t p = fma((real_t)(5.0), s, fma(s, " << in4 << ", -vIn.y));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t s = y;\n"
|
<< "\t\t s = y;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (vIn.y > 0)\n"
|
<< "\t\t if (vIn.y > 0)\n"
|
||||||
<< "\t\t p = 3 * s - vIn.x + s * " << in4 << ";\n"
|
<< "\t\t p = fma((real_t)(3.0), s, fma(s, " << in4 << ", -vIn.x));\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t p = 7 * s + vIn.x + s * " << in4 << ";\n"
|
<< "\t\t p = fma((real_t)(7.0), s, fma(s, " << in4 << ", vIn.x));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t p = fmod(p, s * 8);\n"
|
<< "\t\t p = fmod(p, s * 8);\n"
|
||||||
@ -308,17 +308,17 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else if (p <= 4 * s)\n"
|
<< "\t\t else if (p <= 4 * s)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (3 * s - p);\n"
|
<< "\t\t vOut.x = " << weight << " * fma((real_t)(3.0), s, -p);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * s;\n"
|
<< "\t\t vOut.y = " << weight << " * s;\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else if (p <= 6 * s)\n"
|
<< "\t\t else if (p <= 6 * s)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = -(" << weight << " * s);\n"
|
<< "\t\t vOut.x = -(" << weight << " * s);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (5 * s - p);\n"
|
<< "\t\t vOut.y = " << weight << " * fma((real_t)(5.0), s, -p);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = -(" << weight << " * (7 * s - p));\n"
|
<< "\t\t vOut.x = -(" << weight << " * fma((real_t)(7.0), s, -p));\n"
|
||||||
<< "\t\t vOut.y = -(" << weight << " * s);\n"
|
<< "\t\t vOut.y = -(" << weight << " * s);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -447,19 +447,19 @@ public:
|
|||||||
<< "\t\t if (vIn.x > 0)\n"
|
<< "\t\t if (vIn.x > 0)\n"
|
||||||
<< "\t\t p = vIn.y;\n"
|
<< "\t\t p = vIn.y;\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t p = 4 * s - vIn.y;\n"
|
<< "\t\t p = fma((real_t)(4.0), s, -vIn.y);\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t s = y;\n"
|
<< "\t\t s = y;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (vIn.y > 0)\n"
|
<< "\t\t if (vIn.y > 0)\n"
|
||||||
<< "\t\t p = 2 * s - vIn.x;\n"
|
<< "\t\t p = fma((real_t)(2.0), s, -vIn.x);\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t p = 6 * s + vIn.x;\n"
|
<< "\t\t p = fma((real_t)(6.0), s, vIn.x);\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tp = " << invPower << " * (p + 8 * s * floor(" << power << " * MwcNext01(mwc)));\n"
|
<< "\t\tp = " << invPower << " * fma((real_t)(8.0), s * floor(" << power << " * MwcNext01(mwc)), p);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (p <= s)\n"
|
<< "\t\tif (p <= s)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -468,23 +468,23 @@ public:
|
|||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse if (p <= 3 * s)\n"
|
<< "\t\telse if (p <= 3 * s)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (2 * s - p);\n"
|
<< "\t\t vOut.x = " << weight << " * fma((real_t)(2.0), s, -p);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * s;\n"
|
<< "\t\t vOut.y = " << weight << " * s;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse if (p <= 5 * s)\n"
|
<< "\t\telse if (p <= 5 * s)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = -(" << weight << " * s);\n"
|
<< "\t\t vOut.x = -(" << weight << " * s);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (4 * s - p);\n"
|
<< "\t\t vOut.y = " << weight << " * fma((real_t)(4.0), s, -p);\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse if (p <= 7 * s)\n"
|
<< "\t\telse if (p <= 7 * s)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = -(" << weight << " * (6 * s - p));\n"
|
<< "\t\t vOut.x = -(" << weight << " * fma((real_t)(6.0), s, -p));\n"
|
||||||
<< "\t\t vOut.y = -(" << weight << " * s);\n"
|
<< "\t\t vOut.y = -(" << weight << " * s);\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * s;\n"
|
<< "\t\t vOut.x = " << weight << " * s;\n"
|
||||||
<< "\t\t vOut.y = -(" << weight << " * (8 * s - p));\n"
|
<< "\t\t vOut.y = -(" << weight << " * fma((real_t)(8.0), s, -p));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
@ -705,7 +705,7 @@ public:
|
|||||||
string rxSin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
|
string rxSin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
|
||||||
string rxCos = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string rxCos = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t z = " << rxCos << " * vIn.z - " << rxSin << " * vIn.y;\n"
|
<< "\t\treal_t z = fma(" << rxCos << ", vIn.z, -(" << rxSin << " * vIn.y));\n"
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
@ -720,7 +720,7 @@ public:
|
|||||||
"\t\tvOut.x = vIn.x;\n";
|
"\t\tvOut.x = vIn.x;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
ss << "\t\tvOut.y = " << rxSin << " * vIn.z + " << rxCos << " * vIn.y;\n"
|
ss << "\t\tvOut.y = fma(" << rxSin << ", vIn.z, " << rxCos << " * vIn.y);\n"
|
||||||
<< "\t\tvOut.z = z;\n"
|
<< "\t\tvOut.z = z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -788,7 +788,7 @@ public:
|
|||||||
string rySin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
|
string rySin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
|
||||||
string ryCos = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string ryCos = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tvOut.x = " << ryCos << " * vIn.x - " << rySin << " * vIn.z;\n";
|
<< "\t\tvOut.x = fma(" << ryCos << ", vIn.x, -(" << rySin << " * vIn.z));\n";
|
||||||
|
|
||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
{
|
{
|
||||||
@ -802,7 +802,7 @@ public:
|
|||||||
"\t\tvOut.y = vIn.y;\n";
|
"\t\tvOut.y = vIn.y;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
ss << "\t\tvOut.z = " << rySin << " * vIn.x + " << ryCos << " * vIn.z;\n"
|
ss << "\t\tvOut.z = fma(" << rySin << ", vIn.x, " << ryCos << " * vIn.z);\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -868,8 +868,8 @@ public:
|
|||||||
string rzSin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
|
string rzSin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
|
||||||
string rzCos = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string rzCos = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tvOut.x = " << rzSin << " * vIn.y + " << rzCos << " * vIn.x;\n"
|
<< "\t\tvOut.x = fma(" << rzSin << ", vIn.y, " << rzCos << " * vIn.x);\n"
|
||||||
<< "\t\tvOut.y = " << rzCos << " * vIn.y - " << rzSin << " * vIn.x;\n";
|
<< "\t\tvOut.y = fma(" << rzCos << ", vIn.y, -(" << rzSin << " * vIn.x));\n";
|
||||||
|
|
||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
{
|
{
|
||||||
@ -1161,13 +1161,13 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t sx = vIn.x - " << centerX << ";\n"
|
<< "\t\treal_t sx = vIn.x - " << centerX << ";\n"
|
||||||
<< "\t\treal_t sy = vIn.y - " << centerY << ";\n"
|
<< "\t\treal_t sy = vIn.y - " << centerY << ";\n"
|
||||||
<< "\t\treal_t r = sqrt(SQR(sx) + SQR(sy)) - " << offset << ";\n"
|
<< "\t\treal_t r = sqrt(fma(sx, sx, SQR(sy))) - " << offset << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tr = r < 0 ? 0 : r;\n"
|
<< "\t\tr = r < 0 ? 0 : r;\n"
|
||||||
<< "\t\tr *= " << s2 << ";\n"
|
<< "\t\tr *= " << s2 << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x + (MwcNext01(mwc) - (real_t)(0.5)) * r);\n"
|
<< "\t\tvOut.x = " << weight << " * fma(MwcNext01(mwc) - (real_t)(0.5), r, vIn.x);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (vIn.y + (MwcNext01(mwc) - (real_t)(0.5)) * r);\n"
|
<< "\t\tvOut.y = " << weight << " * fma(MwcNext01(mwc) - (real_t)(0.5), r, vIn.y);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -1241,11 +1241,11 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t jun = Zeps(fabs(" << n << "));\n"
|
<< "\t\treal_t jun = Zeps(fabs(" << n << "));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t a = (atan2(vIn.y, pow(fabs(vIn.x), " << sep << ")) + M_2PI * floor(MwcNext01(mwc) * " << absN << ")) / jun;\n"
|
<< "\t\treal_t a = fma(M_2PI, floor(MwcNext01(mwc) * " << absN << "), atan2(vIn.y, pow(fabs(vIn.x), " << sep << "))) / jun;\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << " * " << a << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(precalcSumSquares, " << cn << " * " << a << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cos(a) + " << b << ";\n"
|
<< "\t\tvOut.x = fma(r, cos(a), " << b << ");\n"
|
||||||
<< "\t\tvOut.y = r * sin(a) + " << b << ";\n"
|
<< "\t\tvOut.y = fma(r, sin(a), " << b << ");\n"
|
||||||
<< "\t\tvOut.z = vIn.z;\n";
|
<< "\t\tvOut.z = vIn.z;\n";
|
||||||
|
|
||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
@ -1436,7 +1436,7 @@ public:
|
|||||||
<< "\t\t y = (real_t)(VoronDiscreteNoise((int)(l + 21 * m1 + 33 * n1 + " << ySeed << ")) + n1) * " << step << ";\n"
|
<< "\t\t y = (real_t)(VoronDiscreteNoise((int)(l + 21 * m1 + 33 * n1 + " << ySeed << ")) + n1) * " << step << ";\n"
|
||||||
<< "\t\t offsetX = vIn.x - x;\n"
|
<< "\t\t offsetX = vIn.x - x;\n"
|
||||||
<< "\t\t offsetY = vIn.y - y;\n"
|
<< "\t\t offsetY = vIn.y - y;\n"
|
||||||
<< "\t\t r = sqrt(SQR(offsetX) + SQR(offsetY));\n"
|
<< "\t\t r = sqrt(fma(offsetX, offsetX, SQR(offsetY)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (r < rMin)\n"
|
<< "\t\t if (r < rMin)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
@ -1448,8 +1448,8 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (" << m_k << " * (vIn.x - x0) + x0);\n"
|
<< "\t\tvOut.x = " << weight << " * fma(" << m_k << ", (vIn.x - x0), x0);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (" << m_k << " * (vIn.y - y0) + y0);\n"
|
<< "\t\tvOut.y = " << weight << " * fma(" << m_k << ", (vIn.y - y0), y0);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -1583,16 +1583,16 @@ public:
|
|||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 3:\n"
|
<< "\t\t case 3:\n"
|
||||||
<< "\t\t a = MwcNext01(mwc);\n"
|
<< "\t\t a = MwcNext01(mwc);\n"
|
||||||
<< "\t\t r = (MwcNextRange(mwc, (int)" << slices << ") + " << yThickness << " + MwcNext01(mwc) * (1 - " << yThickness << ")) / " << slices << ";\n"
|
<< "\t\t r = fma(MwcNext01(mwc), 1 - " << yThickness << ", MwcNextRange(mwc, (int)" << slices << ") + " << yThickness << ") / " << slices << ";\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 4:\n"
|
<< "\t\t case 4:\n"
|
||||||
<< "\t\t a = (MwcNextRange(mwc, (int)" << slices << ") + " << xThickness << " + MwcNext01(mwc) * (1 - " << xThickness << ")) / " << slices << ";\n"
|
<< "\t\t a = fma(MwcNext01(mwc), (1 - " << xThickness << "), MwcNextRange(mwc, (int)" << slices << ") + " << xThickness << ") / " << slices << ";\n"
|
||||||
<< "\t\t r = MwcNext01(mwc);\n"
|
<< "\t\t r = MwcNext01(mwc);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << cosr << " * a + " << sinr << " * r;\n"
|
<< "\t\tvOut.x = fma(" << cosr << ", a, " << sinr << " * r);\n"
|
||||||
<< "\t\tvOut.y = -" << sinr << " * a + " << cosr << " * r;\n"
|
<< "\t\tvOut.y = -fma(" << sinr << ", a, " << cosr << " * r);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -1766,15 +1766,15 @@ public:
|
|||||||
<< "\t\tmsinp = sin(temp);\n"
|
<< "\t\tmsinp = sin(temp);\n"
|
||||||
<< "\t\tmcosp = cos(temp);\n"
|
<< "\t\tmcosp = cos(temp);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tpr1 = " << an2_1 << " * pow(fabs(mcosr), " << n2_1 << ") + " << bn3_1 << " * pow(fabs(msinr), " << n3_1 << ");\n"
|
<< "\t\tpr1 = fma(" << an2_1 << ", pow(fabs(mcosr), " << n2_1 << "), " << bn3_1 << " * pow(fabs(msinr), " << n3_1 << "));\n"
|
||||||
<< "\t\tpr2 = " << an2_2 << " * pow(fabs(mcosp), " << n2_2 << ") + " << bn3_2 << " * pow(fabs(msinp), " << n3_2 << ");\n"
|
<< "\t\tpr2 = fma(" << an2_2 << ", pow(fabs(mcosp), " << n2_2 << "), " << bn3_2 << " * pow(fabs(msinp), " << n3_2 << "));\n"
|
||||||
<< "\t\tr1 = pow(fabs(pr1), " << n1_1 << ") + " << spiral << " * rho1;\n"
|
<< "\t\tr1 = fma(" << spiral << ", rho1, pow(fabs(pr1), " << n1_1 << "));\n"
|
||||||
<< "\t\tr2 = pow(fabs(pr2), " << n1_2 << ");\n"
|
<< "\t\tr2 = pow(fabs(pr2), " << n1_2 << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif ((int)" << toroid << " == 1)\n"
|
<< "\t\tif ((int)" << toroid << " == 1)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * cosr * (r1 + r2 * cosp);\n"
|
<< "\t\t vOut.x = " << weight << " * cosr * fma(r2, cosp, r1);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * sinr * (r1 + r2 * cosp);\n"
|
<< "\t\t vOut.y = " << weight << " * sinr * fma(r2, cosp, r1);\n"
|
||||||
<< "\t\t vOut.z = " << weight << " * r2 * sinp;\n"
|
<< "\t\t vOut.z = " << weight << " * r2 * sinp;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
@ -1908,7 +1908,7 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t t, rX, rY, rZ;\n"
|
<< "\t\treal_t t, rX, rY, rZ;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tt = Zeps(precalcSumSquares + SQR(vIn.z));\n"
|
<< "\t\tt = Zeps(fma(vIn.z, vIn.z, precalcSumSquares));\n"
|
||||||
<< "\t\trX = " << weight << " / pow(t, " << stretchX << ");\n"
|
<< "\t\trX = " << weight << " / pow(t, " << stretchX << ");\n"
|
||||||
<< "\t\trY = " << weight << " / pow(t, " << stretchY << ");\n"
|
<< "\t\trY = " << weight << " / pow(t, " << stretchY << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -2044,7 +2044,7 @@ public:
|
|||||||
ss
|
ss
|
||||||
<< "\t\tconst real_t rad = sqrt(SQR(xi) + SQR(yi));\n"
|
<< "\t\tconst real_t rad = sqrt(SQR(xi) + SQR(yi));\n"
|
||||||
<< "\t\tconst real_t ang = atan2(yi, xi);\n"
|
<< "\t\tconst real_t ang = atan2(yi, xi);\n"
|
||||||
<< "\t\tconst real_t rdc = " << radius << " + (MwcNext01(mwc) * (real_t)(0.5) * " << ca << "); \n"
|
<< "\t\tconst real_t rdc = fma(MwcNext01(mwc) * (real_t)(0.5), " << ca << ", " << radius << ");\n"
|
||||||
<< "\t\tconst real_t s = sin(ang);\n"
|
<< "\t\tconst real_t s = sin(ang);\n"
|
||||||
<< "\t\tconst real_t c = cos(ang);\n"
|
<< "\t\tconst real_t c = cos(ang);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -2062,18 +2062,18 @@ public:
|
|||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse if (cr0 && !esc)\n"
|
<< "\t\telse if (cr0 && !esc)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * xi + " << x << ";\n"
|
<< "\t\t vOut.x = fma(" << weight << ", xi, " << x << ");\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * yi + " << y << ";\n"
|
<< "\t\t vOut.y = fma(" << weight << ", yi, " << y << ");\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse if (!cr0 && esc)\n"
|
<< "\t\telse if (!cr0 && esc)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * rdc * c + " << x << ";\n"
|
<< "\t\t vOut.x = fma(" << weight << ", rdc * c, " << x << ");\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * rdc * s + " << y << ";\n"
|
<< "\t\t vOut.y = fma(" << weight << ", rdc * s, " << y << ");\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse if (!cr0 && !esc)\n"
|
<< "\t\telse if (!cr0 && !esc)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * xi + " << x << ";\n"
|
<< "\t\t vOut.x = fma(" << weight << ", xi, " << x << ");\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * yi + " << y << ";\n"
|
<< "\t\t vOut.y = fma(" << weight << ", yi, " << y << ");\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2153,11 +2153,11 @@ public:
|
|||||||
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tconst real_t z = vIn.z / " << absn << ";\n"
|
<< "\t\tconst real_t z = vIn.z / " << absn << ";\n"
|
||||||
<< "\t\tconst real_t radiusOut = " << weight << " * pow(precalcSumSquares + z * z, " << cn << ");\n"
|
<< "\t\tconst real_t radiusOut = " << weight << " * pow(fma(z, z, precalcSumSquares), " << cn << ");\n"
|
||||||
<< "\t\tconst real_t x = " << a << " * vIn.x + " << b << " * vIn.y + " << e << ";\n"
|
<< "\t\tconst real_t x = fma(" << a << ", vIn.x, fma(" << b << ", vIn.y, " << e << "));\n"
|
||||||
<< "\t\tconst real_t y = " << c << " * vIn.x + " << d << " * vIn.y + " << f << ";\n"
|
<< "\t\tconst real_t y = fma(" << c << ", vIn.x, fma(" << d << ", vIn.y, " << f << "));\n"
|
||||||
<< "\t\tconst real_t rand = (int)(MwcNext01(mwc) * " << absn << ");\n"
|
<< "\t\tconst real_t rand = (int)(MwcNext01(mwc) * " << absn << ");\n"
|
||||||
<< "\t\tconst real_t alpha = (atan2(y, x) + M_2PI * rand) / " << power << ";\n"
|
<< "\t\tconst real_t alpha = fma(M_2PI, rand, atan2(y, x)) / " << power << ";\n"
|
||||||
<< "\t\tconst real_t gamma = radiusOut * precalcSqrtSumSquares;\n"
|
<< "\t\tconst real_t gamma = radiusOut * precalcSqrtSumSquares;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = gamma * cos(alpha);\n"
|
<< "\t\tvOut.x = gamma * cos(alpha);\n"
|
||||||
@ -2312,21 +2312,21 @@ public:
|
|||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t real_t x = vIn.x - " << x << ";\n"
|
<< "\t\t real_t x = vIn.x - " << x << ";\n"
|
||||||
<< "\t\t real_t y = vIn.y + " << y << ";\n"
|
<< "\t\t real_t y = vIn.y + " << y << ";\n"
|
||||||
<< "\t\t real_t r = sqrt(SQR(x) + SQR(y));\n"
|
<< "\t\t real_t r = sqrt(fma(x, x, SQR(y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (r < " << weight << ")\n"
|
<< "\t\t if (r < " << weight << ")\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t real_t a = atan2(y, x) + " << spin << " + " << twist << " * (" << weight << " - r);\n"
|
<< "\t\t real_t a = fma(" << twist << ", " << weight << " - r, atan2(y, x) + " << spin << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t r *= " << weight << ";\n"
|
<< "\t\t r *= " << weight << ";\n"
|
||||||
<< "\t\t vOut.x = r * cos(a) + " << x << ";\n"
|
<< "\t\t vOut.x = fma(r, cos(a), " << x << ");\n"
|
||||||
<< "\t\t vOut.y = r * sin(a) - " << y << ";\n"
|
<< "\t\t vOut.y = fma(r, sin(a), -" << y << ");\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t r = " << weight << " * (1 + " << space << " / Zeps(r));\n"
|
<< "\t\t r = " << weight << " * (1 + " << space << " / Zeps(r));\n"
|
||||||
<< "\t\t vOut.x = r * x + " << x << ";\n"
|
<< "\t\t vOut.x = fma(r, x, " << x << ");\n"
|
||||||
<< "\t\t vOut.y = r * y - " << y << ";\n"
|
<< "\t\t vOut.y = fma(r, y, -" << y << ");\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
@ -2465,19 +2465,19 @@ public:
|
|||||||
<< "\t\tconst real_t z4 = " << cz << ";\n"
|
<< "\t\tconst real_t z4 = " << cz << ";\n"
|
||||||
<< "\t\tconst real_t z5 = " << dz << ";\n"
|
<< "\t\tconst real_t z5 = " << dz << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\treal_t nt = t1 * t2 - x1 * x2 - y1 * y2 + t3;\n"
|
<< "\t\treal_t nt = fma(t1, t2, -(x1 * x2)) - y1 * y2 + t3;\n"
|
||||||
<< "\t\treal_t nx = t1 * x2 + x1 * t2 - z1 * y2 + x3;\n"
|
<< "\t\treal_t nx = fma(t1, x2, x1 * t2) - z1 * y2 + x3;\n"
|
||||||
<< "\t\treal_t ny = t1 * y2 + y1 * t2 + z1 * x2 + y3;\n"
|
<< "\t\treal_t ny = fma(t1, y2, fma(y1, t2, fma(z1, x2, y3)));\n"
|
||||||
<< "\t\treal_t nz = z1 * t2 + x1 * y2 - y1 * x2 + z3;\n"
|
<< "\t\treal_t nz = fma(z1, t2, x1 * y2) - y1 * x2 + z3;\n"
|
||||||
<< "\t\treal_t dt = t4 * t2 - x4 * x2 - y4 * y2 + t5;\n"
|
<< "\t\treal_t dt = fma(t4, t2, -(x4 * x2)) - y4 * y2 + t5;\n"
|
||||||
<< "\t\treal_t dx = t4 * x2 + x4 * t2 - z4 * y2 + x5;\n"
|
<< "\t\treal_t dx = fma(t4, x2, x4 * t2) - z4 * y2 + x5;\n"
|
||||||
<< "\t\treal_t dy = t4 * y2 + y4 * t2 + z4 * x2 + y5;\n"
|
<< "\t\treal_t dy = fma(t4, y2, fma(y4, t2, fma(z4, x2, y5)));\n"
|
||||||
<< "\t\treal_t dz = z4 * t2 + x4 * y2 - y4 * x2 + z5;\n"
|
<< "\t\treal_t dz = fma(z4, t2, x4 * y2) - y4 * x2 + z5;\n"
|
||||||
<< "\t\treal_t ni = " << weight << " / (SQR(dt) + SQR(dx) + SQR(dy) + SQR(dz));\n"
|
<< "\t\treal_t ni = " << weight << " / fma(dt, dt, fma(dx, dx, fma(dy, dy, SQR(dz))));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (nt * dt + nx * dx + ny * dy + nz * dz) * ni;\n"
|
<< "\t\tvOut.x = fma(nt, dt, fma(nx, dx, fma(ny, dy, nz * dz))) * ni;\n"
|
||||||
<< "\t\tvOut.y = (nx * dt - nt * dx - ny * dz + nz * dy) * ni;\n"
|
<< "\t\tvOut.y = (fma(nx, dt, -(nt * dx)) - ny * dz + nz * dy) * ni;\n"
|
||||||
<< "\t\tvOut.z = (ny * dt - nt * dy - nz * dx + nx * dz) * ni;\n"
|
<< "\t\tvOut.z = (fma(ny, dt, -(nt * dy)) - nz * dx + nx * dz) * ni;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -2632,10 +2632,11 @@ public:
|
|||||||
string yOrigin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string yOrigin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string zOrigin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string zOrigin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = " << weight << " * (Sqr(vIn.x - " << xOrigin << ") + \n"
|
<< "\t\treal_t xmx = vIn.x - " << xOrigin << ";\n"
|
||||||
<< "\t\t Sqr(vIn.y - " << yOrigin << ") + \n"
|
<< "\t\treal_t ymy = vIn.y - " << yOrigin << ";\n"
|
||||||
<< "\t\t Sqr(vIn.z - " << zOrigin << ")) *\n"
|
<< "\t\treal_t zmz = vIn.z - " << zOrigin << ";\n"
|
||||||
<< "\t\t (MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) - 2);\n"
|
<< "\t\treal_t r = " << weight << " * (fma(xmx, xmx, fma(ymy, ymy, SQR(zmz))))\n"
|
||||||
|
<< "\t\t * (MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) - 2);\n"
|
||||||
<< "\t\treal_t u = MwcNext01(mwc) * M_2PI;\n"
|
<< "\t\treal_t u = MwcNext01(mwc) * M_2PI;\n"
|
||||||
<< "\t\treal_t su = sin(u);\n"
|
<< "\t\treal_t su = sin(u);\n"
|
||||||
<< "\t\treal_t cu = cos(u);\n"
|
<< "\t\treal_t cu = cos(u);\n"
|
||||||
@ -2727,17 +2728,17 @@ public:
|
|||||||
<< "\t\tconst real_t x = Powq4c(vIn.x, " << power << ");\n"
|
<< "\t\tconst real_t x = Powq4c(vIn.x, " << power << ");\n"
|
||||||
<< "\t\tconst real_t y = Powq4c(vIn.y, " << power << ");\n"
|
<< "\t\tconst real_t y = Powq4c(vIn.y, " << power << ");\n"
|
||||||
<< "\t\tconst real_t z = Powq4c(vIn.z, " << power << ");\n"
|
<< "\t\tconst real_t z = Powq4c(vIn.z, " << power << ");\n"
|
||||||
<< "\t\tconst real_t d = SQR(x) - SQR(y);\n"
|
<< "\t\tconst real_t d = fma(x, x, -SQR(y));\n"
|
||||||
<< "\t\tconst real_t re = Spread(" << c1 << " * x + " << c2 << " * d, " << sx << ") + (real_t)(1.0);\n"
|
<< "\t\tconst real_t re = Spread(fma(" << c1 << ", x, " << c2 << " * d), " << sx << ") + (real_t)(1.0);\n"
|
||||||
<< "\t\tconst real_t im = Spread(" << c1 << " * y + " << c2x2 << " * x * y, " << sy << ");\n"
|
<< "\t\tconst real_t im = Spread(fma(" << c1 << ", y, " << c2x2 << " * x * y), " << sy << ");\n"
|
||||||
<< "\t\treal_t c = Zeps(Powq4c(SQR(re) + SQR(im), " << powerInv << "));\n"
|
<< "\t\treal_t c = Zeps(Powq4c(fma(re, re, SQR(im)), " << powerInv << "));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tconst real_t r = " << weight << " / c;\n"
|
<< "\t\tconst real_t r = " << weight << " / c;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (x * re + y * im) * r;\n"
|
<< "\t\tvOut.x = fma(x, re, y * im) * r;\n"
|
||||||
<< "\t\tvOut.y = (y * re - x * im) * r;\n"
|
<< "\t\tvOut.y = fma(y, re, -(x * im)) * r;\n"
|
||||||
<< "\t\tvOut.z = (z * " << weight << ") / c;\n"
|
<< "\t\tvOut.z = (z * " << weight << ") / c;\n"
|
||||||
<< "\t\toutPoint->m_ColorX = clamp(outPoint->m_ColorX + " << dcAdjust << " * c, (real_t)(0.0), (real_t)(1.0));\n"
|
<< "\t\toutPoint->m_ColorX = clamp(fma(" << dcAdjust << ", c, outPoint->m_ColorX), (real_t)(0.0), (real_t)(1.0));\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -3074,17 +3075,17 @@ public:
|
|||||||
return
|
return
|
||||||
"real_t Interference2Sine(real_t a, real_t b, real_t c, real_t p, real_t x)\n"
|
"real_t Interference2Sine(real_t a, real_t b, real_t c, real_t p, real_t x)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return a * pow(fabs(sin(b * x + c)), p);\n"
|
" return a * pow(fabs(sin(fma(b, x, c))), p);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"real_t Interference2Tri(real_t a, real_t b, real_t c, real_t p, real_t x)\n"
|
"real_t Interference2Tri(real_t a, real_t b, real_t c, real_t p, real_t x)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return a * 2 * pow(fabs(asin(cos(b * x + c - MPI2))) * M1PI, p);\n"
|
" return a * 2 * pow(fabs(asin(cos(fma(b, x, c - MPI2)))) * M1PI, p);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"real_t Interference2Squ(real_t a, real_t b, real_t c, real_t p, real_t x)\n"
|
"real_t Interference2Squ(real_t a, real_t b, real_t c, real_t p, real_t x)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return a * pow(sin(b * x + c) < 0 ? EPS : 1, p);\n"
|
" return a * pow(sin(fma(b, x, c)) < 0 ? EPS : 1, p);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n";
|
"\n";
|
||||||
}
|
}
|
||||||
@ -3266,7 +3267,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
||||||
<< "\t\treal_t ni = " << weight << " / Zeps(precalcSumSquares + SQR(vIn.z));\n"
|
<< "\t\treal_t ni = " << weight << " / Zeps(fma(vIn.z, vIn.z, precalcSumSquares));\n"
|
||||||
<< "\t\treal_t s = sin(-vIn.x);\n"
|
<< "\t\treal_t s = sin(-vIn.x);\n"
|
||||||
<< "\t\treal_t c = cos(-vIn.x);\n"
|
<< "\t\treal_t c = cos(-vIn.x);\n"
|
||||||
<< "\t\treal_t sh = sinh(absV);\n"
|
<< "\t\treal_t sh = sinh(absV);\n"
|
||||||
@ -3318,7 +3319,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
||||||
<< "\t\treal_t ni = " << weight << " / Zeps(precalcSumSquares + SQR(vIn.z));\n"
|
<< "\t\treal_t ni = " << weight << " / Zeps(fma(vIn.z, vIn.z, precalcSumSquares));\n"
|
||||||
<< "\t\treal_t s = sin(absV);\n"
|
<< "\t\treal_t s = sin(absV);\n"
|
||||||
<< "\t\treal_t c = cos(absV);\n"
|
<< "\t\treal_t c = cos(absV);\n"
|
||||||
<< "\t\treal_t sh = sinh(vIn.x);\n"
|
<< "\t\treal_t sh = sinh(vIn.x);\n"
|
||||||
@ -3374,9 +3375,9 @@ public:
|
|||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n"
|
<< "\t\treal_t sysz = fma(vIn.y, vIn.y, SQR(vIn.z));\n"
|
||||||
<< "\t\treal_t absV = sqrt(sysz);\n"
|
<< "\t\treal_t absV = sqrt(sysz);\n"
|
||||||
<< "\t\treal_t ni = " << weight << " / Zeps(SQR(vIn.x) + sysz);\n"
|
<< "\t\treal_t ni = " << weight << " / Zeps(fma(vIn.x, vIn.x, sysz));\n"
|
||||||
<< "\t\treal_t s = sin(vIn.x);\n"
|
<< "\t\treal_t s = sin(vIn.x);\n"
|
||||||
<< "\t\treal_t c = cos(vIn.x);\n"
|
<< "\t\treal_t c = cos(vIn.x);\n"
|
||||||
<< "\t\treal_t sh = sinh(absV);\n"
|
<< "\t\treal_t sh = sinh(absV);\n"
|
||||||
@ -3387,9 +3388,9 @@ public:
|
|||||||
<< "\t\treal_t nstcv = -stcv;\n"
|
<< "\t\treal_t nstcv = -stcv;\n"
|
||||||
<< "\t\treal_t ctcv = c * ch;\n"
|
<< "\t\treal_t ctcv = c * ch;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (stcv * ctcv + d * b * sysz) * ni;\n"
|
<< "\t\tvOut.x = fma(stcv, ctcv, d * b * sysz) * ni;\n"
|
||||||
<< "\t\tvOut.y = (nstcv * b * vIn.y + d * vIn.y * ctcv) * ni;\n"
|
<< "\t\tvOut.y = fma(nstcv, b * vIn.y, d * vIn.y * ctcv) * ni;\n"
|
||||||
<< "\t\tvOut.z = (nstcv * b * vIn.z + d * vIn.z * ctcv) * ni;\n"
|
<< "\t\tvOut.z = fma(nstcv, b * vIn.z, d * vIn.z * ctcv) * ni;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -3436,9 +3437,9 @@ public:
|
|||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n"
|
<< "\t\treal_t sysz = fma(vIn.y, vIn.y, SQR(vIn.z));\n"
|
||||||
<< "\t\treal_t absV = sqrt(sysz);\n"
|
<< "\t\treal_t absV = sqrt(sysz);\n"
|
||||||
<< "\t\treal_t ni = " << weight << " / Zeps(SQR(vIn.x) + sysz);\n"
|
<< "\t\treal_t ni = " << weight << " / Zeps(fma(vIn.x, vIn.x, sysz));\n"
|
||||||
<< "\t\treal_t s = sin(absV);\n"
|
<< "\t\treal_t s = sin(absV);\n"
|
||||||
<< "\t\treal_t c = cos(absV);\n"
|
<< "\t\treal_t c = cos(absV);\n"
|
||||||
<< "\t\treal_t sh = sinh(vIn.x);\n"
|
<< "\t\treal_t sh = sinh(vIn.x);\n"
|
||||||
@ -3449,9 +3450,9 @@ public:
|
|||||||
<< "\t\treal_t nstcv = -stcv;\n"
|
<< "\t\treal_t nstcv = -stcv;\n"
|
||||||
<< "\t\treal_t ctcv = c * ch;\n"
|
<< "\t\treal_t ctcv = c * ch;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (stcv * ctcv + d * b * sysz) * ni;\n"
|
<< "\t\tvOut.x = fma(stcv, ctcv, d * b * sysz) * ni;\n"
|
||||||
<< "\t\tvOut.y = (nstcv * b * vIn.y + d * vIn.y * ctcv) * ni;\n"
|
<< "\t\tvOut.y = fma(nstcv, b * vIn.y, d * vIn.y * ctcv) * ni;\n"
|
||||||
<< "\t\tvOut.z = (nstcv * b * vIn.z + d * vIn.z * ctcv) * ni;\n"
|
<< "\t\tvOut.z = fma(nstcv, b * vIn.z, d * vIn.z * ctcv) * ni;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -3598,9 +3599,9 @@ public:
|
|||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n"
|
<< "\t\treal_t sysz = fma(vIn.y, vIn.y, SQR(vIn.z));\n"
|
||||||
<< "\t\treal_t absV = sqrt(sysz);\n"
|
<< "\t\treal_t absV = sqrt(sysz);\n"
|
||||||
<< "\t\treal_t ni = " << weight << " / Zeps(SQR(vIn.x) + sysz);\n"
|
<< "\t\treal_t ni = " << weight << " / Zeps(fma(vIn.x, vIn.x, sysz));\n"
|
||||||
<< "\t\treal_t s = sin(vIn.x);\n"
|
<< "\t\treal_t s = sin(vIn.x);\n"
|
||||||
<< "\t\treal_t c = cos(vIn.x);\n"
|
<< "\t\treal_t c = cos(vIn.x);\n"
|
||||||
<< "\t\treal_t sh = sinh(absV);\n"
|
<< "\t\treal_t sh = sinh(absV);\n"
|
||||||
@ -3611,9 +3612,9 @@ public:
|
|||||||
<< "\t\treal_t nstcv = -stcv;\n"
|
<< "\t\treal_t nstcv = -stcv;\n"
|
||||||
<< "\t\treal_t ctcv = c * ch;\n"
|
<< "\t\treal_t ctcv = c * ch;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (stcv * ctcv + d * b * sysz) * ni;\n"
|
<< "\t\tvOut.x = fma(stcv, ctcv, d * b * sysz) * ni;\n"
|
||||||
<< "\t\tvOut.y = -(nstcv * b * vIn.y + d * vIn.y * ctcv) * ni;\n"
|
<< "\t\tvOut.y = -fma(nstcv * b, vIn.y, d * vIn.y * ctcv) * ni;\n"
|
||||||
<< "\t\tvOut.z = -(nstcv * b * vIn.z + d * vIn.z * ctcv) * ni;\n"
|
<< "\t\tvOut.z = -fma(nstcv * b, vIn.z, d * vIn.z * ctcv) * ni;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -3660,9 +3661,9 @@ public:
|
|||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n"
|
<< "\t\treal_t sysz = fma(vIn.y, vIn.y, SQR(vIn.z));\n"
|
||||||
<< "\t\treal_t absV = sqrt(sysz);\n"
|
<< "\t\treal_t absV = sqrt(sysz);\n"
|
||||||
<< "\t\treal_t ni = " << weight << " / Zeps(Sqr(SQR(vIn.x) + sysz));\n"
|
<< "\t\treal_t ni = " << weight << " / Zeps(Sqr(fma(vIn.x, vIn.x, sysz)));\n"
|
||||||
<< "\t\treal_t s = sin(absV);\n"
|
<< "\t\treal_t s = sin(absV);\n"
|
||||||
<< "\t\treal_t c = cos(absV);\n"
|
<< "\t\treal_t c = cos(absV);\n"
|
||||||
<< "\t\treal_t sh = sinh(vIn.x);\n"
|
<< "\t\treal_t sh = sinh(vIn.x);\n"
|
||||||
@ -3673,9 +3674,9 @@ public:
|
|||||||
<< "\t\treal_t nstcv = -stcv;\n"
|
<< "\t\treal_t nstcv = -stcv;\n"
|
||||||
<< "\t\treal_t ctcv = ch * c;\n"
|
<< "\t\treal_t ctcv = ch * c;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (stcv * ctcv + d * b * sysz) * ni;\n"
|
<< "\t\tvOut.x = fma(stcv, ctcv, d * b * sysz) * ni;\n"
|
||||||
<< "\t\tvOut.y = (nstcv * b * vIn.y + d * vIn.y * ctcv) * ni;\n"
|
<< "\t\tvOut.y = fma(nstcv * b, vIn.y, d * vIn.y * ctcv) * ni;\n"
|
||||||
<< "\t\tvOut.z = (nstcv * b * vIn.z + d * vIn.z * ctcv) * ni;\n"
|
<< "\t\tvOut.z = fma(nstcv * b, vIn.z, d * vIn.z * ctcv) * ni;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -3718,7 +3719,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
||||||
<< "\t\treal_t ni = " << weight << " / Zeps(precalcSumSquares + SQR(vIn.z));\n"
|
<< "\t\treal_t ni = " << weight << " / Zeps(fma(vIn.z, vIn.z, precalcSumSquares));\n"
|
||||||
<< "\t\treal_t s = sin(vIn.x);\n"
|
<< "\t\treal_t s = sin(vIn.x);\n"
|
||||||
<< "\t\treal_t c = cos(vIn.x);\n"
|
<< "\t\treal_t c = cos(vIn.x);\n"
|
||||||
<< "\t\treal_t sh = sinh(absV);\n"
|
<< "\t\treal_t sh = sinh(absV);\n"
|
||||||
@ -3770,7 +3771,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
||||||
<< "\t\treal_t ni = " << weight << " / Zeps(precalcSumSquares + SQR(vIn.z));\n"
|
<< "\t\treal_t ni = " << weight << " / Zeps(fma(vIn.z, vIn.z, precalcSumSquares));\n"
|
||||||
<< "\t\treal_t s = sin(absV);\n"
|
<< "\t\treal_t s = sin(absV);\n"
|
||||||
<< "\t\treal_t c = cos(absV);\n"
|
<< "\t\treal_t c = cos(absV);\n"
|
||||||
<< "\t\treal_t sh = sinh(vIn.x);\n"
|
<< "\t\treal_t sh = sinh(vIn.x);\n"
|
||||||
@ -3874,7 +3875,7 @@ public:
|
|||||||
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
<< "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n"
|
||||||
<< "\t\treal_t c = " << weight << " * atan2(absV, vIn.x) / Zeps(absV);\n"
|
<< "\t\treal_t c = " << weight << " * atan2(absV, vIn.x) / Zeps(absV);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = log(SQR(vIn.x) + SQR(absV)) * " << denom << ";\n"
|
<< "\t\tvOut.x = log(fma(vIn.x, vIn.x, SQR(absV))) * " << denom << ";\n"
|
||||||
<< "\t\tvOut.y = c * vIn.y;\n"
|
<< "\t\tvOut.y = c * vIn.y;\n"
|
||||||
<< "\t\tvOut.z = c * vIn.z;\n"
|
<< "\t\tvOut.z = c * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -3992,10 +3993,10 @@ public:
|
|||||||
<< "\t\treal_t sqy = SQR(vIn.y);\n"
|
<< "\t\treal_t sqy = SQR(vIn.y);\n"
|
||||||
<< "\t\treal_t xy = vIn.x * vIn.y;\n"
|
<< "\t\treal_t xy = vIn.x * vIn.y;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = (" << q01 << " + " << weight << " * " << q02 << " * vIn.x + " << q03 << " * sqx) + \n"
|
<< "\t\tvOut.x = (" << q01 << " + fma(" << weight << ", " << q02 << " * vIn.x, " << q03 << " * sqx)) + \n"
|
||||||
<< "\t\t (" << q04 << " * xy + " << q05 << " * vIn.y + " << q06 << " * sqy);\n"
|
<< "\t\t fma(" << q04 << ", xy, fma(" << q05 << ", vIn.y, " << q06 << " * sqy));\n"
|
||||||
<< "\t\tvOut.y = (" << q07 << " + " << q08 << " * vIn.x + " << q09 << " * sqx) + \n"
|
<< "\t\tvOut.y = (" << q07 << " + fma(" << q08 << ", vIn.x, " << q09 << " * sqx)) + \n"
|
||||||
<< "\t\t (" << q10 << " * xy + " << weight << " * " << q11 << " * vIn.y + " << q12 << " * sqy);\n"
|
<< "\t\t fma(" << q10 << ", xy, fma(" << weight << ", " << q11 << " * vIn.y, " << q12 << " * sqy));\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -4329,9 +4330,9 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t xrand = xrand * " << seed2 << ";\n"
|
<< "\t\t xrand = xrand * " << seed2 << ";\n"
|
||||||
<< "\t\t yrand = yrand * " << seed2 << ";\n"
|
<< "\t\t yrand = yrand * " << seed2 << ";\n"
|
||||||
<< "\t\t niter = xrand + yrand + xrand * yrand;\n"
|
<< "\t\t niter = fma(xrand, yrand, xrand + yrand);\n"
|
||||||
<< "\t\t randInt = (niter + seed) * " << seed2 << " / 2;\n"
|
<< "\t\t randInt = (niter + seed) * " << seed2 << " / 2;\n"
|
||||||
<< "\t\t randInt = fmod((randInt * multiplier + offset), modBase);\n"
|
<< "\t\t randInt = fmod(fma(randInt, multiplier, offset), modBase);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
@ -4546,7 +4547,7 @@ public:
|
|||||||
"inline real_t GdoffsFclp(real_t a) { return ((a < 0) ? -(fmod(fabs(a), 1)) : fmod(fabs(a), 1)); }\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 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"
|
||||||
"inline real_t GdoffsFlip(real_t a, real_t b, real_t c) { return (c * (b - a) + a); }\n"
|
"inline real_t GdoffsFlip(real_t a, real_t b, real_t c) { return fma(c, (b - a), a); }\n"
|
||||||
"\n";
|
"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4626,7 +4627,10 @@ public:
|
|||||||
|
|
||||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||||
{
|
{
|
||||||
T r = m_Weight / Zeps((SQR(SQR(helper.In.x)) + SQR(helper.In.z) + SQR(SQR(helper.In.y)) + SQR(helper.In.z)));
|
T x2 = SQR(helper.In.x);
|
||||||
|
T y2 = SQR(helper.In.y);
|
||||||
|
T z2 = SQR(helper.In.z);
|
||||||
|
T r = m_Weight / Zeps(SQR(x2) + z2 + SQR(y2) + z2);
|
||||||
|
|
||||||
if (r < 2)
|
if (r < 2)
|
||||||
{
|
{
|
||||||
@ -4639,7 +4643,7 @@ public:
|
|||||||
helper.Out.x = m_Weight * helper.In.x;
|
helper.Out.x = m_Weight * helper.In.x;
|
||||||
helper.Out.y = m_Weight * helper.In.y;
|
helper.Out.y = m_Weight * helper.In.y;
|
||||||
helper.Out.z = m_Weight * helper.In.z;
|
helper.Out.z = m_Weight * helper.In.z;
|
||||||
T t = m_Weight / Zeps((std::sqrt(SQR(helper.In.x)) + std::sqrt(helper.In.z) + std::sqrt(SQR(helper.In.y)) + std::sqrt(helper.In.z)));
|
T t = m_Weight / Zeps(std::sqrt(SQR(helper.In.x)) + std::sqrt(helper.In.z) + std::sqrt(SQR(helper.In.y)) + std::sqrt(helper.In.z));
|
||||||
|
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
{
|
{
|
||||||
@ -4682,7 +4686,10 @@ public:
|
|||||||
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = " << weight << " / Zeps((SQR(SQR(vIn.x)) + SQR(vIn.z) + SQR(SQR(vIn.y)) + SQR(vIn.z)));\n"
|
<< "\t\treal_t x2 = SQR(vIn.x);\n"
|
||||||
|
<< "\t\treal_t y2 = SQR(vIn.y);\n"
|
||||||
|
<< "\t\treal_t z2 = SQR(vIn.z);\n"
|
||||||
|
<< "\t\treal_t r = " << weight << " / Zeps(fma(x2, x2, z2) + fma(y2, y2, z2));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (r < 2)\n"
|
<< "\t\tif (r < 2)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -4696,7 +4703,7 @@ public:
|
|||||||
<< "\t\t vOut.y = " << weight << " * vIn.y;\n"
|
<< "\t\t vOut.y = " << weight << " * vIn.y;\n"
|
||||||
<< "\t\t vOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\t vOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t real_t t = " << weight << " / Zeps((sqrt(SQR(vIn.x)) + sqrt(vIn.z) + sqrt(SQR(vIn.y)) + sqrt(vIn.z)));\n"
|
<< "\t\t real_t t = " << weight << " / Zeps(sqrt(SQR(vIn.x)) + sqrt(vIn.z) + sqrt(SQR(vIn.y)) + sqrt(vIn.z));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (r >= 0)\n"
|
<< "\t\t if (r >= 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
@ -4828,14 +4835,14 @@ public:
|
|||||||
<< "\t\tif (vIn.x > 0)\n"
|
<< "\t\tif (vIn.x > 0)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t c1mx = " << c1 << " - vIn.x;\n"
|
<< "\t\t c1mx = " << c1 << " - vIn.x;\n"
|
||||||
<< "\t\t r = sqrt(SQR(c1mx) + SQR(vIn.y));\n"
|
<< "\t\t r = sqrt(fma(c1mx, c1mx, SQR(vIn.y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (r <= " << r1 << ")\n"
|
<< "\t\t if (r <= " << r1 << ")\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t r *= " << r2 << " / " << r1 << ";\n"
|
<< "\t\t r *= " << r2 << " / " << r1 << ";\n"
|
||||||
<< "\t\t temp = atan2(vIn.y, c1mx);\n"
|
<< "\t\t temp = atan2(vIn.y, c1mx);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (r * cos(temp) - " << c2 << ");\n"
|
<< "\t\t vOut.x = " << weight << " * fma(r, cos(temp), -" << c2 << ");\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * r * sin(temp);\n"
|
<< "\t\t vOut.y = " << weight << " * r * sin(temp);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
@ -4847,14 +4854,14 @@ public:
|
|||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t c1mx = -" << c2 << " - vIn.x;\n"
|
<< "\t\t c1mx = -" << c2 << " - vIn.x;\n"
|
||||||
<< "\t\t r = sqrt(SQR(c1mx) + SQR(vIn.y));\n"
|
<< "\t\t r = sqrt(fma(c1mx, c1mx, SQR(vIn.y)));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (r <= " << r2 << ")\n"
|
<< "\t\t if (r <= " << r2 << ")\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t r *= " << r1 << " / " << r2 << ";\n"
|
<< "\t\t r *= " << r1 << " / " << r2 << ";\n"
|
||||||
<< "\t\t temp = atan2(vIn.y, c1mx);\n"
|
<< "\t\t temp = atan2(vIn.y, c1mx);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (r * cos(temp) + " << c1 << ");\n"
|
<< "\t\t vOut.x = " << weight << " * fma(r, cos(temp), " << c1 << ");\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * r * sin(temp);\n"
|
<< "\t\t vOut.y = " << weight << " * r * sin(temp);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
@ -4935,10 +4942,10 @@ public:
|
|||||||
string reInv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string reInv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string im100 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string im100 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t arg = precalcAtanyx + fmod((real_t)MwcNext(mwc), (real_t)(1 / " << reInv << ")) * M_2PI;\n"
|
<< "\t\treal_t arg = fma(fmod((real_t)MwcNext(mwc), (real_t)(1 / " << reInv << ")), M_2PI, precalcAtanyx);\n"
|
||||||
<< "\t\treal_t lnmod = " << dist << " * (real_t)(0.5) * log(precalcSumSquares);\n"
|
<< "\t\treal_t lnmod = " << dist << " * (real_t)(0.5) * log(precalcSumSquares);\n"
|
||||||
<< "\t\treal_t temp = arg * " << reInv << " + lnmod * " << im100 << ";\n"
|
<< "\t\treal_t temp = fma(arg, " << reInv << ", lnmod * " << im100 << ");\n"
|
||||||
<< "\t\treal_t mod2 = exp(lnmod * " << reInv << " - arg * " << im100 << ");\n"
|
<< "\t\treal_t mod2 = exp(fma(lnmod, " << reInv << ", -(arg * " << im100 << ")));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * mod2 * cos(temp);\n"
|
<< "\t\tvOut.x = " << weight << " * mod2 * cos(temp);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * mod2 * sin(temp);\n"
|
<< "\t\tvOut.y = " << weight << " * mod2 * sin(temp);\n"
|
||||||
@ -5046,7 +5053,7 @@ public:
|
|||||||
string blobWaves = "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"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r = precalcSqrtSumSquares * (" << blobLow << " + " << blobDiff << " * ((real_t)(0.5) + (real_t)(0.5) * sin(" << blobWaves << " * precalcAtanxy)));\n"
|
<< "\t\treal_t r = precalcSqrtSumSquares * fma(" << blobDiff << ", fma((real_t)(0.5), sin(" << blobWaves << " * precalcAtanxy), (real_t)(0.5)), " << blobLow << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (precalcSina * r);\n"
|
<< "\t\tvOut.x = " << weight << " * (precalcSina * r);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (precalcCosa * r);\n"
|
<< "\t\tvOut.y = " << weight << " * (precalcCosa * r);\n"
|
||||||
|
@ -20,7 +20,7 @@ public:
|
|||||||
|
|
||||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||||
{
|
{
|
||||||
T t = T(0.25) * (helper.m_PrecalcSumSquares + SQR(helper.In.z)) + 1;
|
T t = Zeps(T(0.25) * (helper.m_PrecalcSumSquares + SQR(helper.In.z)) + 1);
|
||||||
T r = m_Weight / t;
|
T r = m_Weight / t;
|
||||||
helper.Out.x = helper.In.x * r * m_X;
|
helper.Out.x = helper.In.x * r * m_X;
|
||||||
helper.Out.y = helper.In.y * r * m_Y;
|
helper.Out.y = helper.In.y * r * m_Y;
|
||||||
@ -44,7 +44,7 @@ public:
|
|||||||
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t t = (real_t)(0.25) * (precalcSumSquares + SQR(vIn.z)) + 1;\n"
|
<< "\t\treal_t t = Zeps(fma((real_t)(0.25), fma(vIn.z, vIn.z, precalcSumSquares), (real_t)(1.0)));\n"
|
||||||
<< "\t\treal_t r = " << weight << " / t;\n"
|
<< "\t\treal_t r = " << weight << " / t;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = vIn.x * r * " << x << ";\n"
|
<< "\t\tvOut.x = vIn.x * r * " << x << ";\n"
|
||||||
@ -60,6 +60,11 @@ public:
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
|
{
|
||||||
|
return vector<string> { "Zeps" };
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
@ -94,8 +99,10 @@ public:
|
|||||||
{
|
{
|
||||||
int m = int(Floor<T>(T(0.5) * helper.In.x / m_Sc));
|
int m = int(Floor<T>(T(0.5) * helper.In.x / m_Sc));
|
||||||
int n = int(Floor<T>(T(0.5) * helper.In.y / m_Sc));
|
int n = int(Floor<T>(T(0.5) * helper.In.y / m_Sc));
|
||||||
T x = helper.In.x - (m * 2 + 1) * m_Sc;
|
int m21 = m * 2 + 1;
|
||||||
T y = helper.In.y - (n * 2 + 1) * m_Sc;
|
int n21 = n * 2 + 1;
|
||||||
|
T x = helper.In.x - m21 * m_Sc;
|
||||||
|
T y = helper.In.y - n21 * m_Sc;
|
||||||
T u = Zeps(VarFuncs<T>::Hypot(x, y));
|
T u = Zeps(VarFuncs<T>::Hypot(x, y));
|
||||||
T v = (T(0.3) + T(0.7) * DiscreteNoise2(m + 10, n + 3)) * m_Sc;
|
T v = (T(0.3) + T(0.7) * DiscreteNoise2(m + 10, n + 3)) * m_Sc;
|
||||||
T z1 = DiscreteNoise2(int(m + m_Seed), n);
|
T z1 = DiscreteNoise2(int(m + m_Seed), n);
|
||||||
@ -132,8 +139,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.Out.x = m_Weight * (x + (m * 2 + 1) * m_Sc);
|
helper.Out.x = m_Weight * (x + m21 * m_Sc);
|
||||||
helper.Out.y = m_Weight * (y + (n * 2 + 1) * m_Sc);
|
helper.Out.y = m_Weight * (y + n21 * m_Sc);
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,10 +162,12 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tint m = (int)floor((real_t)(0.5) * vIn.x / " << sc << ");\n"
|
<< "\t\tint m = (int)floor((real_t)(0.5) * vIn.x / " << sc << ");\n"
|
||||||
<< "\t\tint n = (int)floor((real_t)(0.5) * vIn.y / " << sc << ");\n"
|
<< "\t\tint n = (int)floor((real_t)(0.5) * vIn.y / " << sc << ");\n"
|
||||||
<< "\t\treal_t x = vIn.x - (m * 2 + 1) * " << sc << ";\n"
|
<< "\t\tint m21 = m * 2 + 1;\n"
|
||||||
<< "\t\treal_t y = vIn.y - (n * 2 + 1) * " << sc << ";\n"
|
<< "\t\tint n21 = n * 2 + 1;\n"
|
||||||
|
<< "\t\treal_t x = vIn.x - m21 * " << sc << ";\n"
|
||||||
|
<< "\t\treal_t y = vIn.y - n21 * " << sc << ";\n"
|
||||||
<< "\t\treal_t u = Zeps(Hypot(x, y));\n"
|
<< "\t\treal_t u = Zeps(Hypot(x, y));\n"
|
||||||
<< "\t\treal_t v = ((real_t)(0.3) + (real_t)(0.7) * CircleLinearDiscreteNoise2(m + 10, n + 3)) * " << sc << ";\n"
|
<< "\t\treal_t v = fma(CircleLinearDiscreteNoise2(m + 10, n + 3), (real_t)(0.7), (real_t)(0.3)) * " << sc << ";\n"
|
||||||
<< "\t\treal_t z1 = CircleLinearDiscreteNoise2((int)(m + " << seed << "), n);\n"
|
<< "\t\treal_t z1 = CircleLinearDiscreteNoise2((int)(m + " << seed << "), n);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif ((z1 < " << dens1 << ") && (u < v))\n"
|
<< "\t\tif ((z1 < " << dens1 << ") && (u < v))\n"
|
||||||
@ -172,7 +181,7 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t real_t z = v / u * (1 - " << k << ") + " << k << ";\n"
|
<< "\t\t real_t z = fma(v / u, (1 - " << k << "), " << k << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t x *= z;\n"
|
<< "\t\t x *= z;\n"
|
||||||
<< "\t\t y *= z;\n"
|
<< "\t\t y *= z;\n"
|
||||||
@ -187,7 +196,7 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t real_t z = v / u * (1 - " << k << ") + " << k << ";\n"
|
<< "\t\t real_t z = fma(v / u, (1 - " << k << "), " << k << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t x *= z;\n"
|
<< "\t\t x *= z;\n"
|
||||||
<< "\t\t y *= z;\n"
|
<< "\t\t y *= z;\n"
|
||||||
@ -195,8 +204,8 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (x + (m * 2 + 1) * " << sc << ");\n"
|
<< "\t\tvOut.x = " << weight << " * fma((real_t)m21, " << sc << ", x);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (y + (n * 2 + 1) * " << sc << ");\n"
|
<< "\t\tvOut.y = " << weight << " * fma((real_t)n21, " << sc << ", y);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -326,10 +335,10 @@ public:
|
|||||||
<< "\t\t if (++iters > 10)\n"
|
<< "\t\t if (++iters > 10)\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\twhile ((CircleRandDiscreteNoise2((int)(m + " << seed << "), n) > " << dens << ") || (u > ((real_t)(0.3) + (real_t)(0.7) * CircleRandDiscreteNoise2(m + 10, n + 3)) * " << sc << "));\n"
|
<< "\t\twhile ((CircleRandDiscreteNoise2((int)(m + " << seed << "), n) > " << dens << ") || (u > fma(CircleRandDiscreteNoise2(m + 10, n + 3), (real_t)(0.7), (real_t)(0.3)) * " << sc << "));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (x + (m * 2 + 1) * " << sc << ");\n"
|
<< "\t\tvOut.x = " << weight << " * fma((real_t)(m * 2 + 1), " << sc << ", x);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (y + (n * 2 + 1) * " << sc << ");\n"
|
<< "\t\tvOut.y = " << weight << " * fma((real_t)(n * 2 + 1), " << sc << ", y);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -448,7 +457,7 @@ public:
|
|||||||
<< "\t\ty = uy - (n * 2 + 1) * " << sc << ";\n"
|
<< "\t\ty = uy - (n * 2 + 1) * " << sc << ";\n"
|
||||||
<< "\t\tu = Hypot(x, y);\n"
|
<< "\t\tu = Hypot(x, y);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif ((CircleTrans1DiscreteNoise2((int)(m + " << seed << "), n) > " << dens << ") || (u > ((real_t)(0.3) + (real_t)(0.7) * CircleTrans1DiscreteNoise2(m + 10, n + 3)) * " << sc << "))\n"
|
<< "\t\tif ((CircleTrans1DiscreteNoise2((int)(m + " << seed << "), n) > " << dens << ") || (u > fma(CircleTrans1DiscreteNoise2(m + 10, n + 3), (real_t)(0.7), (real_t)(0.3)) * " << sc << "))\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t ux = ux;\n"
|
<< "\t\t ux = ux;\n"
|
||||||
<< "\t\t uy = uy;\n"
|
<< "\t\t uy = uy;\n"
|
||||||
@ -480,8 +489,8 @@ public:
|
|||||||
"\n"
|
"\n"
|
||||||
"void CircleTrans1Trans(real_t a, real_t b, real_t x, real_t y, real_t* x1, real_t* y1)\n"
|
"void CircleTrans1Trans(real_t a, real_t b, real_t x, real_t y, real_t* x1, real_t* y1)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" *x1 = (x - a) * (real_t)(0.5) + a;\n"
|
" *x1 = fma((x - a), (real_t)(0.5), a);\n"
|
||||||
" *y1 = (y - b) * (real_t)(0.5) + b;\n"
|
" *y1 = fma((y - b), (real_t)(0.5), b);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"void CircleTrans1CircleR(real_t mx, real_t my, real_t sc, real_t seed, real_t dens, real_t* ux, real_t* vy, uint2* mwc)\n"
|
"void CircleTrans1CircleR(real_t mx, real_t my, real_t sc, real_t seed, real_t dens, real_t* ux, real_t* vy, uint2* mwc)\n"
|
||||||
@ -496,7 +505,7 @@ public:
|
|||||||
" m = (int)floor((real_t)(0.5) * x / sc);\n"
|
" m = (int)floor((real_t)(0.5) * x / sc);\n"
|
||||||
" n = (int)floor((real_t)(0.5) * y / sc);\n"
|
" n = (int)floor((real_t)(0.5) * y / sc);\n"
|
||||||
" alpha = M_2PI * MwcNext01(mwc);\n"
|
" alpha = M_2PI * MwcNext01(mwc);\n"
|
||||||
" u = (real_t)(0.3) + (real_t)(0.7) * CircleTrans1DiscreteNoise2(m + 10, n + 3);\n"
|
" u = fma(CircleTrans1DiscreteNoise2(m + 10, n + 3), (real_t)(0.7), (real_t)(0.3));\n"
|
||||||
" x = u * cos(alpha);\n"
|
" x = u * cos(alpha);\n"
|
||||||
" y = u * sin(alpha);\n"
|
" y = u * sin(alpha);\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -505,8 +514,8 @@ public:
|
|||||||
" }\n"
|
" }\n"
|
||||||
" while (CircleTrans1DiscreteNoise2((int)(m + seed), n) > dens);\n"
|
" while (CircleTrans1DiscreteNoise2((int)(m + seed), n) > dens);\n"
|
||||||
"\n"
|
"\n"
|
||||||
" *ux = x + (m * 2 + 1) * sc;\n"
|
" *ux = fma((real_t)(m * 2 + 1), sc, x);\n"
|
||||||
" *vy = y + (n * 2 + 1) * sc;\n"
|
" *vy = fma((real_t)(n * 2 + 1), sc, y);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n";
|
"\n";
|
||||||
}
|
}
|
||||||
@ -960,44 +969,44 @@ public:
|
|||||||
<< "\t\tswitch (useNode)\n"
|
<< "\t\tswitch (useNode)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t case 0 :\n"
|
<< "\t\t case 0 :\n"
|
||||||
<< "\t\t vOut.x = pxtx * " << fill << " * exnze + lattd;\n"
|
<< "\t\t vOut.x = fma(pxtx, " << fill << " * exnze, lattd);\n"
|
||||||
<< "\t\t vOut.y = pyty * " << fill << " * wynze + lattd;\n"
|
<< "\t\t vOut.y = fma(pyty, " << fill << " * wynze, lattd);\n"
|
||||||
<< "\t\t vOut.z = pztz * " << fill << " * znxy + lattd;\n"
|
<< "\t\t vOut.z = fma(pztz, " << fill << " * znxy , lattd);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 1 :\n"
|
<< "\t\t case 1 :\n"
|
||||||
<< "\t\t vOut.x = pxtx * " << fill << " * exnze + lattd;\n"
|
<< "\t\t vOut.x = fma(pxtx, " << fill << " * exnze, lattd);\n"
|
||||||
<< "\t\t vOut.y = pyty * " << fill << " * wynze - lattd;\n"
|
<< "\t\t vOut.y = fma(pyty, " << fill << " * wynze, -lattd);\n"
|
||||||
<< "\t\t vOut.z = pztz * " << fill << " * znxy + lattd;\n"
|
<< "\t\t vOut.z = fma(pztz, " << fill << " * znxy, lattd);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 2 :\n"
|
<< "\t\t case 2 :\n"
|
||||||
<< "\t\t vOut.x = pxtx * " << fill << " * exnze + lattd;\n"
|
<< "\t\t vOut.x = fma(pxtx, " << fill << " * exnze, lattd);\n"
|
||||||
<< "\t\t vOut.y = pyty * " << fill << " * wynze + lattd;\n"
|
<< "\t\t vOut.y = fma(pyty, " << fill << " * wynze, lattd);\n"
|
||||||
<< "\t\t vOut.z = pztz * " << fill << " * znxy - lattd;\n"
|
<< "\t\t vOut.z = fma(pztz, " << fill << " * znxy, -lattd);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 3 :\n"
|
<< "\t\t case 3 :\n"
|
||||||
<< "\t\t vOut.x = pxtx * " << fill << " * exnze + lattd;\n"
|
<< "\t\t vOut.x = fma(pxtx, " << fill << " * exnze, lattd);\n"
|
||||||
<< "\t\t vOut.y = pyty * " << fill << " * wynze - lattd;\n"
|
<< "\t\t vOut.y = fma(pyty, " << fill << " * wynze, -lattd);\n"
|
||||||
<< "\t\t vOut.z = pztz * " << fill << " * znxy - lattd;\n"
|
<< "\t\t vOut.z = fma(pztz, " << fill << " * znxy, -lattd);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 4 :\n"
|
<< "\t\t case 4 :\n"
|
||||||
<< "\t\t vOut.x = pxtx * " << fill << " * exnze - lattd;\n"
|
<< "\t\t vOut.x = fma(pxtx, " << fill << " * exnze, -lattd);\n"
|
||||||
<< "\t\t vOut.y = pyty * " << fill << " * wynze + lattd;\n"
|
<< "\t\t vOut.y = fma(pyty, " << fill << " * wynze, lattd);\n"
|
||||||
<< "\t\t vOut.z = pztz * " << fill << " * znxy + lattd;\n"
|
<< "\t\t vOut.z = fma(pztz, " << fill << " * znxy, lattd);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 5 :\n"
|
<< "\t\t case 5 :\n"
|
||||||
<< "\t\t vOut.x = pxtx * " << fill << " * exnze - lattd;\n"
|
<< "\t\t vOut.x = fma(pxtx, " << fill << " * exnze, -lattd);\n"
|
||||||
<< "\t\t vOut.y = pyty * " << fill << " * wynze - lattd;\n"
|
<< "\t\t vOut.y = fma(pyty, " << fill << " * wynze, -lattd);\n"
|
||||||
<< "\t\t vOut.z = pztz * " << fill << " * znxy + lattd;\n"
|
<< "\t\t vOut.z = fma(pztz, " << fill << " * znxy, lattd);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 6 :\n"
|
<< "\t\t case 6 :\n"
|
||||||
<< "\t\t vOut.x = pxtx * " << fill << " * exnze - lattd;\n"
|
<< "\t\t vOut.x = fma(pxtx, " << fill << " * exnze, -lattd);\n"
|
||||||
<< "\t\t vOut.y = pyty * " << fill << " * wynze + lattd;\n"
|
<< "\t\t vOut.y = fma(pyty, " << fill << " * wynze, lattd);\n"
|
||||||
<< "\t\t vOut.z = pztz * " << fill << " * znxy - lattd;\n"
|
<< "\t\t vOut.z = fma(pztz, " << fill << " * znxy, -lattd);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 7 :\n"
|
<< "\t\t case 7 :\n"
|
||||||
<< "\t\t vOut.x = pxtx * " << fill << " * exnze - lattd;\n"
|
<< "\t\t vOut.x = fma(pxtx, " << fill << " * exnze, -lattd);\n"
|
||||||
<< "\t\t vOut.y = pyty * " << fill << " * wynze - lattd;\n"
|
<< "\t\t vOut.y = fma(pyty, " << fill << " * wynze, -lattd);\n"
|
||||||
<< "\t\t vOut.z = pztz * " << fill << " * znxy - lattd;\n"
|
<< "\t\t vOut.z = fma(pztz, " << fill << " * znxy, -lattd);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -1131,9 +1140,9 @@ public:
|
|||||||
<< "\t\treal_t cv = cos(vIn.y);\n"
|
<< "\t\treal_t cv = cos(vIn.y);\n"
|
||||||
<< "\t\treal_t cucv = cu * cv;\n"
|
<< "\t\treal_t cucv = cu * cv;\n"
|
||||||
<< "\t\treal_t sucv = su * cv;\n"
|
<< "\t\treal_t sucv = su * cv;\n"
|
||||||
<< "\t\treal_t x = pow(fabs(cucv), " << xpow << ") + (cucv * " << xpow << ") + ((real_t)(0.25) * atOmegaX);\n"
|
<< "\t\treal_t x = pow(fabs(cucv), " << xpow << ") + fma(cucv, " << xpow << ", (real_t)(0.25) * atOmegaX);\n"
|
||||||
<< "\t\treal_t y = pow(fabs(sucv), " << ypow << ") + (sucv * " << ypow << ") + ((real_t)(0.25) * atOmegaY);\n"
|
<< "\t\treal_t y = pow(fabs(sucv), " << ypow << ") + fma(sucv, " << ypow << ", (real_t)(0.25) * atOmegaY);\n"
|
||||||
<< "\t\treal_t z = pow(fabs(sv), " << zpow << ") + sv * " << zpow << ";\n"
|
<< "\t\treal_t z = fma(sv, " << zpow << ", pow(fabs(sv), " << zpow << "));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * x;\n"
|
<< "\t\tvOut.x = " << weight << " * x;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * y;\n"
|
<< "\t\tvOut.y = " << weight << " * y;\n"
|
||||||
@ -1200,12 +1209,12 @@ public:
|
|||||||
string halfInvPower = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string halfInvPower = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string invPower2pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string invPower2pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t temp = precalcAtanyx * " << invPower << " + MwcNext(mwc) * " << invPower2pi << ";\n"
|
<< "\t\treal_t temp = fma(precalcAtanyx, " << invPower << ", MwcNext(mwc) * " << invPower2pi << ");\n"
|
||||||
<< "\t\treal_t sina = sin(temp);\n"
|
<< "\t\treal_t sina = sin(temp);\n"
|
||||||
<< "\t\treal_t cosa = cos(temp);\n"
|
<< "\t\treal_t cosa = cos(temp);\n"
|
||||||
<< "\t\treal_t z = vIn.z * " << absInvPower << ";\n"
|
<< "\t\treal_t z = vIn.z * " << absInvPower << ";\n"
|
||||||
<< "\t\treal_t r2d = precalcSumSquares;\n"
|
<< "\t\treal_t r2d = precalcSumSquares;\n"
|
||||||
<< "\t\treal_t r = " << weight << " * pow(r2d + SQR(z), " << halfInvPower << ");\n"
|
<< "\t\treal_t r = " << weight << " * pow(fma(z, z, r2d), " << halfInvPower << ");\n"
|
||||||
<< "\t\treal_t rsss = r * precalcSqrtSumSquares;\n"
|
<< "\t\treal_t rsss = r * precalcSqrtSumSquares;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = rsss * cosa;\n"
|
<< "\t\tvOut.x = rsss * cosa;\n"
|
||||||
@ -1399,19 +1408,19 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tint i;\n"
|
<< "\t\tint i;\n"
|
||||||
<< "\t\treal_t xrt = vIn.x, yrt = vIn.y, swp;\n"
|
<< "\t\treal_t xrt = vIn.x, yrt = vIn.y, swp;\n"
|
||||||
<< "\t\treal_t r2 = xrt * " << coss << " + fabs(yrt) * " << sins << ";\n"
|
<< "\t\treal_t r2 = fma(xrt, " << coss << ", fabs(yrt) * " << sins << ");\n"
|
||||||
<< "\t\treal_t circle = precalcSqrtSumSquares;\n"
|
<< "\t\treal_t circle = precalcSqrtSumSquares;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tfor (i = 0; i < " << sides << " - 1; i++)\n"
|
<< "\t\tfor (i = 0; i < " << sides << " - 1; i++)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t swp = xrt * " << cosa << " - yrt * " << sina << ";\n"
|
<< "\t\t swp = fma(xrt, " << cosa << ", -(yrt * " << sina << "));\n"
|
||||||
<< "\t\t yrt = xrt * " << sina << " + yrt * " << cosa << ";\n"
|
<< "\t\t yrt = fma(xrt, " << sina << ", yrt * " << cosa << ");\n"
|
||||||
<< "\t\t xrt = swp;\n"
|
<< "\t\t xrt = swp;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t r2 = max(r2, xrt * " << coss << " + fabs(yrt) * " << sins << ");\n"
|
<< "\t\t r2 = max(r2, fma(xrt, " << coss << ", fabs(yrt) * " << sins << "));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tr2 = r2 * " << cosc << " + circle * " << sinc << ";\n"
|
<< "\t\tr2 = fma(r2, " << cosc << ", circle * " << sinc << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (i > 1)\n"
|
<< "\t\tif (i > 1)\n"
|
||||||
<< "\t\t r2 = SQR(r2);\n"
|
<< "\t\t r2 = SQR(r2);\n"
|
||||||
@ -1619,7 +1628,7 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t kikr = precalcAtanyx;\n"
|
<< "\t\treal_t kikr = precalcAtanyx;\n"
|
||||||
<< "\t\treal_t efTez = vIn.z == 0 ? kikr : vIn.z;\n"
|
<< "\t\treal_t efTez = vIn.z == 0 ? kikr : vIn.z;\n"
|
||||||
<< "\t\treal_t r2 = precalcSumSquares + SQR(efTez);\n"
|
<< "\t\treal_t r2 = fma(efTez, efTez, precalcSumSquares);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (r2 < " << vv << ")\n"
|
<< "\t\tif (r2 < " << vv << ")\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -1693,7 +1702,7 @@ public:
|
|||||||
string twist = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string twist = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string tilt = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string tilt = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t t = precalcSumSquares * (real_t)(0.25) + 1;\n"
|
<< "\t\treal_t t = fma(precalcSumSquares, (real_t)(0.25), (real_t)(1.0));\n"
|
||||||
<< "\t\treal_t r = " << weight << " / t;\n"
|
<< "\t\treal_t r = " << weight << " / t;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = vIn.x * r * " << x << ";\n"
|
<< "\t\tvOut.x = vIn.x * r * " << x << ";\n"
|
||||||
@ -1760,9 +1769,9 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t avgxy = (vIn.x + vIn.y) * (real_t)(0.5);\n"
|
<< "\t\treal_t avgxy = (vIn.x + vIn.y) * (real_t)(0.5);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x + " << scale << " * sin(vIn.y * " << freq << "));\n"
|
<< "\t\tvOut.x = " << weight << " * fma(" << scale << ", sin(vIn.y * " << freq << "), vIn.x);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (vIn.y + " << scale << " * sin(vIn.x * " << freq << "));\n"
|
<< "\t\tvOut.y = " << weight << " * fma(" << scale << ", sin(vIn.x * " << freq << "), vIn.y);\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * (vIn.z + " << scale << " * sin(avgxy * " << freq << "));\n"
|
<< "\t\tvOut.z = " << weight << " * fma(" << scale << ", sin(avgxy * " << freq << "), vIn.z);\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -1816,8 +1825,8 @@ public:
|
|||||||
string rotation = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string rotation = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string thickness = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string thickness = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tint sl = (int)(MwcNext01(mwc) * " << slices << " + (real_t)(0.5));\n"
|
<< "\t\tint sl = (int)fma(MwcNext01(mwc), " << slices << ", (real_t)(0.5));\n"
|
||||||
<< "\t\treal_t a = " << rotation << " + M_2PI * (sl + MwcNext01(mwc) * " << thickness << ") / " << slices << ";\n"
|
<< "\t\treal_t a = fma(M_2PI, fma(MwcNext01(mwc), " << thickness << ", (real_t)(sl)) / " << slices << ", " << rotation << ");\n"
|
||||||
<< "\t\treal_t r = " << weight << " * MwcNext01(mwc);\n"
|
<< "\t\treal_t r = " << weight << " * MwcNext01(mwc);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = r * cos(a);\n"
|
<< "\t\tvOut.x = r * cos(a);\n"
|
||||||
@ -1908,9 +1917,9 @@ public:
|
|||||||
ss << "\t\tif (otherZ == 0)\n"
|
ss << "\t\tif (otherZ == 0)\n"
|
||||||
<< "\t\t tempPZ = " << vv << " * " << stc << " * precalcAtanyx;\n"
|
<< "\t\t tempPZ = " << vv << " * " << stc << " * precalcAtanyx;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << hw << " * (vIn.x + " << x << " * sin(tan(" << c << " * vIn.y)));\n"
|
<< "\t\tvOut.x = " << hw << " * fma(" << x << ", sin(tan(" << c << " * vIn.y)), vIn.x);\n"
|
||||||
<< "\t\tvOut.y = " << hw << " * (vIn.y + " << y << " * sin(tan(" << c << " * vIn.x)));\n"
|
<< "\t\tvOut.y = " << hw << " * fma(" << y << ", sin(tan(" << c << " * vIn.x)), vIn.y);\n"
|
||||||
<< "\t\tvOut.z = tempPZ + " << vv << " * (" << z << " * " << stc << " * tempTZ);\n"
|
<< "\t\tvOut.z = fma(" << vv << ", (" << z << " * " << stc << " * tempTZ), tempPZ);\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -2028,7 +2037,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
string invWeight = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string invWeight = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t t = precalcSumSquares + SQR(vIn.z);\n"
|
<< "\t\treal_t t = fma(vIn.z, vIn.z, precalcSumSquares);\n"
|
||||||
<< "\t\treal_t r = 1 / Zeps(sqrt(t) * (t + " << invWeight << "));\n"
|
<< "\t\treal_t r = 1 / Zeps(sqrt(t) * (t + " << invWeight << "));\n"
|
||||||
<< "\t\treal_t z = vIn.z == 0 ? precalcAtanyx : vIn.z;\n"
|
<< "\t\treal_t z = vIn.z == 0 ? precalcAtanyx : vIn.z;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -2107,8 +2116,8 @@ public:
|
|||||||
<< "\t\tconst real_t xrng = vIn.x / " << xdist << ";\n"
|
<< "\t\tconst real_t xrng = vIn.x / " << xdist << ";\n"
|
||||||
<< "\t\tconst real_t yrng = vIn.y / " << ydist << ";\n"
|
<< "\t\tconst real_t yrng = vIn.y / " << ydist << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << xw << " * ((xrng - (int)xrng) * " << xwidth << " + (int)xrng + ((real_t)(0.5) - xpos) * " << onemx << ");\n"
|
<< "\t\tvOut.x = " << xw << " * fma((xrng - (int)xrng), " << xwidth << ", (int)xrng + ((real_t)(0.5) - xpos) * " << onemx << ");\n"
|
||||||
<< "\t\tvOut.y = " << yw << " * ((yrng - (int)yrng) * " << ywidth << " + (int)yrng + ((real_t)(0.5) - ypos) * " << onemy << ");\n"
|
<< "\t\tvOut.y = " << yw << " * fma((yrng - (int)yrng), " << ywidth << ", (int)yrng + ((real_t)(0.5) - ypos) * " << onemy << ");\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -2224,7 +2233,7 @@ public:
|
|||||||
string px = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string px = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string py = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string py = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t b = " << weight << " / (precalcSumSquares * (real_t)(0.25) + 1);\n"
|
<< "\t\treal_t b = " << weight << " / fma(precalcSumSquares, (real_t)(0.25), (real_t)(1.0));\n"
|
||||||
<< "\t\treal_t roundX = rint(vIn.x);\n"
|
<< "\t\treal_t roundX = rint(vIn.x);\n"
|
||||||
<< "\t\treal_t roundY = rint(vIn.y);\n"
|
<< "\t\treal_t roundY = rint(vIn.y);\n"
|
||||||
<< "\t\treal_t offsetX = vIn.x - roundX;\n"
|
<< "\t\treal_t offsetX = vIn.x - roundX;\n"
|
||||||
@ -2235,8 +2244,8 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (MwcNext01(mwc) >= (real_t)(0.75))\n"
|
<< "\t\tif (MwcNext01(mwc) >= (real_t)(0.75))\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.x += " << weight << " * (offsetX * (real_t)(0.5) + roundX);\n"
|
<< "\t\t vOut.x += " << weight << " * fma(offsetX, (real_t)(0.5), roundX);\n"
|
||||||
<< "\t\t vOut.y += " << weight << " * (offsetY * (real_t)(0.5) + roundY);\n"
|
<< "\t\t vOut.y += " << weight << " * fma(offsetY, (real_t)(0.5), roundY);\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -2244,26 +2253,26 @@ public:
|
|||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t if (offsetX >= 0)\n"
|
<< "\t\t if (offsetX >= 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x += " << weight << " * (offsetX * (real_t)(0.5) + roundX + " << x << ");\n"
|
<< "\t\t vOut.x += " << weight << " * fma(offsetX, (real_t)(0.5), roundX + " << x << ");\n"
|
||||||
<< "\t\t vOut.y += " << weight << " * (offsetY * (real_t)(0.5) + roundY + " << y << " * offsetY / Zeps(offsetX));\n"
|
<< "\t\t vOut.y += " << weight << " * fma(offsetY, (real_t)(0.5), fma(" << y << ", offsetY / Zeps(offsetX), roundY));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x += " << weight << " * (offsetX * (real_t)(0.5) + roundX - " << y << ");\n"
|
<< "\t\t vOut.x += " << weight << " * fma(offsetX, (real_t)(0.5), roundX - " << y << ");\n"
|
||||||
<< "\t\t vOut.y += " << weight << " * (offsetY * (real_t)(0.5) + roundY - " << y << " * offsetY / Zeps(offsetX));\n"
|
<< "\t\t vOut.y += " << weight << " * fma(offsetY, (real_t)(0.5), roundY - " << y << " * offsetY / Zeps(offsetX));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t if (offsetY >= 0)\n"
|
<< "\t\t if (offsetY >= 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.y += " << weight << " * (offsetY * (real_t)(0.5) + roundY + " << y << ");\n"
|
<< "\t\t vOut.y += " << weight << " * fma(offsetY, (real_t)(0.5), roundY + " << y << ");\n"
|
||||||
<< "\t\t vOut.x += " << weight << " * (offsetX * (real_t)(0.5) + roundX + offsetX / Zeps(offsetY) * " << y << ");\n"
|
<< "\t\t vOut.x += " << weight << " * fma(offsetX, (real_t)(0.5), roundX + offsetX / Zeps(offsetY) * " << y << ");\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.y += " << weight << " * (offsetY * (real_t)(0.5) + roundY - " << y << ");\n"
|
<< "\t\t vOut.y += " << weight << " * fma(offsetY, (real_t)(0.5), roundY - " << y << ");\n"
|
||||||
<< "\t\t vOut.x += " << weight << " * (offsetX * (real_t)(0.5) + roundX - offsetX / Zeps(offsetY) * " << x << ");\n"
|
<< "\t\t vOut.x += " << weight << " * fma(offsetX, (real_t)(0.5), roundX - offsetX / Zeps(offsetY) * " << x << ");\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -2376,9 +2385,9 @@ public:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 1://Radial.
|
case 1://Radial.
|
||||||
sigma = std::asin(r == 0 ? 0 : helper.In.z / r) + m_MulZ * az * rs;
|
|
||||||
phi = helper.m_PrecalcAtanyx + m_MulY * ay * rs;
|
|
||||||
rad = r + m_MulX * ax * rs;
|
rad = r + m_MulX * ax * rs;
|
||||||
|
phi = helper.m_PrecalcAtanyx + m_MulY * ay * rs;
|
||||||
|
sigma = std::asin(r == 0 ? 0 : helper.In.z / r) + m_MulZ * az * rs;
|
||||||
sigmas = std::sin(sigma);
|
sigmas = std::sin(sigma);
|
||||||
sigmac = std::cos(sigma);
|
sigmac = std::cos(sigma);
|
||||||
phis = std::sin(phi);
|
phis = std::sin(phi);
|
||||||
@ -2422,7 +2431,10 @@ public:
|
|||||||
<< "\t\tconst real_t ax = MwcNext0505(mwc);\n"
|
<< "\t\tconst real_t ax = MwcNext0505(mwc);\n"
|
||||||
<< "\t\tconst real_t ay = MwcNext0505(mwc);\n"
|
<< "\t\tconst real_t ay = MwcNext0505(mwc);\n"
|
||||||
<< "\t\tconst real_t az = MwcNext0505(mwc);\n"
|
<< "\t\tconst real_t az = MwcNext0505(mwc);\n"
|
||||||
<< "\t\tconst real_t r = sqrt(Sqr(vIn.x - " << x0 << ") + Sqr(vIn.y - " << y0 << ") + Sqr(vIn.z - " << z0 << "));\n"
|
<< "\t\tconst real_t xmx = vIn.x - " << x0 << ";\n"
|
||||||
|
<< "\t\tconst real_t ymy = vIn.y - " << y0 << ";\n"
|
||||||
|
<< "\t\tconst real_t zmz = vIn.z - " << z0 << ";\n"
|
||||||
|
<< "\t\tconst real_t r = sqrt(fma(xmx, xmx, fma(ymy, ymy, SQR(zmz))));\n"
|
||||||
<< "\t\tconst real_t rc = ((" << invert << " != 0 ? max(1 - r, (real_t)(0.0)) : max(r, (real_t)(0.0))) - " << minDist << ") * " << internalScatter << ";\n"
|
<< "\t\tconst real_t rc = ((" << invert << " != 0 ? max(1 - r, (real_t)(0.0)) : max(r, (real_t)(0.0))) - " << minDist << ") * " << internalScatter << ";\n"
|
||||||
<< "\t\tconst real_t rs = max(rc, (real_t)(0.0));\n"
|
<< "\t\tconst real_t rs = max(rc, (real_t)(0.0));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -2432,14 +2444,14 @@ public:
|
|||||||
<< "\t\tswitch ((int)" << type << ")\n"
|
<< "\t\tswitch ((int)" << type << ")\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t case 0:\n"
|
<< "\t\t case 0:\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (vIn.x + " << mulX << " * ax * rs);\n"
|
<< "\t\t vOut.x = " << weight << " * fma(" << mulX << ", ax * rs, vIn.x);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (vIn.y + " << mulY << " * ay * rs);\n"
|
<< "\t\t vOut.y = " << weight << " * fma(" << mulY << ", ay * rs, vIn.y);\n"
|
||||||
<< "\t\t vOut.z = " << weight << " * (vIn.z + " << mulZ << " * az * rs);\n"
|
<< "\t\t vOut.z = " << weight << " * fma(" << mulZ << ", az * rs, vIn.z);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 1:\n"
|
<< "\t\t case 1:\n"
|
||||||
<< "\t\t sigma = asin(r == 0 ? 0 : vIn.z / r) + " << mulZ << " * az * rs;\n"
|
<< "\t\t rad = fma(" << mulX << ", ax * rs, r);\n"
|
||||||
<< "\t\t phi = precalcAtanyx + " << mulY << " * ay * rs;\n"
|
<< "\t\t phi = fma(" << mulY << ", ay * rs, precalcAtanyx);\n"
|
||||||
<< "\t\t rad = r + " << mulX << " * ax * rs;\n"
|
<< "\t\t sigma = fma(" << mulZ << ", az * rs, asin(r == 0 ? 0 : vIn.z / r));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t sigmas = sin(sigma);\n"
|
<< "\t\t sigmas = sin(sigma);\n"
|
||||||
<< "\t\t sigmac = cos(sigma);\n"
|
<< "\t\t sigmac = cos(sigma);\n"
|
||||||
@ -2453,9 +2465,9 @@ public:
|
|||||||
<< "\t\t case 2:\n"
|
<< "\t\t case 2:\n"
|
||||||
<< "\t\t scale = clamp(rs, (real_t)(0.0), (real_t)(0.9)) + (real_t)(0.1);\n"
|
<< "\t\t scale = clamp(rs, (real_t)(0.0), (real_t)(0.9)) + (real_t)(0.1);\n"
|
||||||
<< "\t\t denom = 1 / scale;\n"
|
<< "\t\t denom = 1 / scale;\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * Lerp(vIn.x, floor(vIn.x * denom) + scale * ax, " << mulX << " * rs) + " << mulX << " * pow(ax, " << boxPow << ") * rs * denom;\n"
|
<< "\t\t vOut.x = fma(" << weight << ", Lerp(vIn.x, fma(scale, ax, floor(vIn.x * denom)), " << mulX << " * rs), " << mulX << " * pow(ax, " << boxPow << ") * rs * denom);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * Lerp(vIn.y, floor(vIn.y * denom) + scale * ay, " << mulY << " * rs) + " << mulY << " * pow(ay, " << boxPow << ") * rs * denom;\n"
|
<< "\t\t vOut.y = fma(" << weight << ", Lerp(vIn.y, fma(scale, ay, floor(vIn.y * denom)), " << mulY << " * rs), " << mulY << " * pow(ay, " << boxPow << ") * rs * denom);\n"
|
||||||
<< "\t\t vOut.z = " << weight << " * Lerp(vIn.z, floor(vIn.z * denom) + scale * az, " << mulZ << " * rs) + " << mulZ << " * pow(az, " << boxPow << ") * rs * denom;\n"
|
<< "\t\t vOut.z = fma(" << weight << ", Lerp(vIn.z, fma(scale, az, floor(vIn.z * denom)), " << mulZ << " * rs), " << mulZ << " * pow(az, " << boxPow << ") * rs * denom);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -2547,10 +2559,10 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const T rIn = std::sqrt(helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
const T rIn = Zeps(std::sqrt(helper.m_PrecalcSumSquares + SQR(helper.In.z)));
|
||||||
const T sigma = std::asin(helper.In.z / rIn) + m_MulZ * random.z * dist;
|
|
||||||
const T phi = helper.m_PrecalcAtanyx + m_MulY * random.y * dist;
|
|
||||||
const T r = rIn + m_MulX * random.x * dist;
|
const T r = rIn + m_MulX * random.x * dist;
|
||||||
|
const T phi = helper.m_PrecalcAtanyx + m_MulY * random.y * dist;
|
||||||
|
const T sigma = std::asin(helper.In.z / rIn) + m_MulZ * random.z * dist;
|
||||||
const T sigmas = std::sin(sigma);
|
const T sigmas = std::sin(sigma);
|
||||||
const T sigmac = std::cos(sigma);
|
const T sigmac = std::cos(sigma);
|
||||||
const T phis = std::sin(phi);
|
const T phis = std::sin(phi);
|
||||||
@ -2606,17 +2618,20 @@ public:
|
|||||||
<< "\t\tconst real_t randy = MwcNext0505(mwc);\n"
|
<< "\t\tconst real_t randy = MwcNext0505(mwc);\n"
|
||||||
<< "\t\tconst real_t randz = MwcNext0505(mwc);\n"
|
<< "\t\tconst real_t randz = MwcNext0505(mwc);\n"
|
||||||
<< "\t\tconst real_t randc = MwcNext0505(mwc);\n"
|
<< "\t\tconst real_t randc = MwcNext0505(mwc);\n"
|
||||||
<< "\t\tconst real_t distA = sqrt(Sqr(vIn.x - " << x0 << ") + Sqr(vIn.y - " << y0 << ") + Sqr(vIn.z - " << z0 << "));\n"
|
<< "\t\tconst real_t xmx = vIn.x - " << x0 << ";\n"
|
||||||
|
<< "\t\tconst real_t ymy = vIn.y - " << y0 << ";\n"
|
||||||
|
<< "\t\tconst real_t zmz = vIn.z - " << z0 << ";\n"
|
||||||
|
<< "\t\tconst real_t distA = sqrt(fma(xmx, xmx, fma(ymy, ymy, SQR(zmz))));\n"
|
||||||
<< "\t\tconst real_t distB = " << invert << " != 0 ? max(1 - distA, (real_t)(0.0)) : max(distA, (real_t)(0.0));\n"
|
<< "\t\tconst real_t distB = " << invert << " != 0 ? max(1 - distA, (real_t)(0.0)) : max(distA, (real_t)(0.0));\n"
|
||||||
<< "\t\tconst real_t dist = max((distB - " << minDist << ") * " << rMax << ", (real_t)(0.0));\n"
|
<< "\t\tconst real_t dist = max((distB - " << minDist << ") * " << rMax << ", (real_t)(0.0));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tswitch ((int)" << type << ")\n"
|
<< "\t\tswitch ((int)" << type << ")\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t case 0:\n"
|
<< "\t\t case 0:\n"
|
||||||
<< "\t\t vOut.x = vIn.x + " << mulX << " * randx * dist;\n"
|
<< "\t\t vOut.x = fma(" << mulX << ", randx * dist, vIn.x);\n"
|
||||||
<< "\t\t vOut.y = vIn.y + " << mulY << " * randy * dist;\n"
|
<< "\t\t vOut.y = fma(" << mulY << ", randy * dist, vIn.y);\n"
|
||||||
<< "\t\t vOut.z = vIn.z + " << mulZ << " * randz * dist;\n"
|
<< "\t\t vOut.z = fma(" << mulZ << ", randz * dist, vIn.z);\n"
|
||||||
<< "\t\t outPoint->m_ColorX = fabs(fmod(outPoint->m_ColorX + " << mulC << " * randc * dist, (real_t)(1.0)));\n"
|
<< "\t\t outPoint->m_ColorX = fabs(fmod(fma(" << mulC << ", randc * dist, outPoint->m_ColorX), (real_t)(1.0)));\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 1:\n"
|
<< "\t\t case 1:\n"
|
||||||
<< "\t\t if (vIn.x == 0 && vIn.y == 0 && vIn.z == 0)\n"
|
<< "\t\t if (vIn.x == 0 && vIn.y == 0 && vIn.z == 0)\n"
|
||||||
@ -2627,10 +2642,10 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t real_t rIn = sqrt(precalcSumSquares + SQR(vIn.z));\n"
|
<< "\t\t real_t rIn = Zeps(sqrt(fma(vIn.z, vIn.z, precalcSumSquares)));\n"
|
||||||
<< "\t\t real_t sigma = asin(vIn.z / rIn) + " << mulZ << " * randz * dist;\n"
|
<< "\t\t real_t r = fma(" << mulX << ", randx * dist, rIn);\n"
|
||||||
<< "\t\t real_t phi = precalcAtanyx + " << mulY << " * randy * dist;\n"
|
<< "\t\t real_t phi = fma(" << mulY << ", randy * dist, precalcAtanyx);\n"
|
||||||
<< "\t\t real_t r = rIn + " << mulX << " * randx * dist;\n"
|
<< "\t\t real_t sigma = fma(" << mulZ << ", randz * dist, asin(vIn.z / rIn));\n"
|
||||||
<< "\t\t real_t sigmas = sin(sigma);\n"
|
<< "\t\t real_t sigmas = sin(sigma);\n"
|
||||||
<< "\t\t real_t sigmac = cos(sigma);\n"
|
<< "\t\t real_t sigmac = cos(sigma);\n"
|
||||||
<< "\t\t real_t phis = sin(phi);\n"
|
<< "\t\t real_t phis = sin(phi);\n"
|
||||||
@ -2639,7 +2654,7 @@ public:
|
|||||||
<< "\t\t vOut.x = r * sigmac * phic;\n"
|
<< "\t\t vOut.x = r * sigmac * phic;\n"
|
||||||
<< "\t\t vOut.y = r * sigmac * phis;\n"
|
<< "\t\t vOut.y = r * sigmac * phis;\n"
|
||||||
<< "\t\t vOut.z = r * sigmas;\n"
|
<< "\t\t vOut.z = r * sigmas;\n"
|
||||||
<< "\t\t outPoint->m_ColorX = fabs(fmod(outPoint->m_ColorX + " << mulC << " * randc * dist, (real_t)(1.0)));\n"
|
<< "\t\t outPoint->m_ColorX = fabs(fmod(fma(" << mulC << ", randc * dist, outPoint->m_ColorX), (real_t)(1.0)));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 2:\n"
|
<< "\t\t case 2:\n"
|
||||||
@ -2652,10 +2667,10 @@ public:
|
|||||||
<< "\t\t real_t phis = sin(phi);\n"
|
<< "\t\t real_t phis = sin(phi);\n"
|
||||||
<< "\t\t real_t phic = cos(phi);\n"
|
<< "\t\t real_t phic = cos(phi);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = vIn.x + " << mulX << " * rad * sigmac * phic;\n"
|
<< "\t\t vOut.x = fma(" << mulX << " * rad, sigmac * phic, vIn.x);\n"
|
||||||
<< "\t\t vOut.y = vIn.y + " << mulY << " * rad * sigmac * phis;\n"
|
<< "\t\t vOut.y = fma(" << mulY << " * rad, sigmac * phis, vIn.y);\n"
|
||||||
<< "\t\t vOut.z = vIn.z + " << mulZ << " * rad * sigmas;\n"
|
<< "\t\t vOut.z = fma(" << mulZ << " * rad, sigmas, vIn.z);\n"
|
||||||
<< "\t\t outPoint->m_ColorX = fabs(fmod(outPoint->m_ColorX + " << mulC << " * randc * dist, (real_t)(1.0)));\n"
|
<< "\t\t outPoint->m_ColorX = fabs(fmod(fma(" << mulC << ", randc * dist, outPoint->m_ColorX), (real_t)(1.0)));\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -2665,7 +2680,7 @@ public:
|
|||||||
|
|
||||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
{
|
{
|
||||||
return vector<string> { "Sqr" };
|
return vector<string> { "Sqr", "Zeps" };
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Precalc() override
|
virtual void Precalc() override
|
||||||
@ -2768,9 +2783,9 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const T rIn = std::sqrt(helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
const T rIn = std::sqrt(helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||||
const T sigma = std::asin(helper.In.z / rIn) + m_MulZ * random.z * dist;
|
|
||||||
const T phi = helper.m_PrecalcAtanyx + m_MulY * random.y * dist;
|
|
||||||
const T r = rIn + m_MulX * random.x * dist;
|
const T r = rIn + m_MulX * random.x * dist;
|
||||||
|
const T phi = helper.m_PrecalcAtanyx + m_MulY * random.y * dist;
|
||||||
|
const T sigma = std::asin(helper.In.z / rIn) + m_MulZ * random.z * dist;
|
||||||
const T sigmas = std::sin(sigma);
|
const T sigmas = std::sin(sigma);
|
||||||
const T sigmac = std::cos(sigma);
|
const T sigmac = std::cos(sigma);
|
||||||
const T phis = std::sin(phi);
|
const T phis = std::sin(phi);
|
||||||
@ -2822,15 +2837,18 @@ public:
|
|||||||
<< "\t\tconst real_t randy = MwcNext0505(mwc);\n"
|
<< "\t\tconst real_t randy = MwcNext0505(mwc);\n"
|
||||||
<< "\t\tconst real_t randz = MwcNext0505(mwc);\n"
|
<< "\t\tconst real_t randz = MwcNext0505(mwc);\n"
|
||||||
<< "\t\tconst real_t randc = MwcNext0505(mwc);\n"
|
<< "\t\tconst real_t randc = MwcNext0505(mwc);\n"
|
||||||
|
<< "\t\tconst real_t xmx = vIn.x - " << centerX << ";\n"
|
||||||
|
<< "\t\tconst real_t ymy = vIn.y - " << centerY << ";\n"
|
||||||
|
<< "\t\tconst real_t zmz = vIn.z - " << centerZ << ";\n"
|
||||||
<< "\t\treal_t radius;\n"
|
<< "\t\treal_t radius;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tswitch ((int)" << blurShape << ")\n"
|
<< "\t\tswitch ((int)" << blurShape << ")\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t case 0:\n"
|
<< "\t\t case 0:\n"
|
||||||
<< "\t\t radius = sqrt(Sqr(vIn.x - " << centerX << ") + Sqr(vIn.y - " << centerY << ") + Sqr(vIn.z - " << centerZ << "));\n"
|
<< "\t\t radius = sqrt(fma(xmx, xmx, fma(ymy, ymy, SQR(zmz))));\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t case 1:\n"
|
<< "\t\t case 1:\n"
|
||||||
<< "\t\t radius = max(fabs(vIn.x - " << centerX << "), max(fabs(vIn.y - " << centerY << "), (fabs(vIn.z - " << centerZ << "))));\n"
|
<< "\t\t radius = max(fabs(xmx), max(fabs(ymy), (fabs(zmz))));\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -2848,10 +2866,10 @@ public:
|
|||||||
<< "\t\t real_t phis = sin(phi);\n"
|
<< "\t\t real_t phis = sin(phi);\n"
|
||||||
<< "\t\t real_t phic = cos(phi);\n"
|
<< "\t\t real_t phic = cos(phi);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = vIn.x + " << mulX << " * rad * sigmac * phic;\n"
|
<< "\t\t vOut.x = fma(" << mulX << " * rad, sigmac * phic, vIn.x);\n"
|
||||||
<< "\t\t vOut.y = vIn.y + " << mulY << " * rad * sigmac * phis;\n"
|
<< "\t\t vOut.y = fma(" << mulY << " * rad, sigmac * phis, vIn.y);\n"
|
||||||
<< "\t\t vOut.z = vIn.z + " << mulZ << " * rad * sigmas;\n"
|
<< "\t\t vOut.z = fma(" << mulZ << " * rad, sigmas, vIn.z);\n"
|
||||||
<< "\t\t outPoint->m_ColorX = fabs(fmod(outPoint->m_ColorX + " << mulC << " * randc * dist, (real_t)(1.0)));\n"
|
<< "\t\t outPoint->m_ColorX = fabs(fmod(fma(" << mulC << ", randc * dist, outPoint->m_ColorX), (real_t)(1.0)));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\tcase 1:\n"
|
<< "\t\tcase 1:\n"
|
||||||
@ -2863,10 +2881,10 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t real_t rIn = sqrt(precalcSumSquares + SQR(vIn.z));\n"
|
<< "\t\t real_t rIn = Zeps(sqrt(fma(vIn.z, vIn.z, precalcSumSquares)));\n"
|
||||||
<< "\t\t real_t sigma = asin(vIn.z / rIn) + " << mulZ << " * randz * dist;\n"
|
<< "\t\t real_t r = fma(" << mulX << ", randx * dist, rIn);\n"
|
||||||
<< "\t\t real_t phi = precalcAtanyx + " << mulY << " * randy * dist;\n"
|
<< "\t\t real_t phi = fma(" << mulY << ", randy * dist, precalcAtanyx);\n"
|
||||||
<< "\t\t real_t r = rIn + " << mulX << " * randx * dist;\n"
|
<< "\t\t real_t sigma = fma(" << mulZ << ", randz * dist, asin(vIn.z / rIn));\n"
|
||||||
<< "\t\t real_t sigmas = sin(sigma);\n"
|
<< "\t\t real_t sigmas = sin(sigma);\n"
|
||||||
<< "\t\t real_t sigmac = cos(sigma);\n"
|
<< "\t\t real_t sigmac = cos(sigma);\n"
|
||||||
<< "\t\t real_t phis = sin(phi);\n"
|
<< "\t\t real_t phis = sin(phi);\n"
|
||||||
@ -2875,17 +2893,17 @@ public:
|
|||||||
<< "\t\t vOut.x = r * sigmac * phic;\n"
|
<< "\t\t vOut.x = r * sigmac * phic;\n"
|
||||||
<< "\t\t vOut.y = r * sigmac * phis;\n"
|
<< "\t\t vOut.y = r * sigmac * phis;\n"
|
||||||
<< "\t\t vOut.z = r * sigmas;\n"
|
<< "\t\t vOut.z = r * sigmas;\n"
|
||||||
<< "\t\t outPoint->m_ColorX = fabs(fmod(outPoint->m_ColorX + " << mulC << " * randc * dist, (real_t)(1.0)));\n"
|
<< "\t\t outPoint->m_ColorX = fabs(fmod(fma(" << mulC << ", randc * dist, outPoint->m_ColorX), (real_t)(1.0)));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\tcase 2:\n"
|
<< "\t\tcase 2:\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t real_t coeff = " << rMax << " <= EPS ? dist : dist + " << alpha << " * (LogMap(dist) - dist);\n"
|
<< "\t\t real_t coeff = " << rMax << " <= EPS ? dist : fma(" << alpha << ", (LogMap(dist) - dist), dist);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t vOut.x = vIn.x + LogMap(" << mulX << ") * LogScale(randx) * coeff;\n"
|
<< "\t\t vOut.x = fma(LogMap(" << mulX << "), LogScale(randx) * coeff, vIn.x);\n"
|
||||||
<< "\t\t vOut.y = vIn.y + LogMap(" << mulY << ") * LogScale(randy) * coeff;\n"
|
<< "\t\t vOut.y = fma(LogMap(" << mulY << "), LogScale(randy) * coeff, vIn.y);\n"
|
||||||
<< "\t\t vOut.z = vIn.z + LogMap(" << mulZ << ") * LogScale(randz) * coeff;\n"
|
<< "\t\t vOut.z = fma(LogMap(" << mulZ << "), LogScale(randz) * coeff, vIn.z);\n"
|
||||||
<< "\t\t outPoint->m_ColorX = fabs(fmod(outPoint->m_ColorX + LogMap(" << mulC << ") * LogScale(randc) * coeff, (real_t)(1.0)));\n"
|
<< "\t\t outPoint->m_ColorX = fabs(fmod(fma(LogMap(" << mulC << "), LogScale(randc) * coeff, outPoint->m_ColorX), (real_t)(1.0)));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -2895,7 +2913,7 @@ public:
|
|||||||
|
|
||||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
{
|
{
|
||||||
return vector<string> { "SignNz", "LogMap", "LogScale", "Sqr" };
|
return vector<string> { "SignNz", "LogMap", "LogScale", "Sqr", "Zeps" };
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Precalc() override
|
virtual void Precalc() override
|
||||||
@ -3030,14 +3048,14 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t{\n"//DirectTrilinear function extracted out here.
|
<< "\t\t{\n"//DirectTrilinear function extracted out here.
|
||||||
<< "\t\t alpha = vIn.y + " << radius << ";\n"
|
<< "\t\t alpha = vIn.y + " << radius << ";\n"
|
||||||
<< "\t\t beta = vIn.x * " << sinC << " - vIn.y * " << cosC << " + " << radius << ";\n"
|
<< "\t\t beta = fma(vIn.x, " << sinC << ", fma(-vIn.y, " << cosC << ", " << radius << "));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tm = floor(alpha / " << s2a << ");\n"
|
<< "\t\tm = floor(alpha / " << s2a << ");\n"
|
||||||
<< "\t\toffsetAl = alpha - m * " << s2a << ";\n"
|
<< "\t\toffsetAl = alpha - m * " << s2a << ";\n"
|
||||||
<< "\t\tn = floor(beta / " << s2b << ");\n"
|
<< "\t\tn = floor(beta / " << s2b << ");\n"
|
||||||
<< "\t\toffsetBe = beta - n * " << s2b << ";\n"
|
<< "\t\toffsetBe = beta - n * " << s2b << ";\n"
|
||||||
<< "\t\toffsetGa = " << s2c << " - " << ac << " * offsetAl - " << bc << " * offsetBe;\n"
|
<< "\t\toffsetGa = " << s2c << " + fma(-" << ac << ", offsetAl, -" << bc << " * offsetBe);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (offsetGa > 0)\n"
|
<< "\t\tif (offsetGa > 0)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
@ -3097,10 +3115,10 @@ public:
|
|||||||
<< "\t\tbeta += n * " << s2b << ";\n"
|
<< "\t\tbeta += n * " << s2b << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t{\n"//InverseTrilinear function extracted out here.
|
<< "\t\t{\n"//InverseTrilinear function extracted out here.
|
||||||
<< "\t\t real_t inx = (beta - " << radius << " + (alpha - " << radius << ") * " << cosC << ") / " << sinC << ";\n"
|
<< "\t\t real_t inx = fma(alpha - " << radius << ", " << cosC << ", beta - " << radius << ") / " << sinC << ";\n"
|
||||||
<< "\t\t real_t iny = alpha - " << radius << ";\n"
|
<< "\t\t real_t iny = alpha - " << radius << ";\n"
|
||||||
<< "\t\t real_t angle = (atan2(iny, inx) + M_2PI * MwcNextRange(mwc, (int)" << absN << ")) / " << power << ";\n"
|
<< "\t\t real_t angle = fma(M_2PI, (real_t)MwcNextRange(mwc, (int)" << absN << "), atan2(iny, inx)) / " << power << ";\n"
|
||||||
<< "\t\t real_t r = " << weight << " * pow(SQR(inx) + SQR(iny), " << cn << ");\n"
|
<< "\t\t real_t r = " << weight << " * pow(fma(inx, inx, SQR(iny)), " << cn << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t x = r * cos(angle);\n"
|
<< "\t\t x = r * cos(angle);\n"
|
||||||
<< "\t\t y = r * sin(angle);\n"
|
<< "\t\t y = r * sin(angle);\n"
|
||||||
@ -3150,11 +3168,11 @@ public:
|
|||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" ga1 = width1 * ga + width2 * hc * ga / be;\n"
|
" ga1 = fma(width1, ga, width2 * hc * ga / be);\n"
|
||||||
" de1 = width1 * be + width2 * s2ab * (3 - ga / be);\n"
|
" de1 = fma(width1, be, width2 * s2ab * (3 - ga / be));\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" *al1 = s2a - ba * de1 - ca * ga1;\n"
|
" *al1 = s2a + fma(-ba, de1, - ca * ga1);\n"
|
||||||
" *be1 = de1;\n"
|
" *be1 = de1;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
@ -3168,11 +3186,11 @@ public:
|
|||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" de1 = width1 * be + width2 * hb * be / ga;\n"
|
" de1 = fma(width1, be, width2 * hb * be / ga);\n"
|
||||||
" ga1 = width1 * ga + width2 * s2ac * (3 - be / ga);\n"
|
" ga1 = fma(width1, ga, width2 * s2ac * (3 - be / ga));\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" *al1 = s2a - ba * de1 - ca * ga1;\n"
|
" *al1 = s2a + fma(-ba, de1, -ca * ga1);\n"
|
||||||
" *be1 = de1;\n"
|
" *be1 = de1;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
@ -3184,8 +3202,8 @@ public:
|
|||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" *be1 = width1 * be + width2 * hb * be / al;\n"
|
" *be1 = fma(width1, be, width2 * hb * be / al);\n"
|
||||||
" *al1 = width1 * al + width2 * s2ac * (3 - be / al);\n"
|
" *al1 = fma(width1, al, width2 * s2ac * (3 - be / al));\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
@ -3201,11 +3219,11 @@ public:
|
|||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" ga1 = width1 * ga + width2 * hc * ga / al;\n"
|
" ga1 = fma(width1, ga, width2 * hc * ga / al);\n"
|
||||||
" de1 = width1 * al + width2 * s2ab * (3 - ga / al);\n"
|
" de1 = fma(width1, al, width2 * s2ab * (3 - ga / al));\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" *be1 = s2b - ab * de1 - cb * ga1;\n"
|
" *be1 = s2b + fma(-ab, de1, -cb * ga1);\n"
|
||||||
" *al1 = de1;\n"
|
" *al1 = de1;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
@ -3219,11 +3237,11 @@ public:
|
|||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" de1 = width1 * al + width2 * ha * al / ga;\n"
|
" de1 = fma(width1, al, width2 * ha * al / ga);\n"
|
||||||
" ga1 = width1 * ga + width2 * s2bc * (3 - al / ga);\n"
|
" ga1 = fma(width1, ga, width2 * s2bc * (3 - al / ga));\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" *be1 = s2b - ab * de1 - cb * ga1;\n"
|
" *be1 = s2b + fma(-ab, de1, -cb * ga1);\n"
|
||||||
" *al1 = de1;\n"
|
" *al1 = de1;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
@ -3235,8 +3253,8 @@ public:
|
|||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" *al1 = width1 * al + width2 * ha * al / be;\n"
|
" *al1 = fma(width1, al, width2 * ha * al / be);\n"
|
||||||
" *be1 = width1 * be + width2 * s2bc * (3 - al / be);\n"
|
" *be1 = fma(width1, be, width2 * s2bc * (3 - al / be));\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
@ -3335,7 +3353,7 @@ private:
|
|||||||
{
|
{
|
||||||
T inx = (be - m_Radius + (al - m_Radius) * m_CosC) / m_SinC;
|
T inx = (be - m_Radius + (al - m_Radius) * m_CosC) / m_SinC;
|
||||||
T iny = al - m_Radius;
|
T iny = al - m_Radius;
|
||||||
T angle = (atan2(iny, inx) + M_2PI * (rand.Rand(int(m_AbsN)))) / m_Power;
|
T angle = (std::atan2(iny, inx) + M_2PI * (rand.Rand(int(m_AbsN)))) / m_Power;
|
||||||
T r = m_Weight * std::pow(SQR(inx) + SQR(iny), m_Cn);
|
T r = m_Weight * std::pow(SQR(inx) + SQR(iny), m_Cn);
|
||||||
x = r * std::cos(angle);
|
x = r * std::cos(angle);
|
||||||
y = r * std::sin(angle);
|
y = r * std::sin(angle);
|
||||||
@ -3645,7 +3663,7 @@ public:
|
|||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (majplane == 2)\n"
|
<< "\t\tif (majplane == 2)\n"
|
||||||
<< "\t\t vOut.z = vIn.z * 0.5 * " << zlift << " + (posNeg * boost);\n"
|
<< "\t\t vOut.z = fma(vIn.z * 0.5, " << zlift << ", (posNeg * boost));\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t vOut.z = vIn.z * 0.5 * " << zlift << ";\n"
|
<< "\t\t vOut.z = vIn.z * 0.5 * " << zlift << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -3664,8 +3682,8 @@ public:
|
|||||||
<< "\t\t " << bcycle << " = " << bcycle << " + 1;\n"
|
<< "\t\t " << bcycle << " = " << bcycle << " + 1;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = ((sumX + vIn.x) * " << halfScale << ") + (lrmaj * tempx);\n"
|
<< "\t\tvOut.x = fma((sumX + vIn.x), " << halfScale << ", (lrmaj * tempx));\n"
|
||||||
<< "\t\tvOut.y = ((sumY + vIn.y) * " << halfScale << ") + (lrmaj * tempy);\n"
|
<< "\t\tvOut.y = fma((sumY + vIn.y), " << halfScale << ", (lrmaj * tempy));\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -3759,7 +3777,7 @@ private:
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// hexnix3D.
|
/// hexnix3D.
|
||||||
/// This uses state and the OpenCL version looks different and better than the CPU.
|
/// This uses state and the OpenCL version looks different and better than the CPU.
|
||||||
/// It takes care of doing either a sum or produce of the output variables internally,
|
/// It takes care of doing either a sum or product of the output variables internally,
|
||||||
/// rather than relying on the calling code of Xform::Apply() to do it.
|
/// rather than relying on the calling code of Xform::Apply() to do it.
|
||||||
/// This is because different paths do different things to helper.Out.z
|
/// This is because different paths do different things to helper.Out.z
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -4016,11 +4034,11 @@ public:
|
|||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t if (posNeg > 0)\n"
|
<< "\t\t if (posNeg > 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.z = (smooth * (vIn.z * scale * " << zlift << " + boost));\n"
|
<< "\t\t vOut.z = (smooth * fma(vIn.z * scale, " << zlift << ", boost));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.z = (sumZ - (2 * smooth * sumZ)) + (smooth * posNeg * (vIn.z * scale * " << zlift << " + boost));\n";
|
<< "\t\t vOut.z = fma(smooth * posNeg, fma(vIn.z * scale, " << zlift << ", boost), sumZ - (2 * smooth * sumZ));\n";
|
||||||
|
|
||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
ss << "\t\t outPoint->m_Z = 0;\n";
|
ss << "\t\t outPoint->m_Z = 0;\n";
|
||||||
@ -4030,7 +4048,7 @@ public:
|
|||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t vOut.z = smooth * (vIn.z * scale * " << zlift << " + (posNeg * boost));\n"
|
<< "\t\t vOut.z = smooth * fma(vIn.z * scale, " << zlift << ", (posNeg * boost));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << rswtch << " <= 1)\n"
|
<< "\t\tif (" << rswtch << " <= 1)\n"
|
||||||
@ -4050,12 +4068,12 @@ public:
|
|||||||
<< "\t\t " << bcycle << " = " << bcycle << " + 1;\n"
|
<< "\t\t " << bcycle << " = " << bcycle << " + 1;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tsmRotxFP = (smooth * scale * sumX * tempx) - (smooth * scale * sumY * tempy);\n"
|
<< "\t\tsmRotxFP = fma(smooth * scale, sumX * tempx, -(smooth * scale * sumY * tempy));\n"
|
||||||
<< "\t\tsmRotyFP = (smooth * scale * sumY * tempx) + (smooth * scale * sumX * tempy);\n"
|
<< "\t\tsmRotyFP = fma(smooth * scale, sumY * tempx, (smooth * scale * sumX * tempy));\n"
|
||||||
<< "\t\tsmRotxFT = (vIn.x * smooth * scale * tempx) - (vIn.y * smooth * scale * tempy);\n"
|
<< "\t\tsmRotxFT = fma(vIn.x * smooth, scale * tempx, -(vIn.y * smooth * scale * tempy));\n"
|
||||||
<< "\t\tsmRotyFT = (vIn.y * smooth * scale * tempx) + (vIn.x * smooth * scale * tempy);\n"
|
<< "\t\tsmRotyFT = fma(vIn.y * smooth, scale * tempx, (vIn.x * smooth * scale * tempy));\n"
|
||||||
<< "\t\tvOut.x = sumX * (1 - smooth) + smRotxFP + smRotxFT + smooth * lrmaj * scale3 * tempx;\n"
|
<< "\t\tvOut.x = fma(sumX, (1 - smooth), fma(smooth * lrmaj, scale3 * tempx, smRotxFP + smRotxFT));\n"
|
||||||
<< "\t\tvOut.y = sumY * (1 - smooth) + smRotyFP + smRotyFT + smooth * lrmaj * scale3 * tempy;\n"
|
<< "\t\tvOut.y = fma(sumY, (1 - smooth), fma(smooth * lrmaj, scale3 * tempy, smRotyFP + smRotyFT));\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -4068,6 +4086,7 @@ public:
|
|||||||
string prefix = Prefix();
|
string prefix = Prefix();
|
||||||
//CPU sets fycle and bcycle to 0 at the beginning in Precalc().
|
//CPU sets fycle and bcycle to 0 at the beginning in Precalc().
|
||||||
//Set to random in OpenCL since a value can't be set once and kept between kernel launches without writing it back to an OpenCL buffer.
|
//Set to random in OpenCL since a value can't be set once and kept between kernel launches without writing it back to an OpenCL buffer.
|
||||||
|
//This doesn't seem to make a difference from setting them to 0, but do it anyway because it seems more correct.
|
||||||
ss << "\n\tvarState." << prefix << "hexnix3D_rswtch" << stateIndex << " = trunc(MwcNext01(&mwc) * 3.0);";
|
ss << "\n\tvarState." << prefix << "hexnix3D_rswtch" << stateIndex << " = trunc(MwcNext01(&mwc) * 3.0);";
|
||||||
ss << "\n\tvarState." << prefix << "hexnix3D_fcycle" << stateIndex << " = trunc(MwcNext01(&mwc) * 5.0);";
|
ss << "\n\tvarState." << prefix << "hexnix3D_fcycle" << stateIndex << " = trunc(MwcNext01(&mwc) * 5.0);";
|
||||||
ss << "\n\tvarState." << prefix << "hexnix3D_bcycle" << stateIndex << " = trunc(MwcNext01(&mwc) * 2.0);";
|
ss << "\n\tvarState." << prefix << "hexnix3D_bcycle" << stateIndex << " = trunc(MwcNext01(&mwc) * 2.0);";
|
||||||
@ -4231,8 +4250,8 @@ public:
|
|||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
{
|
{
|
||||||
ss
|
ss
|
||||||
<< "\t\tvOut.x = c != 0 ? outPoint->m_X + i.x * " << weight << " : " << dropoff << ";\n"
|
<< "\t\tvOut.x = c != 0 ? fma(i.x, " << weight << ", outPoint->m_X) : " << dropoff << ";\n"
|
||||||
<< "\t\tvOut.y = c != 0 ? outPoint->m_Y + i.y * " << weight << " : " << dropoff << ";\n"
|
<< "\t\tvOut.y = c != 0 ? fma(i.y, " << weight << ", outPoint->m_Y) : " << dropoff << ";\n"
|
||||||
<< "\t\toutPoint->m_X = 0;\n"
|
<< "\t\toutPoint->m_X = 0;\n"
|
||||||
<< "\t\toutPoint->m_Y = 0;\n";
|
<< "\t\toutPoint->m_Y = 0;\n";
|
||||||
}
|
}
|
||||||
|
@ -170,15 +170,15 @@ public:
|
|||||||
<< "\t\tU.x = vIn.x;\n"
|
<< "\t\tU.x = vIn.x;\n"
|
||||||
<< "\t\tU.y = vIn.y;\n"
|
<< "\t\tU.y = vIn.y;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tXCh = floor((AXhXo * U.x + AXhYo * U.y) / s);\n"
|
<< "\t\tXCh = floor(fma(AXhXo, U.x, AXhYo * U.y) / s);\n"
|
||||||
<< "\t\tYCh = floor((AYhXo * U.x + AYhYo * U.y) / s);\n"
|
<< "\t\tYCh = floor(fma(AYhXo, U.x, AYhYo * U.y) / s);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tfor (i = 0, di = XCh; i < 2; di += 1, i++)\n"
|
<< "\t\tfor (i = 0, di = XCh; i < 2; di += 1, i++)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t for (j = 0, dj = YCh; j < 2; dj += 1, j++)\n"
|
<< "\t\t for (j = 0, dj = YCh; j < 2; dj += 1, j++)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t P[(i * 2) + j].x = (AXoXh * di + AXoYh * dj) * s;\n"
|
<< "\t\t P[(i * 2) + j].x = fma(AXoXh, di, AXoYh * dj) * s;\n"
|
||||||
<< "\t\t P[(i * 2) + j].y = (AYoXh * di + AYoYh * dj) * s;\n"
|
<< "\t\t P[(i * 2) + j].y = fma(AYoXh, di, AYoYh * dj) * s;\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -187,8 +187,8 @@ public:
|
|||||||
<< "\t\tXCh += offset[q].x;\n"
|
<< "\t\tXCh += offset[q].x;\n"
|
||||||
<< "\t\tYCh += offset[q].y;\n"
|
<< "\t\tYCh += offset[q].y;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tXCo = (AXoXh * XCh + AXoYh * YCh) * s;\n"
|
<< "\t\tXCo = fma(AXoXh, XCh, AXoYh * YCh) * s;\n"
|
||||||
<< "\t\tYCo = (AYoXh * XCh + AYoYh * YCh) * s;\n"
|
<< "\t\tYCo = fma(AYoXh, XCh, AYoYh * YCh) * s;\n"
|
||||||
<< "\t\tP[0].x = XCo;\n"
|
<< "\t\tP[0].x = XCo;\n"
|
||||||
<< "\t\tP[0].y = YCo;\n"
|
<< "\t\tP[0].y = YCo;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -212,8 +212,8 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\ttrgL = pow(fabs(L1), " << power << ") * " << scale << ";\n"
|
<< "\t\ttrgL = pow(fabs(L1), " << power << ") * " << scale << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tVx = DXo * " << rotcos << " + DYo * " << rotsin << ";\n"
|
<< "\t\tVx = fma( DXo, " << rotcos << ", DYo * " << rotsin << ");\n"
|
||||||
<< "\t\tVy = -DXo * " << rotsin << " + DYo * " << rotcos << ";\n"
|
<< "\t\tVy = fma(-DXo, " << rotsin << ", DYo * " << rotcos << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tU.x = Vx + P[0].x;\n"
|
<< "\t\tU.x = Vx + P[0].x;\n"
|
||||||
<< "\t\tU.y = Vy + P[0].y;\n"
|
<< "\t\tU.y = Vy + P[0].y;\n"
|
||||||
@ -229,7 +229,7 @@ public:
|
|||||||
<< "\t\t if (L > 0.8)\n"
|
<< "\t\t if (L > 0.8)\n"
|
||||||
<< "\t\t R = trgL / L2;\n"
|
<< "\t\t R = trgL / L2;\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t R = ((trgL / L1) * (0.8 - L) + (trgL / L2) * (L - 0.5)) / 0.3;\n"
|
<< "\t\t R = fma(trgL / L1, (real_t)(0.8) - L, (trgL / L2) * (L - 0.5)) / 0.3;\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tVx *= R;\n"
|
<< "\t\tVx *= R;\n"
|
||||||
@ -444,8 +444,8 @@ public:
|
|||||||
<< "\t\txTmp = params.X;\n"
|
<< "\t\txTmp = params.X;\n"
|
||||||
<< "\t\tyTmp = params.Y;\n"
|
<< "\t\tyTmp = params.Y;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tparams.X = " << cosa << " * xTmp - " << sina << " * yTmp;\n"
|
<< "\t\tparams.X = fma(" << cosa << ", xTmp, -(" << sina << " * yTmp));\n"
|
||||||
<< "\t\tparams.Y = " << sina << " * xTmp + " << cosa << " * yTmp;\n"
|
<< "\t\tparams.Y = fma(" << sina << ", xTmp, " << cosa << " * yTmp);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << adjustedWeight << " * params.X;\n"
|
<< "\t\tvOut.x = " << adjustedWeight << " * params.X;\n"
|
||||||
<< "\t\tvOut.y = " << adjustedWeight << " * params.Y;\n"
|
<< "\t\tvOut.y = " << adjustedWeight << " * params.Y;\n"
|
||||||
@ -686,7 +686,7 @@ public:
|
|||||||
"\n"
|
"\n"
|
||||||
" xTmp = params->Tan90M2 / (params->Tan90M2 - tan(angXY));\n"
|
" xTmp = params->Tan90M2 / (params->Tan90M2 - tan(angXY));\n"
|
||||||
" yTmp = xTmp * tan(angXY);\n"
|
" yTmp = xTmp * tan(angXY);\n"
|
||||||
" params->LenOuterEdges = sqrt(SQR(xTmp) + SQR(yTmp));\n"
|
" params->LenOuterEdges = sqrt(fma(xTmp, xTmp, SQR(yTmp)));\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if (params->ExactCalc == 1)\n"
|
" if (params->ExactCalc == 1)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
@ -722,23 +722,23 @@ public:
|
|||||||
" if (params->CircumCircle == 1)\n"
|
" if (params->CircumCircle == 1)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" if (params->EqualBlur == 1)\n"
|
" if (params->EqualBlur == 1)\n"
|
||||||
" ranTmp = params->LenInnerEdges + sqrt(MwcNext01(mwc)) * (1 - params->LenInnerEdges + EPS);\n"
|
" ranTmp = fma(sqrt(MwcNext01(mwc)), (1 - params->LenInnerEdges + EPS), params->LenInnerEdges);\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" ranTmp = params->LenInnerEdges + MwcNext01(mwc) * (1 - params->LenInnerEdges + EPS);\n"
|
" ranTmp = fma(MwcNext01(mwc), (1 - params->LenInnerEdges + EPS), params->LenInnerEdges);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" if (params->EqualBlur == 1)\n"
|
" if (params->EqualBlur == 1)\n"
|
||||||
" ranTmp = params->LenInnerEdges + sqrt(MwcNext01(mwc)) * (params->LenOuterEdges - params->LenInnerEdges);\n"
|
" ranTmp = fma(sqrt(MwcNext01(mwc)), (params->LenOuterEdges - params->LenInnerEdges), params->LenInnerEdges);\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" ranTmp = params->LenInnerEdges + MwcNext01(mwc) * (params->LenOuterEdges - params->LenInnerEdges);\n"
|
" ranTmp = fma(MwcNext01(mwc), (params->LenOuterEdges - params->LenInnerEdges), params->LenInnerEdges);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" params->X *= ranTmp;\n"
|
" params->X *= ranTmp;\n"
|
||||||
" params->Y *= ranTmp;\n"
|
" params->Y *= ranTmp;\n"
|
||||||
" params->LenXY = sqrt(SQR(params->X) + SQR(params->Y));\n"
|
" params->LenXY = sqrt(fma(params->X, params->X, SQR(params->Y)));\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -1289,8 +1289,8 @@ public:
|
|||||||
ss
|
ss
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = tempOut.x + (" << weight << " * x);\n"
|
<< "\t\tvOut.x = fma(" << weight << ", x, tempOut.x);\n"
|
||||||
<< "\t\tvOut.y = tempOut.y + (" << weight << " * y);\n"
|
<< "\t\tvOut.y = fma(" << weight << ", y, tempOut.y);\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * z;\n"
|
<< "\t\tvOut.z = " << weight << " * z;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -1319,7 +1319,7 @@ public:
|
|||||||
" if (radius == 0)\n"
|
" if (radius == 0)\n"
|
||||||
" return 1;\n"
|
" return 1;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" *r = sqrt(SQR((*p).x) + SQR((*p).y));\n"
|
" *r = sqrt(fma((*p).x, (*p).x, SQR((*p).y)));\n"
|
||||||
" return (*r <= radius);\n"
|
" return (*r <= radius);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -1333,12 +1333,12 @@ public:
|
|||||||
" real_t d02 = dot(v0, v2);\n"
|
" real_t d02 = dot(v0, v2);\n"
|
||||||
" real_t d11 = dot(v1, v1);\n"
|
" real_t d11 = dot(v1, v1);\n"
|
||||||
" real_t d12 = dot(v1, v2);\n"
|
" real_t d12 = dot(v1, v2);\n"
|
||||||
" real_t denom = (d00 * d11 - d01 * d01);\n"
|
" real_t denom = fma(d00, d11, -(d01 * d01));\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if (denom != 0)\n"
|
" if (denom != 0)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" *u = (d11 * d02 - d01 * d12) / denom;\n"
|
" *u = fma(d11, d02, -(d01 * d12)) / denom;\n"
|
||||||
" *v = (d00 * d12 - d01 * d02) / denom;\n"
|
" *v = fma(d00, d12, -(d01 * d02)) / denom;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" *u = *v = 0;\n"
|
" *u = *v = 0;\n"
|
||||||
@ -1610,7 +1610,7 @@ public:
|
|||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t do\n"
|
<< "\t\t do\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t yTmp = " << top << " + MwcNext01(mwc) * " << yInt2 << ";\n"
|
<< "\t\t yTmp = fma(MwcNext01(mwc), " << yInt2 << ", " << top << ");\n"
|
||||||
<< "\t\t xTmp = " << right << " - pow(MwcNext01(mwc), " << directBlur << ") * " << ratioBlur << " * " << minInt2 << ";\n"
|
<< "\t\t xTmp = " << right << " - pow(MwcNext01(mwc), " << directBlur << ") * " << ratioBlur << " * " << minInt2 << ";\n"
|
||||||
<< "\t\t } while ((yTmp - " << y0c << ") / Zeps(xTmp - " << x0c << ") < -1);\n"
|
<< "\t\t } while ((yTmp - " << y0c << ") / Zeps(xTmp - " << x0c << ") < -1);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
@ -2052,8 +2052,8 @@ public:
|
|||||||
"\t\t {\n"
|
"\t\t {\n"
|
||||||
"\t\t if (" << ratioStripes << " == 1)\n"
|
"\t\t if (" << ratioStripes << " == 1)\n"
|
||||||
"\t\t {\n"
|
"\t\t {\n"
|
||||||
"\t\t xTmp = " << c << " * x - " << s << " * y;\n"
|
"\t\t xTmp = fma(" << c << ", x, -(" << s << " * y));\n"
|
||||||
"\t\t yTmp = " << s << " * x + " << c << " * y;\n"
|
"\t\t yTmp = fma(" << s << ", x, " << c << " * y);\n"
|
||||||
"\t\t x = xTmp;\n"
|
"\t\t x = xTmp;\n"
|
||||||
"\t\t y = yTmp;\n"
|
"\t\t y = yTmp;\n"
|
||||||
"\t\t }\n"
|
"\t\t }\n"
|
||||||
@ -2062,8 +2062,8 @@ public:
|
|||||||
"\t\t angRot = (angXY - " << angStrip1 << ") / Zeps(" << angStrip2 << " - " << angStrip1 << ");\n"
|
"\t\t angRot = (angXY - " << angStrip1 << ") / Zeps(" << angStrip2 << " - " << angStrip1 << ");\n"
|
||||||
"\t\t angRot = angXY - angRot * " << angStrip1 << ";\n"
|
"\t\t angRot = angXY - angRot * " << angStrip1 << ";\n"
|
||||||
"\t\t s = sincos(angRot, &c);\n"
|
"\t\t s = sincos(angRot, &c);\n"
|
||||||
"\t\t xTmp = c * x - s * y;\n"
|
"\t\t xTmp = fma(c, x, -(s * y));\n"
|
||||||
"\t\t yTmp = s * x + c * y;\n"
|
"\t\t yTmp = fma(s, x, c * y);\n"
|
||||||
"\t\t x = xTmp;\n"
|
"\t\t x = xTmp;\n"
|
||||||
"\t\t y = yTmp;\n"
|
"\t\t y = yTmp;\n"
|
||||||
"\t\t }\n"
|
"\t\t }\n"
|
||||||
@ -2083,8 +2083,8 @@ public:
|
|||||||
"\t\t {\n"
|
"\t\t {\n"
|
||||||
"\t\t if (" << absNumberStripes << " == 1)\n"
|
"\t\t if (" << absNumberStripes << " == 1)\n"
|
||||||
"\t\t {\n"
|
"\t\t {\n"
|
||||||
"\t\t xTmp = " << c << " * x - " << s << " * y;\n"
|
"\t\t xTmp = fma(" << c << ", x, -(" << s << " * y));\n"
|
||||||
"\t\t yTmp = " << s << " * x + " << c << " * y;\n"
|
"\t\t yTmp = fma(" << s << ", x, " << c << " * y);\n"
|
||||||
"\t\t x = xTmp;\n"
|
"\t\t x = xTmp;\n"
|
||||||
"\t\t y = yTmp;\n"
|
"\t\t y = yTmp;\n"
|
||||||
"\t\t }\n"
|
"\t\t }\n"
|
||||||
@ -2093,8 +2093,8 @@ public:
|
|||||||
"\t\t angRot = (angXY - " << angStrip1 << ") / " << angStrip1 << ";\n"
|
"\t\t angRot = (angXY - " << angStrip1 << ") / " << angStrip1 << ";\n"
|
||||||
"\t\t angRot = angXY - angRot * (" << angStrip2 << " - " << angStrip1 << ");\n"
|
"\t\t angRot = angXY - angRot * (" << angStrip2 << " - " << angStrip1 << ");\n"
|
||||||
"\t\t s = sincos(angRot, &c);\n"
|
"\t\t s = sincos(angRot, &c);\n"
|
||||||
"\t\t xTmp = c * x - s * y;\n"
|
"\t\t xTmp = fma(c, x, -(s * y));\n"
|
||||||
"\t\t yTmp = s * x + c * y;\n"
|
"\t\t yTmp = fma(s, x, c * y);\n"
|
||||||
"\t\t x = xTmp;\n"
|
"\t\t x = xTmp;\n"
|
||||||
"\t\t y = yTmp;\n"
|
"\t\t y = yTmp;\n"
|
||||||
"\t\t }\n"
|
"\t\t }\n"
|
||||||
@ -2111,9 +2111,9 @@ public:
|
|||||||
"\t\t z = 2 / pow(rad, " << exponentZ << ") - 1;\n"
|
"\t\t z = 2 / pow(rad, " << exponentZ << ") - 1;\n"
|
||||||
"\t\t\n"
|
"\t\t\n"
|
||||||
"\t\t if (" << exponentZ << " <= 2)\n"
|
"\t\t if (" << exponentZ << " <= 2)\n"
|
||||||
"\t\t angZ = MPI - acos((z / (SQR(x) + SQR(y) + SQR(z))));\n"
|
"\t\t angZ = MPI - acos((z / fma(x, x, fma(y, y, SQR(z)))));\n"
|
||||||
"\t\t else\n"
|
"\t\t else\n"
|
||||||
"\t\t angZ = MPI - atan2(Sqr(SQR(x) + SQR(y)), z);\n"
|
"\t\t angZ = MPI - atan2(Sqr(fma(x, x, SQR(y))), z);\n"
|
||||||
"\t\t}\n"
|
"\t\t}\n"
|
||||||
"\t\telse\n"
|
"\t\telse\n"
|
||||||
"\t\t{\n"
|
"\t\t{\n"
|
||||||
@ -2135,7 +2135,7 @@ public:
|
|||||||
"\t\t }\n"
|
"\t\t }\n"
|
||||||
"\t\t else\n"
|
"\t\t else\n"
|
||||||
"\t\t {\n"
|
"\t\t {\n"
|
||||||
"\t\t angTmp = (MPI - angZ) / Zeps(" << angHoleComp << " * " << angHoleTemp << " - MPI2);\n"
|
"\t\t angTmp = (MPI - angZ) / Zeps(fma(" << angHoleComp << ", " << angHoleTemp << ", -MPI2));\n"
|
||||||
"\t\t angZ -= MPI2;\n"
|
"\t\t angZ -= MPI2;\n"
|
||||||
"\t\t fac = cos(angTmp) / cos(angZ);\n"
|
"\t\t fac = cos(angTmp) / cos(angZ);\n"
|
||||||
"\t\t x *= fac;\n"
|
"\t\t x *= fac;\n"
|
||||||
@ -2156,7 +2156,7 @@ public:
|
|||||||
"\t\t }\n"
|
"\t\t }\n"
|
||||||
"\t\t else\n"
|
"\t\t else\n"
|
||||||
"\t\t {\n"
|
"\t\t {\n"
|
||||||
"\t\t angTmp = MPI - angZ / Zeps(" << angHoleComp << " * " << angHoleTemp << " - MPI2);\n"
|
"\t\t angTmp = MPI - angZ / Zeps(fma(" << angHoleComp << ", " << angHoleTemp << ", -MPI2));\n"
|
||||||
"\t\t angZ -= MPI2;\n"
|
"\t\t angZ -= MPI2;\n"
|
||||||
"\t\t fac = cos(angTmp) / cos(angZ);\n"
|
"\t\t fac = cos(angTmp) / cos(angZ);\n"
|
||||||
"\t\t x *= fac;\n"
|
"\t\t x *= fac;\n"
|
||||||
@ -2860,8 +2860,8 @@ public:
|
|||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tcase MODE_BLUR_LEGACY:\n"
|
<< "\t\tcase MODE_BLUR_LEGACY:\n"
|
||||||
<< "\t\t radius = (MwcNext01(mwc) + MwcNext01(mwc) + 0.002 * MwcNext01(mwc)) / 2.002;\n"
|
<< "\t\t radius = fma((real_t)(0.002), MwcNext01(mwc), MwcNext01(mwc) + MwcNext01(mwc)) / 2.002;\n"
|
||||||
<< "\t\t theta = M_2PI * MwcNext01(mwc) - MPI;\n"
|
<< "\t\t theta = fma(M_2PI, MwcNext01(mwc), -MPI);\n"
|
||||||
<< "\t\t Vx = radius * sin(theta);\n"
|
<< "\t\t Vx = radius * sin(theta);\n"
|
||||||
<< "\t\t Vy = radius * cos(theta);\n"
|
<< "\t\t Vy = radius * cos(theta);\n"
|
||||||
<< "\t\t radius = pow(Zeps(radius * radius), " << synthPower << " / 2);\n"
|
<< "\t\t radius = pow(Zeps(radius * radius), " << synthPower << " / 2);\n"
|
||||||
@ -2873,7 +2873,7 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tcase MODE_BLUR_NEW:\n"
|
<< "\t\tcase MODE_BLUR_NEW:\n"
|
||||||
<< "\t\t radius = 0.5 * (MwcNext01(mwc) + MwcNext01(mwc));\n"
|
<< "\t\t radius = 0.5 * (MwcNext01(mwc) + MwcNext01(mwc));\n"
|
||||||
<< "\t\t theta = M_2PI * MwcNext01(mwc) - MPI;\n"
|
<< "\t\t theta = fma(M_2PI, MwcNext01(mwc), -MPI);\n"
|
||||||
<< "\t\t radius = pow(Zeps(SQR(radius)), -" << synthPower << " / 2);\n"
|
<< "\t\t radius = pow(Zeps(SQR(radius)), -" << synthPower << " / 2);\n"
|
||||||
<< "\t\t thetaFactor = SynthValue(&synth, theta);\n"
|
<< "\t\t thetaFactor = SynthValue(&synth, theta);\n"
|
||||||
<< "\t\t radius = Interpolate(radius, thetaFactor, synthSmooth);\n"
|
<< "\t\t radius = Interpolate(radius, thetaFactor, synthSmooth);\n"
|
||||||
@ -2883,7 +2883,7 @@ public:
|
|||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tcase MODE_BLUR_ZIGZAG:\n"
|
<< "\t\tcase MODE_BLUR_ZIGZAG:\n"
|
||||||
<< "\t\t Vy = 1 + 0.1 * (MwcNext01(mwc) + MwcNext01(mwc) - 1) * " << synthPower << ";\n"
|
<< "\t\t Vy = fma((real_t)(0.1), (MwcNext01(mwc) + MwcNext01(mwc) - 1) * " << synthPower << ", (real_t)(1.0));\n"
|
||||||
<< "\t\t theta = 2 * asin((MwcNext01(mwc) - 0.5) * 2);\n"
|
<< "\t\t theta = 2 * asin((MwcNext01(mwc) - 0.5) * 2);\n"
|
||||||
<< "\t\t thetaFactor = SynthValue(&synth, theta);\n"
|
<< "\t\t thetaFactor = SynthValue(&synth, theta);\n"
|
||||||
<< "\t\t Vy = Interpolate(Vy, thetaFactor, synthSmooth);\n"
|
<< "\t\t Vy = Interpolate(Vy, thetaFactor, synthSmooth);\n"
|
||||||
@ -2950,8 +2950,8 @@ public:
|
|||||||
<< "\t\tcase MODE_SINUSOIDAL:\n"
|
<< "\t\tcase MODE_SINUSOIDAL:\n"
|
||||||
<< "\t\t Vx = vIn.x;\n"
|
<< "\t\t Vx = vIn.x;\n"
|
||||||
<< "\t\t Vy = vIn.y;\n"
|
<< "\t\t Vy = vIn.y;\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (SynthValue(&synth, Vx) - 1 + (1 - " << synthMix << ") * sin(Vx));\n"
|
<< "\t\t vOut.x = " << weight << " * fma((real_t)(1.0) - " << synthMix << ", sin(Vx), SynthValue(&synth, Vx) - (real_t)(1.0));\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (SynthValue(&synth, Vy) - 1 + (1 - " << synthMix << ") * sin(Vy));\n"
|
<< "\t\t vOut.y = " << weight << " * fma((real_t)(1.0) - " << synthMix << ", sin(Vy), SynthValue(&synth, Vy) - (real_t)(1.0));\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tcase MODE_SWIRL:\n"
|
<< "\t\tcase MODE_SWIRL:\n"
|
||||||
@ -2959,8 +2959,8 @@ public:
|
|||||||
<< "\t\t Vy = vIn.y;\n"
|
<< "\t\t Vy = vIn.y;\n"
|
||||||
<< "\t\t radius = pow(Zeps(precalcSumSquares), " << synthPower << " / 2);\n"
|
<< "\t\t radius = pow(Zeps(precalcSumSquares), " << synthPower << " / 2);\n"
|
||||||
<< "\t\t SynthSinCos(&synth, radius, &s, &c, synthSmooth);\n"
|
<< "\t\t SynthSinCos(&synth, radius, &s, &c, synthSmooth);\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (s * Vx - c * Vy);\n"
|
<< "\t\t vOut.x = " << weight << " * fma(s, Vx, -(c * Vy));\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (c * Vx + s * Vy);\n"
|
<< "\t\t vOut.y = " << weight << " * fma(c, Vx, s * Vy);\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tcase MODE_HYPERBOLIC:\n"
|
<< "\t\tcase MODE_HYPERBOLIC:\n"
|
||||||
@ -3003,7 +3003,7 @@ public:
|
|||||||
<< "\t\t radius = precalcSqrtSumSquares;\n"
|
<< "\t\t radius = precalcSqrtSumSquares;\n"
|
||||||
<< "\t\t theta = precalcAtanxy;\n"
|
<< "\t\t theta = precalcAtanxy;\n"
|
||||||
<< "\t\t mu = Zeps(SQR(" << synthPower << "));\n"
|
<< "\t\t mu = Zeps(SQR(" << synthPower << "));\n"
|
||||||
<< "\t\t radius += -2 * mu * (int)((radius + mu) / (2 * mu)) + radius * (1 - mu);\n"
|
<< "\t\t radius += fma((real_t)(-2.0) * mu, (real_t)(int)((radius + mu) / (2 * mu)), radius * ((real_t)(1.0) - mu));\n"
|
||||||
<< "\t\t SynthSinCos(&synth, radius, &s, &c, synthSmooth);\n"
|
<< "\t\t SynthSinCos(&synth, radius, &s, &c, synthSmooth);\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * s * theta;\n"
|
<< "\t\t vOut.x = " << weight << " * s * theta;\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * c * theta;\n"
|
<< "\t\t vOut.y = " << weight << " * c * theta;\n"
|
||||||
@ -3019,7 +3019,7 @@ public:
|
|||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tcase MODE_BLUR_RING:\n"
|
<< "\t\tcase MODE_BLUR_RING:\n"
|
||||||
<< "\t\t radius = 1 + 0.1 * (MwcNext01(mwc) + MwcNext01(mwc) - 1) * " << synthPower << ";\n"
|
<< "\t\t radius = fma((real_t)(0.1) * " << synthPower << ", MwcNext01(mwc) + MwcNext01(mwc) - (real_t)(1.0), (real_t)(1.0));\n"
|
||||||
<< "\t\t theta = M_2PI * MwcNext01(mwc) - MPI;\n"
|
<< "\t\t theta = M_2PI * MwcNext01(mwc) - MPI;\n"
|
||||||
<< "\t\t thetaFactor = SynthValue(&synth, theta);\n"
|
<< "\t\t thetaFactor = SynthValue(&synth, theta);\n"
|
||||||
<< "\t\t radius = Interpolate(radius, thetaFactor, synthSmooth);\n"
|
<< "\t\t radius = Interpolate(radius, thetaFactor, synthSmooth);\n"
|
||||||
@ -3029,9 +3029,9 @@ public:
|
|||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tcase MODE_BLUR_RING2:\n"
|
<< "\t\tcase MODE_BLUR_RING2:\n"
|
||||||
<< "\t\t theta = M_2PI * MwcNext01(mwc) - MPI;\n"
|
<< "\t\t theta = fma(M_2PI, MwcNext01(mwc), -MPI);\n"
|
||||||
<< "\t\t radius = pow(Zeps(MwcNext01(mwc)), " << synthPower << ");\n"
|
<< "\t\t radius = pow(Zeps(MwcNext01(mwc)), " << synthPower << ");\n"
|
||||||
<< "\t\t radius = SynthValue(&synth, theta) + 0.1 * radius;\n"
|
<< "\t\t radius = fma((real_t)(0.1), radius, SynthValue(&synth, theta));\n"
|
||||||
<< "\t\t s = sincos(theta, &c);\n"
|
<< "\t\t s = sincos(theta, &c);\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * radius * s;\n"
|
<< "\t\t vOut.x = " << weight << " * radius * s;\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * radius * c;\n"
|
<< "\t\t vOut.y = " << weight << " * radius * c;\n"
|
||||||
@ -3072,7 +3072,7 @@ public:
|
|||||||
<< "\t\t Vx = vIn.x;\n"
|
<< "\t\t Vx = vIn.x;\n"
|
||||||
<< "\t\t Vy = vIn.y;\n"
|
<< "\t\t Vy = vIn.y;\n"
|
||||||
<< "\t\t mu = SynthValue(&synth, Vx) - 1;\n"
|
<< "\t\t mu = SynthValue(&synth, Vx) - 1;\n"
|
||||||
<< "\t\t Vy = 2 * mu - Vy;\n"
|
<< "\t\t Vy = fma((real_t)(2.0), mu, -Vy);\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * Vx;\n"
|
<< "\t\t vOut.x = " << weight << " * Vx;\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * Vy;\n"
|
<< "\t\t vOut.y = " << weight << " * Vy;\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
@ -3082,8 +3082,8 @@ public:
|
|||||||
<< "\t\t Vy = vIn.y;\n"
|
<< "\t\t Vy = vIn.y;\n"
|
||||||
<< "\t\t mu = SynthValue(&synth, Vx) - 1;\n"
|
<< "\t\t mu = SynthValue(&synth, Vx) - 1;\n"
|
||||||
<< "\t\t radius = SynthValue(&synth, Vy) - 1;\n"
|
<< "\t\t radius = SynthValue(&synth, Vy) - 1;\n"
|
||||||
<< "\t\t Vy = 2 * mu - Vy;\n"
|
<< "\t\t Vy = fma((real_t)(2.0), mu, -Vy);\n"
|
||||||
<< "\t\t Vx = 2 * radius - Vx;\n"
|
<< "\t\t Vx = fma((real_t)(2.0), radius, -Vx);\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * Vx;\n"
|
<< "\t\t vOut.x = " << weight << " * Vx;\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * Vy;\n"
|
<< "\t\t vOut.y = " << weight << " * Vy;\n"
|
||||||
<< "\t\t break;\n"
|
<< "\t\t break;\n"
|
||||||
@ -3110,7 +3110,7 @@ public:
|
|||||||
|
|
||||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||||
{
|
{
|
||||||
return vector<string> { "Zeps" };
|
return vector<string> { "Zeps", "Sqr" };
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual string OpenCLFuncsString() const override
|
virtual string OpenCLFuncsString() const override
|
||||||
@ -3201,16 +3201,16 @@ public:
|
|||||||
"{\n"
|
"{\n"
|
||||||
" if (*synth != 0)\n"
|
" if (*synth != 0)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" *z = *phs + theta * *frq;\n"
|
" *z = fma(theta, *frq, *phs);\n"
|
||||||
" *y = *z / M_2PI;\n"
|
" *y = *z / M_2PI;\n"
|
||||||
" *y -= floor(*y);\n"
|
" *y -= floor(*y);\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if (*skew != 0)\n"
|
" if (*skew != 0)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" *z = 0.5 + 0.5 * *skew;\n"
|
" *z = fma(0.5, *skew, 0.5);\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if (*y > *z)\n"
|
" if (*y > *z)\n"
|
||||||
" *y = 0.5 + 0.5 * (*y - *z) / Zeps(1 - *z);\n"
|
" *y = fma((real_t)(0.5), (*y - *z) / Zeps(1 - *z), (real_t)(0.5));\n"
|
||||||
" else\n"
|
" else\n"
|
||||||
" *y = 0.5 - 0.5 * (*z - *y) / Zeps(*z);\n"
|
" *y = 0.5 - 0.5 * (*z - *y) / Zeps(*z);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
@ -3230,13 +3230,13 @@ public:
|
|||||||
" *x = 1 - 2 * *y;\n"
|
" *x = 1 - 2 * *y;\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" case WAVE_TRIANGLE:\n"
|
" case WAVE_TRIANGLE:\n"
|
||||||
" *x = *y > 0.5 ? 3 - 4 * *y : 2 * *y - 1;\n"
|
" *x = *y > 0.5 ? 3 - 4 * *y : fma((real_t)(2.0), *y, -1);\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" case WAVE_CONCAVE:\n"
|
" case WAVE_CONCAVE:\n"
|
||||||
" *x = 8 * (*y - 0.5) * (*y - 0.5) - 1;\n"
|
" *x = fma((real_t)(8.0), Sqr(*y - 0.5), (real_t)(-1.0));\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" case WAVE_CONVEX:\n"
|
" case WAVE_CONVEX:\n"
|
||||||
" *x = 2 * sqrt(*y) - 1;\n"
|
" *x = fma((real_t)(2.0), sqrt(*y), (real_t)(-1.0));\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" case WAVE_NGON:\n"
|
" case WAVE_NGON:\n"
|
||||||
" *y -= 0.5;\n"
|
" *y -= 0.5;\n"
|
||||||
@ -3257,14 +3257,14 @@ public:
|
|||||||
" *thetaFactor += *synth * *x;\n"
|
" *thetaFactor += *synth * *x;\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" case LAYER_MULT:\n"
|
" case LAYER_MULT:\n"
|
||||||
" *thetaFactor *= (1 + *synth * *x);\n"
|
" *thetaFactor *= fma(*synth, *x, (real_t)(1.0));\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" case LAYER_MAX:\n"
|
" case LAYER_MAX:\n"
|
||||||
" *z = *synthA + *synth * *x;\n"
|
" *z = fma(*synth, *x, *synthA);\n"
|
||||||
" *thetaFactor = (*thetaFactor > *z ? *thetaFactor : *z);\n"
|
" *thetaFactor = (*thetaFactor > *z ? *thetaFactor : *z);\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" case LAYER_MIN:\n"
|
" case LAYER_MIN:\n"
|
||||||
" *z = *synthA + *synth * *x;\n"
|
" *z = fma(*synth, *x, *synthA);\n"
|
||||||
" *thetaFactor = (*thetaFactor < *z ? *thetaFactor : *z);\n"
|
" *thetaFactor = (*thetaFactor < *z ? *thetaFactor : *z);\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
@ -3282,7 +3282,7 @@ public:
|
|||||||
" SynthValueProc(&(s->SynthA), &thetaFactor, theta, &(s->SynthE), &(s->SynthEPhs), &(s->SynthEFrq), &(s->SynthESkew), &x, &y, &z, &(s->SynthEType), &(s->SynthELayer));\n"
|
" SynthValueProc(&(s->SynthA), &thetaFactor, theta, &(s->SynthE), &(s->SynthEPhs), &(s->SynthEFrq), &(s->SynthESkew), &x, &y, &z, &(s->SynthEType), &(s->SynthELayer));\n"
|
||||||
" SynthValueProc(&(s->SynthA), &thetaFactor, theta, &(s->SynthF), &(s->SynthFPhs), &(s->SynthFFrq), &(s->SynthFSkew), &x, &y, &z, &(s->SynthFType), &(s->SynthFLayer));\n"
|
" SynthValueProc(&(s->SynthA), &thetaFactor, theta, &(s->SynthF), &(s->SynthFPhs), &(s->SynthFFrq), &(s->SynthFSkew), &x, &y, &z, &(s->SynthFType), &(s->SynthFLayer));\n"
|
||||||
"\n"
|
"\n"
|
||||||
" return thetaFactor * s->SynthMix + (1 - s->SynthMix);\n"
|
" return fma(thetaFactor, s->SynthMix, (1 - s->SynthMix));\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"static real_t BezierQuadMap(real_t x, real_t m)\n"
|
"static real_t BezierQuadMap(real_t x, real_t m)\n"
|
||||||
@ -3308,9 +3308,9 @@ public:
|
|||||||
" t = x;\n"
|
" t = x;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if (fabs(m - 0.5) > 1e-10)\n"
|
" if (fabs(m - 0.5) > 1e-10)\n"
|
||||||
" t = (-1 * m + sqrt(m * m + (1 - 2 * m) * x)) / (1 - 2 * m);\n"
|
" t = fma((real_t)(-1.0), m, sqrt(fma(m, m, (1 - 2 * m) * x))) / (1 - 2 * m);\n"
|
||||||
"\n"
|
"\n"
|
||||||
" return a * (x + (m - 1) * t * t);\n"
|
" return a * fma(m - (real_t)(1.0), SQR(t), x);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if ((1 < m) && (x <= 1))\n"
|
" if ((1 < m) && (x <= 1))\n"
|
||||||
@ -3318,19 +3318,19 @@ public:
|
|||||||
" t = x;\n"
|
" t = x;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if (fabs(m - 2) > 1e-10)\n"
|
" if (fabs(m - 2) > 1e-10)\n"
|
||||||
" t = (-1 * iM + sqrt(iM * iM + (1 - 2 * iM) * x)) / (1 - 2 * iM);\n"
|
" t = fma((real_t)(-1.0), iM, sqrt(fma(iM, iM, (1 - 2 * iM) * x))) / (1 - 2 * iM);\n"
|
||||||
"\n"
|
"\n"
|
||||||
" return a * (x + (m - 1) * t * t);\n"
|
" return a * fma(m - (real_t)(1.0), SQR(t), x);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if (m < 1)\n"
|
" if (m < 1)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" t = sqrt((x - 1) / (L - 1));\n"
|
" t = sqrt((x - 1) / (L - 1));\n"
|
||||||
" return a * (x + (m - 1) * t * t + 2 * (1 - m) * t + (m - 1));\n"
|
" return a * fma((m - 1), t * t, x + fma((real_t)(2.0), (1 - m) * t, (m - 1)));\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" t = (1 - m) + sqrt((m - 1) * (m - 1) + (x - 1));\n"
|
" t = (1 - m) + sqrt(fma((m - 1), (m - 1), (x - 1)));\n"
|
||||||
" return a * (x + (m - 1) * t * t - 2 * (m - 1) * t + (m - 1));\n"
|
" return a * fma((m - 1), t * t, x - fma((real_t)(2.0), (m - 1) * t, (m - 1)));\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"static real_t Interpolate(real_t x, real_t m, int lerpType)\n"
|
"static real_t Interpolate(real_t x, real_t m, int lerpType)\n"
|
||||||
@ -3357,8 +3357,8 @@ public:
|
|||||||
" *c = *c * SynthValue(synth, theta + MPI / 2);\n"
|
" *c = *c * SynthValue(synth, theta + MPI / 2);\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" case SINCOS_MIXIN:\n"
|
" case SINCOS_MIXIN:\n"
|
||||||
" *s = (1 - synth->SynthMix) * *s + (SynthValue(synth, theta) - 1);\n"
|
" *s = fma(((real_t)(1.0) - synth->SynthMix), *s, (SynthValue(synth, theta) - 1));\n"
|
||||||
" *c = (1 - synth->SynthMix) * *c + (SynthValue(synth, theta + MPI / 2) - 1);\n"
|
" *c = fma(((real_t)(1.0) - synth->SynthMix), *c, (SynthValue(synth, theta + MPI / 2) - 1));\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -3789,11 +3789,11 @@ public:
|
|||||||
" e.x = x * 2.5;\n"
|
" e.x = x * 2.5;\n"
|
||||||
" e.y = y * 2.5;\n"
|
" e.y = y * 2.5;\n"
|
||||||
" e.z = z * 2.5;\n"
|
" e.z = z * 2.5;\n"
|
||||||
" f.x = y * 2.5 + 30.2;\n"
|
" f.x = fma((real_t)y, (real_t)(2.5), (real_t)( 30.2));\n"
|
||||||
" f.y = x * 2.5 - 12.1;\n"
|
" f.y = fma((real_t)x, (real_t)(2.5), (real_t)(-12.1));\n"
|
||||||
" f.z = z * 2.5 + 19.8;\n"
|
" f.z = fma(z, (real_t)(2.5), (real_t)(19.8));\n"
|
||||||
" (*v).x = (x + d * SimplexNoise3D(&e, p, grad)) * s;\n"
|
" (*v).x = fma(d, SimplexNoise3D(&e, p, grad), (real_t)y) * s;\n"
|
||||||
" (*v).y = (y + d * SimplexNoise3D(&f, p, grad)) * s;\n"
|
" (*v).y = fma(d, SimplexNoise3D(&f, p, grad), (real_t)x) * s;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n";
|
"\n";
|
||||||
@ -4492,7 +4492,7 @@ public:
|
|||||||
intmax_t varIndex = IndexInXform();
|
intmax_t varIndex = IndexInXform();
|
||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t r2 = Sqr(sqrt(precalcSumSquares + SQR(vIn.z)));\n"
|
<< "\t\treal_t r2 = Sqr(sqrt(fma(vIn.z, vIn.z, precalcSumSquares)));\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (fabs(vIn.x) >= 2 ? vIn.x / r2 : erf(vIn.x));\n"
|
<< "\t\tvOut.x = " << weight << " * (fabs(vIn.x) >= 2 ? vIn.x / r2 : erf(vIn.x));\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (fabs(vIn.y) >= 2 ? vIn.y / r2 : erf(vIn.y));\n"
|
<< "\t\tvOut.y = " << weight << " * (fabs(vIn.y) >= 2 ? vIn.y / r2 : erf(vIn.y));\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * (fabs(vIn.z) >= 2 ? vIn.z / r2 : erf(vIn.z));\n"
|
<< "\t\tvOut.z = " << weight << " * (fabs(vIn.z) >= 2 ? vIn.z / r2 : erf(vIn.z));\n"
|
||||||
@ -4669,14 +4669,14 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
|
<< "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(fma(" << hypergonD << ", " << hypergonD << ", -temp2))) / sqrt(temp2);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << star << "!= 0)\n"
|
<< "\t\tif (" << star << "!= 0)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), (real_t)M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), (real_t)M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
||||||
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * fma(temp1, temp1, (real_t)(1.0)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << lituus << " != 0)\n"
|
<< "\t\tif (" << lituus << " != 0)\n"
|
||||||
@ -4696,7 +4696,8 @@ public:
|
|||||||
<< "\t\t if (" << hypergon << " != 0.0)\n"
|
<< "\t\t if (" << hypergon << " != 0.0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t temp1 = fmod(fabs(a2), (real_t)M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
|
<< "\t\t temp1 = fmod(fabs(a2), (real_t)M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
|
||||||
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
|
<< "\t\t real_t tantemp = tan(temp1);\n"
|
||||||
|
<< "\t\t temp2 = fma(tantemp, tantemp, (real_t)(1.0));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
|
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
@ -4704,14 +4705,14 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t total2 += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
|
<< "\t\t total2 += " << hypergon << " * (" << hypergonD << " - sqrt(fma(" << hypergonD << ", " << hypergonD << ", -temp2))) / sqrt(temp2);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (" << star << " != 0)\n"
|
<< "\t\t if (" << star << " != 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t temp1 = tan(fabs(fmod(fabs(a2), (real_t)M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
<< "\t\t temp1 = tan(fabs(fmod(fabs(a2), (real_t)M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
||||||
<< "\t\t total2 += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
<< "\t\t total2 += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * fma(temp1, temp1, (real_t)(1.0)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (" << lituus << " != 0)\n"
|
<< "\t\t if (" << lituus << " != 0)\n"
|
||||||
@ -4903,7 +4904,8 @@ public:
|
|||||||
<< "\t\tif (" << hypergon << " != 0)\n"
|
<< "\t\tif (" << hypergon << " != 0)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
|
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
|
||||||
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
|
<< "\t\treal_t tantemp = tan(temp1);\n"
|
||||||
|
<< "\t\t temp2 = fma(tantemp, tantemp, (real_t)(1.0));\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
|
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
@ -4911,14 +4913,14 @@ public:
|
|||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
|
<< "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(fma(" << hypergonD << ", " << hypergonD << ", -temp2))) / sqrt(temp2);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << star << " != 0)\n"
|
<< "\t\tif (" << star << " != 0)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
||||||
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * fma(temp1, temp1, (real_t)(1.0)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << lituus << " != 0)\n"
|
<< "\t\tif (" << lituus << " != 0)\n"
|
||||||
@ -4933,7 +4935,7 @@ public:
|
|||||||
<< "\t\t total += " << super << " * pow(pow(fabs(c), " << superN2 << ") + pow(fabs(s), " << superN3 << "), " << oneOverSuperN1 << ");\n"
|
<< "\t\t total += " << super << " * pow(pow(fabs(c), " << superN2 << ") + pow(fabs(s), " << superN3 << "), " << oneOverSuperN1 << ");\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tr = " << weight << " * sqrt(precalcSumSquares + Sqr(total));\n"
|
<< "\t\tr = " << weight << " * sqrt(fma(total, total, precalcSumSquares));\n"
|
||||||
<< "\t\ts = sincos(a, &c);\n"
|
<< "\t\ts = sincos(a, &c);\n"
|
||||||
<< "\t\tvOut.x = r * c;\n"
|
<< "\t\tvOut.x = r * c;\n"
|
||||||
<< "\t\tvOut.y = r * s;\n"
|
<< "\t\tvOut.y = r * s;\n"
|
||||||
@ -5030,14 +5032,15 @@ public:
|
|||||||
{
|
{
|
||||||
temp1 = fmod(std::abs(a), M_2PI / m_HypergonN) - T(M_PI) / m_HypergonN;
|
temp1 = fmod(std::abs(a), M_2PI / m_HypergonN) - T(M_PI) / m_HypergonN;
|
||||||
temp2 = Sqr(std::tan(temp1)) + 1;
|
temp2 = Sqr(std::tan(temp1)) + 1;
|
||||||
|
auto hd2 = SQR(m_HypergonD);
|
||||||
|
|
||||||
if (temp2 >= Sqr(m_HypergonD))
|
if (temp2 >= hd2)
|
||||||
{
|
{
|
||||||
total += m_Hypergon;
|
total += m_Hypergon;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
total += m_Hypergon * (m_HypergonD - std::sqrt(Sqr(m_HypergonD) - temp2)) / std::sqrt(temp2);
|
total += m_Hypergon * (m_HypergonD - std::sqrt(hd2 - temp2)) / std::sqrt(temp2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5102,21 +5105,22 @@ public:
|
|||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
|
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
|
||||||
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
|
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
|
||||||
|
<< "\t\t real_t hd2 = SQR(" << hypergonD << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
|
<< "\t\t if (temp2 >= hd2)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t total += " << hypergon << ";\n"
|
<< "\t\t total += " << hypergon << ";\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
|
<< "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(hd2 - temp2)) / sqrt(temp2);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << star << " != 0)\n"
|
<< "\t\tif (" << star << " != 0)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
||||||
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * fma(temp1, temp1, (real_t)(1.0)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << lituus << " != 0)\n"
|
<< "\t\tif (" << lituus << " != 0)\n"
|
||||||
@ -5228,14 +5232,15 @@ public:
|
|||||||
{
|
{
|
||||||
temp1 = fmod(std::abs(a), M_2PI / m_HypergonN) - T(M_PI) / m_HypergonN;
|
temp1 = fmod(std::abs(a), M_2PI / m_HypergonN) - T(M_PI) / m_HypergonN;
|
||||||
temp2 = Sqr(std::tan(temp1)) + 1;
|
temp2 = Sqr(std::tan(temp1)) + 1;
|
||||||
|
auto hd2 = SQR(m_HypergonD);
|
||||||
|
|
||||||
if (temp2 >= Sqr(m_HypergonD))
|
if (temp2 >= hd2)
|
||||||
{
|
{
|
||||||
total += m_Hypergon;
|
total += m_Hypergon;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
total += m_Hypergon * (m_HypergonD - std::sqrt(Sqr(m_HypergonD) - temp2)) / std::sqrt(temp2);
|
total += m_Hypergon * (m_HypergonD - std::sqrt(hd2 - temp2)) / std::sqrt(temp2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5301,21 +5306,22 @@ public:
|
|||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
|
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
|
||||||
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
|
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
|
||||||
|
<< "\t\t real_t hd2 = SQR(" << hypergonD << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
|
<< "\t\t if (temp2 >= hd2)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t total += " << hypergon << ";\n"
|
<< "\t\t total += " << hypergon << ";\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
|
<< "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(hd2 - temp2)) / sqrt(temp2);\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << star << " != 0)\n"
|
<< "\t\tif (" << star << " != 0)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - MPI / " << starN << "));\n"
|
||||||
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * fma(temp1, temp1, (real_t)(1.0)) / Sqr(temp1 + " << tanStarSlope << "));\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << lituus << " != 0)\n"
|
<< "\t\tif (" << lituus << " != 0)\n"
|
||||||
|
@ -170,30 +170,30 @@ public:
|
|||||||
<< "\t\treal_t CsX = 1;\n"
|
<< "\t\treal_t CsX = 1;\n"
|
||||||
<< "\t\treal_t CsY = 1;\n"
|
<< "\t\treal_t CsY = 1;\n"
|
||||||
<< "\t\treal_t jcbSn = 0, jcbCn, jcbDn;\n"
|
<< "\t\treal_t jcbSn = 0, jcbCn, jcbDn;\n"
|
||||||
<< "\t\tCsX = SafeDivInv(" << unity << ", (" << unity << " + Sqr(vIn.x)));\n"
|
<< "\t\tCsX = SafeDivInv(" << unity << ", fma(vIn.x, vIn.x, " << unity << "));\n"
|
||||||
<< "\t\tCsX = CsX * " << six << " + " << scaleinfx << ";\n"
|
<< "\t\tCsX = fma(CsX, " << six << ", " << scaleinfx << ");\n"
|
||||||
<< "\t\tCsY = SafeDivInv(" << unity << ", (" << unity << " + Sqr(vIn.y)));\n"
|
<< "\t\tCsY = SafeDivInv(" << unity << ", fma(vIn.y, vIn.y, " << unity << "));\n"
|
||||||
<< "\t\tCsY = CsY * " << siy << " + " << scaleinfy << ";\n"
|
<< "\t\tCsY = fma(CsY, " << siy << ", " << scaleinfy << ");\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << pwx << " >= 0 && " << pwx << " < 1e-4)\n"
|
<< "\t\tif (" << pwx << " >= 0 && " << pwx << " < 1e-4)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t JacobiElliptic(vIn.y * " << freqx << ", " << jacok << ", &jcbSn, &jcbCn, &jcbDn);\n"
|
<< "\t\t JacobiElliptic(vIn.y * " << freqx << ", " << jacok << ", &jcbSn, &jcbCn, &jcbDn);\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (vIn.x + CsX * jcbSn);\n"
|
<< "\t\t vOut.x = " << weight << " * fma(CsX, jcbSn, vIn.x);\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
//<< "\t\telse if (" << pwx << " < 0 && " << pwx << " > -1e-4)\n"
|
//<< "\t\telse if (" << pwx << " < 0 && " << pwx << " > -1e-4)\n"
|
||||||
//<< "\t\t vOut.x = " << weight << " * (vIn.x + CsX * _j1(vIn.y * " << freqx << "));\n"//This is not implemented in OpenCL.
|
//<< "\t\t vOut.x = " << weight << " * (vIn.x + CsX * _j1(vIn.y * " << freqx << "));\n"//This is not implemented in OpenCL.
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * (vIn.x + CsX * sin(SignNz(vIn.y) * pow(Zeps(fabs(vIn.y)), " << pwx << ") * " << freqx << "));\n"
|
<< "\t\t vOut.x = " << weight << " * fma(CsX, sin(SignNz(vIn.y) * pow(Zeps(fabs(vIn.y)), " << pwx << ") * " << freqx << "), vIn.x);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << pwy << " >= 0 && " << pwy << " < 1e-4)\n"
|
<< "\t\tif (" << pwy << " >= 0 && " << pwy << " < 1e-4)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t JacobiElliptic(vIn.x * " << freqy << ", " << jacok << ", &jcbSn, &jcbCn, &jcbDn);\n"
|
<< "\t\t JacobiElliptic(vIn.x * " << freqy << ", " << jacok << ", &jcbSn, &jcbCn, &jcbDn);\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (vIn.y + CsY * jcbSn);\n"
|
<< "\t\t vOut.y = " << weight << " * fma(CsY, jcbSn, vIn.y);\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
//<< "\t\telse if (" << pwy << " < 0 && " << pwy << " > -1e-4)\n"
|
//<< "\t\telse if (" << pwy << " < 0 && " << pwy << " > -1e-4)\n"
|
||||||
//<< "\t\t vOut.y = " << weight << " * (vIn.y + CsY * _j1(vIn.x * " << freqy << "));\n"//This is not implemented in OpenCL.
|
//<< "\t\t vOut.y = " << weight << " * (vIn.y + CsY * _j1(vIn.x * " << freqy << "));\n"//This is not implemented in OpenCL.
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t vOut.y = " << weight << " * (vIn.y + CsY * sin(SignNz(vIn.x) * pow(Zeps(fabs(vIn.x)), " << pwy << ") * " << freqy << "));\n"
|
<< "\t\t vOut.y = " << weight << " * fma(CsY, sin(SignNz(vIn.x) * pow(Zeps(fabs(vIn.x)), " << pwy << ") * " << freqy << "), vIn.y);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -291,7 +291,7 @@ public:
|
|||||||
<< "\t\tJacobiElliptic(vIn.y, 1 - " << k << ", &sny, &cny, &dny);\n"
|
<< "\t\tJacobiElliptic(vIn.y, 1 - " << k << ", &sny, &cny, &dny);\n"
|
||||||
<< "\t\tnumX = cnx * cny;\n"
|
<< "\t\tnumX = cnx * cny;\n"
|
||||||
<< "\t\tnumY = -dnx * snx * dny * sny;\n"
|
<< "\t\tnumY = -dnx * snx * dny * sny;\n"
|
||||||
<< "\t\tdenom = SQR(snx) * SQR(sny) * " << k << " + SQR(cny);\n"
|
<< "\t\tdenom = fma(SQR(snx) * SQR(sny), " << k << ", SQR(cny));\n"
|
||||||
<< "\t\tdenom = " << weight << " / Zeps(denom);\n"
|
<< "\t\tdenom = " << weight << " / Zeps(denom);\n"
|
||||||
<< "\t\tvOut.x = denom * numX;\n"
|
<< "\t\tvOut.x = denom * numX;\n"
|
||||||
<< "\t\tvOut.y = denom * numY;\n"
|
<< "\t\tvOut.y = denom * numY;\n"
|
||||||
@ -363,7 +363,7 @@ public:
|
|||||||
<< "\t\tJacobiElliptic(vIn.y, 1 - " << k << ", &sny, &cny, &dny);\n"
|
<< "\t\tJacobiElliptic(vIn.y, 1 - " << k << ", &sny, &cny, &dny);\n"
|
||||||
<< "\t\tnumX = dnx * cny * dny;\n"
|
<< "\t\tnumX = dnx * cny * dny;\n"
|
||||||
<< "\t\tnumY = -cnx * snx * sny * " << k << ";\n"
|
<< "\t\tnumY = -cnx * snx * sny * " << k << ";\n"
|
||||||
<< "\t\tdenom = SQR(snx) * SQR(sny) * " << k << " + SQR(cny);\n"
|
<< "\t\tdenom = fma(SQR(snx) * SQR(sny), " << k << ", SQR(cny));\n"
|
||||||
<< "\t\tdenom = " << weight << " / Zeps(denom);\n"
|
<< "\t\tdenom = " << weight << " / Zeps(denom);\n"
|
||||||
<< "\t\tvOut.x = denom * numX;\n"
|
<< "\t\tvOut.x = denom * numX;\n"
|
||||||
<< "\t\tvOut.y = denom * numY;\n"
|
<< "\t\tvOut.y = denom * numY;\n"
|
||||||
@ -435,7 +435,7 @@ public:
|
|||||||
<< "\t\tJacobiElliptic(vIn.y, 1 - " << k << ", &sny, &cny, &dny);\n"
|
<< "\t\tJacobiElliptic(vIn.y, 1 - " << k << ", &sny, &cny, &dny);\n"
|
||||||
<< "\t\tnumX = snx * dny;\n"
|
<< "\t\tnumX = snx * dny;\n"
|
||||||
<< "\t\tnumY = cnx * dnx * cny * sny;\n"
|
<< "\t\tnumY = cnx * dnx * cny * sny;\n"
|
||||||
<< "\t\tdenom = SQR(snx) * SQR(sny) * " << k << " + SQR(cny);\n"
|
<< "\t\tdenom = fma(SQR(snx) * SQR(sny), " << k << ", SQR(cny));\n"
|
||||||
<< "\t\tdenom = " << weight << " / Zeps(denom);\n"
|
<< "\t\tdenom = " << weight << " / Zeps(denom);\n"
|
||||||
<< "\t\tvOut.x = denom * numX;\n"
|
<< "\t\tvOut.x = denom * numX;\n"
|
||||||
<< "\t\tvOut.y = denom * numY;\n"
|
<< "\t\tvOut.y = denom * numY;\n"
|
||||||
@ -492,8 +492,8 @@ public:
|
|||||||
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x + (1 / Zeps(" << x << " * M_2PI)) * sin(" << x << " * M_2PI * vIn.x));\n"
|
<< "\t\tvOut.x = " << weight << " * fma((1 / Zeps(" << x << " * M_2PI)), sin(" << x << " * M_2PI * vIn.x), vIn.x);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (vIn.y + (1 / Zeps(" << y << " * M_2PI)) * sin(" << y << " * M_2PI * vIn.y));\n"
|
<< "\t\tvOut.y = " << weight << " * fma((1 / Zeps(" << y << " * M_2PI)), sin(" << y << " * M_2PI * vIn.y), vIn.y);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -694,61 +694,64 @@ public:
|
|||||||
<< "\t\t posNeg = -1;\n"
|
<< "\t\t posNeg = -1;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tpang = th / Zeps(" << cycle << ");\n"
|
<< "\t\tpang = th / Zeps(" << cycle << ");\n"
|
||||||
<< "\t\twig = pang * " << freq << " * 0.5 + " << offset << " * " << cycle << ";\n"
|
<< "\t\twig = fma(pang, " << freq << " * 0.5, " << offset << " * " << cycle << ");\n"
|
||||||
|
<< "\t\treal_t rad04 = (real_t)(0.4) * rad;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << optDir << " < 0)\n"
|
<< "\t\tif (" << optDir << " < 0)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t wag = sin(curve1 * MPI * " << absOptSc << ") + " << wagsc << " * 0.4 * rad + " << crvsc << " * 0.5 * (sin(curveTwo * MPI));\n"
|
<< "\t\t wag = sin(curve1* MPI * " << absOptSc << ") + fma(" << wagsc << ", rad04, " << crvsc << " * 0.5 * sin(curveTwo * MPI)); \n"
|
||||||
<< "\t\t wag3 = sin(curve4 * MPI * " << absOptSc << ") + " << wagsc << " * SQR(rad) * 0.4 + " << crvsc << " * 0.5 * (cos(curve3 * MPI));\n"
|
<< "\t\t wag3 = sin(curve4* MPI * " << absOptSc << ") + fma(" << wagsc << ", SQR(rad) * (real_t)(0.4), " << crvsc << " * 0.5 * cos(curve3 * MPI)); \n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t wag = sin(curve1 * MPI * " << absOptSc << ") + " << wagsc << " * 0.4 * rad + " << crvsc << " * 0.5 * (cos(curve3 * MPI));\n"
|
<< "\t\t wag = sin(curve1* MPI * " << absOptSc << ") + fma(" << wagsc << ", rad04, " << crvsc << " * 0.5 * cos(curve3 * MPI)); \n"
|
||||||
<< "\t\t wag3 = sin(curve4 * MPI * " << absOptSc << ") + " << wagsc << " * SQR(rad) * 0.4 + " << crvsc << " * 0.5 * (sin(curveTwo * MPI));\n"
|
<< "\t\t wag3 = sin(curve4* MPI * " << absOptSc << ") + fma(" << wagsc << ", SQR(rad) * (real_t)(0.4), " << crvsc << " * 0.5 * sin(curveTwo * MPI)); \n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\twag2 = sin(curveTwo * MPI * " << absOptSc << ") + " << wagsc << " * 0.4 * rad + " << crvsc << " * 0.5 * (cos(curve3 * MPI));\n"
|
<< "\t\twag2 = sin(curveTwo * MPI * " << absOptSc << ") + fma(" << wagsc << ", rad04, " << crvsc << " * 0.5 * cos(curve3 * MPI)); \n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << smooth12 << " <= 1)\n"
|
<< "\t\tif (" << smooth12 << " <= 1)\n"
|
||||||
<< "\t\t wag12 = wag; \n"
|
<< "\t\t wag12 = wag; \n"
|
||||||
<< "\t\telse if (" << smooth12 << " <= 2 && " << smooth12 << " > 1)\n"
|
<< "\t\telse if (" << smooth12 << " <= 2 && " << smooth12 << " > 1)\n"
|
||||||
<< "\t\t wag12 = wag2 * (1 - " << antiOpt1 << ") + wag * " << antiOpt1 << ";\n"
|
<< "\t\t wag12 = fma(wag2, (1 - " << antiOpt1 << "), wag * " << antiOpt1 << "); \n"
|
||||||
<< "\t\telse if (" << smooth12 << " > 2)\n"
|
<< "\t\telse if (" << smooth12 << " > 2)\n"
|
||||||
<< "\t\t wag12 = wag2; \n"
|
<< "\t\t wag12 = wag2; \n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << smooth3 << " == 0)\n"
|
<< "\t\tif (" << smooth3 << " == 0)\n"
|
||||||
<< "\t\t waggle = wag12; \n"
|
<< "\t\t waggle = wag12; \n"
|
||||||
<< "\t\telse if (" << smooth3 << " > 0)\n"
|
<< "\t\telse if (" << smooth3 << " > 0)\n"
|
||||||
<< "\t\t waggle = wag12 * (1 - " << smooth3 << ") + wag3 * " << smooth3 << ";\n"
|
<< "\t\t waggle = fma(wag12, (1 - " << smooth3 << "), wag3 * " << smooth3 << "); \n"
|
||||||
|
<< "\n"
|
||||||
|
<< "\t\treal_t cospetthcl = " << weight << " * (real_t)(0.5) * " << "cos(fma(" << numPetals << ", th, " << c << ")) * " << l << "; \n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (MwcNext01(mwc) < " << ghost << ")\n"
|
<< "\t\tif (MwcNext01(mwc) < " << ghost << ")\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t if (posNeg < 0)\n"
|
<< "\t\t if (posNeg < 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * 0.5 * " << refSc << " * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * cth;\n"
|
<< "\t\t vOut.x = " << refSc << "* cospetthcl * cth; \n"
|
||||||
<< "\t\t vOut.y = " << weight << " * 0.5 * " << refSc << " * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * sth;\n"
|
<< "\t\t vOut.y = " << refSc << "* cospetthcl * sth; \n"
|
||||||
<< "\t\t vOut.z = " << weight << " * -0.5 * ((" << z2 << " * waggle + Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << ");\n"
|
<< "\t\t vOut.z = " << weight << " * -0.5 * (fma(" << z2 << ", waggle, Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << "); \n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * cth;\n"
|
<< "\t\t vOut.x = cospetthcl * cth; \n"
|
||||||
<< "\t\t vOut.y = " << weight << " * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * sth;\n"
|
<< "\t\t vOut.y = cospetthcl * sth; \n"
|
||||||
<< "\t\t vOut.z = " << weight << " * 0.5 * ((" << z1 << " * waggle + Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << ");\n"
|
<< "\t\t vOut.z = " << weight << " * 0.5 * (fma(" << z1 << ", waggle, Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << "); \n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t\telse\n"
|
<< "\t\telse\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t if (posNeg < 0)\n"
|
<< "\t\t if (posNeg < 0)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * cth;\n"
|
<< "\t\t vOut.x = cospetthcl * cth; \n"
|
||||||
<< "\t\t vOut.y = " << weight << " * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * sth;\n"
|
<< "\t\t vOut.y = cospetthcl * sth; \n"
|
||||||
<< "\t\t vOut.z = " << weight << " * 0.5 * ((" << z1 << " * waggle + Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << ");\n"
|
<< "\t\t vOut.z = " << weight << " * 0.5 * (fma(" << z1 << ", waggle, Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << "); \n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t vOut.x = " << weight << " * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * cth;\n"
|
<< "\t\t vOut.x = cospetthcl * cth; \n"
|
||||||
<< "\t\t vOut.y = " << weight << " * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * sth;\n"
|
<< "\t\t vOut.y = cospetthcl * sth; \n"
|
||||||
<< "\t\t vOut.z = " << weight << " * 0.5 * ((" << z1 << " * waggle + Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << ");\n"
|
<< "\t\t vOut.z = " << weight << " * 0.5 * (fma(" << z1 << ", waggle, Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << "); \n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -1067,7 +1070,7 @@ public:
|
|||||||
string weight = WeightDefineString();
|
string weight = WeightDefineString();
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x / Zeps(sqrt(SQR(vIn.x) + (real_t)1.0)));\n"
|
<< "\t\tvOut.x = " << weight << " * (vIn.x / Zeps(sqrt(fma(vIn.x, vIn.x, (real_t)1.0))));\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * vIn.y;\n"
|
<< "\t\tvOut.y = " << weight << " * vIn.y;\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -1297,10 +1300,10 @@ public:
|
|||||||
<< "\t\t\t\txrand = Round(fabs(xrand)) * " << seed2 << ";\n"
|
<< "\t\t\t\txrand = Round(fabs(xrand)) * " << seed2 << ";\n"
|
||||||
<< "\t\t\t\tyrand = Round(fabs(yrand)) * " << seed2 << ";\n"
|
<< "\t\t\t\tyrand = Round(fabs(yrand)) * " << seed2 << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t\t\treal_t niter = xrand + yrand + (xrand * yrand);\n"
|
<< "\t\t\t\treal_t niter = fma(xrand, yrand, xrand + yrand);\n"
|
||||||
<< "\t\t\t\treal_t randint = (" << seed << " + niter) * " << seed2 << " * ((real_t) 0.5);\n"
|
<< "\t\t\t\treal_t randint = (" << seed << " + niter) * " << seed2 << " * ((real_t) 0.5);\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\t\t\trandint = fmod((randint * multiplier + offset), modbase);\n"
|
<< "\t\t\t\trandint = fmod(fma(randint, multiplier, offset), modbase);\n"
|
||||||
<< "\t\t\t\ttiletype = fmod(randint, 2);\n"
|
<< "\t\t\t\ttiletype = fmod(randint, 2);\n"
|
||||||
<< "\t\t\t}\n"
|
<< "\t\t\t}\n"
|
||||||
<< "\t\t}\n"
|
<< "\t\t}\n"
|
||||||
@ -1442,8 +1445,8 @@ public:
|
|||||||
<< "\t\treal_t factor = (dist < " << distance << ") ? (dist - " << nullVar << ") / Zeps(" << distance << "-" << nullVar << ") : (real_t)(1.0);\n"
|
<< "\t\treal_t factor = (dist < " << distance << ") ? (dist - " << nullVar << ") / Zeps(" << distance << "-" << nullVar << ") : (real_t)(1.0);\n"
|
||||||
<< "\t\tfactor = (dist < " << nullVar << ") ? (real_t) 0.0 : factor;\n"
|
<< "\t\tfactor = (dist < " << nullVar << ") ? (real_t) 0.0 : factor;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (x0 + factor * sin(y0 * " << freqX << ") * " << scaleX << ");\n"
|
<< "\t\tvOut.x = " << weight << " * fma(factor * " << scaleX << ", sin(y0 * " << freqX << "), x0);\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (y0 + factor * sin(x0 * " << freqY << ") * " << scaleY << ");\n"
|
<< "\t\tvOut.y = " << weight << " * fma(factor * " << scaleY << ", sin(x0 * " << freqY << "), y0);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -1494,7 +1497,7 @@ public:
|
|||||||
T aux = 1 / std::sqrt(helper.m_PrecalcSumSquares + 1);
|
T aux = 1 / std::sqrt(helper.m_PrecalcSumSquares + 1);
|
||||||
T x1 = helper.m_TransX * aux;
|
T x1 = helper.m_TransX * aux;
|
||||||
T y1 = helper.m_TransY * aux;
|
T y1 = helper.m_TransY * aux;
|
||||||
aux = std::sqrt(x1 * x1 + y1 * y1);
|
aux = std::sqrt(x1 * x1 + SQR(y1));
|
||||||
helper.Out.x = m_Weight * std::atan2(x1, y1) * T(M_1_PI);
|
helper.Out.x = m_Weight * std::atan2(x1, y1) * T(M_1_PI);
|
||||||
helper.Out.y = m_Weight * (aux - T(0.5));
|
helper.Out.y = m_Weight * (aux - T(0.5));
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
@ -1511,7 +1514,7 @@ public:
|
|||||||
<< "\t\treal_t aux = 1.0 / sqrt(precalcSumSquares + 1);\n"
|
<< "\t\treal_t aux = 1.0 / sqrt(precalcSumSquares + 1);\n"
|
||||||
<< "\t\treal_t x1 = transX * aux;\n"
|
<< "\t\treal_t x1 = transX * aux;\n"
|
||||||
<< "\t\treal_t y1 = transY * aux;\n"
|
<< "\t\treal_t y1 = transY * aux;\n"
|
||||||
<< "\t\taux = sqrt(x1 * x1 + y1 * y1);\n"
|
<< "\t\taux = sqrt(fma(x1, x1, SQR(y1)));\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * atan2(x1, y1) * M1PI;\n"
|
<< "\t\tvOut.x = " << weight << " * atan2(x1, y1) * M1PI;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (aux - 0.5);\n"
|
<< "\t\tvOut.y = " << weight << " * (aux - 0.5);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
@ -1538,7 +1541,7 @@ public:
|
|||||||
T aux = 1 / (helper.m_PrecalcSqrtSumSquares + 1);
|
T aux = 1 / (helper.m_PrecalcSqrtSumSquares + 1);
|
||||||
T x1 = helper.m_TransX * aux;
|
T x1 = helper.m_TransX * aux;
|
||||||
T y1 = helper.m_TransY * aux;
|
T y1 = helper.m_TransY * aux;
|
||||||
aux = std::sqrt(x1 * x1 + y1 * y1);
|
aux = std::sqrt(x1 * x1 + SQR(y1));
|
||||||
helper.Out.x = m_Weight * std::atan2(x1, y1) * T(M_1_PI);
|
helper.Out.x = m_Weight * std::atan2(x1, y1) * T(M_1_PI);
|
||||||
helper.Out.y = m_Weight * (aux - T(0.5));
|
helper.Out.y = m_Weight * (aux - T(0.5));
|
||||||
helper.Out.z = DefaultZ(helper);
|
helper.Out.z = DefaultZ(helper);
|
||||||
@ -1555,7 +1558,7 @@ public:
|
|||||||
<< "\t\treal_t aux = 1.0 / (precalcSqrtSumSquares + 1);\n"
|
<< "\t\treal_t aux = 1.0 / (precalcSqrtSumSquares + 1);\n"
|
||||||
<< "\t\treal_t x1 = transX * aux;\n"
|
<< "\t\treal_t x1 = transX * aux;\n"
|
||||||
<< "\t\treal_t y1 = transY * aux;\n"
|
<< "\t\treal_t y1 = transY * aux;\n"
|
||||||
<< "\t\taux = sqrt(x1 * x1 + y1 * y1);\n"
|
<< "\t\taux = sqrt(fma(x1, x1, SQR(y1)));\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * atan2(x1, y1) * M1PI;\n"
|
<< "\t\tvOut.x = " << weight << " * atan2(x1, y1) * M1PI;\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (aux - 0.5);\n"
|
<< "\t\tvOut.y = " << weight << " * (aux - 0.5);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
@ -1644,7 +1647,7 @@ public:
|
|||||||
string freq = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string freq = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
string freq2pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string freq2pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t temp = vIn.z * " << freq2pi << " + precalcAtanyx;\n"
|
<< "\t\treal_t temp = fma(vIn.z, " << freq2pi << ", precalcAtanyx);\n"
|
||||||
<< "\t\treal_t weightXdist = " << weight << " * precalcSqrtSumSquares;\n"
|
<< "\t\treal_t weightXdist = " << weight << " * precalcSqrtSumSquares;\n"
|
||||||
<< "\t\tvOut.x = weightXdist * cos(temp);\n"
|
<< "\t\tvOut.x = weightXdist * cos(temp);\n"
|
||||||
<< "\t\tvOut.y = weightXdist * sin(temp);\n"
|
<< "\t\tvOut.y = weightXdist * sin(temp);\n"
|
||||||
@ -1706,8 +1709,8 @@ public:
|
|||||||
string freq2pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
string freq2pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t temp = vIn.z * " << freq2pi << ";\n"
|
<< "\t\treal_t temp = vIn.z * " << freq2pi << ";\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * (vIn.x + cos(temp) * " << width << ");\n"
|
<< "\t\tvOut.x = " << weight << " * (fma(cos(temp), " << width << ", vIn.x));\n"
|
||||||
<< "\t\tvOut.y = " << weight << " * (vIn.y + sin(temp) * " << width << ");\n"
|
<< "\t\tvOut.y = " << weight << " * (fma(sin(temp), " << width << ", vIn.y));\n"
|
||||||
<< "\t\tvOut.z = " << weight << " * vIn.z ;\n"
|
<< "\t\tvOut.z = " << weight << " * vIn.z ;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@ -1862,8 +1865,8 @@ public:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\ta += ((MwcNext(mwc) & 1) ? M_2PI : -M_2PI) * round(log(MwcNext01(mwc)) * " << coeff << ");\n"
|
<< "\t\ta += ((MwcNext(mwc) & 1) ? M_2PI : -M_2PI) * round(log(MwcNext01(mwc)) * " << coeff << ");\n"
|
||||||
<< "\t\treal_t lnr2 = log(precalcSumSquares);\n"
|
<< "\t\treal_t lnr2 = log(precalcSumSquares);\n"
|
||||||
<< "\t\treal_t r = " << weight << " * exp(" << halfc << " * lnr2 - " << precalcd << " * a);\n"
|
<< "\t\treal_t r = " << weight << " * exp(fma(" << halfc << ", lnr2, -(" << precalcd << " * a)));\n"
|
||||||
<< "\t\treal_t temp = " << precalcc << " * a + " << halfd << " * lnr2 + " << ang << " * MwcNext(mwc);\n"
|
<< "\t\treal_t temp = fma(" << precalcc << ", a, fma(" << halfd << ", lnr2, " << ang << " * MwcNext(mwc)));\n"
|
||||||
<< "\t\tvOut.x = r * cos(temp);\n"
|
<< "\t\tvOut.x = r * cos(temp);\n"
|
||||||
<< "\t\tvOut.y = r * sin(temp);\n"
|
<< "\t\tvOut.y = r * sin(temp);\n"
|
||||||
<< "\t\tvOut.z = " << DefaultZCl()
|
<< "\t\tvOut.z = " << DefaultZCl()
|
||||||
@ -1969,7 +1972,7 @@ public:
|
|||||||
<< "\t\treal_t randr = lvl * " << radius << ";\n"
|
<< "\t\treal_t randr = lvl * " << radius << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << rblur << " != 0)\n"
|
<< "\t\tif (" << rblur << " != 0)\n"
|
||||||
<< "\t\t\trandr += (sqrt(MwcNext01(mwc)) * 2.0 - 1.0) * " << rblur << ";\n";
|
<< "\t\t\trandr += fma(sqrt(MwcNext01(mwc)), (real_t)(2.0), (real_t)(-1.0)) * " << rblur << ";\n";
|
||||||
|
|
||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
{
|
{
|
||||||
@ -1983,7 +1986,7 @@ public:
|
|||||||
<< "\t\treal_t zb = 0;\n"
|
<< "\t\treal_t zb = 0;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (" << zblur << " != 0)\n"
|
<< "\t\tif (" << zblur << " != 0)\n"
|
||||||
<< "\t\t\tzb = (MwcNext01(mwc) * 2.0 - 1.0) * " << zblur << ";\n"
|
<< "\t\t\tzb = fma(sqrt(MwcNext01(mwc)), (real_t)(2.0), (real_t)(-1.0)) * " << zblur << ";\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tvOut.z = (-lvl + zb) * " << weight << ";\n"
|
<< "\t\tvOut.z = (-lvl + zb) * " << weight << ";\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -2091,8 +2094,10 @@ public:
|
|||||||
<< "\t\treal_t angle = floor(precalcAtanyx * " << coeff << ") / " << coeff << " + M_PI / " << n << ";\n"
|
<< "\t\treal_t angle = floor(precalcAtanyx * " << coeff << ") / " << coeff << " + M_PI / " << n << ";\n"
|
||||||
<< "\t\treal_t x0 = cos(angle) * len;\n"
|
<< "\t\treal_t x0 = cos(angle) * len;\n"
|
||||||
<< "\t\treal_t y0 = sin(angle) * len;\n"
|
<< "\t\treal_t y0 = sin(angle) * len;\n"
|
||||||
|
<< "\t\treal_t xmx = vIn.x - x0;\n"
|
||||||
|
<< "\t\treal_t ymy = vIn.y - y0;\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "\t\tif (sqrt(Sqr(vIn.x - x0) + Sqr(vIn.y - y0)) < d)\n"
|
<< "\t\tif (sqrt(fma(xmx, xmx, SQR(ymy))) < d)\n"
|
||||||
<< "\t\t{\n"
|
<< "\t\t{\n"
|
||||||
<< "\t\t if (" << zero << " > 1.5)\n"
|
<< "\t\t if (" << zero << " > 1.5)\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
@ -2111,8 +2116,8 @@ public:
|
|||||||
<< "\t\t else\n"
|
<< "\t\t else\n"
|
||||||
<< "\t\t {\n"
|
<< "\t\t {\n"
|
||||||
<< "\t\t real_t rangle = atan2(vIn.y - y0, vIn.x - x0);\n"
|
<< "\t\t real_t rangle = atan2(vIn.y - y0, vIn.x - x0);\n"
|
||||||
<< "\t\t fx = x0 + cos(rangle) * d;\n"
|
<< "\t\t fx = fma(cos(rangle), d, x0);\n"
|
||||||
<< "\t\t fy = y0 + sin(rangle) * d;\n"
|
<< "\t\t fy = fma(sin(rangle), d, y0);\n"
|
||||||
<< "\t\t fz = 0;\n"
|
<< "\t\t fz = 0;\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
<< "\t\t }\n"
|
<< "\t\t }\n"
|
||||||
@ -2205,12 +2210,12 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t fx = vIn.x * " << scale2 << ";\n"
|
<< "\t\treal_t fx = vIn.x * " << scale2 << ";\n"
|
||||||
<< "\t\treal_t fy = vIn.y * " << scale2 << ";\n"
|
<< "\t\treal_t fy = vIn.y * " << scale2 << ";\n"
|
||||||
<< "\t\treal_t rad = 1 / Zeps(fx * fx + fy * fy);\n"
|
<< "\t\treal_t rad = 1 / Zeps(fma(fx, fx, SQR(fy)));\n"
|
||||||
<< "\t\treal_t x = rad * fx + " << shift << ";\n"
|
<< "\t\treal_t x = rad * fx + " << shift << ";\n"
|
||||||
<< "\t\treal_t y = rad * fy;\n"
|
<< "\t\treal_t y = rad * fy;\n"
|
||||||
<< "\t\trad = " << weight << " * " << shift << " / Zeps(x * x + y * y);\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 = ((MwcNext(mwc) % (int)" << p << ") * 2 + 1) * M_PI / " << p << ";\n"
|
||||||
<< "\t\treal_t X = rad * x + " << shift << ";\n"
|
<< "\t\treal_t X = fma(rad, x, " << shift << ");\n"
|
||||||
<< "\t\treal_t Y = rad * y;\n"
|
<< "\t\treal_t Y = rad * y;\n"
|
||||||
<< "\t\treal_t cosa = cos(angle);\n"
|
<< "\t\treal_t cosa = cos(angle);\n"
|
||||||
<< "\t\treal_t sina = sin(angle);\n";
|
<< "\t\treal_t sina = sin(angle);\n";
|
||||||
@ -2218,8 +2223,8 @@ public:
|
|||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
ss << "\t\toutPoint->m_X = outPoint->m_Y = outPoint->m_Z = 0;\n";
|
ss << "\t\toutPoint->m_X = outPoint->m_Y = outPoint->m_Z = 0;\n";
|
||||||
|
|
||||||
ss << "\t\tvOut.x = cosa * X - sina * Y;\n"
|
ss << "\t\tvOut.x = fma(cosa, X, -(sina * Y));\n"
|
||||||
<< "\t\tvOut.y = sina * X + cosa * Y;\n"
|
<< "\t\tvOut.y = fma(sina, X, cosa * Y);\n"
|
||||||
<< "\t\tvOut.z = vIn.z * rad;\n"
|
<< "\t\tvOut.z = vIn.z * rad;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
return ss.str();
|
return ss.str();
|
||||||
|
@ -1509,7 +1509,7 @@ public:
|
|||||||
ss << "\t{\n"
|
ss << "\t{\n"
|
||||||
<< "\t\treal_t blockx = floor(log(MwcNext01(mwc)) * ((MwcNext(mwc) & 1) ? " << spread << " : -" << spread << "));\n"
|
<< "\t\treal_t blockx = floor(log(MwcNext01(mwc)) * ((MwcNext(mwc) & 1) ? " << spread << " : -" << spread << "));\n"
|
||||||
<< "\t\treal_t blocky = floor(log(MwcNext01(mwc)) * ((MwcNext(mwc) & 1) ? " << spread << " : -" << spread << "));\n"
|
<< "\t\treal_t blocky = floor(log(MwcNext01(mwc)) * ((MwcNext(mwc) & 1) ? " << spread << " : -" << spread << "));\n"
|
||||||
<< "\t\treal_t z = Hash(blockx * " << seed << ") + Hash(blockx + blocky * " << seed << ");\n";
|
<< "\t\treal_t z = Hash(blockx * " << seed << ") + Hash(fma(blocky, " << seed << ", blockx));\n";
|
||||||
|
|
||||||
if (m_VarType == eVariationType::VARTYPE_REG)
|
if (m_VarType == eVariationType::VARTYPE_REG)
|
||||||
{
|
{
|
||||||
@ -1518,8 +1518,8 @@ public:
|
|||||||
<< "\t\toutPoint->m_Z = 0;\n";
|
<< "\t\toutPoint->m_Z = 0;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
ss << "\t\tvOut.x = (blockx * " << density << " + MwcNext01(mwc)) * " << blocksize << ";\n"
|
ss << "\t\tvOut.x = fma(blockx, " << density << ", MwcNext01(mwc)) * " << blocksize << ";\n"
|
||||||
<< "\t\tvOut.y = (blocky * " << density << " + MwcNext01(mwc)) * " << blocksize << ";\n"
|
<< "\t\tvOut.y = fma(blocky, " << density << ", MwcNext01(mwc)) * " << blocksize << ";\n"
|
||||||
<< "\t\tvOut.z = " << blockheight << " * z * pow(MwcNext01(mwc), 0.125);\n"
|
<< "\t\tvOut.z = " << blockheight << " * z * pow(MwcNext01(mwc), 0.125);\n"
|
||||||
<< "\t\toutPoint->m_ColorX = z / 2;\n"
|
<< "\t\toutPoint->m_ColorX = z / 2;\n"
|
||||||
<< "\t}\n";
|
<< "\t}\n";
|
||||||
@ -1601,10 +1601,10 @@ public:
|
|||||||
<< "\t\treal_t xl, yl;\n"
|
<< "\t\treal_t xl, yl;\n"
|
||||||
<< "\t\txl = sincos(" << rad << ", &yl);\n"
|
<< "\t\txl = sincos(" << rad << ", &yl);\n"
|
||||||
<< "\t\tint blockx = (int)floor(vIn.x * " << width << ");\n"
|
<< "\t\tint blockx = (int)floor(vIn.x * " << width << ");\n"
|
||||||
<< "\t\tblockx += (int)(2 - 4 * Hash((int)(blockx * " << seed << " + 1)));\n"
|
<< "\t\tblockx += (int)(2 - 4 * Hash((int)(blockx * (int)" << seed << " + 1)));\n"
|
||||||
<< "\t\tint blocky = (int)floor(vIn.y * " << width << ");\n"
|
<< "\t\tint blocky = (int)floor(vIn.y * " << width << ");\n"
|
||||||
<< "\t\tblocky += (int)(2 - 4 * Hash((int)(blocky * " << seed << " + 1)));\n"
|
<< "\t\tblocky += (int)(2 - 4 * Hash((int)(blocky * (int)" << seed << " + 1)));\n"
|
||||||
<< "\t\treal_t fLen = (Hash((int)(blocky + blockx * -" << seed << ")) + Hash((int)(blockx + blocky * " << seed << " * (real_t)0.5))) * (real_t)0.5;\n"
|
<< "\t\treal_t fLen = (Hash((int)(blocky + blockx * -(int)" << seed << ")) + Hash((int)(blockx + blocky * (int)" << seed << " * (real_t)0.5))) * (real_t)0.5;\n"
|
||||||
<< "\t\treal_t r01 = MwcNext01(mwc);\n"
|
<< "\t\treal_t r01 = MwcNext01(mwc);\n"
|
||||||
<< "\t\treal_t fade = fLen * r01 * r01 * r01 * r01;\n"
|
<< "\t\treal_t fade = fLen * r01 * r01 * r01 * r01;\n"
|
||||||
<< "\t\tvOut.x = " << weight << " * " << len << " * xl * fade;\n"
|
<< "\t\tvOut.x = " << weight << " * " << len << " * xl * fade;\n"
|
||||||
|
@ -59,7 +59,7 @@ FunctionMapper::FunctionMapper()
|
|||||||
s_GlobalMap["Hypot"] =
|
s_GlobalMap["Hypot"] =
|
||||||
"inline real_t Hypot(real_t x, real_t y)\n"
|
"inline real_t Hypot(real_t x, real_t y)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return sqrt(SQR(x) + SQR(y));\n"
|
" return sqrt(fma(x, x, SQR(y)));\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
s_GlobalMap["Spread"] =
|
s_GlobalMap["Spread"] =
|
||||||
"inline real_t Spread(real_t x, real_t y)\n"
|
"inline real_t Spread(real_t x, real_t y)\n"
|
||||||
@ -79,12 +79,12 @@ FunctionMapper::FunctionMapper()
|
|||||||
s_GlobalMap["Zeps"] =
|
s_GlobalMap["Zeps"] =
|
||||||
"inline real_t Zeps(real_t x)\n"
|
"inline real_t Zeps(real_t x)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return x == 0.0 ? EPS : x;\n"
|
" return x != 0.0 ? x : EPS;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
s_GlobalMap["Lerp"] =
|
s_GlobalMap["Lerp"] =
|
||||||
"inline real_t Lerp(real_t a, real_t b, real_t p)\n"
|
"inline real_t Lerp(real_t a, real_t b, real_t p)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return a + (b - a) * p;\n"
|
" return fma(p, (b - a), a);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
s_GlobalMap["Fabsmod"] =
|
s_GlobalMap["Fabsmod"] =
|
||||||
"inline real_t Fabsmod(real_t v)\n"
|
"inline real_t Fabsmod(real_t v)\n"
|
||||||
@ -96,7 +96,7 @@ FunctionMapper::FunctionMapper()
|
|||||||
s_GlobalMap["Fosc"] =
|
s_GlobalMap["Fosc"] =
|
||||||
"inline real_t Fosc(real_t p, real_t amp, real_t ph)\n"
|
"inline real_t Fosc(real_t p, real_t amp, real_t ph)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return 0.5 - cos(p * amp + ph) * 0.5;\n"
|
" return 0.5 - cos(fma(p, amp, ph)) * 0.5;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
s_GlobalMap["Foscn"] =
|
s_GlobalMap["Foscn"] =
|
||||||
"inline real_t Foscn(real_t p, real_t ph)\n"
|
"inline real_t Foscn(real_t p, real_t ph)\n"
|
||||||
@ -154,7 +154,8 @@ FunctionMapper::FunctionMapper()
|
|||||||
"\n"
|
"\n"
|
||||||
" for (i = 0; i < n; i++)\n"
|
" for (i = 0; i < n; i++)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" d2 = Sqr(p[i].x - (*u).x) + Sqr(p[i].y - (*u).y);\n"
|
" real_t pxmx = p[i].x - (*u).x;\n"
|
||||||
|
" d2 = fma(pxmx, pxmx, Sqr(p[i].y - (*u).y));\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if (d2 < d2min)\n"
|
" if (d2 < d2min)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
@ -357,7 +358,7 @@ FunctionMapper::FunctionMapper()
|
|||||||
" a = c / b;\n"
|
" a = c / b;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"\n"
|
"\n"
|
||||||
" a = 1 / sqrt(c * c + 1);\n"
|
" a = 1 / sqrt(fma(c, c, (real_t)(1.0)));\n"
|
||||||
"\n"
|
"\n"
|
||||||
" if (*sn < 0)\n"
|
" if (*sn < 0)\n"
|
||||||
" *sn = -a;\n"
|
" *sn = -a;\n"
|
||||||
|
@ -101,10 +101,20 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
|
|||||||
" outPoint->m_Z = 0;\n";
|
" outPoint->m_Z = 0;\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
/* if (xform->m_Affine.IsID())
|
||||||
{
|
{
|
||||||
xformFuncs <<
|
xformFuncs <<
|
||||||
" transX = (xform->m_A * inPoint->m_X) + (xform->m_B * inPoint->m_Y) + xform->m_C;\n" <<
|
" transX = inPoint->m_X;\n" <<
|
||||||
" transY = (xform->m_D * inPoint->m_X) + (xform->m_E * inPoint->m_Y) + xform->m_F;\n" <<
|
" transY = inPoint->m_Y;\n";
|
||||||
|
}
|
||||||
|
else*/
|
||||||
|
{
|
||||||
|
xformFuncs <<
|
||||||
|
" transX = fma(xform->m_A, inPoint->m_X, fma(xform->m_B, inPoint->m_Y, xform->m_C));\n" <<
|
||||||
|
" transY = fma(xform->m_D, inPoint->m_X, fma(xform->m_E, inPoint->m_Y, xform->m_F));\n";
|
||||||
|
}
|
||||||
|
xformFuncs <<
|
||||||
" transZ = inPoint->m_Z;\n";
|
" transZ = inPoint->m_Z;\n";
|
||||||
varCount = xform->PreVariationCount();
|
varCount = xform->PreVariationCount();
|
||||||
|
|
||||||
@ -198,8 +208,8 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
|
|||||||
"\n\t//Apply post affine transform.\n"
|
"\n\t//Apply post affine transform.\n"
|
||||||
"\treal_t tempX = outPoint->m_X;\n"
|
"\treal_t tempX = outPoint->m_X;\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\toutPoint->m_X = (xform->m_PostA * tempX) + (xform->m_PostB * outPoint->m_Y) + xform->m_PostC;\n" <<
|
"\toutPoint->m_X = fma(xform->m_PostA, tempX, fma(xform->m_PostB, outPoint->m_Y, xform->m_PostC));\n" <<
|
||||||
"\toutPoint->m_Y = (xform->m_PostD * tempX) + (xform->m_PostE * outPoint->m_Y) + xform->m_PostF;\n";
|
"\toutPoint->m_Y = fma(xform->m_PostD, tempX, fma(xform->m_PostE, outPoint->m_Y, xform->m_PostF));\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
xformFuncs << "\toutPoint->m_ColorX = tempColor + xform->m_DirectColor * (outPoint->m_ColorX - tempColor);\n";
|
xformFuncs << "\toutPoint->m_ColorX = tempColor + xform->m_DirectColor * (outPoint->m_ColorX - tempColor);\n";
|
||||||
@ -440,8 +450,8 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
|
|||||||
os <<
|
os <<
|
||||||
" p00 = secondPoint.m_X - ember->m_CenterX;\n"
|
" p00 = secondPoint.m_X - ember->m_CenterX;\n"
|
||||||
" p01 = secondPoint.m_Y - ember->m_CenterY;\n"
|
" p01 = secondPoint.m_Y - ember->m_CenterY;\n"
|
||||||
" tempPoint.m_X = (p00 * ember->m_RotA) + (p01 * ember->m_RotB) + ember->m_CenterX;\n"
|
" tempPoint.m_X = fma(p00, ember->m_RotA, fma(p01, ember->m_RotB, ember->m_CenterX));\n"
|
||||||
" tempPoint.m_Y = (p00 * ember->m_RotD) + (p01 * ember->m_RotE) + ember->m_CenterY;\n"
|
" tempPoint.m_Y = fma(p00, ember->m_RotD, fma(p01, ember->m_RotE, ember->m_CenterY));\n"
|
||||||
"\n"
|
"\n"
|
||||||
//Add this point to the appropriate location in the histogram.
|
//Add this point to the appropriate location in the histogram.
|
||||||
" if (CarToRasInBounds(carToRas, &tempPoint))\n"
|
" if (CarToRasInBounds(carToRas, &tempPoint))\n"
|
||||||
@ -481,7 +491,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
|
|||||||
" palColor1 = read_imagef(palette, paletteSampler, iPaletteCoord);\n"
|
" palColor1 = read_imagef(palette, paletteSampler, iPaletteCoord);\n"
|
||||||
" iPaletteCoord.x += 1;\n"
|
" iPaletteCoord.x += 1;\n"
|
||||||
" palColor2 = read_imagef(palette, paletteSampler, iPaletteCoord);\n"
|
" palColor2 = read_imagef(palette, paletteSampler, iPaletteCoord);\n"
|
||||||
" palColor1 = (palColor1 * (1.0f - (float)colorIndexFrac)) + (palColor2 * (float)colorIndexFrac);\n";//The 1.0f here *must* have the 'f' suffix at the end to compile.
|
" palColor1 = fma(palColor2, (float)colorIndexFrac, palColor1 * (1.0f - (float)colorIndexFrac));\n";//The 1.0f here *must* have the 'f' suffix at the end to compile.
|
||||||
}
|
}
|
||||||
else if (ember.m_PaletteMode == ePaletteMode::PALETTE_STEP)
|
else if (ember.m_PaletteMode == ePaletteMode::PALETTE_STEP)
|
||||||
{
|
{
|
||||||
@ -820,6 +830,9 @@ bool IterOpenCLKernelCreator<T>::IsBuildRequired(const Ember<T>& ember1, const E
|
|||||||
auto xform2 = ember2.GetTotalXform(i);
|
auto xform2 = ember2.GetTotalXform(i);
|
||||||
auto varCount = xform1->TotalVariationCount();
|
auto varCount = xform1->TotalVariationCount();
|
||||||
|
|
||||||
|
//if (xform1->m_Affine.IsID() != xform2->m_Affine.IsID())
|
||||||
|
// return true;
|
||||||
|
|
||||||
if (xform1->HasPost() != xform2->HasPost())
|
if (xform1->HasPost() != xform2->HasPost())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -912,10 +925,10 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
|
|||||||
" real_t dsin, dcos;\n"
|
" real_t dsin, dcos;\n"
|
||||||
" real_t t = MwcNext01(&mwc) * M_2PI;\n"
|
" real_t t = MwcNext01(&mwc) * M_2PI;\n"
|
||||||
" real_t z = secondPoint.m_Z - ember->m_CamZPos;\n"
|
" real_t z = secondPoint.m_Z - ember->m_CamZPos;\n"
|
||||||
" real_t x = ember->m_C00 * secondPoint.m_X + ember->m_C10 * secondPoint.m_Y;\n"
|
" real_t x = fma(ember->m_C00, secondPoint.m_X, ember->m_C10 * secondPoint.m_Y);\n"
|
||||||
" real_t y = ember->m_C01 * secondPoint.m_X + ember->m_C11 * secondPoint.m_Y + ember->m_C21 * z;\n"
|
" real_t y = fma(ember->m_C01, secondPoint.m_X, fma(ember->m_C11, secondPoint.m_Y, ember->m_C21 * z));\n"
|
||||||
"\n"
|
"\n"
|
||||||
" z = ember->m_C02 * secondPoint.m_X + ember->m_C12 * secondPoint.m_Y + ember->m_C22 * z;\n"
|
" z = fma(ember->m_C02, secondPoint.m_X, fma(ember->m_C12, secondPoint.m_Y, ember->m_C22 * z));\n"
|
||||||
"\n"
|
"\n"
|
||||||
" real_t zr = Zeps(1 - ember->m_CamPerspective * z);\n"
|
" real_t zr = Zeps(1 - ember->m_CamPerspective * z);\n"
|
||||||
" real_t dr = MwcNext01(&mwc) * ember->m_BlurCoef * z;\n"
|
" real_t dr = MwcNext01(&mwc) * ember->m_BlurCoef * z;\n"
|
||||||
@ -923,8 +936,8 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
|
|||||||
" dsin = sin(t);\n"
|
" dsin = sin(t);\n"
|
||||||
" dcos = cos(t);\n"
|
" dcos = cos(t);\n"
|
||||||
"\n"
|
"\n"
|
||||||
" secondPoint.m_X = (x + dr * dcos) / zr;\n"
|
" secondPoint.m_X = fma(dr, dcos, x) / zr;\n"
|
||||||
" secondPoint.m_Y = (y + dr * dsin) / zr;\n"
|
" secondPoint.m_Y = fma(dr, dsin, y) / zr;\n"
|
||||||
" secondPoint.m_Z -= ember->m_CamZPos;\n";
|
" secondPoint.m_Z -= ember->m_CamZPos;\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -935,8 +948,8 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
|
|||||||
" real_t t = MwcNext01(&mwc) * M_2PI;\n"
|
" real_t t = MwcNext01(&mwc) * M_2PI;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" z = secondPoint.m_Z - ember->m_CamZPos;\n"
|
" z = secondPoint.m_Z - ember->m_CamZPos;\n"
|
||||||
" y = ember->m_C11 * secondPoint.m_Y + ember->m_C21 * z;\n"
|
" y = fma(ember->m_C11, secondPoint.m_Y, ember->m_C21 * z);\n"
|
||||||
" z = ember->m_C12 * secondPoint.m_Y + ember->m_C22 * z;\n"
|
" z = fma(ember->m_C12, secondPoint.m_Y, ember->m_C22 * z);\n"
|
||||||
" zr = Zeps(1 - ember->m_CamPerspective * z);\n"
|
" zr = Zeps(1 - ember->m_CamPerspective * z);\n"
|
||||||
"\n"
|
"\n"
|
||||||
" dsin = sin(t);\n"
|
" dsin = sin(t);\n"
|
||||||
@ -944,8 +957,8 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
|
|||||||
"\n"
|
"\n"
|
||||||
" real_t dr = MwcNext01(&mwc) * ember->m_BlurCoef * z;\n"
|
" real_t dr = MwcNext01(&mwc) * ember->m_BlurCoef * z;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" secondPoint.m_X = (secondPoint.m_X + dr * dcos) / zr;\n"
|
" secondPoint.m_X = fma(dr, dcos, secondPoint.m_X) / zr;\n"
|
||||||
" secondPoint.m_Y = (y + dr * dsin) / zr;\n"
|
" secondPoint.m_Y = fma(dr, dsin, y) / zr;\n"
|
||||||
" secondPoint.m_Z -= ember->m_CamZPos;\n";
|
" secondPoint.m_Z -= ember->m_CamZPos;\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -955,9 +968,9 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
|
|||||||
{
|
{
|
||||||
os <<
|
os <<
|
||||||
" real_t z = secondPoint.m_Z - ember->m_CamZPos;\n"
|
" real_t z = secondPoint.m_Z - ember->m_CamZPos;\n"
|
||||||
" real_t x = ember->m_C00 * secondPoint.m_X + ember->m_C10 * secondPoint.m_Y;\n"
|
" real_t x = fma(ember->m_C00, secondPoint.m_X, ember->m_C10 * secondPoint.m_Y);\n"
|
||||||
" real_t y = ember->m_C01 * secondPoint.m_X + ember->m_C11 * secondPoint.m_Y + ember->m_C21 * z;\n"
|
" real_t y = fma(ember->m_C01, secondPoint.m_X, fma(ember->m_C11, secondPoint.m_Y, ember->m_C21 * z));\n"
|
||||||
" real_t zr = Zeps(1 - ember->m_CamPerspective * (ember->m_C02 * secondPoint.m_X + ember->m_C12 * secondPoint.m_Y + ember->m_C22 * z));\n"
|
" real_t zr = Zeps(1 - ember->m_CamPerspective * fma(ember->m_C02, secondPoint.m_X, fma(ember->m_C12, secondPoint.m_Y, ember->m_C22 * z)));\n"
|
||||||
"\n"
|
"\n"
|
||||||
" secondPoint.m_X = x / zr;\n"
|
" secondPoint.m_X = x / zr;\n"
|
||||||
" secondPoint.m_Y = y / zr;\n"
|
" secondPoint.m_Y = y / zr;\n"
|
||||||
@ -967,8 +980,8 @@ string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember)
|
|||||||
{
|
{
|
||||||
os <<
|
os <<
|
||||||
" real_t z = secondPoint.m_Z - ember->m_CamZPos;\n"
|
" real_t z = secondPoint.m_Z - ember->m_CamZPos;\n"
|
||||||
" real_t y = ember->m_C11 * secondPoint.m_Y + ember->m_C21 * z;\n"
|
" real_t y = fma(ember->m_C11, secondPoint.m_Y, ember->m_C21 * z);\n"
|
||||||
" real_t zr = Zeps(1 - ember->m_CamPerspective * (ember->m_C12 * secondPoint.m_Y + ember->m_C22 * z));\n"
|
" real_t zr = Zeps(1 - ember->m_CamPerspective * fma(ember->m_C12, secondPoint.m_Y, ember->m_C22 * z));\n"
|
||||||
"\n"
|
"\n"
|
||||||
" secondPoint.m_X /= zr;\n"
|
" secondPoint.m_X /= zr;\n"
|
||||||
" secondPoint.m_Y = y / zr;\n"
|
" secondPoint.m_Y = y / zr;\n"
|
||||||
|
@ -1058,6 +1058,42 @@ bool TestVarAssignVals()
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FindFmaCandidates()
|
||||||
|
{
|
||||||
|
auto vlf(VariationList<float>::Instance());
|
||||||
|
|
||||||
|
for (size_t i = 0; i < vlf->Size(); i++)
|
||||||
|
{
|
||||||
|
auto var = vlf->GetVariation(i);
|
||||||
|
auto cl = var->OpenCLFuncsString() + "\n" + var->StateInitOpenCLString() + "\n" + var->OpenCLString();
|
||||||
|
auto splits = Split(cl, '\n');
|
||||||
|
|
||||||
|
for (auto& split : splits)
|
||||||
|
{
|
||||||
|
if ((split.find("*") != string::npos || split.find("SQR(") != string::npos || split.find("Sqr(") != string::npos) && split.find("+") != string::npos)
|
||||||
|
cout << "Variation " << var->Name() << " is a potential fma() candidate because of line:\n\t" << split << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FindFmaImplemented()
|
||||||
|
{
|
||||||
|
auto vlf(VariationList<float>::Instance());
|
||||||
|
|
||||||
|
for (size_t i = 0; i < vlf->Size(); i++)
|
||||||
|
{
|
||||||
|
auto var = vlf->GetVariation(i);
|
||||||
|
auto cl = var->OpenCLFuncsString() + "\n" + var->StateInitOpenCLString() + "\n" + var->OpenCLString();
|
||||||
|
auto splits = Split(cl, '\n');
|
||||||
|
|
||||||
|
for (auto& split : splits)
|
||||||
|
{
|
||||||
|
if ((split.find("fma(") != string::npos))
|
||||||
|
cout << "Variation " << var->Name() << " has been implemented with fma():\n\t" << split << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool TestZepsFloor()
|
bool TestZepsFloor()
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
@ -2041,7 +2077,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
//int i;
|
//int i;
|
||||||
bool b = true;
|
bool b = true;
|
||||||
Timing t(4);
|
Timing t(4);
|
||||||
vector<Ember<float>> fv;
|
/* vector<Ember<float>> fv;
|
||||||
vector<Ember<double>> dv;
|
vector<Ember<double>> dv;
|
||||||
list<Ember<float>> fl;
|
list<Ember<float>> fl;
|
||||||
list<Ember<double>> dl;
|
list<Ember<double>> dl;
|
||||||
@ -2059,7 +2095,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeRgba1(filename.c_str(), pixels.data(), w, h);
|
writeRgba1(filename.c_str(), pixels.data(), w, h);
|
||||||
/* TestFuncs();
|
TestFuncs();
|
||||||
string line = "title=\"cj_aerie\" smooth=no", delim = " =\"";
|
string line = "title=\"cj_aerie\" smooth=no", delim = " =\"";
|
||||||
auto vec = Split(line, delim, true);
|
auto vec = Split(line, delim, true);
|
||||||
|
|
||||||
@ -2086,6 +2122,11 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
*/
|
*/
|
||||||
//MakeTestAllVarsRegPrePostComboFile("testallvarsout.flame");
|
//MakeTestAllVarsRegPrePostComboFile("testallvarsout.flame");
|
||||||
|
//cout << (10.0 / 2.0 * 5.0) << endl;
|
||||||
|
FindFmaCandidates();
|
||||||
|
//FindFmaImplemented();
|
||||||
|
//cout << 5 * 3 + 2 << endl;
|
||||||
|
//cout << 2 + 5 * 3 << endl;
|
||||||
return 0;
|
return 0;
|
||||||
/*
|
/*
|
||||||
TestThreadedKernel();
|
TestThreadedKernel();
|
||||||
|
@ -873,7 +873,9 @@ void Fractorium::SetTabOrders()
|
|||||||
w = SetTabOrder(this, w, m_PreO1Spin);
|
w = SetTabOrder(this, w, m_PreO1Spin);
|
||||||
w = SetTabOrder(this, w, m_PreO2Spin);
|
w = SetTabOrder(this, w, m_PreO2Spin);
|
||||||
w = SetTabOrder(this, w, ui.PreFlipVerticalButton);
|
w = SetTabOrder(this, w, ui.PreFlipVerticalButton);
|
||||||
|
w = SetTabOrder(this, w, ui.PreCopyButton);
|
||||||
w = SetTabOrder(this, w, ui.PreResetButton);
|
w = SetTabOrder(this, w, ui.PreResetButton);
|
||||||
|
w = SetTabOrder(this, w, ui.PrePasteButton);
|
||||||
w = SetTabOrder(this, w, ui.PreFlipHorizontalButton);
|
w = SetTabOrder(this, w, ui.PreFlipHorizontalButton);
|
||||||
w = SetTabOrder(this, w, ui.PreRotate90CcButton);
|
w = SetTabOrder(this, w, ui.PreRotate90CcButton);
|
||||||
w = SetTabOrder(this, w, ui.PreRotateCcButton);
|
w = SetTabOrder(this, w, ui.PreRotateCcButton);
|
||||||
@ -899,7 +901,9 @@ void Fractorium::SetTabOrders()
|
|||||||
w = SetTabOrder(this, w, m_PostO1Spin);
|
w = SetTabOrder(this, w, m_PostO1Spin);
|
||||||
w = SetTabOrder(this, w, m_PostO2Spin);
|
w = SetTabOrder(this, w, m_PostO2Spin);
|
||||||
w = SetTabOrder(this, w, ui.PostFlipVerticalButton);
|
w = SetTabOrder(this, w, ui.PostFlipVerticalButton);
|
||||||
|
w = SetTabOrder(this, w, ui.PostCopyButton);
|
||||||
w = SetTabOrder(this, w, ui.PostResetButton);
|
w = SetTabOrder(this, w, ui.PostResetButton);
|
||||||
|
w = SetTabOrder(this, w, ui.PostPasteButton);
|
||||||
w = SetTabOrder(this, w, ui.PostFlipHorizontalButton);
|
w = SetTabOrder(this, w, ui.PostFlipHorizontalButton);
|
||||||
w = SetTabOrder(this, w, ui.PostRotate90CcButton);
|
w = SetTabOrder(this, w, ui.PostRotate90CcButton);
|
||||||
w = SetTabOrder(this, w, ui.PostRotateCcButton);
|
w = SetTabOrder(this, w, ui.PostRotateCcButton);
|
||||||
|
@ -114,7 +114,11 @@ public:
|
|||||||
void CurrentXform(uint i);
|
void CurrentXform(uint i);
|
||||||
|
|
||||||
//Xforms Affine.
|
//Xforms Affine.
|
||||||
|
bool DrawCurrentPre();
|
||||||
|
bool DrawSelectedPre();
|
||||||
bool DrawAllPre();
|
bool DrawAllPre();
|
||||||
|
bool DrawCurrentPost();
|
||||||
|
bool DrawSelectedPost();
|
||||||
bool DrawAllPost();
|
bool DrawAllPost();
|
||||||
bool LocalPivot();
|
bool LocalPivot();
|
||||||
|
|
||||||
@ -279,6 +283,8 @@ public slots:
|
|||||||
void OnScaleDownButtonClicked(bool checked);
|
void OnScaleDownButtonClicked(bool checked);
|
||||||
void OnScaleUpButtonClicked(bool checked);
|
void OnScaleUpButtonClicked(bool checked);
|
||||||
void OnResetAffineButtonClicked(bool checked);
|
void OnResetAffineButtonClicked(bool checked);
|
||||||
|
void OnCopyAffineButtonClicked(bool checked);
|
||||||
|
void OnPasteAffineButtonClicked(bool checked);
|
||||||
void OnRandomAffineButtonClicked(bool checked);
|
void OnRandomAffineButtonClicked(bool checked);
|
||||||
|
|
||||||
void OnAffineGroupBoxToggled(bool on);
|
void OnAffineGroupBoxToggled(bool on);
|
||||||
|
@ -3233,7 +3233,7 @@
|
|||||||
<enum>QTabWidget::Triangular</enum>
|
<enum>QTabWidget::Triangular</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>3</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="XformColorTab">
|
<widget class="QWidget" name="XformColorTab">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -4572,6 +4572,50 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="PreCopyButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>41</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Copy the pre affine values, which can then be pasted into other pre/post affines</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QPushButton" name="PrePasteButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>41</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Paste the pre/post affine values which were previously copied</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Paste</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -4617,6 +4661,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="ShowPreAffineSelectedRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>Selected</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="ShowPreAffineAllRadio">
|
<widget class="QRadioButton" name="ShowPreAffineAllRadio">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -5402,6 +5453,50 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="PostCopyButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>41</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Copy the post affine values, which can then be pasted into other pre/post affines</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QPushButton" name="PostPasteButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>41</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Paste the pre/post affine values which were previously copied</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Paste</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -5444,6 +5539,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="ShowPostAffineSelectedRadio">
|
||||||
|
<property name="text">
|
||||||
|
<string>Selected</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="ShowPostAffineAllRadio">
|
<widget class="QRadioButton" name="ShowPostAffineAllRadio">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@ -5675,7 +5777,7 @@
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="columnCount">
|
<property name="columnCount">
|
||||||
<number>2</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="headerDefaultSectionSize">
|
<attribute name="headerDefaultSectionSize">
|
||||||
<number>70</number>
|
<number>70</number>
|
||||||
@ -5702,6 +5804,14 @@
|
|||||||
<string>Weight</string>
|
<string>Weight</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Type</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Red: Uses non-standard assignment which means direct assignment for regular variations, sum for pre/post.</p><p>Green: Uses direct color.</p><p>Blue: Uses an internal variation state.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Spherical</string>
|
<string>Spherical</string>
|
||||||
|
@ -194,6 +194,8 @@ public:
|
|||||||
virtual void MoveXforms(double x, double y, bool pre) { }
|
virtual void MoveXforms(double x, double y, bool pre) { }
|
||||||
virtual void ScaleXforms(double scale, bool pre) { }
|
virtual void ScaleXforms(double scale, bool pre) { }
|
||||||
virtual void ResetXformsAffine(bool pre) { }
|
virtual void ResetXformsAffine(bool pre) { }
|
||||||
|
virtual void CopyXformsAffine(bool pre) { }
|
||||||
|
virtual void PasteXformsAffine(bool pre) { }
|
||||||
virtual void RandomXformsAffine(bool pre) { }
|
virtual void RandomXformsAffine(bool pre) { }
|
||||||
virtual void FillBothAffines() { }
|
virtual void FillBothAffines() { }
|
||||||
double LockedScale() { return m_LockedScale; }
|
double LockedScale() { return m_LockedScale; }
|
||||||
@ -223,6 +225,7 @@ public:
|
|||||||
virtual void FillVariationTreeWithCurrentXform() { }
|
virtual void FillVariationTreeWithCurrentXform() { }
|
||||||
|
|
||||||
//Xforms Selection.
|
//Xforms Selection.
|
||||||
|
virtual QString MakeXformCaption(size_t i) { return ""; }
|
||||||
|
|
||||||
//Xaos.
|
//Xaos.
|
||||||
virtual void FillXaos() { }
|
virtual void FillXaos() { }
|
||||||
@ -265,12 +268,12 @@ public:
|
|||||||
vector<v4F>* FinalImage() { return &(m_FinalImage); }
|
vector<v4F>* FinalImage() { return &(m_FinalImage); }
|
||||||
vector<v4F>* PreviewFinalImage() { return &m_PreviewFinalImage; }
|
vector<v4F>* PreviewFinalImage() { return &m_PreviewFinalImage; }
|
||||||
EmberStats Stats() { return m_Stats; }
|
EmberStats Stats() { return m_Stats; }
|
||||||
|
eProcessState ProcessState() { return m_Renderer.get() ? m_Renderer->ProcessState() : eProcessState::NONE; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//Rendering/progress.
|
//Rendering/progress.
|
||||||
void AddProcessAction(eProcessAction action);
|
void AddProcessAction(eProcessAction action);
|
||||||
eProcessAction CondenseAndClearProcessActions();
|
eProcessAction CondenseAndClearProcessActions();
|
||||||
eProcessState ProcessState() { return m_Renderer.get() ? m_Renderer->ProcessState() : eProcessState::NONE; }
|
|
||||||
|
|
||||||
//Non-templated members.
|
//Non-templated members.
|
||||||
bool m_Rendering = false;
|
bool m_Rendering = false;
|
||||||
@ -468,6 +471,8 @@ public:
|
|||||||
virtual void MoveXforms(double x, double y, bool pre) override;
|
virtual void MoveXforms(double x, double y, bool pre) override;
|
||||||
virtual void ScaleXforms(double scale, bool pre) override;
|
virtual void ScaleXforms(double scale, bool pre) override;
|
||||||
virtual void ResetXformsAffine(bool pre) override;
|
virtual void ResetXformsAffine(bool pre) override;
|
||||||
|
virtual void CopyXformsAffine(bool pre) override;
|
||||||
|
virtual void PasteXformsAffine(bool pre) override;
|
||||||
virtual void RandomXformsAffine(bool pre) override;
|
virtual void RandomXformsAffine(bool pre) override;
|
||||||
virtual void FillBothAffines() override;
|
virtual void FillBothAffines() override;
|
||||||
virtual void InitLockedScale() override;
|
virtual void InitLockedScale() override;
|
||||||
@ -506,6 +511,7 @@ public:
|
|||||||
virtual void AddLayer(int xforms) override;
|
virtual void AddLayer(int xforms) override;
|
||||||
|
|
||||||
//Xforms Selection.
|
//Xforms Selection.
|
||||||
|
virtual QString MakeXformCaption(size_t i) override;
|
||||||
bool XformCheckboxAt(int i, std::function<void(QCheckBox*)> func);
|
bool XformCheckboxAt(int i, std::function<void(QCheckBox*)> func);
|
||||||
bool XformCheckboxAt(Xform<T>* xform, std::function<void(QCheckBox*)> func);
|
bool XformCheckboxAt(Xform<T>* xform, std::function<void(QCheckBox*)> func);
|
||||||
|
|
||||||
@ -545,9 +551,6 @@ private:
|
|||||||
//Xforms Color.
|
//Xforms Color.
|
||||||
void FillCurvesControl();
|
void FillCurvesControl();
|
||||||
|
|
||||||
//Xforms Selection.
|
|
||||||
QString MakeXformCaption(size_t i);
|
|
||||||
|
|
||||||
//Palette.
|
//Palette.
|
||||||
void UpdateAdjustedPaletteGUI(Palette<float>& palette);
|
void UpdateAdjustedPaletteGUI(Palette<float>& palette);
|
||||||
|
|
||||||
@ -567,6 +570,7 @@ private:
|
|||||||
deque<Ember<T>> m_UndoList;
|
deque<Ember<T>> m_UndoList;
|
||||||
vector<Xform<T>> m_CopiedXforms;
|
vector<Xform<T>> m_CopiedXforms;
|
||||||
Xform<T> m_CopiedFinalXform;
|
Xform<T> m_CopiedFinalXform;
|
||||||
|
Affine2D<T> m_CopiedAffine;
|
||||||
shared_ptr<VariationList<T>> m_VariationList;
|
shared_ptr<VariationList<T>> m_VariationList;
|
||||||
unique_ptr<SheepTools<T, float>> m_SheepTools;
|
unique_ptr<SheepTools<T, float>> m_SheepTools;
|
||||||
unique_ptr<GLEmberController<T>> m_GLController;
|
unique_ptr<GLEmberController<T>> m_GLController;
|
||||||
|
@ -645,7 +645,7 @@ void FractoriumEmberController<T>::InterpTypeChanged(int i)
|
|||||||
{
|
{
|
||||||
eInterp interp;
|
eInterp interp;
|
||||||
|
|
||||||
if (i == 0)//Need to make this work like animate flag where it sets the value but doesn't trigger and update.//TODO
|
if (i == 0)
|
||||||
interp = eInterp::EMBER_INTERP_LINEAR;
|
interp = eInterp::EMBER_INTERP_LINEAR;
|
||||||
else if (i == 1)
|
else if (i == 1)
|
||||||
interp = eInterp::EMBER_INTERP_SMOOTH;
|
interp = eInterp::EMBER_INTERP_SMOOTH;
|
||||||
|
@ -159,13 +159,13 @@ void FractoriumEmberControllerBase::SaveCurrentRender(const QString& filename, c
|
|||||||
{
|
{
|
||||||
vector<byte> rgba8Image(size * 4);
|
vector<byte> rgba8Image(size * 4);
|
||||||
Rgba32ToRgba8(data, rgba8Image.data(), width, height, transparency);
|
Rgba32ToRgba8(data, rgba8Image.data(), width, height, transparency);
|
||||||
b = WritePng(s.c_str(), rgba8Image.data(), width, height, 1, true, comments, id, url, nick);//Put an opt here for 1 or 2 bytes.//TODO
|
b = WritePng(s.c_str(), rgba8Image.data(), width, height, 1, true, comments, id, url, nick);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vector<glm::uint16> rgba16Image(size * 4);
|
vector<glm::uint16> rgba16Image(size * 4);
|
||||||
Rgba32ToRgba16(data, rgba16Image.data(), width, height, transparency);
|
Rgba32ToRgba16(data, rgba16Image.data(), width, height, transparency);
|
||||||
b = WritePng(s.c_str(), (byte*)rgba16Image.data(), width, height, 2, true, comments, id, url, nick);//Put an opt here for 1 or 2 bytes.//TODO
|
b = WritePng(s.c_str(), (byte*)rgba16Image.data(), width, height, 2, true, comments, id, url, nick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (suffix.endsWith("exr", Qt::CaseInsensitive))
|
else if (suffix.endsWith("exr", Qt::CaseInsensitive))
|
||||||
|
@ -173,6 +173,9 @@ void FractoriumSettings::OpenClQuality(uint i) { setValue(OPEN
|
|||||||
bool FractoriumSettings::LoadLast() { return value(LOADLAST).toBool(); }
|
bool FractoriumSettings::LoadLast() { return value(LOADLAST).toBool(); }
|
||||||
void FractoriumSettings::LoadLast(bool b) { setValue(LOADLAST, b); }
|
void FractoriumSettings::LoadLast(bool b) { setValue(LOADLAST, b); }
|
||||||
|
|
||||||
|
bool FractoriumSettings::RotateAndScale() { return value(ROTSCALE).toBool(); }
|
||||||
|
void FractoriumSettings::RotateAndScale(bool b) { setValue(ROTSCALE, b); }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sequence generation settings.
|
/// Sequence generation settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#define CPUQUALITY "render/cpuquality"
|
#define CPUQUALITY "render/cpuquality"
|
||||||
#define OPENCLQUALITY "render/openclquality"
|
#define OPENCLQUALITY "render/openclquality"
|
||||||
#define LOADLAST "render/loadlastonstart"
|
#define LOADLAST "render/loadlastonstart"
|
||||||
|
#define ROTSCALE "render/rotateandscale"
|
||||||
|
|
||||||
#define STAGGER "sequence/stagger"
|
#define STAGGER "sequence/stagger"
|
||||||
#define STAGGERMAX "sequence/staggermax"
|
#define STAGGERMAX "sequence/staggermax"
|
||||||
@ -171,6 +172,9 @@ public:
|
|||||||
bool LoadLast();
|
bool LoadLast();
|
||||||
void LoadLast(bool b);
|
void LoadLast(bool b);
|
||||||
|
|
||||||
|
bool RotateAndScale();
|
||||||
|
void RotateAndScale(bool b);
|
||||||
|
|
||||||
double Stagger();
|
double Stagger();
|
||||||
void Stagger(double i);
|
void Stagger(double i);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ void Fractorium::FillXaosTable()
|
|||||||
{
|
{
|
||||||
int count = int(m_Controller->XformCount());
|
int count = int(m_Controller->XformCount());
|
||||||
QStringList hl, vl;
|
QStringList hl, vl;
|
||||||
auto oldModel = m_XaosTableModel;
|
auto oldModel = std::make_unique<QStandardItemModel>(m_XaosTableModel);
|
||||||
hl.reserve(count);
|
hl.reserve(count);
|
||||||
vl.reserve(count);
|
vl.reserve(count);
|
||||||
m_XaosTableModel = new QStandardItemModel(count, count, this);
|
m_XaosTableModel = new QStandardItemModel(count, count, this);
|
||||||
@ -101,7 +101,7 @@ void Fractorium::FillXaosTable()
|
|||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
auto s = QString::number(i + 1);
|
auto s = m_Controller->MakeXformCaption(i);
|
||||||
hl.push_back("F" + s);
|
hl.push_back("F" + s);
|
||||||
vl.push_back("T" + s);
|
vl.push_back("T" + s);
|
||||||
}
|
}
|
||||||
@ -113,10 +113,6 @@ void Fractorium::FillXaosTable()
|
|||||||
SetTabOrder(this, ui.ClearXaosButton, ui.RandomXaosButton);
|
SetTabOrder(this, ui.ClearXaosButton, ui.RandomXaosButton);
|
||||||
m_Controller->FillXaos();
|
m_Controller->FillXaos();
|
||||||
ui.XaosTableView->blockSignals(false);
|
ui.XaosTableView->blockSignals(false);
|
||||||
|
|
||||||
if (oldModel)
|
|
||||||
delete oldModel;
|
|
||||||
|
|
||||||
//Needed to get the dark stylesheet to correctly color the top left corner button.
|
//Needed to get the dark stylesheet to correctly color the top left corner button.
|
||||||
auto widgetList = ui.XaosTableView->findChildren<QAbstractButton*>();
|
auto widgetList = ui.XaosTableView->findChildren<QAbstractButton*>();
|
||||||
|
|
||||||
|
@ -412,6 +412,7 @@ void FractoriumEmberController<T>::XformNameChanged(int row, int col)
|
|||||||
XformCheckboxAt(int(xfindex), [&](QCheckBox * checkbox) { checkbox->setText(MakeXformCaption(xfindex)); });
|
XformCheckboxAt(int(xfindex), [&](QCheckBox * checkbox) { checkbox->setText(MakeXformCaption(xfindex)); });
|
||||||
}, eXformUpdate::UPDATE_CURRENT, false);
|
}, eXformUpdate::UPDATE_CURRENT, false);
|
||||||
FillSummary();//Manually update because this does not trigger a render, which is where this would normally be called.
|
FillSummary();//Manually update because this does not trigger a render, which is where this would normally be called.
|
||||||
|
m_Fractorium->FillXaosTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fractorium::OnXformNameChanged(int row, int col)
|
void Fractorium::OnXformNameChanged(int row, int col)
|
||||||
@ -570,6 +571,7 @@ void FractoriumEmberController<T>::FillXforms(int index)
|
|||||||
if (UseFinalXform())
|
if (UseFinalXform())
|
||||||
{
|
{
|
||||||
auto cb = new QCheckBox(MakeXformCaption(i), m_Fractorium);
|
auto cb = new QCheckBox(MakeXformCaption(i), m_Fractorium);
|
||||||
|
QObject::connect(cb, &QCheckBox::stateChanged, [&](int state) { m_Fractorium->ui.GLDisplay->update(); });
|
||||||
m_Fractorium->m_XformSelections.push_back(cb);
|
m_Fractorium->m_XformSelections.push_back(cb);
|
||||||
m_Fractorium->m_XformsSelectionLayout->addRow(cb, new QWidget(m_Fractorium));
|
m_Fractorium->m_XformsSelectionLayout->addRow(cb, new QWidget(m_Fractorium));
|
||||||
combo->addItem("Final");
|
combo->addItem("Final");
|
||||||
@ -600,7 +602,6 @@ void FractoriumEmberController<T>::FillXforms(int index)
|
|||||||
/// Update the text in xforms combo box to show the name of Xform.
|
/// Update the text in xforms combo box to show the name of Xform.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index">The index of the Xform to update.</param>
|
/// <param name="index">The index of the Xform to update.</param>
|
||||||
///
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void FractoriumEmberController<T>::UpdateXformName(int index)
|
void FractoriumEmberController<T>::UpdateXformName(int index)
|
||||||
{
|
{
|
||||||
|
@ -74,6 +74,8 @@ void Fractorium::InitXformsAffineUI()
|
|||||||
connect(ui.PreScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PreScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PreScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PreScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PreResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PreResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
|
connect(ui.PreCopyButton, SIGNAL(clicked(bool)), this, SLOT(OnCopyAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
|
connect(ui.PrePasteButton, SIGNAL(clicked(bool)), this, SLOT(OnPasteAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PreRandomButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomAffineButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PreRandomButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostFlipHorizontalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipHorizontalButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostFlipHorizontalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipHorizontalButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostFlipVerticalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipVerticalButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostFlipVerticalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipVerticalButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
@ -88,13 +90,17 @@ void Fractorium::InitXformsAffineUI()
|
|||||||
connect(ui.PostScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
|
connect(ui.PostCopyButton, SIGNAL(clicked(bool)), this, SLOT(OnCopyAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
|
connect(ui.PostPasteButton, SIGNAL(clicked(bool)), this, SLOT(OnPasteAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostRandomButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomAffineButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostRandomButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PreAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
|
connect(ui.PreAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
|
connect(ui.PostAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.ShowPreAffineAllRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
connect(ui.ShowPreAffineAllRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.ShowPreAffineCurrentRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
connect(ui.ShowPreAffineCurrentRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
||||||
|
connect(ui.ShowPreAffineSelectedRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.ShowPostAffineAllRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
connect(ui.ShowPostAffineAllRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.ShowPostAffineCurrentRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
connect(ui.ShowPostAffineCurrentRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
||||||
|
connect(ui.ShowPostAffineSelectedRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PolarAffineCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnPolarAffineCheckBoxStateChanged(int)), Qt::QueuedConnection);
|
connect(ui.PolarAffineCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnPolarAffineCheckBoxStateChanged(int)), Qt::QueuedConnection);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
//For some reason linux makes these 24x24, even though the designer explicitly says 16x16.
|
//For some reason linux makes these 24x24, even though the designer explicitly says 16x16.
|
||||||
@ -564,6 +570,7 @@ void Fractorium::OnScaleUpButtonClicked(bool checked)
|
|||||||
/// Called when reset pre/post affine buttons are clicked.
|
/// Called when reset pre/post affine buttons are clicked.
|
||||||
/// Resets the rendering process.
|
/// Resets the rendering process.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="pre">True for pre affine, false for post.</param>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void FractoriumEmberController<T>::ResetXformsAffine(bool pre)
|
void FractoriumEmberController<T>::ResetXformsAffine(bool pre)
|
||||||
{
|
{
|
||||||
@ -577,6 +584,42 @@ void FractoriumEmberController<T>::ResetXformsAffine(bool pre)
|
|||||||
|
|
||||||
void Fractorium::OnResetAffineButtonClicked(bool checked) { m_Controller->ResetXformsAffine(sender() == ui.PreResetButton); }
|
void Fractorium::OnResetAffineButtonClicked(bool checked) { m_Controller->ResetXformsAffine(sender() == ui.PreResetButton); }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy the pre or post affine transform values from the current xform.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pre">True for pre affine, false for post.</param>
|
||||||
|
template <typename T>
|
||||||
|
void FractoriumEmberController<T>::CopyXformsAffine(bool pre)
|
||||||
|
{
|
||||||
|
if (auto xform = CurrentXform())
|
||||||
|
m_CopiedAffine = pre ? xform->m_Affine : xform->m_Post;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fractorium::OnCopyAffineButtonClicked(bool checked)
|
||||||
|
{
|
||||||
|
m_Controller->CopyXformsAffine(sender() == ui.PreCopyButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Paste the last copied affine transform values to the pre or post affine values in the current xform.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pre">True for pre affine, false for post.</param>
|
||||||
|
template <typename T>
|
||||||
|
void FractoriumEmberController<T>::PasteXformsAffine(bool pre)
|
||||||
|
{
|
||||||
|
UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
|
||||||
|
{
|
||||||
|
auto& affine = pre ? xform->m_Affine : xform->m_Post;
|
||||||
|
affine = m_CopiedAffine;
|
||||||
|
}, eXformUpdate::UPDATE_CURRENT);
|
||||||
|
FillAffineWithXform(CurrentXform(), pre);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fractorium::OnPasteAffineButtonClicked(bool checked)
|
||||||
|
{
|
||||||
|
m_Controller->PasteXformsAffine(sender() == ui.PrePasteButton);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Randomize all values in selected pre/post affines to a range of -1 to 1.
|
/// Randomize all values in selected pre/post affines to a range of -1 to 1.
|
||||||
/// Called when random pre/post affine buttons are clicked.
|
/// Called when random pre/post affine buttons are clicked.
|
||||||
@ -731,7 +774,11 @@ void Fractorium::SetupAffineSpinner(QTableWidget* table, const QObject* receiver
|
|||||||
/// GUI wrapper functions, getters only.
|
/// GUI wrapper functions, getters only.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
|
bool Fractorium::DrawCurrentPre() { return !DrawAllPre() && !DrawSelectedPre(); }
|
||||||
|
bool Fractorium::DrawSelectedPre() { return ui.ShowPreAffineSelectedRadio->isChecked(); }
|
||||||
bool Fractorium::DrawAllPre() { return ui.ShowPreAffineAllRadio->isChecked(); }
|
bool Fractorium::DrawAllPre() { return ui.ShowPreAffineAllRadio->isChecked(); }
|
||||||
|
bool Fractorium::DrawCurrentPost() { return !DrawAllPost() && !DrawSelectedPost(); }
|
||||||
|
bool Fractorium::DrawSelectedPost() { return ui.ShowPostAffineSelectedRadio->isChecked(); }
|
||||||
bool Fractorium::DrawAllPost() { return ui.ShowPostAffineAllRadio->isChecked(); }
|
bool Fractorium::DrawAllPost() { return ui.ShowPostAffineAllRadio->isChecked(); }
|
||||||
bool Fractorium::LocalPivot() { return ui.LocalPivotRadio->isChecked(); }
|
bool Fractorium::LocalPivot() { return ui.LocalPivotRadio->isChecked(); }
|
||||||
|
|
||||||
|
@ -14,8 +14,9 @@ void Fractorium::InitXformsVariationsUI()
|
|||||||
connect(ui.VariationsFilterClearButton, SIGNAL(clicked(bool)), this, SLOT(OnVariationsFilterClearButtonClicked(bool)));
|
connect(ui.VariationsFilterClearButton, SIGNAL(clicked(bool)), this, SLOT(OnVariationsFilterClearButtonClicked(bool)));
|
||||||
connect(ui.ActionVariationsDialog, SIGNAL(triggered(bool)), this, SLOT(OnActionVariationsDialog(bool)), Qt::QueuedConnection);
|
connect(ui.ActionVariationsDialog, SIGNAL(triggered(bool)), this, SLOT(OnActionVariationsDialog(bool)), Qt::QueuedConnection);
|
||||||
//Setting dimensions in the designer with a layout is futile, so must hard code here.
|
//Setting dimensions in the designer with a layout is futile, so must hard code here.
|
||||||
tree->setColumnWidth(0, 160);
|
tree->setColumnWidth(0, 170);
|
||||||
tree->setColumnWidth(1, 23);
|
tree->setColumnWidth(1, 80);
|
||||||
|
tree->setColumnWidth(2, 20);
|
||||||
//Set Default variation tree text and background colors for zero and non zero cases.
|
//Set Default variation tree text and background colors for zero and non zero cases.
|
||||||
m_VariationTreeColorNonZero = Qt::black;
|
m_VariationTreeColorNonZero = Qt::black;
|
||||||
m_VariationTreeColorZero = Qt::black;
|
m_VariationTreeColorZero = Qt::black;
|
||||||
@ -106,11 +107,16 @@ void FractoriumEmberController<T>::SetupVariationsTree()
|
|||||||
{
|
{
|
||||||
T fMin = TLOW;
|
T fMin = TLOW;
|
||||||
T fMax = TMAX;
|
T fMax = TMAX;
|
||||||
QSize hint0(75, 16);
|
QSize hint0(170, 16);
|
||||||
QSize hint1(30, 16);
|
QSize hint1(80, 16);
|
||||||
|
QSize hint2(20, 16);
|
||||||
|
static vector<string> dc{ "m_ColorX" };
|
||||||
|
static vector<string> assign{ "outPoint->m_X =", "outPoint->m_Y =", "outPoint->m_Z =",
|
||||||
|
"outPoint->m_X=", "outPoint->m_Y=", "outPoint->m_Z=" };
|
||||||
auto tree = m_Fractorium->ui.VariationsTree;
|
auto tree = m_Fractorium->ui.VariationsTree;
|
||||||
tree->clear();
|
tree->clear();
|
||||||
tree->blockSignals(true);
|
tree->blockSignals(true);
|
||||||
|
int iconSize_ = 20;
|
||||||
|
|
||||||
for (size_t i = 0; i < m_VariationList->Size(); i++)
|
for (size_t i = 0; i < m_VariationList->Size(); i++)
|
||||||
{
|
{
|
||||||
@ -122,6 +128,34 @@ void FractoriumEmberController<T>::SetupVariationsTree()
|
|||||||
item->setText(0, QString::fromStdString(var->Name()));
|
item->setText(0, QString::fromStdString(var->Name()));
|
||||||
item->setSizeHint(0, hint0);
|
item->setSizeHint(0, hint0);
|
||||||
item->setSizeHint(1, hint1);
|
item->setSizeHint(1, hint1);
|
||||||
|
item->setSizeHint(2, hint2);
|
||||||
|
QPixmap pixmap(iconSize_ * 3, iconSize_);
|
||||||
|
auto mask = pixmap.createMaskFromColor(QColor("transparent"), Qt::MaskOutColor);
|
||||||
|
pixmap.setMask(mask);
|
||||||
|
QPainter paint(&pixmap);
|
||||||
|
paint.fillRect(QRect(0, 0, iconSize_ * 3, iconSize_), QColor(0, 0, 0, 0));
|
||||||
|
|
||||||
|
if (var->VarType() == eVariationType::VARTYPE_REG)
|
||||||
|
{
|
||||||
|
if (SearchVar(var, assign, false))
|
||||||
|
paint.fillRect(QRect(0, 0, iconSize_, iconSize_), QColor(255, 0, 0));
|
||||||
|
}
|
||||||
|
else if (var->VarType() == eVariationType::VARTYPE_PRE || var->VarType() == eVariationType::VARTYPE_POST)
|
||||||
|
{
|
||||||
|
if (var->AssignType() == eVariationAssignType::ASSIGNTYPE_SUM)
|
||||||
|
paint.fillRect(QRect(0, 0, iconSize_, iconSize_), QColor(255, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isDc = SearchVar(var, dc, false);
|
||||||
|
|
||||||
|
if (isDc)
|
||||||
|
paint.fillRect(QRect(iconSize_, 0, iconSize_, iconSize_), QColor(0, 255, 0));
|
||||||
|
|
||||||
|
if (!var->StateOpenCLString().empty())
|
||||||
|
paint.fillRect(QRect(iconSize_ * 2, 0, iconSize_, iconSize_), QColor(0, 0, 255));
|
||||||
|
|
||||||
|
QIcon qi(pixmap);
|
||||||
|
item->setIcon(2, qi);
|
||||||
spinBox->setRange(fMin, fMax);
|
spinBox->setRange(fMin, fMax);
|
||||||
spinBox->DoubleClick(true);
|
spinBox->DoubleClick(true);
|
||||||
spinBox->DoubleClickZero(1);
|
spinBox->DoubleClickZero(1);
|
||||||
@ -357,6 +391,8 @@ void FractoriumEmberController<T>::FillVariationTreeWithXform(Xform<T>* xform)
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logicalIndex">Column index of the header clicked. Sort by name if 0, sort by weight if 1.</param>
|
/// <param name="logicalIndex">Column index of the header clicked. Sort by name if 0, sort by weight if 1.</param>
|
||||||
void Fractorium::OnTreeHeaderSectionClicked(int logicalIndex)
|
void Fractorium::OnTreeHeaderSectionClicked(int logicalIndex)
|
||||||
|
{
|
||||||
|
if (logicalIndex <= 1)
|
||||||
{
|
{
|
||||||
m_VarSortMode = logicalIndex;
|
m_VarSortMode = logicalIndex;
|
||||||
ui.VariationsTree->sortItems(m_VarSortMode, m_VarSortMode == 0 ? Qt::AscendingOrder : Qt::DescendingOrder);
|
ui.VariationsTree->sortItems(m_VarSortMode, m_VarSortMode == 0 ? Qt::AscendingOrder : Qt::DescendingOrder);
|
||||||
@ -364,6 +400,7 @@ void Fractorium::OnTreeHeaderSectionClicked(int logicalIndex)
|
|||||||
if (m_VarSortMode == 1)
|
if (m_VarSortMode == 1)
|
||||||
ui.VariationsTree->scrollToTop();
|
ui.VariationsTree->scrollToTop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply the text in the variation filter text box to only show variations whose names
|
/// Apply the text in the variation filter text box to only show variations whose names
|
||||||
|
@ -175,7 +175,7 @@ typename v3T GLEmberController<T>::SnapToNormalizedAngle(v3T& vec, uint division
|
|||||||
{
|
{
|
||||||
T rsq, theta;
|
T rsq, theta;
|
||||||
T bestRsq = numeric_limits<T>::max();
|
T bestRsq = numeric_limits<T>::max();
|
||||||
v3T c, best;
|
v3T c(0, 0, 0), best;
|
||||||
best.x = 1;
|
best.x = 1;
|
||||||
best.y = 0;
|
best.y = 0;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
void CalcDragTranslation();
|
void CalcDragTranslation();
|
||||||
void SetSelectedXform(Xform<T>* xform);
|
void SetSelectedXform(Xform<T>* xform);
|
||||||
void DrawGrid();
|
void DrawGrid();
|
||||||
void DrawAffine(Xform<T>* xform, bool pre, bool selected);
|
void DrawAffine(Xform<T>* xform, bool pre, bool selected, bool hovered);
|
||||||
int UpdateHover(v3T& glCoords);
|
int UpdateHover(v3T& glCoords);
|
||||||
bool CheckXformHover(Xform<T>* xform, v3T& glCoords, T& bestDist, bool pre, bool post);
|
bool CheckXformHover(Xform<T>* xform, v3T& glCoords, T& bestDist, bool pre, bool post);
|
||||||
|
|
||||||
|
@ -390,10 +390,9 @@ void GLEmberController<T>::SetSelectedXform(Xform<T>* xform)
|
|||||||
{
|
{
|
||||||
//By doing this check, it prevents triggering unnecessary events when selecting an xform on this window with the mouse,
|
//By doing this check, it prevents triggering unnecessary events when selecting an xform on this window with the mouse,
|
||||||
//which will set the combo box on the main window, which will trigger this call. However, if the xform has been selected
|
//which will set the combo box on the main window, which will trigger this call. However, if the xform has been selected
|
||||||
//here with the mouse, the window has already repainted, so there's no need to do it again.
|
//here with the mouse, the window has already been repainted, so there's no need to do it again.
|
||||||
if (m_SelectedXform != xform || m_HoverXform != xform)
|
if (m_SelectedXform != xform)
|
||||||
{
|
{
|
||||||
m_HoverXform = xform;
|
|
||||||
m_SelectedXform = xform;
|
m_SelectedXform = xform;
|
||||||
|
|
||||||
if (m_GL->m_Init)
|
if (m_GL->m_Init)
|
||||||
@ -513,7 +512,7 @@ void GLWidget::initializeGL()
|
|||||||
this->glEnable(GL_PROGRAM_POINT_SIZE);
|
this->glEnable(GL_PROGRAM_POINT_SIZE);
|
||||||
this->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_MaxTexSize);
|
this->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_MaxTexSize);
|
||||||
this->glDisable(GL_TEXTURE_2D);
|
this->glDisable(GL_TEXTURE_2D);
|
||||||
m_Fractorium->m_WidthSpin->setMaximum(m_MaxTexSize);//This should also apply to the final render dialog.//TODO
|
m_Fractorium->m_WidthSpin->setMaximum(m_MaxTexSize);
|
||||||
m_Fractorium->m_HeightSpin->setMaximum(m_MaxTexSize);
|
m_Fractorium->m_HeightSpin->setMaximum(m_MaxTexSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,9 +534,18 @@ void GLWidget::paintGL()
|
|||||||
auto controller = m_Fractorium->m_Controller.get();
|
auto controller = m_Fractorium->m_Controller.get();
|
||||||
|
|
||||||
//Ensure there is a renderer and that it's supposed to be drawing, signified by the running timer.
|
//Ensure there is a renderer and that it's supposed to be drawing, signified by the running timer.
|
||||||
if (controller && controller->Renderer())
|
if (controller && controller->Renderer()/* && controller->ProcessState() != eProcessState::NONE*/)//Need a way to determine if at leat one successful render has happened.
|
||||||
{
|
{
|
||||||
auto renderer = controller->Renderer();
|
auto renderer = controller->Renderer();
|
||||||
|
float unitX = std::abs(renderer->UpperRightX(false) - renderer->LowerLeftX(false)) / 2.0f;
|
||||||
|
float unitY = std::abs(renderer->UpperRightY(false) - renderer->LowerLeftY(false)) / 2.0f;
|
||||||
|
|
||||||
|
if (unitX > 100000 || unitY > 100000)//Need a better way to do this.//TODO
|
||||||
|
{
|
||||||
|
qDebug() << unitX << " " << unitY;
|
||||||
|
//return;
|
||||||
|
}
|
||||||
|
|
||||||
m_Drawing = true;
|
m_Drawing = true;
|
||||||
|
|
||||||
if (m_Fractorium->DrawImage())
|
if (m_Fractorium->DrawImage())
|
||||||
@ -553,8 +561,6 @@ void GLWidget::paintGL()
|
|||||||
//Affine drawing.
|
//Affine drawing.
|
||||||
bool pre = m_Fractorium->ui.PreAffineGroupBox->isChecked();
|
bool pre = m_Fractorium->ui.PreAffineGroupBox->isChecked();
|
||||||
bool post = m_Fractorium->ui.PostAffineGroupBox->isChecked();
|
bool post = m_Fractorium->ui.PostAffineGroupBox->isChecked();
|
||||||
float unitX = std::abs(renderer->UpperRightX(false) - renderer->LowerLeftX(false)) / 2.0f;
|
|
||||||
float unitY = std::abs(renderer->UpperRightY(false) - renderer->LowerLeftY(false)) / 2.0f;
|
|
||||||
this->glEnable(GL_BLEND);
|
this->glEnable(GL_BLEND);
|
||||||
this->glEnable(GL_LINE_SMOOTH);
|
this->glEnable(GL_LINE_SMOOTH);
|
||||||
this->glEnable(GL_POINT_SMOOTH);
|
this->glEnable(GL_POINT_SMOOTH);
|
||||||
@ -635,7 +641,6 @@ void GLEmberController<T>::DrawAffines(bool pre, bool post)
|
|||||||
{
|
{
|
||||||
auto dprf = m_GL->devicePixelRatioF();
|
auto dprf = m_GL->devicePixelRatioF();
|
||||||
auto world = ScrolledCenter(true);
|
auto world = ScrolledCenter(true);
|
||||||
|
|
||||||
m_GL->glLineWidth(1.0f * dprf);
|
m_GL->glLineWidth(1.0f * dprf);
|
||||||
GLfloat vertices[] =
|
GLfloat vertices[] =
|
||||||
{
|
{
|
||||||
@ -654,7 +659,7 @@ void GLEmberController<T>::DrawAffines(bool pre, bool post)
|
|||||||
if (!m_Fractorium->m_Settings->ShowAllXforms() && dragging)
|
if (!m_Fractorium->m_Settings->ShowAllXforms() && dragging)
|
||||||
{
|
{
|
||||||
if (m_SelectedXform)
|
if (m_SelectedXform)
|
||||||
DrawAffine(m_SelectedXform, m_AffineType == eAffineType::AffinePre, true);
|
DrawAffine(m_SelectedXform, m_AffineType == eAffineType::AffinePre, true, false);
|
||||||
}
|
}
|
||||||
else//Show all while dragging, or not dragging just hovering/mouse move.
|
else//Show all while dragging, or not dragging just hovering/mouse move.
|
||||||
{
|
{
|
||||||
@ -664,13 +669,30 @@ void GLEmberController<T>::DrawAffines(bool pre, bool post)
|
|||||||
|
|
||||||
while (auto xform = ember->GetTotalXform(i, forceFinal))
|
while (auto xform = ember->GetTotalXform(i, forceFinal))
|
||||||
{
|
{
|
||||||
bool selected = m_Fractorium->IsXformSelected(i++) || (dragging ? (m_SelectedXform == xform) : (m_HoverXform == xform));
|
bool selected = m_Fractorium->IsXformSelected(i++) || m_SelectedXform == xform;
|
||||||
DrawAffine(xform, true, selected);
|
DrawAffine(xform, true, selected, !dragging && (m_HoverXform == xform));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pre && m_HoverXform)//Only draw current pre affine.
|
else if (pre && m_Fractorium->DrawSelectedPre())//Only draw selected pre affine, and if none are selected, draw current. All are considered "selected", so circles are drawn around them.
|
||||||
{
|
{
|
||||||
DrawAffine(m_HoverXform, true, true);
|
size_t i = 0;
|
||||||
|
bool any = false;
|
||||||
|
|
||||||
|
while (auto xform = ember->GetTotalXform(i, forceFinal))
|
||||||
|
{
|
||||||
|
if (m_Fractorium->IsXformSelected(i++))
|
||||||
|
{
|
||||||
|
DrawAffine(xform, true, true, !dragging && (m_HoverXform == xform));
|
||||||
|
any = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!any)
|
||||||
|
DrawAffine(m_FractoriumEmberController->CurrentXform(), true, true, !dragging && (m_HoverXform == m_FractoriumEmberController->CurrentXform()));
|
||||||
|
}
|
||||||
|
else if (pre)//Only draw current pre affine.
|
||||||
|
{
|
||||||
|
DrawAffine(m_SelectedXform, true, true, !dragging && (m_HoverXform == m_FractoriumEmberController->CurrentXform()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (post && m_Fractorium->DrawAllPost())//Draw all post affine if specified.
|
if (post && m_Fractorium->DrawAllPost())//Draw all post affine if specified.
|
||||||
@ -679,13 +701,30 @@ void GLEmberController<T>::DrawAffines(bool pre, bool post)
|
|||||||
|
|
||||||
while (auto xform = ember->GetTotalXform(i, forceFinal))
|
while (auto xform = ember->GetTotalXform(i, forceFinal))
|
||||||
{
|
{
|
||||||
bool selected = m_Fractorium->IsXformSelected(i++) || (dragging ? (m_SelectedXform == xform) : (m_HoverXform == xform));
|
bool selected = m_Fractorium->IsXformSelected(i++) || m_SelectedXform == xform;
|
||||||
DrawAffine(xform, false, selected);
|
DrawAffine(xform, false, selected, !dragging && (m_HoverXform == xform));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (post && m_HoverXform)//Only draw current post affine.
|
else if (post && m_Fractorium->DrawSelectedPost())//Only draw selected post, and if none are selected, draw current. All are considered "selected", so circles are drawn around them.
|
||||||
{
|
{
|
||||||
DrawAffine(m_HoverXform, false, true);
|
size_t i = 0;
|
||||||
|
bool any = false;
|
||||||
|
|
||||||
|
while (auto xform = ember->GetTotalXform(i, forceFinal))
|
||||||
|
{
|
||||||
|
if (m_Fractorium->IsXformSelected(i++))
|
||||||
|
{
|
||||||
|
DrawAffine(xform, false, true, !dragging && (m_HoverXform == xform));
|
||||||
|
any = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!any)
|
||||||
|
DrawAffine(m_FractoriumEmberController->CurrentXform(), false, true, !dragging && (m_HoverXform == m_FractoriumEmberController->CurrentXform()));
|
||||||
|
}
|
||||||
|
else if (post)//Only draw current post affine.
|
||||||
|
{
|
||||||
|
DrawAffine(m_SelectedXform, false, true, !dragging && (m_HoverXform == m_FractoriumEmberController->CurrentXform()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1032,7 +1071,9 @@ void GLEmberController<T>::MouseMove(QMouseEvent* e)
|
|||||||
//Check if they weren't dragging and weren't hovering over any affine.
|
//Check if they weren't dragging and weren't hovering over any affine.
|
||||||
//In that case, nothing needs to be done.
|
//In that case, nothing needs to be done.
|
||||||
if (UpdateHover(mouseFlipped) == -1)
|
if (UpdateHover(mouseFlipped) == -1)
|
||||||
draw = false;
|
{
|
||||||
|
m_HoverXform = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Only update if the user was dragging or hovered over a point.
|
//Only update if the user was dragging or hovered over a point.
|
||||||
@ -1128,7 +1169,7 @@ void GLWidget::DrawPointOrLine(const QVector4D& col, const GLfloat* vertices, in
|
|||||||
{
|
{
|
||||||
#ifdef USE_GLSL
|
#ifdef USE_GLSL
|
||||||
|
|
||||||
if (dashed && drawType == GL_LINES)
|
if (dashed && (drawType == GL_LINES || drawType == GL_LINE_LOOP))
|
||||||
{
|
{
|
||||||
glLineStipple(1, 0XFF00);
|
glLineStipple(1, 0XFF00);
|
||||||
glEnable(GL_LINE_STIPPLE);
|
glEnable(GL_LINE_STIPPLE);
|
||||||
@ -1143,7 +1184,7 @@ void GLWidget::DrawPointOrLine(const QVector4D& col, const GLfloat* vertices, in
|
|||||||
this->glDrawArrays(drawType, 0, size);
|
this->glDrawArrays(drawType, 0, size);
|
||||||
this->glDisableVertexAttribArray(0);
|
this->glDisableVertexAttribArray(0);
|
||||||
|
|
||||||
if (dashed && drawType == GL_LINES)
|
if (dashed && (drawType == GL_LINES || drawType == GL_LINE_LOOP))
|
||||||
glDisable(GL_LINE_STIPPLE);
|
glDisable(GL_LINE_STIPPLE);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -1370,7 +1411,13 @@ void GLEmberController<T>::DrawGrid()
|
|||||||
//qDebug() << renderer->UpperRightX(false) << " " << renderer->LowerLeftX(false) << " " << renderer->UpperRightY(false) << " " << renderer->LowerLeftY(false);
|
//qDebug() << renderer->UpperRightX(false) << " " << renderer->LowerLeftX(false) << " " << renderer->UpperRightY(false) << " " << renderer->LowerLeftY(false);
|
||||||
float unitX = (std::abs(renderer->UpperRightX(false) - renderer->LowerLeftX(false)) / 2.0f) / scale;
|
float unitX = (std::abs(renderer->UpperRightX(false) - renderer->LowerLeftX(false)) / 2.0f) / scale;
|
||||||
float unitY = (std::abs(renderer->UpperRightY(false) - renderer->LowerLeftY(false)) / 2.0f) / scale;
|
float unitY = (std::abs(renderer->UpperRightY(false) - renderer->LowerLeftY(false)) / 2.0f) / scale;
|
||||||
//qDebug() << unitX << " " << unitY;
|
|
||||||
|
if (unitX > 100000 || unitY > 100000)//Need a better way to do this.//TODO
|
||||||
|
{
|
||||||
|
qDebug() << unitX << " " << unitY;
|
||||||
|
//return;
|
||||||
|
}
|
||||||
|
|
||||||
float xLow = std::floor(-unitX);
|
float xLow = std::floor(-unitX);
|
||||||
float xHigh = std::ceil(unitX);
|
float xHigh = std::ceil(unitX);
|
||||||
float yLow = std::floor(-unitY);
|
float yLow = std::floor(-unitY);
|
||||||
@ -1479,8 +1526,9 @@ void GLEmberController<T>::DrawGrid()
|
|||||||
/// <param name="xform">A pointer to the xform whose affine will be drawn</param>
|
/// <param name="xform">A pointer to the xform whose affine will be drawn</param>
|
||||||
/// <param name="pre">True for pre affine, else false for post.</param>
|
/// <param name="pre">True for pre affine, else false for post.</param>
|
||||||
/// <param name="selected">True if selected (draw enclosing circle), else false (only draw axes).</param>
|
/// <param name="selected">True if selected (draw enclosing circle), else false (only draw axes).</param>
|
||||||
|
/// <param name="hovered">True if the xform is being hovered over (draw tansparent disc), else false (no disc).</param>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void GLEmberController<T>::DrawAffine(Xform<T>* xform, bool pre, bool selected)
|
void GLEmberController<T>::DrawAffine(Xform<T>* xform, bool pre, bool selected, bool hovered)
|
||||||
{
|
{
|
||||||
auto ember = m_FractoriumEmberController->CurrentEmber();
|
auto ember = m_FractoriumEmberController->CurrentEmber();
|
||||||
auto final = ember->IsFinalXform(xform);
|
auto final = ember->IsFinalXform(xform);
|
||||||
@ -1498,9 +1546,9 @@ void GLEmberController<T>::DrawAffine(Xform<T>* xform, bool pre, bool selected)
|
|||||||
MultMatrix(mat);
|
MultMatrix(mat);
|
||||||
//QueryMatrices(true);
|
//QueryMatrices(true);
|
||||||
m_GL->glLineWidth(3.0f * m_GL->devicePixelRatioF());//One 3px wide, colored black, except green on x axis for post affine.
|
m_GL->glLineWidth(3.0f * m_GL->devicePixelRatioF());//One 3px wide, colored black, except green on x axis for post affine.
|
||||||
m_GL->DrawAffineHelper(index, selected, pre, final, true);
|
m_GL->DrawAffineHelper(index, selected, hovered, pre, final, true);
|
||||||
m_GL->glLineWidth(1.0f * m_GL->devicePixelRatioF());//Again 1px wide, colored white, to give a white middle with black outline effect.
|
m_GL->glLineWidth(1.0f * m_GL->devicePixelRatioF());//Again 1px wide, colored white, to give a white middle with black outline effect.
|
||||||
m_GL->DrawAffineHelper(index, selected, pre, final, false);
|
m_GL->DrawAffineHelper(index, selected, hovered, pre, final, false);
|
||||||
m_GL->glPointSize(5.0f * m_GL->devicePixelRatioF());//Three black points, one in the center and two on the circle. Drawn big 5px first to give a black outline.
|
m_GL->glPointSize(5.0f * m_GL->devicePixelRatioF());//Three black points, one in the center and two on the circle. Drawn big 5px first to give a black outline.
|
||||||
m_GL->glBegin(GL_POINTS);
|
m_GL->glBegin(GL_POINTS);
|
||||||
m_GL->glColor4f(0.0f, 0.0f, 0.0f, selected ? 1.0f : 0.5f);
|
m_GL->glColor4f(0.0f, 0.0f, 0.0f, selected ? 1.0f : 0.5f);
|
||||||
@ -1528,9 +1576,9 @@ void GLEmberController<T>::DrawAffine(Xform<T>* xform, bool pre, bool selected)
|
|||||||
glm::tmat4x4<float, glm::defaultp> tempmat4 = mat;
|
glm::tmat4x4<float, glm::defaultp> tempmat4 = mat;
|
||||||
m_GL->m_ModelViewMatrix = QMatrix4x4(glm::value_ptr(tempmat4));
|
m_GL->m_ModelViewMatrix = QMatrix4x4(glm::value_ptr(tempmat4));
|
||||||
m_GL->glLineWidth(3.0f * m_GL->devicePixelRatioF());//One 3px wide, colored black, except green on x axis for post affine.
|
m_GL->glLineWidth(3.0f * m_GL->devicePixelRatioF());//One 3px wide, colored black, except green on x axis for post affine.
|
||||||
m_GL->DrawAffineHelper(index, selected, pre, final, true);
|
m_GL->DrawAffineHelper(index, selected, hovered, pre, final, true);
|
||||||
m_GL->glLineWidth(1.0f * m_GL->devicePixelRatioF());//Again 1px wide, colored white, to give a white middle with black outline effect.
|
m_GL->glLineWidth(1.0f * m_GL->devicePixelRatioF());//Again 1px wide, colored white, to give a white middle with black outline effect.
|
||||||
m_GL->DrawAffineHelper(index, selected, pre, final, false);
|
m_GL->DrawAffineHelper(index, selected, hovered, pre, final, false);
|
||||||
QVector4D col(0.0f, 0.0f, 0.0f, selected ? 1.0f : 0.5f);
|
QVector4D col(0.0f, 0.0f, 0.0f, selected ? 1.0f : 0.5f);
|
||||||
m_Verts.clear();
|
m_Verts.clear();
|
||||||
m_Verts.push_back(0.0f);
|
m_Verts.push_back(0.0f);
|
||||||
@ -1577,10 +1625,11 @@ void GLEmberController<T>::DrawAffine(Xform<T>* xform, bool pre, bool selected)
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <param name="selected">True if selected (draw enclosing circle), else false (only draw axes).</param>
|
/// <param name="selected">True if selected (draw enclosing circle), else false (only draw axes).</param>
|
||||||
|
/// <param name="hovered">True if the xform is being hovered over (draw tansparent disc), else false (no disc).</param>
|
||||||
/// <param name="pre"></param>
|
/// <param name="pre"></param>
|
||||||
/// <param name="final"></param>
|
/// <param name="final"></param>
|
||||||
/// <param name="background"></param>
|
/// <param name="background"></param>
|
||||||
void GLWidget::DrawAffineHelper(int index, bool selected, bool pre, bool final, bool background)
|
void GLWidget::DrawAffineHelper(int index, bool selected, bool hovered, bool pre, bool final, bool background)
|
||||||
{
|
{
|
||||||
float px = 1.0f;
|
float px = 1.0f;
|
||||||
float py = 0.0f;
|
float py = 0.0f;
|
||||||
@ -1641,32 +1690,28 @@ void GLWidget::DrawAffineHelper(int index, bool selected, bool pre, bool final,
|
|||||||
//Circle part.
|
//Circle part.
|
||||||
if (!background)
|
if (!background)
|
||||||
{
|
{
|
||||||
color = QVector4D(col.redF(), col.greenF(), col.blueF(), 1.0f);//Draw pre affine transform with white.
|
color = QVector4D(col.redF(), col.greenF(), col.blueF(), hovered ? 0.25f : 1.0f);//Draw pre affine transform with white.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color = QVector4D(0.0f, 0.0f, 0.0f, 1.0f);//Draw pre affine transform outline with white.
|
color = QVector4D(0.0f, 0.0f, 0.0f, hovered ? 0.25f : 1.0f);//Draw pre affine transform outline with white.
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Verts.clear();
|
m_Verts.clear();
|
||||||
|
|
||||||
if (selected)
|
if (selected || hovered)
|
||||||
{
|
{
|
||||||
for (size_t i = 1; i <= 64; i++)//The circle.
|
for (size_t i = 1; i <= 64; i++)//The circle.
|
||||||
{
|
{
|
||||||
float theta = float(M_PI) * 2.0f * float(i % 64) / 64.0f;
|
float theta = float(M_PI) * 2.0f * float(i % 64) / 64.0f;
|
||||||
float fx = std::cos(theta);
|
float fx = std::cos(theta);
|
||||||
float fy = std::sin(theta);
|
float fy = std::sin(theta);
|
||||||
m_Verts.push_back(px);
|
|
||||||
m_Verts.push_back(py);
|
|
||||||
m_Verts.push_back(fx);
|
m_Verts.push_back(fx);
|
||||||
m_Verts.push_back(fy);
|
m_Verts.push_back(fy);
|
||||||
px = fx;
|
|
||||||
py = fy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPointOrLine(color, m_Verts, GL_LINES, !pre);
|
DrawPointOrLine(color, m_Verts, hovered ? GL_TRIANGLE_FAN : GL_LINE_LOOP, !pre);
|
||||||
|
}
|
||||||
|
|
||||||
//Lines from center to circle.
|
//Lines from center to circle.
|
||||||
if (!background)
|
if (!background)
|
||||||
@ -1712,8 +1757,6 @@ int GLEmberController<T>::UpdateHover(v3T& glCoords)
|
|||||||
{
|
{
|
||||||
bool pre = m_Fractorium->ui.PreAffineGroupBox->isChecked();
|
bool pre = m_Fractorium->ui.PreAffineGroupBox->isChecked();
|
||||||
bool post = m_Fractorium->ui.PostAffineGroupBox->isChecked();
|
bool post = m_Fractorium->ui.PostAffineGroupBox->isChecked();
|
||||||
bool preAll = pre && m_Fractorium->DrawAllPre();
|
|
||||||
bool postAll = post && m_Fractorium->DrawAllPost();
|
|
||||||
int i = 0, bestIndex = -1;
|
int i = 0, bestIndex = -1;
|
||||||
T bestDist = 10;
|
T bestDist = 10;
|
||||||
auto ember = m_FractoriumEmberController->CurrentEmber();
|
auto ember = m_FractoriumEmberController->CurrentEmber();
|
||||||
@ -1729,10 +1772,11 @@ int GLEmberController<T>::UpdateHover(v3T& glCoords)
|
|||||||
//These checks prevent highlighting the pre/post selected xform circle, when one is set to show all, and the other
|
//These checks prevent highlighting the pre/post selected xform circle, when one is set to show all, and the other
|
||||||
//is set to show current, and the user hovers over another xform, but doesn't select it, then moves the mouse
|
//is set to show current, and the user hovers over another xform, but doesn't select it, then moves the mouse
|
||||||
//back over the hidden circle for the pre/post that was set to only show current.
|
//back over the hidden circle for the pre/post that was set to only show current.
|
||||||
bool checkSelPre = preAll || (pre && m_HoverXform == m_SelectedXform);
|
bool isSel = m_Fractorium->IsXformSelected(ember->GetTotalXformIndex(m_SelectedXform));
|
||||||
bool checkSelPost = postAll || (post && m_HoverXform == m_SelectedXform);
|
bool checkPre = pre && (m_Fractorium->DrawAllPre() || (m_Fractorium->DrawSelectedPre() && isSel) || m_Fractorium->DrawCurrentPre());
|
||||||
|
bool checkPost = post && (m_Fractorium->DrawAllPost() || (m_Fractorium->DrawSelectedPost() && isSel) || m_Fractorium->DrawCurrentPost());
|
||||||
|
|
||||||
if (CheckXformHover(m_SelectedXform, glCoords, bestDist, checkSelPre, checkSelPost))
|
if (CheckXformHover(m_SelectedXform, glCoords, bestDist, checkPre, checkPost))
|
||||||
{
|
{
|
||||||
m_HoverXform = m_SelectedXform;
|
m_HoverXform = m_SelectedXform;
|
||||||
bestIndex = int(ember->GetTotalXformIndex(m_SelectedXform, forceFinal));
|
bestIndex = int(ember->GetTotalXformIndex(m_SelectedXform, forceFinal));
|
||||||
@ -1740,10 +1784,15 @@ int GLEmberController<T>::UpdateHover(v3T& glCoords)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Check all xforms.
|
//Check all xforms.
|
||||||
|
|
||||||
while (auto xform = ember->GetTotalXform(i, forceFinal))
|
while (auto xform = ember->GetTotalXform(i, forceFinal))
|
||||||
{
|
{
|
||||||
if (preAll || (pre && m_HoverXform == xform))//Only check pre affine if they are shown.
|
bool isSel = m_Fractorium->IsXformSelected(i);
|
||||||
|
|
||||||
|
if (pre)
|
||||||
|
{
|
||||||
|
bool checkPre = m_Fractorium->DrawAllPre() || (m_Fractorium->DrawSelectedPre() && isSel) || (m_SelectedXform == xform);
|
||||||
|
|
||||||
|
if (checkPre)//Only check pre affine if they are shown.
|
||||||
{
|
{
|
||||||
if (CheckXformHover(xform, glCoords, bestDist, true, false))
|
if (CheckXformHover(xform, glCoords, bestDist, true, false))
|
||||||
{
|
{
|
||||||
@ -1751,8 +1800,13 @@ int GLEmberController<T>::UpdateHover(v3T& glCoords)
|
|||||||
bestIndex = i;
|
bestIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (postAll || (post && m_HoverXform == xform))//Only check post affine if they are shown.
|
if (post)
|
||||||
|
{
|
||||||
|
bool checkPost = m_Fractorium->DrawAllPost() || (m_Fractorium->DrawSelectedPost() && isSel) || (m_SelectedXform == xform);
|
||||||
|
|
||||||
|
if (checkPost)
|
||||||
{
|
{
|
||||||
if (CheckXformHover(xform, glCoords, bestDist, false, true))
|
if (CheckXformHover(xform, glCoords, bestDist, false, true))
|
||||||
{
|
{
|
||||||
@ -1760,6 +1814,7 @@ int GLEmberController<T>::UpdateHover(v3T& glCoords)
|
|||||||
bestIndex = i;
|
bestIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -1885,15 +1940,15 @@ bool GLEmberController<T>::CheckXformHover(Xform<T>* xform, v3T& glCoords, T& be
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculate the new affine transform when dragging with the x axis with the left mouse button.
|
/// Calculate the new affine transform when dragging with the x axis with the left mouse button.
|
||||||
/// The value returned will depend on whether any modifier keys were held down.
|
/// The value returned will depend on whether any modifier keys were held down.
|
||||||
/// None: Rotate and scale only.
|
/// None: Rotate only.
|
||||||
/// Local Pivot:
|
/// Local Pivot:
|
||||||
/// Shift: Rotate only about affine center.
|
/// Shift: Scale and optionally Rotate about affine center.
|
||||||
/// Alt: Free transform.
|
/// Alt: Rotate single axis about affine center.
|
||||||
/// Shift + Alt: Rotate single axis about affine center.
|
/// Shift + Alt: Free transform.
|
||||||
/// Control: Rotate and scale, snapping to grid.
|
/// Control: Rotate, snapping to grid.
|
||||||
/// Control + Shift: Rotate only, snapping to grid.
|
/// Control + Shift: Scale and optionally Rotate, snapping to grid.
|
||||||
/// Control + Alt: Free transform, snapping to grid.
|
/// Control + Alt: Rotate single axis about affine center, snapping to grid.
|
||||||
/// Control + Shift + Alt: Rotate single axis about affine center, snapping to grid.
|
/// Control + Shift + Alt: Free transform, snapping to grid.
|
||||||
/// World Pivot:
|
/// World Pivot:
|
||||||
/// Shift + Alt: Rotate single axis about world center.
|
/// Shift + Alt: Rotate single axis about world center.
|
||||||
/// Control + Shift + Alt: Rotate single axis about world center, snapping to grid.
|
/// Control + Shift + Alt: Rotate single axis about world center, snapping to grid.
|
||||||
@ -1907,61 +1962,18 @@ void GLEmberController<T>::CalcDragXAxis()
|
|||||||
auto worldToAffineScale = m_FractoriumEmberController->AffineScaleCurrentToLocked();
|
auto worldToAffineScale = m_FractoriumEmberController->AffineScaleCurrentToLocked();
|
||||||
bool pre = m_AffineType == eAffineType::AffinePre;
|
bool pre = m_AffineType == eAffineType::AffinePre;
|
||||||
bool worldPivotShiftAlt = !m_Fractorium->LocalPivot() && GetShift() && GetAlt();
|
bool worldPivotShiftAlt = !m_Fractorium->LocalPivot() && GetShift() && GetAlt();
|
||||||
auto startDiff = (v2T(m_HoverHandlePos) * affineToWorldScale) - m_DragSrcTransform.O();
|
auto worldRelAxisStartScaled = (v2T(m_HoverHandlePos) * affineToWorldScale) - m_DragSrcTransform.O();//World axis start position, relative, scaled by the zoom.
|
||||||
T startAngle = std::atan2(startDiff.y, startDiff.x);
|
T startAngle = std::atan2(worldRelAxisStartScaled.y, worldRelAxisStartScaled.x);
|
||||||
|
v3T relScaled = (m_MouseWorldPos * affineToWorldScale) - v3T(m_DragSrcTransform.O(), 0);
|
||||||
|
|
||||||
if (GetShift())
|
if (!GetShift())
|
||||||
{
|
{
|
||||||
v3T snapped = GetControl() ? SnapToNormalizedAngle(m_MouseWorldPos, 24u) : m_MouseWorldPos;
|
|
||||||
auto endDiff = (v2T(snapped) * affineToWorldScale) - m_DragSrcTransform.O();
|
|
||||||
T endAngle = std::atan2(endDiff.y, endDiff.x);
|
|
||||||
T angle = startAngle - endAngle;
|
|
||||||
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
|
|
||||||
{
|
|
||||||
auto& affine = pre ? xform->m_Affine : xform->m_Post;
|
|
||||||
auto srcRotated = m_DragSrcTransforms[selIndex];
|
|
||||||
|
|
||||||
if (worldPivotShiftAlt)
|
|
||||||
{
|
|
||||||
srcRotated.X(srcRotated.O() + srcRotated.X());
|
|
||||||
srcRotated.O(v2T(0));
|
|
||||||
srcRotated.Rotate(angle);
|
|
||||||
affine.X(srcRotated.X() - affine.O());
|
|
||||||
}
|
|
||||||
else if (GetAlt())
|
|
||||||
{
|
|
||||||
srcRotated.Rotate(angle);
|
|
||||||
affine.X(srcRotated.X());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
srcRotated.Rotate(angle);
|
|
||||||
affine = srcRotated;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xform == m_FractoriumEmberController->CurrentXform())
|
|
||||||
m_DragHandlePos = v3T((affine.O() + affine.X()) * worldToAffineScale, 0);
|
|
||||||
}, eXformUpdate::UPDATE_CURRENT_AND_SELECTED, false);//Calling code will update renderer.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
v3T diff = m_MouseWorldPos - m_MouseDownWorldPos;
|
|
||||||
auto diffscale = diff * affineToWorldScale;
|
|
||||||
auto origmag = Zeps(glm::length(m_DragSrcTransform.X()));
|
|
||||||
auto origXPlusOff = v3T(m_DragSrcTransform.X(), 0) + diffscale;
|
|
||||||
|
|
||||||
if (GetControl())
|
if (GetControl())
|
||||||
{
|
{
|
||||||
auto o3 = v3T(m_DragSrcTransform.O(), 0);
|
relScaled = SnapToNormalizedAngle(relScaled, 24u);//relScaled is using the relative scaled position of the axis.
|
||||||
auto o3x = origXPlusOff + o3;
|
|
||||||
origXPlusOff = SnapToGrid(o3x);
|
|
||||||
origXPlusOff -= o3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto newmag = glm::length(origXPlusOff);
|
T endAngle = std::atan2(relScaled.y, relScaled.x);
|
||||||
auto newprc = newmag / origmag;
|
|
||||||
auto endDiff = (v2T(origXPlusOff) * affineToWorldScale);
|
|
||||||
T endAngle = std::atan2(endDiff.y, endDiff.x);
|
|
||||||
T angle = startAngle - endAngle;
|
T angle = startAngle - endAngle;
|
||||||
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
|
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
|
||||||
{
|
{
|
||||||
@ -1970,12 +1982,55 @@ void GLEmberController<T>::CalcDragXAxis()
|
|||||||
|
|
||||||
if (GetAlt())
|
if (GetAlt())
|
||||||
{
|
{
|
||||||
affine.X(v2T(origXPlusOff));//Absolute, not ratio.
|
src.Rotate(angle);
|
||||||
|
affine.X(src.X());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
src.Rotate(angle);
|
||||||
|
affine = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xform == m_FractoriumEmberController->CurrentXform())
|
||||||
|
m_DragHandlePos = v3T((affine.O() + affine.X()) * worldToAffineScale, 0);
|
||||||
|
}, eXformUpdate::UPDATE_CURRENT_AND_SELECTED, false);//Calling code will update renderer.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto origmag = Zeps(glm::length(m_DragSrcTransform.X()));//Magnitude of original dragged axis before it was dragged.
|
||||||
|
|
||||||
|
if (GetControl())
|
||||||
|
{
|
||||||
|
relScaled = SnapToGrid(relScaled);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto newmag = glm::length(relScaled);
|
||||||
|
auto newprc = newmag / origmag;
|
||||||
|
T endAngle = std::atan2(relScaled.y, relScaled.x);
|
||||||
|
T angle = startAngle - endAngle;
|
||||||
|
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
|
||||||
|
{
|
||||||
|
auto& affine = pre ? xform->m_Affine : xform->m_Post;
|
||||||
|
auto src = m_DragSrcTransforms[selIndex];
|
||||||
|
|
||||||
|
if (worldPivotShiftAlt)
|
||||||
|
{
|
||||||
|
src.X(src.O() + src.X());
|
||||||
|
src.O(v2T(0));
|
||||||
|
src.Rotate(angle);
|
||||||
|
affine.X(src.X() - affine.O());
|
||||||
|
}
|
||||||
|
else if (GetAlt())
|
||||||
|
{
|
||||||
|
affine.X(v2T(relScaled));//Absolute, not ratio.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
src.ScaleXY(newprc);
|
src.ScaleXY(newprc);
|
||||||
|
|
||||||
|
if (m_Fractorium->m_Settings->RotateAndScale())
|
||||||
src.Rotate(angle);
|
src.Rotate(angle);
|
||||||
|
|
||||||
affine = src;
|
affine = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1988,15 +2043,15 @@ void GLEmberController<T>::CalcDragXAxis()
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculate the new affine transform when dragging with the y axis with the left mouse button.
|
/// Calculate the new affine transform when dragging with the y axis with the left mouse button.
|
||||||
/// The value returned will depend on whether any modifier keys were held down.
|
/// The value returned will depend on whether any modifier keys were held down.
|
||||||
/// None: Rotate and scale only.
|
/// None: Rotate only.
|
||||||
/// Local Pivot:
|
/// Local Pivot:
|
||||||
/// Shift: Rotate only about affine center.
|
/// Shift: Scale and optionally Rotate about affine center.
|
||||||
/// Alt: Free transform.
|
/// Alt: Rotate single axis about affine center.
|
||||||
/// Shift + Alt: Rotate single axis about affine center.
|
/// Shift + Alt: Free transform.
|
||||||
/// Control: Rotate and scale, snapping to grid.
|
/// Control: Rotate, snapping to grid.
|
||||||
/// Control + Shift: Rotate only, snapping to grid.
|
/// Control + Shift: Scale and optionally Rotate, snapping to grid.
|
||||||
/// Control + Alt: Free transform, snapping to grid.
|
/// Control + Alt: Rotate single axis about affine center, snapping to grid.
|
||||||
/// Control + Shift + Alt: Rotate single axis about affine center, snapping to grid.
|
/// Control + Shift + Alt: Free transform, snapping to grid.
|
||||||
/// World Pivot:
|
/// World Pivot:
|
||||||
/// Shift + Alt: Rotate single axis about world center.
|
/// Shift + Alt: Rotate single axis about world center.
|
||||||
/// Control + Shift + Alt: Rotate single axis about world center, snapping to grid.
|
/// Control + Shift + Alt: Rotate single axis about world center, snapping to grid.
|
||||||
@ -2010,61 +2065,18 @@ void GLEmberController<T>::CalcDragYAxis()
|
|||||||
auto worldToAffineScale = m_FractoriumEmberController->AffineScaleCurrentToLocked();
|
auto worldToAffineScale = m_FractoriumEmberController->AffineScaleCurrentToLocked();
|
||||||
bool pre = m_AffineType == eAffineType::AffinePre;
|
bool pre = m_AffineType == eAffineType::AffinePre;
|
||||||
bool worldPivotShiftAlt = !m_Fractorium->LocalPivot() && GetShift() && GetAlt();
|
bool worldPivotShiftAlt = !m_Fractorium->LocalPivot() && GetShift() && GetAlt();
|
||||||
auto startDiff = (v2T(m_HoverHandlePos) * affineToWorldScale) - m_DragSrcTransform.O();
|
auto worldRelAxisStartScaled = (v2T(m_HoverHandlePos) * affineToWorldScale) - m_DragSrcTransform.O();//World axis start position, relative, scaled by the zoom.
|
||||||
T startAngle = std::atan2(startDiff.y, startDiff.x);
|
T startAngle = std::atan2(worldRelAxisStartScaled.y, worldRelAxisStartScaled.x);
|
||||||
|
v3T relScaled = (m_MouseWorldPos * affineToWorldScale) - v3T(m_DragSrcTransform.O(), 0);
|
||||||
|
|
||||||
if (GetShift())
|
if (!GetShift())
|
||||||
{
|
{
|
||||||
v3T snapped = GetControl() ? SnapToNormalizedAngle(m_MouseWorldPos, 24u) : m_MouseWorldPos;
|
|
||||||
auto endDiff = (v2T(snapped) * affineToWorldScale) - m_DragSrcTransform.O();
|
|
||||||
T endAngle = std::atan2(endDiff.y, endDiff.x);
|
|
||||||
T angle = startAngle - endAngle;
|
|
||||||
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
|
|
||||||
{
|
|
||||||
auto& affine = pre ? xform->m_Affine : xform->m_Post;
|
|
||||||
auto srcRotated = m_DragSrcTransforms[selIndex];
|
|
||||||
|
|
||||||
if (worldPivotShiftAlt)
|
|
||||||
{
|
|
||||||
srcRotated.Y(srcRotated.O() + srcRotated.Y());
|
|
||||||
srcRotated.O(v2T(0));
|
|
||||||
srcRotated.Rotate(angle);
|
|
||||||
affine.Y(srcRotated.Y() - affine.O());
|
|
||||||
}
|
|
||||||
else if (GetAlt())
|
|
||||||
{
|
|
||||||
srcRotated.Rotate(angle);
|
|
||||||
affine.Y(srcRotated.Y());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
srcRotated.Rotate(angle);
|
|
||||||
affine = srcRotated;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xform == m_FractoriumEmberController->CurrentXform())
|
|
||||||
m_DragHandlePos = v3T((affine.O() + affine.Y()) * worldToAffineScale, 0);
|
|
||||||
}, eXformUpdate::UPDATE_CURRENT_AND_SELECTED, false);//Calling code will update renderer.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
v3T diff = m_MouseWorldPos - m_MouseDownWorldPos;
|
|
||||||
auto diffscale = diff * affineToWorldScale;
|
|
||||||
auto origmag = Zeps(glm::length(m_DragSrcTransform.Y()));
|
|
||||||
auto origYPlusOff = v3T(m_DragSrcTransform.Y(), 0) + diffscale;
|
|
||||||
|
|
||||||
if (GetControl())
|
if (GetControl())
|
||||||
{
|
{
|
||||||
auto o3 = v3T(m_DragSrcTransform.O(), 0);
|
relScaled = SnapToNormalizedAngle(relScaled, 24u);//relScaled is using the relative scaled position of the axis.
|
||||||
auto o3y = origYPlusOff + o3;
|
|
||||||
origYPlusOff = SnapToGrid(o3y);
|
|
||||||
origYPlusOff -= o3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto newmag = glm::length(origYPlusOff);
|
T endAngle = std::atan2(relScaled.y, relScaled.x);
|
||||||
auto newprc = newmag / origmag;
|
|
||||||
auto endDiff = (v2T(origYPlusOff) * affineToWorldScale);
|
|
||||||
T endAngle = std::atan2(endDiff.y, endDiff.x);
|
|
||||||
T angle = startAngle - endAngle;
|
T angle = startAngle - endAngle;
|
||||||
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
|
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
|
||||||
{
|
{
|
||||||
@ -2073,12 +2085,55 @@ void GLEmberController<T>::CalcDragYAxis()
|
|||||||
|
|
||||||
if (GetAlt())
|
if (GetAlt())
|
||||||
{
|
{
|
||||||
affine.Y(v2T(origYPlusOff));//Absolute, not ratio.
|
src.Rotate(angle);
|
||||||
|
affine.Y(src.Y());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
src.Rotate(angle);
|
||||||
|
affine = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xform == m_FractoriumEmberController->CurrentXform())
|
||||||
|
m_DragHandlePos = v3T((affine.O() + affine.Y()) * worldToAffineScale, 0);
|
||||||
|
}, eXformUpdate::UPDATE_CURRENT_AND_SELECTED, false);//Calling code will update renderer.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto origmag = Zeps(glm::length(m_DragSrcTransform.Y()));//Magnitude of original dragged axis before it was dragged.
|
||||||
|
|
||||||
|
if (GetControl())
|
||||||
|
{
|
||||||
|
relScaled = SnapToGrid(relScaled);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto newmag = glm::length(relScaled);
|
||||||
|
auto newprc = newmag / origmag;
|
||||||
|
T endAngle = std::atan2(relScaled.y, relScaled.x);
|
||||||
|
T angle = startAngle - endAngle;
|
||||||
|
m_FractoriumEmberController->UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
|
||||||
|
{
|
||||||
|
auto& affine = pre ? xform->m_Affine : xform->m_Post;
|
||||||
|
auto src = m_DragSrcTransforms[selIndex];
|
||||||
|
|
||||||
|
if (worldPivotShiftAlt)
|
||||||
|
{
|
||||||
|
src.Y(src.O() + src.Y());
|
||||||
|
src.O(v2T(0));
|
||||||
|
src.Rotate(angle);
|
||||||
|
affine.Y(src.Y() - affine.O());
|
||||||
|
}
|
||||||
|
else if (GetAlt())
|
||||||
|
{
|
||||||
|
affine.Y(v2T(relScaled));//Absolute, not ratio.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
src.ScaleXY(newprc);
|
src.ScaleXY(newprc);
|
||||||
|
|
||||||
|
if (m_Fractorium->m_Settings->RotateAndScale())
|
||||||
src.Rotate(angle);
|
src.Rotate(angle);
|
||||||
|
|
||||||
affine = src;
|
affine = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ private:
|
|||||||
bool Deallocate();
|
bool Deallocate();
|
||||||
void SetViewport();
|
void SetViewport();
|
||||||
void DrawUnitSquare();
|
void DrawUnitSquare();
|
||||||
void DrawAffineHelper(int index, bool selected, bool pre, bool final, bool background);
|
void DrawAffineHelper(int index, bool selected, bool hovered, bool pre, bool final, bool background);
|
||||||
GLEmberControllerBase* GLController();
|
GLEmberControllerBase* GLController();
|
||||||
|
|
||||||
bool m_Init = false;
|
bool m_Init = false;
|
||||||
|
@ -76,6 +76,7 @@ bool FractoriumOptionsDialog::ToggleType() { return ui.ToggleTypeCheckBox->isChe
|
|||||||
bool FractoriumOptionsDialog::Png16Bit() { return ui.Png16BitCheckBox->isChecked(); }
|
bool FractoriumOptionsDialog::Png16Bit() { return ui.Png16BitCheckBox->isChecked(); }
|
||||||
bool FractoriumOptionsDialog::AutoUnique() { return ui.AutoUniqueCheckBox->isChecked(); }
|
bool FractoriumOptionsDialog::AutoUnique() { return ui.AutoUniqueCheckBox->isChecked(); }
|
||||||
bool FractoriumOptionsDialog::LoadLast() { return ui.LoadLastOnStartCheckBox->isChecked(); }
|
bool FractoriumOptionsDialog::LoadLast() { return ui.LoadLastOnStartCheckBox->isChecked(); }
|
||||||
|
bool FractoriumOptionsDialog::RotateAndScale() { return ui.RotateAndScaleCheckBox->isChecked(); }
|
||||||
uint FractoriumOptionsDialog::ThreadCount() { return ui.ThreadCountSpin->value(); }
|
uint FractoriumOptionsDialog::ThreadCount() { return ui.ThreadCountSpin->value(); }
|
||||||
uint FractoriumOptionsDialog::RandomCount() { return ui.RandomCountSpin->value(); }
|
uint FractoriumOptionsDialog::RandomCount() { return ui.RandomCountSpin->value(); }
|
||||||
uint FractoriumOptionsDialog::CpuQuality() { return ui.CpuQualitySpin->value(); }
|
uint FractoriumOptionsDialog::CpuQuality() { return ui.CpuQualitySpin->value(); }
|
||||||
@ -192,6 +193,7 @@ void FractoriumOptionsDialog::GuiToData()
|
|||||||
m_Settings->ThreadCount(ThreadCount());
|
m_Settings->ThreadCount(ThreadCount());
|
||||||
m_Settings->RandomCount(RandomCount());
|
m_Settings->RandomCount(RandomCount());
|
||||||
m_Settings->LoadLast(LoadLast());
|
m_Settings->LoadLast(LoadLast());
|
||||||
|
m_Settings->RotateAndScale(RotateAndScale());
|
||||||
m_Settings->CpuQuality(CpuQuality());
|
m_Settings->CpuQuality(CpuQuality());
|
||||||
m_Settings->OpenClQuality(OpenClQuality());
|
m_Settings->OpenClQuality(OpenClQuality());
|
||||||
m_Settings->CpuSubBatch(ui.CpuSubBatchSpin->value());
|
m_Settings->CpuSubBatch(ui.CpuSubBatchSpin->value());
|
||||||
@ -230,6 +232,7 @@ void FractoriumOptionsDialog::DataToGui()
|
|||||||
ui.ThreadCountSpin->setValue(m_Settings->ThreadCount());
|
ui.ThreadCountSpin->setValue(m_Settings->ThreadCount());
|
||||||
ui.RandomCountSpin->setValue(m_Settings->RandomCount());
|
ui.RandomCountSpin->setValue(m_Settings->RandomCount());
|
||||||
ui.LoadLastOnStartCheckBox->setChecked(m_Settings->LoadLast());
|
ui.LoadLastOnStartCheckBox->setChecked(m_Settings->LoadLast());
|
||||||
|
ui.RotateAndScaleCheckBox->setChecked(m_Settings->RotateAndScale());
|
||||||
ui.CpuQualitySpin->setValue(m_Settings->CpuQuality());
|
ui.CpuQualitySpin->setValue(m_Settings->CpuQuality());
|
||||||
ui.OpenCLQualitySpin->setValue(m_Settings->OpenClQuality());
|
ui.OpenCLQualitySpin->setValue(m_Settings->OpenClQuality());
|
||||||
ui.CpuSubBatchSpin->setValue(m_Settings->CpuSubBatch());
|
ui.CpuSubBatchSpin->setValue(m_Settings->CpuSubBatch());
|
||||||
|
@ -37,6 +37,7 @@ public:
|
|||||||
bool Png16Bit();
|
bool Png16Bit();
|
||||||
bool AutoUnique();
|
bool AutoUnique();
|
||||||
bool LoadLast();
|
bool LoadLast();
|
||||||
|
bool RotateAndScale();
|
||||||
uint ThreadCount();
|
uint ThreadCount();
|
||||||
uint RandomCount();
|
uint RandomCount();
|
||||||
uint CpuQuality();
|
uint CpuQuality();
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>541</width>
|
<width>546</width>
|
||||||
<height>475</height>
|
<height>490</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -496,6 +496,16 @@ in interactive mode for each mouse movement</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QCheckBox" name="RotateAndScaleCheckBox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Checked: scale and rotate when dragging affines while holding shift.</p><p>Unchecked: only scale when dragging affines while holding shift.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Scale and Rotate With Shift</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="OptionsXmlSavingTab">
|
<widget class="QWidget" name="OptionsXmlSavingTab">
|
||||||
@ -913,9 +923,15 @@ in interactive mode for each mouse movement</string>
|
|||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>EarlyClipCheckBox</tabstop>
|
<tabstop>EarlyClipCheckBox</tabstop>
|
||||||
<tabstop>OpenCLCheckBox</tabstop>
|
<tabstop>OpenCLCheckBox</tabstop>
|
||||||
|
<tabstop>YAxisUpCheckBox</tabstop>
|
||||||
|
<tabstop>SharedTextureCheckBox</tabstop>
|
||||||
|
<tabstop>TransparencyCheckBox</tabstop>
|
||||||
<tabstop>DoublePrecisionCheckBox</tabstop>
|
<tabstop>DoublePrecisionCheckBox</tabstop>
|
||||||
|
<tabstop>ContinuousUpdateCheckBox</tabstop>
|
||||||
<tabstop>ShowAllXformsCheckBox</tabstop>
|
<tabstop>ShowAllXformsCheckBox</tabstop>
|
||||||
|
<tabstop>Png16BitCheckBox</tabstop>
|
||||||
<tabstop>ToggleTypeCheckBox</tabstop>
|
<tabstop>ToggleTypeCheckBox</tabstop>
|
||||||
|
<tabstop>RotateAndScaleCheckBox</tabstop>
|
||||||
<tabstop>LoadLastOnStartCheckBox</tabstop>
|
<tabstop>LoadLastOnStartCheckBox</tabstop>
|
||||||
<tabstop>ThreadCountSpin</tabstop>
|
<tabstop>ThreadCountSpin</tabstop>
|
||||||
<tabstop>CpuSubBatchSpin</tabstop>
|
<tabstop>CpuSubBatchSpin</tabstop>
|
||||||
|
Loading…
Reference in New Issue
Block a user