diff --git a/Builds/MSVC/VS2013/Ember.vcxproj b/Builds/MSVC/VS2013/Ember.vcxproj
index 3160a48..0688dec 100644
--- a/Builds/MSVC/VS2013/Ember.vcxproj
+++ b/Builds/MSVC/VS2013/Ember.vcxproj
@@ -299,6 +299,7 @@
+
diff --git a/Builds/MSVC/VS2013/Ember.vcxproj.filters b/Builds/MSVC/VS2013/Ember.vcxproj.filters
index fb9f959..c5bda1e 100644
--- a/Builds/MSVC/VS2013/Ember.vcxproj.filters
+++ b/Builds/MSVC/VS2013/Ember.vcxproj.filters
@@ -122,6 +122,9 @@
Header Files
+
+ Header Files\Variations
+
diff --git a/Builds/QtCreator/Ember/Ember.pro b/Builds/QtCreator/Ember/Ember.pro
index bf31d8f..9f0ea05 100644
--- a/Builds/QtCreator/Ember/Ember.pro
+++ b/Builds/QtCreator/Ember/Ember.pro
@@ -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 \
diff --git a/Builds/QtCreator/defaults.pri b/Builds/QtCreator/defaults.pri
index 917a1e7..e458994 100644
--- a/Builds/QtCreator/defaults.pri
+++ b/Builds/QtCreator/defaults.pri
@@ -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)
diff --git a/Data/Variations.xlsx b/Data/Variations.xlsx
index 040dd5c..4563f8e 100644
Binary files a/Data/Variations.xlsx and b/Data/Variations.xlsx differ
diff --git a/Data/dark.qss b/Data/dark.qss
index 069ddec..b215a6b 100644
--- a/Data/dark.qss
+++ b/Data/dark.qss
@@ -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;
}
-
\ No newline at end of file
diff --git a/Source/Ember/Ember.cpp b/Source/Ember/Ember.cpp
index 5b7ab1f..7161b8e 100644
--- a/Source/Ember/Ember.cpp
+++ b/Source/Ember/Ember.cpp
@@ -23,6 +23,7 @@ template<> CriticalSection QTIsaac::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; /*Only implemented as post.*/ \
EXPORTPREPOSTREGVAR(DCBubble, T) \
EXPORTPREPOSTREGVAR(DCCarpet, T) \
diff --git a/Source/Ember/Ember.h b/Source/Ember/Ember.h
index 732c63a..0608c34 100644
--- a/Source/Ember/Ember.h
+++ b/Source/Ember/Ember.h
@@ -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));
}
///
diff --git a/Source/Ember/EmberDefines.h b/Source/Ember/EmberDefines.h
index 77558f9..1b4d3f9 100644
--- a/Source/Ember/EmberDefines.h
+++ b/Source/Ember/EmberDefines.h
@@ -64,7 +64,6 @@ namespace EmberNs
#define CX(c) (reinterpret_cast(c))
#define CCX(c) (reinterpret_cast(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))
diff --git a/Source/Ember/EmberToXml.h b/Source/Ember/EmberToXml.h
index 858f2cc..2dcc99e 100644
--- a/Source/Ember/EmberToXml.h
+++ b/Source/Ember/EmberToXml.h
@@ -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 << "";
+ os << "";
else
os << "";
}
else
{
if (intPalette)
- os << " ";
+ os << " ";
else
os << " ";
}
diff --git a/Source/Ember/Utils.h b/Source/Ember/Utils.h
index 6f10e9c..02d8b0e 100644
--- a/Source/Ember/Utils.h
+++ b/Source/Ember/Utils.h
@@ -658,6 +658,22 @@ double SafeTan(double x)
return std::tan(x);
}
+///
+/// If r < EPS, return 1 / r.
+/// Else, return q / r.
+///
+/// The numerator
+/// The denominator
+/// The quotient
+template
+static inline T SafeDivInv(T q, T r)
+{
+ if (r < EPS)
+ return 1 / r;
+
+ return q / r;
+}
+
///
/// Return the cube of the passed in value.
/// This is useful when the value is a result of a computation
diff --git a/Source/Ember/VarFuncs.h b/Source/Ember/VarFuncs.h
index c621e6b..a607bb4 100644
--- a/Source/Ember/VarFuncs.h
+++ b/Source/Ember/VarFuncs.h
@@ -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));
}
///
@@ -279,6 +279,99 @@ public:
return ratiomax;
}
+ ///
+ /// Used in the jac_* variations.
+ ///
+ 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);
private:
diff --git a/Source/Ember/Variation.h b/Source/Ember/Variation.h
index f08c358..7cbb5a7 100644
--- a/Source/Ember/Variation.h
+++ b/Source/Ember/Variation.h
@@ -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*>(reinterpret_cast*>(variation.ParentXform())) : nullptr;
@@ -1147,115 +1192,60 @@ public:
/// Per-variation precalc used for pre and post variations.
///
/// The helper to read values from in the case of pre, and store precalc values to in both cases.
- /// The point to read values from in the case of post, ignored for pre.
- void PrecalcHelper(IteratorHelper& iteratorHelper, Point* point)
+ void PrePostPrecalcHelper(IteratorHelper& 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);
}
///
/// Per-variation precalc OpenCL string used for pre and post variations.
///
/// The per-variation OpenCL precalc string
- 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 "";
}
+ ///
+ /// Returns the base name of the variation without the "pre_" or "post_" prefix.
+ ///
+ /// The base name of the variation
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* ParentXform() const { return m_Xform; }
void ParentXform(Xform* xform) { m_Xform = xform; }
intmax_t IndexInXform() const { return m_Xform ? m_Xform->GetVariationIndex(const_cast*>(this)) : -1; }
@@ -1424,6 +1418,10 @@ public:
T m_Weight;//The weight of the variation.
protected:
+ ///
+ /// Sets the type of the variation depending on whether the name starts with "pre_",
+ /// "post_" or neither.
+ ///
void SetType()
{
if (m_Name.find("pre_") == 0)
@@ -1434,11 +1432,30 @@ protected:
m_VarType = eVariationType::VARTYPE_REG;
}
+ ///
+ /// Return the default Z coordinate assignment value depending on the type of variation and its assign type.
+ ///
+ /// The helper used to retrieve the input Z coordinate.
+ /// The appropriate Z value.
+ T DefaultZ(const IteratorHelper& helper) const
+ {
+ return m_VarType == eVariationType::VARTYPE_REG ? 0 : (m_PrePostAssignType == eVariationAssignType::ASSIGNTYPE_SET ? helper.In.z : 0);
+ }
+
+ ///
+ /// OpenCL equivalent of DefaultZ().
+ ///
+ /// The OpenCL string needed to make the proper Z coordinate assignment
+ string DefaultZCl() const
+ {
+ return m_VarType == eVariationType::VARTYPE_REG ? "0;\n" : (m_PrePostAssignType == eVariationAssignType::ASSIGNTYPE_SET ? "vIn.z;\n" : "0;\n");
+ }
+
Xform* 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::m_VariationId; \
using Variation::m_Name; \
using Variation::m_VarType; \
- using Variation::m_AssignType; \
+ using Variation::m_PrePostAssignType; \
using Variation::SetType; \
using Variation::IndexInXform; \
using Variation::XformIndexInEmber; \
using Variation::Prefix; \
using Variation::Precalc; \
- using Variation::StateOpenCLString;
+ using Variation::StateOpenCLString; \
+ using Variation::DefaultZ; \
+ using Variation::DefaultZCl;
///
/// 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(); \
} \
diff --git a/Source/Ember/VariationList.h b/Source/Ember/VariationList.h
index 8d17269..c993c94 100644
--- a/Source/Ember/VariationList.h
+++ b/Source/Ember/VariationList.h
@@ -6,6 +6,7 @@
#include "Variations04.h"
#include "Variations05.h"
#include "Variations06.h"
+#include "Variations07.h"
#include "VariationsDC.h"
///
@@ -343,6 +344,21 @@ public:
ADDPREPOSTREGVAR(Synth)
ADDPREPOSTREGVAR(Crackle)
m_Variations.push_back(new PostSmartcropVariation());//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.
diff --git a/Source/Ember/Variations01.h b/Source/Ember/Variations01.h
index f4c3053..0d8cf58 100644
--- a/Source/Ember/Variations01.h
+++ b/Source/Ember/Variations01.h
@@ -261,7 +261,7 @@ public:
{
helper.Out.x = m_Weight * helper.m_PrecalcSqrtSumSquares * std::sin(helper.m_PrecalcAtanxy + helper.m_PrecalcSqrtSumSquares);
helper.Out.y = m_Weight * helper.m_PrecalcSqrtSumSquares * std::cos(helper.m_PrecalcAtanxy - helper.m_PrecalcSqrtSumSquares);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -271,7 +271,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares * sin(precalcAtanxy + precalcSqrtSumSquares);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares * cos(precalcAtanxy - precalcSqrtSumSquares);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -299,7 +299,7 @@ public:
T r = m_Weight * helper.m_PrecalcSqrtSumSquares;
helper.Out.x = r * std::sin(a);
helper.Out.y = (-r) * std::cos(a);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -312,7 +312,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * sin(a);\n"
<< "\t\tvOut.y = (-r) * cos(a);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -489,7 +489,7 @@ public:
{
helper.Out.x = m_Weight * helper.m_PrecalcSina * std::cos(helper.m_PrecalcSqrtSumSquares);
helper.Out.y = m_Weight * helper.m_PrecalcCosa * std::sin(helper.m_PrecalcSqrtSumSquares);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -499,7 +499,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * precalcSina * cos(precalcSqrtSumSquares);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * precalcCosa * sin(precalcSqrtSumSquares);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -534,7 +534,7 @@ public:
T m1 = n1 * n1 * n1 * r;
helper.Out.x = m_Weight * (m0 + m1);
helper.Out.y = m_Weight * (m0 - m1);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -551,7 +551,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (m0 + m1);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (m0 - m1);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -585,7 +585,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
@@ -601,7 +601,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();
}
@@ -630,7 +630,7 @@ public:
T ny = helper.In.y < T(0.0) ? helper.In.y / 2 : helper.In.y;
helper.Out.x = m_Weight * nx;
helper.Out.y = m_Weight * ny;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -643,7 +643,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * nx;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * ny;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -678,7 +678,7 @@ public:
T ny = helper.In.y + c11 * std::sin(helper.In.x * m_Dy2);
helper.Out.x = m_Weight * nx;
helper.Out.y = m_Weight * ny;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -697,7 +697,7 @@ public:
<< "\n"
<< "\t\tvOut.x = (xform->m_VariationWeights[" << varIndex << "] * nx);\n"
<< "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * ny);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -750,7 +750,7 @@ public:
T r = 2 * m_Weight / (helper.m_PrecalcSqrtSumSquares + 1);
helper.Out.x = r * helper.In.y;
helper.Out.y = r * helper.In.x;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -762,7 +762,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * vIn.y;\n"
<< "\t\tvOut.y = r * vIn.x;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -793,7 +793,7 @@ public:
T ny = helper.In.y + m_Xform->m_Affine.F() * std::sin(dy);
helper.Out.x = m_Weight * nx;
helper.Out.y = m_Weight * ny;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -808,7 +808,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * nx;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * ny;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -837,7 +837,7 @@ public:
T dy = T(M_PI) * helper.In.y;
helper.Out.x = dx * std::cos(dy);
helper.Out.y = dx * std::sin(dy);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -850,7 +850,7 @@ public:
<< "\n"
<< "\t\tvOut.x = dx * cos(dy);\n"
<< "\t\tvOut.y = dx * sin(dy);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -880,7 +880,7 @@ public:
T r = m_Weight * std::pow(helper.m_PrecalcSqrtSumSquares, helper.m_PrecalcSina);
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
@@ -892,7 +892,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();
}
@@ -920,7 +920,7 @@ public:
T ny = -std::sin(a) * std::sinh(helper.In.y);
helper.Out.x = m_Weight * nx;
helper.Out.y = m_Weight * ny;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -934,7 +934,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * nx;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * ny;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -967,7 +967,7 @@ public:
r = m_Weight * (fmod(r + dx, 2 * dx) - dx + r * (1 - dx));
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
@@ -981,7 +981,7 @@ public:
<< "\t\tr = xform->m_VariationWeights[" << varIndex << "] * (fmod(r + dx, 2 * dx) - dx + r * (1 - dx));\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();
}
@@ -1024,7 +1024,7 @@ public:
a += (fmod(a + dy, dx) > dx2) ? -dx2 : dx2;
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
@@ -1040,7 +1040,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();
}
@@ -1078,7 +1078,7 @@ public:
T r = helper.m_PrecalcSqrtSumSquares * (m_BlobLow + m_BlobDiff * (T(0.5) + T(0.5) * std::sin(m_BlobWaves * helper.m_PrecalcAtanxy)));
helper.Out.x = m_Weight * helper.m_PrecalcSina * r;
helper.Out.y = m_Weight * helper.m_PrecalcCosa * r;
- helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -1096,7 +1096,7 @@ public:
<< "\n"
<< "\t\tvOut.x = (xform->m_VariationWeights[" << varIndex << "] * precalcSina * r);\n"
<< "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * precalcCosa * r);\n"
- << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -1445,7 +1445,7 @@ public:
T r = m_Weight / denom;
helper.Out.x = r * helper.In.x;
helper.Out.y = r * helper.In.y;
- helper.Out.z = m_Weight * (2 / denom - 1);
+ helper.Out.z = m_Weight * (2 / Zeps(denom - 1));
}
virtual string OpenCLString() const override
@@ -1458,10 +1458,15 @@ public:
<< "\n"
<< "\t\tvOut.x = r * vIn.x;\n"
<< "\t\tvOut.y = r * vIn.y;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (2 / denom - 1);\n"
+ << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (2 / Zeps(denom - 1));\n"
<< "\t}\n";
return ss.str();
}
+
+ virtual vector OpenCLGlobalFuncNames() const override
+ {
+ return vector { "Zeps" };
+ }
};
///
@@ -1515,7 +1520,7 @@ public:
T t = 1 / d;
helper.Out.x = m_Weight * m_Dist * helper.In.x * t;
helper.Out.y = m_Weight * m_VfCos * helper.In.y * t;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -1534,7 +1539,7 @@ public:
<< "\n"
<< "\t\tvOut.x = (xform->m_VariationWeights[" << varIndex << "] * " << dist << " * vIn.x * t);\n"
<< "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * " << vfCos << " * vIn.y * t);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -1786,7 +1791,7 @@ protected:
string prefix = Prefix();
m_Params.clear();
m_Params.push_back(ParamWithName(&m_Dist, prefix + "juliascope_dist", 1));//Params.
- m_Params.push_back(ParamWithName(&m_Power, prefix + "juliascope_power", 1));
+ m_Params.push_back(ParamWithName(&m_Power, prefix + "juliascope_power", 1, eParamType::REAL_NONZERO));
m_Params.push_back(ParamWithName(true, &m_Rn, prefix + "juliascope_rn"));//Precalc.
m_Params.push_back(ParamWithName(true, &m_Cn, prefix + "juliascope_cn"));
}
@@ -1970,6 +1975,7 @@ public:
T r = m_Weight * rand.Frand01();
helper.Out.x = r * std::cos(a);
helper.Out.y = r * std::sin(a);
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -1988,7 +1994,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();
}
@@ -2148,7 +2154,7 @@ public:
T r = m_Weight / Zeps(SQR(re) + SQR(im));
helper.Out.x = (helper.In.x * re + helper.In.y * im) * r;
helper.Out.y = (helper.In.y * re - helper.In.x * im) * r;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -2167,7 +2173,7 @@ public:
<< "\n"
<< "\t\tvOut.x = (vIn.x * re + vIn.y * im) * r;\n"
<< "\t\tvOut.y = (vIn.y * re - vIn.x * im) * r;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -2295,7 +2301,7 @@ public:
sincos(angle, &sinr, &cosr);
helper.Out.x = m_Weight * sinr;
helper.Out.y = m_Weight * (sinr * sinr) / cosr;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -2309,7 +2315,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sinr;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (sinr * sinr) / cosr;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -2330,7 +2336,7 @@ public:
{
helper.Out.x = m_Weight * std::sin(helper.In.x) / std::cos(helper.In.y);
helper.Out.y = m_Weight * SafeTan(helper.In.y);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -2340,7 +2346,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) / cos(vIn.y);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * tan(vIn.y);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -2395,7 +2401,7 @@ public:
T tanr = m_Weight * SafeTan(ang) * r;
helper.Out.x = tanr * std::cos(helper.In.x);
helper.Out.y = tanr * std::sin(helper.In.y);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -2409,7 +2415,7 @@ public:
<< "\n"
<< "\t\tvOut.x = tanr * cos(vIn.x);\n"
<< "\t\tvOut.y = tanr * sin(vIn.y);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -2438,7 +2444,7 @@ public:
sincos(r, &sinr, &cosr);
helper.Out.x = m_Weight * helper.In.x * (cosr + sinr);
helper.Out.y = m_Weight * helper.In.x * (cosr - sinr);
- helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -2452,7 +2458,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x * (cosr + sinr);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.x * (cosr - sinr);\n"
- << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -2481,7 +2487,7 @@ public:
else
helper.Out.y = m_Weight * (icr - 1);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -2500,7 +2506,7 @@ public:
<< "\t\telse\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * (icr - (real_t)(1.0));\n"
<< "\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -2529,7 +2535,7 @@ public:
helper.Out.x = m_Weight * helper.In.x * diff;
helper.Out.y = m_Weight * helper.In.x * (diff - sinr * T(M_PI));
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -2547,7 +2553,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x * diff;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.x * (diff - sinr * M_PI);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -2614,7 +2620,7 @@ public:
r = m_Weight * helper.m_PrecalcAtanxy / T(M_PI);
helper.Out.x = (sinr + m_CosAdd) * r;
helper.Out.y = (cosr + m_SinAdd) * r;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -2636,7 +2642,7 @@ public:
<< "\n"
<< "\t\tvOut.x = (sinr + " << cosAdd << ") * r;\n"
<< "\t\tvOut.y = (cosr + " << sinAdd << ") * r;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -2714,7 +2720,7 @@ public:
* std::pow(t1 + t2, m_PNeg1N1) / helper.m_PrecalcSqrtSumSquares;
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
@@ -2741,7 +2747,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();
}
@@ -2808,7 +2814,7 @@ public:
T r = m_Weight * (rand.Frand01() - m_Holes) * std::cos(m_Petals * theta) / helper.m_PrecalcSqrtSumSquares;
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
@@ -2825,7 +2831,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();
}
@@ -2871,7 +2877,7 @@ public:
m_Eccentricity / (1 + m_Eccentricity * ct) / helper.m_PrecalcSqrtSumSquares;
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
@@ -2888,7 +2894,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();
}
@@ -2933,7 +2939,7 @@ public:
sincos(helper.m_PrecalcSqrtSumSquares, &sr, &cr);
helper.Out.x = m_Height * m_Weight * sr * sr * rand.Frand01();
helper.Out.y = m_Width * m_Weight * cr * rand.Frand01();
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -2950,7 +2956,7 @@ public:
<< "\n"
<< "\t\tvOut.x = " << height << " * (xform->m_VariationWeights[" << varIndex << "] * sr * sr * MwcNext01(mwc));\n"
<< "\t\tvOut.y = " << width << " * (xform->m_VariationWeights[" << varIndex << "] * cr * MwcNext01(mwc));\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -3001,7 +3007,7 @@ public:
else
helper.Out.y = m_Vy * helper.In.y;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -3025,7 +3031,7 @@ public:
<< "\t\telse\n"
<< "\t\tvOut.y = " << vy << " * vIn.y;\n"
<< "\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -3223,12 +3229,12 @@ public:
virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override
{
- 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;
- if (rand.Frand01() >= 0.75)
+ if (rand.Frand01() >= T(0.75))
{
helper.Out.x = m_Weight * (offsetX * T(0.5) + roundX);
helper.Out.y = m_Weight * (offsetY * T(0.5) + roundY);
@@ -3237,7 +3243,7 @@ public:
{
if (std::abs(offsetX) >= std::abs(offsetY))
{
- if (offsetX >= 0.0)
+ if (offsetX >= 0)
{
helper.Out.x = m_Weight * (offsetX * T(0.5) + roundX + T(0.25));
helper.Out.y = m_Weight * (offsetY * T(0.5) + roundY + T(0.25) * offsetY / offsetX);
@@ -3250,7 +3256,7 @@ public:
}
else
{
- if (offsetY >= 0.0)
+ if (offsetY >= 0)
{
helper.Out.y = m_Weight * (offsetY * T(0.5) + roundY + T(0.25));
helper.Out.x = m_Weight * (offsetX * T(0.5) + roundX + offsetX / offsetY * T(0.25));
@@ -3263,7 +3269,7 @@ public:
}
}
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -3271,8 +3277,8 @@ public:
ostringstream ss;
intmax_t varIndex = IndexInXform();
ss << "\t{\n"
- << "\t\treal_t roundX = Rint(vIn.x);\n"
- << "\t\treal_t roundY = Rint(vIn.y);\n"
+ << "\t\treal_t roundX = rint(vIn.x);\n"
+ << "\t\treal_t roundY = rint(vIn.y);\n"
<< "\t\treal_t offsetX = vIn.x - roundX;\n"
<< "\t\treal_t offsetY = vIn.y - roundY;\n"
<< "\n"
@@ -3311,7 +3317,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();
}
@@ -3335,7 +3341,7 @@ public:
T r = wx * std::sqrt(std::abs(helper.In.y * helper.In.x) / Zeps(SQR(helper.In.x) + SQR(y2)));
helper.Out.x = r * helper.In.x;
helper.Out.y = r * y2;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -3349,7 +3355,7 @@ public:
<< "\n"
<< "\t\tvOut.x = r * vIn.x;\n"
<< "\t\tvOut.y = r * y2;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -3412,7 +3418,7 @@ public:
helper.Out.x = m_Weight * (dx + x * m_Size);
helper.Out.y = -(m_Weight * (dy + y * m_Size));
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
///
@@ -3469,7 +3475,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (dx + x * " << size << ");\n"
<< "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * (dy + y * " << size << "));\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -3513,7 +3519,7 @@ public:
T m = m_Weight * std::exp(m_C * lnr - m_D * a);
helper.Out.x = m * std::cos(angle);
helper.Out.y = m * std::sin(angle);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -3536,7 +3542,7 @@ public:
<< "\n"
<< "\t\tvOut.x = m * cos(angle);\n"
<< "\t\tvOut.y = m * sin(angle);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -3595,7 +3601,7 @@ public:
{
helper.Out.x = m_Weight * helper.In.x + m_XAmpV * std::exp(-helper.In.y * helper.In.y * m_XLengthV);
helper.Out.y = m_Weight * helper.In.y + m_YAmpV * std::exp(-helper.In.x * helper.In.x * m_YLengthV);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -3615,7 +3621,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x + " << xAmpV << " * exp(-vIn.y * vIn.y * " << xLengthV << ");\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y + " << yAmpV << " * exp(-vIn.x * vIn.x * " << yLengthV << ");\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -3693,7 +3699,7 @@ public:
helper.Out.x = w * cshu * csv;
helper.Out.y = w * snhu * snv;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -3717,7 +3723,7 @@ public:
<< "\t\t snv = -snv;\n"
<< "\t\tvOut.x = w * cshu * csv;\n"
<< "\t\tvOut.y = w * snhu * snv;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -3764,7 +3770,7 @@ public:
else
helper.Out.y = -(w * std::log(xmax + ssx));
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -3800,7 +3806,7 @@ public:
<< "\t\telse\n"
<< "\t\t vOut.y = -(w * log(xmax + ssx));\n"
<< "\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -4179,7 +4185,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
@@ -4207,7 +4213,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();
}
@@ -4276,7 +4282,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
@@ -4309,7 +4315,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();
}
@@ -4422,7 +4428,7 @@ public:
{
helper.Out.x = m_Weight * (helper.In.x + m_X * std::sin(SafeTan(helper.In.y * m_C)));
helper.Out.y = m_Weight * (helper.In.y + m_Y * std::sin(SafeTan(helper.In.x * m_C)));
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -4437,7 +4443,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + " << x << " * sin(tan(vIn.y * " << c << ")));\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + " << y << " * sin(tan(vIn.x * " << c << ")));\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -4488,7 +4494,7 @@ public:
T r = 1 / Zeps(helper.m_PrecalcSqrtSumSquares * (t + m_InvWeight));
helper.Out.x = helper.In.x * r;
helper.Out.y = helper.In.y * r;
- helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -4504,7 +4510,7 @@ public:
<< "\n"
<< "\t\tvOut.x = vIn.x * r;\n"
<< "\t\tvOut.y = vIn.y * r;\n"
- << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -4650,7 +4656,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
@@ -4674,7 +4680,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();
}
@@ -4735,7 +4741,7 @@ public:
else
helper.Out.y = m_Weight * (helper.In.y - m_Y);
- helper.Out.z = m_Weight * helper.In.z;//Original does *not* have this. search through all for this and sync.//TODO!
+ helper.Out.z = m_Weight * helper.In.z;//Original from flam3 does not have this, but the apo implementation does, so use Apo since it's more recent.
}
virtual string OpenCLString() const override
@@ -4802,7 +4808,7 @@ public:
T offsetx = helper.In.x - roundx;
helper.Out.x = m_Weight * (offsetx * (1 - m_Space) + roundx);
helper.Out.y = m_Weight * (helper.In.y + offsetx * offsetx * m_Warp);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -4819,7 +4825,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (offsetx * ((real_t)(1.0) - " << space << ") + roundx);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + offsetx * offsetx * " << warp << ");\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -4951,7 +4957,7 @@ public:
a = a * m_Cf + c * m_Angle;
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
@@ -4976,7 +4982,7 @@ public:
<< "\t\ta = a * " << cf << " + c * " << angle << ";\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();
}
@@ -5038,13 +5044,12 @@ public:
{
T r = 1 / Zeps(helper.m_PrecalcSqrtSumSquares);
T a = helper.m_PrecalcAtanyx + m_Swirl * r;
- T c = T(Floor((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5)));
- T compFac = 1 - m_Angle * m_Count * T(M_1_PI) * T(0.5);
- a = a * compFac + c * m_Angle;
- r = m_Weight * (r + m_Hole);
- helper.Out.x = r * std::cos(a);
- helper.Out.y = r * std::sin(a);
- helper.Out.z = m_Weight * helper.In.z;
+ auto c = Floor((m_Count * a + T(M_PI)) * m_C12Pi);
+ a = a * m_CompFac + c * m_Angle;
+ T temp = m_Weight * (r + m_Hole);
+ helper.Out.x = temp * std::cos(a);
+ helper.Out.y = temp * std::sin(a);
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5053,21 +5058,22 @@ public:
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
- string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
- string count = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
- string hole = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
- string swirl = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string count = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hole = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string swirl = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string c12pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string compfac = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t r = (real_t)(1.0) / Zeps(precalcSqrtSumSquares);\n"
<< "\t\treal_t a = precalcAtanyx + " << swirl << " * r;\n"
- << "\t\treal_t c = floor((" << count << " * a + M_PI) * M_1_PI * (real_t)(0.5));\n"
- << "\t\treal_t compFac = 1 - " << angle << " * " << count << " * M_1_PI * (real_t)(0.5);\n"
+ << "\t\treal_t c = floor((" << count << " * a + M_PI) * " << c12pi << "); \n"
<< "\n"
- << "\t\ta = a * compFac + c * " << angle << ";\n"
- << "\t\tr = xform->m_VariationWeights[" << varIndex << "] * (r + " << hole << ");\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\ta = a * " << compfac << " + c * " << angle << ";\n"
+ << "\t\treal_t temp = xform->m_VariationWeights[" << varIndex << "] * (r + " << hole << ");\n"
+ << "\t\tvOut.x = temp * cos(a);\n"
+ << "\t\tvOut.y = temp * sin(a);\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5085,15 +5091,23 @@ public:
m_Swirl = rand.Frand01();
}
+ virtual void Precalc() override
+ {
+ m_C12Pi = T(M_1_PI) / 2;
+ m_CompFac = 1 - m_Angle * m_Count * m_C12Pi;
+ }
+
protected:
void Init()
{
string prefix = Prefix();
m_Params.clear();
- m_Params.push_back(ParamWithName(&m_Angle, prefix + "wedge_sph_angle"));
- m_Params.push_back(ParamWithName(&m_Count, prefix + "wedge_sph_hole", 1));
- m_Params.push_back(ParamWithName(&m_Hole, prefix + "wedge_sph_count"));
+ m_Params.push_back(ParamWithName(&m_Angle, prefix + "wedge_sph_angle", T(M_PI_2)));
+ m_Params.push_back(ParamWithName(&m_Count, prefix + "wedge_sph_count", 2, eParamType::INTEGER, 1));
+ m_Params.push_back(ParamWithName(&m_Hole, prefix + "wedge_sph_hole"));
m_Params.push_back(ParamWithName(&m_Swirl, prefix + "wedge_sph_swirl"));
+ m_Params.push_back(ParamWithName(true, &m_C12Pi, prefix + "wedge_sph_c1_2pi"));
+ m_Params.push_back(ParamWithName(true, &m_CompFac, prefix + "wedge_sph_comp_fac"));
}
private:
@@ -5101,6 +5115,8 @@ private:
T m_Count;
T m_Hole;
T m_Swirl;
+ T m_C12Pi;//Precalc.
+ T m_CompFac;
};
///
@@ -5128,7 +5144,7 @@ public:
helper.Out.x = m_Weight * r * std::cos(a);
helper.Out.y = m_Weight * r * std::sin(a);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5150,7 +5166,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 = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5264,7 +5280,7 @@ public:
T expe = m_Weight * std::exp(helper.In.x);
helper.Out.x = expe * std::cos(helper.In.y);
helper.Out.y = expe * std::sin(helper.In.y);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5276,7 +5292,7 @@ public:
<< "\n"
<< "\t\tvOut.x = expe * cos(vIn.y);\n"
<< "\t\tvOut.y = expe * sin(vIn.y);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5353,7 +5369,7 @@ public:
{
helper.Out.x = m_Weight * std::sin(helper.In.x) * cosh(helper.In.y);
helper.Out.y = m_Weight * std::cos(helper.In.x) * sinh(helper.In.y);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5363,7 +5379,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) * cosh(vIn.y);\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cos(vIn.x) * sinh(vIn.y);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5385,7 +5401,7 @@ public:
//clamp fabs x and y to 7.104760e+002 for cosh, and |x| 7.104760e+002 for sinh
helper.Out.x = m_Weight * std::cos(helper.In.x) * cosh(helper.In.y);
helper.Out.y = -(m_Weight * std::sin(helper.In.x) * sinh(helper.In.y));
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5395,7 +5411,7 @@ public:
ss << "\t{\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cos(vIn.x) * cosh(vIn.y);\n"
<< "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) * sinh(vIn.y));\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5421,7 +5437,7 @@ public:
tanden = 1 / (tancos + tancosh);
helper.Out.x = m_Weight * tanden * tansin;
helper.Out.y = m_Weight * tanden * tansinh;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5437,7 +5453,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * tanden * tansin;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * tanden * tansinh;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5463,7 +5479,7 @@ public:
secden = 2 / (cos(2 * helper.In.x) + cosh(2 * helper.In.y));
helper.Out.x = m_Weight * secden * seccos * seccosh;
helper.Out.y = m_Weight * secden * secsin * secsinh;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5479,7 +5495,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * secden * seccos * seccosh;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * secden * secsin * secsinh;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5505,7 +5521,7 @@ public:
cscden = 2 / (std::cosh(2 * helper.In.y) - std::cos(2 * helper.In.x));
helper.Out.x = m_Weight * cscden * cscsin * csccosh;
helper.Out.y = -(m_Weight * cscden * csccos * cscsinh);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5521,7 +5537,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cscden * cscsin * csccosh;\n"
<< "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * cscden * csccos * cscsinh);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5547,7 +5563,7 @@ public:
cotden = 1 / (cotcosh - cotcos);
helper.Out.x = m_Weight * cotden * cotsin;
helper.Out.y = m_Weight * cotden * -1 * cotsinh;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5563,7 +5579,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cotden * cotsin;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cotden * -1 * cotsinh;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5588,7 +5604,7 @@ public:
sinhcosh = cosh(helper.In.x);
helper.Out.x = m_Weight * sinhsinh * sinhcos;
helper.Out.y = m_Weight * sinhcosh * sinhsin;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5603,7 +5619,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sinhsinh * sinhcos;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinhcosh * sinhsin;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5628,7 +5644,7 @@ public:
coshcosh = cosh(helper.In.x);
helper.Out.x = m_Weight * coshcosh * coshcos;
helper.Out.y = m_Weight * coshsinh * coshsin;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5643,7 +5659,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * coshcosh * coshcos;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * coshsinh * coshsin;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5669,7 +5685,7 @@ public:
tanhden = 1 / (tanhcos + tanhcosh);
helper.Out.x = m_Weight * tanhden * tanhsinh;
helper.Out.y = m_Weight * tanhden * tanhsin;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5685,7 +5701,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * tanhden * tanhsinh;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * tanhden * tanhsin;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5711,7 +5727,7 @@ public:
sechden = 2 / (cos(2 * helper.In.y) + cosh(2 * helper.In.x));
helper.Out.x = m_Weight * sechden * sechcos * sechcosh;
helper.Out.y = -(m_Weight * sechden * sechsin * sechsinh);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5727,7 +5743,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sechden * sechcos * sechcosh;\n"
<< "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * sechden * sechsin * sechsinh);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5753,7 +5769,7 @@ public:
cschden = 2 / (std::cosh(2 * helper.In.x) - std::cos(2 * helper.In.y));
helper.Out.x = m_Weight * cschden * cschsinh * cschcos;
helper.Out.y = -(m_Weight * cschden * cschcosh * cschsin);
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5769,7 +5785,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cschden * cschsinh * cschcos;\n"
<< "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * cschden * cschcosh * cschsin);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5795,7 +5811,7 @@ public:
cothden = 1 / (cothcosh - cothcos);
helper.Out.x = m_Weight * cothden * cothsinh;
helper.Out.y = m_Weight * cothden * cothsin;
- helper.Out.z = m_Weight * helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -5811,7 +5827,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cothden * cothsinh;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cothden * cothsin;\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -5919,7 +5935,7 @@ public:
T avga = (atan2(helper.In.y, xmw) - atan2(helper.In.y, xpw)) * T(0.5);
helper.Out.x = avgr * std::cos(avga);
helper.Out.y = avgr * std::sin(avga);
- helper.Out.z = helper.In.z;
+ helper.Out.z = helper.In.z;//Apo does not use weight, sums only z. Sum here for reg, else assign.
}
virtual string OpenCLString() const override
@@ -5944,7 +5960,7 @@ public:
<< "\n"
<< "\t\tvOut.x = avgr * cos(avga);\n"
<< "\t\tvOut.y = avgr * sin(avga);\n"
- << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
+ << "\t\tvOut.z = vIn.z;\n"
<< "\t}\n";
return ss.str();
}
diff --git a/Source/Ember/Variations02.h b/Source/Ember/Variations02.h
index e193e26..cf33d3f 100644
--- a/Source/Ember/Variations02.h
+++ b/Source/Ember/Variations02.h
@@ -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();
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(0.5));
helper.Out.y = m_V * (rand.Frand01() - 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(m_AmountY, m_Py);
helper.Out.x = -1 + m_Vv2 * Lerp(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(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(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(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(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)
diff --git a/Source/Ember/Variations03.h b/Source/Ember/Variations03.h
index 12aa946..c2619fe 100644
--- a/Source/Ember/Variations03.h
+++ b/Source/Ember/Variations03.h
@@ -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(rand.Frand01() * 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(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(helper.In.x) * m_Weight;
helper.Out.y = std::sin(u) * SafeTan(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() * 2 - 1) / T(M_PI) : std::acos(std::exp(std::log(rand.Frand01()) * 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() * 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(helper.In.x) * std::pow(std::abs(helper.In.x), m_PowX) * m_Weight;
helper.Out.y = SignNz(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(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();
}
diff --git a/Source/Ember/Variations04.h b/Source/Ember/Variations04.h
index b78bca4..6fc82c2 100644
--- a/Source/Ember/Variations04.h
+++ b/Source/Ember/Variations04.h
@@ -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(0.5)) * r);
helper.Out.y = m_Weight * (helper.In.y + (rand.Frand01() - 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(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();
}
diff --git a/Source/Ember/Variations05.h b/Source/Ember/Variations05.h
index 7ab5142..5041573 100644
--- a/Source/Ember/Variations05.h
+++ b/Source/Ember/Variations05.h
@@ -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:
///
/// 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.
///
template
class EMBER_API Waves23DVariation : public ParametricVariation
@@ -2130,8 +2130,8 @@ public:
virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& 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();
}
diff --git a/Source/Ember/Variations06.h b/Source/Ember/Variations06.h
index fb50af5..1fec36c 100644
--- a/Source/Ember/Variations06.h
+++ b/Source/Ember/Variations06.h
@@ -46,7 +46,12 @@ public:
//Infinite number of small cells? No effect . . .
if (s == 0)
+ {
+ helper.Out.x = 0;
+ helper.Out.y = 0;
+ helper.Out.z = DefaultZ(helper);
return;
+ }
//Get co-ordinates, and convert to hex co-ordinates.
u.x = helper.In.x;
@@ -96,7 +101,7 @@ public:
DYo = u.y - P[0].y;
//Apply "interesting bit" to cell's DXo and DYo co-ordinates.
//trgL is the defined value of l, independent of any rotation.
- trgL = std::pow(Zeps(L1), m_Power) * m_Scale;//Original added 1e-100, use Zeps to be more precise.
+ trgL = std::pow(std::abs(L1), m_Power) * m_Scale;//Original added 1e-100, use Zeps to be more precise.
//Rotate.
v.x = DXo * m_RotCos + DYo * m_RotSin;
v.y = -DXo * m_RotSin + DYo * m_RotCos;
@@ -110,7 +115,7 @@ public:
//L is maximum of L1 or L2 . . .
//When L = 0.8 or higher . . . match trgL/L2 exactly.
//When L = T(0.5) or less . . . match trgL/L1 exactly.
- L = (L1 > L2) ? L1 : L2;
+ L = std::max(L1, L2);
if (L < T(0.5))
{
@@ -130,7 +135,7 @@ public:
//Finally add values in.
helper.Out.x = m_Weight * v.x;
helper.Out.y = m_Weight * v.y;
- helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -155,7 +160,12 @@ public:
<< "\t\ts = " << cellsize << ";\n"
<< "\n"
<< "\t\tif (s == 0)\n"
- << "\t\t return;\n"
+ << "\t\t{\n"
+ << "\t\t vOut.x = 0;\n"
+ << "\t\t vOut.y = 0;\n"
+ << "\t\t vOut.z = " << DefaultZCl()
+ << "\t\t return;\n"
+ << "\t\t}\n"
<< "\n"
<< "\t\tU.x = vIn.x;\n"
<< "\t\tU.y = vIn.y;\n"
@@ -201,7 +211,7 @@ public:
<< "\t\tDXo = U.x - P[0].x;\n"
<< "\t\tDYo = U.y - P[0].y;\n"
<< "\n"
- << "\t\ttrgL = pow(Zeps(L1), " << power << ") * " << scale << ";\n"
+ << "\t\ttrgL = pow(fabs(L1), " << power << ") * " << scale << ";\n"
<< "\n"
<< "\t\tVx = DXo * " << rotcos << " + DYo * " << rotsin << ";\n"
<< "\t\tVy = -DXo * " << rotsin << " + DYo * " << rotcos << ";\n"
@@ -209,8 +219,7 @@ public:
<< "\t\tU.x = Vx + P[0].x;\n"
<< "\t\tU.y = Vy + P[0].y;\n"
<< "\t\tL2 = Voronoi(&P[0], 7, 0, &U);\n"
- << "\n"
- << "\t\tL = (L1 > L2) ? L1 : L2;\n"
+ << "\t\tL = max(L1, L2);\n"
<< "\n"
<< "\t\tif (L < 0.5)\n"
<< "\t\t{\n"
@@ -232,7 +241,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}\n";
return ss.str();
}
@@ -366,7 +375,7 @@ public:
params.Y = m_Sina * xTmp + m_Cosa * yTmp;
helper.Out.x = m_AdjustedWeight * params.X;
helper.Out.y = m_AdjustedWeight * params.Y;
- helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -441,7 +450,7 @@ public:
<< "\n"
<< "\t\tvOut.x = " << adjustedWeight << " * params.X;\n"
<< "\t\tvOut.y = " << adjustedWeight << " * params.Y;\n"
- << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -1544,7 +1553,7 @@ public:
helper.Out.x = xTmp;
helper.Out.y = yTmp;
- helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -1646,7 +1655,7 @@ public:
<< "\n"
<< "\t\tvOut.x = xTmp;\n"
<< "\t\tvOut.y = yTmp;\n"
- << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -2737,7 +2746,7 @@ public:
break;
}
- helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual string OpenCLString() const override
@@ -3092,7 +3101,7 @@ public:
<< "\t\t break;\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();
}
@@ -3749,7 +3758,7 @@ public:
dO += p[4];
helper.Out.x = m_Weight * dO.x;
helper.Out.y = m_Weight * dO.y;
- helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z;
+ helper.Out.z = DefaultZ(helper);
}
virtual vector OpenCLGlobalFuncNames() const override
@@ -3847,7 +3856,7 @@ public:
<< "\t\tdO += p[4];\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * dO.x;\n"
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * dO.y;\n"
- << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n"
+ << "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@@ -3920,7 +3929,7 @@ class EMBER_API PostSmartcropVariation : public ParametricVariation
public:
PostSmartcropVariation(T weight = 1.0) : ParametricVariation("post_smartcrop", eVariationId::VAR_POST_SMARTCROP, weight)
{
- m_AssignType = eVariationAssignType::ASSIGNTYPE_SET;
+ m_PrePostAssignType = eVariationAssignType::ASSIGNTYPE_SET;
m_VarType = eVariationType::VARTYPE_POST;//Very special usage, post only.
Init();
}
@@ -4417,6 +4426,984 @@ private:
T m_C;
};
+///
+/// erf.
+///
+template
+class EMBER_API ErfVariation : public Variation
+{
+public:
+ ErfVariation(T weight = 1.0) : Variation("erf", eVariationId::VAR_ERF, weight) { }
+
+ VARCOPY(ErfVariation)
+
+ virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override
+ {
+ helper.Out.x = m_Weight * std::erf(helper.In.x);
+ helper.Out.y = m_Weight * std::erf(helper.In.y);
+ helper.Out.z = DefaultZ(helper);
+ }
+
+ virtual string OpenCLString() const override
+ {
+ ostringstream ss;
+ intmax_t varIndex = IndexInXform();
+ ss << "\t{\n"
+ << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * erf(vIn.x);\n"
+ << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * erf(vIn.y);\n"
+ << "\t\tvOut.z = " << DefaultZCl()
+ << "\t}\n";
+ return ss.str();
+ }
+};
+
+///
+/// xerf.
+///
+template
+class EMBER_API XerfVariation : public Variation
+{
+public:
+ XerfVariation(T weight = 1.0) : Variation("xerf", eVariationId::VAR_XERF, weight, true) { }
+
+ VARCOPY(XerfVariation)
+
+ virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override
+ {
+ T r2 = Sqr(std::sqrt(helper.m_PrecalcSumSquares + SQR(helper.In.z)));
+ helper.Out.x = m_Weight * (std::abs(helper.In.x) >= 2 ? helper.In.x / r2 : std::erf(helper.In.x));
+ helper.Out.y = m_Weight * (std::abs(helper.In.y) >= 2 ? helper.In.y / r2 : std::erf(helper.In.y));
+ helper.Out.z = m_Weight * (std::abs(helper.In.z) >= 2 ? helper.In.z / r2 : std::erf(helper.In.z));
+ }
+
+ virtual string OpenCLString() const override
+ {
+ ostringstream ss;
+ intmax_t varIndex = IndexInXform();
+ ss << "\t{\n"
+ << "\t\treal_t r2 = Sqr(sqrt(precalcSumSquares + SQR(vIn.z)));\n"
+ << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (fabs(vIn.x) >= 2 ? vIn.x / r2 : erf(vIn.x));\n"
+ << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (fabs(vIn.y) >= 2 ? vIn.y / r2 : erf(vIn.y));\n"
+ << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (fabs(vIn.z) >= 2 ? vIn.z / r2 : erf(vIn.z));\n"
+ << "\t}\n";
+ return ss.str();
+ }
+
+ virtual vector OpenCLGlobalFuncNames() const override
+ {
+ return vector { "Sqr" };
+ }
+};
+
+template
+class EMBER_API WVariation : public ParametricVariation
+{
+public:
+ WVariation(T weight = 1.0) : ParametricVariation("w", eVariationId::VAR_W, weight, true, true, false, false, true)
+ {
+ Init();
+ }
+
+ PARVARCOPY(WVariation)
+
+ virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override
+ {
+ T a = helper.m_PrecalcAtanyx;
+ T r = helper.m_PrecalcSqrtSumSquares;
+ T a2 = a + m_Angle;
+
+ if (a2 < -T(M_PI))
+ a2 += M_2PI;
+
+ if (a2 > T(M_PI))
+ a2 -= M_2PI;
+
+ T s, c;
+ T total = 0;
+ T total2 = 0;
+ T temp1, temp2, temp3, temp4;
+
+ if (m_Hypergon != 0)
+ {
+ temp1 = fmod(std::abs(a), M_2PI / m_HypergonN) - T(M_PI) / m_HypergonN;
+ temp2 = Sqr(std::tan(temp1)) + 1;
+
+ if (temp2 >= Sqr(m_HypergonD))
+ {
+ total += m_Hypergon;
+ }
+ else
+ {
+ temp3 = m_HypergonD;
+ total += m_Hypergon * (m_HypergonD - std::sqrt(Sqr(m_HypergonD) - temp2)) / std::sqrt(temp2);
+ }
+ }
+
+ if (m_Star != 0)
+ {
+ temp1 = std::tan(std::abs(fmod(std::abs(a), M_2PI / m_StarN) - T(M_PI) / m_StarN));
+ total += m_Star * std::sqrt(Sqr(m_TanStarSlope) * (1 + Sqr(temp1)) / Sqr(temp1 + m_TanStarSlope));
+ }
+
+ if (m_Lituus != 0)
+ {
+ total += m_Lituus * std::pow(std::abs(a / T(M_PI) + 1), m_InvLituusA);
+ }
+
+ if (m_Super != 0)
+ {
+ temp4 = a * m_SuperM4th;
+ sincos(temp4, &s, &c);
+ total += m_Super * std::pow(std::pow(std::abs(c), m_SuperN2) + std::pow(std::abs(s), m_SuperN3), m_OneOverSuperN1);
+ }
+
+ if (r <= total)
+ {
+ if (m_Hypergon != 0.0)
+ {
+ temp1 = fmod(std::abs(a2), M_2PI / m_HypergonN) - T(M_PI) / m_HypergonN;
+ temp2 = Sqr(std::tan(temp1)) + 1;
+
+ if (temp2 >= Sqr(m_HypergonD))
+ {
+ total2 += m_Hypergon;
+ }
+ else
+ {
+ temp3 = m_HypergonD;
+ total2 += m_Hypergon * (m_HypergonD - std::sqrt(Sqr(m_HypergonD) - temp2)) / std::sqrt(temp2);
+ }
+ }
+
+ if (m_Star != 0)
+ {
+ temp1 = std::tan(std::abs(fmod(std::abs(a2), M_2PI / m_StarN) - T(M_PI) / m_StarN));
+ total2 += m_Star * std::sqrt(Sqr(m_TanStarSlope) * (1 + Sqr(temp1)) / Sqr(temp1 + m_TanStarSlope));
+ }
+
+ if (m_Lituus != 0)
+ {
+ total2 += m_Lituus * std::pow(std::abs(a2 / T(M_PI) + 1), m_InvLituusA);
+ }
+
+ if (m_Super != 0)
+ {
+ temp4 = a2 * m_SuperM4th;
+ sincos(temp4, &s, &c);
+ total2 += m_Super * std::pow(std::pow(std::abs(c), m_SuperN2) + std::pow(std::abs(s), m_SuperN3), m_OneOverSuperN1);
+ }
+
+ r = m_Weight * total2 * r / total;
+ sincos(a2, &s, &c);
+ helper.Out.x = r * c;
+ helper.Out.y = r * s;
+ }
+ else
+ {
+ helper.Out.x = m_Weight * helper.In.x;
+ helper.Out.y = m_Weight * 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 angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergon = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonR = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string star = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string starN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string starSlope = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string lituus = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string lituusA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string super = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superM = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string invLituusA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc
+ string tanStarSlope = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonD = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superM4th = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string oneOverSuperN1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ ss << "\t{\n"
+ << "\t\treal_t a = precalcAtanyx;\n"
+ << "\t\treal_t r = precalcSqrtSumSquares;\n"
+ << "\t\treal_t a2 = a + " << angle << ";\n"
+ << "\n"
+ << "\t\tif (a2 < -M_PI)\n"
+ << "\t\t a2 += M_2PI;\n"
+ << "\n"
+ << "\t\tif (a2 > M_PI)\n"
+ << "\t\t a2 -= M_2PI;\n"
+ << "\n"
+ << "\t\treal_t s, c;\n"
+ << "\t\treal_t total = 0;\n"
+ << "\t\treal_t total2 = 0;\n"
+ << "\t\treal_t temp1, temp2, temp3, temp4;\n"
+ << "\n"
+ << "\t\tif (" << hypergon << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
+ << "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
+ << "\n"
+ << "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
+ << "\t\t {\n"
+ << "\t\t total += " << hypergon << ";\n"
+ << "\t\t }\n"
+ << "\t\t else\n"
+ << "\t\t {\n"
+ << "\t\t temp3 = " << hypergonD << ";\n"
+ << "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
+ << "\t\t }\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << star << "!= 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
+ << "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << lituus << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t total += " << lituus << " * pow(fabs(a / M_PI + 1), " << invLituusA << ");\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << super << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp4 = a * " << superM4th << ";\n"
+ << "\t\t s = sincos(temp4, &c);\n"
+ << "\t\t total += " << super << " * pow(pow(fabs(c), " << superN2 << ") + pow(fabs(s), " << superN3 << "), " << oneOverSuperN1 << ");\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (r <= total)\n"
+ << "\t\t{\n"
+ << "\t\t if (" << hypergon << " != 0.0)\n"
+ << "\t\t {\n"
+ << "\t\t temp1 = fmod(fabs(a2), M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
+ << "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
+ << "\n"
+ << "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
+ << "\t\t {\n"
+ << "\t\t total2 += " << hypergon << ";\n"
+ << "\t\t }\n"
+ << "\t\t else\n"
+ << "\t\t {\n"
+ << "\t\t temp3 = " << hypergonD << ";\n"
+ << "\t\t total2 += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
+ << "\t\t }\n"
+ << "\t\t }\n"
+ << "\n"
+ << "\t\t if (" << star << " != 0)\n"
+ << "\t\t {\n"
+ << "\t\t temp1 = tan(fabs(fmod(fabs(a2), M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
+ << "\t\t total2 += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
+ << "\t\t }\n"
+ << "\n"
+ << "\t\t if (" << lituus << " != 0)\n"
+ << "\t\t {\n"
+ << "\t\t total2 += " << lituus << " * pow(fabs(a2 / M_PI + 1), " << invLituusA << ");\n"
+ << "\t\t }\n"
+ << "\n"
+ << "\t\t if (" << super << " != 0)\n"
+ << "\t\t {\n"
+ << "\t\t temp4 = a2 * " << superM4th << ";\n"
+ << "\t\t s = sincos(temp4, &c);\n"
+ << "\t\t total2 += " << super << " * pow(pow(fabs(c), " << superN2 << ") + pow(fabs(s), " << superN3 << "), " << oneOverSuperN1 << ");\n"
+ << "\t\t }\n"
+ << "\n"
+ << "\t\t r = xform->m_VariationWeights[" << varIndex << "] * total2 * r / total;\n"
+ << "\t\t s = sincos(a2, &c);\n"
+ << "\t\t vOut.x = r * c;\n"
+ << "\t\t vOut.y = r * s;\n"
+ << "\t\t}\n"
+ << "\t\telse\n"
+ << "\t\t{\n"
+ << "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n"
+ << "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tvOut.z = " << DefaultZCl()
+ << "\t}\n";
+ return ss.str();
+ }
+
+ virtual vector OpenCLGlobalFuncNames() const override
+ {
+ return vector { "Sqr" };
+ }
+
+ virtual void Precalc() override
+ {
+ m_HypergonD = std::sqrt(1 + SQR(m_HypergonR));
+ m_InvLituusA = -m_LituusA;
+
+ if (IsClose(m_StarSlope, T(M_PI_2)))
+ m_TanStarSlope = std::tan(m_StarSlope - T(0.05));//Original did not do this, but it makes no sense to take tan(pi/2) because it's undefined.
+ else
+ m_TanStarSlope = std::tan(m_StarSlope);
+
+ m_SuperM4th = m_SuperM / 4;
+ m_OneOverSuperN1 = -1 / Zeps(m_SuperN1);
+ }
+
+protected:
+ void Init()
+ {
+ string prefix = Prefix();
+ m_Params.clear();
+ m_Params.push_back(ParamWithName(&m_Angle, prefix + "w_angle", 0, eParamType::REAL_CYCLIC, T(-M_PI), T(M_PI)));
+ m_Params.push_back(ParamWithName(&m_Hypergon, prefix + "w_hypergon"));
+ m_Params.push_back(ParamWithName(&m_HypergonN, prefix + "w_hypergon_n", 4, eParamType::INTEGER, 3));
+ m_Params.push_back(ParamWithName(&m_HypergonR, prefix + "w_hypergon_r", 1));
+ m_Params.push_back(ParamWithName(&m_Star, prefix + "w_star"));
+ m_Params.push_back(ParamWithName(&m_StarN, prefix + "w_star_n", 5, eParamType::INTEGER, 3));
+ m_Params.push_back(ParamWithName(&m_StarSlope, prefix + "w_star_slope", 2, eParamType::REAL, EPS, T(M_PI_2)));
+ m_Params.push_back(ParamWithName(&m_Lituus, prefix + "w_lituus"));
+ m_Params.push_back(ParamWithName(&m_LituusA, prefix + "w_lituus_a", 1));
+ m_Params.push_back(ParamWithName(&m_Super, prefix + "w_super"));
+ m_Params.push_back(ParamWithName(&m_SuperM, prefix + "w_super_m", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN1, prefix + "w_super_n1", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN2, prefix + "w_super_n2", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN3, prefix + "w_super_n3", 1));
+ m_Params.push_back(ParamWithName(true, &m_InvLituusA, prefix + "w_inv_lituus_a"));//Precalc
+ m_Params.push_back(ParamWithName(true, &m_TanStarSlope, prefix + "w_tan_star_slope"));
+ m_Params.push_back(ParamWithName(true, &m_HypergonD, prefix + "w_hypergon_d"));
+ m_Params.push_back(ParamWithName(true, &m_SuperM4th, prefix + "w_super_m_4th"));
+ m_Params.push_back(ParamWithName(true, &m_OneOverSuperN1, prefix + "w_one_over_super_n1"));
+ }
+
+private:
+ T m_Angle;
+ T m_Hypergon;
+ T m_HypergonN;
+ T m_HypergonR;
+ T m_Star;
+ T m_StarN;
+ T m_StarSlope;
+ T m_Lituus;
+ T m_LituusA;
+ T m_Super;
+ T m_SuperM;
+ T m_SuperN1;
+ T m_SuperN2;
+ T m_SuperN3;
+ T m_InvLituusA;//Precalc
+ T m_TanStarSlope;
+ T m_HypergonD;
+ T m_SuperM4th;
+ T m_OneOverSuperN1;
+};
+
+template
+class EMBER_API XVariation : public ParametricVariation
+{
+public:
+ XVariation(T weight = 1.0) : ParametricVariation("x", eVariationId::VAR_X, weight, true, false, false, false, true)
+ {
+ Init();
+ }
+
+ PARVARCOPY(XVariation)
+
+ virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override
+ {
+ T a = helper.m_PrecalcAtanyx;
+ T a90 = atan2(helper.In.x, -helper.In.y);
+ T r;
+ T s, c;
+ T total = 0;
+ T temp1, temp2, temp3, temp4;
+
+ if (m_Hypergon != 0)
+ {
+ temp1 = fmod(std::abs(a), M_2PI / m_HypergonN) - T(M_PI) / m_HypergonN;
+ temp2 = Sqr(std::tan(temp1)) + 1;
+
+ if (temp2 >= Sqr(m_HypergonD))
+ {
+ total += m_Hypergon;
+ }
+ else
+ {
+ temp3 = m_HypergonD;
+ total += m_Hypergon * (m_HypergonD - std::sqrt(Sqr(m_HypergonD) - temp2)) / std::sqrt(temp2);
+ }
+ }
+
+ if (m_Star != 0)
+ {
+ temp1 = std::tan(std::abs(fmod(std::abs(a), M_2PI / m_StarN) - T(M_PI) / m_StarN));
+ total += m_Star * std::sqrt(Sqr(m_TanStarSlope) * (1 + Sqr(temp1)) / Sqr(temp1 + m_TanStarSlope));
+ }
+
+ if (m_Lituus != 0)
+ {
+ total += m_Lituus * std::pow(std::fabs(a / T(M_PI) + 1), m_InvLituusA);
+ }
+
+ if (m_Super != 0)
+ {
+ temp4 = a * m_SuperM4th;
+ sincos(temp4, &s, &c);
+ total += m_Super * std::pow(std::pow(std::abs(c), m_SuperN2) + std::pow(std::abs(s), m_SuperN3), m_OneOverSuperN1);
+ }
+
+ r = m_Weight * std::sqrt(helper.m_PrecalcSumSquares + Sqr(total));
+ sincos(a, &s, &c);
+ helper.Out.x = r * c;
+ helper.Out.y = r * s;
+ 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 hypergon = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonR = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string star = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string starN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string starSlope = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string lituus = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string lituusA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string super = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superM = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string invLituusA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc
+ string tanStarSlope = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonD = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superM4th = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string oneOverSuperN1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ ss << "\t{\n"
+ << "\t\treal_t a = precalcAtanyx;\n"
+ << "\t\treal_t a90 = atan2(vIn.x, -vIn.y);\n"
+ << "\t\treal_t r;\n"
+ << "\t\treal_t s, c;\n"
+ << "\t\treal_t total = 0;\n"
+ << "\t\treal_t temp1, temp2, temp3, temp4;\n"
+ << "\n"
+ << "\t\tif (" << hypergon << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
+ << "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
+ << "\n"
+ << "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
+ << "\t\t {\n"
+ << "\t\t total += " << hypergon << ";\n"
+ << "\t\t }\n"
+ << "\t\t else\n"
+ << "\t\t {\n"
+ << "\t\t temp3 = " << hypergonD << ";\n"
+ << "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
+ << "\t\t }\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << star << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
+ << "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << lituus << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t total += " << lituus << " * pow(fabs(a / M_PI + 1), " << invLituusA << ");\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << super << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp4 = a * " << superM4th << ";\n"
+ << "\t\t s = sincos(temp4, &c);\n"
+ << "\t\t total += " << super << " * pow(pow(fabs(c), " << superN2 << ") + pow(fabs(s), " << superN3 << "), " << oneOverSuperN1 << ");\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tr = xform->m_VariationWeights[" << varIndex << "] * sqrt(precalcSumSquares + Sqr(total));\n"
+ << "\t\ts = sincos(a, &c);\n"
+ << "\t\tvOut.x = r * c;\n"
+ << "\t\tvOut.y = r * s;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
+ << "\t}\n";
+ return ss.str();
+ }
+
+ virtual vector OpenCLGlobalFuncNames() const override
+ {
+ return vector { "Sqr" };
+ }
+
+ virtual void Precalc() override
+ {
+ m_HypergonD = std::sqrt(1 + SQR(m_HypergonR));
+ m_InvLituusA = -m_LituusA;
+
+ if (IsClose(m_StarSlope, T(M_PI_2)))
+ m_TanStarSlope = std::tan(m_StarSlope - T(0.05));//Original did not do this, but it makes no sense to take tan(pi/2) because it's undefined.
+ else
+ m_TanStarSlope = std::tan(m_StarSlope);
+
+ m_SuperM4th = m_SuperM / 4;
+ m_OneOverSuperN1 = -1 / Zeps(m_SuperN1);
+ }
+
+protected:
+ void Init()
+ {
+ string prefix = Prefix();
+ m_Params.clear();
+ m_Params.push_back(ParamWithName(&m_Hypergon, prefix + "x_hypergon"));
+ m_Params.push_back(ParamWithName(&m_HypergonN, prefix + "x_hypergon_n", 4, eParamType::INTEGER, 3));
+ m_Params.push_back(ParamWithName(&m_HypergonR, prefix + "x_hypergon_r", 1));
+ m_Params.push_back(ParamWithName(&m_Star, prefix + "x_star"));
+ m_Params.push_back(ParamWithName(&m_StarN, prefix + "x_star_n", 5, eParamType::INTEGER, 3));
+ m_Params.push_back(ParamWithName(&m_StarSlope, prefix + "x_star_slope", 2, eParamType::REAL, EPS, T(M_PI_2)));
+ m_Params.push_back(ParamWithName(&m_Lituus, prefix + "x_lituus"));
+ m_Params.push_back(ParamWithName(&m_LituusA, prefix + "x_lituus_a", 1));
+ m_Params.push_back(ParamWithName(&m_Super, prefix + "x_super"));
+ m_Params.push_back(ParamWithName(&m_SuperM, prefix + "x_super_m", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN1, prefix + "x_super_n1", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN2, prefix + "x_super_n2", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN3, prefix + "x_super_n3", 1));
+ m_Params.push_back(ParamWithName(true, &m_InvLituusA, prefix + "x_inv_lituus_a"));//Precalc
+ m_Params.push_back(ParamWithName(true, &m_TanStarSlope, prefix + "x_tan_star_slope"));
+ m_Params.push_back(ParamWithName(true, &m_HypergonD, prefix + "x_hypergon_d"));
+ m_Params.push_back(ParamWithName(true, &m_SuperM4th, prefix + "x_super_m_4th"));
+ m_Params.push_back(ParamWithName(true, &m_OneOverSuperN1, prefix + "x_one_over_super_n1"));
+ }
+
+private:
+ T m_Hypergon;
+ T m_HypergonN;
+ T m_HypergonR;
+ T m_Star;
+ T m_StarN;
+ T m_StarSlope;
+ T m_Lituus;
+ T m_LituusA;
+ T m_Super;
+ T m_SuperM;
+ T m_SuperN1;
+ T m_SuperN2;
+ T m_SuperN3;
+ T m_InvLituusA;//Precalc
+ T m_TanStarSlope;
+ T m_HypergonD;
+ T m_SuperM4th;
+ T m_OneOverSuperN1;
+};
+
+template
+class EMBER_API YVariation : public ParametricVariation
+{
+public:
+ YVariation(T weight = 1.0) : ParametricVariation("y", eVariationId::VAR_Y, weight, true, true, false, false, true)
+ {
+ Init();
+ }
+
+ PARVARCOPY(YVariation)
+
+ virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override
+ {
+ T a = helper.m_PrecalcAtanyx;
+ T a90 = atan2(helper.In.x, -helper.In.y);
+ T r;
+ T s, c;
+ T total = 0;
+ T temp1, temp2, temp3, temp4;
+
+ if (m_Hypergon != 0)
+ {
+ temp1 = fmod(std::abs(a), M_2PI / m_HypergonN) - T(M_PI) / m_HypergonN;
+ temp2 = Sqr(std::tan(temp1)) + 1;
+
+ if (temp2 >= Sqr(m_HypergonD))
+ {
+ total += m_Hypergon;
+ }
+ else
+ {
+ temp3 = m_HypergonD;
+ total += m_Hypergon * (m_HypergonD - std::sqrt(Sqr(m_HypergonD) - temp2)) / std::sqrt(temp2);
+ }
+ }
+
+ if (m_Star != 0)
+ {
+ temp1 = std::tan(std::abs(fmod(std::abs(a), M_2PI / m_StarN) - T(M_PI) / m_StarN));
+ total += m_Star * std::sqrt(Sqr(m_TanStarSlope) * (1 + Sqr(temp1)) / Sqr(temp1 + m_TanStarSlope));
+ }
+
+ if (m_Lituus != 0)
+ {
+ total += m_Lituus * std::pow(std::abs(a / T(M_PI) + 1), m_InvLituusA);
+ }
+
+ if (m_Super != 0)
+ {
+ temp4 = a * m_SuperM4th;
+ sincos(temp4, &s, &c);
+ total += m_Super * std::pow(std::pow(std::abs(c), m_SuperN2) + std::pow(std::abs(s), m_SuperN3), m_OneOverSuperN1);
+ }
+
+ r = m_Weight * Sqr(total) / helper.m_PrecalcSqrtSumSquares;
+ sincos(a, &s, &c);
+ helper.Out.x = r * c;
+ helper.Out.y = r * s;
+ 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 hypergon = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonR = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string star = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string starN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string starSlope = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string lituus = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string lituusA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string super = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superM = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string invLituusA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc
+ string tanStarSlope = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonD = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superM4th = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string oneOverSuperN1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ ss << "\t{\n"
+ << "\t\treal_t a = precalcAtanyx;\n"
+ << "\t\treal_t a90 = atan2(vIn.x, -vIn.y);\n"
+ << "\t\treal_t r;\n"
+ << "\t\treal_t s, c;\n"
+ << "\t\treal_t total = 0;\n"
+ << "\t\treal_t temp1, temp2, temp3, temp4;\n"
+ << "\n"
+ << "\t\tif (" << hypergon << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
+ << "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
+ << "\n"
+ << "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
+ << "\t\t {\n"
+ << "\t\t total += " << hypergon << ";\n"
+ << "\t\t }\n"
+ << "\t\t else\n"
+ << "\t\t {\n"
+ << "\t\t temp3 = " << hypergonD << ";\n"
+ << "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
+ << "\t\t }\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << star << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
+ << "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << lituus << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t total += " << lituus << " * pow(fabs(a / M_PI + 1), " << invLituusA << ");\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << super << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp4 = a * " << superM4th << ";\n"
+ << "\t\t s = sincos(temp4, &c);\n"
+ << "\t\t total += " << super << " * pow(pow(fabs(c), " << superN2 << ") + pow(fabs(s), " << superN3 << "), " << oneOverSuperN1 << ");\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tr = xform->m_VariationWeights[" << varIndex << "] * Sqr(total) / precalcSqrtSumSquares;\n"
+ << "\t\ts = sincos(a, &c);\n"
+ << "\t\tvOut.x = r * c;\n"
+ << "\t\tvOut.y = r * s;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
+ << "\t}\n";
+ return ss.str();
+ }
+
+ virtual vector OpenCLGlobalFuncNames() const override
+ {
+ return vector { "Sqr" };
+ }
+
+ virtual void Precalc() override
+ {
+ m_HypergonD = std::sqrt(1 + SQR(m_HypergonR));
+ m_InvLituusA = -m_LituusA;
+
+ if (IsClose(m_StarSlope, T(M_PI_2)))
+ m_TanStarSlope = std::tan(m_StarSlope - T(0.05));//Original did not do this, but it makes no sense to take tan(pi/2) because it's undefined.
+ else
+ m_TanStarSlope = std::tan(m_StarSlope);
+
+ m_SuperM4th = m_SuperM / 4;
+ m_OneOverSuperN1 = -1 / Zeps(m_SuperN1);
+ }
+
+protected:
+ void Init()
+ {
+ string prefix = Prefix();
+ m_Params.clear();
+ m_Params.push_back(ParamWithName(&m_Hypergon, prefix + "y_hypergon"));
+ m_Params.push_back(ParamWithName(&m_HypergonN, prefix + "y_hypergon_n", 4, eParamType::INTEGER, 3));
+ m_Params.push_back(ParamWithName(&m_HypergonR, prefix + "y_hypergon_r", 1));
+ m_Params.push_back(ParamWithName(&m_Star, prefix + "y_star"));
+ m_Params.push_back(ParamWithName(&m_StarN, prefix + "y_star_n", 5, eParamType::INTEGER, 3));
+ m_Params.push_back(ParamWithName(&m_StarSlope, prefix + "y_star_slope", 2, eParamType::REAL, EPS, T(M_PI_2)));
+ m_Params.push_back(ParamWithName(&m_Lituus, prefix + "y_lituus"));
+ m_Params.push_back(ParamWithName(&m_LituusA, prefix + "y_lituus_a", 1));
+ m_Params.push_back(ParamWithName(&m_Super, prefix + "y_super"));
+ m_Params.push_back(ParamWithName(&m_SuperM, prefix + "y_super_m", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN1, prefix + "y_super_n1", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN2, prefix + "y_super_n2", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN3, prefix + "y_super_n3", 1));
+ m_Params.push_back(ParamWithName(true, &m_InvLituusA, prefix + "y_inv_lituus_a"));//Precalc
+ m_Params.push_back(ParamWithName(true, &m_TanStarSlope, prefix + "y_tan_star_slope"));
+ m_Params.push_back(ParamWithName(true, &m_HypergonD, prefix + "y_hypergon_d"));
+ m_Params.push_back(ParamWithName(true, &m_SuperM4th, prefix + "y_super_m_4th"));
+ m_Params.push_back(ParamWithName(true, &m_OneOverSuperN1, prefix + "y_one_over_super_n1"));
+ }
+
+private:
+ T m_Hypergon;
+ T m_HypergonN;
+ T m_HypergonR;
+ T m_Star;
+ T m_StarN;
+ T m_StarSlope;
+ T m_Lituus;
+ T m_LituusA;
+ T m_Super;
+ T m_SuperM;
+ T m_SuperN1;
+ T m_SuperN2;
+ T m_SuperN3;
+ T m_InvLituusA;//Precalc
+ T m_TanStarSlope;
+ T m_HypergonD;
+ T m_SuperM4th;
+ T m_OneOverSuperN1;
+};
+
+template
+class EMBER_API ZVariation : public ParametricVariation
+{
+public:
+ ZVariation(T weight = 1.0) : ParametricVariation("z", eVariationId::VAR_Z, weight, true, true, false, false, true)
+ {
+ Init();
+ }
+
+ PARVARCOPY(ZVariation)
+
+ virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override
+ {
+ T a = helper.m_PrecalcAtanyx;
+ T a90 = atan2(helper.In.x, -helper.In.y);
+ T r;
+ T s, c;
+ T total = 0;
+ T temp1, temp2, temp3, temp4;
+
+ if (m_Hypergon != 0)
+ {
+ temp1 = fmod(std::abs(a), M_2PI / m_HypergonN) - T(M_PI) / m_HypergonN;
+ temp2 = Sqr(std::tan(temp1)) + 1;
+
+ if (temp2 >= Sqr(m_HypergonD))
+ {
+ total += m_Hypergon;
+ }
+ else
+ {
+ temp3 = m_HypergonD;
+ total += m_Hypergon * (m_HypergonD - std::sqrt(Sqr(m_HypergonD) - temp2)) / std::sqrt(temp2);
+ }
+ }
+
+ if (m_Star != 0)
+ {
+ temp1 = std::tan(std::abs(fmod(std::abs(a), M_2PI / m_StarN) - T(M_PI) / m_StarN));
+ total += m_Star * std::sqrt(Sqr(m_TanStarSlope) * (1 + Sqr(temp1)) / Sqr(temp1 + m_TanStarSlope));
+ }
+
+ if (m_Lituus != 0)
+ {
+ total += m_Lituus * std::pow(std::abs(a / T(M_PI) + 1), m_InvLituusA);
+ }
+
+ if (m_Super != 0)
+ {
+ temp4 = a * m_SuperM4th;
+ sincos(temp4, &s, &c);
+ total += m_Super * std::pow(std::pow(std::abs(c), m_SuperN2) + std::pow(std::abs(s), m_SuperN3), m_OneOverSuperN1);
+ }
+
+ r = m_Weight * (helper.m_PrecalcSqrtSumSquares + total);
+ sincos(a, &s, &c);
+ helper.Out.x = r * c;
+ helper.Out.y = r * s;
+ 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 hypergon = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonR = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string star = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string starN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string starSlope = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string lituus = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string lituusA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string super = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superM = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superN3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string invLituusA = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc
+ string tanStarSlope = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string hypergonD = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string superM4th = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ string oneOverSuperN1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
+ ss << "\t{\n"
+ << "\t\treal_t a = precalcAtanyx;\n"
+ << "\t\treal_t a90 = atan2(vIn.x, -vIn.y);\n"
+ << "\t\treal_t r;\n"
+ << "\t\treal_t s, c;\n"
+ << "\t\treal_t total = 0;\n"
+ << "\t\treal_t temp1, temp2, temp3, temp4;\n"
+ << "\n"
+ << "\t\tif (" << hypergon << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
+ << "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
+ << "\n"
+ << "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
+ << "\t\t {\n"
+ << "\t\t total += " << hypergon << ";\n"
+ << "\t\t }\n"
+ << "\t\t else\n"
+ << "\t\t {\n"
+ << "\t\t temp3 = " << hypergonD << ";\n"
+ << "\t\t total += " << hypergon << " * (" << hypergonD << " - sqrt(Sqr(" << hypergonD << ") - temp2)) / sqrt(temp2);\n"
+ << "\t\t }\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << star << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
+ << "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << lituus << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t total += " << lituus << " * pow(fabs(a / M_PI + 1), " << invLituusA << ");\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tif (" << super << " != 0)\n"
+ << "\t\t{\n"
+ << "\t\t temp4 = a * " << superM4th << ";\n"
+ << "\t\t s = sincos(temp4, &c);\n"
+ << "\t\t total += " << super << " * pow(pow(fabs(c), " << superN2 << ") + pow(fabs(s), " << superN3 << "), " << oneOverSuperN1 << ");\n"
+ << "\t\t}\n"
+ << "\n"
+ << "\t\tr = xform->m_VariationWeights[" << varIndex << "] * (precalcSqrtSumSquares + total);\n"
+ << "\t\ts = sincos(a, &c);\n"
+ << "\t\tvOut.x = r * c;\n"
+ << "\t\tvOut.y = r * s;\n"
+ << "\t\tvOut.z = " << DefaultZCl()
+ << "\t}\n";
+ return ss.str();
+ }
+
+ virtual vector OpenCLGlobalFuncNames() const override
+ {
+ return vector { "Sqr" };
+ }
+
+ virtual void Precalc() override
+ {
+ m_HypergonD = std::sqrt(1 + SQR(m_HypergonR));
+ m_InvLituusA = -m_LituusA;
+
+ if (IsClose(m_StarSlope, T(M_PI_2)))
+ m_TanStarSlope = std::tan(m_StarSlope - T(0.05));//Original did not do this, but it makes no sense to take tan(pi/2) because it's undefined.
+ else
+ m_TanStarSlope = std::tan(m_StarSlope);
+
+ m_SuperM4th = m_SuperM / 4;
+ m_OneOverSuperN1 = -1 / Zeps(m_SuperN1);
+ }
+
+protected:
+ void Init()
+ {
+ string prefix = Prefix();
+ m_Params.clear();
+ m_Params.push_back(ParamWithName(&m_Hypergon, prefix + "z_hypergon"));
+ m_Params.push_back(ParamWithName(&m_HypergonN, prefix + "z_hypergon_n", 4, eParamType::INTEGER, 3));
+ m_Params.push_back(ParamWithName(&m_HypergonR, prefix + "z_hypergon_r", 1));
+ m_Params.push_back(ParamWithName(&m_Star, prefix + "z_star"));
+ m_Params.push_back(ParamWithName(&m_StarN, prefix + "z_star_n", 5, eParamType::INTEGER, 3));
+ m_Params.push_back(ParamWithName(&m_StarSlope, prefix + "z_star_slope", 2, eParamType::REAL, EPS, T(M_PI_2)));
+ m_Params.push_back(ParamWithName(&m_Lituus, prefix + "z_lituus"));
+ m_Params.push_back(ParamWithName(&m_LituusA, prefix + "z_lituus_a", 1));
+ m_Params.push_back(ParamWithName(&m_Super, prefix + "z_super"));
+ m_Params.push_back(ParamWithName(&m_SuperM, prefix + "z_super_m", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN1, prefix + "z_super_n1", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN2, prefix + "z_super_n2", 1));
+ m_Params.push_back(ParamWithName(&m_SuperN3, prefix + "z_super_n3", 1));
+ m_Params.push_back(ParamWithName(true, &m_InvLituusA, prefix + "z_inv_lituus_a"));//Precalc
+ m_Params.push_back(ParamWithName(true, &m_TanStarSlope, prefix + "z_tan_star_slope"));
+ m_Params.push_back(ParamWithName(true, &m_HypergonD, prefix + "z_hypergon_d"));
+ m_Params.push_back(ParamWithName(true, &m_SuperM4th, prefix + "z_super_m_4th"));
+ m_Params.push_back(ParamWithName(true, &m_OneOverSuperN1, prefix + "z_one_over_super_n1"));
+ }
+
+private:
+ T m_Hypergon;
+ T m_HypergonN;
+ T m_HypergonR;
+ T m_Star;
+ T m_StarN;
+ T m_StarSlope;
+ T m_Lituus;
+ T m_LituusA;
+ T m_Super;
+ T m_SuperM;
+ T m_SuperN1;
+ T m_SuperN2;
+ T m_SuperN3;
+ T m_InvLituusA;//Precalc
+ T m_TanStarSlope;
+ T m_HypergonD;
+ T m_SuperM4th;
+ T m_OneOverSuperN1;
+};
+
MAKEPREPOSTPARVAR(Hexes, hexes, HEXES)
MAKEPREPOSTPARVAR(Nblur, nBlur, NBLUR)
MAKEPREPOSTPARVAR(Octapol, octapol, OCTAPOL)
@@ -4424,4 +5411,10 @@ MAKEPREPOSTPARVAR(Crob, crob, CROB)
MAKEPREPOSTPARVAR(BubbleT3D, bubbleT3D, BUBBLET3D)
MAKEPREPOSTPARVAR(Synth, synth, SYNTH)
MAKEPREPOSTPARVAR(Crackle, crackle, CRACKLE)
+MAKEPREPOSTVAR(Erf, erf, ERF)
+MAKEPREPOSTVAR(Xerf, xerf, XERF)
+MAKEPREPOSTPARVAR(W, w, W)
+MAKEPREPOSTPARVAR(X, x, X)
+MAKEPREPOSTPARVAR(Y, y, Y)
+MAKEPREPOSTPARVAR(Z, z, Z)
}
diff --git a/Source/Ember/Variations07.h b/Source/Ember/Variations07.h
new file mode 100644
index 0000000..f5bcdfa
--- /dev/null
+++ b/Source/Ember/Variations07.h
@@ -0,0 +1,968 @@
+#pragma once
+
+#include "Variation.h"
+
+namespace EmberNs
+{
+///
+/// splits3D.
+///
+template
+class EMBER_API Splits3DVariation : public ParametricVariation
+{
+public:
+ Splits3DVariation(T weight = 1.0) : ParametricVariation("splits3D", eVariationId::VAR_SPLITS3D, weight)
+ {
+ Init();
+ }
+
+ PARVARCOPY(Splits3DVariation)
+
+ virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& 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& rand) override
+ {
+ m_X = rand.Frand11();
+ m_Y = rand.Frand11();
+ m_Z = rand.Frand11();
+ }
+
+protected:
+ void Init()
+ {
+ string prefix = Prefix();
+ m_Params.clear();
+ m_Params.push_back(ParamWithName(&m_X, prefix + "splits3D_x"));
+ m_Params.push_back(ParamWithName(&m_Y, prefix + "splits3D_y"));
+ m_Params.push_back(ParamWithName(&m_Z, prefix + "splits3D_z"));
+ }
+
+private:
+ T m_X;
+ T m_Y;
+ T m_Z;
+};
+
+///
+/// waves2b.
+/// Note that _j1() is not implemented in OpenCL, so that conditional is skipped
+/// when running on the GPU. The results might look different.
+///
+template
+class EMBER_API Waves2BVariation : public ParametricVariation
+{
+public:
+ Waves2BVariation(T weight = 1.0) : ParametricVariation("waves2b", eVariationId::VAR_WAVES2B, weight)
+ {
+ Init();
+ }
+
+ PARVARCOPY(Waves2BVariation)
+
+ virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& 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 OpenCLGlobalFuncNames() const override
+ {
+ return vector { "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::Instance();
+ m_Params.clear();
+ m_Params.push_back(ParamWithName(&m_Freqx, prefix + "waves2b_freqx", 2));
+ m_Params.push_back(ParamWithName(&m_Freqy, prefix + "waves2b_freqy", 2));
+ m_Params.push_back(ParamWithName(&m_Pwx, prefix + "waves2b_pwx", 1, eParamType::REAL, -10, 10));
+ m_Params.push_back(ParamWithName(&m_Pwy, prefix + "waves2b_pwy", 1, eParamType::REAL, -10, 10));
+ m_Params.push_back(ParamWithName(&m_Scalex, prefix + "waves2b_scalex", 1));
+ m_Params.push_back(ParamWithName(&m_Scaleinfx, prefix + "waves2b_scaleinfx", 1));
+ m_Params.push_back(ParamWithName(&m_Scaley, prefix + "waves2b_scaley", 1));
+ m_Params.push_back(ParamWithName(&m_Scaleinfy, prefix + "waves2b_scaleinfy", 1));
+ m_Params.push_back(ParamWithName