mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-04 15:25:37 -04:00
--User changes
-Add new variations waves22, waves23, waves42, waves3 and waves4 from user tatasz. -Add new stylesheet called lightdark.qss which gives a more modern look to the dark theme. Started by Michel Mastriani (triptychaos). --Included in the qmake and Wix installers. --Code changes -Add a new C# project that attempts to convert Apophysis plugins to Fractorium style Variation classes. It's not entirely perfect, but gets most of the job done much more quickly than doing so manually. -Remove unused OpenCL functions from variations: elliptic, poincare, mask, bMod, bSwirl, bTransform, bCollide, farblur, popcorn2_3D, falloff, falloff2, falloff3, crackle2, waves2b, hypercrop, depth_gaussian2, depth_sine, depth_sine2, dust, asteria, vibration, vibration2, arctanh, smartshape, squares, starblur2, Truchet,. -Add code in EmberTester to automatically detect such unused functions.
This commit is contained in:
@ -484,6 +484,11 @@ uint Timing::m_ProcessorCount;
|
||||
EXPORTPREPOSTREGVAR(DCTriangle, T) \
|
||||
EXPORTPREPOSTREGVAR(RandCubes, T) \
|
||||
EXPORTPREPOSTREGVAR(PixelFlow, T) \
|
||||
EXPORTPREPOSTREGVAR(Waves22, T) \
|
||||
EXPORTPREPOSTREGVAR(Waves23, T) \
|
||||
EXPORTPREPOSTREGVAR(Waves42, T) \
|
||||
EXPORTPREPOSTREGVAR(Waves3, T) \
|
||||
EXPORTPREPOSTREGVAR(Waves4, T) \
|
||||
template EMBER_API class VariationList<T>; \
|
||||
template EMBER_API class SpatialFilter<T>; \
|
||||
template EMBER_API class GaussianFilter<T>; \
|
||||
|
@ -52,6 +52,7 @@ namespace EmberNs
|
||||
#define M_3PI (T(M_PI * 3))
|
||||
#define SQRT5 T(2.2360679774997896964091736687313)
|
||||
#define M_PHI T(1.61803398874989484820458683436563)
|
||||
#define M_1_2PI T(0.15915494309189533576888376337251)
|
||||
#define COLORMAP_LENGTH 256//These will need to change if 2D palette support is ever added, or variable sized palettes.
|
||||
#define WHITE 255
|
||||
#define DEFAULT_SBS (1024 * 10)
|
||||
|
@ -434,9 +434,14 @@ enum class eVariationId : et
|
||||
VAR_WAFFLE,
|
||||
VAR_WAVES ,
|
||||
VAR_WAVES2 ,
|
||||
VAR_WAVES2_RADIAL,
|
||||
VAR_WAVES22,
|
||||
VAR_WAVES23,
|
||||
VAR_WAVES23D ,
|
||||
VAR_WAVES2B ,
|
||||
VAR_WAVES2_RADIAL,
|
||||
VAR_WAVES3,
|
||||
VAR_WAVES4,
|
||||
VAR_WAVES42,
|
||||
VAR_WAVESN ,
|
||||
VAR_WDISC ,
|
||||
VAR_WEDGE ,
|
||||
@ -841,9 +846,14 @@ enum class eVariationId : et
|
||||
VAR_PRE_WAFFLE,
|
||||
VAR_PRE_WAVES,
|
||||
VAR_PRE_WAVES2,
|
||||
VAR_PRE_WAVES2_RADIAL,
|
||||
VAR_PRE_WAVES22,
|
||||
VAR_PRE_WAVES23,
|
||||
VAR_PRE_WAVES23D,
|
||||
VAR_PRE_WAVES2B,
|
||||
VAR_PRE_WAVES2_RADIAL,
|
||||
VAR_PRE_WAVES3,
|
||||
VAR_PRE_WAVES4,
|
||||
VAR_PRE_WAVES42,
|
||||
VAR_PRE_WAVESN,
|
||||
VAR_PRE_WDISC,
|
||||
VAR_PRE_WEDGE,
|
||||
@ -1248,9 +1258,14 @@ enum class eVariationId : et
|
||||
VAR_POST_WAFFLE,
|
||||
VAR_POST_WAVES,
|
||||
VAR_POST_WAVES2,
|
||||
VAR_POST_WAVES2_RADIAL,
|
||||
VAR_POST_WAVES22,
|
||||
VAR_POST_WAVES23,
|
||||
VAR_POST_WAVES23D,
|
||||
VAR_POST_WAVES2B,
|
||||
VAR_POST_WAVES2_RADIAL,
|
||||
VAR_POST_WAVES3,
|
||||
VAR_POST_WAVES4,
|
||||
VAR_POST_WAVES42,
|
||||
VAR_POST_WAVESN,
|
||||
VAR_POST_WDISC,
|
||||
VAR_POST_WEDGE,
|
||||
|
@ -423,6 +423,11 @@ VariationList<T>::VariationList()
|
||||
ADDPREPOSTREGVAR(Modulusy)
|
||||
ADDPREPOSTREGVAR(Rotate)
|
||||
ADDPREPOSTREGVAR(Shift)
|
||||
ADDPREPOSTREGVAR(Waves22)
|
||||
ADDPREPOSTREGVAR(Waves23)
|
||||
ADDPREPOSTREGVAR(Waves3)
|
||||
ADDPREPOSTREGVAR(Waves4)
|
||||
ADDPREPOSTREGVAR(Waves42)
|
||||
//ADDPREPOSTREGVAR(LinearXZ)
|
||||
//ADDPREPOSTREGVAR(LinearYZ)
|
||||
//DC are special.
|
||||
|
@ -4355,11 +4355,6 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual string OpenCLFuncsString() const override
|
||||
{
|
||||
return
|
||||
|
@ -4460,7 +4460,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Zeps" };
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -5016,8 +5016,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T c0 = m_Ax / (1 + std::exp(m_Sx * helper.In.x));
|
||||
T c1 = m_Ay / (1 + std::exp(m_Sy * helper.In.y));
|
||||
T c0 = m_Ax / Zeps(1 + std::exp(m_Sx * helper.In.x));
|
||||
T c1 = m_Ay / Zeps(1 + std::exp(m_Sy * helper.In.y));
|
||||
T x = (2 * (c0 - T(0.5)));
|
||||
T y = (2 * (c1 - T(0.5)));
|
||||
helper.Out.x = m_Vv * x;
|
||||
@ -5040,8 +5040,8 @@ public:
|
||||
string ay = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string vv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t c0 = " << ax << " / (1 + exp(" << sx << " * vIn.x));\n"
|
||||
<< "\t\treal_t c1 = " << ay << " / (1 + exp(" << sy << " * vIn.y));\n"
|
||||
<< "\t\treal_t c0 = " << ax << " / Zeps(1 + exp(" << sx << " * vIn.x));\n"
|
||||
<< "\t\treal_t c1 = " << ay << " / Zeps(1 + exp(" << sy << " * vIn.y));\n"
|
||||
<< "\t\treal_t x = (2 * (c0 - (real_t)(0.5)));\n"
|
||||
<< "\t\treal_t y = (2 * (c1 - (real_t)(0.5)));\n"
|
||||
<< "\n"
|
||||
@ -5793,11 +5793,6 @@ public:
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5813,7 +5808,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T d = m_Weight / helper.m_PrecalcSumSquares;
|
||||
T d = m_Weight / Zeps(helper.m_PrecalcSumSquares);
|
||||
T sinx = std::sin(helper.In.x);
|
||||
T sinx2 = SQR(sinx);
|
||||
T cosx = std::cos(helper.In.x);
|
||||
@ -5829,7 +5824,7 @@ public:
|
||||
intmax_t varIndex = IndexInXform();
|
||||
string weight = WeightDefineString();
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t d = " << weight << " / precalcSumSquares;\n"
|
||||
<< "\t\treal_t d = " << weight << " / Zeps(precalcSumSquares);\n"
|
||||
<< "\t\treal_t sinx = sin(vIn.x);\n"
|
||||
<< "\t\treal_t sinx2 = SQR(sinx);\n"
|
||||
<< "\t\treal_t cosx = cos(vIn.x);\n"
|
||||
@ -5844,7 +5839,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr" };
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2286,9 +2286,10 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T e = 1 / helper.m_PrecalcSumSquares + SQR(T(M_2_PI));
|
||||
helper.Out.x = m_Weight * (m_Weight / helper.m_PrecalcSumSquares * helper.In.x / e);
|
||||
helper.Out.y = m_Weight * (m_Weight / helper.m_PrecalcSumSquares * helper.In.y / e);
|
||||
T e = 1 / Zeps(helper.m_PrecalcSumSquares) + SQR(T(M_2_PI));
|
||||
T temp = m_Weight / Zeps(helper.m_PrecalcSumSquares);
|
||||
helper.Out.x = m_Weight * (temp * helper.In.x / e);
|
||||
helper.Out.y = m_Weight * (temp * helper.In.y / e);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
@ -2298,10 +2299,11 @@ public:
|
||||
intmax_t varIndex = IndexInXform();
|
||||
string weight = WeightDefineString();
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t e = fma(M2PI, M2PI, 1 / precalcSumSquares);\n"
|
||||
<< "\t\treal_t e = fma(M2PI, M2PI, 1 / Zeps(precalcSumSquares));\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = " << weight << " * (" << weight << " / precalcSumSquares * vIn.x / e);\n"
|
||||
<< "\t\tvOut.y = " << weight << " * (" << weight << " / precalcSumSquares * vIn.y / e);\n"
|
||||
<< "\t\treal_t temp = " << weight << " / Zeps(precalcSumSquares);\n"
|
||||
<< "\t\tvOut.x = " << weight << " * (temp * vIn.x / e);\n"
|
||||
<< "\t\tvOut.y = " << weight << " * (temp * vIn.y / e);\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
@ -3804,7 +3806,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Zeps" };
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3877,7 +3879,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Zeps" };
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3963,7 +3965,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Zeps" };
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -4054,7 +4056,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Zeps" };
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
|
@ -3001,11 +3001,6 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
|
@ -1995,11 +1995,6 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_SinTanC = std::sin(SafeTan<T>(m_C));
|
||||
@ -2547,7 +2542,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Lerp" };
|
||||
return vector<string> { "Lerp" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
@ -2751,7 +2746,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Zeps" };
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
@ -2984,7 +2979,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "SignNz", "LogMap", "LogScale", "Sqr", "Zeps" };
|
||||
return vector<string> { "SignNz", "LogMap", "LogScale", "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
|
@ -4014,7 +4014,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Fract", "HashShadertoy" };
|
||||
return vector<string> { "Fract", "HashShadertoy" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
|
@ -202,7 +202,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Sqr", "SignNz", "SafeDivInv", "JacobiElliptic", "EvalRational", "J1" };
|
||||
return vector<string> { "Zeps", "SignNz", "SafeDivInv", "JacobiElliptic", "EvalRational", "J1" };
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalDataNames() const override
|
||||
@ -1966,7 +1966,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T lvl = (Floor<T>(rand.Frand01<T>() * m_Density) / Zeps(m_Density)); //random level. should care if density=0 but meh, works fine
|
||||
T lvl = T(Floor<T>(rand.Frand01<T>() * m_Density) / Zeps(m_Density)); //random level. should care if density=0 but meh, works fine
|
||||
T randa = rand.Frand01<T>() * M_2PI; //random angle
|
||||
T randr = lvl * m_Radius; //calc radius of rings
|
||||
|
||||
@ -2173,7 +2173,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Sqr" };
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -2983,7 +2983,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Sqr" };
|
||||
return vector<string> { "Sqr" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3337,11 +3337,6 @@ public:
|
||||
m_BlurOver10 = m_Blur / 10;
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -3443,7 +3438,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Sqr" };
|
||||
return vector<string> { "Sqr" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3597,7 +3592,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Fract", "HashShadertoy" };
|
||||
return vector<string> { "Fract", "HashShadertoy" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3725,7 +3720,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Sqr" };
|
||||
return vector<string> { "Sqr" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3991,11 +3986,6 @@ public:
|
||||
m_PhaseShift2 = M_2PI * m_Phase2 / Zeps(m_Freq2);
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Sqr" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -4192,7 +4182,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Sqr", "Modulate" };
|
||||
return vector<string> { "Zeps", "Modulate" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -4542,7 +4532,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sign", "Zeps", "ComplexMultReal", "ComplexLog", "ComplexPlusReal", "ComplexDivComplex" };
|
||||
return vector<string> { "Zeps", "ComplexMultReal", "ComplexLog", "ComplexPlusReal", "ComplexDivComplex" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -4961,11 +4951,6 @@ public:
|
||||
m_Comp = m_Compensation <= 0 ? T(0) : T(1);
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -5110,7 +5095,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Fract", "HashShadertoy" };
|
||||
return vector<string> { "Fract", "HashShadertoy" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -5250,11 +5235,6 @@ public:
|
||||
m_CosAlpha = std::cos(m_Alpha);
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Fract", "HashShadertoy" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -5885,7 +5865,7 @@ public:
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps", "Fract", "HashShadertoy" };
|
||||
return vector<string> { "Fract", "HashShadertoy" };
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -6612,6 +6592,468 @@ private:
|
||||
T m_AngleRad;//Precalc.
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// waves3.
|
||||
/// By tatasz.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class Waves3Variation : public ParametricVariation<T>
|
||||
{
|
||||
public:
|
||||
Waves3Variation(T weight = 1.0) : ParametricVariation<T>("waves3", eVariationId::VAR_WAVES3, weight)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
PARVARCOPY(Waves3Variation)
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x0 = helper.In.x;
|
||||
T y0 = helper.In.y;
|
||||
T scalex = T(0.5) * m_Scalex * (T(1.0) + std::sin(y0 * m_Sxfreq));
|
||||
T scaley = T(0.5) * m_Scaley * (T(1.0) + std::sin(x0 * m_Syfreq));
|
||||
helper.Out.x = m_Weight * (x0 + std::sin(y0 * m_Freqx) * scalex);
|
||||
helper.Out.y = m_Weight * (y0 + std::sin(x0 * m_Freqy) * scaley);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string weight = WeightDefineString();
|
||||
string scalex = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string scaley = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string sxfreq = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string syfreq = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t x0 = vIn.x;\n"
|
||||
<< "\t\treal_t y0 = vIn.y;\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t scalex = (real_t)(0.5) * " << scalex << " * ((real_t)(1.0) + sin(y0 * " << sxfreq << "));\n"
|
||||
<< "\t\treal_t scaley = (real_t)(0.5) * " << scaley << " * ((real_t)(1.0) + sin(x0 * " << syfreq << "));\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = " << weight << " * (x0 + sin(y0 * " << freqx << ") * scalex);\n"
|
||||
<< "\t\tvOut.y = " << weight << " * (y0 + sin(x0 * " << freqy << ") * scaley);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scalex, prefix + "waves3_scalex", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scaley, prefix + "waves3_scaley", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqx, prefix + "waves3_freqx", T(7.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqy, prefix + "waves3_freqy", T(13.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Sxfreq, prefix + "waves3_sx_freq"));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Syfreq, prefix + "waves3_sy_freq", T(2.0)));
|
||||
}
|
||||
|
||||
private:
|
||||
T m_Scalex;
|
||||
T m_Scaley;
|
||||
T m_Freqx;
|
||||
T m_Freqy;
|
||||
T m_Sxfreq;
|
||||
T m_Syfreq;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// waves4.
|
||||
/// By tatasz.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class Waves4Variation : public ParametricVariation<T>
|
||||
{
|
||||
public:
|
||||
Waves4Variation(T weight = 1.0) : ParametricVariation<T>("waves4", eVariationId::VAR_WAVES4, weight)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
PARVARCOPY(Waves4Variation)
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x0 = helper.In.x;
|
||||
T y0 = helper.In.y;
|
||||
T ax = T(Floor<T>(y0 * m_Freqx / M_2PI));
|
||||
ax = std::sin(ax * T(12.9898) + ax * T(78.233) + T(1.0) + y0 * T(0.001) * m_Yfact) * T(43758.5453);
|
||||
ax = ax - (int)ax;
|
||||
|
||||
if (m_Cont == 1) ax = (ax > T(0.5)) ? T(1.0) : T(0.0);
|
||||
|
||||
helper.Out.x = m_Weight * (x0 + std::sin(y0 * m_Freqx) * ax * ax * m_Scalex);
|
||||
helper.Out.y = m_Weight * (y0 + std::sin(x0 * m_Freqy) * m_Scaley);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string weight = WeightDefineString();
|
||||
string scalex = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string scaley = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cont = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string yfact = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t x0 = vIn.x;\n"
|
||||
<< "\t\treal_t y0 = vIn.y;\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t ax = floor(y0 * " << freqx << " / M_2PI);\n"
|
||||
<< "\t\tax = sin(ax * (real_t)(12.9898) + ax * (real_t)(78.233) + (real_t)(1.0) + y0 * (real_t)(0.001) * " << yfact << ") * (real_t)(43758.5453);\n"
|
||||
<< "\t\tax = ax - (int) ax;\n"
|
||||
<< "\t\tif (" << cont << " == 1) ax = (ax > (real_t)(0.5)) ? (real_t)(1.0) : 0.0;\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = " << weight << " * (x0 + sin(y0 * " << freqx << ") * ax * ax * " << scalex << ");\n"
|
||||
<< "\t\tvOut.y = " << weight << " * (y0 + sin(x0 * " << freqy << ") * " << scaley << ");\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scalex, prefix + "waves4_scalex", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scaley, prefix + "waves4_scaley", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqx, prefix + "waves4_freqx", T(7.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqy, prefix + "waves4_freqy", T(13.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Cont, prefix + "waves4_cont", T(0), eParamType::INTEGER, T(0), T(1)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Yfact, prefix + "waves4_yfact", T(0.1)));
|
||||
}
|
||||
|
||||
private:
|
||||
T m_Scalex;
|
||||
T m_Scaley;
|
||||
T m_Freqx;
|
||||
T m_Freqy;
|
||||
T m_Cont;
|
||||
T m_Yfact;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// waves22.
|
||||
/// By tatasz.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class Waves22Variation : public ParametricVariation<T>
|
||||
{
|
||||
public:
|
||||
Waves22Variation(T weight = 1.0) : ParametricVariation<T>("waves22", eVariationId::VAR_WAVES22, weight)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
PARVARCOPY(Waves22Variation)
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x0 = helper.In.x;
|
||||
T y0 = helper.In.y;
|
||||
T sinx, siny;
|
||||
int px = (int)m_Powerx;
|
||||
int py = (int)m_Powery;
|
||||
|
||||
if (m_Modex < T(0.5))
|
||||
{
|
||||
sinx = std::sin(y0 * m_Freqx);
|
||||
}
|
||||
else
|
||||
{
|
||||
sinx = T(0.5) * (T(1.0) + std::sin(y0 * m_Freqx));
|
||||
}
|
||||
|
||||
T offsetx = std::pow(sinx, px) * m_Scalex;
|
||||
|
||||
if (m_Modey < T(0.5))
|
||||
{
|
||||
siny = std::sin(x0 * m_Freqy);
|
||||
}
|
||||
else
|
||||
{
|
||||
siny = T(0.5) * (T(1.0) + std::sin(x0 * m_Freqy));
|
||||
}
|
||||
|
||||
T offsety = std::pow(siny, py) * m_Scaley;
|
||||
helper.Out.x = m_Weight * (x0 + offsetx);
|
||||
helper.Out.y = m_Weight * (y0 + offsety);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string weight = WeightDefineString();
|
||||
string scalex = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string scaley = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string modex = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string modey = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string powerx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string powery = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t x0 = vIn.x;\n"
|
||||
<< "\t\treal_t y0 = vIn.y;\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t sinx, siny;\n"
|
||||
<< "\n"
|
||||
<< "\t\tint px = (int) " << powerx << ";\n"
|
||||
<< "\t\tint py = (int) " << powery << ";\n"
|
||||
<< "\t\tif (" << modex << " < (real_t)(0.5)){\n"
|
||||
<< "\t\tsinx = sin(y0 * " << freqx << ");\n"
|
||||
<< "\t\t} else {\n"
|
||||
<< "\t\tsinx = (real_t)(0.5) * ((real_t)(1.0) + sin(y0 * " << freqx << "));\n"
|
||||
<< "\t\t}\n"
|
||||
<< "\t\treal_t offsetx = pow(sinx, px) * " << scalex << ";\n"
|
||||
<< "\t\tif (" << modey << " < (real_t)(0.5)){\n"
|
||||
<< "\t\tsiny = sin(x0 * " << freqy << ");\n"
|
||||
<< "\t\t} else {\n"
|
||||
<< "\t\tsiny = (real_t)(0.5) * ((real_t)(1.0) + sin(x0 * " << freqy << "));\n"
|
||||
<< "\t\t}\n"
|
||||
<< "\t\treal_t offsety = pow(siny, py) * " << scaley << ";\n"
|
||||
<< "\t\tvOut.x = " << weight << " * (x0 + offsetx);\n"
|
||||
<< "\t\tvOut.y = " << weight << " * (y0 + offsety);\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scalex, prefix + "waves22_scalex", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scaley, prefix + "waves22_scaley", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqx, prefix + "waves22_freqx", T(7.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqy, prefix + "waves22_freqy", T(13.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Modex, prefix + "waves22_modex", T(0), eParamType::INTEGER, T(0), T(1)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Modey, prefix + "waves22_modey", T(0), eParamType::INTEGER, T(0), T(1)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Powerx, prefix + "waves22_powerx", T(2.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Powery, prefix + "waves22_powery", T(2.0)));
|
||||
}
|
||||
|
||||
private:
|
||||
T m_Scalex;
|
||||
T m_Scaley;
|
||||
T m_Freqx;
|
||||
T m_Freqy;
|
||||
T m_Modex;
|
||||
T m_Modey;
|
||||
T m_Powerx;
|
||||
T m_Powery;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// waves23.
|
||||
/// By tatasz.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class Waves23Variation : public ParametricVariation<T>
|
||||
{
|
||||
public:
|
||||
Waves23Variation(T weight = 1.0) : ParametricVariation<T>("waves23", eVariationId::VAR_WAVES23, weight)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
PARVARCOPY(Waves23Variation)
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x0 = helper.In.x;
|
||||
T y0 = helper.In.y;
|
||||
T mx = y0 * m_Freqx * M_1_2PI;
|
||||
T fx = mx - Floor<T>(mx);
|
||||
|
||||
if (fx > T(0.5)) fx = T(0.5) - fx;
|
||||
|
||||
T my = x0 * m_Freqy * M_1_2PI;
|
||||
T fy = my - Floor<T>(my);
|
||||
|
||||
if (fy > T(0.5)) fy = T(0.5) - fy;
|
||||
|
||||
helper.Out.x = m_Weight * (x0 + fx * m_Scalex);
|
||||
helper.Out.y = m_Weight * (y0 + fy * m_Scaley);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string weight = WeightDefineString();
|
||||
string scalex = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string scaley = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t x0 = vIn.x;\n"
|
||||
<< "\t\treal_t y0 = vIn.y;\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t mx = y0 * " << freqx << " * M_1_2PI;\n"
|
||||
<< "\t\treal_t fx = mx - floor(mx);\n"
|
||||
<< "\t\tif (fx > (real_t)(0.5)) fx = (real_t)(0.5) - fx;\n"
|
||||
<< "\t\treal_t my = x0 * " << freqy << " * M_1_2PI;\n"
|
||||
<< "\t\treal_t fy = my - floor(my);\n"
|
||||
<< "\t\tif (fy > (real_t)(0.5)) fy = (real_t)(0.5) - fy;\n"
|
||||
<< "\t\tvOut.x = " << weight << " * (x0 + fx * " << scalex << ");\n"
|
||||
<< "\t\tvOut.y = " << weight << " * (y0 + fy * " << scaley << ");\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scalex, prefix + "waves23_scalex", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scaley, prefix + "waves23_scaley", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqx, prefix + "waves23_freqx", T(7.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqy, prefix + "waves23_freqy", T(13.0)));
|
||||
}
|
||||
|
||||
private:
|
||||
T m_Scalex;
|
||||
T m_Scaley;
|
||||
T m_Freqx;
|
||||
T m_Freqy;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// waves42.
|
||||
/// By tatasz.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class Waves42Variation : public ParametricVariation<T>
|
||||
{
|
||||
public:
|
||||
Waves42Variation(T weight = 1.0) : ParametricVariation<T>("waves42", eVariationId::VAR_WAVES42, weight)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
PARVARCOPY(Waves42Variation)
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x0 = helper.In.x;
|
||||
T y0 = helper.In.y;
|
||||
T ax = T(Floor<T>(y0 * m_Freqx2));
|
||||
ax = std::sin(ax * T(12.9898) + ax * T(78.233) + T(1.0) + y0 * T(0.001) * m_Yfact) * T(43758.5453);
|
||||
ax = ax - (int)ax;
|
||||
|
||||
if (m_Cont == 1) ax = (ax > T(0.5)) ? T(1.0) : T(0.0);
|
||||
|
||||
helper.Out.x = m_Weight * (x0 + std::sin(y0 * m_Freqx) * ax * ax * m_Scalex);
|
||||
helper.Out.y = m_Weight * (y0 + std::sin(x0 * m_Freqy) * m_Scaley);
|
||||
helper.Out.z = DefaultZ(helper);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string weight = WeightDefineString();
|
||||
string scalex = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string scaley = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cont = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string yfact = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string freqx2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t x0 = vIn.x;\n"
|
||||
<< "\t\treal_t y0 = vIn.y;\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t ax = floor(y0 * " << freqx2 << ");\n"
|
||||
<< "\t\tax = sin(ax * (real_t)(12.9898) + ax * (real_t)(78.233) + (real_t)(1.0) + y0 * (real_t)(0.001) * " << yfact << ") * (real_t)(43758.5453);\n"
|
||||
<< "\t\tax = ax - (int) ax;\n"
|
||||
<< "\t\tif (" << cont << " == 1) ax = (ax > (real_t)(0.5)) ? (real_t)(1.0) : 0.0;\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = " << weight << " * (x0 + sin(y0 * " << freqx << ") * ax * ax * " << scalex << ");\n"
|
||||
<< "\t\tvOut.y = " << weight << " * (y0 + sin(x0 * " << freqy << ") * " << scaley << ");\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.z = " << DefaultZCl()
|
||||
<< "\t}\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scalex, prefix + "waves42_scalex", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scaley, prefix + "waves42_scaley", T(0.05)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqx, prefix + "waves42_freqx", T(7.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqy, prefix + "waves42_freqy", T(13.0)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Cont, prefix + "waves42_cont", T(0), eParamType::INTEGER, T(0), T(1)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Yfact, prefix + "waves42_yfact", T(0.1)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Freqx2, prefix + "waves42_freqx2", T(1.0)));
|
||||
}
|
||||
|
||||
private:
|
||||
T m_Scalex;
|
||||
T m_Scaley;
|
||||
T m_Freqx;
|
||||
T m_Freqy;
|
||||
T m_Cont;
|
||||
T m_Yfact;
|
||||
T m_Freqx2;
|
||||
};
|
||||
|
||||
MAKEPREPOSTPARVAR(Splits3D, splits3D, SPLITS3D)
|
||||
MAKEPREPOSTPARVAR(Waves2B, waves2b, WAVES2B)
|
||||
MAKEPREPOSTPARVAR(JacCn, jac_cn, JAC_CN)
|
||||
@ -6675,4 +7117,9 @@ MAKEPREPOSTPARVAR(Modulusx, modulusx, MODULUSX)
|
||||
MAKEPREPOSTPARVAR(Modulusy, modulusy, MODULUSY)
|
||||
MAKEPREPOSTPARVAR(Rotate, rotate, ROTATE)
|
||||
MAKEPREPOSTPARVAR(Shift, shift, SHIFT)
|
||||
MAKEPREPOSTPARVAR(Waves22, waves22, WAVES22)
|
||||
MAKEPREPOSTPARVAR(Waves23, waves23, WAVES23)
|
||||
MAKEPREPOSTPARVAR(Waves42, waves42, WAVES42)
|
||||
MAKEPREPOSTPARVAR(Waves3, waves3, WAVES3)
|
||||
MAKEPREPOSTPARVAR(Waves4, waves4, WAVES4)
|
||||
}
|
||||
|
Reference in New Issue
Block a user