--User changes

-Allow for pausing the renderer in the main window. This makes is more efficient when entering many parameters, such as when following a tutorial.
 -Add support for new variations: erf, gamma, jac_cn, jac_dn, jac_sn, logDB, pressure_wave, pRose3D, splits3D, w, waves2b, x, xerf, y, z.
 -Inform user of the start and stop of file parsing in EmberAnimate because the files could potentially be very large.
 -Move the follwing fields to a new table called Animation: Interpolation, Affine Interpolation, Temporal Samples, Temporal Filter Width, Temporal Filter Type.
  -These currently have no effect on the interactive renderer and instead are used when running flames through EmberGenome to generate sequences, and then animating them in Fractorium or EmberAnimate.
 -Add new parameter overrides for EmberRender and EmberAnimate which directly assign values to all flames being rendered, rather than scale:
  --quality
  --demin
  --demax

--Bug fixes
 -Left pad instead of right pad names of sequence outputs from EmberGenome.
 -Unique file naming was broken for files which already had an underscore in them.
 -Properly report that png is the default format of EmberRender and EmberAnimate output instead of erroneously claiming it was jpg.
 -Make command line programs search these folders in this order for the palette file:
  ./
  ~/.fractorium
  ~/.config/fractorium
  /usr/share/fractorium
  /usr/local/share/fractorium
 -Fix possible bad values in hexes.
 -Better assignment of Z variables.
 -Fix boarders due to use of poorly implemented rint() function from flam3. Use std::rint() now.
 -wedge_sph was completely wrong due to having accidentally swapped the mapping of two parameters.
 -Make juliascope juliascope_power parameter be of type REAL_NONZERO since it's used as a denominator.
 -Make Z assignment compatible with the originals in:
  -arch, bcircle, bCollide, bent, bent2, bisplit, blob, blur_linear, blur_square, bMod, boarders, boarders2, bSwirl, bTransform, butterfly, cardioid, cell, circleblur, circlize, circlize2, circus, collideoscope, cos, cosine, cosh, coth, cpow, cpow2, crescents, cropn, csc, csch, curl, curve, dc_gridout, deltaa, diamond, disc2, eclipse, eCollide, edisc, eJulia, elliptic, eMod, eMotion, ennepers, epispiral, ePush, eRotate, eScale, eSwirl, ex, exp, expo, exponential, fan, fdisc, fibonacci, fibonacci2, fisheye, flipcircle, flipy, flower, flux, funnel, glynnia, GlynnSim1, GlynnSim2, GlynnSim3, gridout, handkerchief, heart, hole, idisc, julia, julian2, juliaNab, kaleidoscope, lazyTravis, Lissajous, mask, MobiusN, mobius_strip, modulus, murl, murl2, npolar, ortho, oscilloscope, parabola, perspective, petal, phoenix_julia, pie (was also inconsistent between cpu and gpu), poincare, popcorn, popcorn2, power, pow_block, rational3, rays, rblur, rings, rippled, roundspher, sec, secant2, sigmoid, sin, sineblur, sinh, sinusgrid, sphericaln, spiralwing, spirograph, split, squarize, squirrel, squish, sschecks, starblur, stripes, stwin, super_shape, tan, tancos, tangent, tanh, TwinTrian, twoface, unpolar, waves, wavesn, wedge_julia, whorl, xheart, zblur, zscale.

--Code changes
 -Generalize Variation::PrecalcHelper() and rename to PrePostPrecalcHelper().
  --Do the same for the OpenCL version and rename it PrePostPrecalcOpenCLString().
 -Rename Variation::m_AssignType to m_PrePostAssignType since it's only relevant to pre/post variations.
This commit is contained in:
mfeemster 2016-01-29 17:02:15 -08:00
parent 6b02ea3465
commit cf9da379b6
43 changed files with 3688 additions and 1136 deletions

View File

@ -299,6 +299,7 @@
<ClInclude Include="..\..\..\Source\Ember\Variations04.h" />
<ClInclude Include="..\..\..\Source\Ember\Variations05.h" />
<ClInclude Include="..\..\..\Source\Ember\Variations06.h" />
<ClInclude Include="..\..\..\Source\Ember\Variations07.h" />
<ClInclude Include="..\..\..\Source\Ember\VariationsDC.h" />
<ClInclude Include="..\..\..\Source\Ember\Xform.h" />
<ClInclude Include="..\..\..\Source\Ember\Isaac.h" />

View File

@ -122,6 +122,9 @@
<ClInclude Include="..\..\..\Source\Ember\VarFuncs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\Ember\Variations07.h">
<Filter>Header Files\Variations</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\Source\Ember\DllMain.cpp">

View File

@ -59,6 +59,7 @@ HEADERS += \
$$PRJ_DIR/Variations04.h \
$$PRJ_DIR/Variations05.h \
$$PRJ_DIR/Variations06.h \
$$PRJ_DIR/Variations07.h \
$$PRJ_DIR/VariationsDC.h \
$$PRJ_DIR/VarFuncs.h \
$$PRJ_DIR/Xform.h \

View File

@ -14,16 +14,21 @@ unix|macx {
#This cannot be this...
#EMBER_ROOT = $$(PWD)/../../..
#It must be this...
EMBER_ROOT = ./../../../
win32:{
EMBER_ROOT = ./../../
}
unix|macx{
EMBER_ROOT = ./../../..
}
# When compiling from project root
autobuild {
EMBER_ROOT = $$(PWD)/../..
# EMBER_ROOT = $$(PWD)/../..
}
win32:{
EMBER_ROOT = $$(PWD)../../..
EXTERNAL_DIR = $$(PWD)../../../../External
EXTERNAL_LIB = $$(PWD)../../../External/libs
#EMBER_ROOT = $$(PWD)../../..
EXTERNAL_DIR = $$(EMBER_ROOT)/../
EXTERNAL_LIB = $$(EMBER_ROOT)/../
# EXTERNAL_DIR which contains Third Party Codes is in the parent folder of "fractorium"
# EXTERNAL_LIB is in EXTERNAL_DIR actually, but it is strange that EXTERNAL_DIR must go
# one more step upper than EXTERNAL_LIB to get it work
@ -32,8 +37,8 @@ win32:{
SHARE_INSTALL_DIR = $$(PWD)../../../Install/share/fractorium
# INSTALL_DIRs Don't work?
message(EMBER_ROOT: $$absolute_path($$EMBER_ROOT))
message(EXTERNAL: $$absolute_path($$EXTERNAL_DIR))
message(EXTERNAL_LIB:$$absolute_path($$EXTERNAL_LIB) )
message(EXTERNAL_DIR: $$absolute_path($$EXTERNAL_DIR))
message(EXTERNAL_LIB: $$absolute_path($$EXTERNAL_LIB) )
}
message(EMBER_ROOT: $$EMBER_ROOT)

Binary file not shown.

View File

@ -537,6 +537,7 @@ QTableWidget#ColorTableHeader QHeaderView::section::horizontal,
QTableWidget#GeometryTableHeader QHeaderView::section::horizontal,
QTableWidget#FilterTableHeader QHeaderView::section::horizontal,
QTableWidget#IterationTableHeader QHeaderView::section::horizontal,
QTableWidget#AnimationTableHeader QHeaderView::section::horizontal,
QTreeWidget#LibraryTree QHeaderView::section::horizontal
{
border-right: none;
@ -546,6 +547,7 @@ QTableWidget#ColorTable,
QTableWidget#GeometryTable,
QTableWidget#FilterTable,
QTableWidget#IterationTable,
QTableWidget#AnimationTable,
QTableWidget#XformWeightNameTable
{
border-left: 1px solid gray;
@ -617,4 +619,3 @@ QTableView#FinalRenderParamsTable QPushButton
margin-bottom: 2px;
padding: 0px;
}

View File

@ -23,6 +23,7 @@ template<> CriticalSection QTIsaac<ISAAC_SIZE, ISAAC_INT>::m_CS = CriticalSectio
#include "Variations04.h"
#include "Variations05.h"
#include "Variations06.h"
#include "Variations07.h"
#include "VariationsDC.h"
#include "VariationList.h"
#include "Affine2D.h"
@ -379,6 +380,21 @@ uint Timing::m_ProcessorCount;
EXPORTPREPOSTREGVAR(BubbleT3D, T) \
EXPORTPREPOSTREGVAR(Synth, T) \
EXPORTPREPOSTREGVAR(Crackle, T) \
EXPORTPREPOSTREGVAR(Erf, T) \
EXPORTPREPOSTREGVAR(Xerf, T) \
EXPORTPREPOSTREGVAR(W, T) \
EXPORTPREPOSTREGVAR(X, T) \
EXPORTPREPOSTREGVAR(Y, T) \
EXPORTPREPOSTREGVAR(Z, T) \
EXPORTPREPOSTREGVAR(Splits3D, T) \
EXPORTPREPOSTREGVAR(Waves2B, T) \
EXPORTPREPOSTREGVAR(JacCn, T) \
EXPORTPREPOSTREGVAR(JacDn, T) \
EXPORTPREPOSTREGVAR(JacSn, T) \
EXPORTPREPOSTREGVAR(PressureWave, T) \
EXPORTPREPOSTREGVAR(Gamma, T) \
EXPORTPREPOSTREGVAR(PRose3D, T) \
EXPORTPREPOSTREGVAR(LogDB, T) \
template EMBER_API class PostSmartcropVariation<T>; /*Only implemented as post.*/ \
EXPORTPREPOSTREGVAR(DCBubble, T) \
EXPORTPREPOSTREGVAR(DCCarpet, T) \

View File

@ -1794,7 +1794,7 @@ private:
for (size_t k = 0; k < size; k++)
t += coefs[k] * embers[k].*m;
this->*m = size_t(Rint(t));
this->*m = size_t(std::rint(t));
}
/// <summary>

View File

@ -64,7 +64,6 @@ namespace EmberNs
#define CX(c) (reinterpret_cast<char*>(c))
#define CCX(c) (reinterpret_cast<const char*>(c))
#define BadVal(x) (((x) != (x)) || ((x) > 1e10) || ((x) < -1e10))
#define Rint(A) floor((A) + (((A) < 0) ? T(-0.5) : T(0.5)))
#define Vlen(x) (sizeof(x) / sizeof(*x))
#define SQR(x) ((x) * (x))
#define CUBE(x) ((x) * (x) * (x))

View File

@ -270,9 +270,9 @@ public:
for (j = 0; j < 8; j++)
{
size_t idx = 8 * i + j;
os << hex << setw(2) << setfill('0') << int(Rint(ember.m_Palette[idx][0] * 255));
os << hex << setw(2) << setfill('0') << int(Rint(ember.m_Palette[idx][1] * 255));
os << hex << setw(2) << setfill('0') << int(Rint(ember.m_Palette[idx][2] * 255));
os << hex << setw(2) << setfill('0') << int(std::rint(ember.m_Palette[idx][0] * 255));
os << hex << setw(2) << setfill('0') << int(std::rint(ember.m_Palette[idx][1] * 255));
os << hex << setw(2) << setfill('0') << int(std::rint(ember.m_Palette[idx][2] * 255));
}
os << endl;
@ -294,14 +294,14 @@ public:
if (IsClose(a, 255.0))
{
if (intPalette)
os << "<color index=\"" << i << "\" rgb=\"" << int(Rint(r)) << " " << int(Rint(g)) << " " << int(Rint(b)) << "\"/>";
os << "<color index=\"" << i << "\" rgb=\"" << int(std::rint(r)) << " " << int(std::rint(g)) << " " << int(std::rint(b)) << "\"/>";
else
os << "<color index=\"" << i << "\" rgb=\"" << std::fixed << std::setprecision(2) << r << " " << g << " " << b << "\"/>";
}
else
{
if (intPalette)
os << " <color index=\"" << i << "\" rgba=\"" << int(Rint(r)) << " " << int(Rint(g)) << " " << int(Rint(b)) << " " << int(Rint(a)) << "\"/>";
os << " <color index=\"" << i << "\" rgba=\"" << int(std::rint(r)) << " " << int(std::rint(g)) << " " << int(std::rint(b)) << " " << int(std::rint(a)) << "\"/>";
else
os << " <color index=\"" << i << "\" rgba=\"" << std::fixed << std::setprecision(2) << r << " " << g << " " << b << " " << a << "\"/>";
}

View File

@ -658,6 +658,22 @@ double SafeTan<double>(double x)
return std::tan(x);
}
/// <summary>
/// If r < EPS, return 1 / r.
/// Else, return q / r.
/// </summary>
/// <param name="q">The numerator</param>
/// <param name="r">The denominator</param>
/// <returns>The quotient</returns>
template <typename T>
static inline T SafeDivInv(T q, T r)
{
if (r < EPS)
return 1 / r;
return q / r;
}
/// <summary>
/// Return the cube of the passed in value.
/// This is useful when the value is a result of a computation

View File

@ -255,7 +255,7 @@ public:
if (pmq.x == 0 && pmq.y == 0)
return 1;
return 2 * ((u.x - q.x) * pmq.x + (u.y - q.y) * pmq.y) / (SQR(pmq.x) + SQR(pmq.y));
return 2 * ((u.x - q.x) * pmq.x + (u.y - q.y) * pmq.y) / Zeps(SQR(pmq.x) + SQR(pmq.y));
}
/// <summary>
@ -279,6 +279,99 @@ public:
return ratiomax;
}
/// <summary>
/// Used in the jac_* variations.
/// </summary>
static void JacobiElliptic(T uu, T emmc, T& sn, T& cn, T& dn)
{
//Code is taken from IROIRO++ library,
//released under CC share-alike license.
//Less accurate for faster rendering (still very precise).
T const CA = T(0.0003);//The accuracy is the square of CA.
T a, b, c, d, em[13], en[13];
int bo;
int l;
int ii;
int i;
T emc = emmc;
T u = uu;
if (emc != 0)
{
bo = 0;
if (emc < 0)
bo = 1;
if (bo != 0)
{
d = 1 - emc;
emc = -emc / d;
d = std::sqrt(d);
u = d * u;
}
a = 1;
dn = 1;
for (i = 0; i < 8; i++)
{
l = i;
em[i] = a;
emc = std::sqrt(emc);
en[i] = emc;
c = T(0.5) * (a + emc);
if (std::abs(a - emc) <= CA * a)
break;
emc = a * emc;
a = c;
}
u = c * u;
sincos(u, &sn, &cn);
if (sn != 0)
{
a = cn / sn;
c = a * c;
for (ii = l; ii >= 0; --ii)
{
b = em[ii];
a = c * a;
c = dn * c;
dn = (en[ii] + a) / (b + a);
a = c / b;
}
a = 1 / std::sqrt(c * c + 1);
if (sn < 0)
sn = -a;
else
sn = a;
cn = c * sn;
}
if (bo != 0)
{
a = dn;
dn = cn;
cn = a;
sn = sn / d;
}
}
else
{
cn = 1 / std::cosh(u);
dn = cn;
sn = std::tanh(u);
}
}
SINGLETON_DERIVED_IMPL(VarFuncs<T>);
private:

View File

