2014-07-08 03:11:14 -04:00
# pragma once
# include "Variation.h"
namespace EmberNs
{
/// <summary>
/// Hemisphere.
/// </summary>
template < typename T >
class EMBER_API HemisphereVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
HemisphereVariation ( T weight = 1.0 ) : Variation < T > ( " hemisphere " , eVariationId : : VAR_HEMISPHERE , weight , true ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( HemisphereVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
2015-04-13 07:32:58 -04:00
T t = m_Weight / std : : sqrt ( helper . m_PrecalcSumSquares + 1 ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = helper . In . x * t ;
helper . Out . y = helper . In . y * t ;
helper . Out . z = t ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t t = xform->m_VariationWeights[ " < < varIndex < < " ] / sqrt(precalcSumSquares + (real_t)(1.0)); \n "
2014-07-08 03:11:14 -04:00
< < " \n "
< < " \t \t vOut.x = vIn.x * t; \n "
< < " \t \t vOut.y = vIn.y * t; \n "
< < " \t \t vOut.z = t; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
} ;
/// <summary>
/// Epispiral.
/// </summary>
template < typename T >
class EMBER_API EpispiralVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
EpispiralVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " epispiral " , eVariationId : : VAR_EPISPIRAL , weight , false , false , false , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( EpispiralVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T theta = helper . m_PrecalcAtanyx ;
--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.
2015-11-22 17:15:07 -05:00
T t = ( rand . Frand01 < T > ( ) * m_Thickness ) * ( 1 / std : : cos ( m_N * theta ) ) - m_Holes ;
2014-07-08 03:11:14 -04:00
2016-01-12 23:42:12 -05:00
if ( std : : abs ( t ) ! = 0 )
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
helper . Out . x = m_Weight * t * std : : cos ( theta ) ;
helper . Out . y = m_Weight * t * std : : sin ( theta ) ;
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
helper . Out . z = 0 ;
}
else
{
helper . Out . x = 0 ;
helper . Out . y = 0 ;
helper . Out . z = 0 ;
2014-07-08 03:11:14 -04:00
}
}
2014-09-01 00:25:15 -04:00
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string n = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string thickness = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string holes = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t theta = precalcAtanyx; \n "
< < " \t \t real_t t = (MwcNext01(mwc) * " < < thickness < < " ) * (1 / cos( " < < n < < " * theta)) - " < < holes < < " ; \n "
< < " \n "
< < " \t \t if (fabs(t) != 0) \n "
< < " \t \t { \n "
< < " \t \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * t * cos(theta); \n "
< < " \t \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * t * sin(theta); \n "
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
< < " \t \t \t vOut.z = 0; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t \t vOut.x = 0; \n "
< < " \t \t \t vOut.y = 0; \n "
< < " \t \t \t vOut.z = 0; \n "
2014-07-08 03:11:14 -04:00
< < " \t \t } \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_N , prefix + " epispiral_n " , 6 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Thickness , prefix + " epispiral_thickness " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Holes , prefix + " epispiral_holes " , 1 ) ) ;
}
private :
T m_N ;
T m_Thickness ;
T m_Holes ;
} ;
/// <summary>
/// Bwraps.
/// Note, this is the same as bwraps2.
/// </summary>
template < typename T >
class EMBER_API BwrapsVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
BwrapsVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " bwraps " , eVariationId : : VAR_BWRAPS , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( BwrapsVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
if ( m_BwrapsCellsize = = 0 )
{
helper . Out . x = m_Weight * helper . In . x ;
helper . Out . y = m_Weight * helper . In . y ;
}
else
{
T vx = helper . In . x ;
T vy = helper . In . y ;
T cx = ( Floor < T > ( vx / m_BwrapsCellsize ) + T ( 0.5 ) ) * m_BwrapsCellsize ;
T cy = ( Floor < T > ( vy / m_BwrapsCellsize ) + T ( 0.5 ) ) * m_BwrapsCellsize ;
T lx = vx - cx ;
T ly = vy - cy ;
if ( ( SQR ( lx ) + SQR ( ly ) ) > m_R2 )
{
helper . Out . x = m_Weight * helper . In . x ;
helper . Out . y = m_Weight * helper . In . y ;
}
else
{
lx * = m_G2 ;
ly * = m_G2 ;
T r = m_Rfactor / ( ( SQR ( lx ) + SQR ( ly ) ) / 4 + 1 ) ;
lx * = r ;
ly * = r ;
r = ( SQR ( lx ) + SQR ( ly ) ) / m_R2 ;
T theta = m_BwrapsInnerTwist * ( 1 - r ) + m_BwrapsOuterTwist * r ;
--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.
2015-11-22 17:15:07 -05:00
T s = std : : sin ( theta ) ;
T c = std : : cos ( theta ) ;
2014-07-08 03:11:14 -04:00
vx = cx + c * lx + s * ly ;
vy = cy - s * lx + c * ly ;
helper . Out . x = m_Weight * vx ;
helper . Out . y = m_Weight * vy ;
}
}
helper . Out . z = m_Weight * helper . In . z ;
}
2014-09-01 00:25:15 -04:00
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string bwrapsCellsize = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string bwrapsSpace = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string bwrapsGain = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string bwrapsInnerTwist = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string bwrapsOuterTwist = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string g2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string r2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string rfactor = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t if ( " < < bwrapsCellsize < < " == 0) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.x; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.y; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t real_t vx = vIn.x; \n "
< < " \t \t real_t vy = vIn.y; \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t cx = (floor(vx / " < < bwrapsCellsize < < " ) + (real_t)(0.5)) * " < < bwrapsCellsize < < " ; \n "
< < " \t \t real_t cy = (floor(vy / " < < bwrapsCellsize < < " ) + (real_t)(0.5)) * " < < bwrapsCellsize < < " ; \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t lx = vx - cx; \n "
< < " \t \t real_t ly = vy - cy; \n "
< < " \n "
< < " \t \t if ((SQR(lx) + SQR(ly)) > " < < r2 < < " ) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.x; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.y; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t lx *= " < < g2 < < " ; \n "
< < " \t \t ly *= " < < g2 < < " ; \n "
< < " \n "
< < " \t \t real_t r = " < < rfactor < < " / ((SQR(lx) + SQR(ly)) / 4 + 1); \n "
< < " \n "
< < " \t \t lx *= r; \n "
< < " \t \t ly *= r; \n "
< < " \t \t r = (SQR(lx) + SQR(ly)) / " < < r2 < < " ; \n "
< < " \n "
< < " \t \t real_t theta = " < < bwrapsInnerTwist < < " * (1 - r) + " < < bwrapsOuterTwist < < " * r; \n "
< < " \t \t real_t s = sin(theta); \n "
< < " \t \t real_t c = cos(theta); \n "
< < " \n "
< < " \t \t vx = cx + c * lx + s * ly; \n "
< < " \t \t vy = cy - s * lx + c * ly; \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * vx; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * vy; \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
T radius = T ( 0.5 ) * ( m_BwrapsCellsize / ( 1 + SQR ( m_BwrapsSpace ) ) ) ;
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
m_G2 = Zeps ( SQR ( m_BwrapsGain ) / Zeps ( radius ) ) ;
2014-07-08 03:11:14 -04:00
T maxBubble = m_G2 * radius ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( maxBubble > 2 )
maxBubble = 1 ;
else
maxBubble * = ( 1 / ( SQR ( maxBubble ) / 4 + 1 ) ) ;
m_R2 = SQR ( radius ) ;
m_Rfactor = radius / maxBubble ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BwrapsCellsize , prefix + " bwraps_cellsize " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BwrapsSpace , prefix + " bwraps_space " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BwrapsGain , prefix + " bwraps_gain " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BwrapsInnerTwist , prefix + " bwraps_inner_twist " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BwrapsOuterTwist , prefix + " bwraps_outer_twist " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_G2 , prefix + " bwraps_g2 " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_R2 , prefix + " bwraps_r2 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Rfactor , prefix + " bwraps_rfactor " ) ) ;
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
private :
T m_BwrapsCellsize ;
T m_BwrapsSpace ;
T m_BwrapsGain ;
T m_BwrapsInnerTwist ;
T m_BwrapsOuterTwist ;
T m_G2 ; //Precalc.
T m_R2 ;
T m_Rfactor ;
} ;
/// <summary>
/// BlurCircle.
/// </summary>
template < typename T >
class EMBER_API BlurCircleVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
BlurCircleVariation ( T weight = 1.0 ) : Variation < T > ( " blur_circle " , eVariationId : : VAR_BLUR_CIRCLE , weight ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( BlurCircleVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T x = 2 * rand . Frand01 < T > ( ) - 1 ;
T y = 2 * rand . Frand01 < T > ( ) - 1 ;
T absx = x ;
T absy = y ;
T side , perimeter ;
if ( absx < 0 )
absx = absx * - 1 ;
if ( absy < 0 )
absy = absy * - 1 ;
if ( absx > = absy )
{
if ( x > = absy )
perimeter = absx + y ;
else
perimeter = 5 * absx - y ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
side = absx ;
}
else
{
if ( y > = absx )
perimeter = 3 * absy - x ;
else
perimeter = 7 * absy + x ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
side = absy ;
}
T r = m_Weight * side ;
T val = T ( M_PI_4 ) * perimeter / side - T ( M_PI_4 ) ;
--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.
2015-11-22 17:15:07 -05:00
T sina = std : : sin ( val ) ;
T cosa = std : : cos ( val ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = r * cosa ;
helper . Out . y = r * sina ;
helper . Out . z = m_Weight * helper . In . z ;
}
2014-09-01 00:25:15 -04:00
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
ss < < " \t { \n "
< < " \t \t real_t x = 2 * MwcNext01(mwc) - 1; \n "
< < " \t \t real_t y = 2 * MwcNext01(mwc) - 1; \n "
< < " \t \t real_t absx = x; \n "
< < " \t \t real_t absy = y; \n "
< < " \t \t real_t side, perimeter; \n "
< < " \t \t \n "
< < " \t \t if (absx < 0) \n "
< < " \t \t absx = absx * -1; \n "
< < " \n "
< < " \t \t if (absy < 0) \n "
< < " \t \t absy = absy * -1; \n "
< < " \n "
< < " \t \t if (absx >= absy) \n "
< < " \t \t { \n "
< < " \t \t if (x >= absy) \n "
< < " \t \t perimeter = absx + y; \n "
< < " \t \t else \n "
< < " \t \t perimeter = 5 * absx - y; \n "
< < " \n "
< < " \t \t side = absx; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if (y >= absx) \n "
< < " \t \t perimeter = 3 * absy - x; \n "
< < " \t \t else \n "
< < " \t \t perimeter = 7 * absy + x; \n "
< < " \n "
< < " \t \t side = absy; \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] * side; \n "
< < " \t \t real_t val = M_PI_4 * perimeter / side - M_PI_4; \n "
< < " \t \t real_t sina = sin(val); \n "
< < " \t \t real_t cosa = cos(val); \n "
< < " \n "
< < " \t \t vOut.x = r * cosa; \n "
< < " \t \t vOut.y = r * sina; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
} ;
/// <summary>
/// BlurZoom.
/// </summary>
template < typename T >
class EMBER_API BlurZoomVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
BlurZoomVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " blur_zoom " , eVariationId : : VAR_BLUR_ZOOM , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( BlurZoomVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T z = 1 + m_BlurZoomLength * rand . Frand01 < T > ( ) ;
helper . Out . x = m_Weight * ( ( helper . In . x - m_BlurZoomX ) * z + m_BlurZoomX ) ;
helper . Out . y = m_Weight * ( ( helper . In . y - m_BlurZoomY ) * z - m_BlurZoomY ) ;
helper . Out . z = m_Weight * helper . In . z ;
}
2014-09-01 00:25:15 -04:00
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string blurZoomLength = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string blurZoomX = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string blurZoomY = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t z = 1 + " < < blurZoomLength < < " * MwcNext01(mwc); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * ((vIn.x - " < < blurZoomX < < " ) * z + " < < blurZoomX < < " ); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * ((vIn.y - " < < blurZoomY < < " ) * z - " < < blurZoomY < < " ); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BlurZoomLength , prefix + " blur_zoom_length " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BlurZoomX , prefix + " blur_zoom_x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BlurZoomY , prefix + " blur_zoom_y " ) ) ;
}
private :
T m_BlurZoomLength ;
T m_BlurZoomX ;
2014-09-01 00:25:15 -04:00
T m_BlurZoomY ;
2014-07-08 03:11:14 -04:00
} ;
/// <summary>
/// BlurPixelize.
/// </summary>
template < typename T >
class EMBER_API BlurPixelizeVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
BlurPixelizeVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " blur_pixelize " , eVariationId : : VAR_BLUR_PIXELIZE , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( BlurPixelizeVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
2014-12-07 02:51:44 -05:00
T x = T ( Floor < T > ( helper . In . x * m_InvSize ) ) ;
T y = T ( Floor < T > ( helper . In . y * m_InvSize ) ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_V * ( x + m_BlurPixelizeScale * ( rand . Frand01 < T > ( ) - T ( 0.5 ) ) + T ( 0.5 ) ) ;
helper . Out . y = m_V * ( y + m_BlurPixelizeScale * ( rand . Frand01 < T > ( ) - T ( 0.5 ) ) + T ( 0.5 ) ) ;
helper . Out . z = m_Weight * helper . In . z ;
}
2014-09-01 00:25:15 -04:00
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string blurPixelizeSize = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string blurPixelizeScale = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string v = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string invSize = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t x = floor(vIn.x * " < < invSize < < " ); \n "
< < " \t \t real_t y = floor(vIn.y * " < < invSize < < " ); \n "
< < " \n "
2015-02-26 16:18:55 -05:00
< < " \t \t vOut.x = " < < v < < " * (x + " < < blurPixelizeScale < < " * (MwcNext01(mwc) - (real_t)(0.5)) + (real_t)(0.5)); \n "
< < " \t \t vOut.y = " < < v < < " * (y + " < < blurPixelizeScale < < " * (MwcNext01(mwc) - (real_t)(0.5)) + (real_t)(0.5)); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_V = m_Weight * m_BlurPixelizeSize ;
m_InvSize = 1 / m_BlurPixelizeSize ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_BlurPixelizeSize , prefix + " blur_pixelize_size " , T ( 0.1 ) , eParamType : : REAL , EPS ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( & m_BlurPixelizeScale , prefix + " blur_pixelize_scale " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_V , prefix + " blur_pixelize_v " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_InvSize , prefix + " blur_pixelize_inv_size " ) ) ;
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
private :
T m_BlurPixelizeSize ;
T m_BlurPixelizeScale ;
T m_V ; //Precalc.
T m_InvSize ;
} ;
/// <summary>
/// Crop.
/// </summary>
template < typename T >
class EMBER_API CropVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
CropVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " crop " , eVariationId : : VAR_CROP , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( CropVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T x = helper . In . x ;
T y = helper . In . y ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( ( ( x < m_X0_ ) | | ( x > m_X1_ ) | | ( y < m_Y0_ ) | | ( y > m_Y1_ ) ) & & m_Z ! = 0 )
{
x = 0 ;
y = 0 ;
}
else
{
if ( x < m_X0_ )
x = m_X0_ + rand . Frand01 < T > ( ) * m_W ;
else if ( x > m_X1_ )
x = m_X1_ - rand . Frand01 < T > ( ) * m_W ;
if ( y < m_Y0_ )
y = m_Y0_ + rand . Frand01 < T > ( ) * m_H ;
else if ( y > m_Y1_ )
y = m_Y1_ - rand . Frand01 < T > ( ) * m_H ;
}
helper . Out . x = m_Weight * x ;
helper . Out . y = m_Weight * y ;
helper . Out . z = m_Weight * helper . In . z ;
}
2014-09-01 00:25:15 -04:00
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string x0 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string y0 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string x1 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string y1 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string z = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string x0_ = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string y0_ = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string x1_ = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string y1_ = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string w = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string h = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t x = vIn.x; \n "
< < " \t \t real_t y = vIn.y; \n "
2016-01-12 23:42:12 -05:00
< < " \n "
2014-07-08 03:11:14 -04:00
< < " \t \t if (((x < " < < x0_ < < " ) || (x > " < < x1_ < < " ) || (y < " < < y0_ < < " ) || (y > " < < y1_ < < " )) && " < < z < < " != 0) \n "
< < " \t \t { \n "
< < " \t \t x = 0; \n "
< < " \t \t y = 0; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if (x < " < < x0_ < < " ) \n "
< < " \t \t x = " < < x0_ < < " + MwcNext01(mwc) * " < < w < < " ; \n "
< < " \t \t else if (x > " < < x1_ < < " ) \n "
< < " \t \t x = " < < x1_ < < " - MwcNext01(mwc) * " < < w < < " ; \n "
< < " \t \t \n "
< < " \t \t if (y < " < < y0_ < < " ) \n "
< < " \t \t y = " < < y0_ < < " + MwcNext01(mwc) * " < < h < < " ; \n "
< < " \t \t else if (y > " < < y1_ < < " ) \n "
< < " \t \t y = " < < y1_ < < " - MwcNext01(mwc) * " < < h < < " ; \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * x; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * y; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
if ( m_X0 < m_X1 )
{
m_X0_ = m_X0 ;
m_X1_ = m_X1 ;
}
else
{
m_X0_ = m_X1 ;
m_X1_ = m_X0 ;
}
if ( m_Y0 < m_Y1 )
{
m_Y0_ = m_Y0 ;
m_Y1_ = m_Y1 ;
}
else
{
m_Y0_ = m_Y1 ;
m_Y1_ = m_Y0 ;
}
m_W = ( m_X1_ - m_X0_ ) * T ( 0.5 ) * m_S ;
m_H = ( m_Y1_ - m_Y0_ ) * T ( 0.5 ) * m_S ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_X0 , prefix + " crop_left " , - 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Y0 , prefix + " crop_top " , - 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_X1 , prefix + " crop_right " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Y1 , prefix + " crop_bottom " , 1 ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_S , prefix + " crop_scatter_area " , 0 , eParamType : : REAL , - 1 , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Z , prefix + " crop_zero " , 0 , eParamType : : INTEGER , 0 , 1 ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_X0_ , prefix + " crop_x0_ " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Y0_ , prefix + " crop_y0_ " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_X1_ , prefix + " crop_x1_ " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Y1_ , prefix + " crop_y1_ " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_W , prefix + " crop_w " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_H , prefix + " crop_h " ) ) ;
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
private :
T m_X0 ;
T m_Y0 ;
T m_X1 ;
T m_Y1 ;
T m_S ;
T m_Z ;
T m_X0_ ; //Precalc.
T m_Y0_ ;
T m_X1_ ;
T m_Y1_ ;
T m_W ;
T m_H ;
} ;
/// <summary>
/// BCircle.
/// </summary>
template < typename T >
class EMBER_API BCircleVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
BCircleVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " bcircle " , eVariationId : : VAR_BCIRCLE , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( BCircleVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
if ( ( helper . In . x = = 0 ) & & ( helper . In . y = = 0 ) )
return ;
T x = helper . In . x * m_Scale ;
T y = helper . In . y * m_Scale ;
2015-04-13 07:32:58 -04:00
T r = std : : sqrt ( SQR ( x ) + SQR ( y ) ) ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( r < = 1 )
{
helper . Out . x = m_Weight * x ;
helper . Out . y = m_Weight * y ;
}
else
{
if ( m_Bcbw ! = 0 )
{
--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.
2015-11-22 17:15:07 -05:00
T ang = std : : atan2 ( y , x ) ;
2014-07-08 03:11:14 -04:00
T omega = ( T ( 0.2 ) * m_Bcbw * rand . Frand01 < T > ( ) ) + 1 ;
--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.
2015-11-22 17:15:07 -05:00
T px = omega * std : : cos ( ang ) ;
T py = omega * std : : sin ( ang ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_Weight * px ;
helper . Out . y = m_Weight * py ;
}
}
helper . Out . z = m_Weight * helper . In . z ;
}
2014-09-01 00:25:15 -04:00
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string scale = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string borderWidth = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string bcbw = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t if ((vIn.x == 0) && (vIn.y == 0)) \n "
< < " \t \t return; \n "
< < " \n "
< < " \t \t real_t x = vIn.x * " < < scale < < " ; \n "
< < " \t \t real_t y = vIn.y * " < < scale < < " ; \n "
< < " \t \t real_t r = sqrt(SQR(x) + SQR(y)); \n "
< < " \n "
< < " \t \t if (r <= 1) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * x; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * y; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if ( " < < bcbw < < " != 0) \n "
< < " \t \t { \n "
< < " \t \t real_t ang = atan2(y, x); \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t omega = ((real_t)(0.2) * " < < bcbw < < " * MwcNext01(mwc)) + 1; \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t px = omega * cos(ang); \n "
< < " \t \t real_t py = omega * sin(ang); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * px; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * py; \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
2016-01-12 23:42:12 -05:00
m_Bcbw = std : : abs ( m_BorderWidth ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Scale , prefix + " bcircle_scale " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BorderWidth , prefix + " bcircle_borderwidth " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Bcbw , prefix + " bcircle_bcbw " ) ) ; //Precalc.
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
private :
T m_Scale ;
T m_BorderWidth ;
T m_Bcbw ; //Precalc.
} ;
/// <summary>
/// BlurLinear.
/// </summary>
template < typename T >
class EMBER_API BlurLinearVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
BlurLinearVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " blur_linear " , eVariationId : : VAR_BLUR_LINEAR , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( BlurLinearVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T r = m_BlurLinearLength * rand . Frand01 < T > ( ) ;
helper . Out . x = m_Weight * ( helper . In . x + r * m_C ) ;
helper . Out . y = m_Weight * ( helper . In . y + r * m_S ) ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string blurLinearLength = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string blurLinearAngle = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t r = " < < blurLinearLength < < " * MwcNext01(mwc); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.x + r * " < < c < < " ); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.y + r * " < < s < < " ); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
sincos ( m_BlurLinearAngle , & m_S , & m_C ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_BlurLinearLength , prefix + " blur_linear_length " ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_BlurLinearAngle , prefix + " blur_linear_angle " , 0 , eParamType : : REAL_CYCLIC , 0 , T ( M_2PI ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_S , prefix + " blur_linear_s " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_C , prefix + " blur_linear_c " ) ) ;
}
private :
T m_BlurLinearLength ;
T m_BlurLinearAngle ;
T m_S ; //Precalc.
T m_C ;
} ;
/// <summary>
/// BlurSquare.
/// </summary>
template < typename T >
class EMBER_API BlurSquareVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
BlurSquareVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " blur_square " , eVariationId : : VAR_BLUR_SQUARE , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( BlurSquareVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
helper . Out . x = m_V * ( rand . Frand01 < T > ( ) - T ( 0.5 ) ) ;
helper . Out . y = m_V * ( rand . Frand01 < T > ( ) - T ( 0.5 ) ) ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string v = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ; //Precalcs only, no params.
ss < < " \t { \n "
2015-02-26 16:18:55 -05:00
< < " \t \t vOut.x = " < < v < < " * (MwcNext01(mwc) - (real_t)(0.5)); \n "
< < " \t \t vOut.y = " < < v < < " * (MwcNext01(mwc) - (real_t)(0.5)); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_V = m_Weight * 2 ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_V , prefix + " blur_square_v " ) ) ; //Precalcs only, no params.
}
private :
T m_V ;
} ;
/// <summary>
/// Flatten.
/// This uses in/out in a rare and different way.
/// </summary>
template < typename T >
class EMBER_API FlattenVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
FlattenVariation ( T weight = 1.0 ) : Variation < T > ( " flatten " , eVariationId : : VAR_FLATTEN , weight ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( FlattenVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
2016-01-04 19:50:15 -05:00
if ( m_VarType = = eVariationType : : VARTYPE_REG ) //Rare and different usage of in/out.
2014-07-08 03:11:14 -04:00
{
helper . Out . x = helper . Out . y = helper . Out . z = 0 ;
outPoint . m_Z = 0 ;
}
else
{
helper . Out . x = helper . In . x ;
helper . Out . y = helper . In . y ;
helper . Out . z = 0 ;
}
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2016-01-04 19:50:15 -05:00
if ( m_VarType = = eVariationType : : VARTYPE_REG )
2014-07-08 03:11:14 -04:00
{
ss < < " \t { \n "
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
< < " \t \t vOut.x = 0; \n "
< < " \t \t vOut.y = 0; \n "
< < " \t \t vOut.z = 0; \n "
2014-07-08 03:11:14 -04:00
< < " \t \t outPoint->m_Z = 0; \n "
< < " \t } \n " ;
}
else
{
ss < < " \t { \n "
< < " \t \t vOut.x = vIn.x; \n "
< < " \t \t vOut.y = vIn.y; \n "
< < " \t \t vOut.z = 0; \n "
2014-09-01 00:25:15 -04:00
< < " \t } \n " ;
2014-07-08 03:11:14 -04:00
}
return ss . str ( ) ;
}
} ;
/// <summary>
/// Zblur.
/// This uses in/out in a rare and different way.
/// </summary>
template < typename T >
class EMBER_API ZblurVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
ZblurVariation ( T weight = 1.0 ) : Variation < T > ( " zblur " , eVariationId : : VAR_ZBLUR , weight ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( ZblurVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
helper . Out . x = helper . Out . y = 0 ;
helper . Out . z = m_Weight * ( rand . Frand01 < T > ( ) + rand . Frand01 < T > ( ) + rand . Frand01 < T > ( ) + rand . Frand01 < T > ( ) - 2 ) ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
< < " \t \t vOut.x = vOut.y = 0; \n "
2015-02-26 16:18:55 -05:00
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * (MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) - (real_t)(2.0)); \n "
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
< < " \t } \n " ;
2014-07-08 03:11:14 -04:00
return ss . str ( ) ;
}
} ;
/// <summary>
/// ZScale.
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
/// This uses in/out in a rare and different way.
2014-07-08 03:11:14 -04:00
/// </summary>
template < typename T >
class EMBER_API ZScaleVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
ZScaleVariation ( T weight = 1.0 ) : Variation < T > ( " zscale " , eVariationId : : VAR_ZSCALE , weight ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( ZScaleVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
helper . Out . x = helper . Out . y = 0 ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
< < " \t \t vOut.x = vOut.y = 0; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
2014-07-08 03:11:14 -04:00
return ss . str ( ) ;
}
} ;
/// <summary>
/// ZTranslate.
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
/// This uses in/out in a rare and different way.
2014-07-08 03:11:14 -04:00
/// </summary>
template < typename T >
class EMBER_API ZTranslateVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
ZTranslateVariation ( T weight = 1.0 ) : Variation < T > ( " ztranslate " , eVariationId : : VAR_ZTRANSLATE , weight ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( ZTranslateVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
helper . Out . x = helper . Out . y = 0 ;
helper . Out . z = m_Weight ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
< < " \t \t vOut.x = vOut.y = 0; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ]; \n "
< < " \t } \n " ;
2014-07-08 03:11:14 -04:00
return ss . str ( ) ;
}
} ;
/// <summary>
/// zcone.
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
/// This uses in/out in a rare and different way.
2014-07-08 03:11:14 -04:00
/// </summary>
template < typename T >
class EMBER_API ZConeVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
ZConeVariation ( T weight = 1.0 ) : Variation < T > ( " zcone " , eVariationId : : VAR_ZCONE , weight , true , true ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( ZConeVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
2016-01-04 19:50:15 -05:00
if ( m_VarType = = eVariationType : : VARTYPE_REG ) //Rare and different usage of in/out.
2014-07-08 03:11:14 -04:00
{
helper . Out . x = helper . Out . y = 0 ;
}
else
{
helper . Out . x = helper . In . x ;
helper . Out . y = helper . In . y ;
}
helper . Out . z = m_Weight * helper . m_PrecalcSqrtSumSquares ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
ss < < " \t { \n " ;
2014-07-08 03:11:14 -04:00
2016-01-04 19:50:15 -05:00
if ( m_VarType = = eVariationType : : VARTYPE_REG )
2014-07-08 03:11:14 -04:00
{
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
ss < < " \t \t vOut.x = vOut.y = 0; \n " ;
2014-07-08 03:11:14 -04:00
}
else
{
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
ss < < " \t \t vOut.x = vIn.x; \n "
< < " \t \t vOut.y = vIn.y; \n " ;
2014-07-08 03:11:14 -04:00
}
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
ss < < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * precalcSqrtSumSquares; \n "
< < " \t } \n " ;
2014-07-08 03:11:14 -04:00
return ss . str ( ) ;
}
} ;
/// <summary>
/// Blur3D.
/// </summary>
template < typename T >
class EMBER_API Blur3DVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
Blur3DVariation ( T weight = 1.0 ) : Variation < T > ( " blur3D " , eVariationId : : VAR_BLUR3D , weight ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( Blur3DVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
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 ) ;
--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.
2015-11-22 17:15:07 -05:00
T sina = std : : sin ( angle ) ;
T cosa = std : : cos ( angle ) ;
T sinb = std : : sin ( angle2 ) ;
T cosb = std : : cos ( angle2 ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = r * sinb * cosa ;
helper . Out . y = r * sinb * sina ;
helper . Out . z = r * cosb ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
< < " \t \t real_t angle = MwcNext01(mwc) * M_2PI; \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] * (MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) - (real_t)(2.0)); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t angle2 = MwcNext01(mwc) * M_PI; \n "
< < " \t \t real_t sina = sin(angle); \n "
< < " \t \t real_t cosa = cos(angle); \n "
< < " \t \t real_t sinb = sin(angle2); \n "
< < " \t \t real_t cosb = cos(angle2); \n "
< < " \n "
< < " \t \t vOut.x = r * sinb * cosa; \n "
< < " \t \t vOut.y = r * sinb * sina; \n "
< < " \t \t vOut.z = r * cosb; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
} ;
/// <summary>
/// Spherical3D.
/// </summary>
template < typename T >
class EMBER_API Spherical3DVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
Spherical3DVariation ( T weight = 1.0 ) : Variation < T > ( " Spherical3D " , eVariationId : : VAR_SPHERICAL3D , weight , true ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( Spherical3DVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
T r2 = m_Weight / Zeps ( helper . m_PrecalcSumSquares + SQR ( helper . In . z ) ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = r2 * helper . In . x ;
helper . Out . y = r2 * helper . In . y ;
helper . Out . z = r2 * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
< < " \t \t real_t r2 = xform->m_VariationWeights[ " < < varIndex < < " ] / Zeps(precalcSumSquares + SQR(vIn.z)); \n "
2014-07-08 03:11:14 -04:00
< < " \n "
< < " \t \t vOut.x = r2 * vIn.x; \n "
< < " \t \t vOut.y = r2 * vIn.y; \n "
< < " \t \t vOut.z = r2 * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Zeps " } ;
}
2014-07-08 03:11:14 -04:00
} ;
/// <summary>
/// Curl3D.
/// </summary>
template < typename T >
class EMBER_API Curl3DVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Curl3DVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " curl3D " , eVariationId : : VAR_CURL3D , weight , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Curl3DVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T r2 = helper . m_PrecalcSumSquares + SQR ( helper . In . z ) ;
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
T r = m_Weight / Zeps ( r2 * m_C2 + m_C2x * helper . In . x - m_C2y * helper . In . y + m_C2z * helper . In . z + 1 ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = r * ( helper . In . x + m_Cx * r2 ) ;
helper . Out . y = r * ( helper . In . y - m_Cy * r2 ) ;
helper . Out . z = r * ( helper . In . z + m_Cz * r2 ) ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string cx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cz = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2y = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2z = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t r2 = precalcSumSquares + SQR(vIn.z); \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] / Zeps(r2 * " < < c2 < < " + " < < c2x < < " * vIn.x - " < < c2y < < " * vIn.y + " < < c2z < < " * vIn.z + (real_t)(1.0)); \n "
2014-07-08 03:11:14 -04:00
< < " \n "
< < " \t \t vOut.x = r * (vIn.x + " < < cx < < " * r2); \n "
< < " \t \t vOut.y = r * (vIn.y - " < < cy < < " * r2); \n "
< < " \t \t vOut.z = r * (vIn.z + " < < cz < < " * r2); \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Zeps " } ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_C2x = 2 * m_Cx ;
m_C2y = 2 * m_Cy ;
m_C2z = 2 * m_Cz ;
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
m_C2 = SQR ( m_Cx ) + SQR ( m_Cy ) + SQR ( m_Cz ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Cx , prefix + " curl3D_cx " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Cy , prefix + " curl3D_cy " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Cz , prefix + " curl3D_cz " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2 , prefix + " curl3D_c2 " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_C2x , prefix + " curl3D_c2x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2y , prefix + " curl3D_c2y " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2z , prefix + " curl3D_c2z " ) ) ;
}
private :
T m_Cx ;
T m_Cy ;
T m_Cz ;
T m_C2 ; //Precalc.
T m_C2x ;
T m_C2y ;
T m_C2z ;
} ;
/// <summary>
/// Disc3D.
/// </summary>
template < typename T >
class EMBER_API Disc3DVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Disc3DVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " disc3d " , eVariationId : : VAR_DISC3D , weight , true , true , false , true , false )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Disc3DVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T r = helper . m_PrecalcSqrtSumSquares ;
T temp = r * m_Pi ;
--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.
2015-11-22 17:15:07 -05:00
T sr = std : : sin ( temp ) ;
T cr = std : : cos ( temp ) ;
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
T vv = m_Weight * helper . m_PrecalcAtanxy / Zeps ( m_Pi ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = vv * sr ;
helper . Out . y = vv * cr ;
--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.
2015-11-22 17:15:07 -05:00
helper . Out . z = vv * ( r * std : : cos ( helper . In . z ) ) ;
2014-07-08 03:11:14 -04:00
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string pi = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t r = precalcSqrtSumSquares; \n "
< < " \t \t real_t temp = r * " < < pi < < " ; \n "
< < " \t \t real_t sr = sin(temp); \n "
< < " \t \t real_t cr = cos(temp); \n "
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
< < " \t \t real_t vv = xform->m_VariationWeights[ " < < varIndex < < " ] * precalcAtanxy / Zeps( " < < pi < < " ); \n "
2014-07-08 03:11:14 -04:00
< < " \n "
< < " \t \t vOut.x = vv * sr; \n "
< < " \t \t vOut.y = vv * cr; \n "
< < " \t \t vOut.z = vv * (r * cos(vIn.z)); \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Zeps " } ;
}
2014-07-08 03:11:14 -04:00
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Pi , prefix + " disc3d_pi " , T ( M_PI ) ) ) ;
}
private :
T m_Pi ;
} ;
/// <summary>
/// Boarders2.
/// </summary>
template < typename T >
class EMBER_API Boarders2Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Boarders2Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " boarders2 " , eVariationId : : VAR_BOARDERS2 , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Boarders2Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
2014-12-07 02:51:44 -05:00
T roundX = T ( int ( helper . In . x > = 0 ? int ( helper . In . x + T ( 0.5 ) ) : int ( helper . In . x - T ( 0.5 ) ) ) ) ;
T roundY = T ( int ( helper . In . y > = 0 ? int ( helper . In . y + T ( 0.5 ) ) : int ( helper . In . y - T ( 0.5 ) ) ) ) ;
2014-07-08 03:11:14 -04:00
T offsetX = helper . In . x - roundX ;
T offsetY = helper . In . y - roundY ;
if ( rand . Frand01 < T > ( ) > = m_Cr )
{
helper . Out . x = m_Weight * ( offsetX * m_AbsC + roundX ) ;
helper . Out . y = m_Weight * ( offsetY * m_AbsC + roundY ) ;
}
else
{
2016-01-12 23:42:12 -05:00
if ( std : : abs ( offsetX ) > = std : : abs ( offsetY ) )
2014-07-08 03:11:14 -04:00
{
if ( offsetX > = 0 )
{
helper . Out . x = m_Weight * ( offsetX * m_AbsC + roundX + m_Cl ) ;
helper . Out . y = m_Weight * ( offsetY * m_AbsC + roundY + m_Cl * offsetY / offsetX ) ;
}
else
{
helper . Out . x = m_Weight * ( offsetX * m_AbsC + roundX - m_Cl ) ;
helper . Out . y = m_Weight * ( offsetY * m_AbsC + roundY - m_Cl * offsetY / offsetX ) ;
}
}
else
{
2016-01-12 23:42:12 -05:00
if ( offsetY > = 0 )
2014-07-08 03:11:14 -04:00
{
helper . Out . y = m_Weight * ( offsetY * m_AbsC + roundY + m_Cl ) ;
helper . Out . x = m_Weight * ( offsetX * m_AbsC + roundX + offsetX / offsetY * m_Cl ) ;
}
else
{
helper . Out . y = m_Weight * ( offsetY * m_AbsC + roundY - m_Cl ) ;
helper . Out . x = m_Weight * ( offsetX * m_AbsC + roundX - offsetX / offsetY * m_Cl ) ;
}
}
}
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string c = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string l = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string r = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string absc = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cl = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cr = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t roundX = (real_t)(int)(vIn.x >= 0 ? (int)(vIn.x + (real_t)(0.5)) : (int)(vIn.x - (real_t)(0.5))); \n "
< < " \t \t real_t roundY = (real_t)(int)(vIn.y >= 0 ? (int)(vIn.y + (real_t)(0.5)) : (int)(vIn.y - (real_t)(0.5))); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t offsetX = vIn.x - roundX; \n "
< < " \t \t real_t offsetY = vIn.y - roundY; \n "
< < " \n "
< < " \t \t if (MwcNext01(mwc) >= " < < cr < < " ) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetX * " < < absc < < " + roundX); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetY * " < < absc < < " + roundY); \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if (fabs(offsetX) >= fabs(offsetY)) \n "
< < " \t \t { \n "
< < " \t \t if (offsetX >= 0) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetX * " < < absc < < " + roundX + " < < cl < < " ); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetY * " < < absc < < " + roundY + " < < cl < < " * offsetY / offsetX); \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetX * " < < absc < < " + roundX - " < < cl < < " ); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetY * " < < absc < < " + roundY - " < < cl < < " * offsetY / offsetX); \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if(offsetY >= 0) \n "
< < " \t \t { \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetY * " < < absc < < " + roundY + " < < cl < < " ); \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetX * " < < absc < < " + roundX + offsetX / offsetY * " < < cl < < " ); \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetY * " < < absc < < " + roundY - " < < cl < < " ); \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (offsetX * " < < absc < < " + roundX - offsetX / offsetY * " < < cl < < " ); \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
2016-01-12 23:42:12 -05:00
T c = Zeps ( std : : abs ( m_C ) ) ;
T cl = Zeps ( std : : abs ( m_Left ) ) ;
T cr = Zeps ( std : : abs ( m_Right ) ) ;
2014-07-08 03:11:14 -04:00
m_AbsC = c ;
m_Cl = c * cl ;
m_Cr = c + ( c * cr ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_C , prefix + " boarders2_c " , T ( 0.5 ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Left , prefix + " boarders2_left " , T ( 0.5 ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Right , prefix + " boarders2_right " , T ( 0.5 ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_AbsC , prefix + " boarders2_cabs " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Cl , prefix + " boarders2_cl " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Cr , prefix + " boarders2_cr " ) ) ;
}
private :
T m_C ;
T m_Left ;
T m_Right ;
T m_AbsC ; //Precalc.
T m_Cl ;
T m_Cr ;
} ;
/// <summary>
/// Cardioid.
/// </summary>
template < typename T >
class EMBER_API CardioidVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
CardioidVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " cardioid " , eVariationId : : VAR_CARDIOID , weight , true , true , true , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( CardioidVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
T r = m_Weight * std : : sqrt ( helper . m_PrecalcSumSquares + std : : sin ( helper . m_PrecalcAtanyx * m_A ) + 1 ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = r * helper . m_PrecalcCosa ;
helper . Out . y = r * helper . m_PrecalcSina ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string a = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] * sqrt(precalcSumSquares + sin(precalcAtanyx * " < < a < < " ) + 1); \n "
< < " \n "
< < " \t \t vOut.x = r * precalcCosa; \n "
< < " \t \t vOut.y = r * precalcSina; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_A , prefix + " cardioid_a " , 1 ) ) ;
}
private :
T m_A ;
} ;
/// <summary>
/// Checks.
/// </summary>
template < typename T >
class EMBER_API ChecksVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
ChecksVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " checks " , eVariationId : : VAR_CHECKS , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( ChecksVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T dx , dy ;
T rnx = m_Rnd * rand . Frand01 < T > ( ) ;
T rny = m_Rnd * rand . Frand01 < T > ( ) ;
2014-12-07 02:51:44 -05:00
int isXY = int ( LRint ( helper . In . x * m_Cs ) + LRint ( helper . In . y * m_Cs ) ) ;
2014-07-08 03:11:14 -04:00
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
if ( isXY & 1 )
2014-07-08 03:11:14 -04:00
{
dx = m_Ncx + rnx ;
dy = m_Ncy ;
}
else
{
dx = m_Cx ;
dy = m_Cy + rny ;
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
helper . Out . x = m_Weight * ( helper . In . x + dx ) ;
helper . Out . y = m_Weight * ( helper . In . y + dy ) ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string y = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string size = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string rnd = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cs = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ncx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ncy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t dx, dy; \n "
< < " \t \t real_t rnx = " < < rnd < < " * MwcNext01(mwc); \n "
< < " \t \t real_t rny = " < < rnd < < " * MwcNext01(mwc); \n "
< < " \n "
< < " \t \t int isXY = (int)(LRint(vIn.x * " < < cs < < " ) + LRint(vIn.y * " < < cs < < " )); \n "
< < " \n "
--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.
2015-11-22 17:15:07 -05:00
< < " \t \t if (isXY & 1) \n "
2014-07-08 03:11:14 -04:00
< < " \t \t { \n "
< < " \t \t dx = " < < ncx < < " + rnx; \n "
< < " \t \t dy = " < < ncy < < " ; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t dx = " < < cx < < " ; \n "
< < " \t \t dy = " < < cy < < " + rny; \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.x + dx); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.y + dy); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " LRint " } ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
m_Cs = 1 / Zeps ( m_Size ) ;
2014-07-08 03:11:14 -04:00
m_Cx = m_X ;
m_Cy = m_Y ;
m_Ncx = - m_X ;
m_Ncy = - m_Y ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_X , prefix + " checks_x " , T ( 0.5 ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Y , prefix + " checks_y " , T ( 0.5 ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Size , prefix + " checks_size " , T ( 0.5 ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Rnd , prefix + " checks_rnd " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Cs , prefix + " checks_cs " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Cx , prefix + " checks_cx " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Cy , prefix + " checks_cy " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Ncx , prefix + " checks_ncx " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Ncy , prefix + " checks_ncy " ) ) ;
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
private :
T m_X ;
T m_Y ;
T m_Size ;
T m_Rnd ;
T m_Cs ; //Precalc.
T m_Cx ;
T m_Cy ;
T m_Ncx ;
T m_Ncy ;
} ;
/// <summary>
/// Circlize.
/// </summary>
template < typename T >
class EMBER_API CirclizeVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
CirclizeVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " circlize " , eVariationId : : VAR_CIRCLIZE , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( CirclizeVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T side ;
T perimeter ;
T r , val ;
2016-01-12 23:42:12 -05:00
T absx = std : : abs ( helper . In . x ) ;
T absy = std : : abs ( helper . In . y ) ;
2014-07-08 03:11:14 -04:00
if ( absx > = absy )
{
if ( helper . In . x > = absy )
perimeter = absx + helper . In . y ;
else
perimeter = 5 * absx - helper . In . y ;
side = absx ;
}
else
{
if ( helper . In . y > = absx )
perimeter = 3 * absy - helper . In . x ;
else
perimeter = 7 * absy + helper . In . x ;
side = absy ;
}
r = m_Vvar4Pi * side + m_Hole ;
val = T ( M_PI_4 ) * perimeter / side - T ( M_PI_4 ) ;
--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.
2015-11-22 17:15:07 -05:00
helper . Out . x = r * std : : cos ( val ) ;
helper . Out . y = r * std : : sin ( val ) ;
2014-07-08 03:11:14 -04:00
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string hole = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string vvar4pi = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t side; \n "
< < " \t \t real_t perimeter; \n "
< < " \t \t real_t absx = fabs(vIn.x); \n "
< < " \t \t real_t absy = fabs(vIn.y); \n "
< < " \n "
< < " \t \t if (absx >= absy) \n "
< < " \t \t { \n "
< < " \t \t if (vIn.x >= absy) \n "
< < " \t \t perimeter = absx + vIn.y; \n "
< < " \t \t else \n "
< < " \t \t perimeter = 5 * absx - vIn.y; \n "
< < " \n "
< < " \t \t side = absx; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if (vIn.y >= absx) \n "
< < " \t \t perimeter = 3 * absy - vIn.x; \n "
< < " \t \t else \n "
< < " \t \t perimeter = 7 * absy + vIn.x; \n "
< < " \n "
< < " \t \t side = absy; \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t real_t r = " < < vvar4pi < < " * side + " < < hole < < " ; \n "
< < " \t \t real_t val = M_PI_4 * perimeter / side - M_PI_4; \n "
< < " \n "
< < " \t \t vOut.x = r * cos(val); \n "
< < " \t \t vOut.y = r * sin(val); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Vvar4Pi = m_Weight / T ( M_PI_4 ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Hole , prefix + " circlize_hole " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Vvar4Pi , prefix + " circlize_vvar4pi " ) ) ; //Precalc.
}
private :
T m_Hole ;
T m_Vvar4Pi ; //Precalc.
} ;
/// <summary>
/// Circlize2.
/// </summary>
template < typename T >
class EMBER_API Circlize2Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Circlize2Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " circlize2 " , eVariationId : : VAR_CIRCLIZE2 , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Circlize2Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T side ;
T perimeter ;
2016-01-12 23:42:12 -05:00
T absx = std : : abs ( helper . In . x ) ;
T absy = std : : abs ( helper . In . y ) ;
2014-07-08 03:11:14 -04:00
if ( absx > = absy )
{
if ( helper . In . x > = absy )
perimeter = absx + helper . In . y ;
else
perimeter = 5 * absx - helper . In . y ;
side = absx ;
}
else
{
if ( helper . In . y > = absx )
perimeter = 3 * absy - helper . In . x ;
else
perimeter = 7 * absy + helper . In . x ;
side = absy ;
}
T r = m_Weight * ( side + m_Hole ) ;
T val = T ( M_PI_4 ) * perimeter / side - T ( M_PI_4 ) ;
--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.
2015-11-22 17:15:07 -05:00
helper . Out . x = r * std : : cos ( val ) ;
helper . Out . y = r * std : : sin ( val ) ;
2014-07-08 03:11:14 -04:00
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string hole = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t side; \n "
< < " \t \t real_t perimeter; \n "
< < " \t \t real_t absx = fabs(vIn.x); \n "
< < " \t \t real_t absy = fabs(vIn.y); \n "
< < " \n "
< < " \t \t if (absx >= absy) \n "
< < " \t \t { \n "
< < " \t \t if (vIn.x >= absy) \n "
< < " \t \t perimeter = absx + vIn.y; \n "
< < " \t \t else \n "
< < " \t \t perimeter = 5 * absx - vIn.y; \n "
< < " \n "
< < " \t \t side = absx; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if (vIn.y >= absx) \n "
< < " \t \t perimeter = 3 * absy - vIn.x; \n "
< < " \t \t else \n "
< < " \t \t perimeter = 7 * absy + vIn.x; \n "
< < " \n "
< < " \t \t side = absy; \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] * (side + " < < hole < < " ); \n "
< < " \t \t real_t val = M_PI_4 * perimeter / side - M_PI_4; \n "
< < " \n "
< < " \t \t vOut.x = r * cos(val); \n "
< < " \t \t vOut.y = r * sin(val); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Hole , prefix + " circlize2_hole " ) ) ;
}
private :
T m_Hole ;
} ;
/// <summary>
/// CosWrap.
/// </summary>
template < typename T >
class EMBER_API CosWrapVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
CosWrapVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " coswrap " , eVariationId : : VAR_COS_WRAP , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( CosWrapVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T x = T ( 0.5 ) * helper . In . x + T ( 0.5 ) ;
T y = T ( 0.5 ) * helper . In . y + T ( 0.5 ) ;
T bx = Fabsmod < T > ( m_Fr * x ) ;
T by = Fabsmod < T > ( m_Fr * y ) ;
T oscnapx = Foscn < T > ( m_AmountX , m_Px ) ;
T oscnapy = Foscn < T > ( m_AmountY , m_Py ) ;
helper . Out . x = - 1 + m_Vv2 * Lerp < T > ( Lerp ( x , Fosc ( x , T ( 4 ) , m_Px ) , oscnapx ) , Fosc ( bx , T ( 4 ) , m_Px ) , oscnapx ) ; //Original did a direct assignment to outPoint, which is incompatible with Ember's design.
helper . Out . y = - 1 + m_Vv2 * Lerp < T > ( Lerp ( y , Fosc ( y , T ( 4 ) , m_Py ) , oscnapy ) , Fosc ( by , T ( 4 ) , m_Py ) , oscnapy ) ;
2016-01-04 19:50:15 -05:00
helper . Out . z = ( m_VarType = = eVariationType : : VARTYPE_REG ) ? 0 : helper . In . z ;
2014-07-08 03:11:14 -04:00
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-09-10 01:41:26 -04:00
int i = 0 ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string repeat = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string amountX = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string amountY = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string phaseX = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string phaseY = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ax = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ay = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string px = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string py = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string fr = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string vv2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t x = (real_t)(0.5) * vIn.x + (real_t)(0.5); \n "
< < " \t \t real_t y = (real_t)(0.5) * vIn.y + (real_t)(0.5); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t bx = Fabsmod( " < < fr < < " * x); \n "
< < " \t \t real_t by = Fabsmod( " < < fr < < " * y); \n "
< < " \t \t real_t oscnapx = Foscn( " < < amountX < < " , " < < px < < " ); \n "
< < " \t \t real_t oscnapy = Foscn( " < < amountY < < " , " < < py < < " ); \n "
< < " \n "
< < " \t \t vOut.x = -1 + " < < vv2 < < " * Lerp(Lerp(x, Fosc(x, 4, " < < px < < " ), oscnapx), Fosc(bx, 4, " < < px < < " ), oscnapx); \n "
< < " \t \t vOut.y = -1 + " < < vv2 < < " * Lerp(Lerp(y, Fosc(y, 4, " < < py < < " ), oscnapy), Fosc(by, 4, " < < py < < " ), oscnapy); \n "
2016-01-04 19:50:15 -05:00
< < " \t \t vOut.z = " < < ( ( m_VarType = = eVariationType : : VARTYPE_REG ) ? " 0 " : " vIn.z " ) < < " ; \n "
2014-07-08 03:11:14 -04:00
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Fabsmod " , " Fosc " , " Foscn " , " Lerp " } ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
2016-01-12 23:42:12 -05:00
m_Ax = M_2PI * std : : abs ( m_AmountX ) ;
m_Ay = M_2PI * std : : abs ( m_AmountY ) ;
2014-07-08 03:11:14 -04:00
m_Px = T ( M_PI ) * m_PhaseX ;
m_Py = T ( M_PI ) * m_PhaseY ;
2016-01-12 23:42:12 -05:00
m_Fr = std : : abs ( m_Repeat ) ;
2014-07-08 03:11:14 -04:00
m_Vv2 = 2 * m_Weight ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_Repeat , prefix + " coswrap_repeat " , 1 , eParamType : : INTEGER_NONZERO ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( & m_AmountX , prefix + " coswrap_amount_x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_AmountY , prefix + " coswrap_amount_y " ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_PhaseX , prefix + " coswrap_phase_x " , 0 , eParamType : : REAL_CYCLIC , - 1 , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_PhaseY , prefix + " coswrap_phase_y " , 0 , eParamType : : REAL_CYCLIC , - 1 , 1 ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_Ax , prefix + " coswrap_ax " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Ay , prefix + " coswrap_ay " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Px , prefix + " coswrap_px " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Py , prefix + " coswrap_py " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Fr , prefix + " coswrap_fr " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Vv2 , prefix + " coswrap_vv2 " ) ) ;
}
private :
T m_Repeat ;
T m_AmountX ;
T m_AmountY ;
T m_PhaseX ;
T m_PhaseY ;
T m_Ax ; //Precalc.
T m_Ay ;
T m_Px ;
T m_Py ;
T m_Fr ;
T m_Vv2 ;
} ;
/// <summary>
/// DeltaA.
/// The original in deltaA.c in Apophysis used a precalc variable named v, but
/// was unused in the calculation. So this remains a non-parametric variation with
/// that precalc variable omitted.
/// </summary>
template < typename T >
class EMBER_API DeltaAVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
DeltaAVariation ( T weight = 1.0 ) : Variation < T > ( " deltaa " , eVariationId : : VAR_DELTA_A , weight ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( DeltaAVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T s , c ;
2015-04-13 07:32:58 -04:00
T avgr = m_Weight * ( std : : sqrt ( SQR ( helper . In . y ) + SQR ( helper . In . x + 1 ) ) / std : : sqrt ( SQR ( helper . In . y ) + SQR ( helper . In . x - 1 ) ) ) ;
2014-07-08 03:11:14 -04:00
T avga = ( atan2 ( helper . In . y , helper . In . x - 1 ) - atan2 ( helper . In . y , helper . In . x + 1 ) ) / 2 ;
sincos ( avga , & s , & c ) ;
helper . Out . x = avgr * c ;
helper . Out . y = avgr * s ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
< < " \t \t real_t avgr = xform->m_VariationWeights[ " < < varIndex < < " ] * (sqrt(SQR(vIn.y) + SQR(vIn.x + 1)) / sqrt(SQR(vIn.y) + SQR(vIn.x - 1))); \n "
< < " \t \t real_t avga = (atan2(vIn.y, vIn.x - 1) - atan2(vIn.y, vIn.x + 1)) / 2; \n "
< < " \t \t real_t s = sin(avga); \n "
< < " \t \t real_t c = cos(avga); \n "
< < " \n "
< < " \t \t vOut.x = avgr * c; \n "
< < " \t \t vOut.y = avgr * s; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
} ;
/// <summary>
/// Expo.
/// </summary>
template < typename T >
class EMBER_API ExpoVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
ExpoVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " expo " , eVariationId : : VAR_EXPO , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( ExpoVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
T expor = std : : exp ( helper . In . x * m_K - helper . In . y * m_T ) ;
2014-07-08 03:11:14 -04:00
T temp = helper . In . x * m_T + helper . In . y * m_K ;
--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.
2015-11-22 17:15:07 -05:00
T snv = std : : sin ( temp ) ;
T csv = std : : cos ( temp ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_Weight * expor * csv ;
helper . Out . y = m_Weight * expor * snv ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string real = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string imag = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string k = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string t = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t expor = exp(vIn.x * " < < k < < " - vIn.y * " < < t < < " ); \n "
< < " \t \t real_t temp = vIn.x * " < < t < < " + vIn.y * " < < k < < " ; \n "
< < " \t \t real_t snv = sin(temp); \n "
< < " \t \t real_t csv = cos(temp); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * expor * csv; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * expor * snv; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
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.
2014-07-08 03:11:14 -04:00
m_T = atan2 ( m_Imag , m_Real ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Real , prefix + " expo_real " , - 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Imag , prefix + " expo_imaginary " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_K , prefix + " expo_k " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_T , prefix + " expo_t " ) ) ;
}
private :
T m_Real ;
T m_Imag ;
T m_K ; //Precalc.
T m_T ;
} ;
/// <summary>
/// Extrude.
/// </summary>
template < typename T >
class EMBER_API ExtrudeVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
ExtrudeVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " extrude " , eVariationId : : VAR_EXTRUDE , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( ExtrudeVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
2016-01-04 19:50:15 -05:00
if ( m_VarType = = eVariationType : : VARTYPE_REG )
2014-07-08 03:11:14 -04:00
{
helper . Out . x = helper . Out . y = helper . Out . z = 0 ;
if ( rand . Frand01 < T > ( ) < m_RootFace )
outPoint . m_Z = ClampGte0 ( m_Weight ) ;
else
outPoint . m_Z = m_Weight * rand . Frand01 < T > ( ) ;
}
else
{
helper . Out . x = helper . In . x ;
helper . Out . y = helper . In . y ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( rand . Frand01 < T > ( ) < m_RootFace )
helper . Out . z = ClampGte0 ( m_Weight ) ;
else
helper . Out . z = m_Weight * rand . Frand01 < T > ( ) ;
}
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string rootFace = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
2014-09-01 00:25:15 -04:00
2016-01-04 19:50:15 -05:00
if ( m_VarType = = eVariationType : : VARTYPE_REG )
2014-07-08 03:11:14 -04:00
{
ss < < " \t { \n "
< < " \t \t vOut.x = vOut.y = vOut.z = 0; \n "
< < " \n "
< < " \t \t if (MwcNext01(mwc) < " < < rootFace < < " ) \n "
2015-02-26 16:18:55 -05:00
< < " \t \t outPoint->m_Z = max(xform->m_VariationWeights[ " < < varIndex < < " ], (real_t)(0.0)); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t else \n "
< < " \t \t outPoint->m_Z = xform->m_VariationWeights[ " < < varIndex < < " ] * MwcNext01(mwc); \n "
< < " \t } \n " ;
}
else
{
ss < < " \t { \n "
< < " \t \t vOut.x = vIn.x; \n "
< < " \t \t vOut.y = vIn.y; \n "
< < " \n "
< < " \t \t if (MwcNext01(mwc) < " < < rootFace < < " ) \n "
2015-02-26 16:18:55 -05:00
< < " \t \t vOut.z = max(xform->m_VariationWeights[ " < < varIndex < < " ], (real_t)(0.0)); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t else \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * MwcNext01(mwc); \n "
< < " \t } \n " ;
}
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_RootFace , prefix + " extrude_root_face " , T ( 0.5 ) ) ) ;
}
private :
T m_RootFace ;
} ;
/// <summary>
/// fdisc.
/// </summary>
template < typename T >
class EMBER_API FDiscVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
FDiscVariation ( T weight = 1.0 ) : Variation < T > ( " fdisc " , eVariationId : : VAR_FDISC , weight , true , true , false , false , true ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( FDiscVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T c , s ;
T a = M_2PI / ( helper . m_PrecalcSqrtSumSquares + 1 ) ;
T r = ( helper . m_PrecalcAtanyx * T ( M_1_PI ) + 1 ) * T ( 0.5 ) ;
sincos ( a , & s , & c ) ;
helper . Out . x = m_Weight * r * c ;
helper . Out . y = m_Weight * r * s ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
< < " \t \t real_t a = M_2PI / (precalcSqrtSumSquares + 1); \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t r = (precalcAtanyx * M_1_PI + 1) * (real_t)(0.5); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t s = sin(a); \n "
< < " \t \t real_t c = cos(a); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * r * c; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * r * s; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
} ;
/// <summary>
/// Fibonacci.
/// </summary>
template < typename T >
class EMBER_API FibonacciVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
FibonacciVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " fibonacci " , eVariationId : : VAR_FIBONACCI , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( FibonacciVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T snum1 , cnum1 , snum2 , cnum2 ;
T temp = helper . In . y * m_NatLog ;
sincos ( temp , & snum1 , & cnum1 ) ;
temp = ( helper . In . x * T ( M_PI ) + helper . In . y * m_NatLog ) * - 1 ;
sincos ( temp , & snum2 , & cnum2 ) ;
--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.
2015-11-22 17:15:07 -05:00
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 ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_Weight * ( eradius1 * cnum1 - eradius2 * cnum2 ) * m_Five ;
helper . Out . y = m_Weight * ( eradius1 * snum1 - eradius2 * snum2 ) * m_Five ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string five = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ; //Precalcs only, no params.
string natLog = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t temp = vIn.y * " < < natLog < < " ; \n "
< < " \t \t real_t snum1 = sin(temp); \n "
< < " \t \t real_t cnum1 = cos(temp); \n "
2015-02-26 16:18:55 -05:00
< < " \t \t temp = (vIn.x * M_PI + vIn.y * " < < natLog < < " ) * -(real_t)(1.0); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t snum2 = sin(temp); \n "
< < " \t \t real_t cnum2 = cos(temp); \n "
< < " \t \t real_t eradius1 = exp(vIn.x * " < < natLog < < " ); \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t eradius2 = exp((vIn.x * " < < natLog < < " - vIn.y * M_PI) * -(real_t)(1.0)); \n "
2014-07-08 03:11:14 -04:00
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (eradius1 * cnum1 - eradius2 * cnum2) * " < < five < < " ; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (eradius1 * snum1 - eradius2 * snum2) * " < < five < < " ; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Five = 1 / SQRT5 ;
--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.
2015-11-22 17:15:07 -05:00
m_NatLog = std : : log ( M_PHI ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Five , prefix + " fibonacci_five " ) ) ; //Precalcs only, no params.
m_Params . push_back ( ParamWithName < T > ( true , & m_NatLog , prefix + " fibonacci_nat_log " ) ) ;
}
private :
T m_Five ; //Precalcs only, no params.
T m_NatLog ;
} ;
/// <summary>
/// Fibonacci2.
/// </summary>
template < typename T >
class EMBER_API Fibonacci2Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Fibonacci2Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " fibonacci2 " , eVariationId : : VAR_FIBONACCI2 , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Fibonacci2Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T snum1 , cnum1 , snum2 , cnum2 ;
T temp = helper . In . y * m_NatLog ;
sincos ( temp , & snum1 , & cnum1 ) ;
temp = ( helper . In . x * T ( M_PI ) + helper . In . y * m_NatLog ) * - 1 ;
sincos ( temp , & snum2 , & cnum2 ) ;
--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.
2015-11-22 17:15:07 -05:00
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 ) ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_Weight * ( eradius1 * cnum1 - eradius2 * cnum2 ) * m_Five ;
helper . Out . y = m_Weight * ( eradius1 * snum1 - eradius2 * snum2 ) * m_Five ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string sc = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string sc2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string five = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string natLog = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t temp = vIn.y * " < < natLog < < " ; \n "
< < " \t \t real_t snum1 = sin(temp); \n "
< < " \t \t real_t cnum1 = cos(temp); \n "
< < " \t \t temp = (vIn.x * M_PI + vIn.y * " < < natLog < < " ) * -1; \n "
< < " \t \t real_t snum2 = sin(temp); \n "
< < " \t \t real_t cnum2 = cos(temp); \n "
< < " \t \t real_t eradius1 = " < < sc < < " * exp( " < < sc2 < < " * (vIn.x * " < < natLog < < " )); \n "
< < " \t \t real_t eradius2 = " < < sc < < " * exp( " < < sc2 < < " * ((vIn.x * " < < natLog < < " - vIn.y * M_PI) * -1)); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (eradius1 * cnum1 - eradius2 * cnum2) * " < < five < < " ; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (eradius1 * snum1 - eradius2 * snum2) * " < < five < < " ; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Five = 1 / SQRT5 ;
--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.
2015-11-22 17:15:07 -05:00
m_NatLog = std : : log ( M_PHI ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Sc , prefix + " fibonacci2_sc " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Sc2 , prefix + " fibonacci2_sc2 " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Five , prefix + " fibonacci2_five " ) ) ; //Precalcs.
m_Params . push_back ( ParamWithName < T > ( true , & m_NatLog , prefix + " fibonacci2_nat_log " ) ) ;
}
private :
T m_Sc ;
T m_Sc2 ;
T m_Five ; //Precalcs.
T m_NatLog ;
} ;
/// <summary>
/// Glynnia.
/// </summary>
template < typename T >
class EMBER_API GlynniaVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
GlynniaVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " glynnia " , eVariationId : : VAR_GLYNNIA , weight , true , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( GlynniaVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T d , r = helper . m_PrecalcSqrtSumSquares ;
if ( r > 1 )
{
if ( rand . Frand01 < T > ( ) > T ( 0.5 ) )
{
2015-04-13 07:32:58 -04:00
d = std : : sqrt ( r + helper . In . x ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_V2 * d ;
helper . Out . y = - ( m_V2 / d * helper . In . y ) ;
}
else
{
d = r + helper . In . x ;
2015-04-13 07:32:58 -04:00
r = m_Weight / std : : sqrt ( r * ( SQR ( helper . In . y ) + SQR ( d ) ) ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = r * d ;
helper . Out . y = r * helper . In . y ;
}
}
else
{
if ( rand . Frand01 < T > ( ) > T ( 0.5 ) )
{
2015-04-13 07:32:58 -04:00
d = std : : sqrt ( r + helper . In . x ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = - ( m_V2 * d ) ;
helper . Out . y = - ( m_V2 / d * helper . In . y ) ;
}
else
{
d = r + helper . In . x ;
2015-04-13 07:32:58 -04:00
r = m_Weight / std : : sqrt ( r * ( SQR ( helper . In . y ) + SQR ( d ) ) ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = - ( r * d ) ;
helper . Out . y = r * helper . In . y ;
}
}
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string v2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ; //Precalcs only, no params.
ss < < " \t { \n "
< < " \t \t real_t d, r = precalcSqrtSumSquares; \n "
< < " \n "
< < " \t \t if (r > 1) \n "
< < " \t \t { \n "
2015-02-26 16:18:55 -05:00
< < " \t \t if (MwcNext01(mwc) > (real_t)(0.5)) \n "
2014-07-08 03:11:14 -04:00
< < " \t \t { \n "
< < " \t \t d = sqrt(r + vIn.x); \n "
< < " \t \t vOut.x = " < < v2 < < " * d; \n "
< < " \t \t vOut.y = -( " < < v2 < < " / d * vIn.y); \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t d = r + vIn.x; \n "
< < " \t \t r = xform->m_VariationWeights[ " < < varIndex < < " ] / sqrt(r * (SQR(vIn.y) + SQR(d))); \n "
< < " \t \t vOut.x = r * d; \n "
< < " \t \t vOut.y = r * vIn.y; \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
2015-02-26 16:18:55 -05:00
< < " \t \t if (MwcNext01(mwc) > (real_t)(0.5)) \n "
2014-07-08 03:11:14 -04:00
< < " \t \t { \n "
< < " \t \t d = sqrt(r + vIn.x); \n "
< < " \t \t vOut.x = -( " < < v2 < < " * d); \n "
2014-07-09 22:18:39 -04:00
< < " \t \t vOut.y = -( " < < v2 < < " / d * vIn.y); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t d = r + vIn.x; \n "
< < " \t \t r = xform->m_VariationWeights[ " < < varIndex < < " ] / sqrt(r * (SQR(vIn.y) + SQR(d))); \n "
< < " \t \t vOut.x = -(r * d); \n "
< < " \t \t vOut.y = r * vIn.y; \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
2015-04-13 07:32:58 -04:00
m_V2 = m_Weight * std : : sqrt ( T ( 2 ) ) / 2 ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_V2 , prefix + " glynnia_v2 " ) ) ; //Precalcs only, no params.
}
private :
T m_V2 ; //Precalcs only, no params.
} ;
/// <summary>
/// GridOut.
/// </summary>
template < typename T >
class EMBER_API GridOutVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
GridOutVariation ( T weight = 1.0 ) : Variation < T > ( " gridout " , eVariationId : : VAR_GRIDOUT , weight ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( GridOutVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T x = LRint ( helper . In . x ) ;
T y = LRint ( helper . In . y ) ;
if ( y < = 0 )
{
if ( x > 0 )
{
if ( - y > = x )
{
helper . Out . x = m_Weight * ( helper . In . x + 1 ) ;
helper . Out . y = m_Weight * helper . In . y ;
}
else
{
helper . Out . x = m_Weight * helper . In . x ;
helper . Out . y = m_Weight * ( helper . In . y + 1 ) ;
}
}
else
{
if ( y < = x )
{
helper . Out . x = m_Weight * ( helper . In . x + 1 ) ;
helper . Out . y = m_Weight * helper . In . y ;
}
else
{
helper . Out . x = m_Weight * helper . In . x ;
helper . Out . y = m_Weight * ( helper . In . y - 1 ) ;
}
}
}
else
{
if ( x > 0 )
{
if ( y > = x )
{
helper . Out . x = m_Weight * ( helper . In . x - 1 ) ;
helper . Out . y = m_Weight * helper . In . y ;
}
else
{
helper . Out . x = m_Weight * helper . In . x ;
helper . Out . y = m_Weight * ( helper . In . y + 1 ) ;
}
}
else
{
if ( y > - x )
{
helper . Out . x = m_Weight * ( helper . In . x - 1 ) ;
helper . Out . y = m_Weight * helper . In . y ;
}
else
{
helper . Out . x = m_Weight * helper . In . x ;
helper . Out . y = m_Weight * ( helper . In . y - 1 ) ;
}
}
}
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
< < " \t \t real_t x = LRint(vIn.x); \n "
< < " \t \t real_t y = LRint(vIn.y); \n "
< < " \n "
< < " \t \t if (y <= 0) \n "
< < " \t \t { \n "
< < " \t \t if (x > 0) \n "
< < " \t \t { \n "
< < " \t \t if (-y >= x) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.x + 1); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.y; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.x; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.y + 1); \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if (y <= x) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.x + 1); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.y; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.x; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.y - 1); \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if (x > 0) \n "
< < " \t \t { \n "
< < " \t \t if (y >= x) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.x - 1); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.y; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.x; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.y + 1); \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t if (y > -x) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.x - 1); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.y; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.x; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (vIn.y - 1); \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " LRint " } ;
}
2014-07-08 03:11:14 -04:00
} ;
/// <summary>
/// Hole.
/// </summary>
template < typename T >
class EMBER_API HoleVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
HoleVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " hole " , eVariationId : : VAR_HOLE , weight , true , true , true , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( HoleVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
T r , delta = std : : pow ( helper . m_PrecalcAtanyx / T ( M_PI ) + 1 , m_A ) ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( m_Inside ! = 0 )
r = m_Weight * delta / ( helper . m_PrecalcSqrtSumSquares + delta ) ;
else
r = m_Weight * helper . m_PrecalcSqrtSumSquares + delta ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
helper . Out . x = r * helper . m_PrecalcCosa ;
helper . Out . y = r * helper . m_PrecalcSina ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string a = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string inside = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
2015-07-24 06:06:14 -04:00
< < " \t \t real_t r, delta = pow(precalcAtanyx / (real_t)M_PI + 1, " < < a < < " ); \n "
2014-07-08 03:11:14 -04:00
< < " \n "
< < " \t \t if ( " < < inside < < " != 0) \n "
< < " \t \t r = xform->m_VariationWeights[ " < < varIndex < < " ] * delta / (precalcSqrtSumSquares + delta); \n "
< < " \t \t else \n "
< < " \t \t r = xform->m_VariationWeights[ " < < varIndex < < " ] * precalcSqrtSumSquares + delta; \n "
< < " \n "
< < " \t \t vOut.x = r * precalcCosa; \n "
< < " \t \t vOut.y = r * precalcSina; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_A , prefix + " hole_a " , 1 ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_Inside , prefix + " hole_inside " , 0 , eParamType : : INTEGER , 0 , 1 ) ) ;
2014-07-08 03:11:14 -04:00
}
private :
T m_A ;
T m_Inside ;
} ;
/// <summary>
/// Hypertile.
/// </summary>
template < typename T >
class EMBER_API HypertileVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
HypertileVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " hypertile " , eVariationId : : VAR_HYPERTILE , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( HypertileVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T a = helper . In . x + m_Real ;
T b = helper . In . y - m_Imag ;
T c = m_Real * helper . In . x - m_Imag * helper . In . y + 1 ;
T d = m_Real * helper . In . y + m_Imag * helper . In . x ;
T vr = m_Weight / ( SQR ( c ) + SQR ( d ) ) ;
helper . Out . x = vr * ( a * c + b * d ) ;
helper . Out . y = vr * ( b * c - a * d ) ;
2016-01-04 19:50:15 -05:00
helper . Out . z = ( m_VarType = = eVariationType : : VARTYPE_REG ) ? 0 : helper . In . z ;
2014-07-08 03:11:14 -04:00
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string p = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string q = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string n = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string real = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string imag = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t a = vIn.x + " < < real < < " ; \n "
< < " \t \t real_t b = vIn.y - " < < imag < < " ; \n "
< < " \t \t real_t c = " < < real < < " * vIn.x - " < < imag < < " * vIn.y + 1; \n "
< < " \t \t real_t d = " < < real < < " * vIn.y + " < < imag < < " * vIn.x; \n "
< < " \t \t real_t vr = xform->m_VariationWeights[ " < < varIndex < < " ] / (SQR(c) + SQR(d)); \n "
< < " \n "
< < " \t \t vOut.x = vr * (a * c + b * d); \n "
< < " \t \t vOut.y = vr * (b * c - a * d); \n "
2016-01-04 19:50:15 -05:00
< < " \t \t vOut.z = " < < ( ( m_VarType = = eVariationType : : VARTYPE_REG ) ? " 0 " : " vIn.z " ) < < " ; \n "
2014-07-08 03:11:14 -04:00
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
T pa = 2 * T ( M_PI ) / m_P ;
T qa = 2 * T ( M_PI ) / m_Q ;
--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.
2015-11-22 17:15:07 -05:00
T r = ( 1 - std : : cos ( pa ) ) / ( std : : cos ( pa ) + std : : cos ( qa ) ) + 1 ;
2014-07-08 03:11:14 -04:00
T a = m_N * pa ;
if ( r > 0 )
2015-04-13 07:32:58 -04:00
r = 1 / std : : sqrt ( r ) ;
2014-07-08 03:11:14 -04:00
else
r = 1 ;
--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.
2015-11-22 17:15:07 -05:00
m_Real = r * std : : cos ( a ) ;
m_Imag = r * std : : sin ( a ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_P , prefix + " hypertile_p " , 3 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Q , prefix + " hypertile_q " , 7 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_N , prefix + " hypertile_n " , 0 , eParamType : : INTEGER ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_Real , prefix + " hypertile_real " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Imag , prefix + " hypertile_imag " ) ) ;
}
private :
T m_P ;
T m_Q ;
T m_N ;
T m_Real ; //Precalc.
T m_Imag ;
} ;
/// <summary>
/// Hypertile1.
/// </summary>
template < typename T >
class EMBER_API Hypertile1Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Hypertile1Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " hypertile1 " , eVariationId : : VAR_HYPERTILE1 , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Hypertile1Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T temp = rand . Rand ( ) * m_Pa ;
--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.
2015-11-22 17:15:07 -05:00
T sina = std : : sin ( temp ) ;
T cosa = std : : cos ( temp ) ;
2014-07-08 03:11:14 -04:00
T re = m_R * cosa ;
T im = m_R * sina ;
T a = helper . In . x + re ;
T b = helper . In . y - im ;
T c = re * helper . In . x - im * helper . In . y + 1 ;
T d = re * helper . In . y + im * helper . In . x ;
T vr = m_Weight / ( SQR ( c ) + SQR ( d ) ) ;
helper . Out . x = vr * ( a * c + b * d ) ;
helper . Out . y = vr * ( b * c - a * d ) ;
2016-01-04 19:50:15 -05:00
helper . Out . z = ( m_VarType = = eVariationType : : VARTYPE_REG ) ? 0 : helper . In . z ;
2014-07-08 03:11:14 -04:00
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string p = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string q = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string pa = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string r = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t temp = MwcNext(mwc) * " < < pa < < " ; \n "
< < " \t \t real_t sina = sin(temp); \n "
< < " \t \t real_t cosa = cos(temp); \n "
< < " \t \t real_t re = " < < r < < " * cosa; \n "
< < " \t \t real_t im = " < < r < < " * sina; \n "
< < " \t \t real_t a = vIn.x + re; \n "
< < " \t \t real_t b = vIn.y - im; \n "
< < " \t \t real_t c = re * vIn.x - im * vIn.y + 1; \n "
< < " \t \t real_t d = re * vIn.y + im * vIn.x; \n "
< < " \t \t real_t vr = xform->m_VariationWeights[ " < < varIndex < < " ] / (SQR(c) + SQR(d)); \n "
< < " \n "
< < " \t \t vOut.x = vr * (a * c + b * d); \n "
< < " \t \t vOut.y = vr * (b * c - a * d); \n "
2016-01-04 19:50:15 -05:00
< < " \t \t vOut.z = " < < ( ( m_VarType = = eVariationType : : VARTYPE_REG ) ? " 0 " : " vIn.z " ) < < " ; \n "
2014-07-08 03:11:14 -04:00
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
T r2 = 1 - ( std : : cos ( 2 * T ( M_PI ) / m_P ) - 1 ) /
2016-01-12 23:42:12 -05:00
( std : : cos ( 2 * T ( M_PI ) / m_P ) + std : : cos ( 2 * T ( M_PI ) / m_Q ) ) ;
2014-07-08 03:11:14 -04:00
if ( r2 > 0 )
2015-04-13 07:32:58 -04:00
m_R = 1 / std : : sqrt ( r2 ) ;
2014-07-08 03:11:14 -04:00
else
m_R = 1 ;
m_Pa = 2 * T ( M_PI ) / m_P ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_P , prefix + " hypertile1_p " , 3 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Q , prefix + " hypertile1_q " , 7 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_Pa , prefix + " hypertile1_pa " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_R , prefix + " hypertile1_r " ) ) ;
}
private :
T m_P ;
T m_Q ;
T m_Pa ; //Precalc.
T m_R ;
} ;
/// <summary>
/// Hypertile2.
/// </summary>
template < typename T >
class EMBER_API Hypertile2Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Hypertile2Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " hypertile2 " , eVariationId : : VAR_HYPERTILE2 , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Hypertile2Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T a = helper . In . x + m_R ;
T b = helper . In . y ;
T c = m_R * helper . In . x + 1 ;
T d = m_R * helper . In . y ;
T x = ( a * c + b * d ) ;
T y = ( b * c - a * d ) ;
T vr = m_Weight / ( SQR ( c ) + SQR ( d ) ) ;
T temp = rand . Rand ( ) * m_Pa ;
--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.
2015-11-22 17:15:07 -05:00
T sina = std : : sin ( temp ) ;
T cosa = std : : cos ( temp ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = vr * ( x * cosa + y * sina ) ;
helper . Out . y = vr * ( y * cosa - x * sina ) ;
2016-01-04 19:50:15 -05:00
helper . Out . z = ( m_VarType = = eVariationType : : VARTYPE_REG ) ? 0 : helper . In . z ;
2014-07-08 03:11:14 -04:00
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string p = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string q = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string pa = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string r = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t a = vIn.x + " < < r < < " ; \n "
< < " \t \t real_t b = vIn.y; \n "
< < " \t \t real_t c = " < < r < < " * vIn.x + 1; \n "
< < " \t \t real_t d = " < < r < < " * vIn.y; \n "
< < " \t \t real_t x = (a * c + b * d); \n "
< < " \t \t real_t y = (b * c - a * d); \n "
< < " \t \t real_t vr = xform->m_VariationWeights[ " < < varIndex < < " ] / (SQR(c) + SQR(d)); \n "
< < " \t \t real_t temp = MwcNext(mwc) * " < < pa < < " ; \n "
< < " \t \t real_t sina = sin(temp); \n "
< < " \t \t real_t cosa = cos(temp); \n "
< < " \n "
< < " \t \t vOut.x = vr * (x * cosa + y * sina); \n "
< < " \t \t vOut.y = vr * (y * cosa - x * sina); \n "
2016-01-04 19:50:15 -05:00
< < " \t \t vOut.z = " < < ( ( m_VarType = = eVariationType : : VARTYPE_REG ) ? " 0 " : " vIn.z " ) < < " ; \n "
2014-07-08 03:11:14 -04:00
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
T r2 = 1 - ( std : : cos ( 2 * T ( M_PI ) / m_P ) - 1 ) /
2016-01-12 23:42:12 -05:00
( std : : cos ( 2 * T ( M_PI ) / m_P ) + std : : cos ( 2 * T ( M_PI ) / m_Q ) ) ;
2014-07-08 03:11:14 -04:00
if ( r2 > 0 )
2015-04-13 07:32:58 -04:00
m_R = 1 / std : : sqrt ( r2 ) ;
2014-07-08 03:11:14 -04:00
else
m_R = 1 ;
m_Pa = 2 * T ( M_PI ) / m_P ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_P , prefix + " hypertile2_p " , 3 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Q , prefix + " hypertile2_q " , 7 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_Pa , prefix + " hypertile2_pa " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_R , prefix + " hypertile2_r " ) ) ;
}
private :
T m_P ;
T m_Q ;
T m_Pa ; //Precalc.
T m_R ;
} ;
/// <summary>
/// Hypertile3D.
/// </summary>
template < typename T >
class EMBER_API Hypertile3DVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Hypertile3DVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " hypertile3D " , eVariationId : : VAR_HYPERTILE3D , weight , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Hypertile3DVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T r2 = helper . m_PrecalcSumSquares + helper . In . z ;
T x2cx = m_C2x * helper . In . x ;
T y2cy = m_C2y * helper . In . y ;
T d = m_Weight / ( m_C2 * r2 + x2cx - y2cy + 1 ) ;
helper . Out . x = d * ( helper . In . x * m_S2x - m_Cx * ( y2cy - r2 - 1 ) ) ;
helper . Out . y = d * ( helper . In . y * m_S2y + m_Cy * ( - x2cx - r2 - 1 ) ) ;
helper . Out . z = d * ( helper . In . z * m_S2z ) ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string p = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string q = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string n = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cz = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2y = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2z = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2y = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2z = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t r2 = precalcSumSquares + vIn.z; \n "
< < " \t \t real_t x2cx = " < < c2x < < " * vIn.x; \n "
< < " \t \t real_t y2cy = " < < c2y < < " * vIn.y; \n "
< < " \t \t real_t d = xform->m_VariationWeights[ " < < varIndex < < " ] / ( " < < c2 < < " * r2 + x2cx - y2cy + 1); \n "
< < " \n "
< < " \t \t vOut.x = d * (vIn.x * " < < s2x < < " - " < < cx < < " * ( y2cy - r2 - 1)); \n "
< < " \t \t vOut.y = d * (vIn.y * " < < s2y < < " + " < < cy < < " * (-x2cx - r2 - 1)); \n "
< < " \t \t vOut.z = d * (vIn.z * " < < s2z < < " ); \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
T pa = 2 * T ( M_PI ) / m_P ;
T qa = 2 * T ( M_PI ) / m_Q ;
--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.
2015-11-22 17:15:07 -05:00
T r = - ( std : : cos ( pa ) - 1 ) / ( std : : cos ( pa ) + std : : cos ( qa ) ) ;
2014-07-08 03:11:14 -04:00
T na = m_N * pa ;
if ( r > 0 )
2015-04-13 07:32:58 -04:00
r = 1 / std : : sqrt ( 1 + r ) ;
2014-07-08 03:11:14 -04:00
else
r = 1 ;
--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.
2015-11-22 17:15:07 -05:00
m_Cx = r * std : : cos ( na ) ;
m_Cy = r * std : : sin ( na ) ;
2014-07-08 03:11:14 -04:00
m_C2 = SQR ( m_Cx ) + SQR ( m_Cy ) ;
m_C2x = 2 * m_Cx ;
m_C2y = 2 * m_Cy ;
m_S2x = 1 + SQR ( m_Cx ) - SQR ( m_Cy ) ;
m_S2y = 1 + SQR ( m_Cy ) - SQR ( m_Cx ) ;
m_S2z = 1 - SQR ( m_Cy ) - SQR ( m_Cx ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_P , prefix + " hypertile3D_p " , 3 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Q , prefix + " hypertile3D_q " , 7 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_N , prefix + " hypertile3D_n " , 0 , eParamType : : INTEGER ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_Cx , prefix + " hypertile3D_cx " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Cy , prefix + " hypertile3D_cy " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Cz , prefix + " hypertile3D_cz " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2x , prefix + " hypertile3D_s2x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2y , prefix + " hypertile3D_s2y " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2z , prefix + " hypertile3D_s2z " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2x , prefix + " hypertile3D_c2x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2y , prefix + " hypertile3D_c2y " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2z , prefix + " hypertile3D_c2z " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2 , prefix + " hypertile3D_c2 " ) ) ;
}
private :
T m_P ;
T m_Q ;
T m_N ;
T m_Cx ; //Precalc.
T m_Cy ;
T m_Cz ;
T m_S2x ;
T m_S2y ;
T m_S2z ;
T m_C2x ;
T m_C2y ;
T m_C2z ;
T m_C2 ;
} ;
/// <summary>
/// Hypertile3D1.
/// </summary>
template < typename T >
class EMBER_API Hypertile3D1Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Hypertile3D1Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " hypertile3D1 " , eVariationId : : VAR_HYPERTILE3D1 , weight , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Hypertile3D1Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T temp = rand . Rand ( ) * m_Pa ;
--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.
2015-11-22 17:15:07 -05:00
T cx = m_R * std : : cos ( temp ) ;
T cy = m_R * std : : sin ( temp ) ;
2014-07-08 03:11:14 -04:00
T s2x = 1 + SQR ( cx ) - SQR ( cy ) ;
T s2y = 1 + SQR ( cy ) - SQR ( cx ) ;
T r2 = helper . m_PrecalcSumSquares + SQR ( helper . In . z ) ;
T x2cx = 2 * cx * helper . In . x ;
T y2cy = 2 * cy * helper . In . x ;
T d = m_Weight / ( m_C2 * r2 + x2cx - y2cy + 1 ) ;
helper . Out . x = d * ( helper . In . x * s2x - cx * ( y2cy - r2 - 1 ) ) ;
helper . Out . y = d * ( helper . In . y * s2y + cy * ( - x2cx - r2 - 1 ) ) ;
helper . Out . z = d * ( helper . In . z * m_S2z ) ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string p = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string q = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string pa = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string r = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2z = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t temp = MwcNext(mwc) * " < < pa < < " ; \n "
< < " \t \t real_t cx = " < < r < < " * cos(temp); \n "
< < " \t \t real_t cy = " < < r < < " * sin(temp); \n "
< < " \t \t real_t s2x = 1 + SQR(cx) - SQR(cy); \n "
< < " \t \t real_t s2y = 1 + SQR(cy) - SQR(cx); \n "
< < " \t \t real_t r2 = precalcSumSquares + SQR(vIn.z); \n "
< < " \t \t real_t x2cx = 2 * cx * vIn.x; \n "
< < " \t \t real_t y2cy = 2 * cy * vIn.x; \n "
< < " \t \t real_t d = xform->m_VariationWeights[ " < < varIndex < < " ] / ( " < < c2 < < " * r2 + x2cx - y2cy + 1); \n "
< < " \n "
< < " \t \t vOut.x = d * (vIn.x * s2x - cx * ( y2cy - r2 - 1)); \n "
< < " \t \t vOut.y = d * (vIn.y * s2y + cy * (-x2cx - r2 - 1)); \n "
< < " \t \t vOut.z = d * (vIn.z * " < < s2z < < " ); \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
T pa = M_2PI / m_P ;
T qa = M_2PI / m_Q ;
--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.
2015-11-22 17:15:07 -05:00
T r = - ( std : : cos ( pa ) - 1 ) / ( std : : cos ( pa ) + std : : cos ( qa ) ) ;
2014-07-08 03:11:14 -04:00
if ( r > 0 )
2015-04-13 07:32:58 -04:00
r = 1 / std : : sqrt ( 1 + r ) ;
2014-07-08 03:11:14 -04:00
else
r = 1 ;
m_Pa = pa ;
m_R = r ;
m_C2 = SQR ( r ) ;
m_S2z = 1 - m_C2 ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_P , prefix + " hypertile3D1_p " , 3 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Q , prefix + " hypertile3D1_q " , 7 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_Pa , prefix + " hypertile3D1_pa " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_R , prefix + " hypertile3D1_r " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2 , prefix + " hypertile3D1_c2 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2z , prefix + " hypertile3D1_s2z " ) ) ;
}
private :
T m_P ;
T m_Q ;
T m_Pa ; //Precalc.
T m_R ;
T m_C2 ;
T m_S2z ;
} ;
/// <summary>
/// Hypertile3D2.
/// </summary>
template < typename T >
class EMBER_API Hypertile3D2Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Hypertile3D2Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " hypertile3D2 " , eVariationId : : VAR_HYPERTILE3D2 , weight , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Hypertile3D2Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T r2 = helper . m_PrecalcSumSquares + SQR ( helper . In . z ) ;
T x2cx = m_C2x * helper . In . x ;
T x = helper . In . x * m_S2x - m_Cx * ( - r2 - 1 ) ;
T y = helper . In . y * m_S2y ;
T vr = m_Weight / ( m_C2 * r2 + x2cx + 1 ) ;
T temp = rand . Rand ( ) * m_Pa ;
--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.
2015-11-22 17:15:07 -05:00
T sina = std : : sin ( temp ) ;
T cosa = std : : cos ( temp ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = vr * ( x * cosa + y * sina ) ;
helper . Out . y = vr * ( y * cosa - x * sina ) ;
helper . Out . z = vr * ( helper . In . z * m_S2z ) ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string p = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string q = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string pa = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2y = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2z = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t r2 = precalcSumSquares + SQR(vIn.z); \n "
< < " \t \t real_t x2cx = " < < c2x < < " * vIn.x; \n "
< < " \t \t real_t x = vIn.x * " < < s2x < < " - " < < cx < < " * (-r2 - 1); \n "
< < " \t \t real_t y = vIn.y * " < < s2y < < " ; \n "
< < " \t \t real_t vr = xform->m_VariationWeights[ " < < varIndex < < " ] / ( " < < c2 < < " * r2 + x2cx + 1); \n "
< < " \t \t real_t temp = MwcNext(mwc) * " < < pa < < " ; \n "
< < " \t \t real_t sina = sin(temp); \n "
< < " \t \t real_t cosa = cos(temp); \n "
< < " \n "
< < " \t \t vOut.x = vr * (x * cosa + y * sina); \n "
< < " \t \t vOut.y = vr * (y * cosa - x * sina); \n "
< < " \t \t vOut.z = vr * (vIn.z * " < < s2z < < " ); \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
T pa = M_2PI / m_P ;
T qa = M_2PI / m_Q ;
--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.
2015-11-22 17:15:07 -05:00
T r = - ( std : : cos ( pa ) - 1 ) / ( std : : cos ( pa ) + std : : cos ( qa ) ) ;
2014-07-08 03:11:14 -04:00
if ( r > 0 )
2015-04-13 07:32:58 -04:00
r = 1 / std : : sqrt ( 1 + r ) ;
2014-07-08 03:11:14 -04:00
else
r = 1 ;
m_Pa = pa ;
m_Cx = r ;
m_C2 = SQR ( m_Cx ) ;
m_C2x = 2 * m_Cx ;
m_S2x = 1 + SQR ( m_Cx ) ;
m_S2y = 1 - SQR ( m_Cx ) ;
m_S2z = 1 - SQR ( m_Cx ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_P , prefix + " hypertile3D2_p " , 3 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Q , prefix + " hypertile3D2_q " , 7 , eParamType : : INTEGER , 3 , T ( 0x7fffffff ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_Pa , prefix + " hypertile3D2_pa " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Cx , prefix + " hypertile3D2_cx " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2 , prefix + " hypertile3D2_c2 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2x , prefix + " hypertile3D2_c2x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2x , prefix + " hypertile3D2_s2x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2y , prefix + " hypertile3D2_s2y " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2z , prefix + " hypertile3D2_s2z " ) ) ;
}
private :
T m_P ;
T m_Q ;
T m_Pa ; //Precalc.
T m_Cx ;
T m_C2 ;
T m_C2x ;
T m_S2x ;
T m_S2y ;
T m_S2z ;
} ;
/// <summary>
/// IDisc.
/// </summary>
template < typename T >
class EMBER_API IDiscVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
IDiscVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " idisc " , eVariationId : : VAR_IDISC , weight , true , true , false , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( IDiscVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T a = T ( M_PI ) / ( helper . m_PrecalcSqrtSumSquares + 1 ) ;
--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.
2015-11-22 17:15:07 -05:00
T s = std : : sin ( a ) ;
T c = std : : cos ( a ) ;
2014-07-08 03:11:14 -04:00
T r = helper . m_PrecalcAtanyx * m_V ;
helper . Out . x = r * c ;
helper . Out . y = r * s ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string v = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ; //Precalcs only, no params.
ss < < " \t { \n "
< < " \t \t real_t a = M_PI / (precalcSqrtSumSquares + 1); \n "
< < " \t \t real_t s = sin(a); \n "
< < " \t \t real_t c = cos(a); \n "
< < " \t \t real_t r = precalcAtanyx * " < < v < < " ; \n "
< < " \n "
< < " \t \t vOut.x = r * c; \n "
< < " \t \t vOut.y = r * s; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_V = m_Weight * T ( M_1_PI ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_V , prefix + " idisc_v " ) ) ; //Precalcs only, no params.
}
private :
T m_V ; //Precalcs only, no params.
} ;
/// <summary>
/// Julian2.
/// </summary>
template < typename T >
class EMBER_API Julian2Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Julian2Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " julian2 " , eVariationId : : VAR_JULIAN2 , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Julian2Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
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 ;
2014-12-07 02:51:44 -05:00
T angle = ( atan2 ( y , x ) + M_2PI * rand . Rand ( int ( m_AbsN ) ) ) / m_Power ;
--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.
2015-11-22 17:15:07 -05:00
T sina = std : : sin ( angle ) ;
T cosa = std : : cos ( angle ) ;
T r = m_Weight * std : : pow ( SQR ( x ) + SQR ( y ) , m_Cn ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = r * cosa ;
helper . Out . y = r * sina ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string a = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string b = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string d = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string e = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string f = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string power = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string dist = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string absn = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cn = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t x = " < < a < < " * vIn.x + " < < b < < " * vIn.y + " < < e < < " ; \n "
< < " \t \t real_t y = " < < c < < " * vIn.x + " < < d < < " * vIn.y + " < < f < < " ; \n "
< < " \t \t real_t angle = (atan2(y, x) + M_2PI * MwcNextRange(mwc, (uint) " < < absn < < " )) / " < < power < < " ; \n "
< < " \t \t real_t sina = sin(angle); \n "
< < " \t \t real_t cosa = cos(angle); \n "
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] * pow(SQR(x) + SQR(y), " < < cn < < " ); \n "
< < " \n "
< < " \t \t vOut.x = r * cosa; \n "
< < " \t \t vOut.y = r * sina; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
if ( m_Power = = 0 )
m_Power = 2 ;
2014-12-07 02:51:44 -05:00
m_AbsN = T ( int ( abs ( m_Power ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Cn = m_Dist / m_Power / 2 ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_A , prefix + " julian2_a " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_B , prefix + " julian2_b " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_C , prefix + " julian2_c " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_D , prefix + " julian2_d " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_E , prefix + " julian2_e " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_F , prefix + " julian2_f " ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_Power , prefix + " julian2_power " , 2 , eParamType : : INTEGER_NONZERO ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( & m_Dist , prefix + " julian2_dist " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_AbsN , prefix + " julian2_absn " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Cn , prefix + " julian2_cn " ) ) ;
}
private :
T m_A ;
T m_B ;
T m_C ;
T m_D ;
T m_E ;
T m_F ;
T m_Power ;
T m_Dist ;
T m_AbsN ; //Precalc.
T m_Cn ;
} ;
/// <summary>
/// JuliaQ.
/// </summary>
template < typename T >
class EMBER_API JuliaQVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
JuliaQVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " juliaq " , eVariationId : : VAR_JULIAQ , weight , true , false , false , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( JuliaQVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T a = helper . m_PrecalcAtanyx * m_InvPower + rand . Rand ( ) * m_InvPower2pi ;
--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.
2015-11-22 17:15:07 -05:00
T sina = std : : sin ( a ) ;
T cosa = std : : cos ( a ) ;
T r = m_Weight * std : : pow ( helper . m_PrecalcSumSquares , m_HalfInvPower ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = r * cosa ;
helper . Out . y = r * sina ;
2016-01-04 19:50:15 -05:00
helper . Out . z = ( m_VarType = = eVariationType : : VARTYPE_REG ) ? 0 : helper . In . z ;
2014-07-08 03:11:14 -04:00
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string power = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string divisor = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string halfInvPower = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string invPower = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string invPower2Pi = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t a = precalcAtanyx * " < < invPower < < " + MwcNext(mwc) * " < < invPower2Pi < < " ; \n "
< < " \t \t real_t sina = sin(a); \n "
< < " \t \t real_t cosa = cos(a); \n "
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] * pow(precalcSumSquares, " < < halfInvPower < < " ); \n "
< < " \n "
< < " \t \t vOut.x = r * cosa; \n "
< < " \t \t vOut.y = r * sina; \n "
2016-01-04 19:50:15 -05:00
< < " \t \t vOut.z = " < < ( ( m_VarType = = eVariationType : : VARTYPE_REG ) ? " 0 " : " vIn.z " ) < < " ; \n "
2014-07-08 03:11:14 -04:00
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_HalfInvPower = T ( 0.5 ) * m_Divisor / m_Power ;
m_InvPower = m_Divisor / m_Power ;
m_InvPower2pi = M_2PI / m_Power ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_Power , prefix + " juliaq_power " , 3 , eParamType : : INTEGER_NONZERO ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Divisor , prefix + " juliaq_divisor " , 2 , eParamType : : INTEGER_NONZERO ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_HalfInvPower , prefix + " juliaq_half_inv_power " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_InvPower , prefix + " juliaq_inv_power " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_InvPower2pi , prefix + " juliaq_inv_power_2pi " ) ) ;
}
private :
T m_Power ;
T m_Divisor ;
T m_HalfInvPower ; //Precalc.
T m_InvPower ;
T m_InvPower2pi ;
} ;
/// <summary>
/// Murl.
/// </summary>
template < typename T >
class EMBER_API MurlVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
MurlVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " murl " , eVariationId : : VAR_MURL , weight , true , false , false , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( MurlVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T angle = helper . m_PrecalcAtanyx * m_Power ;
--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.
2015-11-22 17:15:07 -05:00
T sina = std : : sin ( angle ) ;
T cosa = std : : cos ( angle ) ;
T r = m_Cp * std : : pow ( helper . m_PrecalcSumSquares , m_P2 ) ;
2014-07-08 03:11:14 -04:00
T re = r * cosa + 1 ;
T im = r * sina ;
T r1 = m_Vp / ( SQR ( re ) + SQR ( im ) ) ;
helper . Out . x = r1 * ( helper . In . x * re + helper . In . y * im ) ;
helper . Out . y = r1 * ( helper . In . y * re - helper . In . x * im ) ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string c = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string power = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cp = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string p2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string vp = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t angle = precalcAtanyx * " < < power < < " ; \n "
< < " \t \t real_t sina = sin(angle); \n "
< < " \t \t real_t cosa = cos(angle); \n "
< < " \t \t real_t r = " < < cp < < " * pow(precalcSumSquares, " < < p2 < < " ); \n "
< < " \t \t real_t re = r * cosa + 1; \n "
< < " \t \t real_t im = r * sina; \n "
< < " \t \t real_t r1 = " < < vp < < " / (SQR(re) + SQR(im)); \n "
< < " \n "
< < " \t \t vOut.x = r1 * (vIn.x * re + vIn.y * im); \n "
< < " \t \t vOut.y = r1 * (vIn.y * re - vIn.x * im); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
if ( m_Power ! = 1 )
m_Cp = m_C / ( m_Power - 1 ) ;
else
m_Cp = m_C ;
m_P2 = m_Power / 2 ;
m_Vp = m_Weight * ( m_Cp + 1 ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_C , prefix + " murl_c " ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_Power , prefix + " murl_power " , 2 , eParamType : : INTEGER , 2 , T ( 0x7fffffff ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_Cp , prefix + " murl_cp " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_P2 , prefix + " murl_p2 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Vp , prefix + " murl_vp " ) ) ;
}
private :
T m_C ;
T m_Power ;
T m_Cp ; //Precalc.
T m_P2 ;
T m_Vp ;
} ;
/// <summary>
/// Murl2.
/// </summary>
template < typename T >
class EMBER_API Murl2Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Murl2Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " murl2 " , eVariationId : : VAR_MURL2 , weight , true , false , false , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Murl2Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T angle = helper . m_PrecalcAtanyx * m_Power ;
--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.
2015-11-22 17:15:07 -05:00
T sina = std : : sin ( angle ) ;
T cosa = std : : cos ( angle ) ;
T r = m_C * std : : pow ( helper . m_PrecalcSumSquares , m_P2 ) ;
2014-07-08 03:11:14 -04:00
T re = r * cosa + 1 ;
T im = r * sina ;
--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.
2015-11-22 17:15:07 -05:00
r = std : : pow ( SQR ( re ) + SQR ( im ) , m_InvP ) ;
angle = std : : atan2 ( im , re ) * m_InvP2 ;
sina = std : : sin ( angle ) ;
cosa = std : : cos ( angle ) ;
2014-07-08 03:11:14 -04:00
re = r * cosa ;
im = r * sina ;
T r1 = m_Vp / SQR ( r ) ;
helper . Out . x = r1 * ( helper . In . x * re + helper . In . y * im ) ;
helper . Out . y = r1 * ( helper . In . y * re - helper . In . x * im ) ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string c = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string power = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string p2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string invp = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string invp2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string vp = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t angle = precalcAtanyx * " < < power < < " ; \n "
< < " \t \t real_t sina = sin(angle); \n "
< < " \t \t real_t cosa = cos(angle); \n "
< < " \t \t real_t r = " < < c < < " * pow(precalcSumSquares, " < < p2 < < " ); \n "
< < " \t \t real_t re = r * cosa + 1; \n "
< < " \t \t real_t im = r * sina; \n "
< < " \n "
< < " \t \t r = pow(SQR(re) + SQR(im), " < < invp < < " ); \n "
< < " \t \t angle = atan2(im, re) * " < < invp2 < < " ; \n "
< < " \t \t sina = sin(angle); \n "
< < " \t \t cosa = cos(angle); \n "
< < " \t \t re = r * cosa; \n "
< < " \t \t im = r * sina; \n "
< < " \n "
< < " \t \t real_t r1 = " < < vp < < " / SQR(r); \n "
< < " \n "
< < " \t \t vOut.x = r1 * (vIn.x * re + vIn.y * im); \n "
< < " \t \t vOut.y = r1 * (vIn.y * re - vIn.x * im); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_P2 = m_Power / 2 ;
m_InvP = 1 / m_Power ;
m_InvP2 = 2 / m_Power ;
if ( m_C = = - 1 )
m_Vp = 0 ;
else
--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.
2015-11-22 17:15:07 -05:00
m_Vp = m_Weight * std : : pow ( m_C + 1 , 2 / m_Power ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_C , prefix + " murl2_c " , 0 , eParamType : : REAL , - 1 , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Power , prefix + " murl2_power " , 1 , eParamType : : INTEGER_NONZERO ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_P2 , prefix + " murl2_p2 " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_InvP , prefix + " murl2_invp " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_InvP2 , prefix + " murl2_invp2 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Vp , prefix + " murl2_vp " ) ) ;
}
private :
T m_C ;
T m_Power ;
T m_P2 ; //Precalc.
T m_InvP ;
T m_InvP2 ;
T m_Vp ;
} ;
/// <summary>
/// NPolar.
/// </summary>
template < typename T >
class EMBER_API NPolarVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
NPolarVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " npolar " , eVariationId : : VAR_NPOLAR , weight , true , false , false , true , false )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( NPolarVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T x = ( m_IsOdd ! = 0 ) ? helper . In . x : m_Vvar * helper . m_PrecalcAtanxy ;
--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.
2015-11-22 17:15:07 -05:00
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 * std : : log ( SQR ( cosa ) + SQR ( sina ) ) ) ;
y = ( m_IsOdd ! = 0 ) ? sina : ( m_Vvar * std : : atan2 ( cosa , sina ) ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = x ;
helper . Out . y = y ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string parity = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string n = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string nnz = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string vvar = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string vvar2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string absn = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cn = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string isOdd = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t x = ( " < < isOdd < < " != 0) ? vIn.x : " < < vvar < < " * precalcAtanxy; \n "
< < " \t \t real_t y = ( " < < isOdd < < " != 0) ? vIn.y : " < < vvar2 < < " * log(precalcSumSquares); \n "
< < " \t \t real_t angle = (atan2(y, x) + M_2PI * MwcNextRange(mwc, (uint) " < < absn < < " )) / " < < nnz < < " ; \n "
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] * pow(SQR(x) + SQR(y), " < < cn < < " ) * (( " < < isOdd < < " == 0) ? 1 : " < < parity < < " ); \n "
< < " \t \t real_t sina = sin(angle) * r; \n "
< < " \t \t real_t cosa = cos(angle) * r; \n "
< < " \n "
< < " \t \t x = ( " < < isOdd < < " != 0) ? cosa : ( " < < vvar2 < < " * log(SQR(cosa) + SQR(sina))); \n "
< < " \t \t y = ( " < < isOdd < < " != 0) ? sina : ( " < < vvar < < " * atan2(cosa, sina)); \n "
< < " \t \t vOut.x = x; \n "
< < " \t \t vOut.y = y; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Nnz = ( m_N = = 0 ) ? 1 : m_N ;
m_Vvar = m_Weight / T ( M_PI ) ;
m_Vvar2 = m_Vvar * T ( 0.5 ) ;
m_AbsN = abs ( m_Nnz ) ;
m_Cn = 1 / m_Nnz / 2 ;
--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.
2015-11-22 17:15:07 -05:00
m_IsOdd = T ( abs ( int ( m_Parity ) ) & 1 ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_Parity , prefix + " npolar_parity " , 0 , eParamType : : INTEGER ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_N , prefix + " npolar_n " , 1 , eParamType : : INTEGER ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_Nnz , prefix + " npolar_nnz " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Vvar , prefix + " npolar_vvar " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Vvar2 , prefix + " npolar_vvar_2 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_AbsN , prefix + " npolar_absn " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Cn , prefix + " npolar_cn " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_IsOdd , prefix + " npolar_isodd " ) ) ;
}
private :
T m_Parity ;
T m_N ;
T m_Nnz ; //Precalc.
T m_Vvar ;
T m_Vvar2 ;
T m_AbsN ;
T m_Cn ;
T m_IsOdd ;
} ;
/// <summary>
/// Ortho.
/// </summary>
template < typename T >
class EMBER_API OrthoVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
OrthoVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " ortho " , eVariationId : : VAR_ORTHO , weight , true , false , false , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( OrthoVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T r , a ;
T xo ;
T ro ;
2016-01-12 23:42:12 -05:00
T c , s ;
2014-07-08 03:11:14 -04:00
T x , y , tc , ts ;
T theta ;
r = helper . m_PrecalcSumSquares ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( r < 1 )
{
if ( helper . In . x > = 0 )
{
xo = ( r + 1 ) / ( 2 * helper . In . x ) ;
2015-04-13 07:32:58 -04:00
ro = std : : sqrt ( SQR ( helper . In . x - xo ) + SQR ( helper . In . y ) ) ;
2014-09-01 00:25:15 -04:00
theta = atan2 ( T ( 1 ) , ro ) ;
2014-07-08 03:11:14 -04:00
a = fmod ( m_In * theta + atan2 ( helper . In . y , xo - helper . In . x ) + theta , 2 * theta ) - theta ;
sincos ( a , & s , & c ) ;
helper . Out . x = m_Weight * ( xo - c * ro ) ;
helper . Out . y = m_Weight * s * ro ;
}
else
{
xo = - ( r + 1 ) / ( 2 * helper . In . x ) ;
2015-04-13 07:32:58 -04:00
ro = std : : sqrt ( SQR ( - helper . In . x - xo ) + SQR ( helper . In . y ) ) ;
2014-09-01 00:25:15 -04:00
theta = atan2 ( T ( 1 ) , ro ) ;
2014-07-08 03:11:14 -04:00
a = fmod ( m_In * theta + atan2 ( helper . In . y , xo + helper . In . x ) + theta , 2 * theta ) - theta ;
sincos ( a , & s , & c ) ;
helper . Out . x = - ( m_Weight * ( xo - c * ro ) ) ;
helper . Out . y = m_Weight * s * ro ;
}
}
else
{
2015-04-13 07:32:58 -04:00
r = 1 / std : : sqrt ( r ) ;
--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.
2015-11-22 17:15:07 -05:00
ts = std : : sin ( helper . m_PrecalcAtanyx ) ;
tc = std : : cos ( helper . m_PrecalcAtanyx ) ;
2014-07-08 03:11:14 -04:00
x = r * tc ;
y = r * ts ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( x > = 0 )
{
xo = ( SQR ( x ) + SQR ( y ) + 1 ) / ( 2 * x ) ;
2015-04-13 07:32:58 -04:00
ro = std : : sqrt ( SQR ( x - xo ) + SQR ( y ) ) ;
--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.
2015-11-22 17:15:07 -05:00
theta = std : : atan2 ( T ( 1 ) , ro ) ;
2014-07-08 03:11:14 -04:00
a = fmod ( m_Out * theta + atan2 ( y , xo - x ) + theta , 2 * theta ) - theta ;
sincos ( a , & s , & c ) ;
x = ( xo - c * ro ) ;
y = s * ro ;
--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.
2015-11-22 17:15:07 -05:00
theta = std : : atan2 ( y , x ) ;
2014-07-08 03:11:14 -04:00
sincos ( theta , & ts , & tc ) ;
2015-04-13 07:32:58 -04:00
r = 1 / std : : sqrt ( SQR ( x ) + SQR ( y ) ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_Weight * r * tc ;
helper . Out . y = m_Weight * r * ts ;
}
else
{
xo = - ( SQR ( x ) + SQR ( y ) + 1 ) / ( 2 * x ) ;
2015-04-13 07:32:58 -04:00
ro = std : : sqrt ( SQR ( - x - xo ) + SQR ( y ) ) ;
--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.
2015-11-22 17:15:07 -05:00
theta = std : : atan2 ( T ( 1 ) , ro ) ;
a = fmod ( m_Out * theta + std : : atan2 ( y , xo + x ) + theta , 2 * theta ) - theta ;
2014-07-08 03:11:14 -04:00
sincos ( a , & s , & c ) ;
x = ( xo - c * ro ) ;
y = s * ro ;
--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.
2015-11-22 17:15:07 -05:00
theta = std : : atan2 ( y , x ) ;
2014-07-08 03:11:14 -04:00
sincos ( theta , & ts , & tc ) ;
2015-04-13 07:32:58 -04:00
r = 1 / std : : sqrt ( SQR ( x ) + SQR ( y ) ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = - ( m_Weight * r * tc ) ;
helper . Out . y = m_Weight * r * ts ;
}
}
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string in = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string out = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t r, a; \n "
< < " \t \t real_t xo; \n "
< < " \t \t real_t ro; \n "
< < " \t \t real_t c,s; \n "
< < " \t \t real_t x, y, tc, ts; \n "
< < " \t \t real_t theta; \n "
< < " \n "
< < " \t \t r = precalcSumSquares; \n "
< < " \n "
< < " \t \t if (r < 1) \n "
< < " \t \t { \n "
< < " \t \t if (vIn.x >= 0) \n "
< < " \t \t { \n "
< < " \t \t xo = (r + 1) / (2 * vIn.x); \n "
< < " \t \t ro = sqrt(SQR(vIn.x - xo) + SQR(vIn.y)); \n "
< < " \t \t theta = atan2(1, ro); \n "
< < " \t \t a = fmod( " < < in < < " * theta + atan2(vIn.y, xo - vIn.x) + theta, 2 * theta) - theta; \n "
< < " \t \t s = sin(a); \n "
< < " \t \t c = cos(a); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (xo - c * ro); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * s * ro; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t xo = - (r + 1) / (2 * vIn.x); \n "
< < " \t \t ro = sqrt(SQR(-vIn.x - xo) + SQR(vIn.y)); \n "
< < " \t \t theta = atan2(1 , ro); \n "
< < " \t \t a = fmod( " < < in < < " * theta + atan2(vIn.y, xo + vIn.x) + theta, 2 * theta) - theta; \n "
< < " \t \t s = sin(a); \n "
< < " \t \t c = cos(a); \n "
< < " \n "
< < " \t \t vOut.x = -(xform->m_VariationWeights[ " < < varIndex < < " ] * (xo - c * ro)); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * s * ro; \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t r = 1 / sqrt(r); \n "
< < " \t \t ts = sin(precalcAtanyx); \n "
< < " \t \t tc = cos(precalcAtanyx); \n "
< < " \t \t x = r * tc; \n "
< < " \t \t y = r * ts; \n "
< < " \n "
< < " \t \t if (x >= 0) \n "
< < " \t \t { \n "
< < " \t \t xo = (SQR(x) + SQR(y) + 1) / (2 * x); \n "
< < " \t \t ro = sqrt(SQR(x - xo) + SQR(y)); \n "
< < " \t \t theta = atan2(1 , ro); \n "
< < " \t \t a = fmod( " < < out < < " * theta + atan2(y, xo - x) + theta, 2 * theta) - theta; \n "
< < " \t \t s = sin(a); \n "
< < " \t \t c = cos(a); \n "
< < " \n "
< < " \t \t x = (xo - c * ro); \n "
< < " \t \t y = s * ro; \n "
< < " \t \t theta = atan2(y, x); \n "
< < " \t \t ts = sin(theta); \n "
< < " \t \t tc = cos(theta); \n "
< < " \t \t r = 1 / sqrt(SQR(x) + SQR(y)); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * r * tc; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * r * ts; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t xo = - (SQR(x) + SQR(y) + 1) / (2 * x); \n "
< < " \t \t ro = sqrt(SQR(-x - xo) + SQR(y)); \n "
< < " \t \t theta = atan2(1 , ro); \n "
< < " \t \t a = fmod( " < < out < < " * theta + atan2(y, xo + x) + theta, 2 * theta) - theta; \n "
< < " \t \t s = sin(a); \n "
< < " \t \t c = cos(a); \n "
< < " \n "
< < " \t \t x = (xo - c * ro); \n "
< < " \t \t y = s * ro; \n "
< < " \t \t theta = atan2(y, x); \n "
< < " \t \t ts = sin(theta); \n "
< < " \t \t tc = cos(theta); \n "
< < " \t \t r = 1 / sqrt(SQR(x) + SQR(y)); \n "
< < " \n "
< < " \t \t vOut.x = -(xform->m_VariationWeights[ " < < varIndex < < " ] * r * tc); \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * r * ts; \n "
< < " \t \t } \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_In , prefix + " ortho_in " , 0 , eParamType : : REAL_CYCLIC , T ( - M_PI ) , T ( M_PI ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Out , prefix + " ortho_out " , 0 , eParamType : : REAL_CYCLIC , T ( - M_PI ) , T ( M_PI ) ) ) ;
2014-07-08 03:11:14 -04:00
}
private :
T m_In ;
T m_Out ;
} ;
/// <summary>
/// Poincare.
/// </summary>
template < typename T >
class EMBER_API PoincareVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
PoincareVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " poincare " , eVariationId : : VAR_POINCARE , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( PoincareVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T x = m_C1x + ( SQR ( m_C1r ) * ( helper . In . x - m_C1x ) ) / ( SQR ( helper . In . x - m_C1x ) + SQR ( helper . In . y - m_C1y ) ) ;
T y = m_C1y + ( SQR ( m_C1r ) * ( helper . In . y - m_C1y ) ) / ( SQR ( helper . In . x - m_C1x ) + SQR ( helper . In . y - m_C1y ) ) ;
helper . Out . x = m_C2x + ( SQR ( m_C2r ) * ( x - m_C2x ) ) / ( SQR ( x - m_C2x ) + SQR ( y - m_C2y ) ) ;
helper . Out . y = m_C2y + ( SQR ( m_C2r ) * ( y - m_C2y ) ) / ( SQR ( x - m_C2x ) + SQR ( y - m_C2y ) ) ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string c1r = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c1a = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2r = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2a = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c1x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c1y = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2y = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c1d = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2d = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t x = " < < c1x < < " + (SQR( " < < c1r < < " ) * (vIn.x - " < < c1x < < " )) / (SQR(vIn.x - " < < c1x < < " ) + SQR(vIn.y - " < < c1y < < " )); \n "
< < " \t \t real_t y = " < < c1y < < " + (SQR( " < < c1r < < " ) * (vIn.y - " < < c1y < < " )) / (SQR(vIn.x - " < < c1x < < " ) + SQR(vIn.y - " < < c1y < < " )); \n "
< < " \n "
< < " \t \t vOut.x = " < < c2x < < " + (SQR( " < < c2r < < " ) * (x - " < < c2x < < " )) / (SQR(x - " < < c2x < < " ) + SQR(y - " < < c2y < < " )); \n "
< < " \t \t vOut.y = " < < c2y < < " + (SQR( " < < c2r < < " ) * (y - " < < c2y < < " )) / (SQR(x - " < < c2x < < " ) + SQR(y - " < < c2y < < " )); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
2015-04-13 07:32:58 -04:00
m_C1d = std : : sqrt ( 1 + SQR ( m_C1r ) ) ;
m_C2d = std : : sqrt ( 1 + SQR ( m_C2r ) ) ;
--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.
2015-11-22 17:15:07 -05:00
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 ) ) ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_C1r , prefix + " poincare_c1r " , 1 ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_C1a , prefix + " poincare_c1a " , - 1 , eParamType : : REAL_CYCLIC , T ( - M_PI ) , T ( M_PI ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( & m_C2r , prefix + " poincare_c2r " , 1 ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_C2a , prefix + " poincare_c2a " , 1 , eParamType : : REAL_CYCLIC , T ( - M_PI ) , T ( M_PI ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_C1x , prefix + " poincare_c1x " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_C1y , prefix + " poincare_c1y " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2x , prefix + " poincare_c2x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2y , prefix + " poincare_c2y " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C1d , prefix + " poincare_c1d " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2d , prefix + " poincare_c2d " ) ) ;
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
private :
T m_C1r ;
T m_C1a ;
T m_C2r ;
T m_C2a ;
T m_C1x ; //Precalc.
T m_C1y ;
T m_C2x ;
T m_C2y ;
T m_C1d ;
T m_C2d ;
} ;
/// <summary>
/// Poincare3D.
/// </summary>
template < typename T >
class EMBER_API Poincare3DVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Poincare3DVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " poincare3D " , eVariationId : : VAR_POINCARE3D , weight , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Poincare3DVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T r2 = helper . m_PrecalcSumSquares + SQR ( helper . In . z ) ;
T x2cx = m_C2x * helper . In . x ;
T y2cy = m_C2y * helper . In . y ;
T z2cz = m_C2z * helper . In . z ;
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
T val = Zeps ( m_C2 * r2 - x2cx - y2cy - z2cz + 1 ) ;
2014-07-08 03:11:14 -04:00
T d = m_Weight / val ;
helper . Out . x = d * ( helper . In . x * m_S2x + m_Cx * ( y2cy + z2cz - r2 - 1 ) ) ;
helper . Out . y = d * ( helper . In . y * m_S2y + m_Cy * ( x2cx + z2cz - r2 - 1 ) ) ;
helper . Out . z = d * ( helper . In . z * m_S2z + m_Cz * ( y2cy + x2cx - r2 - 1 ) ) ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string r = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string a = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string b = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cz = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2y = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c2z = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2x = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2y = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s2z = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t r2 = precalcSumSquares + SQR(vIn.z); \n "
< < " \t \t real_t x2cx = " < < c2x < < " * vIn.x; \n "
< < " \t \t real_t y2cy = " < < c2y < < " * vIn.y; \n "
< < " \t \t real_t z2cz = " < < c2z < < " * vIn.z; \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t val = Zeps( " < < c2 < < " * r2 - x2cx - y2cy - z2cz + (real_t)(1.0)); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t d = xform->m_VariationWeights[ " < < varIndex < < " ] / val; \n "
< < " \n "
2015-02-26 16:18:55 -05:00
< < " \t \t vOut.x = d * (vIn.x * " < < s2x < < " + " < < cx < < " * (y2cy + z2cz - r2 - (real_t)(1.0))); \n "
< < " \t \t vOut.y = d * (vIn.y * " < < s2y < < " + " < < cy < < " * (x2cx + z2cz - r2 - (real_t)(1.0))); \n "
< < " \t \t vOut.z = d * (vIn.z * " < < s2z < < " + " < < cz < < " * (y2cy + x2cx - r2 - (real_t)(1.0))); \n "
2014-07-08 03:11:14 -04:00
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Zeps " } ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
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 ) ) ;
2014-07-08 03:11:14 -04:00
m_C2 = SQR ( m_Cx ) + SQR ( m_Cy ) + SQR ( m_Cz ) ;
m_C2x = 2 * m_Cx ;
m_C2y = 2 * m_Cy ;
m_C2z = 2 * m_Cz ;
m_S2x = SQR ( m_Cx ) - SQR ( m_Cy ) - SQR ( m_Cz ) + 1 ;
m_S2y = SQR ( m_Cy ) - SQR ( m_Cx ) - SQR ( m_Cz ) + 1 ;
m_S2z = SQR ( m_Cz ) - SQR ( m_Cy ) - SQR ( m_Cx ) + 1 ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_R , prefix + " poincare3D_r " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_A , prefix + " poincare3D_a " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_B , prefix + " poincare3D_b " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Cx , prefix + " poincare3D_cx " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Cy , prefix + " poincare3D_cy " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Cz , prefix + " poincare3D_cz " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2 , prefix + " poincare3D_c2 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2x , prefix + " poincare3D_c2x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2y , prefix + " poincare3D_c2y " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_C2z , prefix + " poincare3D_c2z " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2x , prefix + " poincare3D_s2x " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2y , prefix + " poincare3D_s2y " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S2z , prefix + " poincare3D_s2z " ) ) ;
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
private :
T m_R ;
T m_A ;
T m_B ;
T m_Cx ; //Precalc.
T m_Cy ;
T m_Cz ;
T m_C2 ;
T m_C2x ;
T m_C2y ;
T m_C2z ;
T m_S2x ;
T m_S2y ;
T m_S2z ;
} ;
/// <summary>
/// Polynomial.
/// </summary>
template < typename T >
class EMBER_API PolynomialVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
PolynomialVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " polynomial " , eVariationId : : VAR_POLYNOMIAL , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( PolynomialVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
2016-01-12 23:42:12 -05:00
T xp = std : : pow ( std : : abs ( m_Weight ) * std : : abs ( helper . In . x ) , m_Powx ) ; //Original did not fabs.
T yp = std : : pow ( std : : abs ( m_Weight ) * std : : abs ( helper . In . y ) , m_Powy ) ;
2014-07-08 03:11:14 -04:00
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 ;
helper . Out . z = m_Weight * helper . In . z ;
}
2014-09-01 00:25:15 -04:00
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string powx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string powy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string lcx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string lcy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string scx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string scy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t xp = pow(fabs(xform->m_VariationWeights[ " < < varIndex < < " ]) * fabs(vIn.x), " < < powx < < " ); \n "
< < " \t \t real_t yp = pow(fabs(xform->m_VariationWeights[ " < < varIndex < < " ]) * fabs(vIn.y), " < < powy < < " ); \n "
< < " \t \t real_t zp = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \n "
< < " \t \t vOut.x = xp * Sign(vIn.x) + " < < lcx < < " * vIn.x + " < < scx < < " ; \n "
< < " \t \t vOut.y = yp * Sign(vIn.y) + " < < lcy < < " * vIn.y + " < < scy < < " ; \n "
< < " \t \t vOut.z = zp; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Powx , prefix + " polynomial_powx " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Powy , prefix + " polynomial_powy " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Lcx , prefix + " polynomial_lcx " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Lcy , prefix + " polynomial_lcy " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Scx , prefix + " polynomial_scx " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Scy , prefix + " polynomial_scy " ) ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Sign " } ;
}
2014-07-08 03:11:14 -04:00
private :
T m_Powx ;
T m_Powy ;
T m_Lcx ;
T m_Lcy ;
T m_Scx ;
T m_Scy ;
} ;
/// <summary>
/// PSphere.
/// </summary>
template < typename T >
class EMBER_API PSphereVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
PSphereVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " psphere " , eVariationId : : VAR_PSPHERE , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( PSphereVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T c0 = helper . In . x * m_Vpi ;
T c1 = helper . In . y * m_Vpi ;
T sinc0 , cosc0 , sinc1 , cosc1 ;
sincos ( c0 , & sinc0 , & cosc0 ) ;
sincos ( c1 , & sinc1 , & cosc1 ) ;
helper . Out . x = cosc0 * - sinc1 ;
helper . Out . y = sinc0 * cosc1 ;
helper . Out . z = cosc1 * m_ZScale ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-09-10 01:41:26 -04:00
int i = 0 ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string zscale = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string vpi = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t c0 = vIn.x * " < < vpi < < " ; \n "
< < " \t \t real_t c1 = vIn.y * " < < vpi < < " ; \n "
< < " \n "
< < " \t \t real_t sinc0 = sin(c0); \n "
< < " \t \t real_t cosc0 = cos(c0); \n "
< < " \t \t real_t sinc1 = sin(c1); \n "
< < " \t \t real_t cosc1 = cos(c1); \n "
< < " \n "
< < " \t \t vOut.x = cosc0 * -sinc1; \n "
< < " \t \t vOut.y = sinc0 * cosc1; \n "
< < " \t \t vOut.z = cosc1 * " < < zscale < < " ; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Vpi = m_Weight * T ( M_PI ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_ZScale , prefix + " psphere_zscale " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Vpi , prefix + " psphere_vpi " ) ) ; //Precalc.
}
private :
T m_ZScale ;
T m_Vpi ; //Precalc.
} ;
/// <summary>
/// Rational3.
/// </summary>
template < typename T >
class EMBER_API Rational3Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Rational3Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " rational3 " , eVariationId : : VAR_RATIONAL3 , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Rational3Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T xsqr = helper . In . x * helper . In . x ;
T ysqr = helper . In . y * helper . In . y ;
T xcb = helper . In . x * helper . In . x * helper . In . x ;
T ycb = helper . In . y * helper . In . y * helper . In . y ;
T tr = m_T3 * ( xcb - 3 * helper . In . x * ysqr ) + m_T2 * ( xsqr - ysqr ) + m_T1 * helper . In . x + m_Tc ;
T ti = m_T3 * ( 3 * xsqr * helper . In . y - ycb ) + m_T2 * 2 * helper . In . x * helper . In . y + m_T1 * helper . In . y ;
T br = m_B3 * ( xcb - 3 * helper . In . x * ysqr ) + m_B2 * ( xsqr - ysqr ) + m_B1 * helper . In . x + m_Bc ;
T bi = m_B3 * ( 3 * xsqr * helper . In . y - ycb ) + m_B2 * 2 * helper . In . x * helper . In . y + m_B1 * helper . In . y ;
T r3den = 1 / ( br * br + bi * bi ) ;
helper . Out . x = m_Weight * ( tr * br + ti * bi ) * r3den ;
helper . Out . y = m_Weight * ( ti * br - tr * bi ) * r3den ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string t3 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string t2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string t1 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string tc = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string b3 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string b2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string b1 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string bc = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t xsqr = vIn.x * vIn.x; \n "
< < " \t \t real_t ysqr = vIn.y * vIn.y; \n "
< < " \t \t real_t xcb = vIn.x * vIn.x * vIn.x; \n "
< < " \t \t real_t ycb = vIn.y * vIn.y * vIn.y; \n "
< < " \n "
< < " \t \t real_t tr = " < < t3 < < " * (xcb - 3 * vIn.x * ysqr) + " < < t2 < < " * (xsqr - ysqr) + " < < t1 < < " * vIn.x + " < < tc < < " ; \n "
< < " \t \t real_t ti = " < < t3 < < " * (3 * xsqr * vIn.y - ycb) + " < < t2 < < " * 2 * vIn.x * vIn.y + " < < t1 < < " * vIn.y; \n "
< < " \n "
< < " \t \t real_t br = " < < b3 < < " * (xcb - 3 * vIn.x * ysqr) + " < < b2 < < " * (xsqr - ysqr) + " < < b1 < < " * vIn.x + " < < bc < < " ; \n "
< < " \t \t real_t bi = " < < b3 < < " * (3 * xsqr * vIn.y - ycb) + " < < b2 < < " * 2 * vIn.x * vIn.y + " < < b1 < < " * vIn.y; \n "
< < " \n "
< < " \t \t real_t r3den = 1 / (br * br + bi * bi); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * (tr * br + ti * bi) * r3den; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * (ti * br - tr * bi) * r3den; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_T3 , prefix + " rational3_t3 " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_T2 , prefix + " rational3_t2 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_T1 , prefix + " rational3_t1 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Tc , prefix + " rational3_tc " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_B3 , prefix + " rational3_b3 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_B2 , prefix + " rational3_b2 " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_B1 , prefix + " rational3_b1 " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Bc , prefix + " rational3_bc " , 1 ) ) ;
}
private :
T m_T3 ;
T m_T2 ;
T m_T1 ;
T m_Tc ;
T m_B3 ;
T m_B2 ;
T m_B1 ;
T m_Bc ;
} ;
/// <summary>
/// Ripple.
/// </summary>
template < typename T >
class EMBER_API RippleVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
RippleVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " ripple " , eVariationId : : VAR_RIPPLE , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( RippleVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
//Align input x, y to given center and multiply with scale.
T x = ( helper . In . x * m_S ) - m_CenterX ;
T y = ( helper . In . y * m_S ) + m_CenterY ;
//Calculate distance from center but constrain it to EPS.
2015-04-13 07:32:58 -04:00
T d = std : : max ( EPS , std : : sqrt ( SQR ( x ) * SQR ( y ) ) ) ;
2014-07-08 03:11:14 -04:00
//Normalize x and y.
T nx = x / d ;
T ny = y / d ;
2014-09-01 00:25:15 -04:00
//Calculate cosine wave with given frequency, velocity
2014-07-08 03:11:14 -04:00
//and phase based on the distance to center.
--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.
2015-11-22 17:15:07 -05:00
T wave = std : : cos ( m_F * d - m_Vxp ) ;
2014-07-08 03:11:14 -04:00
//Calculate the wave offsets
T d1 = wave * m_Pxa + d ;
T d2 = wave * m_Pixa + d ;
//We got two offsets, so we also got two new positions (u,v).
T u1 = m_CenterX + nx * d1 ;
T v1 = - m_CenterY + ny * d1 ;
T u2 = m_CenterX + nx * d2 ;
T v2 = - m_CenterY + ny * d2 ;
//Interpolate the two positions by the given phase and
//invert the multiplication with scale from before.
helper . Out . x = m_Weight * Lerp < T > ( u1 , u2 , m_P ) * m_Is ; //Original did a direct assignment to outPoint, which is incompatible with Ember's design.
helper . Out . y = m_Weight * Lerp < T > ( v1 , v2 , m_P ) * m_Is ;
2016-01-04 19:50:15 -05:00
helper . Out . z = ( m_VarType = = eVariationType : : VARTYPE_REG ) ? 0 : helper . In . z ;
2014-07-08 03:11:14 -04:00
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string frequency = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string velocity = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string amplitude = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string centerx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string centery = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string phase = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string scale = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string f = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string a = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string p = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string s = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string is = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string vxp = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string pxa = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string pixa = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t x = (vIn.x * " < < s < < " ) - " < < centerx < < " ; \n "
< < " \t \t real_t y = (vIn.y * " < < s < < " ) + " < < centery < < " ; \n "
< < " \n "
< < " \t \t real_t d = max(EPS, sqrt(SQR(x) * SQR(y))); \n "
< < " \n "
< < " \t \t real_t nx = x / d; \n "
< < " \t \t real_t ny = y / d; \n "
< < " \n "
< < " \t \t real_t wave = cos( " < < f < < " * d - " < < vxp < < " ); \n "
< < " \n "
< < " \t \t real_t d1 = wave * " < < pxa < < " + d; \n "
< < " \t \t real_t d2 = wave * " < < pixa < < " + d; \n "
< < " \n "
< < " \t \t real_t u1 = " < < centerx < < " + nx * d1; \n "
< < " \t \t real_t v1 = - " < < centery < < " + ny * d1; \n "
< < " \t \t real_t u2 = " < < centerx < < " + nx * d2; \n "
< < " \t \t real_t v2 = - " < < centery < < " + ny * d2; \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * Lerp(u1, u2, " < < p < < " ) * " < < is < < " ; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * Lerp(v1, v2, " < < p < < " ) * " < < is < < " ; \n "
2016-01-04 19:50:15 -05:00
< < " \t \t vOut.z = " < < ( ( m_VarType = = eVariationType : : VARTYPE_REG ) ? " 0 " : " vIn.z " ) < < " ; \n "
2014-07-08 03:11:14 -04:00
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Lerp " } ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_F = m_Frequency * 5 ;
m_A = m_Amplitude * T ( 0.01 ) ;
m_P = m_Phase * M_2PI - T ( M_PI ) ;
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
m_S = Zeps ( m_Scale ) ; //Scale must not be zero.
2014-07-08 03:11:14 -04:00
m_Is = 1 / m_S ; //Need the inverse scale.
//Pre-multiply velocity + phase, phase + amplitude and (PI - phase) + amplitude.
m_Vxp = m_Velocity * m_P ;
m_Pxa = m_P * m_A ;
m_Pixa = ( T ( M_PI ) - m_P ) * m_A ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Frequency , prefix + " ripple_frequency " , 2 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Velocity , prefix + " ripple_velocity " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Amplitude , prefix + " ripple_amplitude " , T ( 0.5 ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_CenterX , prefix + " ripple_centerx " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_CenterY , prefix + " ripple_centery " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Phase , prefix + " ripple_phase " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Scale , prefix + " ripple_scale " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_F , prefix + " ripple_f " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_A , prefix + " ripple_a " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_P , prefix + " ripple_p " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_S , prefix + " ripple_s " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Is , prefix + " ripple_is " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Vxp , prefix + " ripple_vxp " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Pxa , prefix + " ripple_pxa " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Pixa , prefix + " ripple_pixa " ) ) ;
}
private :
T m_Frequency ;
T m_Velocity ;
T m_Amplitude ;
T m_CenterX ;
T m_CenterY ;
T m_Phase ;
T m_Scale ;
T m_F ; //Precalc.
T m_A ;
T m_P ;
T m_S ;
T m_Is ;
T m_Vxp ;
T m_Pxa ;
T m_Pixa ;
} ;
/// <summary>
/// Sigmoid.
/// </summary>
template < typename T >
class EMBER_API SigmoidVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
SigmoidVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " sigmoid " , eVariationId : : VAR_SIGMOID , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( SigmoidVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
T c0 = m_Ax / ( 1 + std : : exp ( m_Sx * helper . In . x ) ) ;
T c1 = m_Ay / ( 1 + std : : exp ( m_Sy * helper . In . y ) ) ;
2014-07-08 03:11:14 -04:00
T x = ( 2 * ( c0 - T ( 0.5 ) ) ) ;
T y = ( 2 * ( c1 - T ( 0.5 ) ) ) ;
helper . Out . x = m_Vv * x ;
helper . Out . y = m_Vv * y ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string shiftX = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string shiftY = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string sx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string sy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ax = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ay = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string vv = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t c0 = " < < ax < < " / (1 + exp( " < < sx < < " * vIn.x)); \n "
< < " \t \t real_t c1 = " < < ay < < " / (1 + exp( " < < sy < < " * vIn.y)); \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t x = (2 * (c0 - (real_t)(0.5))); \n "
< < " \t \t real_t y = (2 * (c1 - (real_t)(0.5))); \n "
2014-07-08 03:11:14 -04:00
< < " \n "
< < " \t \t vOut.x = " < < vv < < " * x; \n "
< < " \t \t vOut.y = " < < vv < < " * y; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Sx = m_ShiftX ;
m_Sy = m_ShiftY ;
m_Ax = 1 ;
m_Ay = 1 ;
if ( m_Sx < 1 & & m_Sx > - 1 )
{
if ( m_Sx = = 0 )
{
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
m_Sx = EPS ;
2014-07-08 03:11:14 -04:00
m_Ax = 1 ;
}
else
{
m_Ax = T ( m_Sx < 0 ? - 1 : 1 ) ;
m_Sx = 1 / m_Sx ;
}
}
if ( m_Sy < 1 & & m_Sy > - 1 )
{
if ( m_Sy = = 0 )
{
m_Sy = EPS ;
m_Ay = 1 ;
}
else
{
m_Ay = T ( m_Sy < 0 ? - 1 : 1 ) ;
m_Sy = 1 / m_Sy ;
}
}
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
m_Sx * = - 5 ;
m_Sy * = - 5 ;
2016-01-12 23:42:12 -05:00
m_Vv = std : : abs ( m_Weight ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_ShiftX , prefix + " sigmoid_shiftx " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_ShiftY , prefix + " sigmoid_shifty " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Sx , prefix + " sigmoid_sx " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Sy , prefix + " sigmoid_sy " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Ax , prefix + " sigmoid_ax " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Ay , prefix + " sigmoid_ay " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Vv , prefix + " sigmoid_vv " ) ) ;
}
private :
T m_ShiftX ;
T m_ShiftY ;
T m_Sx ; //Precalc.
T m_Sy ;
T m_Ax ;
T m_Ay ;
T m_Vv ;
} ;
/// <summary>
/// SinusGrid.
/// </summary>
template < typename T >
class EMBER_API SinusGridVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
SinusGridVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " sinusgrid " , eVariationId : : VAR_SINUS_GRID , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( SinusGridVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T x = helper . In . x ;
T y = helper . In . y ;
--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.
2015-11-22 17:15:07 -05:00
T sx = - 1 * std : : cos ( x * m_Fx ) ;
T sy = - 1 * std : : cos ( y * m_Fy ) ;
2014-07-08 03:11:14 -04:00
T tx = Lerp ( helper . In . x , sx , m_Ax ) ;
T ty = Lerp ( helper . In . y , sy , m_Ay ) ;
helper . Out . x = m_Weight * tx ;
helper . Out . y = m_Weight * ty ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string ampX = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ampY = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string freqX = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string freqY = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string fx = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string fy = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ax = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ay = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t x = vIn.x; \n "
< < " \t \t real_t y = vIn.y; \n "
< < " \t \t real_t sx = -1 * cos(x * " < < fx < < " ); \n "
< < " \t \t real_t sy = -1 * cos(y * " < < fy < < " ); \n "
< < " \t \t real_t tx = Lerp(vIn.x, sx, " < < ax < < " ); \n "
< < " \t \t real_t ty = Lerp(vIn.y, sy, " < < ay < < " ); \n "
< < " \t \t real_t tz = vIn.z; \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * tx; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * ty; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * tz; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Lerp " } ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Ax = m_AmpX ;
m_Ay = m_AmpY ;
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
m_Fx = Zeps ( m_FreqX * M_2PI ) ;
m_Fy = Zeps ( m_FreqY * M_2PI ) ;
2014-07-08 03:11:14 -04:00
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_AmpX , prefix + " sinusgrid_ampx " , T ( 0.5 ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_AmpY , prefix + " sinusgrid_ampy " , T ( 0.5 ) ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_FreqX , prefix + " sinusgrid_freqx " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_FreqY , prefix + " sinusgrid_freqy " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Fx , prefix + " sinusgrid_fx " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Fy , prefix + " sinusgrid_fy " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Ax , prefix + " sinusgrid_ax " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Ay , prefix + " sinusgrid_ay " ) ) ;
}
private :
T m_AmpX ;
T m_AmpY ;
T m_FreqX ;
T m_FreqY ;
T m_Fx ; //Precalc.
T m_Fy ;
T m_Ax ;
T m_Ay ;
} ;
/// <summary>
/// Stwin.
/// </summary>
template < typename T >
class EMBER_API StwinVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
StwinVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " stwin " , eVariationId : : VAR_STWIN , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( StwinVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
const T multiplier = T ( 0.05 ) ;
T x = helper . In . x * m_Weight * multiplier ;
T y = helper . In . y * m_Weight * multiplier ;
T x2 = SQR ( x ) ;
T y2 = SQR ( y ) ;
T xPlusy = x + y ;
T x2Minusy2 = x2 - y2 ;
T x2Plusy2 = x2 + y2 ;
--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.
2015-11-22 17:15:07 -05:00
T result = x2Minusy2 * std : : sin ( M_2PI * m_Distort * xPlusy ) ;
2014-07-08 03:11:14 -04:00
T divident = 1 ;
if ( x2Plusy2 ! = 0 )
divident = x2Plusy2 ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
result / = divident ;
helper . Out . x = m_Weight * helper . In . x + result ;
helper . Out . y = m_Weight * helper . In . y + result ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string distort = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t x = vIn.x * xform->m_VariationWeights[ " < < varIndex < < " ] * (real_t)(0.05); \n "
< < " \t \t real_t y = vIn.y * xform->m_VariationWeights[ " < < varIndex < < " ] * (real_t)(0.05); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t x2 = SQR(x); \n "
< < " \t \t real_t y2 = SQR(y); \n "
< < " \t \t real_t xPlusy = x + y; \n "
< < " \t \t real_t x2Minusy2 = x2 - y2; \n "
< < " \t \t real_t x2Plusy2 = x2 + y2; \n "
< < " \t \t real_t result = x2Minusy2 * sin(M_2PI * " < < distort < < " * xPlusy); \n "
< < " \t \t real_t divident = 1; \n "
< < " \n "
< < " \t \t if (x2Plusy2 != 0) \n "
< < " \t \t divident = x2Plusy2; \n "
< < " \n "
< < " \t \t result /= divident; \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.x + result; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.y + result; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Distort , prefix + " stwin_distort " , 1 ) ) ; //Original had a misspelling of swtin, which is incompatible with Ember's design.
}
private :
T m_Distort ;
} ;
/// <summary>
/// TwoFace.
/// </summary>
template < typename T >
class EMBER_API TwoFaceVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
TwoFaceVariation ( T weight = 1.0 ) : Variation < T > ( " twoface " , eVariationId : : VAR_TWO_FACE , weight , true ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( TwoFaceVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T r = m_Weight ;
if ( helper . In . x > 0 )
r / = helper . m_PrecalcSumSquares ;
helper . Out . x = r * helper . In . x ;
helper . Out . y = r * helper . In . y ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ]; \n "
< < " \n "
< < " \t \t if (vIn.x > 0) \n "
< < " \t \t r /= precalcSumSquares; \n "
< < " \n "
< < " \t \t vOut.x = r * vIn.x; \n "
< < " \t \t vOut.y = r * vIn.y; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
} ;
/// <summary>
/// Unpolar.
/// </summary>
template < typename T >
class EMBER_API UnpolarVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
UnpolarVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " unpolar " , eVariationId : : VAR_UNPOLAR , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( UnpolarVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
T r = std : : exp ( helper . In . y ) ;
T s = std : : sin ( helper . In . x ) ;
T c = std : : cos ( helper . In . x ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_Vvar2 * r * s ;
helper . Out . y = m_Vvar2 * r * c ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string vvar2 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ; //Precalcs only, no params.
ss < < " \t { \n "
< < " \t \t real_t r = exp(vIn.y); \n "
< < " \t \t real_t s = sin(vIn.x); \n "
< < " \t \t real_t c = cos(vIn.x); \n "
< < " \n "
< < " \t \t vOut.x = " < < vvar2 < < " * r * s; \n "
< < " \t \t vOut.y = " < < vvar2 < < " * r * c; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Vvar2 = ( m_Weight / T ( M_PI ) ) * T ( 0.5 ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Vvar2 , prefix + " unpolar_vvar_2 " ) ) ; //Precalcs only, no params.
}
private :
T m_Vvar2 ; //Precalcs only, no params.
} ;
/// <summary>
/// WavesN.
/// </summary>
template < typename T >
class EMBER_API WavesNVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
WavesNVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " wavesn " , eVariationId : : VAR_WAVESN , weight , true , false , false , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( WavesNVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
2014-12-07 02:51:44 -05:00
T angle = ( helper . m_PrecalcAtanyx + M_2PI * rand . Rand ( int ( m_AbsN ) ) ) / m_Power ;
--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.
2015-11-22 17:15:07 -05:00
T r = m_Weight * std : : pow ( helper . m_PrecalcSumSquares , m_Cn ) ;
T sina = std : : sin ( angle ) ;
T cosa = std : : cos ( angle ) ;
2014-07-08 03:11:14 -04:00
T xn = r * cosa ;
T yn = r * sina ;
--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.
2015-11-22 17:15:07 -05:00
T siny = std : : sin ( m_FreqX * yn ) ;
T sinx = std : : sin ( m_FreqY * xn ) ;
2016-01-12 23:42:12 -05:00
T dx = xn + T ( 0.5 ) * ( m_ScaleX * siny + std : : abs ( xn ) * m_IncX * siny ) ;
T dy = yn + T ( 0.5 ) * ( m_ScaleY * sinx + std : : abs ( yn ) * m_IncY * sinx ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_Weight * dx ;
helper . Out . y = m_Weight * dy ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string freqX = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string freqY = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string scaleX = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string scaleY = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string incX = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string incY = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string power = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string absn = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cn = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t angle = (precalcAtanyx + M_2PI * MwcNextRange(mwc, (uint) " < < absn < < " )) / " < < power < < " ; \n "
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] * pow(precalcSumSquares, " < < cn < < " ); \n "
< < " \t \t real_t sina = sin(angle); \n "
< < " \t \t real_t cosa = cos(angle); \n "
< < " \t \t real_t xn = r * cosa; \n "
< < " \t \t real_t yn = r * sina; \n "
< < " \t \t real_t siny = sin( " < < freqX < < " * yn); \n "
< < " \t \t real_t sinx = sin( " < < freqY < < " * xn); \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t dx = xn + (real_t)(0.5) * ( " < < scaleX < < " * siny + fabs(xn) * " < < incX < < " * siny); \n "
< < " \t \t real_t dy = yn + (real_t)(0.5) * ( " < < scaleY < < " * sinx + fabs(yn) * " < < incY < < " * sinx); \n "
2014-07-08 03:11:14 -04:00
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * dx; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * dy; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
if ( m_Power = = 0 )
m_Power = 2 ;
2016-01-12 23:42:12 -05:00
m_AbsN = T ( int ( std : : abs ( m_Power ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Cn = 1 / m_Power / 2 ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_FreqX , prefix + " wavesn_freqx " , 2 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_FreqY , prefix + " wavesn_freqy " , 2 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_ScaleX , prefix + " wavesn_scalex " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_ScaleY , prefix + " wavesn_scaley " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_IncX , prefix + " wavesn_incx " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_IncY , prefix + " wavesn_incy " ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_Power , prefix + " wavesn_power " , 1 , eParamType : : INTEGER_NONZERO ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_AbsN , prefix + " wavesn_absn " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Cn , prefix + " wavesn_cn " ) ) ;
}
private :
T m_FreqX ;
T m_FreqY ;
T m_ScaleX ;
T m_ScaleY ;
T m_IncX ;
T m_IncY ;
T m_Power ;
T m_AbsN ; //Precalc.
T m_Cn ;
} ;
/// <summary>
/// XHeart.
/// </summary>
template < typename T >
class EMBER_API XHeartVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
XHeartVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " xheart " , eVariationId : : VAR_XHEART , weight , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( XHeartVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T r2_4 = helper . m_PrecalcSumSquares + 4 ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( r2_4 = = 0 )
r2_4 = 1 ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
T bx = 4 / r2_4 ;
T by = m_Rat / r2_4 ;
T x = m_Cosa * ( bx * helper . In . x ) - m_Sina * ( by * helper . In . y ) ;
2016-01-12 23:42:12 -05:00
T y = m_Sina * ( bx * helper . In . x ) + m_Cosa * ( by * helper . In . y ) ;
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( x > 0 )
{
helper . Out . x = m_Weight * x ;
helper . Out . y = m_Weight * y ;
}
else
{
helper . Out . x = m_Weight * x ;
helper . Out . y = - m_Weight * y ;
}
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string angle = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ratio = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string cosa = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string sina = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string rat = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t r2_4 = precalcSumSquares + 4; \n "
< < " \n "
< < " \t \t if (r2_4 == 0) \n "
< < " \t \t r2_4 = 1; \n "
< < " \n "
< < " \t \t real_t bx = 4 / r2_4; \n "
< < " \t \t real_t by = " < < rat < < " / r2_4; \n "
< < " \t \t real_t x = " < < cosa < < " * (bx * vIn.x) - " < < sina < < " * (by * vIn.y); \n "
< < " \t \t real_t y = " < < sina < < " * (bx * vIn.x) + " < < cosa < < " * (by * vIn.y); \n "
< < " \n "
< < " \t \t if (x > 0) \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * x; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * y; \n "
< < " \t \t } \n "
< < " \t \t else \n "
< < " \t \t { \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * x; \n "
< < " \t \t vOut.y = -xform->m_VariationWeights[ " < < varIndex < < " ] * y; \n "
< < " \t \t } \n "
< < " \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
T ang = T ( M_PI_4 ) + ( T ( 0.5 ) * T ( M_PI_4 ) * m_Angle ) ;
sincos ( ang , & m_Sina , & m_Cosa ) ;
m_Rat = 6 + 2 * m_Ratio ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Angle , prefix + " xheart_angle " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Ratio , prefix + " xheart_ratio " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Cosa , prefix + " xheart_cosa " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_Sina , prefix + " xheart_sina " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Rat , prefix + " xheart_rat " ) ) ;
}
private :
T m_Angle ;
T m_Ratio ;
T m_Cosa ; //Precalc.
T m_Sina ;
T m_Rat ;
} ;
/// <summary>
/// Barycentroid.
/// </summary>
template < typename T >
class EMBER_API BarycentroidVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
BarycentroidVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " barycentroid " , eVariationId : : VAR_BARYCENTROID , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( BarycentroidVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
//Compute dot products.
T dot00 = SQR ( m_A ) + SQR ( m_B ) ; //v0 * v0.
T dot01 = m_A * m_C + m_B * m_D ; //v0 * v1.
T dot02 = m_A * helper . In . x + m_B * helper . In . y ; //v0 * v2.
T dot11 = SQR ( m_C ) + SQR ( m_D ) ; //v1 * v1.
T dot12 = m_C * helper . In . x + m_D * helper . In . y ; //v1 * v2.
//Compute inverse denomiator.
T invDenom = 1 / ( dot00 * dot11 - dot01 * dot01 ) ;
2014-09-01 00:25:15 -04:00
//Now we can pull [u,v] as the barycentric coordinates of the point
2014-07-08 03:11:14 -04:00
//P in the triangle [A, B, C].
T u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom ;
T v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom ;
// now combine with input
2015-04-13 07:32:58 -04:00
T um = std : : sqrt ( SQR ( u ) + SQR ( helper . In . x ) ) * Sign < T > ( u ) ;
T vm = std : : sqrt ( SQR ( v ) + SQR ( helper . In . y ) ) * Sign < T > ( v ) ;
2014-07-08 03:11:14 -04:00
helper . Out . x = m_Weight * um ;
helper . Out . y = m_Weight * vm ;
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string a = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string b = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string d = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t dot00 = SQR( " < < a < < " ) + SQR( " < < b < < " ); \n "
< < " \t \t real_t dot01 = " < < a < < " * " < < c < < " + " < < b < < " * " < < d < < " ; \n "
< < " \t \t real_t dot02 = " < < a < < " * vIn.x + " < < b < < " * vIn.y; \n "
< < " \t \t real_t dot11 = SQR( " < < c < < " ) + SQR( " < < d < < " ); \n "
< < " \t \t real_t dot12 = " < < c < < " * vIn.x + " < < d < < " * vIn.y; \n "
2015-02-26 16:18:55 -05:00
< < " \t \t real_t invDenom = (real_t)(1.0) / (dot00 * dot11 - dot01 * dot01); \n "
2014-07-08 03:11:14 -04:00
< < " \t \t real_t u = (dot11 * dot02 - dot01 * dot12) * invDenom; \n "
< < " \t \t real_t v = (dot00 * dot12 - dot01 * dot02) * invDenom; \n "
< < " \t \t real_t um = sqrt(SQR(u) + SQR(vIn.x)) * Sign(u); \n "
< < " \t \t real_t vm = sqrt(SQR(v) + SQR(vIn.y)) * Sign(v); \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * um; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * vm; \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Sign " } ;
}
2014-07-08 03:11:14 -04:00
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_A , prefix + " barycentroid_a " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_B , prefix + " barycentroid_b " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_C , prefix + " barycentroid_c " ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_D , prefix + " barycentroid_d " , 1 ) ) ;
}
private :
T m_A ;
T m_B ;
T m_C ;
T m_D ;
} ;
/// <summary>
/// BiSplit.
/// </summary>
template < typename T >
class EMBER_API BiSplitVariation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
BiSplitVariation ( T weight = 1.0 ) : ParametricVariation < T > ( " bisplit " , eVariationId : : VAR_BISPLIT , weight )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( BiSplitVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
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 ) ;
2014-07-08 03:11:14 -04:00
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string weight01 = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t vOut.x = " < < weight01 < < " / tan(vIn.x) * cos(vIn.y); \n "
< < " \t \t vOut.y = " < < weight01 < < " / sin(vIn.x) * (-vIn.y); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Weight01 = m_Weight * T ( 0.1 ) ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Weight01 , prefix + " bisplit_weight01 " ) ) ; //Precalc only.
}
private :
T m_Weight01 ;
} ;
/// <summary>
/// Crescents.
/// </summary>
template < typename T >
class EMBER_API CrescentsVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
CrescentsVariation ( T weight = 1.0 ) : Variation < T > ( " crescents " , eVariationId : : VAR_CRESCENTS , weight ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( CrescentsVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
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 ;
2014-07-08 03:11:14 -04:00
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
--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.
2015-11-22 17:15:07 -05:00
< < " \t \t real_t sinx = sin(vIn.x); \n "
< < " \t \t real_t sinx2 = SQR(sinx); \n "
< < " \t \t real_t cosx = cos(vIn.x); \n "
< < " \t \t real_t coshy1 = cosh(vIn.y) + 1.0; \n "
< < " \n "
< < " \t \t vOut.x = xform->m_VariationWeights[ " < < varIndex < < " ] * sinx * coshy1 * sinx2; \n "
< < " \t \t vOut.y = xform->m_VariationWeights[ " < < varIndex < < " ] * cosx * coshy1 * sinx2; \n "
2014-07-08 03:11:14 -04:00
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Sqr " } ;
}
2014-07-08 03:11:14 -04:00
} ;
/// <summary>
/// Mask.
/// </summary>
template < typename T >
class EMBER_API MaskVariation : public Variation < T >
{
public :
2016-01-04 19:50:15 -05:00
MaskVariation ( T weight = 1.0 ) : Variation < T > ( " mask " , eVariationId : : VAR_MASK , weight , true ) { }
2014-07-08 03:11:14 -04:00
VARCOPY ( MaskVariation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T d = m_Weight / helper . m_PrecalcSumSquares ;
--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.
2015-11-22 17:15:07 -05:00
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 * sinx * coshy1 * sinx2 ;
helper . Out . y = d * cosx * coshy1 * sinx2 ;
2014-07-08 03:11:14 -04:00
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss ;
2014-10-14 11:53:15 -04:00
intmax_t varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss < < " \t { \n "
< < " \t \t real_t d = xform->m_VariationWeights[ " < < varIndex < < " ] / precalcSumSquares; \n "
--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.
2015-11-22 17:15:07 -05:00
< < " \t \t real_t sinx = sin(vIn.x); \n "
< < " \t \t real_t sinx2 = SQR(sinx); \n "
< < " \t \t real_t cosx = cos(vIn.x); \n "
< < " \t \t real_t coshy1 = cosh(vIn.y) + 1.0; \n "
2014-07-08 03:11:14 -04:00
< < " \n "
--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.
2015-11-22 17:15:07 -05:00
< < " \t \t vOut.x = d * sinx * coshy1 * sinx2; \n "
< < " \t \t vOut.y = d * cosx * coshy1 * sinx2; \n "
2014-07-08 03:11:14 -04:00
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
--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.
2015-11-22 17:15:07 -05:00
virtual vector < string > OpenCLGlobalFuncNames ( ) const override
{
return vector < string > { " Sqr " } ;
}
2014-07-08 03:11:14 -04:00
} ;
/// <summary>
/// Cpow2.
/// </summary>
template < typename T >
class EMBER_API Cpow2Variation : public ParametricVariation < T >
{
public :
2016-01-04 19:50:15 -05:00
Cpow2Variation ( T weight = 1.0 ) : ParametricVariation < T > ( " cpow2 " , eVariationId : : VAR_CPOW2 , weight , true , false , false , false , true )
2014-07-08 03:11:14 -04:00
{
Init ( ) ;
}
PARVARCOPY ( Cpow2Variation )
2014-09-01 00:25:15 -04:00
virtual void Func ( IteratorHelper < T > & helper , Point < T > & outPoint , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override
2014-07-08 03:11:14 -04:00
{
T a = helper . m_PrecalcAtanyx ;
2014-12-07 02:51:44 -05:00
int n = rand . Rand ( uint ( m_Spread ) ) ;
2014-07-08 03:11:14 -04:00
if ( a < 0 )
n + + ;
a + = M_2PI * n ;
--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.
2015-11-22 17:15:07 -05:00
if ( std : : cos ( a * m_InvSpread ) < rand . Rand ( ) * 2 / 0xFFFFFFFF - 1 ) //Rand max.
2014-07-08 03:11:14 -04:00
a - = m_FullSpread ;
--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.
2015-11-22 17:15:07 -05:00
T lnr2 = std : : log ( helper . m_PrecalcSumSquares ) ;
T r = m_Weight * std : : exp ( m_HalfC * lnr2 - m_D * a ) ;
2014-07-08 03:11:14 -04:00
T temp = m_C * a + m_HalfD * lnr2 + m_Ang * rand . Rand ( ) ;
--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.
2015-11-22 17:15:07 -05:00
helper . Out . x = r * std : : cos ( temp ) ;
helper . Out . y = r * std : : sin ( temp ) ;
2014-07-08 03:11:14 -04:00
helper . Out . z = m_Weight * helper . In . z ;
}
2015-06-29 23:13:53 -04:00
virtual string OpenCLString ( ) const override
2014-07-08 03:11:14 -04:00
{
ostringstream ss , ss2 ;
2014-10-14 11:53:15 -04:00
intmax_t i = 0 , varIndex = IndexInXform ( ) ;
2014-07-08 03:11:14 -04:00
ss2 < < " _ " < < XformIndexInEmber ( ) < < " ] " ;
string index = ss2 . str ( ) ;
string r = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string a = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string divisor = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string spread = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string c = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string halfC = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string d = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string halfD = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string ang = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string invSpread = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
string fullSpread = " parVars[ " + ToUpper ( m_Params [ i + + ] . Name ( ) ) + index ;
ss < < " \t { \n "
< < " \t \t real_t a = precalcAtanyx; \n "
< < " \t \t int n = MwcNextRange(mwc, (uint) " < < spread < < " ); \n "
< < " \n "
< < " \t \t if (a < 0) \n "
< < " \t \t n++; \n "
< < " \n "
< < " \t \t a += M_2PI * n; \n "
< < " \n "
< < " \t \t if (cos(a * " < < invSpread < < " ) < MwcNext(mwc) * 2 / 0xFFFFFFFF - 1) \n "
< < " \t \t a -= " < < fullSpread < < " ; \n "
< < " \n "
< < " \t \t real_t lnr2 = log(precalcSumSquares); \n "
< < " \t \t real_t r = xform->m_VariationWeights[ " < < varIndex < < " ] * exp( " < < halfC < < " * lnr2 - " < < d < < " * a); \n "
< < " \t \t real_t temp = " < < c < < " * a + " < < halfD < < " * lnr2 + " < < ang < < " * MwcNext(mwc); \n "
< < " \n "
< < " \t \t vOut.x = r * cos(temp); \n "
< < " \t \t vOut.y = r * sin(temp); \n "
< < " \t \t vOut.z = xform->m_VariationWeights[ " < < varIndex < < " ] * vIn.z; \n "
< < " \t } \n " ;
return ss . str ( ) ;
}
2014-09-01 00:25:15 -04:00
virtual void Precalc ( ) override
2014-07-08 03:11:14 -04:00
{
m_Ang = M_2PI / m_Divisor ;
--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.
2015-11-22 17:15:07 -05:00
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 ;
2014-07-08 03:11:14 -04:00
m_HalfC = m_C / 2 ;
m_HalfD = m_D / 2 ;
m_InvSpread = T ( 0.5 ) / m_Spread ;
m_FullSpread = M_2PI * m_Spread ;
}
protected :
void Init ( )
{
string prefix = Prefix ( ) ;
m_Params . clear ( ) ;
m_Params . push_back ( ParamWithName < T > ( & m_R , prefix + " cpow2_r " , 1 ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_A , prefix + " cpow2_a " ) ) ;
2016-01-04 19:50:15 -05:00
m_Params . push_back ( ParamWithName < T > ( & m_Divisor , prefix + " cpow2_divisor " , 1 , eParamType : : INTEGER_NONZERO ) ) ;
m_Params . push_back ( ParamWithName < T > ( & m_Spread , prefix + " cpow2_spread " , 1 , eParamType : : INTEGER , 1 , T ( 0x7FFFFFFF ) ) ) ;
2014-07-08 03:11:14 -04:00
m_Params . push_back ( ParamWithName < T > ( true , & m_C , prefix + " cpow2_c " ) ) ; //Precalc.
m_Params . push_back ( ParamWithName < T > ( true , & m_HalfC , prefix + " cpow2_halfc " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_D , prefix + " cpow2_d " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_HalfD , prefix + " cpow2_halfd " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_Ang , prefix + " cpow2_ang " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_InvSpread , prefix + " cpow2_inv_spread " ) ) ;
m_Params . push_back ( ParamWithName < T > ( true , & m_FullSpread , prefix + " cpow2_full_spread " ) ) ;
}
private :
T m_R ;
T m_A ;
T m_Divisor ;
T m_Spread ;
T m_C ; //Precalc.
T m_HalfC ;
T m_D ;
T m_HalfD ;
T m_Ang ;
T m_InvSpread ;
T m_FullSpread ;
} ;
MAKEPREPOSTVAR ( Hemisphere , hemisphere , HEMISPHERE )
MAKEPREPOSTPARVAR ( Epispiral , epispiral , EPISPIRAL )
MAKEPREPOSTPARVAR ( Bwraps , bwraps , BWRAPS )
2016-01-04 19:50:15 -05:00
MAKEPREPOSTVARASSIGN ( BlurCircle , blur_circle , BLUR_CIRCLE , eVariationAssignType : : ASSIGNTYPE_SUM )
2014-07-08 03:11:14 -04:00
MAKEPREPOSTPARVAR ( BlurZoom , blur_zoom , BLUR_ZOOM )
MAKEPREPOSTPARVAR ( BlurPixelize , blur_pixelize , BLUR_PIXELIZE )
MAKEPREPOSTPARVAR ( Crop , crop , CROP )
MAKEPREPOSTPARVAR ( BCircle , bcircle , BCIRCLE )
MAKEPREPOSTPARVAR ( BlurLinear , blur_linear , BLUR_LINEAR )
2016-01-04 19:50:15 -05:00
MAKEPREPOSTPARVARASSIGN ( BlurSquare , blur_square , BLUR_SQUARE , eVariationAssignType : : ASSIGNTYPE_SUM )
2014-07-08 03:11:14 -04:00
MAKEPREPOSTVAR ( Flatten , flatten , FLATTEN )
2016-01-04 19:50:15 -05:00
MAKEPREPOSTVARASSIGN ( Zblur , zblur , ZBLUR , eVariationAssignType : : ASSIGNTYPE_SUM )
MAKEPREPOSTVARASSIGN ( Blur3D , blur3D , BLUR3D , eVariationAssignType : : ASSIGNTYPE_SUM )
MAKEPREPOSTVARASSIGN ( ZScale , zscale , ZSCALE , eVariationAssignType : : ASSIGNTYPE_SUM )
MAKEPREPOSTVARASSIGN ( ZTranslate , ztranslate , ZTRANSLATE , eVariationAssignType : : ASSIGNTYPE_SUM )
2014-07-08 03:11:14 -04:00
MAKEPREPOSTVAR ( ZCone , zcone , ZCONE )
MAKEPREPOSTVAR ( Spherical3D , Spherical3D , SPHERICAL3D )
MAKEPREPOSTPARVAR ( Curl3D , curl3D , CURL3D )
MAKEPREPOSTPARVAR ( Disc3D , disc3d , DISC3D )
MAKEPREPOSTPARVAR ( Boarders2 , boarders2 , BOARDERS2 )
MAKEPREPOSTPARVAR ( Cardioid , cardioid , CARDIOID )
MAKEPREPOSTPARVAR ( Checks , checks , CHECKS )
MAKEPREPOSTPARVAR ( Circlize , circlize , CIRCLIZE )
MAKEPREPOSTPARVAR ( Circlize2 , circlize2 , CIRCLIZE2 )
MAKEPREPOSTPARVAR ( CosWrap , coswrap , COS_WRAP )
MAKEPREPOSTVAR ( DeltaA , deltaa , DELTA_A )
MAKEPREPOSTPARVAR ( Expo , expo , EXPO )
MAKEPREPOSTPARVAR ( Extrude , extrude , EXTRUDE )
MAKEPREPOSTVAR ( FDisc , fdisc , FDISC )
MAKEPREPOSTPARVAR ( Fibonacci , fibonacci , FIBONACCI )
MAKEPREPOSTPARVAR ( Fibonacci2 , fibonacci2 , FIBONACCI2 )
MAKEPREPOSTPARVAR ( Glynnia , glynnia , GLYNNIA )
MAKEPREPOSTVAR ( GridOut , gridout , GRIDOUT )
MAKEPREPOSTPARVAR ( Hole , hole , HOLE )
MAKEPREPOSTPARVAR ( Hypertile , hypertile , HYPERTILE )
MAKEPREPOSTPARVAR ( Hypertile1 , hypertile1 , HYPERTILE1 )
MAKEPREPOSTPARVAR ( Hypertile2 , hypertile2 , HYPERTILE2 )
MAKEPREPOSTPARVAR ( Hypertile3D , hypertile3D , HYPERTILE3D )
MAKEPREPOSTPARVAR ( Hypertile3D1 , hypertile3D1 , HYPERTILE3D1 )
MAKEPREPOSTPARVAR ( Hypertile3D2 , hypertile3D2 , HYPERTILE3D2 )
MAKEPREPOSTPARVAR ( IDisc , idisc , IDISC )
MAKEPREPOSTPARVAR ( Julian2 , julian2 , JULIAN2 )
MAKEPREPOSTPARVAR ( JuliaQ , juliaq , JULIAQ )
MAKEPREPOSTPARVAR ( Murl , murl , MURL )
MAKEPREPOSTPARVAR ( Murl2 , murl2 , MURL2 )
MAKEPREPOSTPARVAR ( NPolar , npolar , NPOLAR )
MAKEPREPOSTPARVAR ( Ortho , ortho , ORTHO )
MAKEPREPOSTPARVAR ( Poincare , poincare , POINCARE )
MAKEPREPOSTPARVAR ( Poincare3D , poincare3D , POINCARE3D )
MAKEPREPOSTPARVAR ( Polynomial , polynomial , POLYNOMIAL )
MAKEPREPOSTPARVAR ( PSphere , psphere , PSPHERE )
MAKEPREPOSTPARVAR ( Rational3 , rational3 , RATIONAL3 )
MAKEPREPOSTPARVAR ( Ripple , ripple , RIPPLE )
MAKEPREPOSTPARVAR ( Sigmoid , sigmoid , SIGMOID )
MAKEPREPOSTPARVAR ( SinusGrid , sinusgrid , SINUS_GRID )
MAKEPREPOSTPARVAR ( Stwin , stwin , STWIN )
MAKEPREPOSTVAR ( TwoFace , twoface , TWO_FACE )
MAKEPREPOSTPARVAR ( Unpolar , unpolar , UNPOLAR )
MAKEPREPOSTPARVAR ( WavesN , wavesn , WAVESN )
MAKEPREPOSTPARVAR ( XHeart , xheart , XHEART )
MAKEPREPOSTPARVAR ( Barycentroid , barycentroid , BARYCENTROID )
MAKEPREPOSTPARVAR ( BiSplit , bisplit , BISPLIT )
MAKEPREPOSTVAR ( Crescents , crescents , CRESCENTS )
MAKEPREPOSTVAR ( Mask , mask , MASK )
MAKEPREPOSTPARVAR ( Cpow2 , cpow2 , CPOW2 )
2014-07-09 22:18:39 -04:00
}