mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2026-04-11 03:20:27 -04:00
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth. -Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted. -When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember. -Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render. -Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply. -Make default temporal samples be 100, whereas before it was 1000 which was overkill. -Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box. -This wasn't otherwise fixable without writing a lot more code. --Bug fixes -EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it. -EmberGenome was improperly handling the first frame of a merge after the last frame of the loop. -These bugs were due to a previous commit. Revert parts of that commit. -Prevent a zoom value of less than 0 when reading from xml. -Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already. -Unique file naming was broken because it was looking for _# and the default names ended with -#. -Disallow renaming of an ember in the library tree to an empty string. -Severe bug that prevented some variations from being read correctly from params generated outside this program. -Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1. -Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double. -Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU. -Prevent user from saving stylesheet to default.qss, it's a special reserved filename. --Code changes -Generalize using the running sum output point inside of a variation for all cases: pre, reg and post. -Allow for array variables in variations where the address of each element is stored in m_Params. -Qualify all math functions with std:: -No longer use our own Clamp() in OpenCL, instead use the standard clamp(). -Redesign how functions are used in the variations OpenCL code. -Add tests to EmberTester to verify some of the new functionality. -Place more const and override qualifiers on functions where appropriate. -Add a global rand with a lock to be used very sparingly. -Use a map instead of a vector for bad param names in Xml parsing. -Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear. -Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread. -Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember. -Add Contains() function to Utils.h. -EmberRender: print names of kernels being printed with --dump_kernel option. -Clean up EmberTester to handle some of the recent changes. -Fix various casts. -Replace % 2 with & 1, even though the compiler was likely doing this already. -Add new file Variations06.h to accommodate new variations. -General cleanup.
This commit is contained in:
@ -123,7 +123,7 @@ public:
|
||||
//
|
||||
// num filters = (de_max_width / de_min_width)^(1 / estimator_curve)
|
||||
//
|
||||
decFilterCount = pow(finalMaxRad / finalMinRad, T(1.0) / m_Curve);
|
||||
decFilterCount = std::pow(finalMaxRad / finalMinRad, T(1.0) / m_Curve);
|
||||
|
||||
if (decFilterCount > 1e7)//Too many filters.
|
||||
return false;
|
||||
@ -133,8 +133,8 @@ public:
|
||||
//Condense the smaller kernels to save space.
|
||||
if (intFilterCount > keepThresh)
|
||||
{
|
||||
maxIndex = static_cast<int>(ceil(DE_THRESH + pow(T(intFilterCount - DE_THRESH), m_Curve))) + 1;
|
||||
m_MaxFilteredCounts = static_cast<int>(pow(T(maxIndex - DE_THRESH), T(1.0) / m_Curve)) + DE_THRESH;
|
||||
maxIndex = static_cast<int>(ceil(DE_THRESH + std::pow(T(intFilterCount - DE_THRESH), m_Curve))) + 1;
|
||||
m_MaxFilteredCounts = static_cast<int>(std::pow(T(maxIndex - DE_THRESH), T(1.0) / m_Curve)) + DE_THRESH;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -163,12 +163,12 @@ public:
|
||||
//Calculate the filter width for this number of hits in a bin.
|
||||
if (filterLoop < keepThresh)
|
||||
{
|
||||
filterHeight = (finalMaxRad / pow(T(filterLoop + 1), m_Curve));
|
||||
filterHeight = (finalMaxRad / std::pow(T(filterLoop + 1), m_Curve));
|
||||
}
|
||||
else
|
||||
{
|
||||
loopAdjust = pow(T(filterLoop - keepThresh), (T(1.0) / m_Curve)) + keepThresh;
|
||||
filterHeight = (finalMaxRad / pow(loopAdjust + 1, m_Curve));
|
||||
loopAdjust = std::pow(T(filterLoop - keepThresh), (T(1.0) / m_Curve)) + keepThresh;
|
||||
filterHeight = (finalMaxRad / std::pow(loopAdjust + 1, m_Curve));
|
||||
}
|
||||
|
||||
//Once we've reached the min radius, don't populate any more.
|
||||
@ -262,7 +262,7 @@ public:
|
||||
T finalMaxRad = m_MaxRad * m_Supersample + 1;
|
||||
T finalMinRad = m_MinRad * m_Supersample + 1;
|
||||
|
||||
return pow(finalMaxRad / finalMinRad, T(1.0) / m_Curve) <= 1e7;
|
||||
return std::pow(finalMaxRad / finalMinRad, T(1.0) / m_Curve) <= 1e7;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
namespace EmberNs
|
||||
{
|
||||
template<> unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand = unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>>(new QTIsaac<ISAAC_SIZE, ISAAC_INT>());
|
||||
CriticalSection QTIsaac<ISAAC_SIZE, ISAAC_INT>::m_CS;
|
||||
}
|
||||
|
||||
#include "Curves.h"
|
||||
@ -20,6 +21,7 @@ template<> unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_
|
||||
#include "Variations03.h"
|
||||
#include "Variations04.h"
|
||||
#include "Variations05.h"
|
||||
#include "Variations06.h"
|
||||
#include "VariationsDC.h"
|
||||
#include "VariationList.h"
|
||||
#include "Affine2D.h"
|
||||
@ -56,7 +58,7 @@ uint Timing::m_ProcessorCount;
|
||||
template<> map<string, vector<Palette<T>>> PaletteList<T>::m_Palettes = map<string, vector<Palette<T>>>(); \
|
||||
template<> bool XmlToEmber<T>::m_Init = false; \
|
||||
template<> vector<string> XmlToEmber<T>::m_FlattenNames = vector<string>(); \
|
||||
template<> vector<pair<string, string>> XmlToEmber<T>::m_BadParamNames = vector<pair<string, string>>(); \
|
||||
template<> unordered_map<string, string> XmlToEmber<T>::m_BadParamNames = unordered_map<string, string>(); \
|
||||
template<> vector<pair<pair<string, string>, vector<string>>> XmlToEmber<T>::m_BadVariationNames = vector<pair<pair<string, string>, vector<string>>>(); \
|
||||
template EMBER_API class Point<T>; \
|
||||
template EMBER_API struct Color<T>; \
|
||||
@ -350,6 +352,8 @@ uint Timing::m_ProcessorCount;
|
||||
EXPORTPREPOSTREGVAR(Ho, T) \
|
||||
EXPORTPREPOSTREGVAR(Julia3Dq, T) \
|
||||
EXPORTPREPOSTREGVAR(Line, T) \
|
||||
EXPORTPREPOSTREGVAR(Loonie2, T) \
|
||||
EXPORTPREPOSTREGVAR(Loonie3, T) \
|
||||
EXPORTPREPOSTREGVAR(Loonie3D, T) \
|
||||
EXPORTPREPOSTREGVAR(Mcarpet, T) \
|
||||
EXPORTPREPOSTREGVAR(Waves23D, T) \
|
||||
@ -364,12 +368,21 @@ uint Timing::m_ProcessorCount;
|
||||
EXPORTPREPOSTREGVAR(Falloff2, T) \
|
||||
EXPORTPREPOSTREGVAR(Falloff3, T) \
|
||||
EXPORTPREPOSTREGVAR(Xtrb, T) \
|
||||
template EMBER_API class DCBubbleVariation<T>; \
|
||||
EXPORTPREPOSTREGVAR(Hexaplay3D, T) \
|
||||
EXPORTPREPOSTREGVAR(Hexnix3D, T) \
|
||||
EXPORTPREPOSTREGVAR(Hexcrop, T) \
|
||||
EXPORTPREPOSTREGVAR(Hexes, T) \
|
||||
EXPORTPREPOSTREGVAR(Nblur, T) \
|
||||
EXPORTPREPOSTREGVAR(Octapol, T) \
|
||||
EXPORTPREPOSTREGVAR(Crob, T) \
|
||||
EXPORTPREPOSTREGVAR(BubbleT3D, T) \
|
||||
EXPORTPREPOSTREGVAR(Synth, T) \
|
||||
EXPORTPREPOSTREGVAR(DCBubble, T) \
|
||||
EXPORTPREPOSTREGVAR(DCCarpet, T) \
|
||||
EXPORTPREPOSTREGVAR(DCCube, T) \
|
||||
template EMBER_API class DCCylinderVariation<T>; \
|
||||
EXPORTPREPOSTREGVAR(DCCylinder, T) \
|
||||
EXPORTPREPOSTREGVAR(DCGridOut, T) \
|
||||
template EMBER_API class DCLinearVariation<T>; \
|
||||
EXPORTPREPOSTREGVAR(DCLinear, T) \
|
||||
EXPORTPREPOSTREGVAR(DCZTransl, T) \
|
||||
EXPORTPREPOSTREGVAR(DCTriangle, T) \
|
||||
template EMBER_API class VariationList<T>; \
|
||||
|
||||
@ -201,7 +201,7 @@ public:
|
||||
m_SubBatchSize = DEFAULT_SBS;
|
||||
m_FuseCount = 15;
|
||||
m_Supersample = 1;
|
||||
m_TemporalSamples = 1000;
|
||||
m_TemporalSamples = 100;
|
||||
m_Symmetry = 0;
|
||||
m_Quality = 100;
|
||||
m_PixelsPerUnit = 240;
|
||||
@ -226,7 +226,7 @@ public:
|
||||
m_Time = 0;
|
||||
m_Background.Reset();
|
||||
m_Interp = EMBER_INTERP_LINEAR;
|
||||
m_AffineInterp = INTERP_LOG;
|
||||
m_AffineInterp = AFFINE_INTERP_LOG;
|
||||
|
||||
//DE filter.
|
||||
m_MinRadDE = 0;
|
||||
@ -505,15 +505,15 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CamMat[0][0] = cos(-m_CamYaw);
|
||||
m_CamMat[1][0] = -sin(-m_CamYaw);
|
||||
m_CamMat[0][0] = std::cos(-m_CamYaw);
|
||||
m_CamMat[1][0] = -std::sin(-m_CamYaw);
|
||||
m_CamMat[2][0] = 0;
|
||||
m_CamMat[0][1] = cos(m_CamPitch) * sin(-m_CamYaw);
|
||||
m_CamMat[1][1] = cos(m_CamPitch) * cos(-m_CamYaw);
|
||||
m_CamMat[2][1] = -sin(m_CamPitch);
|
||||
m_CamMat[0][2] = sin(m_CamPitch) * sin(-m_CamYaw);
|
||||
m_CamMat[1][2] = sin(m_CamPitch) * cos(-m_CamYaw);
|
||||
m_CamMat[2][2] = cos(m_CamPitch);
|
||||
m_CamMat[0][1] = std::cos(m_CamPitch) * std::sin(-m_CamYaw);
|
||||
m_CamMat[1][1] = std::cos(m_CamPitch) * std::cos(-m_CamYaw);
|
||||
m_CamMat[2][1] = -std::sin(m_CamPitch);
|
||||
m_CamMat[0][2] = std::sin(m_CamPitch) * std::sin(-m_CamYaw);
|
||||
m_CamMat[1][2] = std::sin(m_CamPitch) * std::cos(-m_CamYaw);
|
||||
m_CamMat[2][2] = std::cos(m_CamPitch);
|
||||
|
||||
if (projBits & PROJBITS_BLUR)
|
||||
{
|
||||
@ -667,10 +667,10 @@ public:
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flatten all xforms by adding a flatten variation if none is present, and if any of the
|
||||
/// variations or parameters in the vector are present.
|
||||
/// Flatten all xforms by adding a flatten variation if none is present, and if none of the
|
||||
/// variations or parameters in the vector are not present.
|
||||
/// </summary>
|
||||
/// <param name="names">Vector of variation and parameter names</param>
|
||||
/// <param name="names">Vector of variation and parameter names that inhibit flattening</param>
|
||||
/// <returns>True if flatten was added to any of the xforms, false if it already was present or if none of the specified variations or parameters were present.</returns>
|
||||
bool Flatten(vector<string>& names)
|
||||
{
|
||||
@ -907,7 +907,7 @@ public:
|
||||
ClampRef<T>(thisXform->m_ColorSpeed, -1, 1);
|
||||
|
||||
//Interp affine and post.
|
||||
if (m_AffineInterp == INTERP_LOG)
|
||||
if (m_AffineInterp == AFFINE_INTERP_LOG)
|
||||
{
|
||||
vector<v2T> cxMag(size);
|
||||
vector<v2T> cxAng(size);
|
||||
@ -944,7 +944,7 @@ public:
|
||||
Interpolater<T>::InterpAndConvertBack(coefs, cxAng, cxMag, cxTrn, thisXform->m_Post);
|
||||
}
|
||||
}
|
||||
else if (m_AffineInterp == INTERP_LINEAR)
|
||||
else if (m_AffineInterp == AFFINE_INTERP_LINEAR)
|
||||
{
|
||||
//Interpolate pre and post affine using coefs.
|
||||
allID = true;
|
||||
@ -1057,7 +1057,7 @@ public:
|
||||
continue;
|
||||
|
||||
//Assume that if there are no variations, then it's a padding xform.
|
||||
if (m_Xforms[i].Empty() && m_AffineInterp != INTERP_LOG)
|
||||
if (m_Xforms[i].Empty() && m_AffineInterp != AFFINE_INTERP_LOG)
|
||||
continue;
|
||||
|
||||
m_Xforms[i].m_Affine.Rotate(angle);
|
||||
@ -1140,8 +1140,8 @@ public:
|
||||
m_Xforms[i].m_ColorSpeed = 0;
|
||||
m_Xforms[i].m_Animate = 0;
|
||||
m_Xforms[i].m_ColorX = m_Xforms[i].m_ColorY = (sym < 3) ? 0 : (T(k - 1) / T(sym - 2));//Added Y.
|
||||
m_Xforms[i].m_Affine.A(Round6(cos(k * a)));
|
||||
m_Xforms[i].m_Affine.D(Round6(sin(k * a)));
|
||||
m_Xforms[i].m_Affine.A(Round6(std::cos(k * a)));
|
||||
m_Xforms[i].m_Affine.D(Round6(std::sin(k * a)));
|
||||
m_Xforms[i].m_Affine.B(Round6(-m_Xforms[i].m_Affine.D()));
|
||||
m_Xforms[i].m_Affine.E(m_Xforms[i].m_Affine.A());
|
||||
m_Xforms[i].m_Affine.C(0);
|
||||
@ -1159,7 +1159,7 @@ public:
|
||||
/// Return a uint with bits set to indicate which kind of projection should be done.
|
||||
/// </summary>
|
||||
/// <param name="onlyScaleIfNewIsSmaller">A uint with bits set for each kind of projection that is needed</param>
|
||||
size_t ProjBits()
|
||||
size_t ProjBits() const
|
||||
{
|
||||
size_t val = 0;
|
||||
|
||||
@ -1410,9 +1410,9 @@ public:
|
||||
m_MinRadDE = 0;
|
||||
m_CurveDE = T(0.4);
|
||||
m_GammaThresh = T(0.01);
|
||||
m_TemporalSamples = 1000;
|
||||
m_TemporalSamples = 100;
|
||||
m_SpatialFilterType = GAUSSIAN_SPATIAL_FILTER;
|
||||
m_AffineInterp = INTERP_LOG;
|
||||
m_AffineInterp = AFFINE_INTERP_LOG;
|
||||
m_TemporalFilterType = BOX_TEMPORAL_FILTER;
|
||||
m_TemporalFilterWidth = 1;
|
||||
m_TemporalFilterExp = 0;
|
||||
@ -1443,7 +1443,7 @@ public:
|
||||
m_GammaThresh = -1;
|
||||
m_TemporalSamples = 0;
|
||||
m_SpatialFilterType = GAUSSIAN_SPATIAL_FILTER;
|
||||
m_AffineInterp = INTERP_LOG;
|
||||
m_AffineInterp = AFFINE_INTERP_LOG;
|
||||
m_TemporalFilterType = BOX_TEMPORAL_FILTER;
|
||||
m_TemporalFilterWidth = -1;
|
||||
m_TemporalFilterExp = -999;
|
||||
|
||||
@ -29,15 +29,13 @@
|
||||
|
||||
//Wrap the sincos function for Macs and PC.
|
||||
#if defined(__APPLE__) || defined(_MSC_VER)
|
||||
#define sincos(x, s, c) *(s)=sin(x); *(c)=cos(x);
|
||||
#define sincos(x, s, c) *(s)=std::sin(x); *(c)=std::cos(x);
|
||||
#else
|
||||
//extern void sincos(double x, double *s, double *c);
|
||||
//extern void sincos(float x, float *s, float *c);
|
||||
static void sincos(float x, float* s, float* c)
|
||||
/*static void sincos(float x, float* s, float* c)
|
||||
{
|
||||
*s = sin(x);
|
||||
*c = cos(x);
|
||||
}
|
||||
*s = std::sin(x);
|
||||
*c = std::cos(x);
|
||||
}*/
|
||||
#endif
|
||||
|
||||
namespace EmberNs
|
||||
@ -92,6 +90,15 @@ static inline size_t NowMs()
|
||||
#define DO_DOUBLE 1//Comment this out for shorter build times during development. Always uncomment for release.
|
||||
//#define ISAAC_FLAM3_DEBUG 1//This is almost never needed, but is very useful when troubleshooting difficult bugs. Enable it to do a side by side comparison with flam3.
|
||||
|
||||
//These two must always match.
|
||||
#ifdef WIN32
|
||||
#define ALIGN __declspec(align(16))
|
||||
#else
|
||||
#define ALIGN __attribute__ ((aligned (16)))
|
||||
#endif
|
||||
|
||||
#define ALIGN_CL "((aligned (16)))"//The extra parens are necessary.
|
||||
|
||||
#if GLM_VERSION >= 96
|
||||
#define v2T glm::tvec2<T, glm::defaultp>
|
||||
#define v3T glm::tvec3<T, glm::defaultp>
|
||||
@ -113,7 +120,7 @@ static inline size_t NowMs()
|
||||
#endif
|
||||
|
||||
enum eInterp : uint { EMBER_INTERP_LINEAR = 0, EMBER_INTERP_SMOOTH = 1 };
|
||||
enum eAffineInterp : uint { INTERP_LINEAR = 0, INTERP_LOG = 1, INTERP_COMPAT = 2, INTERP_OLDER = 3 };
|
||||
enum eAffineInterp : uint { AFFINE_INTERP_LINEAR = 0, AFFINE_INTERP_LOG = 1, AFFINE_INTERP_COMPAT = 2, AFFINE_INTERP_OLDER = 3 };
|
||||
enum ePaletteMode : uint { PALETTE_STEP = 0, PALETTE_LINEAR = 1 };
|
||||
enum ePaletteInterp : uint { INTERP_HSV = 0, INTERP_SWEEP = 1 };
|
||||
enum eMotion : uint { MOTION_SIN = 1, MOTION_TRIANGLE = 2, MOTION_HILL = 3, MOTION_SAW = 4 };
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
#include <thread>
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
//Third party headers.
|
||||
#ifdef _WIN32
|
||||
|
||||
@ -64,6 +64,8 @@ public:
|
||||
bool Save(const string& filename, vector<Ember<T>>& embers, size_t printEditDepth, bool doEdits, bool intPalette, bool hexPalette, bool append = false, bool start = false, bool finish = false)
|
||||
{
|
||||
bool b = false;
|
||||
bool hasTimes = false;
|
||||
T t = 0;
|
||||
string temp;
|
||||
ofstream f;
|
||||
|
||||
@ -76,6 +78,21 @@ public:
|
||||
|
||||
if (f.is_open())
|
||||
{
|
||||
//Check to see if there are valid times by checking if any differed.
|
||||
//If so, assume they were intentionally entered times.
|
||||
for (size_t i = 1; i < embers.size(); i++)
|
||||
{
|
||||
if (embers[i].m_Time != embers[i - 1].m_Time)
|
||||
{
|
||||
hasTimes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasTimes)
|
||||
for (auto& ember : embers)
|
||||
ember.m_Time = t++;
|
||||
|
||||
if ((append && start) || !append)
|
||||
{
|
||||
temp = "<flames>\n";
|
||||
@ -170,7 +187,6 @@ public:
|
||||
os << " gamma=\"" << ember.m_Gamma << "\"";
|
||||
os << " highlight_power=\"" << ember.m_HighlightPower << "\"";
|
||||
os << " vibrancy=\"" << ember.m_Vibrancy << "\"";
|
||||
//os << " hue=\"" << ember.m_Hue << "\"";//Oddly enough, flam3 never wrote this value out.//ORIG
|
||||
os << " estimator_radius=\"" << ember.m_MaxRadDE << "\"";
|
||||
os << " estimator_minimum=\"" << ember.m_MinRadDE << "\"";
|
||||
os << " estimator_curve=\"" << ember.m_CurveDE << "\"";
|
||||
@ -186,16 +202,18 @@ public:
|
||||
else if (ember.m_PaletteMode == PALETTE_LINEAR)
|
||||
os << " palette_mode=\"linear\"";
|
||||
|
||||
if (ember.m_Interp == EMBER_INTERP_SMOOTH)
|
||||
if (ember.m_Interp == EMBER_INTERP_LINEAR)
|
||||
os << " interpolation=\"linear\"";
|
||||
else if (ember.m_Interp == EMBER_INTERP_SMOOTH)
|
||||
os << " interpolation=\"smooth\"";
|
||||
|
||||
if (ember.m_AffineInterp == INTERP_LINEAR)
|
||||
if (ember.m_AffineInterp == AFFINE_INTERP_LINEAR)
|
||||
os << " interpolation_type=\"linear\"";
|
||||
else if (ember.m_AffineInterp == INTERP_LOG)
|
||||
else if (ember.m_AffineInterp == AFFINE_INTERP_LOG)
|
||||
os << " interpolation_type=\"log\"";
|
||||
else if (ember.m_AffineInterp == INTERP_COMPAT)
|
||||
else if (ember.m_AffineInterp == AFFINE_INTERP_COMPAT)
|
||||
os << " interpolation_type=\"old\"";
|
||||
else if (ember.m_AffineInterp == INTERP_OLDER)
|
||||
else if (ember.m_AffineInterp == AFFINE_INTERP_OLDER)
|
||||
os << " interpolation_type=\"older\"";
|
||||
|
||||
if (ember.m_PaletteInterp == INTERP_SWEEP)
|
||||
|
||||
@ -110,8 +110,8 @@ public:
|
||||
destXform->DeleteVariationById(VAR_LINEAR);
|
||||
|
||||
//Only do the next substitution for log interpolation.
|
||||
if ((i == 0 && destEmbers[i].m_AffineInterp == INTERP_LOG) ||
|
||||
(i > 0 && destEmbers[i - 1].m_AffineInterp == INTERP_LOG))
|
||||
if ((i == 0 && destEmbers[i].m_AffineInterp == AFFINE_INTERP_LOG) ||
|
||||
(i > 0 && destEmbers[i - 1].m_AffineInterp == AFFINE_INTERP_LOG))
|
||||
{
|
||||
for (ii = -1; ii <= 1; ii += 2)
|
||||
{
|
||||
@ -790,7 +790,7 @@ public:
|
||||
accang[col] += coefs[i] * cxAng[i][col];
|
||||
|
||||
if (accmode[col] == 0)
|
||||
accmag[col] += coefs[i] * log(cxMag[i][col]);
|
||||
accmag[col] += coefs[i] * std::log(cxMag[i][col]);
|
||||
else
|
||||
accmag[col] += coefs[i] * (cxMag[i][col]);
|
||||
|
||||
@ -803,12 +803,12 @@ public:
|
||||
for (col = 0; col < 2; col++)
|
||||
{
|
||||
if (accmode[col] == 0)
|
||||
expmag = exp(accmag[col]);
|
||||
expmag = std::exp(accmag[col]);
|
||||
else
|
||||
expmag = accmag[col];
|
||||
|
||||
store.m_Mat[0][col] = expmag * cos(accang[col]);
|
||||
store.m_Mat[1][col] = expmag * sin(accang[col]);
|
||||
store.m_Mat[0][col] = expmag * std::cos(accang[col]);
|
||||
store.m_Mat[1][col] = expmag * std::sin(accang[col]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -865,7 +865,7 @@ public:
|
||||
//abs peak values should be not be greater than 1.
|
||||
if (funcNum == MOTION_SIN)
|
||||
{
|
||||
return sin(T(2.0) * T(M_PI) * timeVal);
|
||||
return std::sin(T(2.0) * T(M_PI) * timeVal);
|
||||
}
|
||||
else if (funcNum == MOTION_TRIANGLE)
|
||||
{
|
||||
@ -885,7 +885,7 @@ public:
|
||||
}
|
||||
else if (funcNum == MOTION_HILL)
|
||||
{
|
||||
return ((1 - cos(T(2.0) * T(M_PI) * timeVal)) * T(0.5));
|
||||
return ((1 - std::cos(T(2.0) * T(M_PI) * timeVal)) * T(0.5));
|
||||
}
|
||||
else //MOTION_SAW
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "EmberDefines.h"
|
||||
#include "Timing.h"
|
||||
|
||||
/// <summary>
|
||||
/// C++ TEMPLATE VERSION OF Robert J. Jenkins Jr.'s
|
||||
@ -65,6 +65,8 @@ public:
|
||||
/// </summary>
|
||||
static unique_ptr<QTIsaac<ALPHA, ISAAC_INT> > GlobalRand;
|
||||
|
||||
static CriticalSection m_CS;
|
||||
|
||||
/// <summary>
|
||||
/// The structure which holds all of the random information.
|
||||
/// </summary>
|
||||
@ -116,6 +118,18 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of RandByte().
|
||||
/// </summary>
|
||||
/// <returns>The next random integer in the range of 0-255</returns>
|
||||
static inline T LockedRandByte()
|
||||
{
|
||||
m_CS.Enter();
|
||||
T t = GlobalRand->RandByte();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the next random integer.
|
||||
/// </summary>
|
||||
@ -129,6 +143,18 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Rand().
|
||||
/// </summary>
|
||||
/// <returns>The next random integer</returns>
|
||||
static inline T LockedRand()
|
||||
{
|
||||
m_CS.Enter();
|
||||
T t = GlobalRand->Rand();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the next random integer between 0 and the value passed in minus 1.
|
||||
/// </summary>
|
||||
@ -139,6 +165,19 @@ public:
|
||||
return (upper == 0) ? Rand() : Rand() % upper;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Rand().
|
||||
/// </summary>
|
||||
/// <param name="upper">A value one greater than the maximum value that will be returned</param>
|
||||
/// <returns>A value between 0 and the value passed in minus 1</returns>
|
||||
static inline T LockedRand(T upper)
|
||||
{
|
||||
m_CS.Enter();
|
||||
T t = GlobalRand->Rand(upper);
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a random floating point value between the specified minimum and maximum.
|
||||
/// Template argument expected to be float or double.
|
||||
@ -153,6 +192,21 @@ public:
|
||||
return fMin + (f * (fMax - fMin));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Frand().
|
||||
/// </summary>
|
||||
/// <param name="fMin">The minimum value allowed, inclusive.</param>
|
||||
/// <param name="fMax">The maximum value allowed, inclusive.</param>
|
||||
/// <returns>A new random floating point value within the specified range, inclusive.</returns>
|
||||
template<typename floatType>
|
||||
static inline floatType LockedFrand(floatType fMin, floatType fMax)
|
||||
{
|
||||
m_CS.Enter();
|
||||
floatType t = GlobalRand->Frand<floatType>(fMin, fMax);
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thin wrapper around a call to Frand() with a range of 0-1.
|
||||
/// Template argument expected to be float or double.
|
||||
@ -168,6 +222,19 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Frand01().
|
||||
/// </summary>
|
||||
/// <returns>A new random number in the range of 0-1, inclusive.</returns>
|
||||
template<typename floatType>
|
||||
static inline floatType LockedFrand01()
|
||||
{
|
||||
m_CS.Enter();
|
||||
floatType t = GlobalRand->Frand01<floatType>();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thin wrapper around a call to Frand() with a range of -1-1.
|
||||
/// Template argument expected to be float or double.
|
||||
@ -183,6 +250,19 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Frand11().
|
||||
/// </summary>
|
||||
/// <returns>A new random number in the range of -1-1, inclusive.</returns>
|
||||
template<typename floatType>
|
||||
static inline floatType LockedFrand11()
|
||||
{
|
||||
m_CS.Enter();
|
||||
floatType t = GlobalRand->Frand11<floatType>();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not sure what this does.
|
||||
/// </summary>
|
||||
@ -193,6 +273,19 @@ public:
|
||||
return RandBit() ? floatType(0.38196) : floatType(0.61804);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of GoldenBit().
|
||||
/// </summary>
|
||||
/// <returns>Something that is golden</returns>
|
||||
template<typename floatType>
|
||||
static inline floatType LockedGoldenBit()
|
||||
{
|
||||
m_CS.Enter();
|
||||
floatType t = GlobalRand->GoldenBit<floatType>();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a random 0 or 1.
|
||||
/// </summary>
|
||||
@ -202,6 +295,18 @@ public:
|
||||
return RandByte() & 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of RandBit().
|
||||
/// </summary>
|
||||
/// <returns>A random 0 or 1</returns>
|
||||
static inline uint LockedRandBit()
|
||||
{
|
||||
m_CS.Enter();
|
||||
uint t = GlobalRand->RandBit();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A different way of getting a floating point rand in the range -1-1.
|
||||
/// Flam3 used this but it seems unnecessary now, keep around if it's ever needed.
|
||||
|
||||
@ -108,12 +108,12 @@ public:
|
||||
|
||||
for (size_t distrib = 0; distrib < distribCount; distrib++)
|
||||
{
|
||||
T totalDensity = 0;
|
||||
double totalDensity = 0;
|
||||
|
||||
//First find the total densities of all xforms.
|
||||
for (i = 0; i < ember.XformCount(); i++)
|
||||
{
|
||||
T d = xforms[i].m_Weight;
|
||||
double d = xforms[i].m_Weight;
|
||||
|
||||
if (distrib > 0)
|
||||
d *= xforms[distrib - 1].Xaos(i);
|
||||
@ -127,14 +127,15 @@ public:
|
||||
|
||||
//Calculate how much of a fraction of a the total density each element represents.
|
||||
size_t j = 0;
|
||||
T tempDensity = 0, currentDensityLimit = 0, densityPerElement = totalDensity / CHOOSE_XFORM_GRAIN;
|
||||
//These must be double, else roundoff error will prevent the last element of m_XformDistributions from being set.
|
||||
double tempDensity = 0, currentDensityLimit = 0, densityPerElement = totalDensity / CHOOSE_XFORM_GRAIN;
|
||||
|
||||
//Assign xform indices in order to each element of m_XformDistributions.
|
||||
//The number of elements assigned a given index is proportional to that xform's
|
||||
//density relative to the sum of all densities.
|
||||
for (i = 0; i < ember.XformCount(); i++)
|
||||
{
|
||||
T temp = xforms[i].m_Weight;
|
||||
double temp = xforms[i].m_Weight;
|
||||
|
||||
if (distrib > 0)
|
||||
temp *= xforms[distrib - 1].Xaos(i);
|
||||
@ -145,6 +146,11 @@ public:
|
||||
//Also check that j is within the bounds of the distribution array just to be safe in the case of a rounding error.
|
||||
while (tempDensity < currentDensityLimit && j < CHOOSE_XFORM_GRAIN)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
//Ensure distribution contains no out of bounds indices.
|
||||
if (byte(i) >= ember.XformCount())
|
||||
throw "Out of bounds xform index in selection distribution.";
|
||||
#endif
|
||||
//printf("offset = %d, xform = %d, running sum = %f\n", j, i, tempDensity);
|
||||
m_XformDistributions[(distrib * CHOOSE_XFORM_GRAIN) + j] = byte(i);
|
||||
tempDensity += densityPerElement;
|
||||
@ -152,6 +158,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
//Ensure every element of the distribution was populated.
|
||||
if (j < CHOOSE_XFORM_GRAIN)
|
||||
throw "Not all distribution elements set, undefined behavior.";
|
||||
#endif
|
||||
//Flam3 did this, which gives the same result.
|
||||
//T t = xforms[0].m_Weight;
|
||||
//
|
||||
|
||||
@ -492,17 +492,17 @@ public:
|
||||
static T CalcAlpha(T density, T gamma, T linrange)
|
||||
{
|
||||
T frac, alpha;
|
||||
T funcval = pow(linrange, gamma);
|
||||
T funcval = std::pow(linrange, gamma);
|
||||
|
||||
if (density > 0)
|
||||
{
|
||||
if (density < linrange)
|
||||
{
|
||||
frac = density / linrange;
|
||||
alpha = (T(1.0) - frac) * density * (funcval / linrange) + frac * pow(density, gamma);
|
||||
alpha = (T(1.0) - frac) * density * (funcval / linrange) + frac * std::pow(density, gamma);
|
||||
}
|
||||
else
|
||||
alpha = pow(density, gamma);
|
||||
alpha = std::pow(density, gamma);
|
||||
}
|
||||
else
|
||||
alpha = 0;
|
||||
@ -545,7 +545,7 @@ public:
|
||||
if (maxa > 255 && highPow >= 0)
|
||||
{
|
||||
newls = T(255.0) / maxc;
|
||||
lsratio = pow(newls / ls, highPow);
|
||||
lsratio = std::pow(newls / ls, highPow);
|
||||
|
||||
//Calculate the max-value color (ranged 0 - 1).
|
||||
for (rgbi = 0; rgbi < 3; rgbi++)
|
||||
|
||||
@ -113,7 +113,7 @@ void Renderer<T, bucketT>::ComputeBounds()
|
||||
template <typename T, typename bucketT>
|
||||
void Renderer<T, bucketT>::ComputeQuality()
|
||||
{
|
||||
m_Scale = pow(T(2.0), Zoom());
|
||||
m_Scale = std::pow(T(2.0), Zoom());
|
||||
m_ScaledQuality = Quality() * m_Scale * m_Scale;
|
||||
}
|
||||
|
||||
@ -470,7 +470,7 @@ eRenderStatus Renderer<T, bucketT>::Run(vector<byte>& finalImage, double time, s
|
||||
goto Finish;
|
||||
}
|
||||
|
||||
//Don't need to do this every time through for a single image.
|
||||
//Do this every iteration for an animation, or else do it once for a single image.
|
||||
if (TemporalSamples() > 1 || !resume)
|
||||
{
|
||||
ComputeQuality();
|
||||
@ -573,7 +573,7 @@ FilterAndAccum:
|
||||
//Apply appropriate filter if iterating is complete.
|
||||
if (filterAndAccumOnly || temporalSample >= TemporalSamples())
|
||||
{
|
||||
fullRun = m_DensityFilter.get() ? GaussianDensityFilter() : LogScaleDensityFilter();
|
||||
fullRun = m_DensityFilter.get() ? GaussianDensityFilter() : LogScaleDensityFilter(forceOutput);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -581,7 +581,7 @@ FilterAndAccum:
|
||||
if (m_DensityFilter.get() && m_InteractiveFilter == FILTER_DE)
|
||||
fullRun = GaussianDensityFilter();
|
||||
else if (!m_DensityFilter.get() || m_InteractiveFilter == FILTER_LOG)
|
||||
fullRun = LogScaleDensityFilter();
|
||||
fullRun = LogScaleDensityFilter(forceOutput);
|
||||
}
|
||||
|
||||
//Only update state if iterating and filtering finished completely (didn't arrive here via forceOutput).
|
||||
@ -801,14 +801,42 @@ bool Renderer<T, bucketT>::ResetBuckets(bool resetHist, bool resetAccum)
|
||||
return resetHist || resetAccum;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log scales a single row with a specially structured loop that will be vectorized by the compiler.
|
||||
/// Note this adds an epsilon to the denomiator used to compute the logScale
|
||||
/// value because the conditional check for zero would have prevented the loop from
|
||||
/// being vectorized.
|
||||
/// </summary>
|
||||
/// <param name="row">The absolute element index in the histogram this row starts on</param>
|
||||
/// <param name="rowEnd">The absolute element index in the histogram this row ends on</param>
|
||||
template <typename T, typename bucketT>
|
||||
void Renderer<T, bucketT>::VectorizedLogScale(size_t row, size_t rowEnd)
|
||||
{
|
||||
float k1 = float(m_K1);//All types must be float.
|
||||
float k2 = float(m_K2);
|
||||
auto* __restrict hist = m_HistBuckets.data();//Vectorizer can't tell these point to different locations.
|
||||
auto* __restrict acc = m_AccumulatorBuckets.data();
|
||||
|
||||
for (size_t i = row; i < rowEnd; i++)
|
||||
{
|
||||
float logScale = (k1 * std::log(1.0f + hist[i].a * k2)) / (hist[i].a + std::numeric_limits<float>::epsilon());
|
||||
|
||||
acc[i].r = hist[i].r * logScale;//Must break these out individually. Vectorizer can't reason about vec4's overloaded * operator.
|
||||
acc[i].g = hist[i].g * logScale;
|
||||
acc[i].b = hist[i].b * logScale;
|
||||
acc[i].a = hist[i].a * logScale;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform log scale density filtering.
|
||||
/// Base case for simple log scale density estimation as discussed (mostly) in the paper
|
||||
/// in section 4, p. 6-9.
|
||||
/// </summary>
|
||||
/// <param name="forceOutput">Whether this output was forced due to an interactive render</param>
|
||||
/// <returns>True if not prematurely aborted, else false.</returns>
|
||||
template <typename T, typename bucketT>
|
||||
eRenderStatus Renderer<T, bucketT>::LogScaleDensityFilter()
|
||||
eRenderStatus Renderer<T, bucketT>::LogScaleDensityFilter(bool forceOutput)
|
||||
{
|
||||
size_t startRow = 0;
|
||||
size_t endRow = m_SuperRasH;
|
||||
@ -816,30 +844,46 @@ eRenderStatus Renderer<T, bucketT>::LogScaleDensityFilter()
|
||||
size_t endCol = m_SuperRasW;
|
||||
//Timing t(4);
|
||||
|
||||
//Original didn't parallelize this, doing so gives a 50-75% speedup.
|
||||
//The value can be directly assigned, which is quicker than summing.
|
||||
parallel_for(startRow, endRow, [&] (size_t j)
|
||||
//if (forceOutput)//Assume interactive render, so speed up at the expense of slight quality.
|
||||
//{
|
||||
// parallel_for(startRow, endRow, [&](size_t j)
|
||||
// {
|
||||
// if (!m_Abort)
|
||||
// {
|
||||
// size_t row = j * m_SuperRasW;
|
||||
// size_t rowEnd = row + endCol;
|
||||
|
||||
// VectorizedLogScale(row, rowEnd);
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
//else
|
||||
{
|
||||
size_t row = j * m_SuperRasW;
|
||||
//__m128 logm128;//Figure out SSE at some point.
|
||||
//__m128 bucketm128;
|
||||
//__m128 scaledBucket128;
|
||||
|
||||
for (size_t i = startCol; (i < endCol) && !m_Abort; i++)
|
||||
//Original didn't parallelize this, doing so gives a 50-75% speedup.
|
||||
//The value can be directly assigned, which is quicker than summing.
|
||||
parallel_for(startRow, endRow, [&](size_t j)
|
||||
{
|
||||
size_t index = row + i;
|
||||
size_t row = j * m_SuperRasW;
|
||||
size_t rowEnd = row + endCol;
|
||||
|
||||
//Check for visibility first before doing anything else to avoid all possible unnecessary calculations.
|
||||
if (m_HistBuckets[index].a != 0)
|
||||
if (!m_Abort)
|
||||
{
|
||||
bucketT logScale = (m_K1 * log(1 + m_HistBuckets[index].a * m_K2)) / m_HistBuckets[index].a;
|
||||
for (size_t i = row; i < rowEnd; i++)
|
||||
{
|
||||
//Check for visibility first before doing anything else to avoid all possible unnecessary calculations.
|
||||
if (m_HistBuckets[i].a != 0)
|
||||
{
|
||||
bucketT logScale = (m_K1 * std::log(1 + m_HistBuckets[i].a * m_K2)) / m_HistBuckets[i].a;
|
||||
|
||||
//Original did a temporary assignment, then *= logScale, then passed the result to bump_no_overflow().
|
||||
//Combine here into one operation for a slight speedup.
|
||||
m_AccumulatorBuckets[index] = m_HistBuckets[index] * logScale;
|
||||
//Original did a temporary assignment, then *= logScale, then passed the result to bump_no_overflow().
|
||||
//Combine here into one operation for a slight speedup.
|
||||
m_AccumulatorBuckets[i] = m_HistBuckets[i] * logScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//t.Toc(__FUNCTION__);
|
||||
|
||||
return m_Abort ? RENDER_ABORT : RENDER_OK;
|
||||
@ -858,7 +902,7 @@ eRenderStatus Renderer<T, bucketT>::GaussianDensityFilter()
|
||||
Timing totalTime, localTime;
|
||||
bool scf = !(Supersample() & 1);
|
||||
intmax_t ss = Floor<T>(Supersample() / T(2));
|
||||
T scfact = pow(Supersample() / (Supersample() + T(1)), T(2));
|
||||
T scfact = std::pow(Supersample() / (Supersample() + T(1)), T(2));
|
||||
|
||||
size_t threads = m_ThreadsToUse;
|
||||
size_t startRow = Supersample() - 1;
|
||||
@ -896,7 +940,7 @@ eRenderStatus Renderer<T, bucketT>::GaussianDensityFilter()
|
||||
if (bucket->a == 0)
|
||||
continue;
|
||||
|
||||
bucketT cacheLog = (m_K1 * log(1 + bucket->a * m_K2)) / bucket->a;//Caching this calculation gives a 30% speedup.
|
||||
bucketT cacheLog = (m_K1 * std::log(1 + bucket->a * m_K2)) / bucket->a;//Caching this calculation gives a 30% speedup.
|
||||
|
||||
if (ss == 0)
|
||||
{
|
||||
@ -928,7 +972,7 @@ eRenderStatus Renderer<T, bucketT>::GaussianDensityFilter()
|
||||
else if (filterSelect <= DE_THRESH)
|
||||
filterSelectInt = size_t(ceil(filterSelect)) - 1;
|
||||
else
|
||||
filterSelectInt = DE_THRESH + size_t(Floor<T>(pow(filterSelect - DE_THRESH, m_DensityFilter->Curve())));
|
||||
filterSelectInt = DE_THRESH + size_t(Floor<T>(std::pow(filterSelect - DE_THRESH, m_DensityFilter->Curve())));
|
||||
|
||||
//If the filter selected below the min specified clamp it to the min.
|
||||
if (filterSelectInt > m_DensityFilter->MaxFilterIndex())
|
||||
@ -1214,6 +1258,13 @@ EmberStats Renderer<T, bucketT>::Iterate(size_t iterCount, size_t temporalSample
|
||||
double percent, etaMs;
|
||||
EmberStats stats;
|
||||
|
||||
//Do this every iteration for an animation, or else do it once for a single image. CPU only.
|
||||
if (!m_LastIter)
|
||||
{
|
||||
m_ThreadEmbers.clear();
|
||||
m_ThreadEmbers.insert(m_ThreadEmbers.begin(), m_ThreadsToUse, m_Ember);
|
||||
}
|
||||
|
||||
#ifdef TG
|
||||
size_t threadIndex;
|
||||
|
||||
@ -1261,7 +1312,8 @@ EmberStats Renderer<T, bucketT>::Iterate(size_t iterCount, size_t temporalSample
|
||||
//Finally, iterate.
|
||||
//t.Tic();
|
||||
//Iterating, loop 3.
|
||||
m_BadVals[threadIndex] += m_Iterator->Iterate(m_Ember, params, m_Samples[threadIndex].data(), m_Rand[threadIndex]);
|
||||
m_BadVals[threadIndex] += m_Iterator->Iterate(m_ThreadEmbers[threadIndex], params, m_Samples[threadIndex].data(), m_Rand[threadIndex]);
|
||||
//m_BadVals[threadIndex] += m_Iterator->Iterate(m_Ember, params, m_Samples[threadIndex].data(), m_Rand[threadIndex]);
|
||||
//iterationTime += t.Toc();
|
||||
|
||||
if (m_LockAccum)
|
||||
@ -1459,9 +1511,7 @@ void Renderer<T, bucketT>::Accumulate(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand, Poin
|
||||
size_t histIndex, intColorIndex, histSize = m_HistBuckets.size();
|
||||
bucketT colorIndex, colorIndexFrac;
|
||||
auto dmap = palette->m_Entries.data();
|
||||
//T oneColDiv2 = m_CarToRas.OneCol() / 2;
|
||||
//T oneRowDiv2 = m_CarToRas.OneRow() / 2;
|
||||
|
||||
|
||||
//It's critical to understand what's going on here as it's one of the most important parts of the algorithm.
|
||||
//A color value gets retrieved from the palette and
|
||||
//its RGB values are added to the existing RGB values in the histogram bucket.
|
||||
@ -1484,17 +1534,6 @@ void Renderer<T, bucketT>::Accumulate(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand, Poin
|
||||
p.m_Y = (p00 * m_RotMat.D()) + (p11 * m_RotMat.E()) + m_Ember.m_RotCenterY;
|
||||
}
|
||||
|
||||
//T angle = rand.Frand01<T>() * M_2PI;
|
||||
//T r = exp(T(0.5) * sqrt(-log(rand.Frand01<T>()))) - 1;
|
||||
|
||||
//T r = (rand.Frand01<T>() + rand.Frand01<T>() - 1);
|
||||
//T r = (rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() - 2);
|
||||
|
||||
//p.m_X += (r * oneColDiv2) * cos(angle);
|
||||
//p.m_Y += (r * oneRowDiv2) * sin(angle);
|
||||
//p.m_X += r * cos(angle);
|
||||
//p.m_Y += r * sin(angle);
|
||||
|
||||
//Checking this first before converting gives better performance than converting and checking a single value, which the original did.
|
||||
//Second, an interesting optimization observation is that when keeping the bounds vars within m_CarToRas and calling its InBounds() member function,
|
||||
//rather than here as members, about a 7% speedup is achieved. This is possibly due to the fact that data from m_CarToRas is accessed
|
||||
@ -1610,7 +1649,7 @@ void Renderer<T, bucketT>::GammaCorrection(tvec4<bucketT, glm::defaultp>& bucket
|
||||
|
||||
for (glm::length_t rgbi = 0; rgbi < 3; rgbi++)
|
||||
{
|
||||
a = newRgb[rgbi] + ((1 - vibrancy) * 255 * pow(bucket[rgbi], g));
|
||||
a = newRgb[rgbi] + ((1 - vibrancy) * 255 * std::pow(bucket[rgbi], g));
|
||||
|
||||
if (NumChannels() <= 3 || !Transparency())
|
||||
{
|
||||
|
||||
@ -70,7 +70,7 @@ protected:
|
||||
virtual void MakeDmap(T colorScalar);
|
||||
virtual bool Alloc(bool histOnly = false);
|
||||
virtual bool ResetBuckets(bool resetHist = true, bool resetAccum = true);
|
||||
virtual eRenderStatus LogScaleDensityFilter();
|
||||
virtual eRenderStatus LogScaleDensityFilter(bool forceOutput = false);
|
||||
virtual eRenderStatus GaussianDensityFilter();
|
||||
virtual eRenderStatus AccumulatorToFinalImage(vector<byte>& pixels, size_t finalOffset);
|
||||
virtual eRenderStatus AccumulatorToFinalImage(byte* pixels, size_t finalOffset);
|
||||
@ -152,6 +152,7 @@ protected:
|
||||
/*inline*/ void AddToAccum(const tvec4<bucketT, glm::defaultp>& bucket, intmax_t i, intmax_t ii, intmax_t j, intmax_t jj);
|
||||
template <typename accumT> void GammaCorrection(tvec4<bucketT, glm::defaultp>& bucket, Color<bucketT>& background, bucketT g, bucketT linRange, bucketT vibrancy, bool doAlpha, bool scale, accumT* correctedChannels);
|
||||
void CurveAdjust(bucketT& a, const glm::length_t& index);
|
||||
void VectorizedLogScale(size_t row, size_t rowEnd);
|
||||
|
||||
protected:
|
||||
T m_Scale;
|
||||
@ -173,6 +174,7 @@ protected:
|
||||
Ember<T> m_TempEmber;
|
||||
Ember<T> m_LastEmber;
|
||||
vector<Ember<T>> m_Embers;
|
||||
vector<Ember<T>> m_ThreadEmbers;
|
||||
CarToRas<T> m_CarToRas;
|
||||
Iterator<T>* m_Iterator;
|
||||
unique_ptr<StandardIterator<T>> m_StandardIterator;
|
||||
|
||||
@ -185,8 +185,9 @@ public:
|
||||
/// <param name="useVars">The variations to use if the mutation mode is random</param>
|
||||
/// <param name="sym">The type of symmetry to add if random specified. If 0, it will be added randomly.</param>
|
||||
/// <param name="speed">The speed to multiply the pre affine transforms by if the mutate mode is MUTATE_ALL_COEFS, else ignored.</param>
|
||||
/// <param name="maxVars">The maximum number of variations to allow in any single xform in the ember.</param>
|
||||
/// <returns>A string describing what was done</returns>
|
||||
string Mutate(Ember<T>& ember, eMutateMode mode, vector<eVariationId>& useVars, intmax_t sym, T speed)
|
||||
string Mutate(Ember<T>& ember, eMutateMode mode, vector<eVariationId>& useVars, intmax_t sym, T speed, size_t maxVars)
|
||||
{
|
||||
bool done = false;
|
||||
size_t modXform;
|
||||
@ -224,7 +225,7 @@ public:
|
||||
do
|
||||
{
|
||||
//Create a random flame, and use the variations to replace those in the original.
|
||||
Random(mutation, useVars, sym, ember.TotalXformCount());
|
||||
Random(mutation, useVars, sym, ember.TotalXformCount(), maxVars);
|
||||
|
||||
for (size_t i = 0; i < ember.TotalXformCount(); i++)
|
||||
{
|
||||
@ -255,7 +256,7 @@ public:
|
||||
else if (mode == MUTATE_ONE_XFORM_COEFS)
|
||||
{
|
||||
//Generate a 2-xform random.
|
||||
Random(mutation, useVars, sym, 2);
|
||||
Random(mutation, useVars, sym, 2, maxVars);
|
||||
|
||||
//Which xform to mutate?
|
||||
modXform = m_Rand.Rand() % ember.TotalXformCount();
|
||||
@ -305,10 +306,10 @@ public:
|
||||
T f = T(M_PI) * m_Rand.Frand11<T>();
|
||||
T ra, rb, rd, re;
|
||||
|
||||
ra = (xform->m_Affine.A() * cos(f) + xform->m_Affine.B() * -sin(f));
|
||||
rd = (xform->m_Affine.A() * sin(f) + xform->m_Affine.D() * cos(f));
|
||||
rb = (xform->m_Affine.B() * cos(f) + xform->m_Affine.E() * -sin(f));
|
||||
re = (xform->m_Affine.B() * sin(f) + xform->m_Affine.E() * cos(f));
|
||||
ra = (xform->m_Affine.A() * std::cos(f) + xform->m_Affine.B() * -std::sin(f));
|
||||
rd = (xform->m_Affine.A() * std::sin(f) + xform->m_Affine.D() * std::cos(f));
|
||||
rb = (xform->m_Affine.B() * std::cos(f) + xform->m_Affine.E() * -std::sin(f));
|
||||
re = (xform->m_Affine.B() * std::sin(f) + xform->m_Affine.E() * std::cos(f));
|
||||
|
||||
xform->m_Affine.A(ra);
|
||||
xform->m_Affine.B(rb);
|
||||
@ -317,10 +318,10 @@ public:
|
||||
|
||||
f *= -1;
|
||||
|
||||
ra = (xform->m_Post.A() * cos(f) + xform->m_Post.B() * -sin(f));
|
||||
rd = (xform->m_Post.A() * sin(f) + xform->m_Post.D() * cos(f));
|
||||
rb = (xform->m_Post.B() * cos(f) + xform->m_Post.E() * -sin(f));
|
||||
re = (xform->m_Post.B() * sin(f) + xform->m_Post.E() * cos(f));
|
||||
ra = (xform->m_Post.A() * std::cos(f) + xform->m_Post.B() * -std::sin(f));
|
||||
rd = (xform->m_Post.A() * std::sin(f) + xform->m_Post.D() * std::cos(f));
|
||||
rb = (xform->m_Post.B() * std::cos(f) + xform->m_Post.E() * -std::sin(f));
|
||||
re = (xform->m_Post.B() * std::sin(f) + xform->m_Post.E() * std::cos(f));
|
||||
|
||||
xform->m_Post.A(ra);
|
||||
xform->m_Post.B(rb);
|
||||
@ -408,7 +409,7 @@ public:
|
||||
else if (mode == MUTATE_ALL_COEFS)
|
||||
{
|
||||
os << "mutate all coefs";
|
||||
Random(mutation, useVars, sym, ember.TotalXformCount());
|
||||
Random(mutation, useVars, sym, ember.TotalXformCount(), maxVars);
|
||||
|
||||
//Change all the coefs by a fraction of the random.
|
||||
for (size_t x = 0; x < ember.TotalXformCount(); x++)
|
||||
@ -599,11 +600,12 @@ public:
|
||||
/// Thin wrapper around Random() that passes an empty vector for useVars, a random value for symmetry and 0 for max xforms.
|
||||
/// </summary>
|
||||
/// <param name="ember">The newly created random ember</param>
|
||||
void Random(Ember<T>& ember)
|
||||
/// <param name="maxVars">The maximum number of variations to allow in any single xform in the ember.</param>
|
||||
void Random(Ember<T>& ember, size_t maxVars)
|
||||
{
|
||||
vector<eVariationId> useVars;
|
||||
|
||||
Random(ember, useVars, static_cast<intmax_t>(m_Rand.Frand<T>(-2, 2)), 0);
|
||||
Random(ember, useVars, static_cast<intmax_t>(m_Rand.Frand<T>(-2, 2)), 0, maxVars);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -613,7 +615,8 @@ public:
|
||||
/// <param name="useVars">A list of variations to use. If empty, any variation can be used.</param>
|
||||
/// <param name="sym">The symmetry type to use from -2 to 2</param>
|
||||
/// <param name="specXforms">The number of xforms to use. If 0, a quasi random count is used.</param>
|
||||
void Random(Ember<T>& ember, vector<eVariationId>& useVars, intmax_t sym, size_t specXforms)
|
||||
/// <param name="maxVars">The maximum number of variations to allow in any single xform in the ember.</param>
|
||||
void Random(Ember<T>& ember, vector<eVariationId>& useVars, intmax_t sym, size_t specXforms, size_t maxVars)
|
||||
{
|
||||
bool postid, addfinal = false;
|
||||
int var, samed, multid, samepost;
|
||||
@ -705,11 +708,13 @@ public:
|
||||
|
||||
if (var > -1)
|
||||
{
|
||||
xform->AddVariation(m_VariationList.GetVariation(var)->Copy());//Use only one variation specified for all xforms.
|
||||
if (xform->TotalVariationCount() < maxVars)
|
||||
xform->AddVariation(m_VariationList.GetVariation(var)->Copy());//Use only one variation specified for all xforms.
|
||||
}
|
||||
else if (multid && var == -1)
|
||||
{
|
||||
xform->AddVariation(m_VariationList.GetVariation(m_Rand.Rand() % varCount)->Copy());//Choose a random var for this xform.
|
||||
if (xform->TotalVariationCount() < maxVars)
|
||||
xform->AddVariation(m_VariationList.GetVariation(m_Rand.Rand() % varCount)->Copy());//Choose a random var for this xform.
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -719,7 +724,8 @@ public:
|
||||
Xform<T>* prevXform = ember.GetXform(i - 1);
|
||||
|
||||
for (j = 0; j < prevXform->TotalVariationCount(); j++)
|
||||
xform->AddVariation(prevXform->GetVariation(j)->Copy());
|
||||
if (xform->TotalVariationCount() < maxVars)
|
||||
xform->AddVariation(prevXform->GetVariation(j)->Copy());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -735,21 +741,24 @@ public:
|
||||
//the probability that multiple vars are used.
|
||||
for (j = 0; j < n; j++)
|
||||
{
|
||||
if (var != -2)
|
||||
if (xform->TotalVariationCount() < maxVars)
|
||||
{
|
||||
//Pick a random variation and use a random weight from 0-1.
|
||||
Variation<T>* v = m_VariationList.GetVariationCopy(static_cast<size_t>(m_Rand.Rand() % varCount), m_Rand.Frand<T>(T(0.001), 1));
|
||||
if (var != -2)
|
||||
{
|
||||
//Pick a random variation and use a random weight from 0-1.
|
||||
Variation<T>* v = m_VariationList.GetVariationCopy(static_cast<size_t>(m_Rand.Rand() % varCount), m_Rand.Frand<T>(T(0.001), 1));
|
||||
|
||||
if (v && !xform->AddVariation(v))
|
||||
delete v;//It already existed and therefore was not added.
|
||||
}
|
||||
else
|
||||
{
|
||||
//Pick a random variation from the suppled IDs and use a random weight from 0-1.
|
||||
Variation<T>* v = m_VariationList.GetVariationCopy(useVars[m_Rand.Rand() % useVars.size()], m_Rand.Frand<T>(T(0.001), 1));
|
||||
if (v && !xform->AddVariation(v))
|
||||
delete v;//It already existed and therefore was not added.
|
||||
}
|
||||
else
|
||||
{
|
||||
//Pick a random variation from the suppled IDs and use a random weight from 0-1.
|
||||
Variation<T>* v = m_VariationList.GetVariationCopy(useVars[m_Rand.Rand() % useVars.size()], m_Rand.Frand<T>(T(0.001), 1));
|
||||
|
||||
if (v && !xform->AddVariation(v))
|
||||
delete v;
|
||||
if (v && !xform->AddVariation(v))
|
||||
delete v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -770,15 +779,18 @@ public:
|
||||
//the probability that multiple vars are used.
|
||||
for (j = 0; j < n; j++)
|
||||
{
|
||||
if (var != -2)
|
||||
if (xform->TotalVariationCount() < maxVars)
|
||||
{
|
||||
//Pick a random variation and use a random weight from 0-1.
|
||||
xform->AddVariation(m_VariationList.GetVariationCopy(static_cast<size_t>(m_Rand.Rand() % varCount), m_Rand.Frand<T>(T(0.001), 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Pick a random variation from the suppled IDs and use a random weight from 0-1.
|
||||
xform->AddVariation(m_VariationList.GetVariationCopy(useVars[m_Rand.Rand() % useVars.size()], m_Rand.Frand<T>(T(0.001), 1)));
|
||||
if (var != -2)
|
||||
{
|
||||
//Pick a random variation and use a random weight from 0-1.
|
||||
xform->AddVariation(m_VariationList.GetVariationCopy(static_cast<size_t>(m_Rand.Rand() % varCount), m_Rand.Frand<T>(T(0.001), 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Pick a random variation from the suppled IDs and use a random weight from 0-1.
|
||||
xform->AddVariation(m_VariationList.GetVariationCopy(useVars[m_Rand.Rand() % useVars.size()], m_Rand.Frand<T>(T(0.001), 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1240,8 +1252,8 @@ public:
|
||||
{
|
||||
T r[2];
|
||||
T th = by * 2 * T(M_PI) / 360;
|
||||
T c = cos(th);
|
||||
T s = -sin(th);
|
||||
T c = std::cos(th);
|
||||
T s = -std::sin(th);
|
||||
|
||||
newCenterX -= oldCenterX;
|
||||
newCenterY -= oldCenterY;
|
||||
|
||||
@ -207,7 +207,7 @@ protected:
|
||||
x *= T(M_PI);
|
||||
|
||||
if (x != 0)
|
||||
return sin(x) / x;
|
||||
return std::sin(x) / x;
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
@ -269,7 +269,7 @@ public:
|
||||
/// <returns>The filtered value</returns>
|
||||
virtual T Filter(T t) const
|
||||
{
|
||||
return exp(-2 * t * t) * std::sqrt(2 / T(M_PI));
|
||||
return std::exp(-2 * t * t) * std::sqrt(2 / T(M_PI));
|
||||
}
|
||||
};
|
||||
|
||||
@ -604,7 +604,7 @@ public:
|
||||
/// <returns>The filtered value</returns>
|
||||
virtual T Filter(T t) const
|
||||
{
|
||||
return (T(0.42) + T(0.5) * cos(T(M_PI) * t) + T(0.08) * cos(2 * T(M_PI) * t));
|
||||
return (T(0.42) + T(0.5) * std::cos(T(M_PI) * t) + T(0.08) * std::cos(2 * T(M_PI) * t));
|
||||
}
|
||||
};
|
||||
|
||||
@ -675,7 +675,7 @@ public:
|
||||
/// <returns>The filtered value</returns>
|
||||
virtual T Filter(T t) const
|
||||
{
|
||||
return T(0.54) + T(0.46) * cos(T(M_PI) * t);
|
||||
return T(0.54) + T(0.46) * std::cos(T(M_PI) * t);
|
||||
}
|
||||
};
|
||||
|
||||
@ -703,7 +703,7 @@ public:
|
||||
/// <returns>The filtered value</returns>
|
||||
virtual T Filter(T t) const
|
||||
{
|
||||
return T(0.5) + T(0.5) * cos(T(M_PI) * t);
|
||||
return T(0.5) + T(0.5) * std::cos(T(M_PI) * t);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -207,7 +207,7 @@ public:
|
||||
slpx = T(Size() - i) / Size();
|
||||
|
||||
//Scale the color based on these values.
|
||||
m_Filter[i] = pow(slpx, fabs(filterExp));
|
||||
m_Filter[i] = std::pow(slpx, fabs(filterExp));
|
||||
|
||||
//Keep the max.
|
||||
if (m_Filter[i] > maxFilt)
|
||||
|
||||
@ -41,6 +41,18 @@ static inline bool FindIf(c& container, pr pred)
|
||||
return std::find_if(container.begin(), container.end(), pred) != container.end();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thin wrapper around std::find_if() determine if a value exists at least once.
|
||||
/// </summary>
|
||||
/// <param name="container">The container to call find_if() on</param>
|
||||
/// <param name="val">The value to search for</param>
|
||||
/// <returns>True if the value was contained at least once, else false.</returns>
|
||||
template<class c, class T>
|
||||
static inline bool Contains(c& container, const T& val)
|
||||
{
|
||||
return std::find_if(container.begin(), container.end(), [&](const T& t) -> bool { return t == val; }) != container.end();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thin wrapper around computing the total size of a vector.
|
||||
/// </summary>
|
||||
@ -574,7 +586,7 @@ static
|
||||
#endif
|
||||
float SafeTan<float>(float x)
|
||||
{
|
||||
return tan(Clamp<float>(x, FLOAT_MIN_TAN, FLOAT_MAX_TAN));
|
||||
return std::tan(Clamp<float>(x, FLOAT_MIN_TAN, FLOAT_MAX_TAN));
|
||||
}
|
||||
|
||||
template <>
|
||||
@ -583,7 +595,7 @@ static
|
||||
#endif
|
||||
double SafeTan<double>(double x)
|
||||
{
|
||||
return tan(x);
|
||||
return std::tan(x);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -632,7 +644,7 @@ static inline T Spread(T x, T y)
|
||||
template <typename T>
|
||||
static inline T Powq4(T x, T y)
|
||||
{
|
||||
return pow(fabs(x), y) * SignNz(x);
|
||||
return std::pow(std::fabs(x), y) * SignNz(x);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -696,7 +708,7 @@ static inline T Fabsmod(T v)
|
||||
template <typename T>
|
||||
static inline T Fosc(T p, T amp, T ph)
|
||||
{
|
||||
return T(0.5) - cos(p * amp + ph) * T(0.5);
|
||||
return T(0.5) - std::cos(p * amp + ph) * T(0.5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -708,7 +720,7 @@ static inline T Fosc(T p, T amp, T ph)
|
||||
template <typename T>
|
||||
static inline T Foscn(T p, T ph)
|
||||
{
|
||||
return T(0.5) - cos(p + ph) * T(0.5);
|
||||
return T(0.5) - std::cos(p + ph) * T(0.5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -719,7 +731,7 @@ static inline T Foscn(T p, T ph)
|
||||
template <typename T>
|
||||
static inline T LogScale(T x)
|
||||
{
|
||||
return x == 0 ? 0 : log((fabs(x) + 1) * T(M_E)) * SignNz(x) / T(M_E);
|
||||
return x == 0 ? 0 : std::log((fabs(x) + 1) * T(M_E)) * SignNz(x) / T(M_E);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -730,7 +742,7 @@ static inline T LogScale(T x)
|
||||
template <typename T>
|
||||
static inline T LogMap(T x)
|
||||
{
|
||||
return x == 0 ? 0 : (T(M_E) + log(x * T(M_E))) * T(0.25) * SignNz(x);
|
||||
return x == 0 ? 0 : (T(M_E) + std::log(x * T(M_E))) * T(0.25) * SignNz(x);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -73,6 +73,7 @@ enum eVariationId
|
||||
VAR_BTRANSFORM ,
|
||||
VAR_BUBBLE ,
|
||||
VAR_BUBBLE2 ,
|
||||
VAR_BUBBLET3D ,
|
||||
VAR_BUTTERFLY ,
|
||||
VAR_BWRAPS ,
|
||||
VAR_CARDIOID ,
|
||||
@ -101,6 +102,7 @@ enum eVariationId
|
||||
VAR_CPOW ,
|
||||
VAR_CPOW2 ,
|
||||
VAR_CRESCENTS ,
|
||||
VAR_CROB ,
|
||||
VAR_CROP ,
|
||||
VAR_CROPN ,
|
||||
VAR_CROSS ,
|
||||
@ -173,6 +175,10 @@ enum eVariationId
|
||||
VAR_HEART ,
|
||||
VAR_HEAT ,
|
||||
VAR_HEMISPHERE ,
|
||||
VAR_HEXAPLAY3D ,
|
||||
VAR_HEXCROP ,
|
||||
VAR_HEXES ,
|
||||
VAR_HEXNIX3D ,
|
||||
VAR_HO ,
|
||||
VAR_HOLE ,
|
||||
VAR_HORSESHOE ,
|
||||
@ -210,6 +216,8 @@ enum eVariationId
|
||||
VAR_LOG ,
|
||||
VAR_LOQ ,
|
||||
VAR_LOONIE ,
|
||||
VAR_LOONIE2 ,
|
||||
VAR_LOONIE3 ,
|
||||
VAR_LOONIE3D ,
|
||||
VAR_MASK ,
|
||||
VAR_MCARPET ,
|
||||
@ -223,10 +231,12 @@ enum eVariationId
|
||||
VAR_MODULUS ,
|
||||
VAR_MURL ,
|
||||
VAR_MURL2 ,
|
||||
VAR_NBLUR ,
|
||||
VAR_NGON ,
|
||||
VAR_NOISE ,
|
||||
VAR_NPOLAR ,
|
||||
VAR_OCTAGON ,
|
||||
VAR_OCTAPOL ,
|
||||
VAR_ORTHO ,
|
||||
VAR_OSCILLOSCOPE ,
|
||||
VAR_OVOID ,
|
||||
@ -284,6 +294,7 @@ enum eVariationId
|
||||
VAR_SINUS_GRID ,
|
||||
VAR_SINUSOIDAL ,
|
||||
VAR_SINUSOIDAL3D ,
|
||||
//VAR_SMARTCROP ,
|
||||
VAR_SPHERICAL ,
|
||||
VAR_SPHERICAL3D ,
|
||||
VAR_SPHERICALN ,
|
||||
@ -308,6 +319,7 @@ enum eVariationId
|
||||
VAR_SUPER_SHAPE3D ,
|
||||
VAR_SVF ,
|
||||
VAR_SWIRL ,
|
||||
VAR_SYNTH ,
|
||||
VAR_TAN ,
|
||||
VAR_TANCOS ,
|
||||
VAR_TANGENT ,
|
||||
@ -369,6 +381,7 @@ enum eVariationId
|
||||
VAR_PRE_BTRANSFORM,
|
||||
VAR_PRE_BUBBLE,
|
||||
VAR_PRE_BUBBLE2,
|
||||
VAR_PRE_BUBBLET3D,
|
||||
VAR_PRE_BUTTERFLY,
|
||||
VAR_PRE_BWRAPS,
|
||||
VAR_PRE_CARDIOID,
|
||||
@ -397,6 +410,7 @@ enum eVariationId
|
||||
VAR_PRE_CPOW,
|
||||
VAR_PRE_CPOW2,
|
||||
VAR_PRE_CRESCENTS,
|
||||
VAR_PRE_CROB,
|
||||
VAR_PRE_CROP,
|
||||
VAR_PRE_CROPN,
|
||||
VAR_PRE_CROSS,
|
||||
@ -469,6 +483,10 @@ enum eVariationId
|
||||
VAR_PRE_HEART,
|
||||
VAR_PRE_HEAT,
|
||||
VAR_PRE_HEMISPHERE,
|
||||
VAR_PRE_HEXAPLAY3D,
|
||||
VAR_PRE_HEXCROP,
|
||||
VAR_PRE_HEXES,
|
||||
VAR_PRE_HEXNIX3D,
|
||||
VAR_PRE_HO,
|
||||
VAR_PRE_HOLE,
|
||||
VAR_PRE_HORSESHOE,
|
||||
@ -506,6 +524,8 @@ enum eVariationId
|
||||
VAR_PRE_LOG,
|
||||
VAR_PRE_LOQ,
|
||||
VAR_PRE_LOONIE,
|
||||
VAR_PRE_LOONIE2,
|
||||
VAR_PRE_LOONIE3,
|
||||
VAR_PRE_LOONIE3D,
|
||||
VAR_PRE_MASK,
|
||||
VAR_PRE_MCARPET,
|
||||
@ -519,10 +539,12 @@ enum eVariationId
|
||||
VAR_PRE_MODULUS,
|
||||
VAR_PRE_MURL,
|
||||
VAR_PRE_MURL2,
|
||||
VAR_PRE_NBLUR,
|
||||
VAR_PRE_NGON,
|
||||
VAR_PRE_NOISE,
|
||||
VAR_PRE_NPOLAR,
|
||||
VAR_PRE_OCTAGON,
|
||||
VAR_PRE_OCTAPOL,
|
||||
VAR_PRE_ORTHO,
|
||||
VAR_PRE_OSCILLOSCOPE,
|
||||
VAR_PRE_OVOID,
|
||||
@ -580,6 +602,7 @@ enum eVariationId
|
||||
VAR_PRE_SINUS_GRID,
|
||||
VAR_PRE_SINUSOIDAL,
|
||||
VAR_PRE_SINUSOIDAL3D,
|
||||
//VAR_PRE_SMARTCROP,
|
||||
VAR_PRE_SPHERICAL,
|
||||
VAR_PRE_SPHERICAL3D,
|
||||
VAR_PRE_SPHERICALN,
|
||||
@ -604,6 +627,7 @@ enum eVariationId
|
||||
VAR_PRE_SUPER_SHAPE3D,
|
||||
VAR_PRE_SVF,
|
||||
VAR_PRE_SWIRL,
|
||||
VAR_PRE_SYNTH,
|
||||
VAR_PRE_TAN,
|
||||
VAR_PRE_TANCOS,
|
||||
VAR_PRE_TANGENT,
|
||||
@ -665,6 +689,7 @@ enum eVariationId
|
||||
VAR_POST_BTRANSFORM,
|
||||
VAR_POST_BUBBLE,
|
||||
VAR_POST_BUBBLE2,
|
||||
VAR_POST_BUBBLET3D,
|
||||
VAR_POST_BUTTERFLY,
|
||||
VAR_POST_BWRAPS,
|
||||
VAR_POST_CARDIOID,
|
||||
@ -693,6 +718,7 @@ enum eVariationId
|
||||
VAR_POST_CPOW,
|
||||
VAR_POST_CPOW2,
|
||||
VAR_POST_CRESCENTS,
|
||||
VAR_POST_CROB,
|
||||
VAR_POST_CROP,
|
||||
VAR_POST_CROPN,
|
||||
VAR_POST_CROSS,
|
||||
@ -765,6 +791,10 @@ enum eVariationId
|
||||
VAR_POST_HEART,
|
||||
VAR_POST_HEAT,
|
||||
VAR_POST_HEMISPHERE,
|
||||
VAR_POST_HEXAPLAY3D,
|
||||
VAR_POST_HEXCROP,
|
||||
VAR_POST_HEXES,
|
||||
VAR_POST_HEXNIX3D,
|
||||
VAR_POST_HO,
|
||||
VAR_POST_HOLE,
|
||||
VAR_POST_HORSESHOE,
|
||||
@ -802,6 +832,8 @@ enum eVariationId
|
||||
VAR_POST_LOG,
|
||||
VAR_POST_LOQ,
|
||||
VAR_POST_LOONIE,
|
||||
VAR_POST_LOONIE2,
|
||||
VAR_POST_LOONIE3,
|
||||
VAR_POST_LOONIE3D,
|
||||
VAR_POST_MASK,
|
||||
VAR_POST_MCARPET,
|
||||
@ -815,10 +847,12 @@ enum eVariationId
|
||||
VAR_POST_MODULUS,
|
||||
VAR_POST_MURL,
|
||||
VAR_POST_MURL2,
|
||||
VAR_POST_NBLUR,
|
||||
VAR_POST_NGON,
|
||||
VAR_POST_NOISE,
|
||||
VAR_POST_NPOLAR,
|
||||
VAR_POST_OCTAGON,
|
||||
VAR_POST_OCTAPOL,
|
||||
VAR_POST_ORTHO,
|
||||
VAR_POST_OSCILLOSCOPE,
|
||||
VAR_POST_OVOID,
|
||||
@ -876,6 +910,7 @@ enum eVariationId
|
||||
VAR_POST_SINUS_GRID,
|
||||
VAR_POST_SINUSOIDAL,
|
||||
VAR_POST_SINUSOIDAL3D,
|
||||
//VAR_POST_SMARTCROP,
|
||||
VAR_POST_SPHERICAL,
|
||||
VAR_POST_SPHERICAL3D,
|
||||
VAR_POST_SPHERICALN,
|
||||
@ -900,6 +935,7 @@ enum eVariationId
|
||||
VAR_POST_SUPER_SHAPE3D,
|
||||
VAR_POST_SVF,
|
||||
VAR_POST_SWIRL,
|
||||
VAR_POST_SYNTH,
|
||||
VAR_POST_TAN,
|
||||
VAR_POST_TANCOS,
|
||||
VAR_POST_TANGENT,
|
||||
@ -931,7 +967,7 @@ enum eVariationId
|
||||
VAR_POST_ZSCALE,
|
||||
VAR_POST_ZTRANSLATE,
|
||||
|
||||
//Direct color are special and only some have pre/post counterparts.
|
||||
//Direct color variations are special.
|
||||
VAR_DC_BUBBLE,
|
||||
VAR_DC_CARPET,
|
||||
VAR_DC_CUBE,
|
||||
@ -941,15 +977,21 @@ enum eVariationId
|
||||
VAR_DC_TRIANGLE,
|
||||
VAR_DC_ZTRANSL,
|
||||
|
||||
VAR_PRE_DC_BUBBLE,
|
||||
VAR_PRE_DC_CARPET,
|
||||
VAR_PRE_DC_CUBE,
|
||||
VAR_PRE_DC_CYLINDER,
|
||||
VAR_PRE_DC_GRIDOUT,
|
||||
VAR_PRE_DC_LINEAR,
|
||||
VAR_PRE_DC_TRIANGLE,
|
||||
VAR_PRE_DC_ZTRANSL,
|
||||
|
||||
VAR_POST_DC_BUBBLE,
|
||||
VAR_POST_DC_CARPET,
|
||||
VAR_POST_DC_CUBE,
|
||||
VAR_POST_DC_CYLINDER,
|
||||
VAR_POST_DC_GRIDOUT,
|
||||
VAR_POST_DC_LINEAR,
|
||||
VAR_POST_DC_TRIANGLE,
|
||||
VAR_POST_DC_ZTRANSL,
|
||||
|
||||
@ -1215,6 +1257,30 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an OpenCL string for the fields in this variation
|
||||
/// that change during iterations.
|
||||
/// Note these are different than regular variation parameters,
|
||||
/// and thus require a completely different solution.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual string StateOpenCLString() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an OpenCL string for the initialization of the fields in this variation
|
||||
/// that change during iterations.
|
||||
/// Note these are different than regular variation parameters,
|
||||
/// and thus require a completely different solution.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual string StateInitOpenCLString() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the name and weight of the variation as a string.
|
||||
/// </summary>
|
||||
@ -1274,6 +1340,12 @@ public:
|
||||
/// <returns>The OpenCL string to perform the equivalent calculation on the GPU in OpenCL</returns>
|
||||
virtual string OpenCLString() const { return ""; }
|
||||
|
||||
/// <summary>
|
||||
/// If the OpenCL string depends on any global functions specific to this variation, return their names.
|
||||
/// </summary>
|
||||
/// <returns>The names for global OpenCL functions specific to this variation</returns>
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const { return vector<string>(); }
|
||||
|
||||
/// <summary>
|
||||
/// If the OpenCL string depends on any functions specific to this variation, return them.
|
||||
/// </summary>
|
||||
@ -1389,6 +1461,7 @@ template <typename T> class ParametricVariation;
|
||||
/// Each of these takes the form of a name string and a pointer to a value.
|
||||
/// Also, some of them can be considered precalculated values, rather than
|
||||
/// formal parameters.
|
||||
/// Further, some can change state between iterations.
|
||||
/// This class encapsulates a single parameter.
|
||||
/// Template argument expected to be float or double.
|
||||
/// </summary>
|
||||
@ -1409,7 +1482,7 @@ public:
|
||||
/// <summary>
|
||||
/// Constructor for a precalc param that takes arguments.
|
||||
/// </summary>
|
||||
/// <param name="isPrecalc">Whether the parameter is actually a precalculated value. Default: false.</param>
|
||||
/// <param name="isPrecalc">Whether the parameter is actually a precalculated value. Always true.</param>
|
||||
/// <param name="param">A pointer to the parameter</param>
|
||||
/// <param name="name">The name of the parameter</param>
|
||||
ParamWithName(bool isPrecalc,
|
||||
@ -1419,6 +1492,21 @@ public:
|
||||
Init(param, name, 0, REAL, TLOW, TMAX, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a state param that takes arguments.
|
||||
/// </summary>
|
||||
/// <param name="isPrecalc">Whether the parameter is actually a precalculated value. Always true.</param>
|
||||
/// <param name="isState">Whether the parameter changes state between iterations. Always true.</param>
|
||||
/// <param name="param">A pointer to the parameter</param>
|
||||
/// <param name="name">The name of the parameter</param>
|
||||
ParamWithName(bool isPrecalc,
|
||||
bool isState,
|
||||
T* param,
|
||||
string name)
|
||||
{
|
||||
Init(param, name, 0, REAL, TLOW, TMAX, true, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a non-precalc param that takes arguments.
|
||||
/// </summary>
|
||||
@ -1466,6 +1554,7 @@ public:
|
||||
m_Type = paramWithName.m_Type;
|
||||
m_Name = paramWithName.m_Name;
|
||||
m_IsPrecalc = paramWithName.m_IsPrecalc;
|
||||
m_IsState = paramWithName.m_IsState;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -1481,7 +1570,8 @@ public:
|
||||
/// <param name="min">The minimum value the parameter can be</param>
|
||||
/// <param name="max">The maximum value the parameter can be</param>
|
||||
/// <param name="isPrecalc">Whether the parameter is actually a precalculated value. Default: false.</param>
|
||||
void Init(T* param, const string& name, T def = 0, eParamType type = REAL, T min = TLOW, T max = TMAX, bool isPrecalc = false)
|
||||
/// <param name="isState">Whether the parameter changes state between iterations. Default: false.</param>
|
||||
void Init(T* param, const string& name, T def = 0, eParamType type = REAL, T min = TLOW, T max = TMAX, bool isPrecalc = false, bool isState = false)
|
||||
{
|
||||
m_Param = param;
|
||||
m_Def = def;
|
||||
@ -1490,6 +1580,7 @@ public:
|
||||
m_Type = type;
|
||||
m_Name = name;
|
||||
m_IsPrecalc = isPrecalc;
|
||||
m_IsState = isState;
|
||||
|
||||
Set(m_Def);//Initial value.
|
||||
}
|
||||
@ -1569,7 +1660,8 @@ public:
|
||||
<< "Param Min: " << m_Min << endl
|
||||
<< "Param Max: " << m_Max << endl
|
||||
<< "Param Type: " << m_Type << endl
|
||||
<< "Is Precalc: " << m_IsPrecalc << endl;
|
||||
<< "Is Precalc: " << m_IsPrecalc << endl
|
||||
<< "Is State: " << m_IsState << endl;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
@ -1585,6 +1677,7 @@ public:
|
||||
eParamType Type() const { return m_Type; }
|
||||
string Name() const { return m_Name; }
|
||||
bool IsPrecalc() const { return m_IsPrecalc; }
|
||||
bool IsState() const { return m_IsState; }
|
||||
|
||||
private:
|
||||
T* m_Param;//Pointer to the parameter value.
|
||||
@ -1594,6 +1687,7 @@ private:
|
||||
eParamType m_Type;//The type of the parameter.
|
||||
string m_Name;//Name of the parameter.
|
||||
bool m_IsPrecalc;//Whether the parameter is actually a precalculated value.
|
||||
bool m_IsState;//Whether the parameter changes state between iterations. This is also considered precalc.
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -1694,7 +1788,7 @@ public:
|
||||
/// Get a pointer to a parameter value with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name to search for</param>
|
||||
/// <returns>A pointer to the parameter value if the name matched, else false.</returns>
|
||||
/// <returns>A pointer to the parameter value if the name matched, else null.</returns>
|
||||
T* GetParam(const char* name) const
|
||||
{
|
||||
for (auto& param : m_Params)
|
||||
@ -1808,11 +1902,35 @@ public:
|
||||
return vec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an OpenCL string for the fields in this variation
|
||||
/// that change during iterations.
|
||||
/// Note these are different than regular variation parameters,
|
||||
/// and thus require a completely different solution.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
virtual string StateOpenCLString() const override
|
||||
{
|
||||
ostringstream os, os2;
|
||||
os2 << "_" << XformIndexInEmber() << ";";
|
||||
string index = os2.str();
|
||||
|
||||
for (auto& param : m_Params)
|
||||
{
|
||||
if (param.IsState())
|
||||
{
|
||||
os << "\n\treal_t " << param.Name() << index;
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the name, weight and parameters of the variation as a string.
|
||||
/// </summary>
|
||||
/// <returns>The name, weight and parameters of the variation</returns>
|
||||
virtual string ToString() const
|
||||
virtual string ToString() const override
|
||||
{
|
||||
ostringstream ss;
|
||||
|
||||
@ -1849,6 +1967,20 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a pointer to the underlying ParamWithName object with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name to search for</param>
|
||||
/// <returns>A pointer to the underlying ParamWithName object if the name matched, else null.</returns>
|
||||
const ParamWithName<T>* GetUnderlyingParam(const char* name) const
|
||||
{
|
||||
for (auto& param : m_Params)
|
||||
if (!_stricmp(param.Name().c_str(), name))
|
||||
return ¶m;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vector<ParamWithName<T>> m_Params;//The params pointer vector which stores pointer to parameter members of derived classes.
|
||||
};
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "Variations03.h"
|
||||
#include "Variations04.h"
|
||||
#include "Variations05.h"
|
||||
#include "Variations06.h"
|
||||
#include "VariationsDC.h"
|
||||
|
||||
/// <summary>
|
||||
@ -35,7 +36,7 @@ public:
|
||||
/// </summary>
|
||||
VariationList()
|
||||
{
|
||||
m_Variations.reserve(900);//Change this as the list grows.
|
||||
m_Variations.reserve(eVariationId::LAST_VAR);
|
||||
ADDPREPOSTREGVAR(Linear)
|
||||
ADDPREPOSTREGVAR(Sinusoidal)
|
||||
ADDPREPOSTREGVAR(Spherical)
|
||||
@ -315,6 +316,8 @@ public:
|
||||
ADDPREPOSTREGVAR(Ho)
|
||||
ADDPREPOSTREGVAR(Julia3Dq)
|
||||
ADDPREPOSTREGVAR(Line)
|
||||
ADDPREPOSTREGVAR(Loonie2)
|
||||
ADDPREPOSTREGVAR(Loonie3)
|
||||
ADDPREPOSTREGVAR(Loonie3D)
|
||||
ADDPREPOSTREGVAR(Mcarpet)
|
||||
ADDPREPOSTREGVAR(Waves23D)
|
||||
@ -329,16 +332,25 @@ public:
|
||||
ADDPREPOSTREGVAR(Falloff2)
|
||||
ADDPREPOSTREGVAR(Falloff3)
|
||||
ADDPREPOSTREGVAR(Xtrb)
|
||||
ADDPREPOSTREGVAR(Hexaplay3D)
|
||||
ADDPREPOSTREGVAR(Hexnix3D)
|
||||
ADDPREPOSTREGVAR(Hexcrop)
|
||||
ADDPREPOSTREGVAR(Hexes)
|
||||
ADDPREPOSTREGVAR(Nblur)
|
||||
ADDPREPOSTREGVAR(Octapol)
|
||||
ADDPREPOSTREGVAR(Crob)
|
||||
ADDPREPOSTREGVAR(BubbleT3D)
|
||||
ADDPREPOSTREGVAR(Synth)
|
||||
//ADDPREPOSTREGVAR(LinearXZ)
|
||||
//ADDPREPOSTREGVAR(LinearYZ)
|
||||
|
||||
//DC are special.
|
||||
m_Variations.push_back(new DCBubbleVariation<T>());
|
||||
ADDPREPOSTREGVAR(DCBubble)
|
||||
ADDPREPOSTREGVAR(DCCarpet)
|
||||
ADDPREPOSTREGVAR(DCCube)
|
||||
m_Variations.push_back(new DCCylinderVariation<T>());
|
||||
ADDPREPOSTREGVAR(DCCylinder)
|
||||
ADDPREPOSTREGVAR(DCGridOut)
|
||||
m_Variations.push_back(new DCLinearVariation<T>());
|
||||
ADDPREPOSTREGVAR(DCLinear)
|
||||
ADDPREPOSTREGVAR(DCTriangle)
|
||||
ADDPREPOSTREGVAR(DCZTransl)
|
||||
|
||||
@ -348,6 +360,7 @@ public:
|
||||
m_RegVariations.reserve(m_Variations.size() / 3);
|
||||
m_PreVariations.reserve(m_Variations.size() / 3);
|
||||
m_PostVariations.reserve(m_Variations.size() / 3);
|
||||
m_ParametricVariations.reserve(size_t(m_Variations.size() * .90));//This is a rough guess at how many are parametric.
|
||||
|
||||
for (auto var : m_Variations) if (var->VarType() == VARTYPE_REG) m_RegVariations.push_back(var);
|
||||
for (auto var : m_Variations) if (var->VarType() == VARTYPE_PRE) m_PreVariations.push_back(var);
|
||||
|
||||
@ -58,8 +58,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * sin(helper.In.x);
|
||||
helper.Out.y = m_Weight * sin(helper.In.y);
|
||||
helper.Out.x = m_Weight * std::sin(helper.In.x);
|
||||
helper.Out.y = m_Weight * std::sin(helper.In.y);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -118,6 +118,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -208,6 +213,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -264,8 +274,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * helper.m_PrecalcSqrtSumSquares * sin(helper.m_PrecalcAtanxy + helper.m_PrecalcSqrtSumSquares);
|
||||
helper.Out.y = m_Weight * helper.m_PrecalcSqrtSumSquares * cos(helper.m_PrecalcAtanxy - helper.m_PrecalcSqrtSumSquares);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -305,8 +315,8 @@ public:
|
||||
T a = helper.m_PrecalcSqrtSumSquares * helper.m_PrecalcAtanxy;
|
||||
T r = m_Weight * helper.m_PrecalcSqrtSumSquares;
|
||||
|
||||
helper.Out.x = r * sin(a);
|
||||
helper.Out.y = (-r) * cos(a);
|
||||
helper.Out.x = r * std::sin(a);
|
||||
helper.Out.y = (-r) * std::cos(a);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -353,8 +363,8 @@ public:
|
||||
T val = T(M_PI) * helper.m_PrecalcSqrtSumSquares;
|
||||
T r = m_WeightByPI * helper.m_PrecalcAtanxy;
|
||||
|
||||
helper.Out.x = sin(val) * r;
|
||||
helper.Out.y = cos(val) * r;
|
||||
helper.Out.x = std::sin(val) * r;
|
||||
helper.Out.y = std::cos(val) * r;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -416,8 +426,8 @@ public:
|
||||
T r = Zeps(helper.m_PrecalcSqrtSumSquares);
|
||||
T r1 = m_Weight / r;
|
||||
|
||||
helper.Out.x = r1 * (helper.m_PrecalcCosa + sin(r));
|
||||
helper.Out.y = r1 * (helper.m_PrecalcSina - cos(r));
|
||||
helper.Out.x = r1 * (helper.m_PrecalcCosa + std::sin(r));
|
||||
helper.Out.y = r1 * (helper.m_PrecalcSina - std::cos(r));
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -437,6 +447,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -478,6 +493,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -497,8 +517,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * helper.m_PrecalcSina * cos(helper.m_PrecalcSqrtSumSquares);
|
||||
helper.Out.y = m_Weight * helper.m_PrecalcCosa * sin(helper.m_PrecalcSqrtSumSquares);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -540,8 +560,8 @@ public:
|
||||
{
|
||||
T a = helper.m_PrecalcAtanxy;
|
||||
T r = helper.m_PrecalcSqrtSumSquares;
|
||||
T n0 = sin(a + r);
|
||||
T n1 = cos(a - r);
|
||||
T n0 = std::sin(a + r);
|
||||
T n1 = std::cos(a - r);
|
||||
T m0 = n0 * n0 * n0 * r;
|
||||
T m1 = n1 * n1 * n1 * r;
|
||||
|
||||
@ -598,8 +618,8 @@ public:
|
||||
if (rand.RandBit())
|
||||
a += T(M_PI);
|
||||
|
||||
helper.Out.x = r * cos(a);
|
||||
helper.Out.y = r * sin(a);
|
||||
helper.Out.x = r * std::cos(a);
|
||||
helper.Out.y = r * std::sin(a);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -694,8 +714,8 @@ public:
|
||||
{
|
||||
T c10 = m_Xform->m_Affine.B();
|
||||
T c11 = m_Xform->m_Affine.E();
|
||||
T nx = helper.In.x + c10 * sin(helper.In.y * m_Dx2);
|
||||
T ny = helper.In.y + c11 * sin(helper.In.x * m_Dy2);
|
||||
T nx = helper.In.x + c10 * std::sin(helper.In.y * m_Dx2);
|
||||
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;
|
||||
@ -817,8 +837,8 @@ public:
|
||||
{
|
||||
T dx = SafeTan<T>(3 * helper.In.y);
|
||||
T dy = SafeTan<T>(3 * helper.In.x);
|
||||
T nx = helper.In.x + m_Xform->m_Affine.C() * sin(dx);
|
||||
T ny = helper.In.y + m_Xform->m_Affine.F() * sin(dy);
|
||||
T nx = helper.In.x + m_Xform->m_Affine.C() * std::sin(dx);
|
||||
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;
|
||||
@ -864,11 +884,11 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T dx = m_Weight * exp(helper.In.x - 1);
|
||||
T dx = m_Weight * std::exp(helper.In.x - 1);
|
||||
T dy = T(M_PI) * helper.In.y;
|
||||
|
||||
helper.Out.x = dx * cos(dy);
|
||||
helper.Out.y = dx * sin(dy);
|
||||
helper.Out.x = dx * std::cos(dy);
|
||||
helper.Out.y = dx * std::sin(dy);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -911,7 +931,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = m_Weight * pow(helper.m_PrecalcSqrtSumSquares, helper.m_PrecalcSina);
|
||||
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;
|
||||
@ -953,8 +973,8 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T a = helper.In.x * T(M_PI);
|
||||
T nx = cos(a) * cosh(helper.In.y);
|
||||
T ny = -sin(a) * sinh(helper.In.y);
|
||||
T nx = std::cos(a) * std::cosh(helper.In.y);
|
||||
T ny = -std::sin(a) * std::sinh(helper.In.y);
|
||||
|
||||
helper.Out.x = m_Weight * nx;
|
||||
helper.Out.y = m_Weight * ny;
|
||||
@ -1028,6 +1048,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -1061,8 +1086,8 @@ public:
|
||||
T r = m_Weight * helper.m_PrecalcSqrtSumSquares;
|
||||
|
||||
a += (fmod(a + dy, dx) > dx2) ? -dx2 : dx2;
|
||||
helper.Out.x = r * cos(a);
|
||||
helper.Out.y = r * sin(a);
|
||||
helper.Out.x = r * std::cos(a);
|
||||
helper.Out.y = r * std::sin(a);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -1085,6 +1110,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -1111,7 +1141,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = helper.m_PrecalcSqrtSumSquares * (m_BlobLow + m_BlobDiff * (T(0.5) + T(0.5) * sin(m_BlobWaves * helper.m_PrecalcAtanxy)));
|
||||
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;
|
||||
@ -1194,10 +1224,10 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T nx1 = cos(m_PdjB * helper.In.x);
|
||||
T nx2 = sin(m_PdjC * helper.In.x);
|
||||
T ny1 = sin(m_PdjA * helper.In.y);
|
||||
T ny2 = cos(m_PdjD * helper.In.y);
|
||||
T nx1 = std::cos(m_PdjB * helper.In.x);
|
||||
T nx2 = std::sin(m_PdjC * helper.In.x);
|
||||
T ny1 = std::sin(m_PdjA * helper.In.y);
|
||||
T ny2 = std::cos(m_PdjD * helper.In.y);
|
||||
|
||||
helper.Out.x = m_Weight * (ny1 - nx1);
|
||||
helper.Out.y = m_Weight * (nx2 - ny2);
|
||||
@ -1300,8 +1330,8 @@ public:
|
||||
else
|
||||
a = a + m_Fan2Dx2;
|
||||
|
||||
helper.Out.x = r * sin(a);
|
||||
helper.Out.y = r * cos(a);
|
||||
helper.Out.x = r * std::sin(a);
|
||||
helper.Out.y = r * std::cos(a);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -1534,9 +1564,9 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * sin(helper.In.x);
|
||||
helper.Out.x = m_Weight * std::sin(helper.In.x);
|
||||
helper.Out.y = m_Weight * helper.In.y;
|
||||
helper.Out.z = m_Weight * cos(helper.In.x);
|
||||
helper.Out.z = m_Weight * std::cos(helper.In.x);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
@ -1601,12 +1631,17 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
T angle = m_Angle * T(M_PI) / 2;
|
||||
|
||||
m_Vsin = sin(angle);
|
||||
m_VfCos = m_Dist * cos(angle);
|
||||
m_Vsin = std::sin(angle);
|
||||
m_VfCos = m_Dist * std::cos(angle);
|
||||
}
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
@ -1650,8 +1685,8 @@ public:
|
||||
T tempr = rand.Frand01<T>() * M_2PI;
|
||||
T r = m_Weight * rand.Frand01<T>();
|
||||
|
||||
helper.Out.x = helper.In.x * r * cos(tempr);
|
||||
helper.Out.y = helper.In.y * r * sin(tempr);
|
||||
helper.Out.x = helper.In.x * r * std::cos(tempr);
|
||||
helper.Out.y = helper.In.y * r * std::sin(tempr);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -1690,10 +1725,10 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T tempr = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand(ISAAC_INT(m_Rn))) / m_Power;
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
|
||||
helper.Out.x = r * cos(tempr);
|
||||
helper.Out.y = r * sin(tempr);
|
||||
helper.Out.x = r * std::cos(tempr);
|
||||
helper.Out.y = r * std::sin(tempr);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -1770,15 +1805,15 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int rnd = int(m_Rn * rand.Frand01<T>());
|
||||
T tempr, r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
T tempr, r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
|
||||
if ((rnd & 1) == 0)
|
||||
tempr = (M_2PI * rnd + helper.m_PrecalcAtanyx) / m_Power;
|
||||
else
|
||||
tempr = (M_2PI * rnd - helper.m_PrecalcAtanyx) / m_Power;
|
||||
|
||||
helper.Out.x = r * cos(tempr);
|
||||
helper.Out.y = r * sin(tempr);
|
||||
helper.Out.x = r * std::cos(tempr);
|
||||
helper.Out.y = r * std::sin(tempr);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
|
||||
//int rnd = (int)(m_Rn * rand.Frand01<T>());
|
||||
@ -1892,8 +1927,8 @@ public:
|
||||
T tempr = rand.Frand01<T>() * M_2PI;
|
||||
T r = m_Weight * rand.Frand01<T>();
|
||||
|
||||
helper.Out.x = r * cos(tempr);
|
||||
helper.Out.y = r * sin(tempr);
|
||||
helper.Out.x = r * std::cos(tempr);
|
||||
helper.Out.y = r * std::sin(tempr);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -1931,8 +1966,8 @@ public:
|
||||
T angle = rand.Frand01<T>() * M_2PI;
|
||||
T r = m_Weight * (rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() - 2);
|
||||
|
||||
helper.Out.x = r * cos(angle);
|
||||
helper.Out.y = r * sin(angle);
|
||||
helper.Out.x = r * std::cos(angle);
|
||||
helper.Out.y = r * std::sin(angle);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -1979,8 +2014,8 @@ public:
|
||||
T tempa = helper.m_PrecalcAtanyx + m_Spin * rndG;
|
||||
T rz = m_Zoom * rndG - 1;
|
||||
|
||||
helper.Out.x = ra * cos(tempa) + rz * helper.In.x;
|
||||
helper.Out.y = ra * sin(tempa) + rz * helper.In.y;
|
||||
helper.Out.x = ra * std::cos(tempa) + rz * helper.In.x;
|
||||
helper.Out.y = ra * std::sin(tempa) + rz * helper.In.y;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -2055,8 +2090,8 @@ public:
|
||||
T a = m_Rotation + M_2PI * (sl + rand.Frand01<T>() * m_Thickness) / m_Slices;
|
||||
T r = m_Weight * rand.Frand01<T>();
|
||||
|
||||
helper.Out.x = r * cos(a);
|
||||
helper.Out.y = r * sin(a);
|
||||
helper.Out.x = r * std::cos(a);
|
||||
helper.Out.y = r * std::sin(a);
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
@ -2127,14 +2162,14 @@ public:
|
||||
if ((helper.In.x == 0) && (helper.In.y == 0))
|
||||
rFactor = 0;
|
||||
else
|
||||
rFactor = pow(helper.m_PrecalcSumSquares, m_CPower);
|
||||
rFactor = std::pow(helper.m_PrecalcSumSquares, m_CPower);
|
||||
|
||||
T phi = helper.m_PrecalcAtanyx - m_CSides * Floor<T>(helper.m_PrecalcAtanyx * m_CSidesInv);
|
||||
|
||||
if (phi > T(0.5) * m_CSides)
|
||||
phi -= m_CSides;
|
||||
|
||||
T amp = (m_Corners * (1 / cos(phi) - 1) + m_Circle) * m_Weight * rFactor;
|
||||
T amp = (m_Corners * (1 / std::cos(phi) - 1) + m_Circle) * m_Weight * rFactor;
|
||||
|
||||
helper.Out.x = amp * helper.In.x;
|
||||
helper.Out.y = amp * helper.In.y;
|
||||
@ -2269,6 +2304,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_C22 = 2 * m_C2;
|
||||
@ -2427,7 +2467,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * sin(helper.In.x) / cos(helper.In.y);
|
||||
helper.Out.x = m_Weight * std::sin(helper.In.x) / std::cos(helper.In.y);
|
||||
helper.Out.y = m_Weight * SafeTan<T>(helper.In.y);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
@ -2497,8 +2537,8 @@ public:
|
||||
T r = m_Weight / Zeps(helper.m_PrecalcSumSquares);
|
||||
T tanr = m_Weight * SafeTan<T>(ang) * r;
|
||||
|
||||
helper.Out.x = tanr * cos(helper.In.x);
|
||||
helper.Out.y = tanr * sin(helper.In.y);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2519,6 +2559,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -2576,7 +2621,7 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = m_Weight * helper.m_PrecalcSqrtSumSquares;
|
||||
T cr = cos(r);
|
||||
T cr = std::cos(r);
|
||||
T icr = 1 / cr;
|
||||
|
||||
helper.Out.x = m_Weight * helper.In.x;
|
||||
@ -2630,7 +2675,7 @@ public:
|
||||
T sinr, cosr, diff;
|
||||
|
||||
sincos(r, &sinr, &cosr);
|
||||
diff = log10(sinr * sinr) + cosr;
|
||||
diff = std::log10(sinr * sinr) + cosr;
|
||||
|
||||
if (BadVal(diff))
|
||||
diff = -30.0;
|
||||
@ -2698,6 +2743,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -2820,14 +2870,14 @@ public:
|
||||
{
|
||||
T theta = m_Pm4 * helper.m_PrecalcAtanyx + T(M_PI_4);
|
||||
|
||||
T t1 = fabs(cos(theta));
|
||||
t1 = pow(t1, m_N2);
|
||||
T t1 = fabs(std::cos(theta));
|
||||
t1 = std::pow(t1, m_N2);
|
||||
|
||||
T t2 = fabs(sin(theta));
|
||||
t2 = pow(t2, m_N3);
|
||||
T t2 = fabs(std::sin(theta));
|
||||
t2 = std::pow(t2, m_N3);
|
||||
|
||||
T r = m_Weight * ((m_Rnd * rand.Frand01<T>() + (1 - m_Rnd) * helper.m_PrecalcSqrtSumSquares) - m_Holes)
|
||||
* pow(t1 + t2, m_PNeg1N1) / helper.m_PrecalcSqrtSumSquares;
|
||||
* std::pow(t1 + t2, m_PNeg1N1) / helper.m_PrecalcSqrtSumSquares;
|
||||
|
||||
helper.Out.x = r * helper.In.x;
|
||||
helper.Out.y = r * helper.In.y;
|
||||
@ -2925,7 +2975,7 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T theta = helper.m_PrecalcAtanyx;
|
||||
T r = m_Weight * (rand.Frand01<T>() - m_Holes) * cos(m_Petals * theta) / helper.m_PrecalcSqrtSumSquares;
|
||||
T r = m_Weight * (rand.Frand01<T>() - m_Holes) * std::cos(m_Petals * theta) / helper.m_PrecalcSqrtSumSquares;
|
||||
|
||||
helper.Out.x = r * helper.In.x;
|
||||
helper.Out.y = r * helper.In.y;
|
||||
@ -3241,7 +3291,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
helper.Out.x = m_V4 * log((t + x2) / (t - x2));
|
||||
helper.Out.x = m_V4 * std::log((t + x2) / (t - x2));
|
||||
helper.Out.y = m_V * y;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
@ -3497,6 +3547,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3651,12 +3706,12 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T a = helper.m_PrecalcAtanyx;
|
||||
T lnr = T(0.5) * log(helper.m_PrecalcSumSquares);
|
||||
T lnr = T(0.5) * std::log(helper.m_PrecalcSumSquares);
|
||||
T angle = m_C * a + m_D * lnr + m_Ang * Floor<T>(m_Power * rand.Frand01<T>());
|
||||
T m = m_Weight * exp(m_C * lnr - m_D * a);
|
||||
T m = m_Weight * std::exp(m_C * lnr - m_D * a);
|
||||
|
||||
helper.Out.x = m * cos(angle);
|
||||
helper.Out.y = m * sin(angle);
|
||||
helper.Out.x = m * std::cos(angle);
|
||||
helper.Out.y = m * std::sin(angle);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -3740,8 +3795,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * helper.In.x + m_XAmpV * exp(-helper.In.y * helper.In.y * m_XLengthV);
|
||||
helper.Out.y = m_Weight * helper.In.y + m_YAmpV * exp(-helper.In.x * helper.In.x * m_YLengthV);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -3830,8 +3885,8 @@ public:
|
||||
T r1 = std::sqrt(tmp + tmp2);
|
||||
T r2 = std::sqrt(tmp - tmp2);
|
||||
T xmax = (r1 + r2) * T(0.5);
|
||||
T a1 = log(xmax + std::sqrt(xmax - 1));
|
||||
T a2 = -acos(Clamp<T>(helper.In.x / xmax, -1, 1));
|
||||
T a1 = std::log(xmax + std::sqrt(xmax - 1));
|
||||
T a2 = -std::acos(Clamp<T>(helper.In.x / xmax, -1, 1));
|
||||
T w = m_Weight / T(11.57034632);//This is an interesting magic number.
|
||||
T snv, csv, snhu, cshu;
|
||||
|
||||
@ -3860,7 +3915,7 @@ public:
|
||||
<< "\t\treal_t r2 = sqrt(tmp - tmp2);\n"
|
||||
<< "\t\treal_t xmax = (r1 + r2) * (real_t)(0.5);\n"
|
||||
<< "\t\treal_t a1 = log(xmax + sqrt(xmax - (real_t)(1.0)));\n"
|
||||
<< "\t\treal_t a2 = -acos(Clamp(vIn.x / xmax, -(real_t)(1.0), (real_t)(1.0)));\n"
|
||||
<< "\t\treal_t a2 = -acos(clamp(vIn.x / xmax, -(real_t)(1.0), (real_t)(1.0)));\n"
|
||||
<< "\t\treal_t w = xform->m_VariationWeights[" << varIndex << "] / (real_t)(11.57034632);\n"
|
||||
<< "\t\treal_t snv = sin(a1);\n"
|
||||
<< "\t\treal_t csv = cos(a1);\n"
|
||||
@ -3916,9 +3971,9 @@ public:
|
||||
helper.Out.x = w * atan2(a, b);
|
||||
|
||||
if (helper.In.y > 0)
|
||||
helper.Out.y = w * log(xmax + ssx);
|
||||
helper.Out.y = w * std::log(xmax + ssx);
|
||||
else
|
||||
helper.Out.y = -(w * log(xmax + ssx));
|
||||
helper.Out.y = -(w * std::log(xmax + ssx));
|
||||
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
@ -3998,12 +4053,12 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T a = helper.m_PrecalcAtanyx;
|
||||
T lnr = T(0.5) * log(helper.m_PrecalcSumSquares);
|
||||
T m = m_Weight * exp(m_C * lnr - m_D * a);
|
||||
T lnr = T(0.5) * std::log(helper.m_PrecalcSumSquares);
|
||||
T m = m_Weight * std::exp(m_C * lnr - m_D * a);
|
||||
T n = m_C * a + m_D * lnr;
|
||||
|
||||
helper.Out.x = m * cos(n);
|
||||
helper.Out.y = m * sin(n);
|
||||
helper.Out.x = m * std::cos(n);
|
||||
helper.Out.y = m * std::sin(n);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -4085,7 +4140,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T expx = exp(helper.In.x) * T(0.5);
|
||||
T expx = std::exp(helper.In.x) * T(0.5);
|
||||
T expnx = T(0.25) / expx;
|
||||
T sn, cn, tmp;
|
||||
|
||||
@ -4119,6 +4174,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -4145,8 +4205,8 @@ public:
|
||||
{
|
||||
T a = atan2(y, x) + m_Spin + m_Twist * (m_Weight - r);
|
||||
|
||||
helper.Out.x = m_Weight * (r * cos(a) + m_X);//Fix to make it colapse to 0 when weight is 0.//SMOULDER
|
||||
helper.Out.y = m_Weight * (r * sin(a) - m_Y);
|
||||
helper.Out.x = m_Weight * (r * std::cos(a) + m_X);//Fix to make it colapse to 0 when weight is 0.//SMOULDER
|
||||
helper.Out.y = m_Weight * (r * std::sin(a) - m_Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4197,6 +4257,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual bool SetParamVal(const char* name, T val) override
|
||||
{
|
||||
if (!_stricmp(name, "lazysusan_spin"))
|
||||
@ -4431,9 +4496,9 @@ public:
|
||||
T t;
|
||||
|
||||
if (m_Damping == 0.0)
|
||||
t = m_Amplitude * cos(m_2PiFreq * helper.In.x) + m_Separation;
|
||||
t = m_Amplitude * std::cos(m_2PiFreq * helper.In.x) + m_Separation;
|
||||
else
|
||||
t = m_Amplitude * exp(-fabs(helper.In.x) * m_Damping) * cos(m_2PiFreq * helper.In.x) + m_Separation;
|
||||
t = m_Amplitude * std::exp(-fabs(helper.In.x) * m_Damping) * std::cos(m_2PiFreq * helper.In.x) + m_Separation;
|
||||
|
||||
if (fabs(helper.In.y) <= t)
|
||||
{
|
||||
@ -4537,7 +4602,7 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Vvar * helper.m_PrecalcAtanxy;
|
||||
helper.Out.y = m_Vvar2 * log(helper.m_PrecalcSumSquares);
|
||||
helper.Out.y = m_Vvar2 * std::log(helper.m_PrecalcSumSquares);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -4596,8 +4661,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * (helper.In.x + m_X * sin(SafeTan<T>(helper.In.y * m_C)));
|
||||
helper.Out.y = m_Weight * (helper.In.y + m_Y * sin(SafeTan<T>(helper.In.x * m_C)));
|
||||
helper.Out.x = m_Weight * (helper.In.x + m_X * std::sin(SafeTan<T>(helper.In.y * m_C)));
|
||||
helper.Out.y = m_Weight * (helper.In.y + m_Y * std::sin(SafeTan<T>(helper.In.x * m_C)));
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -4691,6 +4756,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_InvWeight = 1 / Zeps(m_Weight);
|
||||
@ -5057,8 +5127,8 @@ public:
|
||||
|
||||
a = a * m_CompFac + c * m_Angle;
|
||||
r = m_Weight * (r + m_Hole);
|
||||
helper.Out.x = r * cos(a);
|
||||
helper.Out.y = r * sin(a);
|
||||
helper.Out.x = r * std::cos(a);
|
||||
helper.Out.y = r * std::sin(a);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -5139,14 +5209,14 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
int tRand = int(m_Rn * rand.Frand01<T>());
|
||||
T a = (helper.m_PrecalcAtanyx + M_2PI * tRand) / m_Power;
|
||||
T c = T(Floor<T>((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5)));
|
||||
|
||||
a = a * m_Cf + c * m_Angle;
|
||||
helper.Out.x = r * cos(a);
|
||||
helper.Out.y = r * sin(a);
|
||||
helper.Out.x = r * std::cos(a);
|
||||
helper.Out.y = r * std::sin(a);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -5242,8 +5312,8 @@ public:
|
||||
|
||||
a = a * compFac + c * m_Angle;
|
||||
r = m_Weight * (r + m_Hole);
|
||||
helper.Out.x = r * cos(a);
|
||||
helper.Out.y = r * sin(a);
|
||||
helper.Out.x = r * std::cos(a);
|
||||
helper.Out.y = r * std::sin(a);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -5274,6 +5344,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Angle = T(M_PI) * rand.Frand01<T>();
|
||||
@ -5324,8 +5399,8 @@ public:
|
||||
else
|
||||
a = helper.m_PrecalcAtanyx + m_Outside / (m_Weight - r);
|
||||
|
||||
helper.Out.x = m_Weight * r * cos(a);
|
||||
helper.Out.y = m_Weight * r * sin(a);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -5392,9 +5467,9 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * (helper.In.x + m_ScaleX * sin(helper.In.y * m_FreqX));
|
||||
helper.Out.y = m_Weight * (helper.In.y + m_ScaleY * sin(helper.In.x * m_FreqY));
|
||||
helper.Out.z = m_Weight * (helper.In.z + m_ScaleZ * sin(helper.m_PrecalcSqrtSumSquares * m_FreqZ));
|
||||
helper.Out.x = m_Weight * (helper.In.x + m_ScaleX * std::sin(helper.In.y * m_FreqX));
|
||||
helper.Out.y = m_Weight * (helper.In.y + m_ScaleY * std::sin(helper.In.x * m_FreqY));
|
||||
helper.Out.z = m_Weight * (helper.In.z + m_ScaleZ * std::sin(helper.m_PrecalcSqrtSumSquares * m_FreqZ));
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
@ -5465,10 +5540,10 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T expe = m_Weight * exp(helper.In.x);
|
||||
T expe = m_Weight * std::exp(helper.In.x);
|
||||
|
||||
helper.Out.x = expe * cos(helper.In.y);
|
||||
helper.Out.y = expe * sin(helper.In.y);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -5505,7 +5580,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * log(helper.m_PrecalcSumSquares) * m_Denom;
|
||||
helper.Out.x = m_Weight * std::log(helper.m_PrecalcSumSquares) * m_Denom;
|
||||
helper.Out.y = m_Weight * helper.m_PrecalcAtanyx;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
@ -5530,7 +5605,7 @@ public:
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Denom = T(0.5) / log(m_Base);
|
||||
m_Denom = T(0.5) / std::log(m_Base);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -5561,8 +5636,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * sin(helper.In.x) * cosh(helper.In.y);
|
||||
helper.Out.y = m_Weight * cos(helper.In.x) * sinh(helper.In.y);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -5595,8 +5670,8 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
//clamp fabs x and y to 7.104760e+002 for cosh, and |x| 7.104760e+002 for sinh
|
||||
helper.Out.x = m_Weight * cos(helper.In.x) * cosh(helper.In.y);
|
||||
helper.Out.y = -(m_Weight * sin(helper.In.x) * sinh(helper.In.y));
|
||||
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;
|
||||
}
|
||||
|
||||
@ -5721,9 +5796,9 @@ public:
|
||||
T cscsin, csccos, cscsinh, csccosh, cscden;
|
||||
|
||||
sincos(helper.In.x, &cscsin, &csccos);
|
||||
cscsinh = sinh(helper.In.y);
|
||||
csccosh = cosh(helper.In.y);
|
||||
cscden = 2 / (cosh(2 * helper.In.y) - cos(2 * helper.In.x));
|
||||
cscsinh = std::sinh(helper.In.y);
|
||||
csccosh = std::cosh(helper.In.y);
|
||||
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;
|
||||
@ -5987,9 +6062,9 @@ public:
|
||||
T cschsin, cschcos, cschsinh, cschcosh, cschden;
|
||||
|
||||
sincos(helper.In.y, &cschsin, &cschcos);
|
||||
cschsinh = sinh(helper.In.x);
|
||||
cschcosh = cosh(helper.In.x);
|
||||
cschden = 2 / (cosh(2 * helper.In.x) - cos(2 * helper.In.y));
|
||||
cschsinh = std::sinh(helper.In.x);
|
||||
cschcosh = std::cosh(helper.In.x);
|
||||
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;
|
||||
@ -6077,8 +6152,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T s = sin(m_Freq * helper.In.x);
|
||||
T t = sin(m_Freq * helper.In.y);
|
||||
T s = std::sin(m_Freq * helper.In.x);
|
||||
T t = std::sin(m_Freq * helper.In.y);
|
||||
T dy = helper.In.y + m_AugerWeight * (m_Scale * s / 2 + fabs(helper.In.y) * s);
|
||||
T dx = helper.In.x + m_AugerWeight * (m_Scale * t / 2 + fabs(helper.In.x) * t);
|
||||
|
||||
@ -6166,10 +6241,9 @@ public:
|
||||
T avgr = m_Weight * (m_Spr * std::sqrt(std::sqrt(yy + SQR(xpw)) / frac));
|
||||
T avga = (atan2(helper.In.y, xmw) - atan2(helper.In.y, xpw)) * T(0.5);
|
||||
|
||||
helper.Out.x = avgr * cos(avga);
|
||||
helper.Out.y = avgr * sin(avga);
|
||||
helper.Out.x = avgr * std::cos(avga);
|
||||
helper.Out.y = avgr * std::sin(avga);
|
||||
helper.Out.z = helper.In.z;
|
||||
//helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
|
||||
@ -58,12 +58,12 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T theta = helper.m_PrecalcAtanyx;
|
||||
T t = (rand.Frand01<T>() * m_Thickness) * (1 / cos(m_N * theta)) - m_Holes;
|
||||
T t = (rand.Frand01<T>() * m_Thickness) * (1 / std::cos(m_N * theta)) - m_Holes;
|
||||
|
||||
if (fabs(t) != 0)
|
||||
{
|
||||
helper.Out.x = m_Weight * t * cos(theta);
|
||||
helper.Out.y = m_Weight * t * sin(theta);
|
||||
helper.Out.x = m_Weight * t * std::cos(theta);
|
||||
helper.Out.y = m_Weight * t * std::sin(theta);
|
||||
helper.Out.z = 0;
|
||||
}
|
||||
else
|
||||
@ -170,8 +170,8 @@ public:
|
||||
r = (SQR(lx) + SQR(ly)) / m_R2;
|
||||
|
||||
T theta = m_BwrapsInnerTwist * (1 - r) + m_BwrapsOuterTwist * r;
|
||||
T s = sin(theta);
|
||||
T c = cos(theta);
|
||||
T s = std::sin(theta);
|
||||
T c = std::cos(theta);
|
||||
|
||||
vx = cx + c * lx + s * ly;
|
||||
vy = cy - s * lx + c * ly;
|
||||
@ -336,8 +336,8 @@ public:
|
||||
|
||||
T r = m_Weight * side;
|
||||
T val = T(M_PI_4) * perimeter / side - T(M_PI_4);
|
||||
T sina = sin(val);
|
||||
T cosa = cos(val);
|
||||
T sina = std::sin(val);
|
||||
T cosa = std::cos(val);
|
||||
|
||||
helper.Out.x = r * cosa;
|
||||
helper.Out.y = r * sina;
|
||||
@ -716,10 +716,10 @@ public:
|
||||
{
|
||||
if (m_Bcbw != 0)
|
||||
{
|
||||
T ang = atan2(y, x);
|
||||
T ang = std::atan2(y, x);
|
||||
T omega = (T(0.2) * m_Bcbw * rand.Frand01<T>()) + 1;
|
||||
T px = omega * cos(ang);
|
||||
T py = omega * sin(ang);
|
||||
T px = omega * std::cos(ang);
|
||||
T py = omega * std::sin(ang);
|
||||
helper.Out.x = m_Weight * px;
|
||||
helper.Out.y = m_Weight * py;
|
||||
}
|
||||
@ -1134,10 +1134,10 @@ public:
|
||||
T angle = rand.Frand01<T>() * M_2PI;
|
||||
T r = m_Weight * (rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() - 2);
|
||||
T angle2 = rand.Frand01<T>() * T(M_PI);
|
||||
T sina = sin(angle);
|
||||
T cosa = cos(angle);
|
||||
T sinb = sin(angle2);
|
||||
T cosb = cos(angle2);
|
||||
T sina = std::sin(angle);
|
||||
T cosa = std::cos(angle);
|
||||
T sinb = std::sin(angle2);
|
||||
T cosb = std::cos(angle2);
|
||||
|
||||
helper.Out.x = r * sinb * cosa;
|
||||
helper.Out.y = r * sinb * sina;
|
||||
@ -1202,6 +1202,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -1254,6 +1259,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_C2x = 2 * m_Cx;
|
||||
@ -1305,13 +1315,13 @@ public:
|
||||
{
|
||||
T r = helper.m_PrecalcSqrtSumSquares;
|
||||
T temp = r * m_Pi;
|
||||
T sr = sin(temp);
|
||||
T cr = cos(temp);
|
||||
T sr = std::sin(temp);
|
||||
T cr = std::cos(temp);
|
||||
T vv = m_Weight * helper.m_PrecalcAtanxy / Zeps(m_Pi);
|
||||
|
||||
helper.Out.x = vv * sr;
|
||||
helper.Out.y = vv * cr;
|
||||
helper.Out.z = vv * (r * cos(helper.In.z));
|
||||
helper.Out.z = vv * (r * std::cos(helper.In.z));
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
@ -1337,6 +1347,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -1519,7 +1534,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = m_Weight * std::sqrt(helper.m_PrecalcSumSquares + sin(helper.m_PrecalcAtanyx * m_A) + 1);
|
||||
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;
|
||||
@ -1580,7 +1595,7 @@ public:
|
||||
|
||||
int isXY = int(LRint(helper.In.x * m_Cs) + LRint(helper.In.y * m_Cs));
|
||||
|
||||
if (isXY % 2)
|
||||
if (isXY & 1)
|
||||
{
|
||||
dx = m_Ncx + rnx;
|
||||
dy = m_Ncy;
|
||||
@ -1619,7 +1634,7 @@ public:
|
||||
<< "\n"
|
||||
<< "\t\tint isXY = (int)(LRint(vIn.x * " << cs << ") + LRint(vIn.y * " << cs << "));\n"
|
||||
<< "\n"
|
||||
<< "\t\tif (isXY % 2)\n"
|
||||
<< "\t\tif (isXY & 1)\n"
|
||||
<< "\t\t{\n"
|
||||
<< "\t\t dx = " << ncx << " + rnx;\n"
|
||||
<< "\t\t dy = " << ncy << ";\n"
|
||||
@ -1638,6 +1653,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "LRint" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Cs = 1 / Zeps(m_Size);
|
||||
@ -1719,8 +1739,8 @@ public:
|
||||
|
||||
r = m_Vvar4Pi * side + m_Hole;
|
||||
val = T(M_PI_4) * perimeter / side - T(M_PI_4);
|
||||
helper.Out.x = r * cos(val);
|
||||
helper.Out.y = r * sin(val);
|
||||
helper.Out.x = r * std::cos(val);
|
||||
helper.Out.y = r * std::sin(val);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -1832,8 +1852,8 @@ public:
|
||||
T r = m_Weight * (side + m_Hole);
|
||||
T val = T(M_PI_4) * perimeter / side - T(M_PI_4);
|
||||
|
||||
helper.Out.x = r * cos(val);
|
||||
helper.Out.y = r * sin(val);
|
||||
helper.Out.x = r * std::cos(val);
|
||||
helper.Out.y = r * std::sin(val);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -1956,6 +1976,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Fabsmod", "Fosc", "Foscn", "Lerp" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Ax = M_2PI * fabs(m_AmountX);
|
||||
@ -2061,10 +2086,10 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T expor = exp(helper.In.x * m_K - helper.In.y * m_T);
|
||||
T expor = std::exp(helper.In.x * m_K - helper.In.y * m_T);
|
||||
T temp = helper.In.x * m_T + helper.In.y * m_K;
|
||||
T snv = sin(temp);
|
||||
T csv = cos(temp);
|
||||
T snv = std::sin(temp);
|
||||
T csv = std::cos(temp);
|
||||
|
||||
helper.Out.x = m_Weight * expor * csv;
|
||||
helper.Out.y = m_Weight * expor * snv;
|
||||
@ -2098,7 +2123,7 @@ public:
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_K = T(0.5) * log(Zeps(SQR(m_Real) + SQR(m_Imag)));//Original used 1e-300, which isn't representable with a float.
|
||||
m_K = T(0.5) * std::log(Zeps(SQR(m_Real) + SQR(m_Imag)));//Original used 1e-300, which isn't representable with a float.
|
||||
m_T = atan2(m_Imag, m_Real);
|
||||
}
|
||||
|
||||
@ -2272,8 +2297,8 @@ public:
|
||||
temp = (helper.In.x * T(M_PI) + helper.In.y * m_NatLog) * -1;
|
||||
sincos(temp, &snum2, &cnum2);
|
||||
|
||||
T eradius1 = exp(helper.In.x * m_NatLog);
|
||||
T eradius2 = exp((helper.In.x * m_NatLog - helper.In.y * T(M_PI)) * -1);
|
||||
T eradius1 = std::exp(helper.In.x * m_NatLog);
|
||||
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;
|
||||
@ -2310,7 +2335,7 @@ public:
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Five = 1 / SQRT5;
|
||||
m_NatLog = log(M_PHI);
|
||||
m_NatLog = std::log(M_PHI);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -2351,8 +2376,8 @@ public:
|
||||
temp = (helper.In.x * T(M_PI) + helper.In.y * m_NatLog) * -1;
|
||||
sincos(temp, &snum2, &cnum2);
|
||||
|
||||
T eradius1 = m_Sc * exp(m_Sc2 * (helper.In.x * m_NatLog));
|
||||
T eradius2 = m_Sc * exp(m_Sc2 * ((helper.In.x * m_NatLog - helper.In.y * T(M_PI)) * -1));
|
||||
T eradius1 = m_Sc * std::exp(m_Sc2 * (helper.In.x * m_NatLog));
|
||||
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;
|
||||
@ -2391,7 +2416,7 @@ public:
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Five = 1 / SQRT5;
|
||||
m_NatLog = log(M_PHI);
|
||||
m_NatLog = std::log(M_PHI);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -2686,6 +2711,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "LRint" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -2704,7 +2734,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r, delta = pow(helper.m_PrecalcAtanyx / T(M_PI) + 1, m_A);
|
||||
T r, delta = std::pow(helper.m_PrecalcAtanyx / T(M_PI) + 1, m_A);
|
||||
|
||||
if (m_Inside != 0)
|
||||
r = m_Weight * delta / (helper.m_PrecalcSqrtSumSquares + delta);
|
||||
@ -2814,7 +2844,7 @@ public:
|
||||
{
|
||||
T pa = 2 * T(M_PI) / m_P;
|
||||
T qa = 2 * T(M_PI) / m_Q;
|
||||
T r = (1 - cos(pa)) / (cos(pa) + cos(qa)) + 1;
|
||||
T r = (1 - std::cos(pa)) / (std::cos(pa) + std::cos(qa)) + 1;
|
||||
T a = m_N * pa;
|
||||
|
||||
if (r > 0)
|
||||
@ -2822,8 +2852,8 @@ public:
|
||||
else
|
||||
r = 1;
|
||||
|
||||
m_Real = r * cos(a);
|
||||
m_Imag = r * sin(a);
|
||||
m_Real = r * std::cos(a);
|
||||
m_Imag = r * std::sin(a);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -2864,8 +2894,8 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T temp = rand.Rand() * m_Pa;
|
||||
T sina = sin(temp);
|
||||
T cosa = cos(temp);
|
||||
T sina = std::sin(temp);
|
||||
T cosa = std::cos(temp);
|
||||
T re = m_R * cosa;
|
||||
T im = m_R * sina;
|
||||
T a = helper.In.x + re;
|
||||
@ -2912,8 +2942,8 @@ public:
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
T r2 = 1 - (cos(2 * T(M_PI) / m_P) - 1) /
|
||||
(cos(2 * T(M_PI) / m_P) + cos(2 * T(M_PI) / m_Q));
|
||||
T r2 = 1 - (std::cos(2 * T(M_PI) / m_P) - 1) /
|
||||
(std::cos(2 * T(M_PI) / m_P) + std::cos(2 * T(M_PI) / m_Q));
|
||||
|
||||
if (r2 > 0)
|
||||
m_R = 1 / std::sqrt(r2);
|
||||
@ -2966,8 +2996,8 @@ public:
|
||||
T y = (b * c - a * d);
|
||||
T vr = m_Weight / (SQR(c) + SQR(d));
|
||||
T temp = rand.Rand() * m_Pa;
|
||||
T sina = sin(temp);
|
||||
T cosa = cos(temp);
|
||||
T sina = std::sin(temp);
|
||||
T cosa = std::cos(temp);
|
||||
|
||||
helper.Out.x = vr * (x * cosa + y * sina);
|
||||
helper.Out.y = vr * (y * cosa - x * sina);
|
||||
@ -3007,8 +3037,8 @@ public:
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
T r2 = 1 - (cos(2 * T(M_PI) / m_P) - 1) /
|
||||
(cos(2 * T(M_PI) / m_P) + cos(2 * T(M_PI) / m_Q));
|
||||
T r2 = 1 - (std::cos(2 * T(M_PI) / m_P) - 1) /
|
||||
(std::cos(2 * T(M_PI) / m_P) + std::cos(2 * T(M_PI) / m_Q));
|
||||
|
||||
if (r2 > 0)
|
||||
m_R = 1 / std::sqrt(r2);
|
||||
@ -3101,7 +3131,7 @@ public:
|
||||
{
|
||||
T pa = 2 * T(M_PI) / m_P;
|
||||
T qa = 2 * T(M_PI) / m_Q;
|
||||
T r = -(cos(pa) - 1) / (cos(pa) + cos(qa));
|
||||
T r = -(std::cos(pa) - 1) / (std::cos(pa) + std::cos(qa));
|
||||
T na = m_N * pa;
|
||||
|
||||
if (r > 0)
|
||||
@ -3109,8 +3139,8 @@ public:
|
||||
else
|
||||
r = 1;
|
||||
|
||||
m_Cx = r * cos(na);
|
||||
m_Cy = r * sin(na);
|
||||
m_Cx = r * std::cos(na);
|
||||
m_Cy = r * std::sin(na);
|
||||
m_C2 = SQR(m_Cx) + SQR(m_Cy);
|
||||
m_C2x = 2 * m_Cx;
|
||||
m_C2y = 2 * m_Cy;
|
||||
@ -3173,8 +3203,8 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T temp = rand.Rand() * m_Pa;
|
||||
T cx = m_R * cos(temp);
|
||||
T cy = m_R * sin(temp);
|
||||
T cx = m_R * std::cos(temp);
|
||||
T cy = m_R * std::sin(temp);
|
||||
T s2x = 1 + SQR(cx) - SQR(cy);
|
||||
T s2y = 1 + SQR(cy) - SQR(cx);
|
||||
T r2 = helper.m_PrecalcSumSquares + SQR(helper.In.z);
|
||||
@ -3223,7 +3253,7 @@ public:
|
||||
{
|
||||
T pa = M_2PI / m_P;
|
||||
T qa = M_2PI / m_Q;
|
||||
T r = -(cos(pa) - 1) / (cos(pa) + cos(qa));
|
||||
T r = -(std::cos(pa) - 1) / (std::cos(pa) + std::cos(qa));
|
||||
|
||||
if (r > 0)
|
||||
r = 1 / std::sqrt(1 + r);
|
||||
@ -3281,8 +3311,8 @@ public:
|
||||
T y = helper.In.y * m_S2y;
|
||||
T vr = m_Weight / (m_C2 * r2 + x2cx + 1);
|
||||
T temp = rand.Rand() * m_Pa;
|
||||
T sina = sin(temp);
|
||||
T cosa = cos(temp);
|
||||
T sina = std::sin(temp);
|
||||
T cosa = std::cos(temp);
|
||||
|
||||
helper.Out.x = vr * (x * cosa + y * sina);
|
||||
helper.Out.y = vr * (y * cosa - x * sina);
|
||||
@ -3327,7 +3357,7 @@ public:
|
||||
{
|
||||
T pa = M_2PI / m_P;
|
||||
T qa = M_2PI / m_Q;
|
||||
T r = -(cos(pa) - 1) / (cos(pa) + cos(qa));
|
||||
T r = -(std::cos(pa) - 1) / (std::cos(pa) + std::cos(qa));
|
||||
|
||||
if (r > 0)
|
||||
r = 1 / std::sqrt(1 + r);
|
||||
@ -3389,8 +3419,8 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T a = T(M_PI) / (helper.m_PrecalcSqrtSumSquares + 1);
|
||||
T s = sin(a);
|
||||
T c = cos(a);
|
||||
T s = std::sin(a);
|
||||
T c = std::cos(a);
|
||||
T r = helper.m_PrecalcAtanyx * m_V;
|
||||
|
||||
helper.Out.x = r * c;
|
||||
@ -3457,9 +3487,9 @@ public:
|
||||
T x = m_A * helper.In.x + m_B * helper.In.y + m_E;
|
||||
T y = m_C * helper.In.x + m_D * helper.In.y + m_F;
|
||||
T angle = (atan2(y, x) + M_2PI * rand.Rand(int(m_AbsN))) / m_Power;
|
||||
T sina = sin(angle);
|
||||
T cosa = cos(angle);
|
||||
T r = m_Weight * pow(SQR(x) + SQR(y), m_Cn);
|
||||
T sina = std::sin(angle);
|
||||
T cosa = std::cos(angle);
|
||||
T r = m_Weight * std::pow(SQR(x) + SQR(y), m_Cn);
|
||||
|
||||
helper.Out.x = r * cosa;
|
||||
helper.Out.y = r * sina;
|
||||
@ -3556,9 +3586,9 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T a = helper.m_PrecalcAtanyx * m_InvPower + rand.Rand() * m_InvPower2pi;
|
||||
T sina = sin(a);
|
||||
T cosa = cos(a);
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares, m_HalfInvPower);
|
||||
T sina = std::sin(a);
|
||||
T cosa = std::cos(a);
|
||||
T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_HalfInvPower);
|
||||
|
||||
helper.Out.x = r * cosa;
|
||||
helper.Out.y = r * sina;
|
||||
@ -3636,9 +3666,9 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T angle = helper.m_PrecalcAtanyx * m_Power;
|
||||
T sina = sin(angle);
|
||||
T cosa = cos(angle);
|
||||
T r = m_Cp * pow(helper.m_PrecalcSumSquares, m_P2);
|
||||
T sina = std::sin(angle);
|
||||
T cosa = std::cos(angle);
|
||||
T r = m_Cp * std::pow(helper.m_PrecalcSumSquares, m_P2);
|
||||
T re = r * cosa + 1;
|
||||
T im = r * sina;
|
||||
T r1 = m_Vp / (SQR(re) + SQR(im));
|
||||
@ -3726,16 +3756,16 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T angle = helper.m_PrecalcAtanyx * m_Power;
|
||||
T sina = sin(angle);
|
||||
T cosa = cos(angle);
|
||||
T r = m_C * pow(helper.m_PrecalcSumSquares, m_P2);
|
||||
T sina = std::sin(angle);
|
||||
T cosa = std::cos(angle);
|
||||
T r = m_C * std::pow(helper.m_PrecalcSumSquares, m_P2);
|
||||
T re = r * cosa + 1;
|
||||
T im = r * sina;
|
||||
|
||||
r = pow(SQR(re) + SQR(im), m_InvP);
|
||||
angle = atan2(im, re) * m_InvP2;
|
||||
sina = sin(angle);
|
||||
cosa = cos(angle);
|
||||
r = std::pow(SQR(re) + SQR(im), m_InvP);
|
||||
angle = std::atan2(im, re) * m_InvP2;
|
||||
sina = std::sin(angle);
|
||||
cosa = std::cos(angle);
|
||||
re = r * cosa;
|
||||
im = r * sina;
|
||||
|
||||
@ -3793,7 +3823,7 @@ public:
|
||||
if (m_C == -1)
|
||||
m_Vp = 0;
|
||||
else
|
||||
m_Vp = m_Weight * pow(m_C + 1, 2 / m_Power);
|
||||
m_Vp = m_Weight * std::pow(m_C + 1, 2 / m_Power);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3836,14 +3866,14 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x = (m_IsOdd != 0) ? helper.In.x : m_Vvar * helper.m_PrecalcAtanxy;
|
||||
T y = (m_IsOdd != 0) ? helper.In.y : m_Vvar2 * log(helper.m_PrecalcSumSquares);
|
||||
T angle = (atan2(y, x) + M_2PI * rand.Rand(int(m_AbsN))) / m_Nnz;
|
||||
T r = m_Weight * pow(SQR(x) + SQR(y), m_Cn) * ((m_IsOdd == 0) ? 1 : m_Parity);
|
||||
T sina = sin(angle) * r;
|
||||
T cosa = cos(angle) * r;
|
||||
T y = (m_IsOdd != 0) ? helper.In.y : m_Vvar2 * std::log(helper.m_PrecalcSumSquares);
|
||||
T angle = (std::atan2(y, x) + M_2PI * rand.Rand(int(m_AbsN))) / m_Nnz;
|
||||
T r = m_Weight * std::pow(SQR(x) + SQR(y), m_Cn) * ((m_IsOdd == 0) ? 1 : m_Parity);
|
||||
T sina = std::sin(angle) * r;
|
||||
T cosa = std::cos(angle) * r;
|
||||
|
||||
x = (m_IsOdd != 0) ? cosa : (m_Vvar2 * log(SQR(cosa) + SQR(sina)));
|
||||
y = (m_IsOdd != 0) ? sina : (m_Vvar * atan2(cosa, sina));
|
||||
x = (m_IsOdd != 0) ? cosa : (m_Vvar2 * std::log(SQR(cosa) + SQR(sina)));
|
||||
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;
|
||||
@ -3889,7 +3919,7 @@ public:
|
||||
m_Vvar2 = m_Vvar * T(0.5);
|
||||
m_AbsN = abs(m_Nnz);
|
||||
m_Cn = 1 / m_Nnz / 2;
|
||||
m_IsOdd = T(abs(int(m_Parity)) % 2);
|
||||
m_IsOdd = T(abs(int(m_Parity)) & 1);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3972,8 +4002,8 @@ public:
|
||||
else
|
||||
{
|
||||
r = 1 / std::sqrt(r);
|
||||
ts = sin(helper.m_PrecalcAtanyx);
|
||||
tc = cos(helper.m_PrecalcAtanyx);
|
||||
ts = std::sin(helper.m_PrecalcAtanyx);
|
||||
tc = std::cos(helper.m_PrecalcAtanyx);
|
||||
x = r * tc;
|
||||
y = r * ts;
|
||||
|
||||
@ -3981,13 +4011,13 @@ public:
|
||||
{
|
||||
xo = (SQR(x) + SQR(y) + 1) / (2 * x);
|
||||
ro = std::sqrt(SQR(x - xo) + SQR(y));
|
||||
theta = atan2(T(1), ro);
|
||||
theta = std::atan2(T(1), ro);
|
||||
a = fmod(m_Out * theta + atan2(y, xo - x) + theta, 2 * theta) - theta;
|
||||
sincos(a, &s, &c);
|
||||
|
||||
x = (xo - c * ro);
|
||||
y = s * ro;
|
||||
theta = atan2(y, x);
|
||||
theta = std::atan2(y, x);
|
||||
sincos(theta, &ts, &tc);
|
||||
r = 1 / std::sqrt(SQR(x) + SQR(y));
|
||||
|
||||
@ -3998,13 +4028,13 @@ public:
|
||||
{
|
||||
xo = - (SQR(x) + SQR(y) + 1) / (2 * x);
|
||||
ro = std::sqrt(SQR(-x - xo) + SQR(y));
|
||||
theta = atan2(T(1), ro);
|
||||
a = fmod(m_Out * theta + atan2(y, xo + x) + theta, 2 * theta) - theta;
|
||||
theta = std::atan2(T(1), ro);
|
||||
a = fmod(m_Out * theta + std::atan2(y, xo + x) + theta, 2 * theta) - theta;
|
||||
sincos(a, &s, &c);
|
||||
|
||||
x = (xo - c * ro);
|
||||
y = s * ro;
|
||||
theta = atan2(y, x);
|
||||
theta = std::atan2(y, x);
|
||||
sincos(theta, &ts, &tc);
|
||||
r = 1 / std::sqrt(SQR(x) + SQR(y));
|
||||
|
||||
@ -4189,10 +4219,10 @@ public:
|
||||
m_C1d = std::sqrt(1 + SQR(m_C1r));
|
||||
m_C2d = std::sqrt(1 + SQR(m_C2r));
|
||||
|
||||
m_C1x = m_C1d * cos(fmod(m_C1a, T(M_PI)));
|
||||
m_C1y = m_C1d * sin(fmod(m_C1a, T(M_PI)));
|
||||
m_C2x = m_C2d * cos(fmod(m_C2a, T(M_PI)));
|
||||
m_C2y = m_C2d * sin(fmod(m_C2a, T(M_PI)));
|
||||
m_C1x = m_C1d * std::cos(fmod(m_C1a, T(M_PI)));
|
||||
m_C1y = m_C1d * std::sin(fmod(m_C1a, T(M_PI)));
|
||||
m_C2x = m_C2d * std::cos(fmod(m_C2a, T(M_PI)));
|
||||
m_C2y = m_C2d * std::sin(fmod(m_C2a, T(M_PI)));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -4290,11 +4320,16 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Cx = -m_R * cos(m_A * T(M_PI_2)) * cos(m_B * T(M_PI_2));
|
||||
m_Cy = m_R * sin(m_A * T(M_PI_2)) * cos(m_B * T(M_PI_2));
|
||||
m_Cz = -m_R * sin(m_B * T(M_PI_2));
|
||||
m_Cx = -m_R * std::cos(m_A * T(M_PI_2)) * std::cos(m_B * T(M_PI_2));
|
||||
m_Cy = m_R * std::sin(m_A * T(M_PI_2)) * std::cos(m_B * T(M_PI_2));
|
||||
m_Cz = -m_R * std::sin(m_B * T(M_PI_2));
|
||||
|
||||
m_C2 = SQR(m_Cx) + SQR(m_Cy) + SQR(m_Cz);
|
||||
|
||||
@ -4360,8 +4395,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T xp = pow(fabs(m_Weight) * fabs(helper.In.x), m_Powx);//Original did not fabs.
|
||||
T yp = pow(fabs(m_Weight) * fabs(helper.In.y), m_Powy);
|
||||
T xp = std::pow(fabs(m_Weight) * fabs(helper.In.x), m_Powx);//Original did not fabs.
|
||||
T yp = std::pow(fabs(m_Weight) * fabs(helper.In.y), m_Powy);
|
||||
|
||||
helper.Out.x = xp * Sign(helper.In.x) + m_Lcx * helper.In.x + m_Scx;
|
||||
helper.Out.y = yp * Sign(helper.In.y) + m_Lcy * helper.In.y + m_Scy;
|
||||
@ -4408,6 +4443,11 @@ protected:
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scy, prefix + "polynomial_scy"));
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sign" };
|
||||
}
|
||||
|
||||
private:
|
||||
T m_Powx;
|
||||
T m_Powy;
|
||||
@ -4618,7 +4658,7 @@ public:
|
||||
|
||||
//Calculate cosine wave with given frequency, velocity
|
||||
//and phase based on the distance to center.
|
||||
T wave = cos(m_F * d - m_Vxp);
|
||||
T wave = std::cos(m_F * d - m_Vxp);
|
||||
|
||||
//Calculate the wave offsets
|
||||
T d1 = wave * m_Pxa + d;
|
||||
@ -4686,6 +4726,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Lerp" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_F = m_Frequency * 5;
|
||||
@ -4757,8 +4802,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T c0 = m_Ax / (1 + exp(m_Sx * helper.In.x));
|
||||
T c1 = m_Ay / (1 + exp(m_Sy * helper.In.y));
|
||||
T c0 = m_Ax / (1 + std::exp(m_Sx * helper.In.x));
|
||||
T c1 = m_Ay / (1 + std::exp(m_Sy * helper.In.y));
|
||||
T x = (2 * (c0 - T(0.5)));
|
||||
T y = (2 * (c1 - T(0.5)));
|
||||
|
||||
@ -4879,8 +4924,8 @@ public:
|
||||
{
|
||||
T x = helper.In.x;
|
||||
T y = helper.In.y;
|
||||
T sx = -1 * cos(x * m_Fx);
|
||||
T sy = -1 * cos(y * m_Fy);
|
||||
T sx = -1 * std::cos(x * m_Fx);
|
||||
T sy = -1 * std::cos(y * m_Fy);
|
||||
T tx = Lerp(helper.In.x, sx, m_Ax);
|
||||
T ty = Lerp(helper.In.y, sy, m_Ay);
|
||||
|
||||
@ -4921,6 +4966,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Lerp" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Ax = m_AmpX;
|
||||
@ -4980,7 +5030,7 @@ public:
|
||||
T xPlusy = x + y;
|
||||
T x2Minusy2 = x2 - y2;
|
||||
T x2Plusy2 = x2 + y2;
|
||||
T result = x2Minusy2 * sin(M_2PI * m_Distort * xPlusy);
|
||||
T result = x2Minusy2 * std::sin(M_2PI * m_Distort * xPlusy);
|
||||
T divident = 1;
|
||||
|
||||
if (x2Plusy2 != 0)
|
||||
@ -5097,9 +5147,9 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = exp(helper.In.y);
|
||||
T s = sin(helper.In.x);
|
||||
T c = cos(helper.In.x);
|
||||
T r = std::exp(helper.In.y);
|
||||
T s = std::sin(helper.In.x);
|
||||
T c = std::cos(helper.In.x);
|
||||
|
||||
helper.Out.x = m_Vvar2 * r * s;
|
||||
helper.Out.y = m_Vvar2 * r * c;
|
||||
@ -5162,13 +5212,13 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T angle = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand(int(m_AbsN))) / m_Power;
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
T sina = sin(angle);
|
||||
T cosa = cos(angle);
|
||||
T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
T sina = std::sin(angle);
|
||||
T cosa = std::cos(angle);
|
||||
T xn = r * cosa;
|
||||
T yn = r * sina;
|
||||
T siny = sin(m_FreqX * yn);
|
||||
T sinx = sin(m_FreqY * xn);
|
||||
T siny = std::sin(m_FreqX * yn);
|
||||
T sinx = std::sin(m_FreqY * xn);
|
||||
T dx = xn + T(0.5) * (m_ScaleX * siny + fabs(xn) * m_IncX * siny);
|
||||
T dy = yn + T(0.5) * (m_ScaleY * sinx + fabs(yn) * m_IncY * sinx);
|
||||
|
||||
@ -5432,6 +5482,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sign" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -5467,8 +5522,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight01 / SafeTan<T>(helper.In.x) * cos(helper.In.y);
|
||||
helper.Out.y = m_Weight01 / sin(helper.In.x) * (-helper.In.y);
|
||||
helper.Out.x = m_Weight01 / SafeTan<T>(helper.In.x) * std::cos(helper.In.y);
|
||||
helper.Out.y = m_Weight01 / std::sin(helper.In.x) * (-helper.In.y);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -5520,8 +5575,13 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * sin(helper.In.x) * (cosh(helper.In.y) + 1) * Sqr<T>(sin(helper.In.x));
|
||||
helper.Out.y = m_Weight * cos(helper.In.x) * (cosh(helper.In.y) + 1) * Sqr<T>(sin(helper.In.x));
|
||||
T sinx = std::sin(helper.In.x);
|
||||
T sinx2 = SQR(sinx);
|
||||
T cosx = std::cos(helper.In.x);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -5531,13 +5591,23 @@ public:
|
||||
intmax_t varIndex = IndexInXform();
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) * (cosh(vIn.y) + (real_t)(1.0)) * Sqr(sin(vIn.x));\n"
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cos(vIn.x) * (cosh(vIn.y) + (real_t)(1.0)) * Sqr(sin(vIn.x));\n"
|
||||
<< "\t\treal_t sinx = sin(vIn.x);\n"
|
||||
<< "\t\treal_t sinx2 = SQR(sinx);\n"
|
||||
<< "\t\treal_t cosx = cos(vIn.x);\n"
|
||||
<< "\t\treal_t coshy1 = cosh(vIn.y) + 1.0;\n"
|
||||
<< "\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}\n";
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5554,9 +5624,13 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T d = m_Weight / helper.m_PrecalcSumSquares;
|
||||
T sinx = std::sin(helper.In.x);
|
||||
T sinx2 = SQR(sinx);
|
||||
T cosx = std::cos(helper.In.x);
|
||||
T coshy1 = std::cosh(helper.In.y) + 1;
|
||||
|
||||
helper.Out.x = d * sin(helper.In.x) * (cosh(helper.In.y) + 1) * Sqr(sin(helper.In.x));
|
||||
helper.Out.y = d * cos(helper.In.x) * (cosh(helper.In.y) + 1) * Sqr(sin(helper.In.x));
|
||||
helper.Out.x = d * sinx * coshy1 * sinx2;
|
||||
helper.Out.y = d * cosx * coshy1 * sinx2;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -5567,14 +5641,23 @@ public:
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] / precalcSumSquares;\n"
|
||||
<< "\t\treal_t sinx = sin(vIn.x);\n"
|
||||
<< "\t\treal_t sinx2 = SQR(sinx);\n"
|
||||
<< "\t\treal_t cosx = cos(vIn.x);\n"
|
||||
<< "\t\treal_t coshy1 = cosh(vIn.y) + 1.0;\n"
|
||||
<< "\n"
|
||||
<< "\t\tvOut.x = d * sin(vIn.x) * (cosh(vIn.y) + (real_t)(1.0)) * Sqr(sin(vIn.x));\n"
|
||||
<< "\t\tvOut.y = d * cos(vIn.x) * (cosh(vIn.y) + (real_t)(1.0)) * Sqr(sin(vIn.x));\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}\n";
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -5601,15 +5684,15 @@ public:
|
||||
|
||||
a += M_2PI * n;
|
||||
|
||||
if (cos(a * m_InvSpread) < rand.Rand() * 2 / 0xFFFFFFFF - 1)//Rand max.
|
||||
if (std::cos(a * m_InvSpread) < rand.Rand() * 2 / 0xFFFFFFFF - 1)//Rand max.
|
||||
a -= m_FullSpread;
|
||||
|
||||
T lnr2 = log(helper.m_PrecalcSumSquares);
|
||||
T r = m_Weight * exp(m_HalfC * lnr2 - m_D * a);
|
||||
T lnr2 = std::log(helper.m_PrecalcSumSquares);
|
||||
T r = m_Weight * std::exp(m_HalfC * lnr2 - m_D * a);
|
||||
T temp = m_C * a + m_HalfD * lnr2 + m_Ang * rand.Rand();
|
||||
|
||||
helper.Out.x = r * cos(temp);
|
||||
helper.Out.y = r * sin(temp);
|
||||
helper.Out.x = r * std::cos(temp);
|
||||
helper.Out.y = r * std::sin(temp);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
}
|
||||
|
||||
@ -5658,8 +5741,8 @@ public:
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Ang = M_2PI / m_Divisor;
|
||||
m_C = m_R * cos(T(M_PI) / 2 * m_A) / m_Divisor;
|
||||
m_D = m_R * sin(T(M_PI) / 2 * m_A) / m_Divisor;
|
||||
m_C = m_R * std::cos(T(M_PI) / 2 * m_A) / m_Divisor;
|
||||
m_D = m_R * std::sin(T(M_PI) / 2 * m_A) / m_Divisor;
|
||||
m_HalfC = m_C / 2;
|
||||
m_HalfD = m_D / 2;
|
||||
m_InvSpread = T(0.5) / m_Spread;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -26,16 +26,16 @@ public:
|
||||
|
||||
ClampGteRef<T>(xmax, -1);
|
||||
|
||||
T mu = acosh(xmax);
|
||||
T nu = acos(Clamp<T>(helper.In.x / xmax, -1, 1));//-Pi < nu < Pi.
|
||||
T mu = std::acosh(xmax);
|
||||
T nu = std::acos(Clamp<T>(helper.In.x / xmax, -1, 1));//-Pi < nu < Pi.
|
||||
|
||||
if (helper.In.y < 0)
|
||||
nu *= -1;
|
||||
|
||||
nu = nu + mu * m_Out + m_In / mu;
|
||||
|
||||
helper.Out.x = m_Weight * cosh(mu) * cos(nu);
|
||||
helper.Out.y = m_Weight * sinh(mu) * sin(nu);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
<< "\t\t xmax = 1;\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t mu = acosh(xmax);\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"
|
||||
@ -72,6 +72,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "SafeSqrt" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -623,6 +628,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -660,6 +670,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -683,8 +698,8 @@ public:
|
||||
|
||||
if (m_VarType == VARTYPE_REG)
|
||||
{
|
||||
helper.Out.x = 0;
|
||||
outPoint.m_X = helper.In.x;
|
||||
helper.Out.x = helper.In.x;
|
||||
outPoint.m_X = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -729,8 +744,8 @@ public:
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_RxSin = sin(m_Weight * T(M_PI_2));
|
||||
m_RxCos = cos(m_Weight * T(M_PI_2));
|
||||
m_RxSin = std::sin(m_Weight * T(M_PI_2));
|
||||
m_RxCos = std::cos(m_Weight * T(M_PI_2));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -812,8 +827,8 @@ public:
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_RySin = sin(m_Weight * T(M_PI_2));
|
||||
m_RyCos = cos(m_Weight * T(M_PI_2));
|
||||
m_RySin = std::sin(m_Weight * T(M_PI_2));
|
||||
m_RyCos = std::cos(m_Weight * T(M_PI_2));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -853,8 +868,8 @@ public:
|
||||
|
||||
if (m_VarType == VARTYPE_REG)
|
||||
{
|
||||
helper.Out.z = 0;
|
||||
outPoint.m_Z = helper.In.z;
|
||||
helper.Out.z = helper.In.z;
|
||||
outPoint.m_Z = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -894,8 +909,8 @@ public:
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_RzSin = sin(m_Weight * T(M_PI_2));
|
||||
m_RzCos = cos(m_Weight * T(M_PI_2));
|
||||
m_RzSin = std::sin(m_Weight * T(M_PI_2));
|
||||
m_RzCos = std::cos(m_Weight * T(M_PI_2));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -1181,7 +1196,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 = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
|
||||
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"//WHY IS THIS DIFFERENT THAN THE CPU ONE?//TODO
|
||||
<< "\t}\n";
|
||||
|
||||
return ss.str();
|
||||
@ -1231,11 +1246,11 @@ public:
|
||||
{
|
||||
T jun = Zeps(fabs(m_N));
|
||||
|
||||
T a = (atan2(helper.In.y, pow(fabs(helper.In.x), m_Sep)) + M_2PI * Floor<T>(rand.Frand01<T>() * m_AbsN)) / jun;
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn * m_A);
|
||||
T a = (std::atan2(helper.In.y, std::pow(fabs(helper.In.x), m_Sep)) + M_2PI * Floor<T>(rand.Frand01<T>() * m_AbsN)) / jun;
|
||||
T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn * m_A);
|
||||
|
||||
helper.Out.x = r * cos(a) + m_B;
|
||||
helper.Out.y = r * sin(a) + m_B;
|
||||
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.
|
||||
}
|
||||
|
||||
@ -1266,6 +1281,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
T jun = Zeps(fabs(m_N));
|
||||
@ -1317,8 +1337,8 @@ public:
|
||||
T sqY = SQR(helper.In.y);
|
||||
T v = (sqX + sqY) * m_W;//Do not use precalcSumSquares here because its components are needed below.
|
||||
|
||||
helper.Out.x = m_Weight * sin(helper.In.x) * (sqX + m_W - v);
|
||||
helper.Out.y = m_Weight * sin(helper.In.y) * (sqY + m_W - v);
|
||||
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 == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
}
|
||||
|
||||
@ -1467,7 +1487,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual string OpenCLFuncsString() const
|
||||
virtual string OpenCLFuncsString() const override
|
||||
{
|
||||
return
|
||||
"real_t VoronDiscreteNoise(int x)\n"
|
||||
@ -1611,8 +1631,8 @@ public:
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_SinR = sin(m_Rotation);
|
||||
m_CosR = cos(m_Rotation);
|
||||
m_SinR = std::sin(m_Rotation);
|
||||
m_CosR = std::cos(m_Rotation);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -1695,24 +1715,24 @@ public:
|
||||
if (rand.RandBit())
|
||||
phi1 = -phi1;
|
||||
|
||||
sinr = sin(rho1);
|
||||
cosr = cos(rho1);
|
||||
sinr = std::sin(rho1);
|
||||
cosr = std::cos(rho1);
|
||||
|
||||
sinp = sin(phi1);
|
||||
cosp = cos(phi1);
|
||||
sinp = std::sin(phi1);
|
||||
cosp = std::cos(phi1);
|
||||
|
||||
temp = m_M4_1 * rho1;
|
||||
msinr = sin(temp);
|
||||
mcosr = cos(temp);
|
||||
msinr = std::sin(temp);
|
||||
mcosr = std::cos(temp);
|
||||
|
||||
temp = m_M4_2 * phi1;
|
||||
msinp = sin(temp);
|
||||
mcosp = cos(temp);
|
||||
msinp = std::sin(temp);
|
||||
mcosp = std::cos(temp);
|
||||
|
||||
pr1 = m_An2_1 * pow(fabs(mcosr), m_N2_1) + m_Bn3_1 * pow(fabs(msinr), m_N3_1);
|
||||
pr2 = m_An2_2 * pow(fabs(mcosp), m_N2_2) + m_Bn3_2 * pow(fabs(msinp), m_N3_2);
|
||||
r1 = pow(fabs(pr1), m_N1_1) + m_Spiral * rho1;
|
||||
r2 = pow(fabs(pr2), m_N1_2);
|
||||
pr1 = m_An2_1 * std::pow(fabs(mcosr), m_N2_1) + m_Bn3_1 * std::pow(fabs(msinr), m_N3_1);
|
||||
pr2 = m_An2_2 * std::pow(fabs(mcosp), m_N2_2) + m_Bn3_2 * std::pow(fabs(msinp), m_N3_2);
|
||||
r1 = std::pow(fabs(pr1), m_N1_1) + m_Spiral * rho1;
|
||||
r2 = std::pow(fabs(pr2), m_N1_2);
|
||||
|
||||
if (int(m_Toroidmap) == 1)
|
||||
{
|
||||
@ -1810,10 +1830,10 @@ public:
|
||||
{
|
||||
m_N1n_1 = (-1 / m_N1_1);
|
||||
m_N1n_2 = (-1 / m_N1_2);
|
||||
m_An2_1 = pow(fabs(1 / m_A1), m_N2_1);
|
||||
m_An2_2 = pow(fabs(1 / m_A2), m_N2_2);
|
||||
m_Bn3_1 = pow(fabs(1 / m_B1), m_N3_1);
|
||||
m_Bn3_2 = pow(fabs(1 / m_B2), m_N3_2);
|
||||
m_An2_1 = std::pow(fabs(1 / m_A1), m_N2_1);
|
||||
m_An2_2 = std::pow(fabs(1 / m_A2), m_N2_2);
|
||||
m_Bn3_1 = std::pow(fabs(1 / m_B1), m_N3_1);
|
||||
m_Bn3_2 = std::pow(fabs(1 / m_B2), m_N3_2);
|
||||
m_M4_1 = m_M1 / 4;
|
||||
m_M4_2 = m_M2 / 4;
|
||||
m_Rho2Pi = m_Rho * T(M_2_PI);
|
||||
@ -1902,8 +1922,8 @@ public:
|
||||
T t, rX, rY, rZ;
|
||||
|
||||
t = Zeps(helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||
rX = m_Weight / pow(t, m_StretchX);
|
||||
rY = m_Weight / pow(t, m_StretchY);
|
||||
rX = m_Weight / std::pow(t, m_StretchX);
|
||||
rY = m_Weight / std::pow(t, m_StretchY);
|
||||
|
||||
helper.Out.x = helper.In.x * rX;
|
||||
helper.Out.y = helper.In.y * rY;
|
||||
@ -1911,7 +1931,7 @@ public:
|
||||
//Optional 3D calculation.
|
||||
if (int(m_ZOn) == 1)
|
||||
{
|
||||
rZ = m_Weight / pow(t, m_StretchZ);
|
||||
rZ = m_Weight / std::pow(t, m_StretchZ);
|
||||
helper.Out.z = helper.In.z * rZ;
|
||||
}
|
||||
}
|
||||
@ -1948,6 +1968,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -1987,10 +2012,10 @@ public:
|
||||
T yi = helper.In.y - m_Y;
|
||||
|
||||
const T rad = std::sqrt(SQR(xi) + SQR(yi));
|
||||
const T ang = atan2(yi, xi);
|
||||
const T ang = std::atan2(yi, xi);
|
||||
const T rdc = m_Radius + (rand.Frand01<T>() * T(0.5) * m_Ca);
|
||||
const T s = sin(ang);
|
||||
const T c = cos(ang);
|
||||
const T s = std::sin(ang);
|
||||
const T c = std::cos(ang);
|
||||
|
||||
const int esc = rad > m_Radius;
|
||||
const int cr0 = int(m_Zero);
|
||||
@ -2131,15 +2156,15 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
const T z = helper.In.z / m_AbsN;
|
||||
const T radiusOut = m_Weight * pow(helper.m_PrecalcSumSquares + z * z, m_Cn);
|
||||
const T radiusOut = m_Weight * std::pow(helper.m_PrecalcSumSquares + z * z, m_Cn);
|
||||
const T x = m_A * helper.In.x + m_B * helper.In.y + m_E;
|
||||
const T y = m_C * helper.In.x + m_D * helper.In.y + m_F;
|
||||
const T tempRand = T(int(rand.Frand01<T>() * m_AbsN));
|
||||
const T alpha = (atan2(y, x) + M_2PI * tempRand) / m_Power;
|
||||
const T alpha = (std::atan2(y, x) + M_2PI * tempRand) / m_Power;
|
||||
const T gamma = radiusOut * helper.m_PrecalcSqrtSumSquares;
|
||||
|
||||
helper.Out.x = gamma * cos(alpha);
|
||||
helper.Out.y = gamma * sin(alpha);
|
||||
helper.Out.x = gamma * std::cos(alpha);
|
||||
helper.Out.y = gamma * std::sin(alpha);
|
||||
helper.Out.z = radiusOut * z;
|
||||
}
|
||||
|
||||
@ -2234,8 +2259,8 @@ public:
|
||||
{
|
||||
T r = 1 / helper.m_PrecalcSqrtSumSquares;
|
||||
|
||||
helper.Out.x = m_Weight * r * cos(helper.m_PrecalcAtanyx);
|
||||
helper.Out.y = m_Weight * r * sin(helper.m_PrecalcAtanyx);
|
||||
helper.Out.x = m_Weight * r * std::cos(helper.m_PrecalcAtanyx);
|
||||
helper.Out.y = m_Weight * r * std::sin(helper.m_PrecalcAtanyx);
|
||||
}
|
||||
else if (helper.In.x > 0 && helper.In.y < 0)//Quadrant I: loonie.
|
||||
{
|
||||
@ -2262,11 +2287,11 @@ public:
|
||||
|
||||
if (r < m_Weight)
|
||||
{
|
||||
T a = atan2(y, x) + m_Spin + m_Twist * (m_Weight - r);
|
||||
T a = std::atan2(y, x) + m_Spin + m_Twist * (m_Weight - r);
|
||||
|
||||
r *= m_Weight;
|
||||
helper.Out.x = r * cos(a) + m_X;
|
||||
helper.Out.y = r * sin(a) - m_Y;
|
||||
helper.Out.x = r * std::cos(a) + m_X;
|
||||
helper.Out.y = r * std::sin(a) - m_Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2355,6 +2380,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_SqrWeight = SQR(m_Weight);
|
||||
@ -2556,12 +2586,12 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
const T zr = Hypot<T>(helper.In.z, helper.m_PrecalcSqrtSumSquares);
|
||||
const T phi = acos(Clamp<T>(helper.In.z / zr, -1, 1));
|
||||
const T ps = sin(phi);
|
||||
const T pc = cos(phi);
|
||||
const T phi = std::acos(Clamp<T>(helper.In.z / zr, -1, 1));
|
||||
const T ps = std::sin(phi);
|
||||
const T pc = std::cos(phi);
|
||||
|
||||
helper.Out.x = m_Weight * cos(helper.m_PrecalcAtanyx) * ps * (zr + m_Radius);
|
||||
helper.Out.y = m_Weight * sin(helper.m_PrecalcAtanyx) * ps * (zr + m_Radius);
|
||||
helper.Out.x = m_Weight * std::cos(helper.m_PrecalcAtanyx) * ps * (zr + m_Radius);
|
||||
helper.Out.y = m_Weight * std::sin(helper.m_PrecalcAtanyx) * ps * (zr + m_Radius);
|
||||
helper.Out.z = m_Weight * pc * (zr + m_Radius);
|
||||
}
|
||||
|
||||
@ -2575,7 +2605,7 @@ public:
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\tconst real_t zr = Hypot(vIn.z, precalcSqrtSumSquares);\n"
|
||||
<< "\t\tconst real_t phi = acos(Clamp(vIn.z / zr, -(real_t)(1.0), (real_t)(1.0)));\n"
|
||||
<< "\t\tconst real_t phi = acos(clamp(vIn.z / zr, -(real_t)(1.0), (real_t)(1.0)));\n"
|
||||
<< "\t\tconst real_t ps = sin(phi);\n"
|
||||
<< "\t\tconst real_t pc = cos(phi);\n"
|
||||
<< "\n"
|
||||
@ -2587,6 +2617,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -2621,11 +2656,11 @@ public:
|
||||
Sqr(helper.In.z - m_ZOrigin)) *
|
||||
(rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() - 2);
|
||||
T u = rand.Frand01<T>() * M_2PI;
|
||||
T su = sin(u);
|
||||
T cu = cos(u);
|
||||
T su = std::sin(u);
|
||||
T cu = std::cos(u);
|
||||
T v = rand.Frand01<T>() * M_2PI;
|
||||
T sv = sin(v);
|
||||
T cv = cos(v);
|
||||
T sv = std::sin(v);
|
||||
T cv = std::cos(v);
|
||||
|
||||
helper.Out.x = m_X * r * sv * cu;
|
||||
helper.Out.y = m_Y * r * sv * su;
|
||||
@ -2665,6 +2700,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -2749,12 +2789,17 @@ public:
|
||||
<< "\t\tvOut.x = (x * re + y * im) * r;\n"
|
||||
<< "\t\tvOut.y = (y * re - x * im) * r;\n"
|
||||
<< "\t\tvOut.z = (z * xform->m_VariationWeights[" << varIndex << "]) / c;\n"
|
||||
<< "\t\toutPoint->m_ColorX = Clamp(outPoint->m_ColorX + " << dcAdjust << " * c, (real_t)(0.0), (real_t)(1.0));\n"
|
||||
<< "\t\toutPoint->m_ColorX = clamp(outPoint->m_ColorX + " << dcAdjust << " * c, (real_t)(0.0), (real_t)(1.0));\n"
|
||||
<< "\t}\n";
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot", "Spread", "SignNz", "Powq4", "Powq4c", "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_C2x2 = 2 * m_C2;
|
||||
@ -2810,19 +2855,19 @@ public:
|
||||
{
|
||||
T r = std::sqrt(fabs(helper.m_PrecalcSumSquares + helper.In.z));
|
||||
|
||||
r += m_Ar * sin(fma(m_Br, r, m_Cr));
|
||||
r += m_Ar * std::sin(fma(m_Br, r, m_Cr));
|
||||
|
||||
if (r == 0)
|
||||
r = EPS;
|
||||
|
||||
T temp = fma(m_At, sin(fma(m_Bt, r, m_Ct)), helper.m_PrecalcAtanyx);
|
||||
T st = sin(temp);
|
||||
T ct = cos(temp);
|
||||
T temp = fma(m_At, std::sin(fma(m_Bt, r, m_Ct)), helper.m_PrecalcAtanyx);
|
||||
T st = std::sin(temp);
|
||||
T ct = std::cos(temp);
|
||||
|
||||
temp = fma(m_Ap, sin(fma(m_Bp, r, m_Cp)), acos(Clamp<T>(helper.In.z / r, -1, 1)));
|
||||
temp = fma(m_Ap, std::sin(fma(m_Bp, r, m_Cp)), std::acos(Clamp<T>(helper.In.z / r, -1, 1)));
|
||||
|
||||
T sp = sin(temp);
|
||||
T cp = cos(temp);
|
||||
T sp = std::sin(temp);
|
||||
T cp = std::cos(temp);
|
||||
|
||||
helper.Out.x = r * ct * sp;
|
||||
helper.Out.y = r * st * sp;
|
||||
@ -2866,7 +2911,7 @@ public:
|
||||
<< "\t\treal_t st = sin(temp);\n"
|
||||
<< "\t\treal_t ct = cos(temp);\n"
|
||||
<< "\n"
|
||||
<< "\t\ttemp = fma(" << ap << ", sin(fma(" << bp << ", r, " << cp << ")), acos(Clamp(vIn.z / r, -(real_t)(1.0), (real_t)(1.0))));\n"
|
||||
<< "\t\ttemp = fma(" << ap << ", sin(fma(" << bp << ", r, " << cp << ")), acos(clamp(vIn.z / r, -(real_t)(1.0), (real_t)(1.0))));\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t sp = sin(temp);\n"
|
||||
<< "\t\treal_t cp = cos(temp);\n"
|
||||
@ -3080,7 +3125,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual string OpenCLFuncsString() const
|
||||
virtual string OpenCLFuncsString() const override
|
||||
{
|
||||
return
|
||||
"real_t Interference2Sine(real_t a, real_t b, real_t c, real_t p, real_t x)\n"
|
||||
@ -3121,17 +3166,17 @@ protected:
|
||||
private:
|
||||
inline static T Sine(T a, T b, T c, T p, T x)
|
||||
{
|
||||
return a * pow(fabs(sin(b * x + c)), p);//Original did not fabs().
|
||||
return a * std::pow(std::fabs(std::sin(b * x + c)), p);//Original did not fabs().
|
||||
}
|
||||
|
||||
inline static T Tri(T a, T b, T c, T p, T x)
|
||||
{
|
||||
return a * 2 * pow(fabs(asin(cos(b * x + c - T(M_PI_2)))) * T(M_1_PI), p);//Original did not fabs().
|
||||
return a * 2 * std::pow(std::fabs(std::asin(std::cos(b * x + c - T(M_PI_2)))) * T(M_1_PI), p);//Original did not fabs().
|
||||
}
|
||||
|
||||
inline static T Squ(T a, T b, T c, T p, T x)
|
||||
{
|
||||
return a * pow(sin(b * x + c) < 0 ? EPS : T(1), p);//Original passed -1 to pow if sin() was < 0. Doing so will return NaN, so EPS is passed instead.
|
||||
return a * std::pow(std::sin(b * x + c) < 0 ? EPS : T(1), p);//Original passed -1 to pow if sin() was < 0. Doing so will return NaN, so EPS is passed instead.
|
||||
}
|
||||
|
||||
T m_A1;
|
||||
@ -3160,10 +3205,10 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T s = sin(helper.In.x);
|
||||
T c = cos(helper.In.x);
|
||||
T sh = sinh(absV);
|
||||
T ch = cosh(absV);
|
||||
T s = std::sin(helper.In.x);
|
||||
T c = std::cos(helper.In.x);
|
||||
T sh = std::sinh(absV);
|
||||
T ch = std::cosh(absV);
|
||||
T d = m_Weight * c * sh / absV;
|
||||
|
||||
helper.Out.x = m_Weight * s * ch;
|
||||
@ -3191,6 +3236,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3207,10 +3257,10 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T s = sin(absV);
|
||||
T c = cos(absV);
|
||||
T sh = sinh(helper.In.x);
|
||||
T ch = cosh(helper.In.x);
|
||||
T s = std::sin(absV);
|
||||
T c = std::cos(absV);
|
||||
T sh = std::sinh(helper.In.x);
|
||||
T ch = std::cosh(helper.In.x);
|
||||
T d = m_Weight * ch * s / absV;
|
||||
|
||||
helper.Out.x = m_Weight * sh * c;
|
||||
@ -3238,6 +3288,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3255,10 +3310,10 @@ public:
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T ni = m_Weight / (helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||
T s = sin(-helper.In.x);
|
||||
T c = cos(-helper.In.x);
|
||||
T sh = sinh(absV);
|
||||
T ch = cosh(absV);
|
||||
T s = std::sin(-helper.In.x);
|
||||
T c = std::cos(-helper.In.x);
|
||||
T sh = std::sinh(absV);
|
||||
T ch = std::cosh(absV);
|
||||
T d = ni * s * sh / absV;
|
||||
|
||||
helper.Out.x = c * ch * ni;
|
||||
@ -3287,6 +3342,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3304,10 +3364,10 @@ public:
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T ni = m_Weight / (helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||
T s = sin(absV);
|
||||
T c = cos(absV);
|
||||
T sh = sinh(helper.In.x);
|
||||
T ch = cosh(helper.In.x);
|
||||
T s = std::sin(absV);
|
||||
T c = std::cos(absV);
|
||||
T sh = std::sinh(helper.In.x);
|
||||
T ch = std::cosh(helper.In.x);
|
||||
T d = ni * sh * s / absV;
|
||||
|
||||
helper.Out.x = ch * c * ni;
|
||||
@ -3336,6 +3396,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3354,10 +3419,10 @@ public:
|
||||
T sysz = SQR(helper.In.y) + SQR(helper.In.z);
|
||||
T absV = std::sqrt(sysz);
|
||||
T ni = m_Weight / (SQR(helper.In.x) + sysz);
|
||||
T s = sin(helper.In.x);
|
||||
T c = cos(helper.In.x);
|
||||
T sh = sinh(absV);
|
||||
T ch = cosh(absV);
|
||||
T s = std::sin(helper.In.x);
|
||||
T c = std::cos(helper.In.x);
|
||||
T sh = std::sinh(absV);
|
||||
T ch = std::cosh(absV);
|
||||
T d = c * sh / absV;
|
||||
T b = -s * sh / absV;
|
||||
T stcv = s * ch;
|
||||
@ -3413,10 +3478,10 @@ public:
|
||||
T sysz = SQR(helper.In.y) + SQR(helper.In.z);
|
||||
T absV = std::sqrt(sysz);
|
||||
T ni = m_Weight / (SQR(helper.In.x) + sysz);
|
||||
T s = sin(absV);
|
||||
T c = cos(absV);
|
||||
T sh = sinh(helper.In.x);
|
||||
T ch = cosh(helper.In.x);
|
||||
T s = std::sin(absV);
|
||||
T c = std::cos(absV);
|
||||
T sh = std::sinh(helper.In.x);
|
||||
T ch = std::cosh(helper.In.x);
|
||||
T d = ch * s / absV;
|
||||
T b = sh * s / absV;
|
||||
T stcv = sh * c;
|
||||
@ -3470,10 +3535,10 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T s = sin(helper.In.x);
|
||||
T c = cos(helper.In.x);
|
||||
T sh = sinh(absV);
|
||||
T ch = cosh(absV);
|
||||
T s = std::sin(helper.In.x);
|
||||
T c = std::cos(helper.In.x);
|
||||
T sh = std::sinh(absV);
|
||||
T ch = std::cosh(absV);
|
||||
T d = -m_Weight * s * sh / absV;
|
||||
|
||||
helper.Out.x = m_Weight * c * ch;
|
||||
@ -3501,6 +3566,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3517,10 +3587,10 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T s = sin(absV);
|
||||
T c = cos(absV);
|
||||
T sh = sinh(helper.In.x);
|
||||
T ch = cosh(helper.In.x);
|
||||
T s = std::sin(absV);
|
||||
T c = std::cos(absV);
|
||||
T sh = std::sinh(helper.In.x);
|
||||
T ch = std::cosh(helper.In.x);
|
||||
T d = -m_Weight * sh * s / absV;
|
||||
|
||||
helper.Out.x = m_Weight * c * ch;
|
||||
@ -3548,6 +3618,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3566,10 +3641,10 @@ public:
|
||||
T sysz = SQR(helper.In.y) + SQR(helper.In.z);
|
||||
T absV = std::sqrt(sysz);
|
||||
T ni = m_Weight / (SQR(helper.In.x) + sysz);
|
||||
T s = sin(helper.In.x);
|
||||
T c = cos(helper.In.x);
|
||||
T sh = sinh(absV);
|
||||
T ch = cosh(absV);
|
||||
T s = std::sin(helper.In.x);
|
||||
T c = std::cos(helper.In.x);
|
||||
T sh = std::sinh(absV);
|
||||
T ch = std::cosh(absV);
|
||||
T d = c * sh / absV;
|
||||
T b = -s * sh / absV;
|
||||
T stcv = s * ch;
|
||||
@ -3625,10 +3700,10 @@ public:
|
||||
T sysz = SQR(helper.In.y) + SQR(helper.In.z);
|
||||
T absV = std::sqrt(sysz);
|
||||
T ni = m_Weight / (SQR(helper.In.x) + sysz);
|
||||
T s = sin(absV);
|
||||
T c = cos(absV);
|
||||
T sh = sinh(helper.In.x);
|
||||
T ch = cosh(helper.In.x);
|
||||
T s = std::sin(absV);
|
||||
T c = std::cos(absV);
|
||||
T sh = std::sinh(helper.In.x);
|
||||
T ch = std::cosh(helper.In.x);
|
||||
T d = ch * s / absV;
|
||||
T b = sh * s / absV;
|
||||
T stcv = sh * c;
|
||||
@ -3683,10 +3758,10 @@ public:
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T ni = m_Weight / (helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||
T s = sin(helper.In.x);
|
||||
T c = cos(helper.In.x);
|
||||
T sh = sinh(absV);
|
||||
T ch = cosh(absV);
|
||||
T s = std::sin(helper.In.x);
|
||||
T c = std::cos(helper.In.x);
|
||||
T sh = std::sinh(absV);
|
||||
T ch = std::cosh(absV);
|
||||
T d = ni * c * sh / absV;
|
||||
|
||||
helper.Out.x = s * ch * ni;
|
||||
@ -3715,6 +3790,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3732,10 +3812,10 @@ public:
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T ni = m_Weight / (helper.m_PrecalcSumSquares + SQR(helper.In.z));
|
||||
T s = sin(absV);
|
||||
T c = cos(absV);
|
||||
T sh = sinh(helper.In.x);
|
||||
T ch = cosh(helper.In.x);
|
||||
T s = std::sin(absV);
|
||||
T c = std::cos(absV);
|
||||
T sh = std::sinh(helper.In.x);
|
||||
T ch = std::cosh(helper.In.x);
|
||||
T d = ni * ch * s / absV;
|
||||
|
||||
helper.Out.x = sh * c * ni;
|
||||
@ -3764,6 +3844,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3780,9 +3865,9 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T e = exp(helper.In.x);
|
||||
T s = sin(absV);
|
||||
T c = cos(absV);
|
||||
T e = std::exp(helper.In.x);
|
||||
T s = std::sin(absV);
|
||||
T c = std::cos(absV);
|
||||
T a = e * s / absV;
|
||||
|
||||
helper.Out.x = m_Weight * e * c;
|
||||
@ -3809,6 +3894,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -3828,9 +3918,9 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T absV = Hypot<T>(helper.In.y, helper.In.z);
|
||||
T c = m_Weight * atan2(absV, helper.In.x) / absV;
|
||||
T c = m_Weight * std::atan2(absV, helper.In.x) / absV;
|
||||
|
||||
helper.Out.x = log(SQR(helper.In.x) + SQR(absV)) * m_Denom;
|
||||
helper.Out.x = std::log(SQR(helper.In.x) + SQR(absV)) * m_Denom;
|
||||
helper.Out.y = c * helper.In.y;
|
||||
helper.Out.z = c * helper.In.z;
|
||||
}
|
||||
@ -3855,10 +3945,15 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Hypot" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Denom = T(0.5) / log(m_Base);
|
||||
m_Denom = T(0.5) / std::log(m_Base);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -3907,6 +4002,11 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -4024,7 +4124,7 @@ public:
|
||||
T xx = (rand.Frand01<T>() - T(0.5)) * 2;
|
||||
T yy = (rand.Frand01<T>() - T(0.5)) * 2;
|
||||
T k = SignNz(yy);
|
||||
T yymax = ((m_A * pow(fabs(xx), m_P) + k * m_B * std::sqrt(fabs(1 - SQR(xx)))) - m_A);
|
||||
T yymax = ((m_A * std::pow(fabs(xx), m_P) + k * m_B * std::sqrt(fabs(1 - SQR(xx)))) - m_A);
|
||||
|
||||
//The function must be in a range 0-1 to work properly.
|
||||
yymax /= Zeps(fabs(m_A) + fabs(m_B));
|
||||
@ -4083,6 +4183,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "SignNz", "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -4190,26 +4295,26 @@ public:
|
||||
{
|
||||
if (tileType < 1)
|
||||
{
|
||||
r0 = pow((pow(fabs(x ), m_Exponent) + pow(fabs(y ), m_Exponent)), m_OneOverEx);
|
||||
r1 = pow((pow(fabs(x - 1), m_Exponent) + pow(fabs(y - 1), m_Exponent)), m_OneOverEx);
|
||||
r0 = std::pow((pow(fabs(x ), m_Exponent) + std::pow(fabs(y ), m_Exponent)), m_OneOverEx);
|
||||
r1 = std::pow((pow(fabs(x - 1), m_Exponent) + std::pow(fabs(y - 1), m_Exponent)), m_OneOverEx);
|
||||
}
|
||||
else
|
||||
{
|
||||
r0 = pow((pow(fabs(x - 1), m_Exponent) + pow(fabs(y ), m_Exponent)), m_OneOverEx);
|
||||
r1 = pow((pow(fabs(x ), m_Exponent) + pow(fabs(y - 1), m_Exponent)), m_OneOverEx);
|
||||
r0 = std::pow((pow(fabs(x - 1), m_Exponent) + std::pow(fabs(y ), m_Exponent)), m_OneOverEx);
|
||||
r1 = std::pow((pow(fabs(x ), m_Exponent) + std::pow(fabs(y - 1), m_Exponent)), m_OneOverEx);
|
||||
}
|
||||
}
|
||||
else//Slow drawmode
|
||||
{
|
||||
if (tileType == 1)
|
||||
{
|
||||
r0 = pow((pow(fabs(x ), m_Exponent) + pow(fabs(y ), m_Exponent)), m_OneOverEx);
|
||||
r1 = pow((pow(fabs(x - 1), m_Exponent) + pow(fabs(y - 1), m_Exponent)), m_OneOverEx);
|
||||
r0 = std::pow((std::pow(fabs(x ), m_Exponent) + std::pow(fabs(y ), m_Exponent)), m_OneOverEx);
|
||||
r1 = std::pow((std::pow(fabs(x - 1), m_Exponent) + std::pow(fabs(y - 1), m_Exponent)), m_OneOverEx);
|
||||
}
|
||||
else
|
||||
{
|
||||
r0 = pow((pow(fabs(x - 1), m_Exponent) + pow(fabs(y ), m_Exponent)), m_OneOverEx);
|
||||
r1 = pow((pow(fabs(x ), m_Exponent) + pow(fabs(y - 1), m_Exponent)), m_OneOverEx);
|
||||
r0 = std::pow((std::pow(fabs(x - 1), m_Exponent) + std::pow(fabs(y ), m_Exponent)), m_OneOverEx);
|
||||
r1 = std::pow((std::pow(fabs(x ), m_Exponent) + std::pow(fabs(y - 1), m_Exponent)), m_OneOverEx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4378,13 +4483,18 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Round" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_OneOverEx = 1 / m_Exponent;
|
||||
m_AbsSeed = fabs(m_Seed);
|
||||
m_Seed2 = std::sqrt(Zeps(m_AbsSeed + (m_AbsSeed / 2))) / Zeps((m_AbsSeed * T(0.5))) * T(0.25);
|
||||
m_OneOverRmax = 1 / (T(0.5) * (pow(T(2), 1 / m_Exponent) - 1) * m_ArcWidth);
|
||||
m_Scale = (cos(-m_Rotation) - sin(-m_Rotation)) / m_Weight;
|
||||
m_OneOverRmax = 1 / (T(0.5) * (std::pow(T(2), 1 / m_Exponent) - 1) * m_ArcWidth);
|
||||
m_Scale = (std::cos(-m_Rotation) - std::sin(-m_Rotation)) / m_Weight;
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -4508,7 +4618,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual string OpenCLFuncsString() const
|
||||
virtual string OpenCLFuncsString() const override
|
||||
{
|
||||
return
|
||||
"inline real_t GdoffsFcip(real_t a) { return (real_t)((a < 0) ? -((int)(fabs(a)) + 1) : 0) + ((a > 1) ? ((int)(a)) : 0); }\n"
|
||||
@ -4561,7 +4671,7 @@ private:
|
||||
static inline T GdoffsFcip(T a) { return T((a < 0) ? -(int(fabs(a)) + 1) : 0) + ((a > 1) ? (int(a)) : 0); }
|
||||
static inline T GdoffsFclp(T a) { return ((a < 0) ? -(fmod(fabs(a), T(1))) : fmod(fabs(a), T(1))); }
|
||||
static inline T GdoffsFscl(T a) { return GdoffsFclp((a + 1) / 2); }
|
||||
static inline T GdoffsFosc(T p, T a) { return GdoffsFscl(-1 * cos(p * a * M_2PI)); }
|
||||
static inline T GdoffsFosc(T p, T a) { return GdoffsFscl(-1 * std::cos(p * a * M_2PI)); }
|
||||
static inline T GdoffsFlip(T a, T b, T c) { return (c * (b - a) + a); }
|
||||
|
||||
T m_DeltaX;//Params.
|
||||
@ -4703,6 +4813,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Zeps" };
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
@ -4748,8 +4863,8 @@ public:
|
||||
r *= m_R2 / m_R1;
|
||||
temp = atan2(helper.In.y, c1mx);
|
||||
|
||||
helper.Out.x = m_Weight * (r * cos(temp) - m_C2);
|
||||
helper.Out.y = m_Weight * r * sin(temp);
|
||||
helper.Out.x = m_Weight * (r * std::cos(temp) - m_C2);
|
||||
helper.Out.y = m_Weight * r * std::sin(temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4767,8 +4882,8 @@ public:
|
||||
r *= m_R1 / m_R2;
|
||||
temp = atan2(helper.In.y, c1mx);
|
||||
|
||||
helper.Out.x = m_Weight * (r * cos(temp) + m_C1);
|
||||
helper.Out.y = m_Weight * r * sin(temp);
|
||||
helper.Out.x = m_Weight * (r * std::cos(temp) + m_C1);
|
||||
helper.Out.y = m_Weight * r * std::sin(temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4887,12 +5002,12 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T arg = helper.m_PrecalcAtanyx + fmod(T(rand.Rand()), T(1 / m_ReInv)) * M_2PI;
|
||||
T lnmod = m_Dist * T(0.5) * log(helper.m_PrecalcSumSquares);
|
||||
T lnmod = m_Dist * T(0.5) * std::log(helper.m_PrecalcSumSquares);
|
||||
T temp = arg * m_ReInv + lnmod * m_Im100;
|
||||
T mod2 = exp(lnmod * m_ReInv - arg * m_Im100);
|
||||
T mod2 = std::exp(lnmod * m_ReInv - arg * m_Im100);
|
||||
|
||||
helper.Out.x = m_Weight * mod2 * cos(temp);
|
||||
helper.Out.y = m_Weight * mod2 * sin(temp);
|
||||
helper.Out.x = m_Weight * mod2 * std::cos(temp);
|
||||
helper.Out.y = m_Weight * mod2 * std::sin(temp);
|
||||
helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
}
|
||||
|
||||
@ -5006,11 +5121,11 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = helper.m_PrecalcSqrtSumSquares * (m_BlobLow + m_BlobDiff * (T(0.5) + T(0.5) * sin(m_BlobWaves * helper.m_PrecalcAtanxy)));
|
||||
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_Weight * sin(m_BlobWaves * helper.m_PrecalcAtanxy) * r;
|
||||
helper.Out.z = m_Weight * std::sin(m_BlobWaves * helper.m_PrecalcAtanxy) * r;
|
||||
}
|
||||
|
||||
virtual string OpenCLString() const override
|
||||
@ -5082,7 +5197,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T t = Zeps((cos(helper.In.x) + cos(helper.In.y)) / m_Mp + 1);
|
||||
T t = Zeps((std::cos(helper.In.x) + std::cos(helper.In.y)) / m_Mp + 1);
|
||||
T r = m_Weight / t;
|
||||
T tmp = helper.m_PrecalcSumSquares + 1;
|
||||
T x2 = 2 * helper.In.x;
|
||||
@ -5137,6 +5252,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "SafeSqrt", "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_V = m_Weight / T(M_PI_2);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
3832
Source/Ember/Variations06.h
Normal file
3832
Source/Ember/Variations06.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,7 @@ namespace EmberNs
|
||||
{
|
||||
/// <summary>
|
||||
/// DC Bubble.
|
||||
/// This accesses the summed output point in a rare and different way
|
||||
/// and therefore cannot be made into pre and post variations.
|
||||
/// This accesses the summed output point in a rare and different way.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EMBER_API DCBubbleVariation : public ParametricVariation<T>
|
||||
@ -30,8 +29,21 @@ public:
|
||||
helper.Out.y = r4_1 * helper.In.y;
|
||||
helper.Out.z = m_Weight * (2 / r4_1 - 1);
|
||||
|
||||
T tempX = helper.Out.x + outPoint.m_X;
|
||||
T tempY = helper.Out.y + outPoint.m_Y;
|
||||
T sumX, sumY;
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
sumX = helper.In.x;
|
||||
sumY = helper.In.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
sumX = outPoint.m_X;
|
||||
sumY = outPoint.m_Y;
|
||||
}
|
||||
|
||||
T tempX = helper.Out.x + sumX;
|
||||
T tempY = helper.Out.y + sumY;
|
||||
|
||||
outPoint.m_ColorX = fmod(fabs(m_Bdcs * (Sqr<T>(tempX + m_CenterX) + Sqr<T>(tempY + m_CenterY))), T(1.0));
|
||||
}
|
||||
@ -56,8 +68,24 @@ public:
|
||||
<< "\t\tvOut.y = r4_1 * vIn.y;\n"
|
||||
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (2 / r4_1 - 1);\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t tempX = vOut.x + outPoint->m_X;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + outPoint->m_Y;\n"
|
||||
<< "\t\treal_t sumX, sumY;\n\n";
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = vIn.x;\n"
|
||||
<< "\t\tsumY = vIn.y;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = outPoint->m_X;\n"
|
||||
<< "\t\tsumY = outPoint->m_Y;\n";
|
||||
}
|
||||
|
||||
ss
|
||||
<< "\t\treal_t tempX = vOut.x + sumX;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + sumY;\n"
|
||||
<< "\n"
|
||||
<< "\t\toutPoint->m_ColorX = fmod(fabs(" << bdcs << " * (Sqr(tempX + " << centerX << ") + Sqr(tempY + " << centerY << "))), (real_t)(1.0));\n"
|
||||
<< "\t}\n";
|
||||
@ -65,6 +93,11 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "Sqr", "Zeps" };
|
||||
}
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Bdcs = 1 / (m_Scale == 0 ? T(10E-6) : m_Scale);
|
||||
@ -255,7 +288,7 @@ public:
|
||||
<< "\t\treal_t x, y, z;\n"
|
||||
<< "\t\treal_t p = 2 * MwcNext01(mwc) - 1;\n"
|
||||
<< "\t\treal_t q = 2 * MwcNext01(mwc) - 1;\n"
|
||||
<< "\t\tuint i = MwcNext(mwc) % 3;\n"
|
||||
<< "\t\tuint i = MwcNextRange(mwc, 3);\n"
|
||||
<< "\t\tuint j = MwcNext(mwc) & 1;\n"
|
||||
<< "\n"
|
||||
<< "\t\tswitch (i)\n"
|
||||
@ -356,8 +389,7 @@ private:
|
||||
|
||||
/// <summary>
|
||||
/// DC Cylinder.
|
||||
/// This accesses the summed output point in a rare and different way
|
||||
/// and therefore cannot be made into pre and post variations.
|
||||
/// This accesses the summed output point in a rare and different way.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EMBER_API DCCylinderVariation : public ParametricVariation<T>
|
||||
@ -373,16 +405,29 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T temp = rand.Frand01<T>() * M_2PI;
|
||||
T sr = sin(temp);
|
||||
T cr = cos(temp);
|
||||
T sr = std::sin(temp);
|
||||
T cr = std::cos(temp);
|
||||
T r = m_Blur * (rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() + rand.Frand01<T>() - 2);
|
||||
|
||||
helper.Out.x = m_Weight * sin(helper.In.x + r * sr) * m_X;
|
||||
helper.Out.x = m_Weight * std::sin(helper.In.x + r * sr) * m_X;
|
||||
helper.Out.y = r + helper.In.y * m_Y;
|
||||
helper.Out.z = m_Weight * cos(helper.In.x + r * cr);
|
||||
helper.Out.z = m_Weight * std::cos(helper.In.x + r * cr);
|
||||
|
||||
T tempX = helper.Out.x + outPoint.m_X;
|
||||
T tempY = helper.Out.y + outPoint.m_Y;
|
||||
T sumX, sumY;
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
sumX = helper.In.x;
|
||||
sumY = helper.In.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
sumX = outPoint.m_X;
|
||||
sumY = outPoint.m_Y;
|
||||
}
|
||||
|
||||
T tempX = helper.Out.x + sumX;
|
||||
T tempY = helper.Out.y + sumY;
|
||||
|
||||
outPoint.m_ColorX = fmod(fabs(T(0.5) * (m_Ldcs * ((m_Cosa * tempX + m_Sina * tempY + m_Offset)) + 1)), T(1.0));
|
||||
}
|
||||
@ -413,8 +458,24 @@ public:
|
||||
<< "\t\tvOut.y = r + vIn.y * " << y << ";\n"
|
||||
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * cos(vIn.x + r * cr);\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t tempX = vOut.x + outPoint->m_X;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + outPoint->m_Y;\n"
|
||||
<< "\t\treal_t sumX, sumY;\n\n";
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = vIn.x;\n"
|
||||
<< "\t\tsumY = vIn.y;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = outPoint->m_X;\n"
|
||||
<< "\t\tsumY = outPoint->m_Y;\n";
|
||||
}
|
||||
|
||||
ss
|
||||
<< "\t\treal_t tempX = vOut.x + sumX;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + sumY;\n"
|
||||
<< "\n"
|
||||
<< "\t\toutPoint->m_ColorX = fmod(fabs((real_t)(0.5) * (" << ldcs << " * ((" << cosa << " * tempX + " << sina << " * tempY + " << offset << ")) + (real_t)(1.0))), (real_t)(1.0));\n"
|
||||
<< "\t}\n";
|
||||
@ -631,12 +692,16 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual vector<string> OpenCLGlobalFuncNames() const override
|
||||
{
|
||||
return vector<string> { "LRint" };
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// DC Linear.
|
||||
/// This accesses the summed output point in a rare and different way
|
||||
/// and therefore cannot be made into pre and post variations.
|
||||
/// This accesses the summed output point in a rare and different way.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EMBER_API DCLinearVariation : public ParametricVariation<T>
|
||||
@ -655,8 +720,21 @@ public:
|
||||
helper.Out.y = m_Weight * helper.In.y;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
|
||||
T tempX = helper.Out.x + outPoint.m_X;
|
||||
T tempY = helper.Out.y + outPoint.m_Y;
|
||||
T sumX, sumY;
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
sumX = helper.In.x;
|
||||
sumY = helper.In.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
sumX = outPoint.m_X;
|
||||
sumY = outPoint.m_Y;
|
||||
}
|
||||
|
||||
T tempX = helper.Out.x + sumX;
|
||||
T tempY = helper.Out.y + sumY;
|
||||
|
||||
outPoint.m_ColorX = fmod(fabs(T(0.5) * (m_Ldcs * ((m_Cosa * tempX + m_Sina * tempY + m_Offset)) + T(1.0))), T(1.0));
|
||||
}
|
||||
@ -680,8 +758,24 @@ public:
|
||||
<< "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n"
|
||||
<< "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n"
|
||||
<< "\n"
|
||||
<< "\t\treal_t tempX = vOut.x + outPoint->m_X;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + outPoint->m_Y;\n"
|
||||
<< "\t\treal_t sumX, sumY;\n\n";
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = vIn.x;\n"
|
||||
<< "\t\tsumY = vIn.y;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss
|
||||
<< "\t\tsumX = outPoint->m_X;\n"
|
||||
<< "\t\tsumY = outPoint->m_Y;\n";
|
||||
}
|
||||
|
||||
ss
|
||||
<< "\t\treal_t tempX = vOut.x + sumX;\n"
|
||||
<< "\t\treal_t tempY = vOut.y + sumY;\n"
|
||||
<< "\n"
|
||||
<< "\t\toutPoint->m_ColorX = fmod(fabs((real_t)(0.5) * (" << ldcs << " * ((" << cosa << " * tempX + " << sina << " * tempY + " << offset << ")) + (real_t)(1.0))), (real_t)(1.0));\n"
|
||||
<< "\t}\n";
|
||||
@ -1034,9 +1128,12 @@ private:
|
||||
T m_X1_m_x0;
|
||||
};
|
||||
|
||||
MAKEPREPOSTPARVAR(DCBubble, dc_bubble, DC_BUBBLE)
|
||||
MAKEPREPOSTPARVAR(DCCarpet, dc_carpet, DC_CARPET)
|
||||
MAKEPREPOSTPARVARASSIGN(DCCube, dc_cube, DC_CUBE, ASSIGNTYPE_SUM)
|
||||
MAKEPREPOSTPARVAR(DCCylinder, dc_cylinder, DC_CYLINDER)
|
||||
MAKEPREPOSTVAR(DCGridOut, dc_gridout, DC_GRIDOUT)
|
||||
MAKEPREPOSTPARVAR(DCLinear, dc_linear, DC_LINEAR)
|
||||
MAKEPREPOSTPARVAR(DCTriangle, dc_triangle, DC_TRIANGLE)
|
||||
MAKEPREPOSTPARVAR(DCZTransl, dc_ztransl, DC_ZTRANSL)
|
||||
}
|
||||
|
||||
@ -915,7 +915,6 @@ public:
|
||||
AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
|
||||
{
|
||||
for (auto var : variations)
|
||||
//for (size_t i = 0; i < variations.size(); i++)
|
||||
{
|
||||
if (var->m_Weight != 0)//This should never happen, but just to be safe.
|
||||
{
|
||||
@ -1273,7 +1272,7 @@ private:
|
||||
if (in == 0)
|
||||
return 0;
|
||||
else
|
||||
return pow(T(10.0), -log(T(1.0) / T(in)) / log(T(2)));
|
||||
return std::pow(T(10.0), -std::log(T(1.0) / T(in)) / std::log(T(2)));
|
||||
}
|
||||
|
||||
vector<T> m_Xaos;//Xaos vector which affects the probability that this xform is chosen. Usually empty.
|
||||
|
||||
@ -80,81 +80,100 @@ public:
|
||||
if (!m_Init)
|
||||
{
|
||||
m_BadParamNames.reserve(100);
|
||||
m_BadParamNames.push_back(pair<string, string>("swtin_distort", "stwin_distort"));//stwin.
|
||||
m_BadParamNames.push_back(pair<string, string>("pow_numerator", "pow_block_numerator"));//pow_block.
|
||||
m_BadParamNames.push_back(pair<string, string>("pow_denominator", "pow_block_denominator"));
|
||||
m_BadParamNames.push_back(pair<string, string>("pow_root", "pow_block_root"));
|
||||
m_BadParamNames.push_back(pair<string, string>("pow_correctn", "pow_block_correctn"));
|
||||
m_BadParamNames.push_back(pair<string, string>("pow_correctd", "pow_block_correctd"));
|
||||
m_BadParamNames.push_back(pair<string, string>("pow_power", "pow_block_power"));
|
||||
m_BadParamNames.push_back(pair<string, string>("lT", "linearT_powX"));//linearT.
|
||||
m_BadParamNames.push_back(pair<string, string>("lT", "linearT_powY"));
|
||||
m_BadParamNames.push_back(pair<string, string>("Re_A", "Mobius_Re_A"));//Mobius.
|
||||
m_BadParamNames.push_back(pair<string, string>("Im_A", "Mobius_Im_A"));
|
||||
m_BadParamNames.push_back(pair<string, string>("Re_B", "Mobius_Re_B"));
|
||||
m_BadParamNames.push_back(pair<string, string>("Im_B", "Mobius_Im_B"));
|
||||
m_BadParamNames.push_back(pair<string, string>("Re_C", "Mobius_Re_C"));
|
||||
m_BadParamNames.push_back(pair<string, string>("Im_C", "Mobius_Im_C"));
|
||||
m_BadParamNames.push_back(pair<string, string>("Re_D", "Mobius_Re_D"));
|
||||
m_BadParamNames.push_back(pair<string, string>("Im_D", "Mobius_Im_D"));
|
||||
m_BadParamNames.push_back(pair<string, string>("rx_sin", "rotate_x_sin"));//rotate_x.
|
||||
m_BadParamNames.push_back(pair<string, string>("rx_cos", "rotate_x_cos"));
|
||||
m_BadParamNames.push_back(pair<string, string>("ry_sin", "rotate_y_sin"));//rotate_y.
|
||||
m_BadParamNames.push_back(pair<string, string>("ry_cos", "rotate_y_cos"));
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_a1", "interference2_a1"));//interference2.
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_b1", "interference2_b1"));
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_c1", "interference2_c1"));
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_p1", "interference2_p1"));
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_t1", "interference2_t1"));
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_a2", "interference2_a2"));
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_b2", "interference2_b2"));
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_c2", "interference2_c2"));
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_p2", "interference2_p2"));
|
||||
m_BadParamNames.push_back(pair<string, string>("intrfr2_t2", "interference2_t2"));
|
||||
m_BadParamNames.push_back(pair<string, string>("octa_x", "octagon_x"));//octagon.
|
||||
m_BadParamNames.push_back(pair<string, string>("octa_y", "octagon_y"));
|
||||
m_BadParamNames.push_back(pair<string, string>("octa_z", "octagon_z"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bubble_x", "bubble2_x"));//bubble2.
|
||||
m_BadParamNames.push_back(pair<string, string>("bubble_y", "bubble2_y"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bubble_z", "bubble2_z"));
|
||||
m_BadParamNames.push_back(pair<string, string>("cubic3D_xpand", "cubicLattice_3D_xpand"));//cubicLattice_3D.
|
||||
m_BadParamNames.push_back(pair<string, string>("cubic3D_style", "cubicLattice_3D_style"));
|
||||
m_BadParamNames.push_back(pair<string, string>("splitb_x", "SplitBrdr_x"));//SplitBrdr.
|
||||
m_BadParamNames.push_back(pair<string, string>("splitb_y", "SplitBrdr_y"));
|
||||
m_BadParamNames.push_back(pair<string, string>("splitb_px", "SplitBrdr_px"));
|
||||
m_BadParamNames.push_back(pair<string, string>("splitb_py", "SplitBrdr_py"));
|
||||
m_BadParamNames.push_back(pair<string, string>("dc_cyl_offset", "dc_cylinder_offset"));//dc_cylinder.
|
||||
m_BadParamNames.push_back(pair<string, string>("dc_cyl_angle", "dc_cylinder_angle"));
|
||||
m_BadParamNames.push_back(pair<string, string>("dc_cyl_scale", "dc_cylinder_scale"));
|
||||
m_BadParamNames.push_back(pair<string, string>("cyl_x", "dc_cylinder_x"));
|
||||
m_BadParamNames.push_back(pair<string, string>("cyl_y", "dc_cylinder_y"));
|
||||
m_BadParamNames.push_back(pair<string, string>("cyl_blur", "dc_cylinder_blur"));
|
||||
m_BadParamNames.push_back(pair<string, string>("mobius_radius", "mobius_strip_radius"));//mobius_strip.
|
||||
m_BadParamNames.push_back(pair<string, string>("mobius_width", "mobius_strip_width"));
|
||||
m_BadParamNames.push_back(pair<string, string>("mobius_rect_x", "mobius_strip_rect_x"));
|
||||
m_BadParamNames.push_back(pair<string, string>("mobius_rect_y", "mobius_strip_rect_y"));
|
||||
m_BadParamNames.push_back(pair<string, string>("mobius_rotate_x", "mobius_strip_rotate_x"));
|
||||
m_BadParamNames.push_back(pair<string, string>("mobius_rotate_y", "mobius_strip_rotate_y"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps2_cellsize", "bwraps_cellsize"));//bwraps2.
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps2_space", "bwraps_space"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps2_gain", "bwraps_gain"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps2_inner_twist", "bwraps_inner_twist"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps2_outer_twist", "bwraps_outer_twist"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps7_cellsize", "bwraps_cellsize"));//bwraps7.
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps7_space", "bwraps_space"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps7_gain", "bwraps_gain"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps7_inner_twist", "bwraps_inner_twist"));
|
||||
m_BadParamNames.push_back(pair<string, string>("bwraps7_outer_twist", "bwraps_outer_twist"));
|
||||
m_BadParamNames.push_back(pair<string, string>("pre_bwraps2_cellsize", "pre_bwraps_cellsize"));
|
||||
m_BadParamNames.push_back(pair<string, string>("pre_bwraps2_space", "pre_bwraps_space"));
|
||||
m_BadParamNames.push_back(pair<string, string>("pre_bwraps2_gain", "pre_bwraps_gain"));
|
||||
m_BadParamNames.push_back(pair<string, string>("pre_bwraps2_inner_twist", "pre_bwraps_inner_twist"));
|
||||
m_BadParamNames.push_back(pair<string, string>("pre_bwraps2_outer_twist", "pre_bwraps_outer_twist"));
|
||||
m_BadParamNames.push_back(pair<string, string>("post_bwraps2_cellsize", "post_bwraps_cellsize"));
|
||||
m_BadParamNames.push_back(pair<string, string>("post_bwraps2_space", "post_bwraps_space"));
|
||||
m_BadParamNames.push_back(pair<string, string>("post_bwraps2_gain", "post_bwraps_gain"));
|
||||
m_BadParamNames.push_back(pair<string, string>("post_bwraps2_inner_twist", "post_bwraps_inner_twist"));
|
||||
m_BadParamNames.push_back(pair<string, string>("post_bwraps2_outer_twist", "post_bwraps_outer_twist"));
|
||||
m_BadParamNames["swtin_distort"] = "stwin_distort";//stwin.
|
||||
m_BadParamNames["pow_numerator"] = "pow_block_numerator";//pow_block.
|
||||
m_BadParamNames["pow_denominator"] = "pow_block_denominator";
|
||||
m_BadParamNames["pow_root"] = "pow_block_root";
|
||||
m_BadParamNames["pow_correctn"] = "pow_block_correctn";
|
||||
m_BadParamNames["pow_correctd"] = "pow_block_correctd";
|
||||
m_BadParamNames["pow_power"] = "pow_block_power";
|
||||
m_BadParamNames["lt"] = "linearT_powX";//linearT.
|
||||
m_BadParamNames["lt"] = "linearT_powY";
|
||||
m_BadParamNames["re_a"] = "Mobius_Re_A";//Mobius.
|
||||
m_BadParamNames["im_a"] = "Mobius_Im_A";
|
||||
m_BadParamNames["re_b"] = "Mobius_Re_B";
|
||||
m_BadParamNames["im_b"] = "Mobius_Im_B";
|
||||
m_BadParamNames["re_c"] = "Mobius_Re_C";
|
||||
m_BadParamNames["im_c"] = "Mobius_Im_C";
|
||||
m_BadParamNames["re_d"] = "Mobius_Re_D";
|
||||
m_BadParamNames["im_d"] = "Mobius_Im_D";
|
||||
m_BadParamNames["rx_sin"] = "rotate_x_sin";//rotate_x.
|
||||
m_BadParamNames["rx_cos"] = "rotate_x_cos";
|
||||
m_BadParamNames["ry_sin"] = "rotate_y_sin";//rotate_y.
|
||||
m_BadParamNames["ry_cos"] = "rotate_y_cos";
|
||||
m_BadParamNames["intrfr2_a1"] = "interference2_a1";//interference2.
|
||||
m_BadParamNames["intrfr2_b1"] = "interference2_b1";
|
||||
m_BadParamNames["intrfr2_c1"] = "interference2_c1";
|
||||
m_BadParamNames["intrfr2_p1"] = "interference2_p1";
|
||||
m_BadParamNames["intrfr2_t1"] = "interference2_t1";
|
||||
m_BadParamNames["intrfr2_a2"] = "interference2_a2";
|
||||
m_BadParamNames["intrfr2_b2"] = "interference2_b2";
|
||||
m_BadParamNames["intrfr2_c2"] = "interference2_c2";
|
||||
m_BadParamNames["intrfr2_p2"] = "interference2_p2";
|
||||
m_BadParamNames["intrfr2_t2"] = "interference2_t2";
|
||||
m_BadParamNames["octa_x"] = "octagon_x";//octagon.
|
||||
m_BadParamNames["octa_y"] = "octagon_y";
|
||||
m_BadParamNames["octa_z"] = "octagon_z";
|
||||
m_BadParamNames["bubble_x"] = "bubble2_x";//bubble2.
|
||||
m_BadParamNames["bubble_y"] = "bubble2_y";
|
||||
m_BadParamNames["bubble_z"] = "bubble2_z";
|
||||
m_BadParamNames["cubic3d_xpand"] = "cubicLattice_3D_xpand";//cubicLattice_3D.
|
||||
m_BadParamNames["cubic3d_style"] = "cubicLattice_3D_style";
|
||||
m_BadParamNames["splitb_x"] = "SplitBrdr_x";//SplitBrdr.
|
||||
m_BadParamNames["splitb_y"] = "SplitBrdr_y";
|
||||
m_BadParamNames["splitb_px"] = "SplitBrdr_px";
|
||||
m_BadParamNames["splitb_py"] = "SplitBrdr_py";
|
||||
m_BadParamNames["dc_cyl_offset"] = "dc_cylinder_offset";//dc_cylinder.
|
||||
m_BadParamNames["dc_cyl_angle"] = "dc_cylinder_angle";
|
||||
m_BadParamNames["dc_cyl_scale"] = "dc_cylinder_scale";
|
||||
m_BadParamNames["cyl_x"] = "dc_cylinder_x";
|
||||
m_BadParamNames["cyl_y"] = "dc_cylinder_y";
|
||||
m_BadParamNames["cyl_blur"] = "dc_cylinder_blur";
|
||||
m_BadParamNames["mobius_radius"] = "mobius_strip_radius";//mobius_strip.
|
||||
m_BadParamNames["mobius_width"] = "mobius_strip_width";
|
||||
m_BadParamNames["mobius_rect_x"] = "mobius_strip_rect_x";
|
||||
m_BadParamNames["mobius_rect_y"] = "mobius_strip_rect_y";
|
||||
m_BadParamNames["mobius_rotate_x"] = "mobius_strip_rotate_x";
|
||||
m_BadParamNames["mobius_rotate_y"] = "mobius_strip_rotate_y";
|
||||
m_BadParamNames["bwraps2_cellsize"] = "bwraps_cellsize";//bwraps2.
|
||||
m_BadParamNames["bwraps2_space"] = "bwraps_space";
|
||||
m_BadParamNames["bwraps2_gain"] = "bwraps_gain";
|
||||
m_BadParamNames["bwraps2_inner_twist"] = "bwraps_inner_twist";
|
||||
m_BadParamNames["bwraps2_outer_twist"] = "bwraps_outer_twist";
|
||||
m_BadParamNames["bwraps7_cellsize"] = "bwraps_cellsize";//bwraps7.
|
||||
m_BadParamNames["bwraps7_space"] = "bwraps_space";
|
||||
m_BadParamNames["bwraps7_gain"] = "bwraps_gain";
|
||||
m_BadParamNames["bwraps7_inner_twist"] = "bwraps_inner_twist";
|
||||
m_BadParamNames["bwraps7_outer_twist"] = "bwraps_outer_twist";
|
||||
m_BadParamNames["pre_bwraps2_cellsize"] = "pre_bwraps_cellsize";
|
||||
m_BadParamNames["pre_bwraps2_space"] = "pre_bwraps_space";
|
||||
m_BadParamNames["pre_bwraps2_gain"] = "pre_bwraps_gain";
|
||||
m_BadParamNames["pre_bwraps2_inner_twist"] = "pre_bwraps_inner_twist";
|
||||
m_BadParamNames["pre_bwraps2_outer_twist"] = "pre_bwraps_outer_twist";
|
||||
m_BadParamNames["post_bwraps2_cellsize"] = "post_bwraps_cellsize";
|
||||
m_BadParamNames["post_bwraps2_space"] = "post_bwraps_space";
|
||||
m_BadParamNames["post_bwraps2_gain"] = "post_bwraps_gain";
|
||||
m_BadParamNames["post_bwraps2_inner_twist"] = "post_bwraps_inner_twist";
|
||||
m_BadParamNames["post_bwraps2_outer_twist"] = "post_bwraps_outer_twist";
|
||||
m_BadParamNames["hexa3d_majp"] = "hexaplay3D_majp";
|
||||
m_BadParamNames["hexa3d_scale"] = "hexaplay3D_scale";
|
||||
m_BadParamNames["hexa3d_zlift"] = "hexaplay3D_zlift";
|
||||
m_BadParamNames["nb_numedges"] = "nBlur_numEdges";
|
||||
m_BadParamNames["nb_numstripes"] = "nBlur_numStripes";
|
||||
m_BadParamNames["nb_ratiostripes"] = "nBlur_ratioStripes";
|
||||
m_BadParamNames["nb_ratiohole"] = "nBlur_ratioHole";
|
||||
m_BadParamNames["nb_circumcircle"] = "nBlur_circumCircle";
|
||||
m_BadParamNames["nb_adjusttolinear"] = "nBlur_adjustToLinear";
|
||||
m_BadParamNames["nb_equalblur"] = "nBlur_equalBlur";
|
||||
m_BadParamNames["nb_exactcalc"] = "nBlur_exactCalc";
|
||||
m_BadParamNames["nb_highlightedges"] = "nBlur_highlightEdges";
|
||||
m_BadParamNames["octapol_r"] = "octapol_radius";
|
||||
m_BadParamNames["number_of_stripes"] = "bubbleT3D_number_of_stripes";
|
||||
m_BadParamNames["ratio_of_stripes"] = "bubbleT3D_ratio_of_stripes";
|
||||
m_BadParamNames["angle_of_hole"] = "bubbleT3D_angle_of_hole";
|
||||
m_BadParamNames["exponentZ"] = "bubbleT3D_exponentZ";
|
||||
m_BadParamNames["_symmetryZ"] = "bubbleT3D_symmetryZ";
|
||||
m_BadParamNames["_modusBlur"] = "bubbleT3D_modusBlur";
|
||||
|
||||
m_FlattenNames.reserve(24);
|
||||
m_FlattenNames.push_back("pre_crop");
|
||||
@ -318,7 +337,7 @@ public:
|
||||
for (size_t i = 1; i < emberSize; i++)
|
||||
{
|
||||
//Only do this adjustment if not in compat mode..
|
||||
if (embers[i - 1].m_AffineInterp != INTERP_COMPAT && embers[i - 1].m_AffineInterp != INTERP_OLDER)
|
||||
if (embers[i - 1].m_AffineInterp != AFFINE_INTERP_COMPAT && embers[i - 1].m_AffineInterp != AFFINE_INTERP_OLDER)
|
||||
{
|
||||
while (embers[i].m_Rotate < embers[i - 1].m_Rotate - 180)
|
||||
embers[i].m_Rotate += 360;
|
||||
@ -524,7 +543,7 @@ private:
|
||||
if (ParseAndAssign(curAtt->name, attStr, "time", currentEmber.m_Time, ret)) { }
|
||||
else if (ParseAndAssign(curAtt->name, attStr, "scale", currentEmber.m_PixelsPerUnit, ret)) { currentEmber.m_OrigPixPerUnit = currentEmber.m_PixelsPerUnit; }
|
||||
else if (ParseAndAssign(curAtt->name, attStr, "rotate", currentEmber.m_Rotate, ret)) { }
|
||||
else if (ParseAndAssign(curAtt->name, attStr, "zoom", currentEmber.m_Zoom, ret)) { }
|
||||
else if (ParseAndAssign(curAtt->name, attStr, "zoom", currentEmber.m_Zoom, ret)) { ClampGteRef<T>(currentEmber.m_Zoom, 0); }
|
||||
else if (ParseAndAssign(curAtt->name, attStr, "filter", currentEmber.m_SpatialFilterRadius, ret)) { }
|
||||
else if (ParseAndAssign(curAtt->name, attStr, "temporal_filter_width", currentEmber.m_TemporalFilterWidth, ret)) { }
|
||||
else if (ParseAndAssign(curAtt->name, attStr, "temporal_filter_exp", currentEmber.m_TemporalFilterExp, ret)) { }
|
||||
@ -576,13 +595,13 @@ private:
|
||||
else if (!Compare(curAtt->name, "interpolation_space") || !Compare(curAtt->name, "interpolation_type"))
|
||||
{
|
||||
if (!_stricmp("linear", attStr))
|
||||
currentEmber.m_AffineInterp = INTERP_LINEAR;
|
||||
currentEmber.m_AffineInterp = AFFINE_INTERP_LINEAR;
|
||||
else if (!_stricmp("log", attStr))
|
||||
currentEmber.m_AffineInterp = INTERP_LOG;
|
||||
currentEmber.m_AffineInterp = AFFINE_INTERP_LOG;
|
||||
else if (!_stricmp("old", attStr))
|
||||
currentEmber.m_AffineInterp = INTERP_COMPAT;
|
||||
currentEmber.m_AffineInterp = AFFINE_INTERP_COMPAT;
|
||||
else if (!_stricmp("older", attStr))
|
||||
currentEmber.m_AffineInterp = INTERP_OLDER;
|
||||
currentEmber.m_AffineInterp = AFFINE_INTERP_OLDER;
|
||||
else
|
||||
m_ErrorReport.push_back(string(loc) + " : Unrecognized interpolation type " + string(attStr));
|
||||
}
|
||||
@ -593,7 +612,7 @@ private:
|
||||
}
|
||||
else if (!Compare(curAtt->name, "version"))
|
||||
{
|
||||
if (ToLower(string(attStr)).find_first_of("ember") != string::npos)
|
||||
if (ToLower(string(attStr)).find("ember") != string::npos)
|
||||
fromEmber = true;
|
||||
}
|
||||
else if (!Compare(curAtt->name, "size"))
|
||||
@ -1050,8 +1069,8 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
//if (!newLinear)
|
||||
// currentEmber.Flatten(m_FlattenNames);
|
||||
if (!fromEmber && !newLinear)
|
||||
currentEmber.Flatten(m_FlattenNames);
|
||||
|
||||
for (i = 0; i < currentEmber.XformCount(); i++)
|
||||
if (soloXform >= 0 && i != soloXform)
|
||||
@ -1342,16 +1361,17 @@ private:
|
||||
/// Some Apophysis plugins use an inconsistent naming scheme for the parametric variation variables.
|
||||
/// This function identifies and converts them to Ember's consistent naming convention.
|
||||
/// </summary>
|
||||
/// <param name="vec">The vector of corrected names to search</param>
|
||||
/// <param name="att">The current Xml node to check</param>
|
||||
/// <param name="names">The map of corrected names to search</param>
|
||||
/// <param name="name">The current Xml node to check</param>
|
||||
/// <returns>The corrected name if one was found, else the passed in name.</returns>
|
||||
static string GetCorrectedParamName(vector<pair<string, string>>& vec, const char* name)
|
||||
static string GetCorrectedParamName(const unordered_map<string, string>& names, const char* name)
|
||||
{
|
||||
for (auto& v : vec)
|
||||
if (!_stricmp(v.first.c_str(), name))
|
||||
return v.second;
|
||||
auto& newName = names.find(ToLower(name));
|
||||
|
||||
return name;
|
||||
if (newName != names.end())
|
||||
return newName->second;
|
||||
else
|
||||
return name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1503,7 +1523,7 @@ private:
|
||||
}
|
||||
|
||||
static bool m_Init;
|
||||
static vector<pair<string, string>> m_BadParamNames;
|
||||
static unordered_map<string, string> m_BadParamNames;
|
||||
static vector<pair<pair<string, string>, vector<string>>> m_BadVariationNames;
|
||||
VariationList<T> m_VariationList;//The variation list used to make copies of variations to populate the embers with.
|
||||
PaletteList<T> m_PaletteList;
|
||||
|
||||
Reference in New Issue
Block a user