@ -136,6 +136,7 @@ enum class eVariationId : et
VAR_ENNEPERS ,
VAR_EPISPIRAL ,
VAR_EPUSH ,
VAR_ERF ,
VAR_EROTATE ,
VAR_ESCALE ,
VAR_ESCHER ,
@ -166,6 +167,7 @@ enum class eVariationId : et
VAR_FOCI3D ,
VAR_FOURTH ,
VAR_FUNNEL ,
VAR_GAMMA ,
VAR_GAUSSIAN_BLUR ,
VAR_GDOFFS ,
VAR_GLYNNIA ,
@ -193,6 +195,9 @@ enum class eVariationId : et
VAR_HYPERTILE3D2 ,
VAR_IDISC ,
VAR_INTERFERENCE2 ,
VAR_JAC_CN ,
VAR_JAC_DN ,
VAR_JAC_SN ,
VAR_JULIA ,
VAR_JULIA3D ,
VAR_JULIA3DQ ,
@ -216,6 +221,7 @@ enum class eVariationId : et
VAR_LINEAR3D ,
VAR_LISSAJOUS ,
VAR_LOG ,
VAR_LOG_DB ,
VAR_LOQ ,
VAR_LOONIE ,
VAR_LOONIE2 ,
@ -260,6 +266,8 @@ enum class eVariationId : et
VAR_POPCORN23D ,
VAR_POW_BLOCK ,
VAR_POWER ,
VAR_PRESSURE_WAVE ,
VAR_PROSE3D ,
VAR_PSPHERE ,
VAR_Q_ODE ,
VAR_RADIAL_BLUR ,
@ -308,6 +316,7 @@ enum class eVariationId : et
VAR_SPLIT ,
VAR_SPLIT_BRDR ,
VAR_SPLITS ,
VAR_SPLITS3D ,
VAR_SQUARE ,
VAR_SQUARE3D ,
VAR_SQUARIZE ,
@ -336,18 +345,24 @@ enum class eVariationId : et
VAR_TWO_FACE ,
VAR_UNPOLAR ,
VAR_VORON ,
VAR_W ,
VAR_WAFFLE ,
VAR_WAVES ,
VAR_WAVES2 ,
VAR_WAVES23D ,
VAR_WAVES2B ,
VAR_WAVESN ,
VAR_WDISC ,
VAR_WEDGE ,
VAR_WEDGE_JULIA ,
VAR_WEDGE_SPH ,
VAR_WHORL ,
VAR_X ,
VAR_XERF ,
VAR_XHEART ,
VAR_XTRB ,
VAR_Y ,
VAR_Z ,
VAR_ZBLUR ,
VAR_ZCONE ,
VAR_ZSCALE ,
@ -445,6 +460,7 @@ enum class eVariationId : et
VAR_PRE_ENNEPERS,
VAR_PRE_EPISPIRAL,
VAR_PRE_EPUSH,
VAR_PRE_ERF,
VAR_PRE_EROTATE,
VAR_PRE_ESCALE,
VAR_PRE_ESCHER,
@ -475,6 +491,7 @@ enum class eVariationId : et
VAR_PRE_FOCI3D,
VAR_PRE_FOURTH,
VAR_PRE_FUNNEL,
VAR_PRE_GAMMA,
VAR_PRE_GAUSSIAN_BLUR,
VAR_PRE_GDOFFS,
VAR_PRE_GLYNNIA,
@ -502,6 +519,9 @@ enum class eVariationId : et
VAR_PRE_HYPERTILE3D2,
VAR_PRE_IDISC,
VAR_PRE_INTERFERENCE2,
VAR_PRE_JAC_CN,
VAR_PRE_JAC_DN,
VAR_PRE_JAC_SN,
VAR_PRE_JULIA,
VAR_PRE_JULIA3D,
VAR_PRE_JULIA3DQ,
@ -525,6 +545,7 @@ enum class eVariationId : et
VAR_PRE_LINEAR3D,
VAR_PRE_LISSAJOUS,
VAR_PRE_LOG,
VAR_PRE_LOG_DB,
VAR_PRE_LOQ,
VAR_PRE_LOONIE,
VAR_PRE_LOONIE2,
@ -569,6 +590,8 @@ enum class eVariationId : et
VAR_PRE_POPCORN23D,
VAR_PRE_POW_BLOCK,
VAR_PRE_POWER,
VAR_PRE_PRESSURE_WAVE,
VAR_PRE_PROSE3D,
VAR_PRE_PSPHERE,
VAR_PRE_Q_ODE,
VAR_PRE_RADIAL_BLUR,
@ -617,6 +640,7 @@ enum class eVariationId : et
VAR_PRE_SPLIT,
VAR_PRE_SPLIT_BRDR,
VAR_PRE_SPLITS,
VAR_PRE_SPLITS3D,
VAR_PRE_SQUARE,
VAR_PRE_SQUARE3D,
VAR_PRE_SQUARIZE,
@ -645,18 +669,24 @@ enum class eVariationId : et
VAR_PRE_TWO_FACE,
VAR_PRE_UNPOLAR,
VAR_PRE_VORON,
VAR_PRE_W,
VAR_PRE_WAFFLE,
VAR_PRE_WAVES,
VAR_PRE_WAVES2,
VAR_PRE_WAVES23D,
VAR_PRE_WAVES2B,
VAR_PRE_WAVESN,
VAR_PRE_WDISC,
VAR_PRE_WEDGE,
VAR_PRE_WEDGE_JULIA,
VAR_PRE_WEDGE_SPH,
VAR_PRE_WHORL,
VAR_PRE_X,
VAR_PRE_XERF,
VAR_PRE_XHEART,
VAR_PRE_XTRB,
VAR_PRE_Y,
VAR_PRE_Z,
VAR_PRE_ZBLUR,
VAR_PRE_ZCONE,
VAR_PRE_ZSCALE,
@ -754,6 +784,7 @@ enum class eVariationId : et
VAR_POST_ENNEPERS,
VAR_POST_EPISPIRAL,
VAR_POST_EPUSH,
VAR_POST_ERF,
VAR_POST_EROTATE,
VAR_POST_ESCALE,
VAR_POST_ESCHER,
@ -784,6 +815,7 @@ enum class eVariationId : et
VAR_POST_FOCI3D,
VAR_POST_FOURTH,
VAR_POST_FUNNEL,
VAR_POST_GAMMA,
VAR_POST_GAUSSIAN_BLUR,
VAR_POST_GDOFFS,
VAR_POST_GLYNNIA,
@ -811,6 +843,9 @@ enum class eVariationId : et
VAR_POST_HYPERTILE3D2,
VAR_POST_IDISC,
VAR_POST_INTERFERENCE2,
VAR_POST_JAC_CN,
VAR_POST_JAC_DN,
VAR_POST_JAC_SN,
VAR_POST_JULIA,
VAR_POST_JULIA3D,
VAR_POST_JULIA3DQ,
@ -834,6 +869,7 @@ enum class eVariationId : et
VAR_POST_LINEAR3D,
VAR_POST_LISSAJOUS,
VAR_POST_LOG,
VAR_POST_LOG_DB,
VAR_POST_LOQ,
VAR_POST_LOONIE,
VAR_POST_LOONIE2,
@ -878,6 +914,8 @@ enum class eVariationId : et
VAR_POST_POPCORN23D,
VAR_POST_POW_BLOCK,
VAR_POST_POWER,
VAR_POST_PRESSURE_WAVE,
VAR_POST_PROSE3D,
VAR_POST_PSPHERE,
VAR_POST_Q_ODE,
VAR_POST_RADIAL_BLUR,
@ -926,6 +964,7 @@ enum class eVariationId : et
VAR_POST_SPLIT,
VAR_POST_SPLIT_BRDR,
VAR_POST_SPLITS,
VAR_POST_SPLITS3D,
VAR_POST_SQUARE,
VAR_POST_SQUARE3D,
VAR_POST_SQUARIZE,
@ -954,18 +993,24 @@ enum class eVariationId : et
VAR_POST_TWO_FACE,
VAR_POST_UNPOLAR,
VAR_POST_VORON,
VAR_POST_W,
VAR_POST_WAFFLE,
VAR_POST_WAVES,
VAR_POST_WAVES2,
VAR_POST_WAVES23D,
VAR_POST_WAVES2B,
VAR_POST_WAVESN,
VAR_POST_WDISC,
VAR_POST_WEDGE,
VAR_POST_WEDGE_JULIA,
VAR_POST_WEDGE_SPH,
VAR_POST_WHORL,
VAR_POST_X,
VAR_POST_XERF,
VAR_POST_XHEART,
VAR_POST_XTRB,
VAR_POST_Y,
VAR_POST_Z,
VAR_POST_ZBLUR,
VAR_POST_ZCONE,
VAR_POST_ZSCALE,
@ -1077,7 +1122,7 @@ public:
m_NeedPrecalcSqrtSumSquares = true;
}
m_AssignType = eVariationAssignType::ASSIGNTYPE_SET;
m_PrePostAssignType = eVariationAssignType::ASSIGNTYPE_SET;
SetType();
}
@ -1131,7 +1176,7 @@ public:
{
m_Name = variation.Name();
m_VarType = variation.VarType();
m_AssignType = variation.AssignType();
m_PrePostAssignType = variation.AssignType();
m_VariationId = variation.VariationId();
m_Weight = T(variation.m_Weight);
m_Xform = typeid(T) == typeid(U) ? const_cast<Xform<T>*>(reinterpret_cast<const Xform<T>*>(variation.ParentXform())) : nullptr;
@ -1147,115 +1192,60 @@ public:
/// Per-variation precalc used for pre and post variations.
/// </summary>
/// <param name="iteratorHelper">The helper to read values from in the case of pre, and store precalc values to in both cases.</param>
/// <param name="point">The point to read values from in the case of post, ignored for pre.</param>
void PrecalcHelper(IteratorHelper<T>& iteratorHelper, Point<T>* point)
void PrePostPrecalcHelper(IteratorHelper<T>& iteratorHelper)
{
if (m_VarType == eVariationType::VARTYPE_PRE)
if (m_NeedPrecalcSumSquares)
{
if (m_NeedPrecalcSumSquares)
iteratorHelper.m_PrecalcSumSquares = SQR(iteratorHelper.In.x) + SQR(iteratorHelper.In.y);
if (m_NeedPrecalcSqrtSumSquares)
{
iteratorHelper.m_PrecalcSumSquares = SQR(iteratorHelper.m_TransX) + SQR(iteratorHelper.m_TransY);
iteratorHelper.m_PrecalcSqrtSumSquares = std::sqrt(iteratorHelper.m_PrecalcSumSquares);
if (m_NeedPrecalcSqrtSumSquares)
if (m_NeedPrecalcAngles)
{
iteratorHelper.m_PrecalcSqrtSumSquares = std::sqrt(iteratorHelper.m_PrecalcSumSquares);
if (m_NeedPrecalcAngles)
{
iteratorHelper.m_PrecalcSina = iteratorHelper.m_TransX / iteratorHelper.m_PrecalcSqrtSumSquares;
iteratorHelper.m_PrecalcCosa = iteratorHelper.m_TransY / iteratorHelper.m_PrecalcSqrtSumSquares;
}
iteratorHelper.m_PrecalcSina = iteratorHelper.In.x / iteratorHelper.m_PrecalcSqrtSumSquares;
iteratorHelper.m_PrecalcCosa = iteratorHelper.In.y / iteratorHelper.m_PrecalcSqrtSumSquares;
}
}
if (m_NeedPrecalcAtanXY)
iteratorHelper.m_PrecalcAtanxy = atan2(iteratorHelper.m_TransX, iteratorHelper.m_TransY);
if (m_NeedPrecalcAtanYX)
iteratorHelper.m_PrecalcAtanyx = atan2(iteratorHelper.m_TransY, iteratorHelper.m_TransX);
}
else if (m_VarType == eVariationType::VARTYPE_POST)
{
if (m_NeedPrecalcSumSquares)
{
iteratorHelper.m_PrecalcSumSquares = SQR(point->m_X) + SQR(point->m_Y);
if (m_NeedPrecalcSqrtSumSquares)
{
iteratorHelper.m_PrecalcSqrtSumSquares = std::sqrt(iteratorHelper.m_PrecalcSumSquares);
if (m_NeedPrecalcAtanXY)
iteratorHelper.m_PrecalcAtanxy = atan2(iteratorHelper.In.x, iteratorHelper.In.y);
if (m_NeedPrecalcAngles)
{
iteratorHelper.m_PrecalcSina = point->m_X / iteratorHelper.m_PrecalcSqrtSumSquares;
iteratorHelper.m_PrecalcCosa = point->m_Y / iteratorHelper.m_PrecalcSqrtSumSquares;
}
}
}
if (m_NeedPrecalcAtanXY)
iteratorHelper.m_PrecalcAtanxy = atan2(point->m_X, point->m_Y);
if (m_NeedPrecalcAtanYX)
iteratorHelper.m_PrecalcAtanyx = atan2(point->m_Y, point->m_X);
}
if (m_NeedPrecalcAtanYX)
iteratorHelper.m_PrecalcAtanyx = atan2(iteratorHelper.In.y, iteratorHelper.In.x);
}
/// <summary>
/// Per-variation precalc OpenCL string used for pre and post variations.
/// </summary>
/// <returns>The per-variation OpenCL precalc string</returns>
string PrecalcOpenCLString() const
string PrePostPrecalcOpenCLString() const
{
ostringstream ss;
if (m_VarType == eVariationType::VARTYPE_PRE)
if (m_NeedPrecalcSumSquares)
{
if (m_NeedPrecalcSumSquares)
ss << "\tprecalcSumSquares = SQR(vIn.x) + SQR(vIn.y);\n";
if (m_NeedPrecalcSqrtSumSquares)
{
ss << "\tprecalcSumSquares = SQR(transX) + SQR(transY);\n";
ss << "\tprecalcSqrtSumSquares = sqrt(precalcSumSquares);\n";
if (m_NeedPrecalcSqrtSumSquares)
if (m_NeedPrecalcAngles)
{
ss << "\tprecalcSqrtSumSquares = sqrt(precalcSumSquares);\n";
if (m_NeedPrecalcAngles)
{
ss << "\tprecalcSina = transX / precalcSqrtSumSquares;\n";
ss << "\tprecalcCosa = transY / precalcSqrtSumSquares;\n";
}
ss << "\tprecalcSina = vIn.x / precalcSqrtSumSquares;\n";
ss << "\tprecalcCosa = vIn.y / precalcSqrtSumSquares;\n";
}
}
if (m_NeedPrecalcAtanXY)
ss << "\tprecalcAtanxy = atan2(transX, transY);\n";
if (m_NeedPrecalcAtanYX)
ss << "\tprecalcAtanyx = atan2(transY, transX);\n";
}
else if (m_VarType == eVariationType::VARTYPE_POST)
{
if (m_NeedPrecalcSumSquares)
{
ss << "\tprecalcSumSquares = SQR(outPoint->m_X) + SQR(outPoint->m_Y);\n";
if (m_NeedPrecalcSqrtSumSquares)
{
ss << "\tprecalcSqrtSumSquares = sqrt(precalcSumSquares);\n";
if (m_NeedPrecalcAtanXY)
ss << "\tprecalcAtanxy = atan2(vIn.x, vIn.y);\n";
if (m_NeedPrecalcAngles)
{
ss << "\tprecalcSina = outPoint->m_X / precalcSqrtSumSquares;\n";
ss << "\tprecalcCosa = outPoint->m_Y / precalcSqrtSumSquares;\n";
}
}
}
if (m_NeedPrecalcAtanXY)
ss << "\tprecalcAtanxy = atan2(outPoint->m_X, outPoint->m_Y);\n";
if (m_NeedPrecalcAtanYX)
ss << "\tprecalcAtanyx = atan2(outPoint->m_Y, outPoint->m_X);\n";
}
if (m_NeedPrecalcAtanYX)
ss << "\tprecalcAtanyx = atan2(vIn.y, vIn.x);\n";
if (NeedAnyPrecalc())
ss << "\n";
@ -1393,6 +1383,10 @@ public:
return "";
}
/// <summary>
/// Returns the base name of the variation without the "pre_" or "post_" prefix.
/// </summary>
/// <returns>The base name of the variation</returns>
string BaseName() const
{
string prefix = Prefix();
@ -1415,7 +1409,7 @@ public:
eVariationId VariationId() const { return m_VariationId; }
string Name() const { return m_Name; }
eVariationType VarType() const { return m_VarType; }
eVariationAssignType AssignType() const { return m_AssignType; }
eVariationAssignType AssignType() const { return m_PrePostAssignType; }
const Xform<T>* ParentXform() const { return m_Xform; }
void ParentXform(Xform<T>* xform) { m_Xform = xform; }
intmax_t IndexInXform() const { return m_Xform ? m_Xform->GetVariationIndex(const_cast<Variation<T>*>(this)) : -1; }
@ -1424,6 +1418,10 @@ public:
T m_Weight;//The weight of the variation.
protected:
/// <summary>
/// Sets the type of the variation depending on whether the name starts with "pre_",
/// "post_" or neither.
/// </summary>
void SetType()
{
if (m_Name.find("pre_") == 0)
@ -1434,11 +1432,30 @@ protected:
m_VarType = eVariationType::VARTYPE_REG;
}
/// <summary>
/// Return the default Z coordinate assignment value depending on the type of variation and its assign type.
/// </summary>
/// <param name="helper">The helper used to retrieve the input Z coordinate.</param>
/// <returns>The appropriate Z value.</returns>
T DefaultZ(const IteratorHelper<T>& helper) const
{
return m_VarType == eVariationType::VARTYPE_REG ? 0 : (m_PrePostAssignType == eVariationAssignType::ASSIGNTYPE_SET ? helper.In.z : 0);
}
/// <summary>
/// OpenCL equivalent of DefaultZ().
/// </summary>
/// <returns>The OpenCL string needed to make the proper Z coordinate assignment</returns>
string DefaultZCl() const
{
return m_VarType == eVariationType::VARTYPE_REG ? "0;\n" : (m_PrePostAssignType == eVariationAssignType::ASSIGNTYPE_SET ? "vIn.z;\n" : "0;\n");
}
Xform<T>* m_Xform;//The parent Xform that this variation is a child of.
eVariationId m_VariationId;//The unique ID of this variation.
string m_Name;//The unique name of this variation.
eVariationType m_VarType;//The type of variation: regular, pre or post.
eVariationAssignType m_AssignType;//Whether to assign the results for pre/post, or sum them.
eVariationAssignType m_PrePostAssignType;//Whether to assign the results for pre/post, or sum them.
private:
bool m_NeedPrecalcSumSquares;//Whether this variation uses the precalc sum squares value in its calculations.
@ -1750,13 +1767,15 @@ private:
using Variation<T>::m_VariationId; \
using Variation<T>::m_Name; \
using Variation<T>::m_VarType; \
using Variation<T>::m_AssignType; \
using Variation<T>::m_PrePostAssignType; \
using Variation<T>::SetType; \
using Variation<T>::IndexInXform; \
using Variation<T>::XformIndexInEmber; \
using Variation<T>::Prefix; \
using Variation<T>::Precalc; \
using Variation<T>::StateOpenCLString;
using Variation<T>::StateOpenCLString; \
using Variation<T>::DefaultZ; \
using Variation<T>::DefaultZCl;
/// <summary>
/// Parametric variations use parameters in addition to weight.
@ -2147,7 +2166,7 @@ protected:
{ \
m_VariationId = eVariationId::VAR_PRE_##enumName; \
m_Name = "pre_"#stringName; \
m_AssignType = assignType; \
m_PrePostAssignType = assignType; \
SetType(); \
} \
\
@ -2163,7 +2182,7 @@ protected:
{ \
m_VariationId = eVariationId::VAR_POST_##enumName; \
m_Name = "post_"#stringName; \
m_AssignType = assignType; \
m_PrePostAssignType = assignType; \
SetType(); \
} \
\
@ -2268,7 +2287,7 @@ protected:
{ \
m_VariationId = eVariationId::VAR_PRE_##enumName; \
m_Name = "pre_"#stringName; \
m_AssignType = assignType; \
m_PrePostAssignType = assignType; \
SetType(); \
Init(); \
} \
@ -2287,7 +2306,7 @@ protected:
{ \
m_VariationId = eVariationId::VAR_POST_##enumName; \
m_Name = "post_"#stringName; \
m_AssignType = assignType; \
m_PrePostAssignType = assignType; \
SetType(); \
Init(); \
} \

View File

@ -6,6 +6,7 @@
#include "Variations04.h"
#include "Variations05.h"
#include "Variations06.h"
#include "Variations07.h"
#include "VariationsDC.h"
/// <summary>
@ -343,6 +344,21 @@ public:
ADDPREPOSTREGVAR(Synth)
ADDPREPOSTREGVAR(Crackle)
m_Variations.push_back(new PostSmartcropVariation<T>());//Post only
ADDPREPOSTREGVAR(Xerf)
ADDPREPOSTREGVAR(Erf)
ADDPREPOSTREGVAR(W)
ADDPREPOSTREGVAR(X)
ADDPREPOSTREGVAR(Y)
ADDPREPOSTREGVAR(Z)
ADDPREPOSTREGVAR(Splits3D)
ADDPREPOSTREGVAR(Waves2B)
ADDPREPOSTREGVAR(JacCn)
ADDPREPOSTREGVAR(JacDn)
ADDPREPOSTREGVAR(JacSn)
ADDPREPOSTREGVAR(PressureWave)
ADDPREPOSTREGVAR(Gamma)
ADDPREPOSTREGVAR(PRose3D)
ADDPREPOSTREGVAR(LogDB)
//ADDPREPOSTREGVAR(LinearXZ)
//ADDPREPOSTREGVAR(LinearYZ)
//DC are special.

File diff suppressed because it is too large Load Diff

View File

@ -61,14 +61,14 @@ public:
{
helper.Out.x = m_Weight * t * std::cos(theta);
helper.Out.y = m_Weight * t * std::sin(theta);
helper.Out.z = 0;
}
else
{
helper.Out.x = 0;
helper.Out.y = 0;
helper.Out.z = 0;
}
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -96,6 +96,7 @@ public:
<< "\t\t\tvOut.y = 0;\n"
<< "\t\t\tvOut.z = 0;\n"
<< "\t\t}\n"
<< "\t\tvOut.Z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -697,7 +698,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -736,7 +737,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -781,7 +782,7 @@ public:
T r = m_BlurLinearLength * rand.Frand01<T>();
helper.Out.x = m_Weight * (helper.In.x + r * m_C);
helper.Out.y = m_Weight * (helper.In.y + r * m_S);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -799,7 +800,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + r * " << c << ");\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + r * " << s << ");\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -845,7 +846,7 @@ public:
{
helper.Out.x = m_V * (rand.Frand01<T>() - T(0.5));
helper.Out.y = m_V * (rand.Frand01<T>() - T(0.5));
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -858,7 +859,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = " << v << " * (MwcNext01(mwc) - (real_t)(0.5));\n"
<< "\t\tvOut.y = " << v << " * (MwcNext01(mwc) - (real_t)(0.5));\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1361,7 +1362,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1417,7 +1418,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1473,7 +1474,7 @@ public:
T r = m_Weight * std::sqrt(helper.m_PrecalcSumSquares + std::sin(helper.m_PrecalcAtanyx * m_A) + 1);
helper.Out.x = r * helper.m_PrecalcCosa;
helper.Out.y = r * helper.m_PrecalcSina;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1488,7 +1489,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * precalcCosa;\n"
<< "\t\tvOut.y = r * precalcSina;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1669,7 +1670,7 @@ public:
val = T(M_PI_4) * perimeter / side - T(M_PI_4);
helper.Out.x = r * std::cos(val);
helper.Out.y = r * std::sin(val);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1710,7 +1711,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * cos(val);\n"
<< "\t\tvOut.y = r * sin(val);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1778,7 +1779,7 @@ public:
T val = T(M_PI_4) * perimeter / side - T(M_PI_4);
helper.Out.x = r * std::cos(val);
helper.Out.y = r * std::sin(val);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1818,7 +1819,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * cos(val);\n"
<< "\t\tvOut.y = r * sin(val);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1859,7 +1860,7 @@ public:
T oscnapy = Foscn<T>(m_AmountY, m_Py);
helper.Out.x = -1 + m_Vv2 * Lerp<T>(Lerp(x, Fosc(x, T(4), m_Px), oscnapx), Fosc(bx, T(4), m_Px), oscnapx);//Original did a direct assignment to outPoint, which is incompatible with Ember's design.
helper.Out.y = -1 + m_Vv2 * Lerp<T>(Lerp(y, Fosc(y, T(4), m_Py), oscnapy), Fosc(by, T(4), m_Py), oscnapy);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1889,7 +1890,7 @@ public:
<< "\n"
<< "\t\tvOut.x = -1 + " << vv2 << " * Lerp(Lerp(x, Fosc(x, 4, " << px << "), oscnapx), Fosc(bx, 4, " << px << "), oscnapx);\n"
<< "\t\tvOut.y = -1 + " << vv2 << " * Lerp(Lerp(y, Fosc(y, 4, " << py << "), oscnapy), Fosc(by, 4, " << py << "), oscnapy);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1963,7 +1964,7 @@ public:
sincos(avga, &s, &c);
helper.Out.x = avgr * c;
helper.Out.y = avgr * s;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1978,7 +1979,7 @@ public:
<< "\n"
<< "\t\tvOut.x = avgr * c;\n"
<< "\t\tvOut.y = avgr * s;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2006,7 +2007,7 @@ public:
T csv = std::cos(temp);
helper.Out.x = m_Weight * expor * csv;
helper.Out.y = m_Weight * expor * snv;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2027,7 +2028,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * expor * csv;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * expor * snv;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2159,7 +2160,7 @@ public:
sincos(a, &s, &c);
helper.Out.x = m_Weight * r * c;
helper.Out.y = m_Weight * r * s;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2174,7 +2175,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * r * c;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * r * s;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2205,7 +2206,7 @@ public:
T eradius2 = std::exp((helper.In.x * m_NatLog - helper.In.y * T(M_PI)) * -1);
helper.Out.x = m_Weight * (eradius1 * cnum1 - eradius2 * cnum2) * m_Five;
helper.Out.y = m_Weight * (eradius1 * snum1 - eradius2 * snum2) * m_Five;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2228,7 +2229,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (eradius1 * cnum1 - eradius2 * cnum2) * " << five << ";\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (eradius1 * snum1 - eradius2 * snum2) * " << five << ";\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2278,7 +2279,7 @@ public:
T eradius2 = m_Sc * std::exp(m_Sc2 * ((helper.In.x * m_NatLog - helper.In.y * T(M_PI)) * -1));
helper.Out.x = m_Weight * (eradius1 * cnum1 - eradius2 * cnum2) * m_Five;
helper.Out.y = m_Weight * (eradius1 * snum1 - eradius2 * snum2) * m_Five;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2303,7 +2304,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (eradius1 * cnum1 - eradius2 * cnum2) * " << five << ";\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (eradius1 * snum1 - eradius2 * snum2) * " << five << ";\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2383,7 +2384,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2429,7 +2430,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2526,7 +2527,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2596,7 +2597,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2632,7 +2633,7 @@ public:
helper.Out.x = r * helper.m_PrecalcCosa;
helper.Out.y = r * helper.m_PrecalcSina;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2653,7 +2654,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * precalcCosa;\n"
<< "\t\tvOut.y = r * precalcSina;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2695,7 +2696,7 @@ public:
T vr = m_Weight / (SQR(c) + SQR(d));
helper.Out.x = vr * (a * c + b * d);
helper.Out.y = vr * (b * c - a * d);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2718,7 +2719,7 @@ public:
<< "\n"
<< "\t\tvOut.x = vr * (a * c + b * d);\n"
<< "\t\tvOut.y = vr * (b * c - a * d);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2787,7 +2788,7 @@ public:
T vr = m_Weight / (SQR(c) + SQR(d));
helper.Out.x = vr * (a * c + b * d);
helper.Out.y = vr * (b * c - a * d);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2814,7 +2815,7 @@ public:
<< "\n"
<< "\t\tvOut.x = vr * (a * c + b * d);\n"
<< "\t\tvOut.y = vr * (b * c - a * d);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2878,7 +2879,7 @@ public:
T cosa = std::cos(temp);
helper.Out.x = vr * (x * cosa + y * sina);
helper.Out.y = vr * (y * cosa - x * sina);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2905,7 +2906,7 @@ public:
<< "\n"
<< "\t\tvOut.x = vr * (x * cosa + y * sina);\n"
<< "\t\tvOut.y = vr * (y * cosa - x * sina);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3286,7 +3287,7 @@ public:
T r = helper.m_PrecalcAtanyx * m_V;
helper.Out.x = r * c;
helper.Out.y = r * s;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3304,7 +3305,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * c;\n"
<< "\t\tvOut.y = r * s;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3350,7 +3351,7 @@ public:
T r = m_Weight * std::pow(SQR(x) + SQR(y), m_Cn);
helper.Out.x = r * cosa;
helper.Out.y = r * sina;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3379,7 +3380,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * cosa;\n"
<< "\t\tvOut.y = r * sina;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3445,7 +3446,7 @@ public:
T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_HalfInvPower);
helper.Out.x = r * cosa;
helper.Out.y = r * sina;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3467,7 +3468,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * cosa;\n"
<< "\t\tvOut.y = r * sina;\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3524,7 +3525,7 @@ public:
T r1 = m_Vp / (SQR(re) + SQR(im));
helper.Out.x = r1 * (helper.In.x * re + helper.In.y * im);
helper.Out.y = r1 * (helper.In.y * re - helper.In.x * im);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3549,7 +3550,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r1 * (vIn.x * re + vIn.y * im);\n"
<< "\t\tvOut.y = r1 * (vIn.y * re - vIn.x * im);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3616,7 +3617,7 @@ public:
T r1 = m_Vp / SQR(r);
helper.Out.x = r1 * (helper.In.x * re + helper.In.y * im);
helper.Out.y = r1 * (helper.In.y * re - helper.In.x * im);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3650,7 +3651,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r1 * (vIn.x * re + vIn.y * im);\n"
<< "\t\tvOut.y = r1 * (vIn.y * re - vIn.x * im);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3715,7 +3716,7 @@ public:
y = (m_IsOdd != 0) ? sina : (m_Vvar * std::atan2(cosa, sina));
helper.Out.x = x;
helper.Out.y = y;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3744,7 +3745,7 @@ public:
<< "\t\ty = (" << isOdd << " != 0) ? sina : (" << vvar << " * atan2(cosa, sina));\n"
<< "\t\tvOut.x = x;\n"
<< "\t\tvOut.y = y;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3872,7 +3873,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3968,7 +3969,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4007,7 +4008,7 @@ public:
T y = m_C1y + (SQR(m_C1r) * (helper.In.y - m_C1y)) / (SQR(helper.In.x - m_C1x) + SQR(helper.In.y - m_C1y));
helper.Out.x = m_C2x + (SQR(m_C2r) * (x - m_C2x)) / (SQR(x - m_C2x) + SQR(y - m_C2y));
helper.Out.y = m_C2y + (SQR(m_C2r) * (y - m_C2y)) / (SQR(x - m_C2x) + SQR(y - m_C2y));
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4032,7 +4033,7 @@ public:
<< "\n"
<< "\t\tvOut.x = " << c2x << " + (SQR(" << c2r << ") * (x - " << c2x << ")) / (SQR(x - " << c2x << ") + SQR(y - " << c2y << "));\n"
<< "\t\tvOut.y = " << c2y << " + (SQR(" << c2r << ") * (y - " << c2y << ")) / (SQR(x - " << c2x << ") + SQR(y - " << c2y << "));\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4363,7 +4364,7 @@ public:
T r3den = 1 / (br * br + bi * bi);
helper.Out.x = m_Weight * (tr * br + ti * bi) * r3den;
helper.Out.y = m_Weight * (ti * br - tr * bi) * r3den;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4396,7 +4397,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (tr * br + ti * bi) * r3den;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (ti * br - tr * bi) * r3den;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4466,7 +4467,7 @@ public:
//invert the multiplication with scale from before.
helper.Out.x = m_Weight * Lerp<T>(u1, u2, m_P) * m_Is;//Original did a direct assignment to outPoint, which is incompatible with Ember's design.
helper.Out.y = m_Weight * Lerp<T>(v1, v2, m_P) * m_Is;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4511,7 +4512,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * Lerp(u1, u2, " << p << ") * " << is << ";\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * Lerp(v1, v2, " << p << ") * " << is << ";\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4596,7 +4597,7 @@ public:
T y = (2 * (c1 - T(0.5)));
helper.Out.x = m_Vv * x;
helper.Out.y = m_Vv * y;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4620,7 +4621,7 @@ public:
<< "\n"
<< "\t\tvOut.x = " << vv << " * x;\n"
<< "\t\tvOut.y = " << vv << " * y;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4713,7 +4714,7 @@ public:
T ty = Lerp(helper.In.y, sy, m_Ay);
helper.Out.x = m_Weight * tx;
helper.Out.y = m_Weight * ty;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4741,7 +4742,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * tx;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * ty;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * tz;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4818,7 +4819,7 @@ public:
result /= divident;
helper.Out.x = m_Weight * helper.In.x + result;
helper.Out.y = m_Weight * helper.In.y + result;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4846,7 +4847,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x + result;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y + result;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4883,7 +4884,7 @@ public:
helper.Out.x = r * helper.In.x;
helper.Out.y = r * helper.In.y;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4898,7 +4899,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * vIn.x;\n"
<< "\t\tvOut.y = r * vIn.y;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4925,7 +4926,7 @@ public:
T c = std::cos(helper.In.x);
helper.Out.x = m_Vvar2 * r * s;
helper.Out.y = m_Vvar2 * r * c;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4942,7 +4943,7 @@ public:
<< "\n"
<< "\t\tvOut.x = " << vvar2 << " * r * s;\n"
<< "\t\tvOut.y = " << vvar2 << " * r * c;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4992,7 +4993,7 @@ public:
T dy = yn + T(0.5) * (m_ScaleY * sinx + std::abs(yn) * m_IncY * sinx);
helper.Out.x = m_Weight * dx;
helper.Out.y = m_Weight * dy;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -5024,7 +5025,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * dx;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * dy;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -5103,7 +5104,7 @@ public:
helper.Out.y = -m_Weight * y;
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -5139,7 +5140,7 @@ public:
<< "\t\t vOut.y = -xform->m_VariationWeights[" << varIndex << "] * y;\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -5277,7 +5278,7 @@ public:
{
helper.Out.x = m_Weight01 / SafeTan<T>(helper.In.x) * std::cos(helper.In.y);
helper.Out.y = m_Weight01 / std::sin(helper.In.x) * (-helper.In.y);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -5290,7 +5291,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = " << weight01 << " / tan(vIn.x) * cos(vIn.y);\n"
<< "\t\tvOut.y = " << weight01 << " / sin(vIn.x) * (-vIn.y);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -5331,7 +5332,7 @@ public:
T coshy1 = std::cosh(helper.In.y) + 1;
helper.Out.x = m_Weight * sinx * coshy1 * sinx2;
helper.Out.y = m_Weight * cosx * coshy1 * sinx2;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -5346,7 +5347,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sinx * coshy1 * sinx2;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cosx * coshy1 * sinx2;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -5377,7 +5378,7 @@ public:
T coshy1 = std::cosh(helper.In.y) + 1;
helper.Out.x = d * sinx * coshy1 * sinx2;
helper.Out.y = d * cosx * coshy1 * sinx2;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -5393,7 +5394,7 @@ public:
<< "\n"
<< "\t\tvOut.x = d * sinx * coshy1 * sinx2;\n"
<< "\t\tvOut.y = d * cosx * coshy1 * sinx2;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -5436,7 +5437,7 @@ public:
T temp = m_C * a + m_HalfD * lnr2 + m_Ang * rand.Rand();
helper.Out.x = r * std::cos(temp);
helper.Out.y = r * std::sin(temp);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -5474,7 +5475,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * cos(temp);\n"
<< "\t\tvOut.y = r * sin(temp);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -5535,7 +5536,7 @@ MAKEPREPOSTPARVARASSIGN(BlurSquare, blur_square, BLUR_SQUARE, eVariationAssignTy
MAKEPREPOSTVAR(Flatten, flatten, FLATTEN)
MAKEPREPOSTVARASSIGN(Zblur, zblur, ZBLUR, eVariationAssignType::ASSIGNTYPE_SUM)
MAKEPREPOSTVARASSIGN(Blur3D, blur3D, BLUR3D, eVariationAssignType::ASSIGNTYPE_SUM)
MAKEPREPOSTVARASSIGN(ZScale, zscale, ZSCALE, eVariationAssignType::ASSIGNTYPE_SUM)
MAKEPREPOSTVAR(ZScale, zscale, ZSCALE)
MAKEPREPOSTVARASSIGN(ZTranslate, ztranslate, ZTRANSLATE, eVariationAssignType::ASSIGNTYPE_SUM)
MAKEPREPOSTVAR(ZCone, zcone, ZCONE)
MAKEPREPOSTVAR(Spherical3D, Spherical3D, SPHERICAL3D)

View File

@ -23,7 +23,7 @@ public:
T temp = 1 / Zeps(cos(helper.In.y)) + m_Effect * T(M_PI);
helper.Out.x = m_Weight * (tanh(helper.In.x) * temp);
helper.Out.y = m_Weight * (tanh(helper.In.y) * temp);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -38,7 +38,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (tanh(vIn.x) * temp);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (tanh(vIn.y) * temp);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -111,7 +111,7 @@ public:
T ran = (helper.m_PrecalcAtanyx / Zeps(m_Denominator) + (m_Root * M_2PI * Floor<T>(rand.Frand01<T>() * m_Denominator) / Zeps(m_Denominator))) * m_Numerator;
helper.Out.x = r2 * std::cos(ran);
helper.Out.y = r2 * std::sin(ran);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -132,7 +132,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r2 * cos(ran);\n"
<< "\t\tvOut.y = r2 * sin(ran);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -188,7 +188,7 @@ public:
T u = std::sqrt(ClampGte0<T>(Zeps(m_A) * SQR(helper.In.x) + Zeps(m_B) * SQR(helper.In.y)));//Original did not clamp.
helper.Out.x = std::cos(u) * SafeTan<T>(helper.In.x) * m_Weight;
helper.Out.y = std::sin(u) * SafeTan<T>(helper.In.y) * m_Weight;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -204,7 +204,7 @@ public:
<< "\n"
<< "\t\tvOut.x = cos(u) * tan(vIn.x) * xform->m_VariationWeights[" << varIndex << "];\n"
<< "\t\tvOut.y = sin(u) * tan(vIn.y) * xform->m_VariationWeights[" << varIndex << "];\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -243,7 +243,7 @@ public:
{
helper.Out.x = m_Weight * (helper.In.x - ((SQR(helper.In.x) * helper.In.x) / 3)) + helper.In.x * SQR(helper.In.y);
helper.Out.y = m_Weight * (helper.In.y - ((SQR(helper.In.y) * helper.In.y) / 3)) + helper.In.y * SQR(helper.In.x);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -253,7 +253,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x - ((SQR(vIn.x) * vIn.x) / 3)) + vIn.x * SQR(vIn.y);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y - ((SQR(vIn.y) * vIn.y) / 3)) + vIn.y * SQR(vIn.x);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -282,7 +282,7 @@ public:
T cosa = std::cos(alpha);
helper.Out.x = m_Weight * cosa / r;
helper.Out.y = m_Weight * sina / r;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -302,7 +302,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cosa / r;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sina / r;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -352,7 +352,7 @@ public:
else
helper.Out.y = (m_Rotate * helper.In.y) * cos45 + helper.In.x * sin45 - m_Pull - m_LineUp;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -377,7 +377,7 @@ public:
<< "\t\telse\n"
<< "\t\t vOut.y = (" << rotate << " * vIn.y) * cos45 + vIn.x * sin45 - " << pull << " - " << lineUp << ";\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -456,7 +456,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -512,7 +512,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -624,7 +624,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -668,7 +668,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -783,7 +783,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -825,7 +825,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -936,7 +936,7 @@ public:
T temp = angle - T(M_PI_2);
helper.Out.x = m_Weight * z * std::cos(temp);
helper.Out.y = m_Weight * z * std::sin(temp);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -969,7 +969,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * z * cos(temp);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * z * sin(temp);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1021,7 +1021,7 @@ public:
T r = m_Weight * (m_Power == 1 ? std::acos(rand.Frand01<T>() * 2 - 1) / T(M_PI) : std::acos(std::exp(std::log(rand.Frand01<T>()) * m_Power) * 2 - 1) / T(M_PI));
helper.Out.x = r * c;
helper.Out.y = r * s;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1039,7 +1039,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * c;\n"
<< "\t\tvOut.y = r * s;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1073,7 +1073,7 @@ public:
T temp = rand.Frand01<T>() * M_2PI;
helper.Out.x = m_Weight * std::cos(temp) * rad;
helper.Out.y = m_Weight * std::sin(temp) * rad;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1086,7 +1086,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cos(temp) * rad;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(temp) * rad;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1190,7 +1190,7 @@ public:
helper.Out.y = m_Weight * helper.In.y;
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1233,7 +1233,7 @@ public:
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1611,7 +1611,7 @@ public:
{
helper.Out.x = SignNz<T>(helper.In.x) * std::pow(std::abs(helper.In.x), m_PowX) * m_Weight;
helper.Out.y = SignNz<T>(helper.In.y) * std::pow(std::abs(helper.In.y), m_PowY) * m_Weight;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1625,7 +1625,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = SignNz(vIn.x) * pow(fabs(vIn.x), " << powx << ") * xform->m_VariationWeights[" << varIndex << "];\n"
<< "\t\tvOut.y = SignNz(vIn.y) * pow(fabs(vIn.y), " << powy << ") * xform->m_VariationWeights[" << varIndex << "];\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1722,7 +1722,7 @@ public:
T r = m_Weight / Zeps(helper.m_PrecalcSumSquares);
helper.Out.x = helper.In.x * r * m_X;
helper.Out.y = helper.In.y * r * m_Y;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1738,7 +1738,7 @@ public:
<< "\n"
<< "\t\tvOut.x = vIn.x * r * " << x << ";\n"
<< "\t\tvOut.y = vIn.y * r * " << y << ";\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1846,7 +1846,7 @@ public:
T y1 = (m_A + m_B) * std::sin(t) - m_C2 * std::sin((m_A + m_B) / m_B * t);
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.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1872,7 +1872,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (x1 + " << d << " * cos(t) + y);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (y1 + " << d << " * sin(t) + y);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1925,7 +1925,7 @@ public:
T by = Cube(sinX * cosY);
helper.Out.x = m_Weight * cosX * bx;
helper.Out.y = m_Weight * cosX * by;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1942,7 +1942,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cosX * bx;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cosX * by;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1969,7 +1969,7 @@ public:
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);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1981,7 +1981,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (xform->m_VariationWeights[" << varIndex << "] / precalcSumSquares * vIn.x / e);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (xform->m_VariationWeights[" << varIndex << "] / precalcSumSquares * vIn.y / e);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2124,7 +2124,7 @@ public:
T c2 = Zeps(SQR(helper.In.y));
helper.Out.x = m_Weight * ((1 / d) * std::cos(c1) * std::sin(c2));
helper.Out.y = m_Weight * ((1 / d) * std::sin(c1) * std::sin(c2));
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2138,7 +2138,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (((real_t)(1.0) / d) * cos(c1) * sin(c2));\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (((real_t)(1.0) / d) * sin(c1) * sin(c2));\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2195,7 +2195,7 @@ public:
helper.Out.y = -(m_Weight * (8 * helper.m_PrecalcSqrtSumSquares - p));
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2236,7 +2236,7 @@ public:
<< "\t\t vOut.y = -(xform->m_VariationWeights[" << varIndex << "] * (8 * precalcSqrtSumSquares - p));\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2274,7 +2274,7 @@ public:
helper.Out.x = m_Weight * (std::sin(helper.In.x) * r + dx);
helper.Out.y = m_Weight * (std::sin(helper.In.y) * r + dy);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2305,7 +2305,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (sin(vIn.x) * r + dx);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (sin(vIn.y) * r + dy);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2362,7 +2362,7 @@ public:
T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn);
helper.Out.x = r * std::cos(temp);
helper.Out.y = r * std::sin(temp);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2386,7 +2386,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * cos(temp);\n"
<< "\t\tvOut.y = r * sin(temp);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2542,7 +2542,7 @@ public:
alpha = (std::atan2(y, x) + n * M_2PI) / Floor<T>(m_Power);
helper.Out.x = m_Weight * r * std::cos(alpha);
helper.Out.y = m_Weight * r * std::sin(alpha);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2585,7 +2585,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * r * cos(alpha);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * r * sin(alpha);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2689,7 +2689,7 @@ public:
//Add final values in to variations totals.
helper.Out.x = m_Weight * mx;
helper.Out.y = m_Weight * my;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2752,7 +2752,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * mx;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * my;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2817,7 +2817,7 @@ public:
T y1 = sin(m_B * t);
helper.Out.x = m_Weight * (x1 + m_C * t + m_E * y);
helper.Out.y = m_Weight * (y1 + m_C * t + m_E * y);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2841,7 +2841,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (x1 + " << c << " * t + " << e << " * y);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (y1 + " << c << " * t + " << e << " * y);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2960,7 +2960,7 @@ public:
helper.Out.x = helper.m_PrecalcSqrtSumSquares * std::cos(a);
helper.Out.y = helper.m_PrecalcSqrtSumSquares * std::sin(a);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2989,7 +2989,7 @@ public:
<< "\n"
<< "\t\tvOut.x = precalcSqrtSumSquares * cos(a);\n"
<< "\t\tvOut.y = precalcSqrtSumSquares * sin(a);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3142,7 +3142,7 @@ public:
helper.Out.x = r * std::cos(a);
helper.Out.y = r * std::sin(a);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3183,7 +3183,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * cos(a);\n"
<< "\t\tvOut.y = r * sin(a);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3244,7 +3244,7 @@ public:
T temp = std::cosh(tau) - std::cos(sigma);
helper.Out.x = m_Weight * std::sinh(tau) / temp;
helper.Out.y = m_Weight * std::sin(sigma) / temp;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3266,7 +3266,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sinh(tau) / temp;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(sigma) / temp;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3312,7 +3312,7 @@ public:
T temp = std::cosh(tau) - std::cos(sigma);
helper.Out.x = m_Weight * std::sinh(tau) / temp;
helper.Out.y = m_Weight * std::sin(sigma) / temp;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3333,7 +3333,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sinh(tau) / temp;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(sigma) / temp;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3385,7 +3385,7 @@ public:
T temp = std::cosh(tau) - std::cos(sigma);
helper.Out.x = m_Weight * std::sinh(tau) / temp;
helper.Out.y = m_Weight * std::sin(sigma) / temp;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3413,7 +3413,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sinh(tau) / temp;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(sigma) / temp;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3469,7 +3469,7 @@ public:
T temp = std::cosh(tau) - std::cos(sigma);
helper.Out.x = m_Weight * sinh(tau) / temp;
helper.Out.y = m_Weight * sin(sigma) / temp;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3498,7 +3498,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sinh(tau) / temp;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(sigma) / temp;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3582,7 +3582,7 @@ public:
helper.Out.y = m_Weight * helper.In.y;
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3621,7 +3621,7 @@ public:
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3661,7 +3661,7 @@ public:
else
helper.Out.y = -(m_Weight * helper.In.y);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3679,7 +3679,7 @@ public:
<< "\t\telse\n"
<< "\t\t vOut.y = -(xform->m_VariationWeights[" << varIndex << "] * vIn.y);\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3721,7 +3721,7 @@ public:
else
helper.Out.y = m_Weight * helper.In.y;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3736,7 +3736,7 @@ public:
<< "\t\telse\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3791,7 +3791,7 @@ public:
helper.Out.x = m_Weight * xmax * std::cos(nu);
helper.Out.y = m_Weight * std::sqrt(xmax - 1) * std::sqrt(xmax + 1) * sin(nu);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3840,7 +3840,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * xmax * cos(nu);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sqrt(xmax - 1) * sqrt(xmax + 1) * sin(nu);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3922,7 +3922,7 @@ public:
mu /= m_Power;
helper.Out.x = m_Weight * std::cosh(mu) * std::cos(nu);
helper.Out.y = m_Weight * std::sinh(mu) * std::sin(nu);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3964,7 +3964,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cosh(mu) * cos(nu);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4032,7 +4032,7 @@ public:
helper.Out.x = m_Weight * std::cosh(mu) * std::cos(nu);
helper.Out.y = m_Weight * std::sinh(mu) * std::sin(nu);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4067,7 +4067,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cosh(mu) * cos(nu);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4131,7 +4131,7 @@ public:
nu += m_Rotate;
helper.Out.x = m_Weight * std::cosh(mu) * std::cos(nu);
helper.Out.y = m_Weight * std::sinh(mu) * std::sin(nu);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4171,7 +4171,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cosh(mu) * cos(nu);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4226,7 +4226,7 @@ public:
mu += m_Push;
helper.Out.x = m_Weight * std::cosh(mu) * std::cos(nu);
helper.Out.y = m_Weight * std::sinh(mu) * std::sin(nu);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4258,7 +4258,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cosh(mu) * cos(nu);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4315,7 +4315,7 @@ public:
nu = fmod(nu + m_Rotate + T(M_PI), M_2PI) - T(M_PI);
helper.Out.x = m_Weight * xmax * std::cos(nu);
helper.Out.y = m_Weight * std::sqrt(xmax - 1) * std::sqrt(xmax + 1) * std::sin(nu);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4333,7 +4333,7 @@ public:
<< "\t\tif (xmax < 1)\n"
<< "\t\t xmax = 1;\n"
<< "\n"
<< "\t\treal_t nu = acos(clamp(vIn.x / xmax, -(real_t)(1.0), (real_t)(1.0)));\n"
<< "\t\treal_t nu = acos(clamp(vIn.x / xmax, (real_t)(-1.0), (real_t)(1.0)));\n"
<< "\n"
<< "\t\tif (vIn.y < 0)\n"
<< "\t\t nu *= -1;\n"
@ -4342,7 +4342,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * xmax * cos(nu);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sqrt(xmax - 1) * sqrt(xmax + 1) * sin(nu);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4401,7 +4401,7 @@ public:
helper.Out.x = m_Weight * std::cosh(mu) * std::cos(nu);
helper.Out.y = m_Weight * std::sinh(mu) * std::sin(nu);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4437,7 +4437,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cosh(mu) * cos(nu);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}

