mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-01 05:46:06 -04:00
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth. -Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted. -When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember. -Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render. -Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply. -Make default temporal samples be 100, whereas before it was 1000 which was overkill. -Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box. -This wasn't otherwise fixable without writing a lot more code. --Bug fixes -EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it. -EmberGenome was improperly handling the first frame of a merge after the last frame of the loop. -These bugs were due to a previous commit. Revert parts of that commit. -Prevent a zoom value of less than 0 when reading from xml. -Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already. -Unique file naming was broken because it was looking for _# and the default names ended with -#. -Disallow renaming of an ember in the library tree to an empty string. -Severe bug that prevented some variations from being read correctly from params generated outside this program. -Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1. -Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double. -Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU. -Prevent user from saving stylesheet to default.qss, it's a special reserved filename. --Code changes -Generalize using the running sum output point inside of a variation for all cases: pre, reg and post. -Allow for array variables in variations where the address of each element is stored in m_Params. -Qualify all math functions with std:: -No longer use our own Clamp() in OpenCL, instead use the standard clamp(). -Redesign how functions are used in the variations OpenCL code. -Add tests to EmberTester to verify some of the new functionality. -Place more const and override qualifiers on functions where appropriate. -Add a global rand with a lock to be used very sparingly. -Use a map instead of a vector for bad param names in Xml parsing. -Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear. -Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread. -Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember. -Add Contains() function to Utils.h. -EmberRender: print names of kernels being printed with --dump_kernel option. -Clean up EmberTester to handle some of the recent changes. -Fix various casts. -Replace % 2 with & 1, even though the compiler was likely doing this already. -Add new file Variations06.h to accommodate new variations. -General cleanup.
This commit is contained in:
@ -6,8 +6,7 @@ namespace EmberNs
|
||||
{
|
||||
/// <summary>
|
||||
/// DC Bubble.
|
||||
/// This accesses the summed output point in a rare and different way
|
||||
/// and therefore cannot be made into pre and post variations.
|
||||
/// This accesses the summed output point in a rare and different way.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EMBER_API DCBubbleVariation : public ParametricVariation<T>
|
||||
@ -30,8 +29,21 @@ public:
|
||||
helper.Out.y = r4_1 * helper.In.y;
|
||||
helper.Out.z = m_Weight * (2 / r4_1 - 1);
|
||||
|
||||
T tempX = helper.Out.x + outPoint.m_X;
|
||||
T tempY = helper.Out.y + outPoint.m_Y;
|
||||
T sumX, sumY;
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
sumX = helper.In.x;
|
||||
sumY = helper.In.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
sumX = outPoint.m_X;
|
||||
sumY = outPoint.m_Y;
|
||||
}
|
||||
|
||||
T tempX = helper.Out.x + sumX;
|
||||
T tempY = helper.Out.y + sumY;
|
||||
|
||||
outPoint.m_ColorX = fmod(fabs(m_Bdcs * (Sqr<T>(tempX + m_CenterX) + Sqr<T>(tempY + m_CenterY))), T(1.0));
|
||||
}
|
||||
@ -56,8 +68,24 @@ public:
|
||||
<< "\t\tvOut.y = r4_1 * vIn.y;\n"
|
||||
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (2 / r4_1 - 1);\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t tempX = vOut.x + outPoint->m_X;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + outPoint->m_Y;\n"
|
||||
<< "\t\treal_t sumX, sumY;\n\n";
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = vIn.x;\n"
|
||||
<< "\t\tsumY = vIn.y;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = outPoint->m_X;\n"
|
||||
<< "\t\tsumY = outPoint->m_Y;\n";
|
||||
}
|
||||
|
||||
ss
|
||||
<< "\t\treal_t tempX = vOut.x + sumX;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + sumY;\n"
|
||||
<< "\n"
|
||||
<< "\t\toutPoint->m_ColorX = fmod(fabs(" << bdcs << " * (Sqr(tempX + " << centerX << ") + Sqr(tempY + " << centerY << "))), (real_t)(1.0));\n"
|
||||
<< "\t}\n";
|
||||
@ -65,6 +93,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Bdcs = 1 / (m_Scale == 0 ? T(10E-6) : m_Scale);
|
||||
@ -255,7 +288,7 @@ public:
|
||||
<< "\t\treal_t x, y, z;\n"
|
||||
<< "\t\treal_t p = 2 * MwcNext01(mwc) - 1;\n"
|
||||
<< "\t\treal_t q = 2 * MwcNext01(mwc) - 1;\n"
|
||||
<< "\t\tuint i = MwcNext(mwc) % 3;\n"
|
||||
<< "\t\tuint i = MwcNextRange(mwc, 3);\n"
|
||||
<< "\t\tuint j = MwcNext(mwc) & 1;\n"
|
||||
<< "\n"
|
||||
<< "\t\tswitch (i)\n"
|
||||
@ -356,8 +389,7 @@ private:
|
||||
|
||||
/// <summary>
|
||||
/// DC Cylinder.
|
||||
/// This accesses the summed output point in a rare and different way
|
||||
/// and therefore cannot be made into pre and post variations.
|
||||
/// This accesses the summed output point in a rare and different way.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EMBER_API DCCylinderVariation : public ParametricVariation<T>
|
||||
@ -373,16 +405,29 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T temp = rand.Frand01<T>() * M_2PI;
|
||||
T sr = sin(temp);
|
||||
T cr = cos(temp);
|
||||
T sr = std::sin(temp);
|
||||
T cr = std::cos(temp);
|
||||
T r = m_Blur * (rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() - 2);
|
||||
|
||||
helper.Out.x = m_Weight * sin(helper.In.x + r * sr) * m_X;
|
||||
helper.Out.x = m_Weight * std::sin(helper.In.x + r * sr) * m_X;
|
||||
helper.Out.y = r + helper.In.y * m_Y;
|
||||
helper.Out.z = m_Weight * cos(helper.In.x + r * cr);
|
||||
helper.Out.z = m_Weight * std::cos(helper.In.x + r * cr);
|
||||
|
||||
T tempX = helper.Out.x + outPoint.m_X;
|
||||
T tempY = helper.Out.y + outPoint.m_Y;
|
||||
T sumX, sumY;
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
sumX = helper.In.x;
|
||||
sumY = helper.In.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
sumX = outPoint.m_X;
|
||||
sumY = outPoint.m_Y;
|
||||
}
|
||||
|
||||
T tempX = helper.Out.x + sumX;
|
||||
T tempY = helper.Out.y + sumY;
|
||||
|
||||
outPoint.m_ColorX = fmod(fabs(T(0.5) * (m_Ldcs * ((m_Cosa * tempX + m_Sina * tempY + m_Offset)) + 1)), T(1.0));
|
||||
}
|
||||
@ -413,8 +458,24 @@ public:
|
||||
<< "\t\tvOut.y = r + vIn.y * " << y << ";\n"
|
||||
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * cos(vIn.x + r * cr);\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t tempX = vOut.x + outPoint->m_X;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + outPoint->m_Y;\n"
|
||||
<< "\t\treal_t sumX, sumY;\n\n";
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = vIn.x;\n"
|
||||
<< "\t\tsumY = vIn.y;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = outPoint->m_X;\n"
|
||||
<< "\t\tsumY = outPoint->m_Y;\n";
|
||||
}
|
||||
|
||||
ss
|
||||
<< "\t\treal_t tempX = vOut.x + sumX;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + sumY;\n"
|
||||
<< "\n"
|
||||
<< "\t\toutPoint->m_ColorX = fmod(fabs((real_t)(0.5) * (" << ldcs << " * ((" << cosa << " * tempX + " << sina << " * tempY + " << offset << ")) + (real_t)(1.0))), (real_t)(1.0));\n"
|
||||
<< "\t}\n";
|
||||
@ -631,12 +692,16 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "LRint" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// DC Linear.
|
||||
/// This accesses the summed output point in a rare and different way
|
||||
/// and therefore cannot be made into pre and post variations.
|
||||
/// This accesses the summed output point in a rare and different way.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EMBER_API DCLinearVariation : public ParametricVariation<T>
|
||||
@ -655,8 +720,21 @@ public:
|
||||
helper.Out.y = m_Weight * helper.In.y;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
|
||||
T tempX = helper.Out.x + outPoint.m_X;
|
||||
T tempY = helper.Out.y + outPoint.m_Y;
|
||||
T sumX, sumY;
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
sumX = helper.In.x;
|
||||
sumY = helper.In.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
sumX = outPoint.m_X;
|
||||
sumY = outPoint.m_Y;
|
||||
}
|
||||
|
||||
T tempX = helper.Out.x + sumX;
|
||||
T tempY = helper.Out.y + sumY;
|
||||
|
||||
outPoint.m_ColorX = fmod(fabs(T(0.5) * (m_Ldcs * ((m_Cosa * tempX + m_Sina * tempY + m_Offset)) + T(1.0))), T(1.0));
|
||||
}
|
||||
@ -680,8 +758,24 @@ public:
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
|
||||
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t tempX = vOut.x + outPoint->m_X;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + outPoint->m_Y;\n"
|
||||
<< "\t\treal_t sumX, sumY;\n\n";
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = vIn.x;\n"
|
||||
<< "\t\tsumY = vIn.y;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = outPoint->m_X;\n"
|
||||
<< "\t\tsumY = outPoint->m_Y;\n";
|
||||
}
|
||||
|
||||
ss
|
||||
<< "\t\treal_t tempX = vOut.x + sumX;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + sumY;\n"
|
||||
<< "\n"
|
||||
<< "\t\toutPoint->m_ColorX = fmod(fabs((real_t)(0.5) * (" << ldcs << " * ((" << cosa << " * tempX + " << sina << " * tempY + " << offset << ")) + (real_t)(1.0))), (real_t)(1.0));\n"
|
||||
<< "\t}\n";
|
||||
@ -1034,9 +1128,12 @@ private:
|
||||
T m_X1_m_x0;
|
||||
};
|
||||
|
||||
MAKEPREPOSTPARVAR(DCBubble, dc_bubble, DC_BUBBLE)
|
||||
MAKEPREPOSTPARVAR(DCCarpet, dc_carpet, DC_CARPET)
|
||||
MAKEPREPOSTPARVARASSIGN(DCCube, dc_cube, DC_CUBE, ASSIGNTYPE_SUM)
|
||||
MAKEPREPOSTPARVAR(DCCylinder, dc_cylinder, DC_CYLINDER)
|
||||
MAKEPREPOSTVAR(DCGridOut, dc_gridout, DC_GRIDOUT)
|
||||
MAKEPREPOSTPARVAR(DCLinear, dc_linear, DC_LINEAR)
|
||||
MAKEPREPOSTPARVAR(DCTriangle, dc_triangle, DC_TRIANGLE)
|
||||
MAKEPREPOSTPARVAR(DCZTransl, dc_ztransl, DC_ZTRANSL)
|
||||
}
|
||||
|
Reference in New Issue
Block a user