mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 13:10:04 -05: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:
parent
04e72c27de
commit
330074cfb2
@ -13,7 +13,7 @@
|
||||
<!--
|
||||
Change this for every release.
|
||||
-->
|
||||
<?define ProductCode="{F59721C4-C46D-4FFF-BEA4-803FA3BD0BFE}"?>
|
||||
<?define ProductCode="{96EEC105-DB40-4453-AD22-ABA8BC03267D}"?>
|
||||
|
||||
<Product Id="$(var.ProductCode)" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
|
||||
<Package
|
||||
|
@ -157,7 +157,8 @@
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<PrecompiledHeaderFile>EmberPch.h</PrecompiledHeaderFile>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions>/bigobj
|
||||
%(AdditionalOptions)</AdditionalOptions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
@ -228,7 +229,8 @@
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<PrecompiledHeaderFile>EmberPch.h</PrecompiledHeaderFile>
|
||||
<StringPooling>true</StringPooling>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions>/bigobj
|
||||
%(AdditionalOptions)</AdditionalOptions>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
@ -295,12 +297,12 @@
|
||||
<ClInclude Include="..\..\..\Source\Ember\Variations03.h" />
|
||||
<ClInclude Include="..\..\..\Source\Ember\Variations04.h" />
|
||||
<ClInclude Include="..\..\..\Source\Ember\Variations05.h" />
|
||||
<ClInclude Include="..\..\..\Source\Ember\Variations06.h" />
|
||||
<ClInclude Include="..\..\..\Source\Ember\VariationsDC.h" />
|
||||
<ClInclude Include="..\..\..\Source\Ember\Xform.h" />
|
||||
<ClInclude Include="..\..\..\Source\Ember\Isaac.h" />
|
||||
<ClInclude Include="..\..\..\Source\Ember\Timing.h" />
|
||||
<ClInclude Include="..\..\..\Source\Ember\XmlToEmber.h" />
|
||||
<ClInclude Include="resource1.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\Source\Ember\Affine2D.cpp" />
|
||||
|
@ -116,8 +116,8 @@
|
||||
<ClInclude Include="..\..\..\Source\Ember\EmberMotion.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource1.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="..\..\..\Source\Ember\Variations06.h">
|
||||
<Filter>Header Files\Variations</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -298,6 +298,7 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Source\EmberCL\FinalAccumOpenCLKernelCreator.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\EmberCL\DEOpenCLKernelCreator.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\EmberCL\FunctionMapper.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\EmberCL\IterOpenCLKernelCreator.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\EmberCL\OpenCLInfo.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\EmberCL\OpenCLWrapper.cpp" />
|
||||
@ -309,6 +310,7 @@
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\EmberCLStructs.h" />
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\DEOpenCLKernelCreator.h" />
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\FinalAccumOpenCLKernelCreator.h" />
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\FunctionMapper.h" />
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\IterOpenCLKernelCreator.h" />
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\OpenCLInfo.h" />
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\OpenCLWrapper.h" />
|
||||
|
@ -42,6 +42,9 @@
|
||||
<ClCompile Include="..\..\..\Source\EmberCL\OpenCLInfo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Source\EmberCL\FunctionMapper.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\OpenCLWrapper.h">
|
||||
@ -74,6 +77,9 @@
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\OpenCLInfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\Source\EmberCL\FunctionMapper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EmberCL.rc">
|
||||
|
@ -338,7 +338,6 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)"</
|
||||
<ClCompile Include="..\..\..\Source\Fractorium\OptionsDialog.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\Fractorium\qcssparser.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\Fractorium\qcssscanner.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\Fractorium\qcssscanner.h" />
|
||||
<ClCompile Include="..\..\..\Source\Fractorium\QssDialog.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\Fractorium\QssTextEdit.cpp" />
|
||||
<ClCompile Include="..\..\..\Source\Fractorium\SpinBox.cpp" />
|
||||
|
Binary file not shown.
1231
Data/dark.qss
1231
Data/dark.qss
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
|
@ -29,7 +29,7 @@ bool EmberAnimate(EmberOptions& opt)
|
||||
Timing t;
|
||||
bool unsorted = false;
|
||||
uint channels, padding;
|
||||
size_t i;
|
||||
size_t i, firstUnsortedIndex = 0;
|
||||
string inputPath = GetPath(opt.Input());
|
||||
vector<Ember<T>> embers;
|
||||
XmlToEmber<T> parser;
|
||||
@ -128,6 +128,12 @@ bool EmberAnimate(EmberOptions& opt)
|
||||
if (!ParseEmberFile(parser, opt.Input(), embers))
|
||||
return false;
|
||||
|
||||
if (embers.size() <= 1)
|
||||
{
|
||||
cout << "Read " << embers.size() << " embers from file. At least 2 required to animate, exiting." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opt.Format() != "jpg" &&
|
||||
opt.Format() != "png" &&
|
||||
opt.Format() != "ppm" &&
|
||||
@ -206,7 +212,18 @@ bool EmberAnimate(EmberOptions& opt)
|
||||
for (i = 0; i < embers.size(); i++)
|
||||
{
|
||||
if (i > 0 && embers[i].m_Time <= embers[i - 1].m_Time)
|
||||
{
|
||||
if (!unsorted)
|
||||
firstUnsortedIndex = i;
|
||||
|
||||
unsorted = true;
|
||||
}
|
||||
|
||||
if (i > 0 && embers[i].m_Time == embers[i - 1].m_Time)
|
||||
{
|
||||
cout << "Image " << i << " time of " << embers[i].m_Time << " equaled previous image time of " << embers[i - 1].m_Time << ". Adjusting up by 1." << endl;
|
||||
embers[i].m_Time++;
|
||||
}
|
||||
|
||||
if (opt.Supersample() > 0)
|
||||
embers[i].m_Supersample = opt.Supersample();
|
||||
@ -215,8 +232,8 @@ bool EmberAnimate(EmberOptions& opt)
|
||||
embers[i].m_SubBatchSize = opt.SubBatchSize();
|
||||
|
||||
embers[i].m_Quality *= T(opt.QualityScale());
|
||||
embers[i].m_FinalRasW = uint(T(embers[i].m_FinalRasW) * opt.SizeScale());
|
||||
embers[i].m_FinalRasH = uint(T(embers[i].m_FinalRasH) * opt.SizeScale());
|
||||
embers[i].m_FinalRasW = size_t(T(embers[i].m_FinalRasW) * opt.SizeScale());
|
||||
embers[i].m_FinalRasH = size_t(T(embers[i].m_FinalRasH) * opt.SizeScale());
|
||||
embers[i].m_PixelsPerUnit *= T(opt.SizeScale());
|
||||
|
||||
//Cast to double in case the value exceeds 2^32.
|
||||
@ -251,17 +268,18 @@ bool EmberAnimate(EmberOptions& opt)
|
||||
|
||||
if (unsorted)
|
||||
{
|
||||
cout << "Embers were unsorted by time. First out of order index was " << i << ". Sorting." << endl;
|
||||
cout << "Embers were unsorted by time. First out of order index was " << firstUnsortedIndex << ". Sorting." << endl;
|
||||
std::sort(embers.begin(), embers.end(), &CompareEmbers<T>);
|
||||
}
|
||||
|
||||
if (!opt.Time() && !opt.Frame())
|
||||
{
|
||||
if (opt.FirstFrame() == UINT_MAX)
|
||||
opt.FirstFrame(int(embers[0].m_Time));
|
||||
opt.FirstFrame(size_t(embers[0].m_Time));
|
||||
|
||||
if (opt.LastFrame() == UINT_MAX)
|
||||
opt.LastFrame(ClampGte<size_t>(size_t(embers.back().m_Time - 1), opt.FirstFrame()));
|
||||
opt.LastFrame(ClampGte<size_t>(size_t(embers.back().m_Time),//Make sure time - 1 is positive before converting to size_t.
|
||||
opt.FirstFrame() + opt.Dtime()));//Make sure the final value is at least first frame + dtime.
|
||||
}
|
||||
|
||||
if (!opt.Out().empty())
|
||||
@ -271,7 +289,7 @@ bool EmberAnimate(EmberOptions& opt)
|
||||
}
|
||||
|
||||
//Final setup steps before running.
|
||||
padding = uint(log10(double(embers.size()))) + 1;
|
||||
padding = uint(std::log10(double(embers.size()))) + 1;
|
||||
|
||||
for (auto& r : renderers)
|
||||
{
|
||||
@ -284,7 +302,7 @@ bool EmberAnimate(EmberOptions& opt)
|
||||
r->Transparency(opt.Transparency());
|
||||
r->NumChannels(channels);
|
||||
r->BytesPerChannel(opt.BitsPerChannel() / 8);
|
||||
r->Priority(eThreadPriority(Clamp<int>(int(opt.Priority()), int(eThreadPriority::LOWEST), int(eThreadPriority::HIGHEST))));
|
||||
r->Priority(eThreadPriority(Clamp<intmax_t>(intmax_t(opt.Priority()), intmax_t(eThreadPriority::LOWEST), intmax_t(eThreadPriority::HIGHEST))));
|
||||
}
|
||||
|
||||
std::function<void (vector<byte>&, string, EmberImageComments, size_t, size_t, size_t)> saveFunc = [&](vector<byte>& finalImage,
|
||||
|
@ -787,7 +787,8 @@ string DEOpenCLKernelCreator::CreateGaussianDEKernelNoLocalCache(size_t ss)
|
||||
"\n";
|
||||
|
||||
if (doScf)
|
||||
os << " filterSelect *= scfact;\n";
|
||||
os <<
|
||||
" filterSelect *= scfact;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -830,7 +831,7 @@ string DEOpenCLKernelCreator::CreateGaussianDEKernelNoLocalCache(size_t ss)
|
||||
" }\n"
|
||||
" }\n"//bucket.w != 0.
|
||||
" }\n"//In bounds.
|
||||
"\n"
|
||||
//"\n"
|
||||
//" barrier(CLK_GLOBAL_MEM_FENCE);\n"//Just to be safe.
|
||||
"}\n";
|
||||
|
||||
|
@ -149,8 +149,8 @@ static const char* CalcAlphaFunctionString =
|
||||
static const char* CurveAdjustFunctionString =
|
||||
"static inline void CurveAdjust(__constant real4reals_bucket* csa, float* a, uint index)\n"
|
||||
"{\n"
|
||||
" uint tempIndex = (uint)Clamp(*a, 0.0, (float)COLORMAP_LENGTH_MINUS_1);\n"
|
||||
" uint tempIndex2 = (uint)Clamp(csa[tempIndex].m_Real4.x, 0.0, (real_t)COLORMAP_LENGTH_MINUS_1);\n"
|
||||
" uint tempIndex = (uint)clamp(*a, (float)0.0, (float)COLORMAP_LENGTH_MINUS_1);\n"
|
||||
" uint tempIndex2 = (uint)clamp((float)csa[tempIndex].m_Real4.x, (float)0.0, (float)COLORMAP_LENGTH_MINUS_1);\n"
|
||||
"\n"
|
||||
" *a = (float)round(csa[tempIndex2].m_Reals[index]);\n"
|
||||
"}\n";
|
||||
@ -194,135 +194,6 @@ static const char* RandFunctionString =
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
/// <summary>
|
||||
/// OpenCL equivalent of the global ClampRef().
|
||||
/// </summary>
|
||||
static const char* ClampRealFunctionString =
|
||||
"inline real_t Clamp(real_t val, real_t min, real_t max)\n"
|
||||
"{\n"
|
||||
" if (val < min)\n"
|
||||
" return min;\n"
|
||||
" else if (val > max)\n"
|
||||
" return max;\n"
|
||||
" else\n"
|
||||
" return val;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline void ClampRef(real_t* val, real_t min, real_t max)\n"
|
||||
"{\n"
|
||||
" if (*val < min)\n"
|
||||
" *val = min;\n"
|
||||
" else if (*val > max)\n"
|
||||
" *val = max;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t ClampGte(real_t val, real_t gte)\n"
|
||||
"{\n"
|
||||
" return (val < gte) ? gte : val;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
/// <summary>
|
||||
/// OpenCL equivalent of the global LRint().
|
||||
/// </summary>
|
||||
static const char* InlineMathFunctionsString =
|
||||
"inline real_t LRint(real_t x)\n"
|
||||
"{\n"
|
||||
" intPrec temp = (x >= 0.0 ? (intPrec)(x + 0.5) : (intPrec)(x - 0.5));\n"
|
||||
" return (real_t)temp;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Round(real_t r)\n"
|
||||
"{\n"
|
||||
" return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Sign(real_t v)\n"
|
||||
"{\n"
|
||||
" return (v < 0.0) ? -1 : (v > 0.0) ? 1 : 0.0;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t SignNz(real_t v)\n"
|
||||
"{\n"
|
||||
" return (v < 0.0) ? -1.0 : 1.0;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Sqr(real_t v)\n"
|
||||
"{\n"
|
||||
" return v * v;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t SafeSqrt(real_t x)\n"
|
||||
"{\n"
|
||||
" if (x <= 0.0)\n"
|
||||
" return 0.0;\n"
|
||||
"\n"
|
||||
" return sqrt(x);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Cube(real_t v)\n"
|
||||
"{\n"
|
||||
" return v * v * v;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Hypot(real_t x, real_t y)\n"
|
||||
"{\n"
|
||||
" return sqrt(SQR(x) + SQR(y));\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Spread(real_t x, real_t y)\n"
|
||||
"{\n"
|
||||
" return Hypot(x, y) * ((x) > 0.0 ? 1.0 : -1.0);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Powq4(real_t x, real_t y)\n"
|
||||
"{\n"
|
||||
" return pow(fabs(x), y) * SignNz(x);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Powq4c(real_t x, real_t y)\n"
|
||||
"{\n"
|
||||
" return y == 1.0 ? x : Powq4(x, y);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Zeps(real_t x)\n"
|
||||
"{\n"
|
||||
" return x == 0.0 ? EPS : x;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Lerp(real_t a, real_t b, real_t p)\n"
|
||||
"{\n"
|
||||
" return a + (b - a) * p;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Fabsmod(real_t v)\n"
|
||||
"{\n"
|
||||
" real_t dummy;\n"
|
||||
"\n"
|
||||
" return modf(v, &dummy);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Fosc(real_t p, real_t amp, real_t ph)\n"
|
||||
"{\n"
|
||||
" return 0.5 - cos(p * amp + ph) * 0.5;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t Foscn(real_t p, real_t ph)\n"
|
||||
"{\n"
|
||||
" return 0.5 - cos(p + ph) * 0.5;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t LogScale(real_t x)\n"
|
||||
"{\n"
|
||||
" return x == 0.0 ? 0.0 : log((fabs(x) + 1) * M_E) * SignNz(x) / M_E;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"inline real_t LogMap(real_t x)\n"
|
||||
"{\n"
|
||||
" return x == 0.0 ? 0.0 : (M_E + log(x * M_E)) * 0.25 * SignNz(x);\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
/// <summary>
|
||||
/// OpenCL equivalent Renderer::AddToAccum().
|
||||
/// </summary>
|
||||
|
@ -44,9 +44,11 @@
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
#include <time.h>
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(BUILDING_EMBERCL)
|
||||
|
@ -13,15 +13,6 @@
|
||||
|
||||
namespace EmberCLns
|
||||
{
|
||||
//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.
|
||||
|
||||
/// <summary>
|
||||
/// Various constants needed for rendering.
|
||||
/// </summary>
|
||||
@ -32,20 +23,23 @@ static string ConstantDefinesString(bool doublePrecision)
|
||||
if (doublePrecision)
|
||||
{
|
||||
os << "#if defined(cl_amd_fp64)\n"//AMD extension available?
|
||||
<< " #pragma OPENCL EXTENSION cl_amd_fp64 : enable\n"
|
||||
<< "#endif\n"
|
||||
<< "#if defined(cl_khr_fp64)\n"//Khronos extension available?
|
||||
<< " #pragma OPENCL EXTENSION cl_khr_fp64 : enable\n"
|
||||
<< "#endif\n"
|
||||
<< "#pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable\n"//Only supported on nVidia.
|
||||
<< "typedef long intPrec;\n"
|
||||
<< "typedef uint atomi;\n"//Same size as real_bucket_t, always 4 bytes.
|
||||
<< "typedef double real_t;\n"
|
||||
<< "typedef float real_bucket_t;\n"//Assume buckets are always float, even though iter calcs are in double.
|
||||
<< "typedef double4 real4;\n"
|
||||
<< "typedef float4 real4_bucket;\n"//And here too.
|
||||
<< "#define EPS (DBL_EPSILON)\n"
|
||||
;
|
||||
" #pragma OPENCL EXTENSION cl_amd_fp64 : enable\n"
|
||||
"#endif\n"
|
||||
"#if defined(cl_khr_fp64)\n"//Khronos extension available?
|
||||
" #pragma OPENCL EXTENSION cl_khr_fp64 : enable\n"
|
||||
"#endif\n"
|
||||
"#pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable\n"//Only supported on nVidia.
|
||||
"typedef long intPrec;\n"
|
||||
"typedef uint atomi;\n"//Same size as real_bucket_t, always 4 bytes.
|
||||
"typedef double real_t;\n"
|
||||
"typedef float real_bucket_t;\n"//Assume buckets are always float, even though iter calcs are in double.
|
||||
"typedef double2 real2;\n"
|
||||
"typedef double4 real4;\n"
|
||||
"typedef float4 real4_bucket;\n"//And here too.
|
||||
"#define EPS (DBL_EPSILON)\n"
|
||||
"#define TLOW (DBL_MIN)\n"
|
||||
"#define TMAX (DBL_MAX)\n"
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -53,9 +47,12 @@ static string ConstantDefinesString(bool doublePrecision)
|
||||
"typedef uint atomi;\n"
|
||||
"typedef float real_t;\n"
|
||||
"typedef float real_bucket_t;\n"
|
||||
"typedef float2 real2;\n"
|
||||
"typedef float4 real4;\n"
|
||||
"typedef float4 real4_bucket;\n"
|
||||
"#define EPS (FLT_EPSILON)\n"
|
||||
"#define TLOW (FLT_MIN)\n"
|
||||
"#define TMAX (FLT_MAX)\n"
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,6 @@ string FinalAccumOpenCLKernelCreator::CreateFinalAccumKernelString(bool earlyCli
|
||||
|
||||
os <<
|
||||
ConstantDefinesString(m_DoublePrecision) <<
|
||||
ClampRealFunctionString <<
|
||||
UnionCLStructString <<
|
||||
RgbToHsvFunctionString <<
|
||||
HsvToRgbFunctionString <<
|
||||
@ -484,7 +483,6 @@ string FinalAccumOpenCLKernelCreator::CreateGammaCorrectionKernelString(bool alp
|
||||
|
||||
os <<
|
||||
ConstantDefinesString(m_DoublePrecision) <<
|
||||
ClampRealFunctionString <<
|
||||
UnionCLStructString <<
|
||||
RgbToHsvFunctionString <<
|
||||
HsvToRgbFunctionString <<
|
||||
|
151
Source/EmberCL/FunctionMapper.cpp
Normal file
151
Source/EmberCL/FunctionMapper.cpp
Normal file
@ -0,0 +1,151 @@
|
||||
#include "EmberCLPch.h"
|
||||
#include "FunctionMapper.h"
|
||||
|
||||
namespace EmberCLns
|
||||
{
|
||||
std::unordered_map<string, string> FunctionMapper::m_GlobalMap;
|
||||
|
||||
FunctionMapper::FunctionMapper()
|
||||
{
|
||||
if (m_GlobalMap.empty())
|
||||
{
|
||||
m_GlobalMap["LRint"] =
|
||||
"inline real_t LRint(real_t x)\n"
|
||||
"{\n"
|
||||
" intPrec temp = (x >= 0.0 ? (intPrec)(x + 0.5) : (intPrec)(x - 0.5));\n"
|
||||
" return (real_t)temp;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Round"] =
|
||||
"inline real_t Round(real_t r)\n"
|
||||
"{\n"
|
||||
" return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Sign"] =
|
||||
"inline real_t Sign(real_t v)\n"
|
||||
"{\n"
|
||||
" return (v < 0.0) ? -1 : (v > 0.0) ? 1 : 0.0;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["SignNz"] =
|
||||
"inline real_t SignNz(real_t v)\n"
|
||||
"{\n"
|
||||
" return (v < 0.0) ? -1.0 : 1.0;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Sqr"] =
|
||||
"inline real_t Sqr(real_t v)\n"
|
||||
"{\n"
|
||||
" return v * v;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["SafeSqrt"] =
|
||||
"inline real_t SafeSqrt(real_t x)\n"
|
||||
"{\n"
|
||||
" if (x <= 0.0)\n"
|
||||
" return 0.0;\n"
|
||||
"\n"
|
||||
" return sqrt(x);\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Cube"] =
|
||||
"inline real_t Cube(real_t v)\n"
|
||||
"{\n"
|
||||
" return v * v * v;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Hypot"] =
|
||||
"inline real_t Hypot(real_t x, real_t y)\n"
|
||||
"{\n"
|
||||
" return sqrt(SQR(x) + SQR(y));\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Spread"] =
|
||||
"inline real_t Spread(real_t x, real_t y)\n"
|
||||
"{\n"
|
||||
" return Hypot(x, y) * ((x) > 0.0 ? 1.0 : -1.0);\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Powq4"] =
|
||||
"inline real_t Powq4(real_t x, real_t y)\n"
|
||||
"{\n"
|
||||
" return pow(fabs(x), y) * SignNz(x);\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Powq4c"] =
|
||||
"inline real_t Powq4c(real_t x, real_t y)\n"
|
||||
"{\n"
|
||||
" return y == 1.0 ? x : Powq4(x, y);\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Zeps"] =
|
||||
"inline real_t Zeps(real_t x)\n"
|
||||
"{\n"
|
||||
" return x == 0.0 ? EPS : x;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Lerp"] =
|
||||
"inline real_t Lerp(real_t a, real_t b, real_t p)\n"
|
||||
"{\n"
|
||||
" return a + (b - a) * p;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Fabsmod"] =
|
||||
"inline real_t Fabsmod(real_t v)\n"
|
||||
"{\n"
|
||||
" real_t dummy;\n"
|
||||
"\n"
|
||||
" return modf(v, &dummy);\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Fosc"] =
|
||||
"inline real_t Fosc(real_t p, real_t amp, real_t ph)\n"
|
||||
"{\n"
|
||||
" return 0.5 - cos(p * amp + ph) * 0.5;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Foscn"] =
|
||||
"inline real_t Foscn(real_t p, real_t ph)\n"
|
||||
"{\n"
|
||||
" return 0.5 - cos(p + ph) * 0.5;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["LogScale"] =
|
||||
"inline real_t LogScale(real_t x)\n"
|
||||
"{\n"
|
||||
" return x == 0.0 ? 0.0 : log((fabs(x) + 1) * M_E) * SignNz(x) / M_E;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["LogMap"] =
|
||||
"inline real_t LogMap(real_t x)\n"
|
||||
"{\n"
|
||||
" return x == 0.0 ? 0.0 : (M_E + log(x * M_E)) * 0.25 * SignNz(x);\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["ClampGte"] =
|
||||
"inline real_t ClampGte(real_t val, real_t gte)\n"
|
||||
"{\n"
|
||||
" return (val < gte) ? gte : val;\n"
|
||||
"}\n";
|
||||
|
||||
m_GlobalMap["Swap"] =
|
||||
"inline void Swap(real_t* val1, real_t* val2)\n"
|
||||
"{\n"
|
||||
" real_t tmp = *val1;\n"
|
||||
" *val1 = *val2;\n"
|
||||
" *val2 = tmp;\n"
|
||||
"}\n";
|
||||
}
|
||||
}
|
||||
|
||||
const string* FunctionMapper::GetGlobalFunc(const string& func)
|
||||
{
|
||||
auto& text = m_GlobalMap.find(func);
|
||||
|
||||
if (text != m_GlobalMap.end())
|
||||
return &text->second;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
}
|
21
Source/EmberCL/FunctionMapper.h
Normal file
21
Source/EmberCL/FunctionMapper.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "EmberCLPch.h"
|
||||
|
||||
namespace EmberCLns
|
||||
{
|
||||
/// <summary>
|
||||
/// Functionality to map OpenCL function names to their full function body program strings.
|
||||
/// This is used to ensure only the functions that are needed by a program are included once
|
||||
/// in the program string.
|
||||
/// </summary>
|
||||
class EMBERCL_API FunctionMapper
|
||||
{
|
||||
public:
|
||||
FunctionMapper();
|
||||
static const string* GetGlobalFunc(const string& func);
|
||||
|
||||
private:
|
||||
static std::unordered_map<string, string> m_GlobalMap;
|
||||
};
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
#include "IterOpenCLKernelCreator.h"
|
||||
|
||||
//#define STRAIGHT_RAND 1
|
||||
#define USE_CASE 1
|
||||
|
||||
namespace EmberCLns
|
||||
{
|
||||
@ -39,16 +38,20 @@ template <typename T> const string& IterOpenCLKernelCreator<T>::IterEntryPoint()
|
||||
/// <param name="doAccum">Debugging parameter to include or omit accumulating to the histogram. Default: true.</param>
|
||||
/// <returns>The kernel string</returns>
|
||||
template <typename T>
|
||||
string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, string& parVarDefines, bool lockAccum, bool doAccum)
|
||||
string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember, string& parVarDefines, bool lockAccum, bool doAccum)
|
||||
{
|
||||
bool doublePrecision = typeid(T) == typeid(double);
|
||||
size_t i, v, varIndex, varCount, totalXformCount = ember.TotalXformCount();
|
||||
ostringstream kernelIterBody, xformFuncs, os;
|
||||
vector<Variation<T>*> variations;
|
||||
|
||||
xformFuncs << "\n" << parVarDefines << endl;
|
||||
xformFuncs << VariationStateString(ember);
|
||||
xformFuncs << parVarDefines << endl;
|
||||
ember.GetPresentVariations(variations);
|
||||
for (auto var : variations) if (var) xformFuncs << var->OpenCLFuncsString();
|
||||
|
||||
for (auto var : variations)
|
||||
if (var)
|
||||
xformFuncs << var->OpenCLFuncsString();
|
||||
|
||||
for (i = 0; i < totalXformCount; i++)
|
||||
{
|
||||
@ -62,7 +65,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
|
||||
v = varIndex = varCount = 0;
|
||||
xformFuncs <<
|
||||
"void Xform" << i << "(__constant XformCL* xform, __constant real_t* parVars, Point* inPoint, Point* outPoint, uint2* mwc)\n" <<
|
||||
"void Xform" << i << "(__constant XformCL* xform, __constant real_t* parVars, Point* inPoint, Point* outPoint, uint2* mwc, VariationState* varState)\n" <<
|
||||
"{\n"
|
||||
" real_t transX, transY, transZ;\n"
|
||||
" real4 vIn, vOut = 0.0;\n";
|
||||
@ -215,8 +218,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
|
||||
os <<
|
||||
ConstantDefinesString(doublePrecision) <<
|
||||
InlineMathFunctionsString <<
|
||||
ClampRealFunctionString <<
|
||||
GlobalFunctionsString(ember) <<
|
||||
RandFunctionString <<
|
||||
PointCLStructString <<
|
||||
XformCLStructString <<
|
||||
@ -237,12 +239,13 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
" __constant EmberCL* ember,\n"
|
||||
" __constant XformCL* xforms,\n"
|
||||
" __constant real_t* parVars,\n"
|
||||
" __global uchar* xformDistributions,\n"//Using uchar is quicker than uint. Can't be constant because the size can be too large to fit when using xaos.//FINALOPT
|
||||
" __global uchar* xformDistributions,\n"//Using uchar is quicker than uint. Can't be constant because the size can be too large to fit when using xaos.
|
||||
" __constant CarToRasCL* carToRas,\n"
|
||||
" __global real4reals_bucket* histogram,\n"
|
||||
" uint histSize,\n"
|
||||
" __read_only image2d_t palette,\n"
|
||||
" __global Point* points\n"
|
||||
//" uint startRender\n"
|
||||
"\t)\n"
|
||||
"{\n"
|
||||
" bool fuse, ok;\n"
|
||||
@ -261,8 +264,9 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
" CLK_ADDRESS_CLAMP_TO_EDGE |\n"//Clamp to edge
|
||||
" CLK_FILTER_NEAREST;\n"//Don't interpolate
|
||||
" uint threadXY = (THREAD_ID_X + THREAD_ID_Y);\n"
|
||||
" uint threadXDivRows = (THREAD_ID_X / (NTHREADS / THREADS_PER_WARP));\n"
|
||||
" uint threadXDivRows = (THREAD_ID_X / NWARPS);\n"
|
||||
" uint threadsMinus1 = NTHREADS - 1;\n"
|
||||
" VariationState varState;\n"
|
||||
;
|
||||
|
||||
os <<
|
||||
@ -278,6 +282,9 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
" {\n"
|
||||
" fuse = true;\n"
|
||||
" itersToDo = fuseCount;\n"
|
||||
//Calling MwcNextNeg1Pos1() twice is deliberate. The first call to mwc is not very random since it just does
|
||||
//an xor. So it must be called twice to get it in a good random state.
|
||||
" firstPoint.m_X = MwcNextNeg1Pos1(&mwc);\n"
|
||||
" firstPoint.m_X = MwcNextNeg1Pos1(&mwc);\n"
|
||||
" firstPoint.m_Y = MwcNextNeg1Pos1(&mwc);\n"
|
||||
" firstPoint.m_Z = 0.0;\n"
|
||||
@ -290,7 +297,13 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
" itersToDo = iterCount;\n"
|
||||
" firstPoint = points[pointsIndex];\n"
|
||||
" }\n"
|
||||
"\n";
|
||||
"\n"
|
||||
;
|
||||
|
||||
auto varStateString = VariationStateInitString(ember);
|
||||
|
||||
if (!varStateString.empty())
|
||||
os << varStateString << "\n\n";
|
||||
|
||||
//This is done once initially here and then again after each swap-sync in the main loop.
|
||||
//This along with the randomness that the point shuffle provides gives sufficient randomness
|
||||
@ -336,7 +349,6 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
|
||||
for (i = 0; i < ember.XformCount(); i++)
|
||||
{
|
||||
#ifdef USE_CASE
|
||||
if (i == 0)
|
||||
{
|
||||
os <<
|
||||
@ -347,7 +359,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
os <<
|
||||
" case " << i << ":\n"
|
||||
" {\n" <<
|
||||
" Xform" << i << "(&(xforms[" << i << "]), parVars, &firstPoint, &secondPoint, &mwc);\n" <<
|
||||
" Xform" << i << "(&(xforms[" << i << "]), parVars, &firstPoint, &secondPoint, &mwc, &varState);\n" <<
|
||||
" break;\n"
|
||||
" }\n";
|
||||
|
||||
@ -356,19 +368,6 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
os <<
|
||||
" }\n";
|
||||
}
|
||||
#else
|
||||
if (i == 0)
|
||||
os <<
|
||||
" if (secondPoint.m_LastXfUsed == " << i << ")\n";
|
||||
else
|
||||
os <<
|
||||
" else if (secondPoint.m_LastXfUsed == " << i << ")\n";
|
||||
|
||||
os <<
|
||||
" {\n" <<
|
||||
" Xform" << i << "(&(xforms[" << i << "]), parVars, &firstPoint, &secondPoint, &mwc);\n" <<
|
||||
" }\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
os <<
|
||||
@ -438,7 +437,7 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
" if ((xforms[" << finalIndex << "].m_Opacity == 1) || (MwcNext01(&mwc) < xforms[" << finalIndex << "].m_Opacity))\n"
|
||||
" {\n"
|
||||
" tempPoint.m_LastXfUsed = secondPoint.m_LastXfUsed;\n"
|
||||
" Xform" << finalIndex << "(&(xforms[" << finalIndex << "]), parVars, &secondPoint, &tempPoint, &mwc);\n"
|
||||
" Xform" << finalIndex << "(&(xforms[" << finalIndex << "]), parVars, &secondPoint, &tempPoint, &mwc, &varState);\n"
|
||||
" secondPoint = tempPoint;\n"
|
||||
" }\n"
|
||||
"\n";
|
||||
@ -543,6 +542,50 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a string containing all of the global functions needed by the passed in ember.
|
||||
/// </summary>
|
||||
/// <param name="ember">The ember to create the global function strings from</param>
|
||||
/// <returns>String of all global function names and bodies</returns>
|
||||
template <typename T>
|
||||
string IterOpenCLKernelCreator<T>::GlobalFunctionsString(const Ember<T>& ember)
|
||||
{
|
||||
size_t i, j, xformCount = ember.TotalXformCount();
|
||||
vector<string> funcNames;//Can't use a set here because they sort and we must preserve the insertion order due to nested function calls.
|
||||
ostringstream os;
|
||||
static string zeps = "Zeps";
|
||||
|
||||
for (i = 0; i < xformCount; i++)
|
||||
{
|
||||
if (auto xform = ember.GetTotalXform(i))
|
||||
{
|
||||
size_t varCount = xform->TotalVariationCount();
|
||||
|
||||
if (xform->NeedPrecalcAngles())
|
||||
if (!Contains(funcNames, zeps))
|
||||
funcNames.push_back(zeps);
|
||||
|
||||
for (j = 0; j < varCount; j++)
|
||||
{
|
||||
if (auto var = xform->GetVariation(j))
|
||||
{
|
||||
auto names = var->OpenCLGlobalFuncNames();
|
||||
|
||||
for (auto& name : names)
|
||||
if (!Contains(funcNames, name))
|
||||
funcNames.push_back(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& funcName : funcNames)
|
||||
if(auto text = m_FunctionMapper.GetGlobalFunc(funcName))
|
||||
os << *text << endl;
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an OpenCL string of #defines and a corresponding host side vector for parametric variation values.
|
||||
/// Parametric variations present a special problem in the iteration code.
|
||||
@ -571,9 +614,9 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
/// #define CURL_C2_2 3
|
||||
/// #define BLOB_LOW_3 4
|
||||
/// #define BLOB_HIGH_3 5
|
||||
/// #define BLOB_WAVES_ 6
|
||||
/// #define BLOB_WAVES_3 6
|
||||
///
|
||||
/// The variations the use these #defines by first looking up the index of the
|
||||
/// The variations use these #defines by first looking up the index of the
|
||||
/// xform they belong to in the parent ember and generating the OpenCL string based on that
|
||||
/// in their overridden OpenCLString() functions.
|
||||
/// Template argument expected to be float or double.
|
||||
@ -583,10 +626,9 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(Ember<T>& ember, strin
|
||||
/// <param name="doVals">True if the vector should be populated, else false. Default: true.</param>
|
||||
/// <param name="doString">True if the string should be populated, else false. Default: true.</param>
|
||||
template <typename T>
|
||||
void IterOpenCLKernelCreator<T>::ParVarIndexDefines(Ember<T>& ember, pair<string, vector<T>>& params, bool doVals, bool doString)
|
||||
void IterOpenCLKernelCreator<T>::ParVarIndexDefines(const Ember<T>& ember, pair<string, vector<T>>& params, bool doVals, bool doString)
|
||||
{
|
||||
size_t i, j, k, size = 0, xformCount = ember.TotalXformCount();
|
||||
Xform<T>* xform;
|
||||
ostringstream os;
|
||||
|
||||
if (doVals)
|
||||
@ -594,23 +636,26 @@ void IterOpenCLKernelCreator<T>::ParVarIndexDefines(Ember<T>& ember, pair<string
|
||||
|
||||
for (i = 0; i < xformCount; i++)
|
||||
{
|
||||
if ((xform = ember.GetTotalXform(i)))
|
||||
if (auto xform = ember.GetTotalXform(i))
|
||||
{
|
||||
size_t varCount = xform->TotalVariationCount();
|
||||
|
||||
for (j = 0; j < varCount; j++)
|
||||
{
|
||||
if (ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(xform->GetVariation(j)))
|
||||
if (auto parVar = dynamic_cast<ParametricVariation<T>*>(xform->GetVariation(j)))
|
||||
{
|
||||
for (k = 0; k < parVar->ParamCount(); k++)
|
||||
{
|
||||
if (doString)
|
||||
os << "#define " << ToUpper(parVar->Params()[k].Name()) << "_" << i << " " << size << endl;//Uniquely identify this param in this variation in this xform.
|
||||
if (!parVar->Params()[k].IsState())
|
||||
{
|
||||
if (doString)
|
||||
os << "#define " << ToUpper(parVar->Params()[k].Name()) << "_" << i << " " << size << endl;//Uniquely identify this param in this variation in this xform.
|
||||
|
||||
if (doVals)
|
||||
params.second.push_back(parVar->Params()[k].ParamVal());
|
||||
if (doVals)
|
||||
params.second.push_back(parVar->Params()[k].ParamVal());
|
||||
|
||||
size++;
|
||||
size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -624,6 +669,69 @@ void IterOpenCLKernelCreator<T>::ParVarIndexDefines(Ember<T>& ember, pair<string
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the string needed for the struct whose values will change between each iteration.
|
||||
/// This is only needed for variations whose state changes.
|
||||
/// If none are present, the struct will be empty.
|
||||
/// </summary>
|
||||
/// <param name="ember">The ember to generate the variation state struct string for</param>
|
||||
/// <returns>The variation state struct string</returns>
|
||||
template <typename T>
|
||||
string IterOpenCLKernelCreator<T>::VariationStateString(const Ember<T>& ember)
|
||||
{
|
||||
ostringstream os;
|
||||
|
||||
os << "typedef struct __attribute__ " ALIGN_CL " _VariationState\n{";
|
||||
|
||||
for (size_t i = 0; i < ember.TotalXformCount(); i++)
|
||||
{
|
||||
if (auto xform = ember.GetTotalXform(i))
|
||||
{
|
||||
for (size_t j = 0; j < xform->TotalVariationCount(); j++)
|
||||
{
|
||||
if (auto var = xform->GetVariation(j))
|
||||
{
|
||||
os << var->StateOpenCLString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
os << "\n} VariationState;\n\n";
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the string needed for the initial state of the struct whose values will change between each iteration.
|
||||
/// This is only needed for variations whose state changes.
|
||||
/// If none are present, the returned init string will be empty.
|
||||
/// This will be called at the beginning of each kernel.
|
||||
/// </summary>
|
||||
/// <param name="ember">The ember to generate the variation state struct init string for</param>
|
||||
/// <returns>The variation state struct init string</returns>
|
||||
template <typename T>
|
||||
string IterOpenCLKernelCreator<T>::VariationStateInitString(const Ember<T>& ember)
|
||||
{
|
||||
ostringstream os;
|
||||
|
||||
for (size_t i = 0; i < ember.TotalXformCount(); i++)
|
||||
{
|
||||
if (auto xform = ember.GetTotalXform(i))
|
||||
{
|
||||
for (size_t j = 0; j < xform->TotalVariationCount(); j++)
|
||||
{
|
||||
if (auto var = xform->GetVariation(j))
|
||||
{
|
||||
os << var->StateInitOpenCLString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine whether the two embers passed in differ enough
|
||||
/// to require a rebuild of the iteration code.
|
||||
@ -641,7 +749,7 @@ void IterOpenCLKernelCreator<T>::ParVarIndexDefines(Ember<T>& ember, pair<string
|
||||
/// <param name="ember2">The second ember to compare</param>
|
||||
/// <returns>True if a rebuild is required, else false</returns>
|
||||
template <typename T>
|
||||
bool IterOpenCLKernelCreator<T>::IsBuildRequired(Ember<T>& ember1, Ember<T>& ember2)
|
||||
bool IterOpenCLKernelCreator<T>::IsBuildRequired(const Ember<T>& ember1, const Ember<T>& ember2)
|
||||
{
|
||||
size_t i, j, xformCount = ember1.TotalXformCount();
|
||||
|
||||
@ -688,7 +796,7 @@ bool IterOpenCLKernelCreator<T>::IsBuildRequired(Ember<T>& ember1, Ember<T>& emb
|
||||
/// </summary>
|
||||
/// <returns>The kernel string</returns>
|
||||
template <typename T>
|
||||
string IterOpenCLKernelCreator<T>::CreateZeroizeKernelString()
|
||||
string IterOpenCLKernelCreator<T>::CreateZeroizeKernelString() const
|
||||
{
|
||||
ostringstream os;
|
||||
|
||||
@ -707,8 +815,16 @@ string IterOpenCLKernelCreator<T>::CreateZeroizeKernelString()
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the histogram summing kernel string.
|
||||
/// This is used when running with multiple GPUs. It takes
|
||||
/// two histograms present on a single device, source and dest,
|
||||
/// and adds the values of source to dest.
|
||||
/// It optionally sets all values of source to zero.
|
||||
/// </summary>
|
||||
/// <returns>The kernel string</returns>
|
||||
template <typename T>
|
||||
string IterOpenCLKernelCreator<T>::CreateSumHistKernelString()
|
||||
string IterOpenCLKernelCreator<T>::CreateSumHistKernelString() const
|
||||
{
|
||||
ostringstream os;
|
||||
|
||||
@ -739,7 +855,7 @@ string IterOpenCLKernelCreator<T>::CreateSumHistKernelString()
|
||||
/// <param name="ember">The ember to create the projection string for</param>
|
||||
/// <returns>The kernel string</returns>
|
||||
template <typename T>
|
||||
string IterOpenCLKernelCreator<T>::CreateProjectionString(Ember<T>& ember)
|
||||
string IterOpenCLKernelCreator<T>::CreateProjectionString(const Ember<T>& ember) const
|
||||
{
|
||||
size_t projBits = ember.ProjBits();
|
||||
ostringstream os;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "EmberCLPch.h"
|
||||
#include "EmberCLStructs.h"
|
||||
#include "EmberCLFunctions.h"
|
||||
#include "FunctionMapper.h"
|
||||
|
||||
/// <summary>
|
||||
/// IterOpenCLKernelCreator class.
|
||||
@ -29,20 +30,24 @@ public:
|
||||
const string& SumHistKernel() const;
|
||||
const string& SumHistEntryPoint() const;
|
||||
const string& IterEntryPoint() const;
|
||||
string CreateIterKernelString(Ember<T>& ember, string& parVarDefines, bool lockAccum = false, bool doAccum = true);
|
||||
static void ParVarIndexDefines(Ember<T>& ember, pair<string, vector<T>>& params, bool doVals = true, bool doString = true);
|
||||
static bool IsBuildRequired(Ember<T>& ember1, Ember<T>& ember2);
|
||||
string CreateIterKernelString(const Ember<T>& ember, string& parVarDefines, bool lockAccum = false, bool doAccum = true);
|
||||
string GlobalFunctionsString(const Ember<T>& ember);
|
||||
static void ParVarIndexDefines(const Ember<T>& ember, pair<string, vector<T>>& params, bool doVals = true, bool doString = true);
|
||||
static string VariationStateString(const Ember<T>& ember);
|
||||
static string VariationStateInitString(const Ember<T>& ember);
|
||||
static bool IsBuildRequired(const Ember<T>& ember1, const Ember<T>& ember2);
|
||||
|
||||
private:
|
||||
string CreateZeroizeKernelString();
|
||||
string CreateSumHistKernelString();
|
||||
string CreateProjectionString(Ember<T>& ember);
|
||||
string CreateZeroizeKernelString() const;
|
||||
string CreateSumHistKernelString() const;
|
||||
string CreateProjectionString(const Ember<T>& ember) const;
|
||||
|
||||
string m_IterEntryPoint;
|
||||
string m_ZeroizeKernel;
|
||||
string m_ZeroizeEntryPoint;
|
||||
string m_SumHistKernel;
|
||||
string m_SumHistEntryPoint;
|
||||
FunctionMapper m_FunctionMapper;
|
||||
};
|
||||
|
||||
#ifdef OPEN_CL_TEST_AREA
|
||||
|
@ -354,7 +354,7 @@ bool RendererCL<T, bucketT>::WritePoints(size_t device, vector<PointCL<T>>& vec)
|
||||
|
||||
#ifdef TEST_CL
|
||||
template <typename T, typename bucketT>
|
||||
bool RendererCL<T, bucketT>::WriteRandomPoints()
|
||||
bool RendererCL<T, bucketT>::WriteRandomPoints(size_t device)
|
||||
{
|
||||
size_t size = IterGridKernelCount();
|
||||
vector<PointCL<T>> vec(size);
|
||||
@ -368,7 +368,7 @@ bool RendererCL<T, bucketT>::WriteRandomPoints()
|
||||
vec[i].m_LastXfUsed = 0;
|
||||
}
|
||||
|
||||
return WritePoints(vec);
|
||||
return WritePoints(device, vec);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -613,6 +613,8 @@ vector<string> RendererCL<T, bucketT>::ErrorReport()
|
||||
/// <summary>
|
||||
/// Set the vector of random contexts on every device.
|
||||
/// Call the base, and reset the seeds vector.
|
||||
/// Used on the command line when the user wants a specific set of seeds to start with to
|
||||
/// produce an exact result. Mostly for debugging.
|
||||
/// </summary>
|
||||
/// <param name="randVec">The vector of random contexts to assign</param>
|
||||
/// <returns>True if the size of the vector matched the number of threads used for rendering and writing seeds to OpenCL succeeded, else false.</returns>
|
||||
@ -707,9 +709,10 @@ bool RendererCL<T, bucketT>::ResetBuckets(bool resetHist, bool resetAccum)
|
||||
/// <summary>
|
||||
/// Perform log scale density filtering on the primary device.
|
||||
/// </summary>
|
||||
/// <param name="forceOutput">Whether this output was forced due to an interactive render</param>
|
||||
/// <returns>True if success and not aborted, else false.</returns>
|
||||
template <typename T, typename bucketT>
|
||||
eRenderStatus RendererCL<T, bucketT>::LogScaleDensityFilter()
|
||||
eRenderStatus RendererCL<T, bucketT>::LogScaleDensityFilter(bool forceOutput)
|
||||
{
|
||||
return RunLogScaleFilter();
|
||||
}
|
||||
@ -804,10 +807,10 @@ EmberStats RendererCL<T, bucketT>::Iterate(size_t iterCount, size_t temporalSamp
|
||||
{
|
||||
auto& wrapper = device->m_Wrapper;
|
||||
|
||||
if (b && !(b = wrapper.WriteBuffer (m_EmberBufferName, reinterpret_cast<void*>(&m_EmberCL), sizeof(m_EmberCL)))) { this->m_ErrorReport.push_back(loc); }
|
||||
if (b && !(b = wrapper.WriteBuffer (m_XformsBufferName, reinterpret_cast<void*>(m_XformsCL.data()), sizeof(m_XformsCL[0]) * m_XformsCL.size()))) { this->m_ErrorReport.push_back(loc); }
|
||||
if (b && !(b = wrapper.AddAndWriteBuffer(m_DistBufferName, reinterpret_cast<void*>(const_cast<byte*>(XformDistributions())), XformDistributionsSize()))) { this->m_ErrorReport.push_back(loc); }//Will be resized for xaos.
|
||||
if (b && !(b = wrapper.WriteBuffer (m_CarToRasBufferName, reinterpret_cast<void*>(&m_CarToRasCL), sizeof(m_CarToRasCL)))) { this->m_ErrorReport.push_back(loc); }
|
||||
if (b && !(b = wrapper.WriteBuffer (m_EmberBufferName, reinterpret_cast<void*>(&m_EmberCL), sizeof(m_EmberCL)))) { this->m_ErrorReport.push_back(loc); }
|
||||
if (b && !(b = wrapper.WriteBuffer (m_XformsBufferName, reinterpret_cast<void*>(m_XformsCL.data()), sizeof(m_XformsCL[0]) * m_XformsCL.size()))) { this->m_ErrorReport.push_back(loc); }
|
||||
if (b && !(b = wrapper.AddAndWriteBuffer(m_DistBufferName, reinterpret_cast<void*>(const_cast<byte*>(XformDistributions())), XformDistributionsSize()))) { this->m_ErrorReport.push_back(loc); }//Will be resized for xaos.
|
||||
if (b && !(b = wrapper.WriteBuffer (m_CarToRasBufferName, reinterpret_cast<void*>(&m_CarToRasCL), sizeof(m_CarToRasCL)))) { this->m_ErrorReport.push_back(loc); }
|
||||
|
||||
if (b && !(b = wrapper.AddAndWriteImage("Palette", CL_MEM_READ_ONLY, m_PaletteFormat, m_Dmap.m_Entries.size(), 1, 0, m_Dmap.m_Entries.data()))) { this->m_ErrorReport.push_back(loc); }
|
||||
|
||||
@ -966,7 +969,7 @@ bool RendererCL<T, bucketT>::RunIter(size_t iterCount, size_t temporalSample, si
|
||||
{
|
||||
cl_uint argIndex = 0;
|
||||
#ifdef TEST_CL
|
||||
fuse = 0;
|
||||
uint fuse = 0;
|
||||
#else
|
||||
uint fuse = uint((m_Devices[dev]->m_Calls % fuseFreq) == 0u ? FuseCount() : 0u);
|
||||
#endif
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
bool ClearAccum();
|
||||
bool WritePoints(size_t device, vector<PointCL<T>>& vec);
|
||||
#ifdef TEST_CL
|
||||
bool WriteRandomPoints();
|
||||
bool WriteRandomPoints(size_t device);
|
||||
#endif
|
||||
const string& IterKernel() const;
|
||||
const string& DEKernel() const;
|
||||
@ -159,7 +159,7 @@ protected:
|
||||
//Protected virtual functions overridden from Renderer.
|
||||
virtual bool Alloc(bool histOnly = false) override;
|
||||
virtual bool ResetBuckets(bool resetHist = true, bool resetAccum = true) override;
|
||||
virtual eRenderStatus LogScaleDensityFilter() override;
|
||||
virtual eRenderStatus LogScaleDensityFilter(bool forceOutput = false) override;
|
||||
virtual eRenderStatus GaussianDensityFilter() override;
|
||||
virtual eRenderStatus AccumulatorToFinalImage(byte* pixels, size_t finalOffset) override;
|
||||
virtual EmberStats Iterate(size_t iterCount, size_t temporalSample) override;
|
||||
|
@ -321,8 +321,8 @@ bool EmberGenome(EmberOptions& opt)
|
||||
embers[i].DeleteMotionElements();
|
||||
}
|
||||
|
||||
firstFrame = uint(opt.FirstFrame() == UINT_MAX ? embers[0].m_Time : opt.FirstFrame());
|
||||
lastFrame = uint(opt.LastFrame() == UINT_MAX ? embers.back().m_Time : opt.LastFrame());
|
||||
firstFrame = size_t(opt.FirstFrame() == UINT_MAX ? embers[0].m_Time : opt.FirstFrame());
|
||||
lastFrame = size_t(opt.LastFrame() == UINT_MAX ? embers.back().m_Time : opt.LastFrame());
|
||||
|
||||
if (lastFrame < firstFrame)
|
||||
lastFrame = firstFrame;
|
||||
@ -335,7 +335,7 @@ bool EmberGenome(EmberOptions& opt)
|
||||
|
||||
for (i = 0; i < embers.size(); i++)
|
||||
{
|
||||
if (ftime == uint(embers[i].m_Time))
|
||||
if (ftime == size_t(embers[i].m_Time))
|
||||
{
|
||||
interpolated = embers[i];
|
||||
exactTimeMatch = true;
|
||||
@ -349,7 +349,7 @@ bool EmberGenome(EmberOptions& opt)
|
||||
|
||||
for (i = 0; i < embers.size(); i++)
|
||||
{
|
||||
if (ftime == uint(embers[i].m_Time - 1))
|
||||
if (ftime == size_t(embers[i].m_Time - 1))
|
||||
{
|
||||
exactTimeMatch = true;
|
||||
break;
|
||||
@ -357,7 +357,7 @@ bool EmberGenome(EmberOptions& opt)
|
||||
}
|
||||
|
||||
if (!exactTimeMatch)
|
||||
interpolated.m_AffineInterp = INTERP_LINEAR;
|
||||
interpolated.m_AffineInterp = AFFINE_INTERP_LINEAR;
|
||||
}
|
||||
|
||||
if (pTemplate)
|
||||
@ -400,23 +400,12 @@ bool EmberGenome(EmberOptions& opt)
|
||||
|
||||
if (i < embers.size() - 1)
|
||||
{
|
||||
vector<Ember<T>> interpEmbers;
|
||||
|
||||
interpEmbers.push_back(embers[i]);
|
||||
interpEmbers.push_back(embers[i + 1]);
|
||||
|
||||
if (opt.Loops() > 0)
|
||||
{
|
||||
//We might have looped a non-integral number of times, so store the last result as our flame to interpolate from.
|
||||
interpEmbers[i] = result;
|
||||
}
|
||||
|
||||
for (frame = 0; frame < opt.Frames(); frame++)
|
||||
{
|
||||
seqFlag = (frame == 0 || frame == opt.Frames() - 1);
|
||||
blend = frame / T(opt.Frames());
|
||||
result.Clear();
|
||||
tools.SpinInter(&interpEmbers[i], pTemplate, result, frameCount++, seqFlag, blend);
|
||||
tools.SpinInter(&embers[i], pTemplate, result, frameCount++, seqFlag, blend);
|
||||
cout << emberToXml.ToString(result, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), false, opt.HexPalette());
|
||||
}
|
||||
}
|
||||
@ -500,7 +489,7 @@ bool EmberGenome(EmberOptions& opt)
|
||||
|
||||
oldX = embers[i].m_CenterX;
|
||||
oldY = embers[i].m_CenterY;
|
||||
embers[i].m_FinalRasH = uint(T(embers[i].m_FinalRasH) / T(opt.Frames()));
|
||||
embers[i].m_FinalRasH = size_t(T(embers[i].m_FinalRasH) / T(opt.Frames()));
|
||||
|
||||
embers[i].m_CenterY = embers[i].m_CenterY - ((opt.Frames() - 1) * embers[i].m_FinalRasH) /
|
||||
(2 * embers[i].m_PixelsPerUnit * pow(T(2.0), embers[i].m_Zoom));
|
||||
@ -596,7 +585,7 @@ bool EmberGenome(EmberOptions& opt)
|
||||
mutMeth = MUTATE_NOT_SPECIFIED;
|
||||
}
|
||||
|
||||
os << tools.Mutate(orig, mutMeth, vars, opt.Symmetry(), T(opt.Speed()));
|
||||
os << tools.Mutate(orig, mutMeth, vars, opt.Symmetry(), T(opt.Speed()), MAX_CL_VARS);
|
||||
|
||||
//Scan string returned for 'mutate color'.
|
||||
if (strstr(os.str().c_str(), "mutate color"))
|
||||
@ -647,7 +636,7 @@ bool EmberGenome(EmberOptions& opt)
|
||||
{
|
||||
os << "random";
|
||||
randomMode = true;
|
||||
tools.Random(orig, vars, opt.Symmetry(), 0);
|
||||
tools.Random(orig, vars, opt.Symmetry(), 0, MAX_CL_VARS);
|
||||
aselp0 = nullptr;
|
||||
aselp1 = nullptr;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ bool EmberRender(EmberOptions& opt)
|
||||
|
||||
//Final setup steps before running.
|
||||
os.imbue(std::locale(""));
|
||||
padding = uint(log10(double(embers.size()))) + 1;
|
||||
padding = uint(std::log10(double(embers.size()))) + 1;
|
||||
renderer->EarlyClip(opt.EarlyClip());
|
||||
renderer->YAxisUp(opt.YAxisUp());
|
||||
renderer->LockAccum(opt.LockAccum());
|
||||
@ -158,7 +158,7 @@ bool EmberRender(EmberOptions& opt)
|
||||
renderer->Transparency(opt.Transparency());
|
||||
renderer->NumChannels(channels);
|
||||
renderer->BytesPerChannel(opt.BitsPerChannel() / 8);
|
||||
renderer->Priority(eThreadPriority(Clamp<int>(int(opt.Priority()), int(eThreadPriority::LOWEST), int(eThreadPriority::HIGHEST))));
|
||||
renderer->Priority(eThreadPriority(Clamp<intmax_t>(intmax_t(opt.Priority()), intmax_t(eThreadPriority::LOWEST), intmax_t(eThreadPriority::HIGHEST))));
|
||||
renderer->Callback(opt.DoProgress() ? progress.get() : nullptr);
|
||||
|
||||
for (i = 0; i < embers.size(); i++)
|
||||
@ -176,8 +176,8 @@ bool EmberRender(EmberOptions& opt)
|
||||
|
||||
embers[i].m_TemporalSamples = 1;//Force temporal samples to 1 for render.
|
||||
embers[i].m_Quality *= T(opt.QualityScale());
|
||||
embers[i].m_FinalRasW = uint(T(embers[i].m_FinalRasW) * opt.SizeScale());
|
||||
embers[i].m_FinalRasH = uint(T(embers[i].m_FinalRasH) * opt.SizeScale());
|
||||
embers[i].m_FinalRasW = size_t(T(embers[i].m_FinalRasW) * opt.SizeScale());
|
||||
embers[i].m_FinalRasH = size_t(T(embers[i].m_FinalRasH) * opt.SizeScale());
|
||||
embers[i].m_PixelsPerUnit *= T(opt.SizeScale());
|
||||
|
||||
if (embers[i].m_FinalRasW == 0 || embers[i].m_FinalRasH == 0)
|
||||
@ -309,9 +309,11 @@ bool EmberRender(EmberOptions& opt)
|
||||
{
|
||||
if (auto rendererCL = dynamic_cast<RendererCL<T, float>*>(renderer.get()))
|
||||
{
|
||||
cout << "Iteration kernel: \n" <<
|
||||
cout << "Iteration kernel:\n" <<
|
||||
rendererCL->IterKernel() << "\n\n" <<
|
||||
"Density filter kernel:\n" <<
|
||||
rendererCL->DEKernel() << "\n\n" <<
|
||||
"Final accumulation kernel:\n" <<
|
||||
rendererCL->FinalAccumKernel() << endl;
|
||||
}
|
||||
}
|
||||
|
@ -136,6 +136,12 @@ void MakeTestAllVarsRegPrePost(vector<Ember<T>>& embers)
|
||||
|
||||
while (index < varList.RegSize())
|
||||
{
|
||||
/*if (index != VAR_SYNTH)
|
||||
{
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
Ember<T> ember1;
|
||||
unique_ptr<Variation<T>> regVar(varList.GetVariationCopy(index, VARTYPE_REG));
|
||||
unique_ptr<Variation<T>> preVar(varList.GetVariationCopy("pre_" + regVar->Name()));
|
||||
@ -422,7 +428,7 @@ bool TestVarUnique()
|
||||
|
||||
for (size_t i = 0; i < vl.Size(); i++)
|
||||
{
|
||||
Variation<T>* var = vl.GetVariation(i);
|
||||
auto var = vl.GetVariation(i);
|
||||
|
||||
if (std::find(ids.begin(), ids.end(), var->VariationId()) != ids.end())
|
||||
{
|
||||
@ -490,7 +496,7 @@ bool TestVarPrecalcEqual(const Variation<sT>* var1, const Variation<dT>* var2)
|
||||
}
|
||||
|
||||
template <typename sT, typename dT>
|
||||
bool TestVarEqual(Variation<sT>* var1, Variation<dT>* var2)
|
||||
bool TestVarEqual(const Variation<sT>* var1, const Variation<dT>* var2)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
@ -530,8 +536,8 @@ bool TestVarEqual(Variation<sT>* var1, Variation<dT>* var2)
|
||||
success = false;
|
||||
}
|
||||
|
||||
ParametricVariation<sT>* parVar1 = dynamic_cast<ParametricVariation<sT>*>(var1);
|
||||
ParametricVariation<dT>* parVar2 = dynamic_cast<ParametricVariation<dT>*>(var2);
|
||||
auto parVar1 = dynamic_cast<const ParametricVariation<sT>*>(var1);
|
||||
auto parVar2 = dynamic_cast<const ParametricVariation<dT>*>(var2);
|
||||
|
||||
if (parVar1 && parVar2)
|
||||
{
|
||||
@ -585,10 +591,13 @@ bool TestVarEqual(Variation<sT>* var1, Variation<dT>* var2)
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsClose<sT>(params1[i].ParamVal(), (sT)params2[i].ParamVal(), sT(1e-4)))
|
||||
if (!params1[i].IsState() && !params2[i].IsState())//Don't compare state params, they can be different if set to random vals.
|
||||
{
|
||||
cout << "Param " << params1[i].Name() << " Val were not equal: " << params1[i].ParamVal() << " != " << params2[i].ParamVal() << endl;
|
||||
success = false;
|
||||
if (!IsClose<sT>(params1[i].ParamVal(), (sT)params2[i].ParamVal(), sT(1e-4)))
|
||||
{
|
||||
cout << "Param " << params1[i].Name() << " Val were not equal: " << params1[i].ParamVal() << " != " << params2[i].ParamVal() << endl;
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -669,7 +678,7 @@ bool TestVarCopy()
|
||||
|
||||
for (size_t i = 0; i < vlf.Size(); i++)
|
||||
{
|
||||
Variation<sT>* var = vlf.GetVariation(i);
|
||||
auto var = vlf.GetVariation(i);
|
||||
Variation<dT>* destVar = NULL;
|
||||
unique_ptr<Variation<sT>> copyVar(var->Copy());//Test Copy().
|
||||
|
||||
@ -1126,6 +1135,36 @@ bool TestConstants()
|
||||
return success;
|
||||
}
|
||||
|
||||
bool TestGlobalFuncs()
|
||||
{
|
||||
bool success = true;
|
||||
VariationList<float> vlf;
|
||||
vector<string> funcs;
|
||||
FunctionMapper mapper;
|
||||
|
||||
for (size_t i = 0; i < vlf.Size(); i++)
|
||||
{
|
||||
auto var = vlf.GetVariation(i);
|
||||
|
||||
funcs = var->OpenCLGlobalFuncNames();
|
||||
|
||||
for (auto& func : funcs)
|
||||
{
|
||||
if (!mapper.GetGlobalFunc(func))
|
||||
{
|
||||
cout << "Variation " << var->Name() << " used unknown global funcion " << func << endl;
|
||||
success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//cout << "Variation " << var->Name() << " used valid global funcion " << func << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void PrintAllVars()
|
||||
{
|
||||
uint i = 0;
|
||||
@ -1506,17 +1545,20 @@ void TestVarsSimilar()
|
||||
#ifdef TEST_CL
|
||||
|
||||
template <typename T>
|
||||
void TestAllVarsCLBuild(bool printSuccess = true)
|
||||
bool TestAllVarsCLBuild(size_t platform, size_t device, bool printSuccess = true)
|
||||
{
|
||||
bool success = true;
|
||||
vector<Ember<T>> embers;
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> rand;
|
||||
RendererCL<T> renderer;
|
||||
vector<pair<size_t, size_t>> devices{ std::make_pair(platform, device) };
|
||||
RendererCL<T, float> renderer(devices);
|
||||
|
||||
const char* loc = __FUNCTION__;
|
||||
|
||||
if (!renderer.Init(1, 0, false, 0))
|
||||
if (!renderer.Ok())
|
||||
{
|
||||
cout << loc << "Creating RendererCL failed, tests will not be run." << endl;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
MakeTestAllVarsRegPrePost(embers);
|
||||
@ -1531,12 +1573,18 @@ void TestAllVarsCLBuild(bool printSuccess = true)
|
||||
cout << loc << ": Build succeeded for ember " << it.m_Name << endl;
|
||||
}
|
||||
else
|
||||
cout << loc << ": OpenCL program build failed:\n" << renderer.ErrorReport() << endl;
|
||||
{
|
||||
success = false;
|
||||
cout << loc << ": OpenCL program build failed for ember " << it.m_Name << ":\n" << renderer.ErrorReportString() << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void TestCpuGpuResults()
|
||||
void TestCpuGpuResults(size_t platform, size_t device)
|
||||
{
|
||||
bool breakOnBad = true;
|
||||
int i = 0;//(int)VAR_TARGET;//Start at the one you want to test.
|
||||
@ -1547,10 +1595,8 @@ void TestCpuGpuResults()
|
||||
VariationList<T> vlf;
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> rand;
|
||||
vector<PointCL<T>> points;
|
||||
RendererCL<T> renderer;
|
||||
|
||||
if (!renderer.Init(1, 0, false, 0))
|
||||
return;
|
||||
vector<pair<size_t, size_t>> devices{ std::make_pair(platform, device) };
|
||||
RendererCL<T, float> renderer(devices);
|
||||
|
||||
points.resize(renderer.TotalIterKernelCount());
|
||||
|
||||
@ -1637,7 +1683,7 @@ void TestCpuGpuResults()
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void TestGpuVectorRead()
|
||||
void TestGpuVectorRead(size_t platform, size_t device)
|
||||
{
|
||||
T minx = TMAX, miny = TMAX, minz = TMAX, mincolorx = TMAX;
|
||||
T maxx = TLOW, maxy = TLOW, maxz = TLOW, maxcolorx = TLOW;
|
||||
@ -1649,10 +1695,8 @@ void TestGpuVectorRead()
|
||||
VariationList<T> vlf;
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> rand;
|
||||
vector<PointCL<T>> points;
|
||||
RendererCL<T> renderer;
|
||||
|
||||
if (!renderer.Init(1, 0, false, 0))
|
||||
return;
|
||||
vector<pair<size_t, size_t>> devices{ std::make_pair(platform, device) };
|
||||
RendererCL<T, float> renderer(devices);
|
||||
|
||||
points.resize(renderer.TotalIterKernelCount());
|
||||
|
||||
@ -1918,17 +1962,110 @@ void TestThreadedKernel()
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void DistribTester()
|
||||
{
|
||||
size_t i;
|
||||
size_t distribCount = 1;
|
||||
size_t xformCount = 3;
|
||||
vector<byte> m_XformDistributions;
|
||||
//const Xform<T>* xforms = 3;
|
||||
size_t j = 0;
|
||||
vector<T> weights { T(0.333333), T(1.0), T(0.25) };
|
||||
double tempDensity = 0, currentDensityLimit = 0, densityPerElement;
|
||||
|
||||
if (m_XformDistributions.size() < CHOOSE_XFORM_GRAIN * distribCount)
|
||||
m_XformDistributions.resize(CHOOSE_XFORM_GRAIN * distribCount);
|
||||
|
||||
if (m_XformDistributions.size() < CHOOSE_XFORM_GRAIN * distribCount)
|
||||
return;
|
||||
|
||||
for (size_t distrib = 0; distrib < distribCount; distrib++)
|
||||
{
|
||||
double totalDensity = 0;
|
||||
|
||||
//First find the total densities of all xforms.
|
||||
for (i = 0; i < xformCount; i++)
|
||||
{
|
||||
T d = weights[i];
|
||||
|
||||
totalDensity += d;
|
||||
}
|
||||
|
||||
//Original returned false if all were 0, but it's allowed here
|
||||
//which will just end up setting all elements to 0 which means
|
||||
//only the first xform will get used.
|
||||
|
||||
//Calculate how much of a fraction of a the total density each element represents.
|
||||
j = 0;
|
||||
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 < xformCount; i++)
|
||||
{
|
||||
T temp = weights[i];
|
||||
currentDensityLimit += temp;
|
||||
|
||||
//Populate points corresponding to this xform's weight/density.
|
||||
//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) >= 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;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Flam3 did this, which gives the same result.
|
||||
//T t = xforms[0].m_Weight;
|
||||
//
|
||||
//if (distrib > 0)
|
||||
// t *= xforms[distrib - 1].Xaos(0);
|
||||
//
|
||||
//T r = 0;
|
||||
//
|
||||
//for (i = 0; i < CHOOSE_XFORM_GRAIN; i++)
|
||||
//{
|
||||
// while (r >= t)
|
||||
// {
|
||||
// j++;
|
||||
//
|
||||
// if (distrib > 0)
|
||||
// t += xforms[j].m_Weight * xforms[distrib - 1].Xaos(j);
|
||||
// else
|
||||
// t += xforms[j].m_Weight;
|
||||
// }
|
||||
//
|
||||
// m_XformDistributions[(distrib * CHOOSE_XFORM_GRAIN) + i] = j;
|
||||
// r += densityPerElement;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
//int i;
|
||||
bool b = true;
|
||||
Timing t(4);
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> rand(1, 2, 3);
|
||||
mt19937 meow(1729);
|
||||
MakeTestAllVarsRegPrePostComboFile("testallvarsout.flame");
|
||||
|
||||
/*MakeTestAllVarsRegPrePostComboFile("testallvarsout.flame");
|
||||
return 0;
|
||||
|
||||
|
||||
/*TestThreadedKernel();
|
||||
TestThreadedKernel();
|
||||
|
||||
PaletteList<float> palf;
|
||||
Palette<float>* pal = palf.GetRandomPalette();
|
||||
@ -1939,7 +2076,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
cout << "log10(" << d << ") = " << std::max<uint>(1u, uint(log10(d)) + 1u) << endl;
|
||||
cout << "log10(" << d << ") = " << std::max<uint>(1u, uint(std::log10(d)) + 1u) << endl;
|
||||
d *= 10;
|
||||
}
|
||||
|
||||
@ -2041,7 +2178,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
//cd2 = sin(cd);
|
||||
|
||||
/*t.Tic();
|
||||
t.Tic();
|
||||
TestCasting();
|
||||
t.Toc("TestCasting()");
|
||||
|
||||
@ -2088,6 +2225,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
TestVarCopy<double, float>();
|
||||
t.Toc("TestVarCopy<double, float>()");
|
||||
#endif
|
||||
|
||||
t.Tic();
|
||||
TestVarRegPrePost();
|
||||
t.Toc("TestVarRegPrePost()");
|
||||
@ -2121,17 +2259,22 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
t.Toc("TestConstants()");
|
||||
|
||||
t.Tic();
|
||||
TestGlobalFuncs();
|
||||
t.Toc("TestGlobalFuncs()");
|
||||
|
||||
/*t.Tic();
|
||||
TestXformsInOutPoints();
|
||||
t.Toc("TestXformsInOutPoints()");
|
||||
|
||||
t.Tic();
|
||||
TestVarTime<float>();
|
||||
t.Toc("TestVarTime()");
|
||||
|
||||
*/
|
||||
|
||||
t.Tic();
|
||||
TestOperations<float>();
|
||||
t.Toc("TestOperations()");
|
||||
*/
|
||||
|
||||
//t.Tic();
|
||||
//TestVarsSimilar<float>();
|
||||
//t.Toc("TestVarsSimilar()");
|
||||
@ -2141,18 +2284,34 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
//TestCpuGpuResults<float>();
|
||||
//t.Toc("TestCpuGpuResults<float>()");
|
||||
|
||||
t.Tic();
|
||||
TestAllVarsCLBuild<float>();
|
||||
t.Toc("TestAllVarsCLBuild<float>()");
|
||||
//t.Tic();
|
||||
//b = TestAllVarsCLBuild<float>(0, 0, true);
|
||||
//t.Toc("TestAllVarsCLBuild<float>()");
|
||||
|
||||
if (b)
|
||||
{
|
||||
t.Tic();
|
||||
b = TestAllVarsCLBuild<float>(1, 0, true);
|
||||
t.Toc("TestAllVarsCLBuild<float>()");
|
||||
}
|
||||
|
||||
#ifdef DO_DOUBLE
|
||||
//t.Tic();
|
||||
//TestCpuGpuResults<double>();
|
||||
//t.Toc("TestCpuGpuResults<double>()");
|
||||
if (b)
|
||||
{
|
||||
t.Tic();
|
||||
TestAllVarsCLBuild<double>(0, 0, true);
|
||||
t.Toc("TestAllVarsCLBuild<double>()");
|
||||
|
||||
t.Tic();
|
||||
TestAllVarsCLBuild<double>();
|
||||
t.Toc("TestAllVarsCLBuild<double>()");
|
||||
if (b)
|
||||
{
|
||||
t.Tic();
|
||||
TestAllVarsCLBuild<double>(1, 0, true);
|
||||
t.Toc("TestAllVarsCLBuild<double>()");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
{
|
||||
if (i != j && m_Embers[i].m_Name == m_Embers[j].m_Name)
|
||||
{
|
||||
m_Embers[j].m_Name = m_Embers[j].m_Name + "_" + ToString(++x).toStdString();
|
||||
m_Embers[j].m_Name = IncrementTrailingUnderscoreInt(QString::fromStdString(m_Embers[j].m_Name)).toStdString();
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
@ -130,6 +130,33 @@ public:
|
||||
return "Flame_" + QDateTime(QDateTime::currentDateTime()).toString("yyyy-MM-dd-hhmmss");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a copy of the string which ends with _# where # is the
|
||||
/// previous number at that position incremented by one.
|
||||
/// If the original string did not end with _#, the returned
|
||||
/// string will just have _1 appended to it.
|
||||
/// </summary>
|
||||
/// <param name="str">The string to process</param>
|
||||
/// <returns>The original string with the number after the final _ character incremented by one</returns>
|
||||
static QString IncrementTrailingUnderscoreInt(const QString& str)
|
||||
{
|
||||
bool ok = false;
|
||||
size_t num = 0;
|
||||
QString endSection;
|
||||
QString ret = str;
|
||||
int lastUnderscore = str.lastIndexOf('_');
|
||||
|
||||
if (lastUnderscore != -1)
|
||||
{
|
||||
endSection = str.section('_', -1);
|
||||
num = endSection.toULongLong(&ok);
|
||||
ret.chop(str.size() - lastUnderscore);
|
||||
}
|
||||
|
||||
ret += "_" + QString::number(num + 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures a given input filename is unique by appending a count to the end.
|
||||
/// </summary>
|
||||
@ -146,10 +173,11 @@ public:
|
||||
QString path = original.absolutePath() + '/';
|
||||
QString base = original.completeBaseName();
|
||||
QString extension = original.suffix();
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
newPath = path + base + "_" + ToString(counter++) + "." + extension;
|
||||
base = IncrementTrailingUnderscoreInt(base);
|
||||
newPath = path + base + "." + extension;
|
||||
}
|
||||
while (QFile::exists(newPath));
|
||||
|
||||
@ -164,7 +192,7 @@ public:
|
||||
/// <returns>The default ember name</returns>
|
||||
static QString DefaultEmberName(uint i)
|
||||
{
|
||||
return DefaultFilename() + "-" + ToString(i);
|
||||
return DefaultFilename() + "_" + ToString(i);
|
||||
}
|
||||
|
||||
QString m_Filename;
|
||||
|
@ -331,6 +331,8 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
|
||||
}
|
||||
else if (QKeyEvent* ke = dynamic_cast<QKeyEvent*>(e))
|
||||
{
|
||||
bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
|
||||
|
||||
if (ke->key() >= Qt::Key_F1 && ke->key() <= Qt::Key_F32)
|
||||
{
|
||||
int val = ke->key() - (int)Qt::Key_F1;
|
||||
@ -340,7 +342,8 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
|
||||
}
|
||||
else if (o == ui.LibraryTree)
|
||||
{
|
||||
if (ke->key() == Qt::Key_Delete && e->type() == QEvent::KeyRelease)
|
||||
//Require shift for deleting to prevent it from triggering when the user enters delete in the edit box.
|
||||
if (ke->key() == Qt::Key_Delete && e->type() == QEvent::KeyRelease && shift)
|
||||
{
|
||||
auto p = GetCurrentEmberIndex();
|
||||
|
||||
|
@ -5046,6 +5046,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::WheelFocus</enum>
|
||||
</property>
|
||||
@ -5065,10 +5068,10 @@
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectItems</enum>
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>12</number>
|
||||
|
@ -213,6 +213,12 @@ void FractoriumEmberController<T>::EmberTreeItemChanged(QTreeWidgetItem* item, i
|
||||
|
||||
if (emberItem)
|
||||
{
|
||||
if (emberItem->text(0).isEmpty())//Prevent empty string.
|
||||
{
|
||||
emberItem->UpdateEditText();
|
||||
return;
|
||||
}
|
||||
|
||||
string oldName = emberItem->GetEmber()->m_Name;//First preserve the previous name.
|
||||
|
||||
tree->blockSignals(true);
|
||||
|
@ -65,10 +65,10 @@ void FractoriumEmberController<T>::NewFlock(size_t count)
|
||||
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
m_SheepTools->Random(ember, m_FilteredVariations, static_cast<intmax_t>(QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Frand<T>(-2, 2)), 0);
|
||||
m_SheepTools->Random(ember, m_FilteredVariations, static_cast<intmax_t>(QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Frand<T>(-2, 2)), 0, MAX_CL_VARS);
|
||||
ParamsToEmber(ember);
|
||||
ember.m_Index = i;
|
||||
ember.m_Name = m_EmberFile.m_Filename.toStdString() + "-" + ToString(i + 1ULL).toStdString();
|
||||
ember.m_Name = m_EmberFile.m_Filename.toStdString() + "_" + ToString(i + 1ULL).toStdString();
|
||||
m_EmberFile.m_Embers.push_back(ember);
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ void FractoriumEmberController<T>::NewRandomFlameInCurrentFile()
|
||||
Ember<T> ember;
|
||||
|
||||
StopPreviewRender();
|
||||
m_SheepTools->Random(ember, m_FilteredVariations, static_cast<int>(QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Frand<T>(-2, 2)), 0);
|
||||
m_SheepTools->Random(ember, m_FilteredVariations, static_cast<int>(QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Frand<T>(-2, 2)), 0, MAX_CL_VARS);
|
||||
ParamsToEmber(ember);
|
||||
ember.m_Name = EmberFile<T>::DefaultEmberName(m_EmberFile.Size() + 1).toStdString();
|
||||
ember.m_Index = m_EmberFile.Size();
|
||||
|
@ -79,7 +79,7 @@ void Fractorium::InitParamsUI()
|
||||
SetupCombo(table, this, row, 1, m_TemporalFilterTypeCombo, comboVals, SIGNAL(currentIndexChanged(const QString&)), SLOT(OnTemporalFilterTypeComboCurrentIndexChanged(const QString&)));
|
||||
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_DEFilterMinRadiusSpin, spinHeight, 0, 25, 1, SIGNAL(valueChanged(double)), SLOT(OnDEFilterMinRadiusWidthChanged(double)), true, 0, 0, 0);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_DEFilterMaxRadiusSpin, spinHeight, 0, 25, 1, SIGNAL(valueChanged(double)), SLOT(OnDEFilterMaxRadiusWidthChanged(double)), true, 9.0, 9.0, 0);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_DEFilterMaxRadiusSpin, spinHeight, 0, 25, 1, SIGNAL(valueChanged(double)), SLOT(OnDEFilterMaxRadiusWidthChanged(double)), true, 0.0, 9.0, 0);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_DECurveSpin, spinHeight, 0.15, 5, 0.1, SIGNAL(valueChanged(double)), SLOT(OnDEFilterCurveWidthChanged(double)), true, 0.4, 0.4, 0.4);
|
||||
|
||||
//Iteration.
|
||||
@ -89,7 +89,7 @@ void Fractorium::InitParamsUI()
|
||||
SetupSpinner<SpinBox, int>( table, this, row, 1, m_FuseSpin, spinHeight, 1, 1000, 5, SIGNAL(valueChanged(int)), SLOT(OnFuseChanged(int)), true, 15, 15, 15);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_QualitySpin, spinHeight, 1, dmax, 50, SIGNAL(valueChanged(double)), SLOT(OnQualityChanged(double)), true, 10, 10, 10);
|
||||
SetupSpinner<SpinBox, int>( table, this, row, 1, m_SupersampleSpin, spinHeight, 1, 4, 1, SIGNAL(valueChanged(int)), SLOT(OnSupersampleChanged(int)), true, 1, 1, 1);
|
||||
SetupSpinner<SpinBox, int>( table, this, row, 1, m_TemporalSamplesSpin, spinHeight, 1, 5000, 50, SIGNAL(valueChanged(int)), SLOT(OnTemporalSamplesChanged(int)), true, 1000);
|
||||
SetupSpinner<SpinBox, int>( table, this, row, 1, m_TemporalSamplesSpin, spinHeight, 1, 5000, 1, SIGNAL(valueChanged(int)), SLOT(OnTemporalSamplesChanged(int)), true, 1000);
|
||||
|
||||
comboVals.clear();
|
||||
comboVals.push_back("Step");
|
||||
@ -412,8 +412,8 @@ void Fractorium::OnFuseChanged(int d) { m_Controller->FuseChanged(d); }
|
||||
/// the rendering process is continued, else it's reset.
|
||||
/// </summary>
|
||||
/// <param name="d">The quality in terms of iterations per pixel</param>
|
||||
template <typename T> void FractoriumEmberController<T>::QualityChanged(double d) { Update([&] { m_Ember.m_Quality = d; }, true, d > m_Ember.m_Quality ? KEEP_ITERATING : FULL_RENDER); }
|
||||
void Fractorium::OnQualityChanged(double d) { m_Controller->QualityChanged(d); }
|
||||
template <typename T> void FractoriumEmberController<T>::QualityChanged(double d) { /*Update([&] { m_Ember.m_Quality = d; }, true, d > m_Ember.m_Quality ? KEEP_ITERATING : FULL_RENDER);*/ }
|
||||
void Fractorium::OnQualityChanged(double d) { /*m_Controller->QualityChanged(d);*/ }
|
||||
|
||||
/// <summary>
|
||||
/// Set the supersample.
|
||||
@ -452,11 +452,11 @@ void FractoriumEmberController<T>::AffineInterpTypeChanged(int i)
|
||||
Update([&]
|
||||
{
|
||||
if (i == 0)
|
||||
m_Ember.m_AffineInterp = INTERP_LINEAR;
|
||||
m_Ember.m_AffineInterp = AFFINE_INTERP_LINEAR;
|
||||
else if (i == 1)
|
||||
m_Ember.m_AffineInterp = INTERP_LOG;
|
||||
m_Ember.m_AffineInterp = AFFINE_INTERP_LOG;
|
||||
else
|
||||
m_Ember.m_AffineInterp = INTERP_LINEAR;
|
||||
m_Ember.m_AffineInterp = AFFINE_INTERP_LINEAR;
|
||||
}, true, NOTHING);
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,33 @@ bool FractoriumEmberController<T>::Render()
|
||||
bool success = true;
|
||||
GLWidget* gl = m_Fractorium->ui.GLDisplay;
|
||||
RendererCL<T, float>* rendererCL = nullptr;
|
||||
eProcessAction action = CondenseAndClearProcessActions();
|
||||
eProcessAction qualityAction, action;
|
||||
|
||||
//Quality is the only parameter we update inside the timer.
|
||||
//This is to allow the user to rapidly increase the quality spinner
|
||||
//without fully resetting the render. Instead, it will just keep iterating
|
||||
//where it last left off in response to an increase.
|
||||
T d = T(m_Fractorium->m_QualitySpin->value());
|
||||
|
||||
if (d < m_Ember.m_Quality)//Full restart if quality decreased.
|
||||
{
|
||||
m_Ember.m_Quality = d;
|
||||
qualityAction = eProcessAction::FULL_RENDER;
|
||||
}
|
||||
else if (d > m_Ember.m_Quality && ProcessState() == ACCUM_DONE)//If quality increased, keep iterating after current render finishes.
|
||||
{
|
||||
m_Ember.m_Quality = d;
|
||||
qualityAction = eProcessAction::KEEP_ITERATING;
|
||||
}
|
||||
else if (IsClose(d, m_Ember.m_Quality))
|
||||
qualityAction = eProcessAction::NOTHING;
|
||||
|
||||
if (qualityAction == eProcessAction::FULL_RENDER)
|
||||
Update([&] {});//Stop the current render, a full restart is needed.
|
||||
else if (qualityAction == eProcessAction::KEEP_ITERATING)
|
||||
m_ProcessActions.push_back(qualityAction);//Special, direct call to avoid resetting the render inside Update() because only KEEP_ITERATING is needed.
|
||||
|
||||
action = CondenseAndClearProcessActions();//Combine with all other previously requested actions.
|
||||
|
||||
if (m_Renderer->RendererType() == OPENCL_RENDERER)
|
||||
rendererCL = dynamic_cast<RendererCL<T, float>*>(m_Renderer.get());
|
||||
@ -391,7 +417,7 @@ bool FractoriumEmberController<T>::Render()
|
||||
//Only certain stats can be reported with OpenCL.
|
||||
if (m_Renderer->RendererType() == OPENCL_RENDERER)
|
||||
{
|
||||
m_Fractorium->m_RenderStatusLabel->setText("Iters: " + iters + ". Scaled quality: " + scaledQuality + ". Total time: " + QString::fromStdString(renderTime));
|
||||
m_Fractorium->m_RenderStatusLabel->setText("Iters: " + iters + ". Scaled quality: " + scaledQuality + ". Total time: " + QString::fromStdString(renderTime) + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -399,7 +425,7 @@ bool FractoriumEmberController<T>::Render()
|
||||
QString badVals = ToString<qulonglong>(stats.m_Badvals);
|
||||
QString badPercent = QLocale::system().toString(percent * 100, 'f', 2);
|
||||
|
||||
m_Fractorium->m_RenderStatusLabel->setText("Iters: " + iters + ". Scaled quality: " + scaledQuality + ". Bad values: " + badVals + " (" + badPercent + "%). Total time: " + QString::fromStdString(renderTime));
|
||||
m_Fractorium->m_RenderStatusLabel->setText("Iters: " + iters + ". Scaled quality: " + scaledQuality + ". Bad values: " + badVals + " (" + badPercent + "%). Total time: " + QString::fromStdString(renderTime) + ".");
|
||||
}
|
||||
|
||||
if (m_LastEditWasUndoRedo && (m_UndoIndex == m_UndoList.size() - 1))//Traversing through undo list, reached the end, so put back in regular edit mode.
|
||||
|
@ -18,8 +18,8 @@ FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, Q
|
||||
m_Settings = settings;
|
||||
QTableWidget* table = ui.OptionsXmlSavingTable;
|
||||
ui.ThreadCountSpin->setRange(1, Timing::ProcessorCount());
|
||||
connect(ui.OpenCLCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnOpenCLCheckBoxStateChanged(int)), Qt::QueuedConnection);
|
||||
connect(ui.DeviceTable, SIGNAL(cellChanged(int, int)), this, SLOT(OnDeviceTableCellChanged(int, int)), Qt::QueuedConnection);
|
||||
connect(ui.OpenCLCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnOpenCLCheckBoxStateChanged(int)), Qt::QueuedConnection);
|
||||
connect(ui.DeviceTable, SIGNAL(cellChanged(int, int)), this, SLOT(OnDeviceTableCellChanged(int, int)), Qt::QueuedConnection);
|
||||
|
||||
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlTemporalSamplesSpin, spinHeight, 1, 1000, 100, "", "", true, 1000);
|
||||
SetupSpinner<SpinBox, int>(table, this, row, 1, m_XmlQualitySpin, spinHeight, 1, 200000, 50, "", "", true, 1000);
|
||||
|
@ -70,7 +70,6 @@ QssDialog::QssDialog(Fractorium* parent) :
|
||||
|
||||
connect(ui->QssLoadButton, SIGNAL(clicked()), this, SLOT(LoadButton_clicked()), Qt::QueuedConnection);
|
||||
connect(ui->QssSaveButton, SIGNAL(clicked()), this, SLOT(SaveButton_clicked()), Qt::QueuedConnection);
|
||||
connect(ui->QssSaveDefaultButton, SIGNAL(clicked()), this, SLOT(SaveDefaultButton_clicked()), Qt::QueuedConnection);
|
||||
connect(ui->QssBasicButton, SIGNAL(clicked()), this, SLOT(BasicButton_clicked()), Qt::QueuedConnection);
|
||||
connect(ui->QssMediumButton, SIGNAL(clicked()), this, SLOT(MediumButton_clicked()), Qt::QueuedConnection);
|
||||
connect(ui->QssAdvancedButton, SIGNAL(clicked()), this, SLOT(AdvancedButton_clicked()), Qt::QueuedConnection);
|
||||
@ -310,7 +309,7 @@ void QssDialog::accept()
|
||||
if (m_Theme)
|
||||
m_Parent->m_Settings->Theme(m_Theme->objectName());
|
||||
|
||||
SaveDefaultButton_clicked();
|
||||
SaveAsDefault();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
@ -506,11 +505,20 @@ void QssDialog::LoadButton_clicked()
|
||||
/// <summary>
|
||||
/// Save the stylesheet to disk.
|
||||
/// Called when the user clicks the save button.
|
||||
/// The user cannot save to default.qss, as it's a special placeholder.
|
||||
/// When they exit the dialog by clicking OK, the currently displayed stylesheet
|
||||
/// will be saved to default.qss.
|
||||
/// </summary>
|
||||
void QssDialog::SaveButton_clicked()
|
||||
{
|
||||
auto path = SaveFile();
|
||||
|
||||
if (path.toLower().endsWith("default.qss"))
|
||||
{
|
||||
QMessageBox::critical(this, "File save error", "Stylesheet cannot be saved to default.qss. Save it to a different file name, then exit the dialog by clicking OK which will set it as the default.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!path.isEmpty())
|
||||
{
|
||||
ofstream of(path.toStdString());
|
||||
@ -522,16 +530,16 @@ void QssDialog::SaveButton_clicked()
|
||||
of.close();
|
||||
}
|
||||
else
|
||||
QMessageBox::critical(this, "File open error", "Failed to open " + path + ", style will not be set as default");
|
||||
QMessageBox::critical(this, "File save error", "Failed to save " + path + ", style will not be set as default");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save the stylesheet to the default.qss on disk.
|
||||
/// This will be loaded the next time Fractorium runs.
|
||||
/// Called when the user clicks the save as default button.
|
||||
/// Called when the user clicks ok.
|
||||
/// </summary>
|
||||
void QssDialog::SaveDefaultButton_clicked()
|
||||
void QssDialog::SaveAsDefault()
|
||||
{
|
||||
auto path = m_Parent->m_SettingsPath + "/default.qss";
|
||||
ofstream of(path.toStdString());
|
||||
@ -543,7 +551,7 @@ void QssDialog::SaveDefaultButton_clicked()
|
||||
of.close();
|
||||
}
|
||||
else
|
||||
QMessageBox::critical(this, "File open error", "Failed to open " + path + ", style will not be set as default");
|
||||
QMessageBox::critical(this, "File save error", "Failed to save " + path + ", style will not be set as default");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -107,12 +107,12 @@ private slots:
|
||||
|
||||
void LoadButton_clicked();
|
||||
void SaveButton_clicked();
|
||||
void SaveDefaultButton_clicked();
|
||||
void BasicButton_clicked();
|
||||
void MediumButton_clicked();
|
||||
void AdvancedButton_clicked();
|
||||
|
||||
private:
|
||||
void SaveAsDefault();
|
||||
void InsertCssProperty(const QString &name, const QString &value);
|
||||
void SetupFileDialog();
|
||||
QString OpenFile();
|
||||
|
@ -47,13 +47,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="QssSaveDefaultButton">
|
||||
<property name="text">
|
||||
<string>Save as default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="QssBasicButton">
|
||||
<property name="text">
|
||||
|
@ -39,7 +39,6 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "FractoriumPch.h"
|
||||
#include "qcssparser.h"
|
||||
#include "qcssscanner.h"
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user