View File

@ -33,7 +33,7 @@ public:
nu = nu + mu * m_Out + m_In / mu;
helper.Out.x = m_Weight * std::cosh(mu) * std::cos(nu);
helper.Out.y = m_Weight * std::sinh(mu) * std::sin(nu);
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -62,7 +62,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cosh(mu) * cos(nu);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -204,7 +204,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -321,7 +321,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -420,7 +420,7 @@ public:
helper.Out.y = (m_Weight * (8 * s - p));
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -484,7 +484,7 @@ public:
<< "\t\t vOut.y = -(xform->m_VariationWeights[" << varIndex << "] * (8 * s - p));\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -533,7 +533,7 @@ public:
helper.Out.x = m_Weight * r * helper.m_PrecalcCosa;
helper.Out.y = m_Weight * r * helper.m_PrecalcSina;
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -554,7 +554,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * r * precalcCosa;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * r * precalcSina;\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -594,7 +594,7 @@ public:
T d = Zeps(helper.m_PrecalcSumSquares);
helper.Out.x = (m_Weight / d) * (tanh(d) * (2 * helper.In.x));
helper.Out.y = (m_Weight / d) * (cos(d) * (2 * helper.In.y));
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -606,7 +606,7 @@ public:
<< "\n"
<< "\t\tvOut.x = (xform->m_VariationWeights[" << varIndex << "] / d) * (tanh(d) * ((real_t)(2.0) * vIn.x));\n"
<< "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] / d) * (cos(d) * ((real_t)(2.0) * vIn.y));\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -633,7 +633,7 @@ public:
T d = Zeps(helper.m_PrecalcSumSquares);
helper.Out.x = (m_Weight / 2) * (tanh(d) * (2 * helper.In.x));
helper.Out.y = (m_Weight / 2) * (cos(d) * (2 * helper.In.y));
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -645,7 +645,7 @@ public:
<< "\n"
<< "\t\tvOut.x = (xform->m_VariationWeights[" << varIndex << "] / (real_t)(2.0)) * (tanh(d) * ((real_t)(2.0) * vIn.x));\n"
<< "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] / (real_t)(2.0)) * (cos(d) * ((real_t)(2.0) * vIn.y));\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1134,7 +1134,7 @@ public:
r *= m_S2;
helper.Out.x = m_Weight * (helper.In.x + (rand.Frand01<T>() - T(0.5)) * r);
helper.Out.y = m_Weight * (helper.In.y + (rand.Frand01<T>() - T(0.5)) * r);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1158,7 +1158,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + (MwcNext01(mwc) - (real_t)(0.5)) * r);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + (MwcNext01(mwc) - (real_t)(0.5)) * r);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1209,7 +1209,10 @@ public:
T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn * m_A);
helper.Out.x = r * std::cos(a) + m_B;
helper.Out.y = r * std::sin(a) + m_B;
helper.Out.z = m_Weight * helper.In.z;//Original did not multiply by weight. Do it here to be consistent with others.
helper.Out.z = helper.In.z;
if (m_VarType == eVariationType::VARTYPE_REG)
outPoint.m_Z = 0;
}
virtual string OpenCLString() const override
@ -1232,8 +1235,13 @@ public:
<< "\n"
<< "\t\tvOut.x = r * cos(a) + " << b << ";\n"
<< "\t\tvOut.y = r * sin(a) + " << b << ";\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t}\n";
<< "\t\tvOut.z = vIn.z;\n";
if (m_VarType == eVariationType::VARTYPE_REG)
ss << "\t\toutPoint->m_Z = 0;\n";
ss
<< "\t}\n";
return ss.str();
}
@ -1292,7 +1300,7 @@ public:
T v = (sqX + sqY) * m_W;//Do not use precalcSumSquares here because its components are needed below.
helper.Out.x = m_Weight * std::sin(helper.In.x) * (sqX + m_W - v);
helper.Out.y = m_Weight * std::sin(helper.In.y) * (sqY + m_W - v);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1309,7 +1317,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) * (sqX + " << w << " - v);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.y) * (sqY + " << w << " - v);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1378,7 +1386,7 @@ public:
helper.Out.x = m_Weight * (m_K * (helper.In.x - x0) + x0);
helper.Out.y = m_Weight * (m_K * (helper.In.y - y0) + y0);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1429,7 +1437,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (" << m_k << " * (vIn.x - x0) + x0);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (" << m_k << " * (vIn.y - y0) + y0);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1527,7 +1535,7 @@ public:
helper.Out.x = m_CosR * a + m_SinR * r;
helper.Out.y = -m_SinR * a + m_CosR * r;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1571,7 +1579,7 @@ public:
<< "\n"
<< "\t\tvOut.x = " << cosr << " * a + " << sinr << " * r;\n"
<< "\t\tvOut.y = -" << sinr << " * a + " << cosr << " * r;\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2240,7 +2248,7 @@ public:
helper.Out.y = m_Weight * helper.In.y;
}
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2307,7 +2315,7 @@ public:
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2963,7 +2971,7 @@ public:
helper.Out.x = m_Weight * (fp1x + fp2x);
helper.Out.y = m_Weight * (fp1y + fp2y);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3030,7 +3038,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (fp1x + fp2x);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (fp1y + fp2y);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3852,7 +3860,7 @@ public:
{
helper.Out.x = m_Weight / Zeps(helper.m_PrecalcSqrtSumSquares);
helper.Out.y = helper.m_PrecalcAtanyx;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3862,7 +3870,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSqrtSumSquares);\n"
<< "\t\tvOut.y = precalcAtanyx;\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -3896,7 +3904,7 @@ public:
(m_Q04 * xy + m_Q05 * helper.In.y + m_Q06 * sqy);
helper.Out.y = (m_Q07 + m_Q08 * helper.In.x + m_Q09 * sqx) +
(m_Q10 * xy + m_Weight * m_Q11 * helper.In.y + m_Q12 * sqy);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3926,7 +3934,7 @@ public:
<< "\t\t (" << q04 << " * xy + " << q05 << " * vIn.y + " << q06 << " * sqy);\n"
<< "\t\tvOut.y = (" << q07 << " + " << q08 << " * vIn.x + " << q09 << " * sqx) + \n"
<< "\t\t (" << q10 << " * xy + xform->m_VariationWeights[" << varIndex << "] * " << q11 << " * vIn.y + " << q12 << " * sqy);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4002,7 +4010,7 @@ public:
helper.Out.x = xx * m_Weight;
helper.Out.y = yy * m_Weight;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4035,7 +4043,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xx * xform->m_VariationWeights[" << varIndex << "];\n"
<< "\t\tvOut.y = yy * xform->m_VariationWeights[" << varIndex << "];\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4192,7 +4200,7 @@ public:
helper.Out.y += m_Size * (y + Floor<T>(helper.In.y));
}
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4329,7 +4337,7 @@ public:
<< "\t\t vOut.y += " << size << " * (y + floor(vIn.y));\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4732,7 +4740,7 @@ public:
}
}
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4789,7 +4797,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -4844,7 +4852,7 @@ public:
T mod2 = std::exp(lnmod * m_ReInv - arg * m_Im100);
helper.Out.x = m_Weight * mod2 * std::cos(temp);
helper.Out.y = m_Weight * mod2 * std::sin(temp);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -4866,7 +4874,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * mod2 * cos(temp);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * mod2 * sin(temp);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -5036,7 +5044,7 @@ public:
a = helper.In.y / Zeps(ymax);
b = SafeSqrt(1 - SQR(a));
helper.Out.y = m_Vy * atan2(a, b) * r;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -5068,7 +5076,7 @@ public:
<< "\t\tb = SafeSqrt(1 - SQR(a));\n"
<< "\n"
<< "\t\tvOut.y = " << vy << " * atan2(a, b) * r;\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}

View File

@ -133,7 +133,7 @@ public:
helper.Out.x = m_Weight * (x + (m * 2 + 1) * m_Sc);
helper.Out.y = m_Weight * (y + (n * 2 + 1) * m_Sc);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -195,7 +195,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (x + (m * 2 + 1) * " << sc << ");\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (y + (n * 2 + 1) * " << sc << ");\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -292,7 +292,7 @@ public:
helper.Out.x = m_Weight * (x + (m * 2 + 1) * m_Sc);
helper.Out.y = m_Weight * (y + (n * 2 + 1) * m_Sc);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -327,7 +327,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (x + (m * 2 + 1) * " << sc << ");\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (y + (n * 2 + 1) * " << sc << ");\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -418,7 +418,7 @@ public:
helper.Out.x = m_Weight * ux;
helper.Out.y = m_Weight * uy;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -456,7 +456,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * ux;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * uy;\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1086,7 +1086,7 @@ public:
T sucv = su * cv;
T x = std::pow(std::abs(cucv), m_XPow) + (cucv * m_XPow) + (T(0.25) * atOmegaX);//Must fabs first argument to pow, because negative values will return NaN.
T y = std::pow(std::abs(sucv), m_YPow) + (sucv * m_YPow) + (T(0.25) * atOmegaY);//Original did not do this and would frequently return bad values.
T z = std::pow(std::abs(sv), m_ZPow) + sv * m_ZPow;
T z = std::pow(std::abs(sv), m_ZPow) + sv * m_ZPow;
helper.Out.x = m_Weight * x;
helper.Out.y = m_Weight * y;
helper.Out.z = m_Weight * z;
@ -1356,7 +1356,7 @@ public:
helper.Out.y = m_Weight * helper.In.y;
}
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1417,7 +1417,7 @@ public:
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1498,7 +1498,7 @@ public:
helper.Out.y = m_Weight * helper.In.y;
}
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1529,7 +1529,7 @@ public:
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1655,7 +1655,7 @@ public:
helper.Out.y = helper.In.y * r * m_Y;
helper.Out.x += (1 - (m_Twist * SQR(helper.In.x)) + helper.In.y) * m_Weight;//The += is intentional.
helper.Out.y += m_Tilt * helper.In.x * m_Weight;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -1676,7 +1676,7 @@ public:
<< "\t\tvOut.y = vIn.y * r * " << y << ";\n"
<< "\t\tvOut.x += (1 - (" << twist << " * SQR(vIn.x)) + vIn.y) * xform->m_VariationWeights[" << varIndex << "];\n"
<< "\t\tvOut.y += " << tilt << " * vIn.x * xform->m_VariationWeights[" << varIndex << "];\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -1702,8 +1702,8 @@ private:
/// <summary>
/// waves2_3D.
/// Original used a precalc for the input points, but it doesn't
/// work with Ember's design, so it gets calculated on every iter
/// which is slightly slower.
/// work with Ember's design (and is also likely wrong), so it gets calculated on every iter
/// which is slightly slower, but more correct.
/// </summary>
template <typename T>
class EMBER_API Waves23DVariation : public ParametricVariation<T>
@ -2130,8 +2130,8 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T b = m_Weight / (helper.m_PrecalcSumSquares * T(0.25) + 1);
T roundX = Rint(helper.In.x);
T roundY = Rint(helper.In.y);
T roundX = std::rint(helper.In.x);
T roundY = std::rint(helper.In.y);
T offsetX = helper.In.x - roundX;
T offsetY = helper.In.y - roundY;
helper.Out.x = helper.In.x * b;
@ -2174,7 +2174,7 @@ public:
helper.Out.x += helper.In.x * m_Px;
helper.Out.y += helper.In.y * m_Py;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2234,7 +2234,7 @@ public:
<< "\n"
<< "\t\tvOut.x += vIn.x * " << px << ";\n"
<< "\t\tvOut.y += vIn.y * " << py << ";\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2278,7 +2278,7 @@ public:
helper.Out.x = m_Weight * r * std::cos(a);
helper.Out.y = m_Weight * r * std::sin(a);
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -2294,7 +2294,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * r * cos(a);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * r * sin(a);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2941,7 +2941,7 @@ public:
InverseTrilinear(alpha, beta, x, y, rand);
helper.Out.x = m_Weight * x;
helper.Out.y = m_Weight * y;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@ -3062,7 +3062,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * x;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * y;\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}

File diff suppressed because it is too large Load Diff

968
Source/Ember/Variations07.h Normal file
View File

@ -0,0 +1,968 @@
#pragma once
#include "Variation.h"
namespace EmberNs
{
/// <summary>
/// splits3D.
/// </summary>
template <typename T>
class EMBER_API Splits3DVariation : public ParametricVariation<T>
{
public:
Splits3DVariation(T weight = 1.0) : ParametricVariation<T>("splits3D", eVariationId::VAR_SPLITS3D, weight)
{
Init();
}
PARVARCOPY(Splits3DVariation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
if (helper.In.x >= 0)
helper.Out.x = m_Weight * (helper.In.x + m_X);
else
helper.Out.x = m_Weight * (helper.In.x - m_X);
if (helper.In.y >= 0)
helper.Out.y = m_Weight * (helper.In.y + m_Y);
else
helper.Out.y = m_Weight * (helper.In.y - m_Y);
if (helper.In.z >= 0)
helper.Out.z = m_Weight * (helper.In.z + m_Z);
else
helper.Out.z = m_Weight * (helper.In.z - m_Z);
}
virtual string OpenCLString() const override
{
ostringstream ss, ss2;
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "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;
ss << "\t{\n"
<< "\t\tif (vIn.x >= 0)\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + " << x << ");\n"
<< "\t\telse\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x - " << x << ");\n"
<< "\n"
<< "\t\tif (vIn.y >= 0)\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + " << y << ");\n"
<< "\t\telse\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y - " << y << ");\n"
<< "\n"
<< "\t\tif (vIn.z >= 0)\n"
<< "\t\t vOut.z = xform->m_VariationWeights[" << varIndex << "] * (vIn.z + " << z << ");\n"
<< "\t\telse\n"
<< "\t\t vOut.z = xform->m_VariationWeights[" << varIndex << "] * (vIn.z - " << z << ");\n"
<< "\t}\n";
return ss.str();
}
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
m_X = rand.Frand11<T>();
m_Y = rand.Frand11<T>();
m_Z = rand.Frand11<T>();
}
protected:
void Init()
{
string prefix = Prefix();
m_Params.clear();
m_Params.push_back(ParamWithName<T>(&m_X, prefix + "splits3D_x"));
m_Params.push_back(ParamWithName<T>(&m_Y, prefix + "splits3D_y"));
m_Params.push_back(ParamWithName<T>(&m_Z, prefix + "splits3D_z"));
}
private:
T m_X;
T m_Y;
T m_Z;
};
/// <summary>
/// waves2b.
/// Note that _j1() is not implemented in OpenCL, so that conditional is skipped
/// when running on the GPU. The results might look different.
/// </summary>
template <typename T>
class EMBER_API Waves2BVariation : public ParametricVariation<T>
{
public:
Waves2BVariation(T weight = 1.0) : ParametricVariation<T>("waves2b", eVariationId::VAR_WAVES2B, weight)
{
Init();
}
PARVARCOPY(Waves2BVariation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T CsX = 1;
T CsY = 1;
T jcbSn = 0, jcbCn, jcbDn;
CsX = SafeDivInv(m_Unity, (m_Unity + Sqr(helper.In.x)));
CsX = CsX * m_Six + m_Scaleinfx;
CsY = SafeDivInv(m_Unity, (m_Unity + Sqr(helper.In.y)));
CsY = CsY * m_Siy + m_Scaleinfy;
if (m_Pwx >= 0 && m_Pwx < 1e-4)
{
m_VarFuncs->JacobiElliptic(helper.In.y * m_Freqx, m_Jacok, jcbSn, jcbCn, jcbDn);
helper.Out.x = m_Weight * (helper.In.x + CsX * jcbSn);
}
else if (m_Pwx < 0 && m_Pwx > -1e-4)
#ifdef _WIN32
helper.Out.x = m_Weight * (helper.In.x + CsX * T(_j1(helper.In.y * m_Freqx)));//This is not implemented in OpenCL.
#else
helper.Out.x = m_Weight * (helper.In.x + CsX * T(j1(helper.In.y * m_Freqx)));//This is not implemented in OpenCL.
#endif
else
helper.Out.x = m_Weight * (helper.In.x + CsX * std::sin(SignNz(helper.In.y) * std::pow(Zeps(std::abs(helper.In.y)), m_Pwx) * m_Freqx));
if (m_Pwy >= 0 && m_Pwy < 1e-4)
{
m_VarFuncs->JacobiElliptic(helper.In.x * m_Freqy, m_Jacok, jcbSn, jcbCn, jcbDn);
helper.Out.y = m_Weight * (helper.In.y + CsY * jcbSn);
}
else if (m_Pwy < 0 && m_Pwy > -1e-4)
#ifdef _WIN32
helper.Out.y = m_Weight * (helper.In.y + CsY * T(_j1(helper.In.x * m_Freqy)));
#else
helper.Out.y = m_Weight * (helper.In.y + CsY * T(j1(helper.In.x * m_Freqy)));
#endif
else
helper.Out.y = m_Weight * (helper.In.y + CsY * std::sin(SignNz(helper.In.x) * std::pow(Zeps(std::abs(helper.In.x)), m_Pwy) * m_Freqy));
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 freqx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string freqy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string pwx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string pwy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string scalex = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string scaleinfx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string scaley = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string scaleinfy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string unity = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string jacok = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string six = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc.
string siy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t CsX = 1;\n"
<< "\t\treal_t CsY = 1;\n"
<< "\t\treal_t jcbSn = 0, jcbCn, jcbDn;\n"
<< "\t\tCsX = SafeDivInv(" << unity << ", (" << unity << " + Sqr(vIn.x)));\n"
<< "\t\tCsX = CsX * " << six << " + " << scaleinfx << ";\n"
<< "\t\tCsY = SafeDivInv(" << unity << ", (" << unity << " + Sqr(vIn.y)));\n"
<< "\t\tCsY = CsY * " << siy << " + " << scaleinfy << ";\n"
<< "\n"
<< "\t\tif (" << pwx << " >= 0 && " << pwx << " < 1e-4)\n"
<< "\t\t{\n"
<< "\t\t JacobiElliptic(vIn.y * " << freqx << ", " << jacok << ", &jcbSn, &jcbCn, &jcbDn);\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + CsX * jcbSn);\n"
<< "\t\t}\n"
//<< "\t\telse if (" << pwx << " < 0 && " << pwx << " > -1e-4)\n"
//<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + CsX * _j1(vIn.y * " << freqx << "));\n"//This is not implemented in OpenCL.
<< "\t\telse\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + CsX * sin(SignNz(vIn.y) * pow(Zeps(fabs(vIn.y)), " << pwx << ") * " << freqx << "));\n"
<< "\n"
<< "\t\tif (" << pwy << " >= 0 && " << pwy << " < 1e-4)\n"
<< "\t\t{\n"
<< "\t\t JacobiElliptic(vIn.x * " << freqy << ", " << jacok << ", &jcbSn, &jcbCn, &jcbDn);\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + CsY * jcbSn);\n"
<< "\t\t}\n"
//<< "\t\telse if (" << pwy << " < 0 && " << pwy << " > -1e-4)\n"
//<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + CsY * _j1(vIn.x * " << freqy << "));\n"//This is not implemented in OpenCL.
<< "\t\telse\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + CsY * sin(SignNz(vIn.x) * pow(Zeps(fabs(vIn.x)), " << pwy << ") * " << freqy << "));\n"
<< "\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
virtual vector<string> OpenCLGlobalFuncNames() const override
{
return vector<string> { "Zeps", "Sqr", "SignNz", "SafeDivInv", "JacobiElliptic" };
}
virtual void Precalc() override
{
m_Six = m_Scalex - m_Scaleinfx;
m_Siy = m_Scaley - m_Scaleinfy;
}
protected:
void Init()
{
string prefix = Prefix();
m_VarFuncs = VarFuncs<T>::Instance();
m_Params.clear();
m_Params.push_back(ParamWithName<T>(&m_Freqx, prefix + "waves2b_freqx", 2));
m_Params.push_back(ParamWithName<T>(&m_Freqy, prefix + "waves2b_freqy", 2));
m_Params.push_back(ParamWithName<T>(&m_Pwx, prefix + "waves2b_pwx", 1, eParamType::REAL, -10, 10));
m_Params.push_back(ParamWithName<T>(&m_Pwy, prefix + "waves2b_pwy", 1, eParamType::REAL, -10, 10));
m_Params.push_back(ParamWithName<T>(&m_Scalex, prefix + "waves2b_scalex", 1));
m_Params.push_back(ParamWithName<T>(&m_Scaleinfx, prefix + "waves2b_scaleinfx", 1));
m_Params.push_back(ParamWithName<T>(&m_Scaley, prefix + "waves2b_scaley", 1));
m_Params.push_back(ParamWithName<T>(&m_Scaleinfy, prefix + "waves2b_scaleinfy", 1));
m_Params.push_back(ParamWithName<T>(&m_Unity, prefix + "waves2b_unity", 1));
m_Params.push_back(ParamWithName<T>(&m_Jacok, prefix + "waves2b_jacok", T(0.25), eParamType::REAL, -1, 1));
m_Params.push_back(ParamWithName<T>(true, &m_Six, prefix + "waves2b_six"));//Precalc.
m_Params.push_back(ParamWithName<T>(true, &m_Siy, prefix + "waves2b_siy"));
}
private:
T m_Freqx;
T m_Freqy;
T m_Pwx;
T m_Pwy;
T m_Scalex;
T m_Scaleinfx;
T m_Scaley;
T m_Scaleinfy;
T m_Unity;
T m_Jacok;
T m_Six;//Precalc.
T m_Siy;
shared_ptr<VarFuncs<T>> m_VarFuncs;
};
/// <summary>
/// jac_cn.
/// </summary>
template <typename T>
class EMBER_API JacCnVariation : public ParametricVariation<T>
{
public:
JacCnVariation(T weight = 1.0) : ParametricVariation<T>("jac_cn", eVariationId::VAR_JAC_CN, weight)
{
Init();
}
PARVARCOPY(JacCnVariation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T snx, cnx, dnx;
T sny, cny, dny;
T numX, numY, denom;
m_VarFuncs->JacobiElliptic(helper.In.x, m_K, snx, cnx, dnx);
m_VarFuncs->JacobiElliptic(helper.In.y, 1 - m_K, sny, cny, dny);
numX = cnx * cny;
numY = -dnx * snx * dny * sny;
denom = SQR(snx) * SQR(sny) * m_K + SQR(cny);
denom = m_Weight / Zeps(denom);
helper.Out.x = denom * numX;
helper.Out.y = denom * numY;
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 k = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t snx, cnx, dnx;\n"
<< "\t\treal_t sny, cny, dny;\n"
<< "\t\treal_t numX, numY, denom;\n"
<< "\t\tJacobiElliptic(vIn.x, " << k << ", &snx, &cnx, &dnx);\n"
<< "\t\tJacobiElliptic(vIn.y, 1 - " << k << ", &sny, &cny, &dny);\n"
<< "\t\tnumX = cnx * cny;\n"
<< "\t\tnumY = -dnx * snx * dny * sny;\n"
<< "\t\tdenom = SQR(snx) * SQR(sny) * " << k << " + SQR(cny);\n"
<< "\t\tdenom = xform->m_VariationWeights[" << varIndex << "] / Zeps(denom);\n"
<< "\t\tvOut.x = denom * numX;\n"
<< "\t\tvOut.y = denom * numY;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
virtual vector<string> OpenCLGlobalFuncNames() const override
{
return vector<string> { "Zeps", "JacobiElliptic" };
}
protected:
void Init()
{
string prefix = Prefix();
m_VarFuncs = VarFuncs<T>::Instance();
m_Params.clear();
m_Params.push_back(ParamWithName<T>(&m_K, prefix + "jac_cn_k", T(0.5), eParamType::REAL, -1, 1));
}
private:
T m_K;
shared_ptr<VarFuncs<T>> m_VarFuncs;
};
/// <summary>
/// jac_dn.
/// </summary>
template <typename T>
class EMBER_API JacDnVariation : public ParametricVariation<T>
{
public:
JacDnVariation(T weight = 1.0) : ParametricVariation<T>("jac_dn", eVariationId::VAR_JAC_DN, weight)
{
Init();
}
PARVARCOPY(JacDnVariation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T snx, cnx, dnx;
T sny, cny, dny;
T numX, numY, denom;
m_VarFuncs->JacobiElliptic(helper.In.x, m_K, snx, cnx, dnx);
m_VarFuncs->JacobiElliptic(helper.In.y, 1 - m_K, sny, cny, dny);
numX = dnx * cny * dny;
numY = -cnx * snx * sny * m_K;
denom = SQR(snx) * SQR(sny) * m_K + SQR(cny);
denom = m_Weight / Zeps(denom);
helper.Out.x = denom * numX;
helper.Out.y = denom * numY;
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 k = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t snx, cnx, dnx;\n"
<< "\t\treal_t sny, cny, dny;\n"
<< "\t\treal_t numX, numY, denom;\n"
<< "\t\tJacobiElliptic(vIn.x, " << k << ", &snx, &cnx, &dnx);\n"
<< "\t\tJacobiElliptic(vIn.y, 1 - " << k << ", &sny, &cny, &dny);\n"
<< "\t\tnumX = dnx * cny * dny;\n"
<< "\t\tnumY = -cnx * snx * sny * " << k << ";\n"
<< "\t\tdenom = SQR(snx) * SQR(sny) * " << k << " + SQR(cny);\n"
<< "\t\tdenom = xform->m_VariationWeights[" << varIndex << "] / Zeps(denom);\n"
<< "\t\tvOut.x = denom * numX;\n"
<< "\t\tvOut.y = denom * numY;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
virtual vector<string> OpenCLGlobalFuncNames() const override
{
return vector<string> { "Zeps", "JacobiElliptic" };
}
protected:
void Init()
{
string prefix = Prefix();
m_VarFuncs = VarFuncs<T>::Instance();
m_Params.clear();
m_Params.push_back(ParamWithName<T>(&m_K, prefix + "jac_dn_k", T(0.5), eParamType::REAL, -1, 1));
}
private:
T m_K;
shared_ptr<VarFuncs<T>> m_VarFuncs;
};
/// <summary>
/// jac_sn.
/// </summary>
template <typename T>
class EMBER_API JacSnVariation : public ParametricVariation<T>
{
public:
JacSnVariation(T weight = 1.0) : ParametricVariation<T>("jac_sn", eVariationId::VAR_JAC_SN, weight)
{
Init();
}
PARVARCOPY(JacSnVariation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T snx, cnx, dnx;
T sny, cny, dny;
T numX, numY, denom;
m_VarFuncs->JacobiElliptic(helper.In.x, m_K, snx, cnx, dnx);
m_VarFuncs->JacobiElliptic(helper.In.y, 1 - m_K, sny, cny, dny);
numX = snx * dny;
numY = cnx * dnx * cny * sny;
denom = SQR(snx) * SQR(sny) * m_K + SQR(cny);
denom = m_Weight / Zeps(denom);
helper.Out.x = denom * numX;
helper.Out.y = denom * numY;
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 k = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t snx, cnx, dnx;\n"
<< "\t\treal_t sny, cny, dny;\n"
<< "\t\treal_t numX, numY, denom;\n"
<< "\t\tJacobiElliptic(vIn.x, " << k << ", &snx, &cnx, &dnx);\n"
<< "\t\tJacobiElliptic(vIn.y, 1 - " << k << ", &sny, &cny, &dny);\n"
<< "\t\tnumX = snx * dny;\n"
<< "\t\tnumY = cnx * dnx * cny * sny;\n"
<< "\t\tdenom = SQR(snx) * SQR(sny) * " << k << " + SQR(cny);\n"
<< "\t\tdenom = xform->m_VariationWeights[" << varIndex << "] / Zeps(denom);\n"
<< "\t\tvOut.x = denom * numX;\n"
<< "\t\tvOut.y = denom * numY;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
virtual vector<string> OpenCLGlobalFuncNames() const override
{
return vector<string> { "Zeps", "JacobiElliptic" };
}
protected:
void Init()
{
string prefix = Prefix();
m_VarFuncs = VarFuncs<T>::Instance();
m_Params.clear();
m_Params.push_back(ParamWithName<T>(&m_K, prefix + "jac_sn_k", T(0.5), eParamType::REAL, -1, 1));
}
private:
T m_K;
shared_ptr<VarFuncs<T>> m_VarFuncs;
};
/// <summary>
/// pressure_wave.
/// </summary>
template <typename T>
class EMBER_API PressureWaveVariation : public ParametricVariation<T>
{
public:
PressureWaveVariation(T weight = 1.0) : ParametricVariation<T>("pressure_wave", eVariationId::VAR_PRESSURE_WAVE, weight)
{
Init();
}
PARVARCOPY(PressureWaveVariation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
helper.Out.x = m_Weight * (helper.In.x + (1 / Zeps(m_X * M_2PI)) * std::sin(m_X * M_2PI * helper.In.x));
helper.Out.y = m_Weight * (helper.In.y + (1 / Zeps(m_Y * M_2PI)) * std::sin(m_Y * M_2PI * helper.In.y));
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 x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + (1 / Zeps(" << x << " * M_2PI)) * sin(" << x << " * M_2PI * vIn.x));\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + (1 / Zeps(" << y << " * M_2PI)) * sin(" << y << " * M_2PI * vIn.y));\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
virtual vector<string> OpenCLGlobalFuncNames() const override
{
return vector<string> { "Zeps" };
}
protected:
void Init()
{
string prefix = Prefix();
m_Params.clear();
m_Params.push_back(ParamWithName<T>(&m_X, prefix + "pressure_wave_x_freq", 1));
m_Params.push_back(ParamWithName<T>(&m_Y, prefix + "pressure_wave_y_freq", 1));
}
private:
T m_X;
T m_Y;
};
/// <summary>
/// gamma.
/// </summary>
template <typename T>
class EMBER_API GammaVariation : public Variation<T>
{
public:
GammaVariation(T weight = 1.0) : Variation<T>("gamma", eVariationId::VAR_GAMMA, weight, true, true, false, false, true)
{
}
VARCOPY(GammaVariation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
helper.Out.x = m_Weight * std::lgamma(helper.m_PrecalcSqrtSumSquares);
helper.Out.y = m_Weight * helper.m_PrecalcAtanyx;
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();
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * lgamma(precalcSqrtSumSquares);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * precalcAtanyx;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
};
/// <summary>
/// prose3D.
/// </summary>
template <typename T>
class EMBER_API PRose3DVariation : public ParametricVariation<T>
{
public:
PRose3DVariation(T weight = 1.0) : ParametricVariation<T>("pRose3D", eVariationId::VAR_PROSE3D, weight, true, true, false, false, true)
{
Init();
}
PARVARCOPY(PRose3DVariation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
int posNeg = 1;
T th = 0;
T sth, cth, pang, wig, wag, wag2, wag3, wag12, waggle;
T rad = helper.m_PrecalcSqrtSumSquares;
T curve1 = rad / m_L;
T curve2 = Sqr(curve1);
T curve3 = (rad - m_L * T(0.5)) / m_L;
T curve4 = Sqr(curve2);
th = helper.m_PrecalcAtanyx;
sincos(th, &sth, &cth);
if (rand.Frand01<T>() < T(0.5))
posNeg = -1;
pang = th / Zeps(m_Cycle);
wig = pang * m_Freq * T(0.5) + m_Offset * m_Cycle;
if (m_OptDir < 0)
{
wag = std::sin(curve1 * T(M_PI) * m_AbsOptSc) + m_Wagsc * T(0.4) * rad + m_Crvsc * T(0.5) * (std::sin(curve2 * T(M_PI)));
wag3 = std::sin(curve4 * T(M_PI) * m_AbsOptSc) + m_Wagsc * SQR(rad) * T(0.4) + m_Crvsc * T(0.5) * (std::cos(curve3 * T(M_PI)));
}
else
{
wag = std::sin(curve1 * T(M_PI) * m_AbsOptSc) + m_Wagsc * T(0.4) * rad + m_Crvsc * T(0.5) * (std::cos(curve3 * T(M_PI)));
wag3 = std::sin(curve4 * T(M_PI) * m_AbsOptSc) + m_Wagsc * SQR(rad) * T(0.4) + m_Crvsc * T(0.5) * (std::sin(curve2 * T(M_PI)));
}
wag2 = std::sin(curve2 * T(M_PI) * m_AbsOptSc) + m_Wagsc * T(0.4) * rad + m_Crvsc * T(0.5) * (std::cos(curve3 * T(M_PI)));
if (m_Smooth12 <= 1)
wag12 = wag;
else if (m_Smooth12 <= 2 && m_Smooth12 > 1)
wag12 = wag2 * (1 - m_AntiOpt1) + wag * m_AntiOpt1;
else if (m_Smooth12 > 2)
wag12 = wag2;
if (m_Smooth3 == 0)
waggle = wag12;
else if (m_Smooth3 > 0)
waggle = wag12 * (1 - m_Smooth3) + wag3 * m_Smooth3;
if (rand.Frand01<T>() < m_Ghost)
{
if (posNeg < 0)
{
helper.Out.x = m_Weight * T(0.5) * m_RefSc * (m_L * std::cos(m_NumPetals * th + m_C)) * cth;
helper.Out.y = m_Weight * T(0.5) * m_RefSc * (m_L * std::cos(m_NumPetals * th + m_C)) * sth;
helper.Out.z = m_Weight * T(-0.5) * ((m_Z2 * waggle + Sqr(rad * T(0.5)) * std::sin(wig) * m_WigScale) + m_Dist);
}
else
{
helper.Out.x = m_Weight * T(0.5) * (m_L * std::cos(m_NumPetals * th + m_C)) * cth;
helper.Out.y = m_Weight * T(0.5) * (m_L * std::cos(m_NumPetals * th + m_C)) * sth;
helper.Out.z = m_Weight * T(0.5) * ((m_Z1 * waggle + Sqr(rad * T(0.5)) * std::sin(wig) * m_WigScale) + m_Dist);
}
}
else
{
if (posNeg < 0)
{
helper.Out.x = m_Weight * T(0.5) * (m_L * std::cos(m_NumPetals * th + m_C)) * cth;
helper.Out.y = m_Weight * T(0.5) * (m_L * std::cos(m_NumPetals * th + m_C)) * sth;
helper.Out.z = m_Weight * T(0.5) * ((m_Z1 * waggle + Sqr(rad * T(0.5)) * std::sin(wig) * m_WigScale) + m_Dist);
}
else
{
helper.Out.x = m_Weight * T(0.5) * (m_L * std::cos(m_NumPetals * th + m_C)) * cth;
helper.Out.y = m_Weight * T(0.5) * (m_L * std::cos(m_NumPetals * th + m_C)) * sth;
helper.Out.z = m_Weight * T(0.5) * ((m_Z1 * waggle + Sqr(rad * T(0.5)) * std::sin(wig) * m_WigScale) + m_Dist);
}
}
}
virtual string OpenCLString() const override
{
ostringstream ss, ss2;
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string l = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string k = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string z1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string z2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string refSc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string opt = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string optSc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string opt3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string transp = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string wagsc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string crvsc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string f = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string wigsc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string offset = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string cycle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc.
string optDir = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string petalsSign = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string numPetals = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string absOptSc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string smooth12 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string smooth3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string antiOpt1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string ghost = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string freq = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string wigScale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\tint posNeg = 1;\n"
<< "\t\treal_t th = 0;\n"
<< "\t\treal_t sth, cth, pang, wig, wag, wag2, wag3, wag12, waggle;\n"
<< "\t\treal_t rad = precalcSqrtSumSquares;\n"
<< "\t\treal_t curve1 = rad / " << l << ";\n"
<< "\t\treal_t curveTwo = Sqr(curve1);\n"
<< "\t\treal_t curve3 = (rad - " << l << " * 0.5) / " << l << ";\n"
<< "\t\treal_t curve4 = Sqr(curveTwo);\n"
<< "\t\tth = precalcAtanyx;\n"
<< "\t\tsth = sincos(th, &cth);\n"
<< "\n"
<< "\t\tif (MwcNext01(mwc) < 0.5)\n"
<< "\t\t posNeg = -1;\n"
<< "\n"
<< "\t\tpang = th / Zeps(" << cycle << ");\n"
<< "\t\twig = pang * " << freq << " * 0.5 + " << offset << " * " << cycle << ";\n"
<< "\n"
<< "\t\tif (" << optDir << " < 0)\n"
<< "\t\t{\n"
<< "\t\t wag = sin(curve1 * M_PI * " << absOptSc << ") + " << wagsc << " * 0.4 * rad + " << crvsc << " * 0.5 * (sin(curveTwo * M_PI));\n"
<< "\t\t wag3 = sin(curve4 * M_PI * " << absOptSc << ") + " << wagsc << " * SQR(rad) * 0.4 + " << crvsc << " * 0.5 * (cos(curve3 * M_PI));\n"
<< "\t\t}\n"
<< "\t\telse\n"
<< "\t\t{\n"
<< "\t\t wag = sin(curve1 * M_PI * " << absOptSc << ") + " << wagsc << " * 0.4 * rad + " << crvsc << " * 0.5 * (cos(curve3 * M_PI));\n"
<< "\t\t wag3 = sin(curve4 * M_PI * " << absOptSc << ") + " << wagsc << " * SQR(rad) * 0.4 + " << crvsc << " * 0.5 * (sin(curveTwo * M_PI));\n"
<< "\t\t}\n"
<< "\n"
<< "\t\twag2 = sin(curveTwo * M_PI * " << absOptSc << ") + " << wagsc << " * 0.4 * rad + " << crvsc << " * 0.5 * (cos(curve3 * M_PI));\n"
<< "\n"
<< "\t\tif (" << smooth12 << " <= 1)\n"
<< "\t\t wag12 = wag;\n"
<< "\t\telse if (" << smooth12 << " <= 2 && " << smooth12 << " > 1)\n"
<< "\t\t wag12 = wag2 * (1 - " << antiOpt1 << ") + wag * " << antiOpt1 << ";\n"
<< "\t\telse if (" << smooth12 << " > 2)\n"
<< "\t\t wag12 = wag2;\n"
<< "\n"
<< "\t\tif (" << smooth3 << " == 0)\n"
<< "\t\t waggle = wag12;\n"
<< "\t\telse if (" << smooth3 << " > 0)\n"
<< "\t\t waggle = wag12 * (1 - " << smooth3 << ") + wag3 * " << smooth3 << ";\n"
<< "\n"
<< "\t\tif (MwcNext01(mwc) < " << ghost << ")\n"
<< "\t\t{\n"
<< "\t\t if (posNeg < 0)\n"
<< "\t\t {\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * 0.5 * " << refSc << " * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * cth;\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * 0.5 * " << refSc << " * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * sth;\n"
<< "\t\t vOut.z = xform->m_VariationWeights[" << varIndex << "] * -0.5 * ((" << z2 << " * waggle + Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << ");\n"
<< "\t\t }\n"
<< "\t\t else\n"
<< "\t\t {\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * cth;\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * sth;\n"
<< "\t\t vOut.z = xform->m_VariationWeights[" << varIndex << "] * 0.5 * ((" << z1 << " * waggle + Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << ");\n"
<< "\t\t }\n"
<< "\t\t}\n"
<< "\t\telse\n"
<< "\t\t{\n"
<< "\t\t if (posNeg < 0)\n"
<< "\t\t {\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * cth;\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * sth;\n"
<< "\t\t vOut.z = xform->m_VariationWeights[" << varIndex << "] * 0.5 * ((" << z1 << " * waggle + Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << ");\n"
<< "\t\t }\n"
<< "\t\t else\n"
<< "\t\t {\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * cth;\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * 0.5 * (" << l << " * cos(" << numPetals << " * th + " << c << ")) * sth;\n"
<< "\t\t vOut.z = xform->m_VariationWeights[" << varIndex << "] * 0.5 * ((" << z1 << " * waggle + Sqr(rad * 0.5) * sin(wig) * " << wigScale << ") + " << dist << ");\n"
<< "\t\t }\n"
<< "\t\t}\n"
<< "\t}\n";
return ss.str();
}
virtual vector<string> OpenCLGlobalFuncNames() const override
{
return vector<string> { "Sqr", "Zeps" };
}
virtual void Precalc() override
{
m_Cycle = M_2PI / Zeps(m_K);
m_NumPetals = m_K;
m_Ghost = Sqr(m_Transp);
m_Freq = m_F * M_2PI;
m_WigScale = m_Wigsc * T(0.5);
if (std::abs(m_NumPetals) < T(0.0001))
m_NumPetals = T(0.0001) * m_PetalsSign;
m_Smooth12 = std::abs(m_Opt);
m_Smooth3 = std::abs(m_Opt3);
m_AbsOptSc = std::abs(m_OptSc);
if (m_Smooth12 > 2)
m_Smooth12 = 2;
m_AntiOpt1 = 2 - m_Smooth12;
if (m_Smooth3 > 1)
m_Smooth3 = 1;
m_OptDir = std::copysign(T(1.0), m_Opt);
m_PetalsSign = std::copysign(T(1.0), m_K);
if (m_Opt3 < 0)
m_OptDir = -1;
if (m_OptDir > 0)
m_Ghost = 0;
}
protected:
void Init()
{
string prefix = Prefix();
m_Params.clear();
m_Params.push_back(ParamWithName<T>(&m_L, prefix + "pRose3D_l", 1, eParamType::REAL_NONZERO));
m_Params.push_back(ParamWithName<T>(&m_K, prefix + "pRose3D_k", 3));
m_Params.push_back(ParamWithName<T>(&m_C, prefix + "pRose3D_c"));
m_Params.push_back(ParamWithName<T>(&m_Z1, prefix + "pRose3D_z1", 1));
m_Params.push_back(ParamWithName<T>(&m_Z2, prefix + "pRose3D_z2", 1));
m_Params.push_back(ParamWithName<T>(&m_RefSc, prefix + "pRose3D_refSc", 1));
m_Params.push_back(ParamWithName<T>(&m_Opt, prefix + "pRose3D_opt", 1));
m_Params.push_back(ParamWithName<T>(&m_OptSc, prefix + "pRose3D_optSc", 1));
m_Params.push_back(ParamWithName<T>(&m_Opt3, prefix + "pRose3D_opt3"));
m_Params.push_back(ParamWithName<T>(&m_Transp, prefix + "pRose3D_transp", T(0.5)));
m_Params.push_back(ParamWithName<T>(&m_Dist, prefix + "pRose3D_dist", 1));
m_Params.push_back(ParamWithName<T>(&m_Wagsc, prefix + "pRose3D_wagsc", 0));
m_Params.push_back(ParamWithName<T>(&m_Crvsc, prefix + "pRose3D_crvsc", 0));
m_Params.push_back(ParamWithName<T>(&m_F, prefix + "pRose3D_f", 3));
m_Params.push_back(ParamWithName<T>(&m_Wigsc, prefix + "pRose3D_wigsc"));
m_Params.push_back(ParamWithName<T>(&m_Offset, prefix + "pRose3D_offset"));
m_Params.push_back(ParamWithName<T>(true, &m_Cycle, prefix + "pRose3D_cycle"));
m_Params.push_back(ParamWithName<T>(true, &m_OptDir, prefix + "pRose3D_opt_dir"));
m_Params.push_back(ParamWithName<T>(true, &m_PetalsSign, prefix + "pRose3D_petals_sign"));
m_Params.push_back(ParamWithName<T>(true, &m_NumPetals, prefix + "pRose3D_num_petals"));
m_Params.push_back(ParamWithName<T>(true, &m_AbsOptSc, prefix + "pRose3D_abs_optSc"));
m_Params.push_back(ParamWithName<T>(true, &m_Smooth12, prefix + "pRose3D_smooth12"));
m_Params.push_back(ParamWithName<T>(true, &m_Smooth3, prefix + "pRose3D_smooth3"));
m_Params.push_back(ParamWithName<T>(true, &m_AntiOpt1, prefix + "pRose3D_anti_opt1"));
m_Params.push_back(ParamWithName<T>(true, &m_Ghost, prefix + "pRose3D_ghost"));
m_Params.push_back(ParamWithName<T>(true, &m_Freq, prefix + "pRose3D_freq"));
m_Params.push_back(ParamWithName<T>(true, &m_WigScale, prefix + "pRose3D_wig_scale"));
}
private:
T m_L;
T m_K;
T m_C;
T m_Z1;
T m_Z2;
T m_RefSc;
T m_Opt;
T m_OptSc;
T m_Opt3;
T m_Transp;
T m_Dist;
T m_Wagsc;
T m_Crvsc;
T m_F;
T m_Wigsc;
T m_Offset;
T m_Cycle;//Precalc.
T m_OptDir;
T m_PetalsSign;
T m_NumPetals;
T m_AbsOptSc;
T m_Smooth12;
T m_Smooth3;
T m_AntiOpt1;
T m_Ghost;
T m_Freq;
T m_WigScale;
};
/// <summary>
/// log_db.
/// By DarkBeam, taken from JWildfire.
/// http://jwildfire.org/forum/viewtopic.php?f=23&t=1450&p=2692#p2692
/// </summary>
template <typename T>
class EMBER_API LogDBVariation : public ParametricVariation<T>
{
public:
LogDBVariation(T weight = 1.0) : ParametricVariation<T>("log_db", eVariationId::VAR_LOG_DB, weight, true, false, false, false, true)
{
Init();
}
PARVARCOPY(LogDBVariation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
int i, adp;
T atanPeriod = 0;
for (i = 0; i < 7; i++)
{
adp = rand.Rand(10) - 5;
if (std::abs(adp) >= 3)
adp = 0;
atanPeriod += adp;
}
atanPeriod *= m_FixPe;
helper.Out.x = m_Denom * std::log(helper.m_PrecalcSumSquares);
helper.Out.y = m_Weight * (helper.m_PrecalcAtanyx + atanPeriod);
helper.Out.z = m_Weight * helper.In.z;
}
virtual string OpenCLString() const override
{
ostringstream ss, ss2;
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string base = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string fixPeriod = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string denom = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string fixPe = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\tint i, adp;\n"
<< "\t\treal_t atanPeriod = 0;\n"
<< "\n"
<< "\t\tfor (i = 0; i < 7; i++)\n"
<< "\t\t{\n"
<< "\t\t adp = MwcNextRange(mwc, 10) - 5;\n"
<< "\n"
<< "\t\t if (abs(adp) >= 3)\n"
<< "\t\t adp = 0;\n"
<< "\n"
<< "\t\t atanPeriod += adp;\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tatanPeriod *= " << fixPe << ";\n"
<< "\t\tvOut.x = " << denom << " * log(precalcSumSquares);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (precalcAtanyx + atanPeriod);\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t}\n";
return ss.str();
}
virtual void Precalc() override
{
m_Denom = T(0.5);
if (m_Base > EPS)
m_Denom = m_Denom / std::log(T(M_E) * m_Base);
m_Denom *= m_Weight;
m_FixPe = T(M_PI);
if (m_FixPeriod > EPS)
m_FixPe *= m_FixPeriod;
}
protected:
void Init()
{
string prefix = Prefix();
m_Params.clear();
m_Params.push_back(ParamWithName<T>(&m_Base, prefix + "log_db_base", 1));
m_Params.push_back(ParamWithName<T>(&m_FixPeriod, prefix + "log_db_fix_period", 1));
m_Params.push_back(ParamWithName<T>(true, &m_Denom, prefix + "log_db_denom"));
m_Params.push_back(ParamWithName<T>(true, &m_FixPe, prefix + "log_db_fix_pe"));
}
private:
T m_Base;
T m_FixPeriod;
T m_Denom;
T m_FixPe;
};
MAKEPREPOSTPARVAR(Splits3D, splits3D, SPLITS3D)
MAKEPREPOSTPARVAR(Waves2B, waves2b, WAVES2B)
MAKEPREPOSTPARVAR(JacCn, jac_cn, JAC_CN)
MAKEPREPOSTPARVAR(JacDn, jac_dn, JAC_DN)
MAKEPREPOSTPARVAR(JacSn, jac_sn, JAC_SN)
MAKEPREPOSTPARVAR(PressureWave, pressure_wave, PRESSURE_WAVE)
MAKEPREPOSTVAR(Gamma, gamma, GAMMA)
MAKEPREPOSTPARVAR(PRose3D, pRose3D, PROSE3D)
MAKEPREPOSTPARVAR(LogDB, log_db, LOG_DB)
}

View File

@ -140,7 +140,7 @@ public:
T h = -m_H + (1 - x0_xor_y0) * m_H;
helper.Out.x = m_Weight * (m_Xform->m_Affine.A() * x + m_Xform->m_Affine.B() * y + m_Xform->m_Affine.E());
helper.Out.y = m_Weight * (m_Xform->m_Affine.C() * x + m_Xform->m_Affine.D() * y + m_Xform->m_Affine.F());
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
outPoint.m_ColorX = fmod(std::abs(outPoint.m_ColorX * T(0.5) * (1 + h) + x0_xor_y0 * (1 - h) * T(0.5)), T(1.0));
}
@ -162,7 +162,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (xform->m_A * x + xform->m_B * y + xform->m_E);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (xform->m_C * x + xform->m_D * y + xform->m_F);\n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t\toutPoint->m_ColorX = fmod(fabs(outPoint->m_ColorX * (real_t)(0.5) * (1 + h) + x0_xor_y0 * (1 - h) * (real_t)(0.5)), (real_t)(1.0));\n"
<< "\t}\n";
return ss.str();
@ -588,7 +588,7 @@ public:
}
}
helper.Out.z = m_Weight * helper.In.z;
helper.Out.z = DefaultZ(helper);
outPoint.m_ColorX = fmod(c, T(1.0));
}
@ -668,7 +668,7 @@ public:
<< "\t\t }\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t\toutPoint->m_ColorX = fmod(c, (real_t)(1.0));\n"
<< "\t}\n";
return ss.str();
@ -1242,7 +1242,7 @@ public:
// Add blur effect to transform
helper.Out.x = m_Weight * vx;
helper.Out.y = m_Weight * vy;
helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
helper.Out.z = DefaultZ(helper);
col = m_Centre + m_Range * p;
outPoint.m_ColorX = col - Floor<T>(col);
}
@ -1393,7 +1393,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vx; \n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vy; \n"
<< "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t\tcol = " << centre << " + " << range << " * p; \n"
<< "\t\toutPoint->m_ColorX = col - floor(col); \n"
<< "\t}\n";

View File

@ -616,7 +616,7 @@ public:
iterHelper.In.x = iterHelper.m_TransX;//Read must be done before every pre variation because transX/Y are changing.
iterHelper.In.y = iterHelper.m_TransY;
iterHelper.In.z = iterHelper.m_TransZ;
m_PreVariations[i]->PrecalcHelper(iterHelper, inPoint);//Apply per-variation precalc, the second parameter is unused for pre variations.
m_PreVariations[i]->PrePostPrecalcHelper(iterHelper);//Apply per-variation precalc, the second parameter is unused for pre variations.
m_PreVariations[i]->Func(iterHelper, *outPoint, rand);
WritePre(iterHelper, m_PreVariations[i]->AssignType());
}
@ -668,7 +668,7 @@ public:
iterHelper.In.x = outPoint->m_X;//Read must be done before every post variation because the out point is changing.
iterHelper.In.y = outPoint->m_Y;
iterHelper.In.z = outPoint->m_Z;
m_PostVariations[i]->PrecalcHelper(iterHelper, outPoint);//Apply per-variation precalc.
m_PostVariations[i]->PrePostPrecalcHelper(iterHelper);//Apply per-variation precalc.
m_PostVariations[i]->Func(iterHelper, *outPoint, rand);
WritePost(iterHelper, *outPoint, m_PostVariations[i]->AssignType());
}

View File

@ -268,6 +268,7 @@ public:
badParams.push_back("post_scrop_cropmode");
badParams.push_back("post_scrop_static");
m_BadVariationNames.push_back(make_pair(make_pair(string("post_scrop"), string("post_smartcrop")), badParams));
//Note that splits3D can't be done here because it's param names are also used by splits.
badParams.clear();
m_BadVariationNames.push_back(make_pair(make_pair(string("pre_blur"), string("pre_gaussian_blur")), badParams));//No other special params for these.
m_BadVariationNames.push_back(make_pair(make_pair(string("pre_spin_z"), string("pre_rotate_z")), badParams));

View File

@ -27,7 +27,8 @@ bool EmberAnimate(EmberOptions& opt)
//Regular variables.
Timing t;
bool unsorted = false;
uint channels, padding;
uint channels;
streamsize padding;
size_t i, firstUnsortedIndex = 0;
string inputPath = GetPath(opt.Input());
vector<Ember<T>> embers;
@ -124,9 +125,13 @@ bool EmberAnimate(EmberOptions& opt)
if (!InitPaletteList<T>(opt.PalettePath()))
return false;
cout << "Parsing ember file " << opt.Input() << endl;
if (!ParseEmberFile(parser, opt.Input(), embers))
return false;
cout << "Finished parsing.\n";
if (embers.size() <= 1)
{
cout << "Read " << embers.size() << " embers from file. At least 2 required to animate, exiting." << endl;
@ -227,6 +232,15 @@ bool EmberAnimate(EmberOptions& opt)
if (opt.Supersample() > 0)
embers[i].m_Supersample = opt.Supersample();
if (opt.Quality() > 0)
embers[i].m_Quality = T(opt.Quality());
if (opt.DeMin() > -1)
embers[i].m_MinRadDE = T(opt.DeMin());
if (opt.DeMax() > -1)
embers[i].m_MaxRadDE = T(opt.DeMax());
if (opt.SubBatchSize() != DEFAULT_SBS)
embers[i].m_SubBatchSize = opt.SubBatchSize();

View File

@ -73,7 +73,6 @@ static string ConstantDefinesString(bool doublePrecision)
"#define COLORMAP_LENGTH_MINUS_1 255u\n"
"#define DE_THRESH 100u\n"
"#define BadVal(x) (((x) != (x)) || ((x) > 1e10) || ((x) < -1e10))\n"
"#define Rint(A) floor((A) + (((A) < 0) ? -0.5 : 0.5))\n"
"#define SQR(x) ((x) * (x))\n"
"#define CUBE(x) ((x) * (x) * (x))\n"
"#define M_2PI (M_PI * 2)\n"

View File

@ -43,6 +43,14 @@ FunctionMapper::FunctionMapper()
"\n"
" return sqrt(x);\n"
"}\n";
m_GlobalMap["SafeDivInv"] =
"inline real_t SafeDivInv(real_t q, real_t r)\n"
"{\n"
" if (r < EPS)\n"
" return 1 / r;\n"
"\n"
" return q / r;\n"
"}\n";
m_GlobalMap["Cube"] =
"inline real_t Cube(real_t v)\n"
"{\n"
@ -125,7 +133,7 @@ FunctionMapper::FunctionMapper()
" if (pmq.x == 0 && pmq.y == 0)\n"
" return 1.0;\n"
"\n"
" return 2 * (((*u).x - (*q).x) * pmq.x + ((*u).y - (*q).y) * pmq.y) / (SQR(pmq.x) + SQR(pmq.y));\n"
" return 2 * (((*u).x - (*q).x) * pmq.x + ((*u).y - (*q).y) * pmq.y) / Zeps(SQR(pmq.x) + SQR(pmq.y));\n"
"}\n";
m_GlobalMap["Closest"] =
"inline int Closest(real2* p, int n, real2* u)\n"
@ -273,6 +281,93 @@ FunctionMapper::FunctionMapper()
"\n"
" return n;\n"
"}\n";
m_GlobalMap["JacobiElliptic"] =
"inline void JacobiElliptic(real_t uu, real_t emmc, real_t* sn, real_t* cn, real_t* dn)\n"
"{\n"
" real_t CA = 0.0003;\n"
" real_t a, b, c, d, em[13], en[13];\n"
" int bo;\n"
" int l;\n"
" int ii;\n"
" int i;\n"
" real_t emc = emmc;\n"
" real_t u = uu;\n"
"\n"
" if (emc != 0)\n"
" {\n"
" bo = 0;\n"
"\n"
" if (emc < 0)\n"
" bo = 1;\n"
"\n"
" if (bo != 0)\n"
" {\n"
" d = 1 - emc;\n"
" emc = -emc / d;\n"
" d = sqrt(d);\n"
" u = d * u;\n"
" }\n"
"\n"
" a = 1;\n"
" *dn = 1;\n"
"\n"
" for (i = 0; i < 8; i++)\n"
" {\n"
" l = i;\n"
" em[i] = a;\n"
" emc = sqrt(emc);\n"
" en[i] = emc;\n"
" c = 0.5 * (a + emc);\n"
"\n"
" if (fabs(a - emc) <= CA * a)\n"
" break;\n"
"\n"
" emc = a * emc;\n"
" a = c;\n"
" }\n"
"\n"
" u = c * u;\n"
" *sn = sincos(u, cn);\n"
"\n"
" if (*sn != 0)\n"
" {\n"
" a = *cn / *sn;\n"
" c = a * c;\n"
"\n"
" for (ii = l; ii >= 0; --ii)\n"
" {\n"
" b = em[ii];\n"
" a = c * a;\n"
" c = *dn * c;\n"
" *dn = (en[ii] + a) / (b + a);\n"
" a = c / b;\n"
" }\n"
"\n"
" a = 1 / sqrt(c * c + 1);\n"
"\n"
" if (*sn < 0)\n"
" *sn = -a;\n"
" else\n"
" *sn = a;\n"
"\n"
" *cn = c * *sn;\n"
" }\n"
"\n"
" if (bo != 0)\n"
" {\n"
" a = *dn;\n"
" *dn = *cn;\n"
" *cn = a;\n"
" *sn = *sn / d;\n"
" }\n"
" }\n"
" else\n"
" {\n"
" *cn = 1 / cosh(u);\n"
" *dn = *cn;\n"
" *sn = tanh(u);\n"
" }\n"
"}\n";
}
}

View File

@ -122,8 +122,8 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
if (Variation<T>* var = xform->GetVariation(varIndex))
{
xformFuncs << "\n\t//" << var->Name() << ".\n";
xformFuncs << var->PrecalcOpenCLString();
xformFuncs << xform->ReadOpenCLString(eVariationType::VARTYPE_PRE) << "\n";
xformFuncs << var->PrePostPrecalcOpenCLString();
xformFuncs << var->OpenCLString() << "\n";
xformFuncs << xform->WriteOpenCLString(eVariationType::VARTYPE_PRE, var->AssignType()) << "\n";
}
@ -188,8 +188,8 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
if (Variation<T>* var = xform->GetVariation(varIndex))
{
xformFuncs << "\n\t//" << var->Name() << ".\n";
xformFuncs << var->PrecalcOpenCLString();
xformFuncs << xform->ReadOpenCLString(eVariationType::VARTYPE_POST) << "\n";
xformFuncs << var->PrePostPrecalcOpenCLString();
xformFuncs << var->OpenCLString() << "\n";
xformFuncs << xform->WriteOpenCLString(eVariationType::VARTYPE_POST, var->AssignType()) << (varIndex == varCount - 1 ? "\n" : "\n\n");
}

View File

@ -112,8 +112,22 @@ template <typename T>
static bool InitPaletteList(const string& filename)
{
PaletteList<T> paletteList;//Even though this is local, the members are static so they will remain.
static vector<string> paths =
{
"./"
#ifndef WIN32
"~/.fractorium"
"~/.config/fractorium"
"/usr/share/fractorium"
"/usr/local/share/fractorium"
#endif
};
bool added = paletteList.Add(filename);
for (auto& p : paths)
if (!added)
added |= paletteList.Add(p + "/" + filename);
if (!added || !paletteList.Size())
{
cout << "Error parsing palette file " << filename << ". Reason: " << endl;

View File

@ -81,6 +81,9 @@ enum class eOptionIDs : et
OPT_SS,//Float value args.
OPT_QS,
OPT_QUALITY,
OPT_DE_MIN,
OPT_DE_MAX,
OPT_PIXEL_ASPECT,
OPT_STAGGER,
OPT_AVG_THRESH,
@ -322,13 +325,13 @@ public:
INITBOOLOPTION(LockAccum, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_LOCK_ACCUM, _T("--lock_accum"), false, SO_NONE, "\t--lock_accum Lock threads when accumulating to the histogram using the CPU. This will drop performance to that of single threading [default: false].\n"));
INITBOOLOPTION(DumpKernel, Eob(eOptionUse::OPT_USE_RENDER, eOptionIDs::OPT_DUMP_KERNEL, _T("--dump_kernel"), false, SO_NONE, "\t--dump_kernel Print the iteration kernel string when using OpenCL (ignored for CPU) [default: false].\n"));
//Int.
INITINTOPTION(Symmetry, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SYMMETRY, _T("--symmetry"), 0, SO_REQ_SEP, "\t--symmetry=<val> Set symmetry of result [default: 0].\n"));
INITINTOPTION(SheepGen, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SHEEP_GEN, _T("--sheep_gen"), -1, SO_REQ_SEP, "\t--sheep_gen=<val> Sheep generation of this flame [default: -1].\n"));
INITINTOPTION(SheepId, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SHEEP_ID, _T("--sheep_id"), -1, SO_REQ_SEP, "\t--sheep_id=<val> Sheep ID of this flame [default: -1].\n"));
INITINTOPTION(Symmetry, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SYMMETRY, _T("--symmetry"), 0, SO_REQ_SEP, "\t--symmetry=<val> Set symmetry of result [default: 0].\n"));
INITINTOPTION(SheepGen, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SHEEP_GEN, _T("--sheep_gen"), -1, SO_REQ_SEP, "\t--sheep_gen=<val> Sheep generation of this flame [default: -1].\n"));
INITINTOPTION(SheepId, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SHEEP_ID, _T("--sheep_id"), -1, SO_REQ_SEP, "\t--sheep_id=<val> Sheep ID of this flame [default: -1].\n"));
#ifdef _WIN32
INITINTOPTION(Priority, Eoi(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_PRIORITY, _T("--priority"), int(eThreadPriority::NORMAL), SO_REQ_SEP, "\t--priority=<val> The priority of the CPU rendering threads from -2 - 2. This does not apply to OpenCL rendering.\n"));
INITINTOPTION(Priority, Eoi(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_PRIORITY, _T("--priority"), int(eThreadPriority::NORMAL), SO_REQ_SEP, "\t--priority=<val> The priority of the CPU rendering threads from -2 - 2. This does not apply to OpenCL rendering.\n"));
#else
INITINTOPTION(Priority, Eoi(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_PRIORITY, _T("--priority"), int(eThreadPriority::NORMAL), SO_REQ_SEP, "\t--priority=<val> The priority of the CPU rendering threads, 1, 25, 50, 75, 99. This does not apply to OpenCL rendering.\n"));
INITINTOPTION(Priority, Eoi(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_PRIORITY, _T("--priority"), int(eThreadPriority::NORMAL), SO_REQ_SEP, "\t--priority=<val> The priority of the CPU rendering threads, 1, 25, 50, 75, 99. This does not apply to OpenCL rendering.\n"));
#endif
//Uint.
INITUINTOPTION(Seed, Eou(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_SEED, _T("--seed"), 0, SO_REQ_SEP, "\t--seed=<val> Integer seed to use for the random number generator [default: random].\n"));
@ -355,6 +358,9 @@ public:
//Double.
INITDOUBLEOPTION(SizeScale, Eod(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_SS, _T("--ss"), 1, SO_REQ_SEP, "\t--ss=<val> Size scale. All dimensions are scaled by this amount [default: 1.0].\n"));
INITDOUBLEOPTION(QualityScale, Eod(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_QS, _T("--qs"), 1, SO_REQ_SEP, "\t--qs=<val> Quality scale. All quality values are scaled by this amount [default: 1.0].\n"));
INITDOUBLEOPTION(Quality, Eod(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_QUALITY, _T("--quality"), 0, SO_REQ_SEP, "\t--quality=<val> Override the quality of the flame if not 0 [default: 0].\n"));
INITDOUBLEOPTION(DeMin, Eod(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_DE_MIN, _T("--demin"), -1, SO_REQ_SEP, "\t--demin=<val> Override the minimum size of the density estimator filter radius if not -1 [default: -1].\n"));
INITDOUBLEOPTION(DeMax, Eod(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_DE_MAX, _T("--demax"), -1, SO_REQ_SEP, "\t--demax=<val> Override the maximum size of the density estimator filter radius if not -1 [default: -1].\n"));
INITDOUBLEOPTION(AspectRatio, Eod(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_PIXEL_ASPECT, _T("--pixel_aspect"), 1, SO_REQ_SEP, "\t--pixel_aspect=<val> Aspect ratio of pixels (width over height), eg. 0.90909 for NTSC [default: 1.0].\n"));
INITDOUBLEOPTION(Stagger, Eod(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_STAGGER, _T("--stagger"), 0, SO_REQ_SEP, "\t--stagger=<val> Affects simultaneity of xform interpolation during flame interpolation.\n"
"\t Represents how 'separate' the xforms are interpolated. Set to 1 for each\n"
@ -374,7 +380,7 @@ public:
INITSTRINGOPTION(Out, Eos(eOptionUse::OPT_USE_RENDER, eOptionIDs::OPT_OUT, _T("--out"), "", SO_REQ_SEP, "\t--out=<val> Name of a single output file. Not recommended when rendering more than one image.\n"));
INITSTRINGOPTION(Prefix, Eos(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_PREFIX, _T("--prefix"), "", SO_REQ_SEP, "\t--prefix=<val> Prefix to prepend to all output files.\n"));
INITSTRINGOPTION(Suffix, Eos(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_SUFFIX, _T("--suffix"), "", SO_REQ_SEP, "\t--suffix=<val> Suffix to append to all output files.\n"));
INITSTRINGOPTION(Format, Eos(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_FORMAT, _T("--format"), "png", SO_REQ_SEP, "\t--format=<val> Format of the output file. Valid values are: bmp, jpg, png, ppm [default: jpg].\n"));
INITSTRINGOPTION(Format, Eos(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_FORMAT, _T("--format"), "png", SO_REQ_SEP, "\t--format=<val> Format of the output file. Valid values are: bmp, jpg, png, ppm [default: png].\n"));
INITSTRINGOPTION(PalettePath, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_PALETTE_FILE, _T("--flam3_palettes"), "flam3-palettes.xml", SO_REQ_SEP, "\t--flam3_palettes=<val> Path and name of the palette file [default: flam3-palettes.xml].\n"));
//INITSTRINGOPTION(PaletteImage, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_PALETTE_IMAGE, _T("--image"), "", SO_REQ_SEP, "\t--image=<val> Replace palette with png, jpg, or ppm image.\n"));
INITSTRINGOPTION(Id, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_ID, _T("--id"), "", SO_REQ_SEP, "\t--id=<val> ID to use in <edit> tags / image comments.\n"));
@ -483,6 +489,9 @@ public:
PARSEUINTOPTION(eOptionIDs::OPT_MAX_XFORMS, MaxXforms);
PARSEDOUBLEOPTION(eOptionIDs::OPT_SS, SizeScale);//Float args.
PARSEDOUBLEOPTION(eOptionIDs::OPT_QS, QualityScale);
PARSEDOUBLEOPTION(eOptionIDs::OPT_QUALITY, Quality);
PARSEDOUBLEOPTION(eOptionIDs::OPT_DE_MIN, DeMin);
PARSEDOUBLEOPTION(eOptionIDs::OPT_DE_MAX, DeMax);
PARSEDOUBLEOPTION(eOptionIDs::OPT_PIXEL_ASPECT, AspectRatio);
PARSEDOUBLEOPTION(eOptionIDs::OPT_STAGGER, Stagger);
PARSEDOUBLEOPTION(eOptionIDs::OPT_AVG_THRESH, AvgThresh);
@ -743,6 +752,9 @@ public:
Eod SizeScale;//Value double.
Eod QualityScale;
Eod Quality;
Eod DeMin;
Eod DeMax;
Eod AspectRatio;
Eod Stagger;
Eod AvgThresh;

View File

@ -34,6 +34,14 @@ void SetDefaultTestValues(Ember<T>& ember)
ember.m_CurveDE = T(0.6);
}
template <typename T>
void FormatName(Ember<T>& result, ostringstream& os, streamsize padding)
{
os << std::setw(padding) << result.m_Time;
result.m_Name = os.str();
os.str("");
}
/// <summary>
/// The core of the EmberGenome.exe program.
/// Template argument expected to be float or double.
@ -381,6 +389,9 @@ bool EmberGenome(EmberOptions& opt)
spread = 1 / T(opt.Frames());
frameCount = 0;
os.str("");
os << setfill('0');
auto padding = streamsize(std::log10(((opt.Frames() * opt.Loops()) + opt.Frames()) * embers.size())) + 1;
for (i = 0; i < embers.size(); i++)
{
@ -390,6 +401,7 @@ bool EmberGenome(EmberOptions& opt)
{
blend = T(frame) / T(opt.Frames());
tools.Spin(embers[i], pTemplate, result, frameCount++, blend);//Result is cleared and reassigned each time inside of Spin().
FormatName(result, os, padding);
cout << emberToXml.ToString(result, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), false, opt.HexPalette());
}
@ -399,6 +411,7 @@ bool EmberGenome(EmberOptions& opt)
frame = size_t(std::round(opt.Frames() * opt.Loops()));
blend = T(frame) / T(opt.Frames());
tools.Spin(embers[i], pTemplate, result, frameCount, blend);//Do not increment frameCount here.
FormatName(result, os, padding);
}
if (i < embers.size() - 1)
@ -412,6 +425,7 @@ bool EmberGenome(EmberOptions& opt)
blend = frame / T(opt.Frames());
result.Clear();
tools.SpinInter(&embers[i], pTemplate, result, frameCount++, seqFlag, blend);
FormatName(result, os, padding);
cout << emberToXml.ToString(result, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), false, opt.HexPalette());
}
}
@ -419,6 +433,7 @@ bool EmberGenome(EmberOptions& opt)
result = embers.back();
tools.Spin(embers.back(), pTemplate, result, frameCount, 0);
FormatName(result, os, padding);
cout << emberToXml.ToString(result, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), false, opt.HexPalette());
if (opt.Enclosed())

View File

@ -172,6 +172,15 @@ bool EmberRender(EmberOptions& opt)
if (opt.Supersample() > 0)
embers[i].m_Supersample = opt.Supersample();
if (opt.Quality() > 0)
embers[i].m_Quality = T(opt.Quality());
if (opt.DeMin() > -1)
embers[i].m_MinRadDE = T(opt.DeMin());
if (opt.DeMax() > -1)
embers[i].m_MaxRadDE = T(opt.DeMax());
if (opt.SubBatchSize() != DEFAULT_SBS)
embers[i].m_SubBatchSize = opt.SubBatchSize();

View File

@ -567,7 +567,7 @@ bool TestVarEqual(const Variation<sT>* var1, const Variation<dT>* var2)
{
if (!IsClose<sT>(params1[i].ParamVal(), (sT)params2[i].ParamVal(), sT(1e-4)))
{
cout << "Param " << params1[i].Name() << " Val were not equal: " << params1[i].ParamVal() << " != " << params2[i].ParamVal() << endl;
cout << "Param " << params1[i].Name() << " Vals were not equal: " << params1[i].ParamVal() << " != " << params2[i].ParamVal() << endl;
success = false;
}
}

View File

@ -150,7 +150,9 @@ public:
{
endSection = str.section('_', -1);
num = endSection.toULongLong(&ok);
ret.chop(str.size() - lastUnderscore);
if (ok)
ret.chop(str.size() - lastUnderscore);
}
ret += "_" + QString::number(num + 1);
@ -180,7 +182,7 @@ public:
newPath = path + base + "." + extension;
}
while (QFile::exists(newPath));
return newPath;
}

View File

@ -149,6 +149,7 @@ public slots:
void OnActionSP(bool checked);
void OnActionDP(bool checked);
void OnActionStyle(bool checked);
void OnActionStartStopRenderer(bool checked);
//Library.
void OnEmberTreeItemChanged(QTreeWidgetItem* item, int col);
@ -369,6 +370,7 @@ private:
void ShutdownAndRecreateFromOptions();
bool CreateRendererFromOptions();
bool CreateControllerFromOptions();
void EnableRenderControls(bool enable);
//Dialogs.
QStringList SetupOpenXmlDialog();

View File

@ -46,5 +46,7 @@
<file>Icons/table_gear.png</file>
<file>Icons/checkbox_checked.png</file>
<file>Icons/checkbox_unchecked.png</file>
<file>Icons/control.png</file>
<file>Icons/control-stop-square.png</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -823,6 +823,8 @@ void Fractorium::OnFinalRenderClose(int result)
{
m_RenderStatusLabel->setText("Renderer starting...");
StartRenderTimer();//Re-create the renderer and start rendering again.
ui.ActionStartStopRenderer->setChecked(false);//Re-enable any controls that might have been disabled.
OnActionStartStopRenderer(false);
}
/// <summary>

View File

@ -20,8 +20,9 @@ void Fractorium::InitParamsUI()
SetFixedTableHeader(ui.GeometryTableHeader->horizontalHeader());
SetFixedTableHeader(ui.FilterTableHeader->horizontalHeader());
SetFixedTableHeader(ui.IterationTableHeader->horizontalHeader());
SetFixedTableHeader(ui.AnimationTableHeader->horizontalHeader());
//Color.
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_BrightnessSpin, spinHeight, 0.05, 100, 1, SIGNAL(valueChanged(double)), SLOT(OnBrightnessChanged(double)), true, 4.0, 4.0, 4.0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_BrightnessSpin, spinHeight, 0.05, 1000, 1, SIGNAL(valueChanged(double)), SLOT(OnBrightnessChanged(double)), true, 4.0, 4.0, 4.0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_GammaSpin, spinHeight, 1, 9999, 0.5, SIGNAL(valueChanged(double)), SLOT(OnGammaChanged(double)), true, 4.0, 4.0, 4.0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_GammaThresholdSpin, spinHeight, 0, 10, 0.01, SIGNAL(valueChanged(double)), SLOT(OnGammaThresholdChanged(double)), true, 0.1, 0.1, 0.0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_VibrancySpin, spinHeight, 0, 30, 0.01, SIGNAL(valueChanged(double)), SLOT(OnVibrancyChanged(double)), true, 1.0, 1.0, 0.0);
@ -65,9 +66,6 @@ void Fractorium::InitParamsUI()
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_SpatialFilterWidthSpin, spinHeight, 0.1, 10, 0.1, SIGNAL(valueChanged(double)), SLOT(OnSpatialFilterWidthChanged(double)), true, 1.0, 1.0, 1.0);
comboVals = SpatialFilterCreator<float>::FilterTypes();
SetupCombo(table, this, row, 1, m_SpatialFilterTypeCombo, comboVals, SIGNAL(currentIndexChanged(const QString&)), SLOT(OnSpatialFilterTypeComboCurrentIndexChanged(const QString&)));
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_TemporalFilterWidthSpin, spinHeight, 1, 10, 1, SIGNAL(valueChanged(double)), SLOT(OnTemporalFilterWidthChanged(double)), true, 1);
comboVals = TemporalFilterCreator<float>::FilterTypes();
SetupCombo(table, this, row, 1, m_TemporalFilterTypeCombo, comboVals, SIGNAL(currentIndexChanged(const QString&)), SLOT(OnTemporalFilterTypeComboCurrentIndexChanged(const QString&)));
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_DEFilterMinRadiusSpin, spinHeight, 0, 25, 1, SIGNAL(valueChanged(double)), SLOT(OnDEFilterMinRadiusWidthChanged(double)), true, 0, 0, 0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_DEFilterMaxRadiusSpin, spinHeight, 0, 25, 1, SIGNAL(valueChanged(double)), SLOT(OnDEFilterMaxRadiusWidthChanged(double)), true, 0.0, 9.0, 0);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_DECurveSpin, spinHeight, 0.15, 5, 0.1, SIGNAL(valueChanged(double)), SLOT(OnDEFilterCurveWidthChanged(double)), true, 0.4, 0.4, 0.4);
@ -78,15 +76,21 @@ void Fractorium::InitParamsUI()
SetupSpinner<SpinBox, int>( table, this, row, 1, m_FuseSpin, spinHeight, 1, 1000, 5, SIGNAL(valueChanged(int)), SLOT(OnFuseChanged(int)), true, 15, 15, 15);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_QualitySpin, spinHeight, 1, dmax, 50, SIGNAL(valueChanged(double)), SLOT(OnQualityChanged(double)), true, 10, 10, 10);
SetupSpinner<SpinBox, int>( table, this, row, 1, m_SupersampleSpin, spinHeight, 1, 4, 1, SIGNAL(valueChanged(int)), SLOT(OnSupersampleChanged(int)), true, 1, 1, 1);
SetupSpinner<SpinBox, int>( table, this, row, 1, m_TemporalSamplesSpin, spinHeight, 1, 5000, 1, SIGNAL(valueChanged(int)), SLOT(OnTemporalSamplesChanged(int)), true, 1000);
comboVals.clear();
comboVals.push_back("Step");
comboVals.push_back("Linear");
SetupCombo(table, this, row, 1, m_AffineInterpTypeCombo, comboVals, SIGNAL(currentIndexChanged(int)), SLOT(OnAffineInterpTypeComboCurrentIndexChanged(int)));
//Animation.
row = 0;
table = ui.AnimationTable;
comboVals.clear();
comboVals.push_back("Linear");
comboVals.push_back("Smooth");
SetupCombo(table, this, row, 1, m_InterpTypeCombo, comboVals, SIGNAL(currentIndexChanged(int)), SLOT(OnInterpTypeComboCurrentIndexChanged(int)));
comboVals.clear();
comboVals.push_back("Step");
comboVals.push_back("Linear");
SetupCombo( table, this, row, 1, m_AffineInterpTypeCombo, comboVals, SIGNAL(currentIndexChanged(int)), SLOT(OnAffineInterpTypeComboCurrentIndexChanged(int)));
SetupSpinner<SpinBox, int>( table, this, row, 1, m_TemporalSamplesSpin, spinHeight, 1, 5000, 1, SIGNAL(valueChanged(int)), SLOT(OnTemporalSamplesChanged(int)), true, 1000);
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_TemporalFilterWidthSpin, spinHeight, 1, 10, 1, SIGNAL(valueChanged(double)), SLOT(OnTemporalFilterWidthChanged(double)), true, 1);
comboVals = TemporalFilterCreator<float>::FilterTypes();
SetupCombo( table, this, row, 1, m_TemporalFilterTypeCombo, comboVals, SIGNAL(currentIndexChanged(const QString&)), SLOT(OnTemporalFilterTypeComboCurrentIndexChanged(const QString&)));
}
/// <summary>

View File

@ -606,6 +606,20 @@ bool FractoriumEmberController<T>::CreateRenderer(eRendererType renderType, cons
return ok;
}
/// <summary>
/// Enable or disable the controls related to changing the renderer.
/// Used when pausing and restarting the renderer.
/// </summary>
/// <param name="enable">True to enable, else false.</param>
void Fractorium::EnableRenderControls(bool enable)
{
ui.ActionCpu->setEnabled(enable);
ui.ActionCL->setEnabled(enable);
ui.ActionSP->setEnabled(enable);
ui.ActionDP->setEnabled(enable);
ui.ActionOptions->setEnabled(enable);
}
/// <summary>
/// Wrapper to stop the timer, shutdown the controller and recreate, then restart the controller and renderer from the options.
/// </summary>

View File

@ -14,11 +14,12 @@ void Fractorium::InitToolbarUI()
spGroup->addAction(ui.ActionSP);
spGroup->addAction(ui.ActionDP);
SyncOptionsToToolbar();
connect(ui.ActionCpu, SIGNAL(triggered(bool)), this, SLOT(OnActionCpu(bool)), Qt::QueuedConnection);
connect(ui.ActionCL, SIGNAL(triggered(bool)), this, SLOT(OnActionCL(bool)), Qt::QueuedConnection);
connect(ui.ActionSP, SIGNAL(triggered(bool)), this, SLOT(OnActionSP(bool)), Qt::QueuedConnection);
connect(ui.ActionDP, SIGNAL(triggered(bool)), this, SLOT(OnActionDP(bool)), Qt::QueuedConnection);
connect(ui.ActionStyle, SIGNAL(triggered(bool)), this, SLOT(OnActionStyle(bool)), Qt::QueuedConnection);
connect(ui.ActionCpu, SIGNAL(triggered(bool)), this, SLOT(OnActionCpu(bool)), Qt::QueuedConnection);
connect(ui.ActionCL, SIGNAL(triggered(bool)), this, SLOT(OnActionCL(bool)), Qt::QueuedConnection);
connect(ui.ActionSP, SIGNAL(triggered(bool)), this, SLOT(OnActionSP(bool)), Qt::QueuedConnection);
connect(ui.ActionDP, SIGNAL(triggered(bool)), this, SLOT(OnActionDP(bool)), Qt::QueuedConnection);
connect(ui.ActionStyle, SIGNAL(triggered(bool)), this, SLOT(OnActionStyle(bool)), Qt::QueuedConnection);
connect(ui.ActionStartStopRenderer, SIGNAL(triggered(bool)), this, SLOT(OnActionStartStopRenderer(bool)), Qt::QueuedConnection);
}
/// <summary>
@ -82,6 +83,28 @@ void Fractorium::OnActionStyle(bool checked)
m_QssDialog->show();
}
/// <summary>
/// Called when the start/stop renderer button is clicked.
/// </summary>
/// <param name="checked">Check state, stop renderer if true, else start.</param>
void Fractorium::OnActionStartStopRenderer(bool checked)
{
EnableRenderControls(!checked);
if (checked)
{
m_Controller->StopRenderTimer(true);
ui.ActionStartStopRenderer->setToolTip("Start Renderer");
ui.ActionStartStopRenderer->setIcon(QIcon(":/Fractorium/Icons/control.png"));
}
else
{
m_Controller->StartRenderTimer();
ui.ActionStartStopRenderer->setToolTip("Stop Renderer");
ui.ActionStartStopRenderer->setIcon(QIcon(":/Fractorium/Icons/control-stop-square.png"));
}
}
/// <summary>
/// Sync options data to the check state of the toolbar buttons.
/// This does not trigger a clicked() event.

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B