2014-07-08 03:11:14 -04:00
# pragma once
# include "EmberDefines.h"
# include "Isaac.h"
# include "VariationList.h"
# include "Renderer.h"
/// <summary>
/// SheepTools class.
/// </summary>
namespace EmberNs
{
/// <summary>
/// Mutation mode enum.
/// </summary>
2020-01-01 02:01:30 -05:00
enum class eMutateMode : char
2014-07-08 03:11:14 -04:00
{
MUTATE_NOT_SPECIFIED = - 1 ,
MUTATE_ALL_VARIATIONS = 0 ,
MUTATE_ONE_XFORM_COEFS = 1 ,
MUTATE_ADD_SYMMETRY = 2 ,
MUTATE_POST_XFORMS = 3 ,
MUTATE_COLOR_PALETTE = 4 ,
MUTATE_DELETE_XFORM = 5 ,
MUTATE_ALL_COEFS = 6
} ;
/// <summary>
/// Cross mode enum.
/// </summary>
2020-01-01 02:01:30 -05:00
enum class eCrossMode : char
2014-07-08 03:11:14 -04:00
{
CROSS_NOT_SPECIFIED = - 1 ,
CROSS_UNION = 0 ,
2014-09-10 01:41:26 -04:00
CROSS_INTERPOLATE = 1 ,
2014-07-08 03:11:14 -04:00
CROSS_ALTERNATE = 2
} ;
/// <summary>
/// SheepTools contains miscellaneous functions for mutating, rotating
/// crossing and randomizing embers. It is named so because these functions
/// are used in the electric sheep genome mutation process.
/// Most functions in this class perform a particular action and return
/// a string describing what it did so it can be recorded in an Xml edit doc
/// to be saved with the ember when converting to Xml.
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
/// Since its members can occupy significant memory space and also have
2014-07-08 03:11:14 -04:00
/// hefty initialization sequences, it's important to declare one instance
/// and reuse it for the duration of the program instead of creating and deleting
/// them as local variables.
/// Template argument expected to be float or double.
/// </summary>
template < typename T , typename bucketT >
class EMBER_API SheepTools
{
public :
/// <summary>
/// Constructor which takes a palette path and pre-constructed renderer.
2014-09-10 01:41:26 -04:00
/// This class will take over ownership of the passed in renderer so the
2014-07-08 03:11:14 -04:00
/// caller should not delete it.
/// </summary>
/// <param name="palettePath">The full path and filename of the palette file</param>
/// <param name="renderer">A pre-constructed renderer to use. The caller should not delete this.</param>
2014-10-14 11:53:15 -04:00
SheepTools ( const string & palettePath , Renderer < T , bucketT > * renderer )
2017-02-26 12:34:43 -05:00
: m_VariationList ( VariationList < T > : : Instance ( ) ) ,
m_PaletteList ( PaletteList < float > : : Instance ( ) )
2014-07-08 03:11:14 -04:00
{
Timing t ;
2017-02-26 12:34:43 -05:00
m_PaletteList - > Add ( palettePath ) ;
2014-09-10 01:41:26 -04:00
m_Renderer = unique_ptr < Renderer < T , bucketT > > ( renderer ) ;
2014-07-08 03:11:14 -04:00
m_Rand = QTIsaac < ISAAC_SIZE , ISAAC_INT > ( ISAAC_INT ( t . Tic ( ) ) , ISAAC_INT ( t . Tic ( ) * 2 ) , ISAAC_INT ( t . Tic ( ) * 3 ) ) ;
}
2016-04-03 21:55:12 -04:00
SheepTools ( const SheepTools & sheepTools ) = delete ;
SheepTools < T , bucketT > & operator = ( const SheepTools < T , bucketT > & sheepTools ) = delete ;
2014-07-08 03:11:14 -04:00
/// <summary>
/// Create the linear default ember with a random palette.
/// </summary>
/// <returns>The newly constructed linear default ember</returns>
Ember < T > CreateLinearDefault ( )
{
Ember < T > ember ;
Xform < T > xform1 ( T ( 0.25 ) , T ( 1 ) , T ( 0.5 ) , T ( 1 ) , T ( 0.5 ) , T ( 0 ) , T ( 0 ) , T ( 0.5 ) , T ( 0.5 ) , T ( 0.25 ) ) ;
Xform < T > xform2 ( T ( 0.25 ) , T ( 0.66 ) , T ( 0.5 ) , T ( 1 ) , T ( 0.5 ) , T ( 0 ) , T ( 0 ) , T ( 0.5 ) , T ( - 0.5 ) , T ( 0.25 ) ) ;
Xform < T > xform3 ( T ( 0.25 ) , T ( 0.33 ) , T ( 0.5 ) , T ( 1 ) , T ( 0.5 ) , T ( 0 ) , T ( 0 ) , T ( 0.5 ) , T ( 0.0 ) , T ( - 0.5 ) ) ;
2016-04-13 23:59:57 -04:00
xform1 . AddVariation ( m_VariationList - > GetVariationCopy ( eVariationId : : VAR_LINEAR ) ) ;
xform2 . AddVariation ( m_VariationList - > GetVariationCopy ( eVariationId : : VAR_LINEAR ) ) ;
xform3 . AddVariation ( m_VariationList - > GetVariationCopy ( eVariationId : : VAR_LINEAR ) ) ;
2014-07-08 03:11:14 -04:00
ember . AddXform ( xform1 ) ;
ember . AddXform ( xform2 ) ;
ember . AddXform ( xform3 ) ;
2014-09-10 01:41:26 -04:00
2017-02-26 12:34:43 -05:00
if ( m_PaletteList - > Size ( ) )
ember . m_Palette = * m_PaletteList - > GetRandomPalette ( ) ;
2014-07-08 03:11:14 -04:00
return ember ;
}
/// <summary>
/// Ensure all xforms, including final, have no more than the specified number of variations.
/// Remove variations in order of smallest weight to largest weight.
/// Also remove all xforms whose density is less than 0.001.
/// </summary>
/// <param name="ember">The ember whose xforms will be truncated</param>
/// <param name="maxVars">The maximum number of variations each xform can have</param>
/// <returns>A string describing what was done</returns>
2014-10-14 11:53:15 -04:00
string TruncateVariations ( Ember < T > & ember , size_t maxVars )
2014-07-08 03:11:14 -04:00
{
2014-10-14 11:53:15 -04:00
intmax_t smallest ;
2017-05-31 22:50:05 -04:00
size_t i = 0 , j , numVars ;
2014-07-08 03:11:14 -04:00
T sv = 0 ;
ostringstream os ;
//First clear out any xforms that are not the final, and have a density of less than 0.001.
2017-05-31 22:50:05 -04:00
while ( auto xform = ember . GetXform ( i ) )
{
2014-07-08 03:11:14 -04:00
if ( xform - > m_Weight < T ( 0.001 ) )
{
os < < " trunc_density " < < i ;
ember . DeleteXform ( i ) ;
i = 0 ; //Size will have changed, so start over.
2017-05-31 22:50:05 -04:00
continue ;
2014-07-08 03:11:14 -04:00
}
2017-05-31 22:50:05 -04:00
i + + ;
2014-07-08 03:11:14 -04:00
}
//Now consider all xforms, including final.
2017-05-31 22:50:05 -04:00
i = 0 ;
2014-07-08 03:11:14 -04:00
2017-05-31 22:50:05 -04:00
while ( auto xform = ember . GetTotalXform ( i ) )
{
2014-07-08 03:11:14 -04:00
do
{
2014-09-10 01:41:26 -04:00
Variation < T > * var = nullptr ;
Variation < T > * smallestVar = nullptr ;
2014-07-08 03:11:14 -04:00
numVars = 0 ;
smallest = - 1 ;
for ( j = 0 ; j < xform - > TotalVariationCount ( ) ; j + + )
{
var = xform - > GetVariation ( j ) ;
if ( var & & var - > m_Weight ! = 0.0 )
{
T v = var - > m_Weight ;
numVars + + ;
if ( smallest = = - 1 | | fabs ( v ) < sv )
{
smallest = j ;
smallestVar = var ;
sv = fabs ( v ) ;
}
}
}
if ( numVars > maxVars )
{
os < < " trunc " < < i < < " " < < smallest ;
if ( smallestVar )
xform - > DeleteVariationById ( smallestVar - > VariationId ( ) ) ;
}
2015-12-31 19:00:36 -05:00
}
while ( numVars > maxVars ) ;
2017-05-31 22:50:05 -04:00
i + + ;
2014-07-08 03:11:14 -04:00
}
return os . str ( ) ;
}
/// <summary>
/// Mutate the ember using the specified mode.
/// </summary>
/// <param name="ember">The ember to mutate</param>
/// <param name="mode">The mutation mode</param>
/// <param name="useVars">The variations to use if the mutation mode is random</param>
/// <param name="sym">The type of symmetry to add if random specified. If 0, it will be added randomly.</param>
2016-01-04 19:50:15 -05:00
/// <param name="speed">The speed to multiply the pre affine transforms by if the mutate mode is eMutateMode::MUTATE_ALL_COEFS, else ignored.</param>
--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
/// <param name="maxVars">The maximum number of variations to allow in any single xform in the ember.</param>
2014-07-08 03:11:14 -04:00
/// <returns>A string describing what was done</returns>
--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
string Mutate ( Ember < T > & ember , eMutateMode mode , vector < eVariationId > & useVars , intmax_t sym , T speed , size_t maxVars )
2014-07-08 03:11:14 -04:00
{
2014-10-14 11:53:15 -04:00
bool done = false ;
size_t modXform ;
2014-07-08 03:11:14 -04:00
T randSelect ;
ostringstream os ;
Ember < T > mutation ;
mutation . Clear ( ) ;
//If mutate_mode = -1, choose a random mutation mode.
2016-01-04 19:50:15 -05:00
if ( mode = = eMutateMode : : MUTATE_NOT_SPECIFIED )
2014-07-08 03:11:14 -04:00
{
randSelect = m_Rand . Frand01 < T > ( ) ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( randSelect < T ( 0.1 ) )
2016-01-04 19:50:15 -05:00
mode = eMutateMode : : MUTATE_ALL_VARIATIONS ;
2014-07-08 03:11:14 -04:00
else if ( randSelect < T ( 0.3 ) )
2016-01-04 19:50:15 -05:00
mode = eMutateMode : : MUTATE_ONE_XFORM_COEFS ;
2014-07-08 03:11:14 -04:00
else if ( randSelect < T ( 0.5 ) )
2016-01-04 19:50:15 -05:00
mode = eMutateMode : : MUTATE_ADD_SYMMETRY ;
2014-07-08 03:11:14 -04:00
else if ( randSelect < T ( 0.6 ) )
2016-01-04 19:50:15 -05:00
mode = eMutateMode : : MUTATE_POST_XFORMS ;
2014-07-08 03:11:14 -04:00
else if ( randSelect < T ( 0.7 ) )
2016-01-04 19:50:15 -05:00
mode = eMutateMode : : MUTATE_COLOR_PALETTE ;
2014-07-08 03:11:14 -04:00
else if ( randSelect < T ( 0.8 ) )
2016-01-04 19:50:15 -05:00
mode = eMutateMode : : MUTATE_DELETE_XFORM ;
2014-07-08 03:11:14 -04:00
else
2016-01-04 19:50:15 -05:00
mode = eMutateMode : : MUTATE_ALL_COEFS ;
2014-07-08 03:11:14 -04:00
}
2014-09-10 01:41:26 -04:00
2016-01-04 19:50:15 -05:00
if ( mode = = eMutateMode : : MUTATE_ALL_VARIATIONS )
2014-07-08 03:11:14 -04:00
{
os < < " mutate all variations " ;
do
{
//Create a random flame, and use the variations to replace those in the original.
--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
Random ( mutation , useVars , sym , ember . TotalXformCount ( ) , maxVars ) ;
2014-07-08 03:11:14 -04:00
2014-10-14 11:53:15 -04:00
for ( size_t i = 0 ; i < ember . TotalXformCount ( ) ; i + + )
2014-07-08 03:11:14 -04:00
{
2016-02-02 20:51:58 -05:00
auto xform1 = ember . GetTotalXform ( i ) ;
auto xform2 = mutation . GetTotalXform ( i ) ;
2014-07-08 03:11:14 -04:00
if ( xform1 & & xform2 )
{
2014-10-14 11:53:15 -04:00
for ( size_t j = 0 ; j < xform1 - > TotalVariationCount ( ) ; j + + )
2014-07-08 03:11:14 -04:00
{
Variation < T > * var1 = xform1 - > GetVariation ( j ) ;
Variation < T > * var2 = xform2 - > GetVariationById ( var1 - > VariationId ( ) ) ;
2014-09-10 01:41:26 -04:00
if ( ( var1 = = nullptr ) ^ ( var2 = = nullptr ) ) //If any of them are different, clear the first and copy all of the second and exit the while loop.
2014-07-08 03:11:14 -04:00
{
xform1 - > ClearAndDeleteVariations ( ) ;
2014-10-14 11:53:15 -04:00
for ( size_t k = 0 ; k < xform2 - > TotalVariationCount ( ) ; k + + )
2014-07-08 03:11:14 -04:00
xform1 - > AddVariation ( xform2 - > GetVariation ( k ) - > Copy ( ) ) ;
2014-10-14 11:53:15 -04:00
done = true ;
2014-07-08 03:11:14 -04:00
}
}
}
}
2015-12-31 19:00:36 -05:00
}
while ( ! done ) ;
2014-07-08 03:11:14 -04:00
}
2016-01-04 19:50:15 -05:00
else if ( mode = = eMutateMode : : MUTATE_ONE_XFORM_COEFS )
2014-07-08 03:11:14 -04:00
{
//Generate a 2-xform random.
--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
Random ( mutation , useVars , sym , 2 , maxVars ) ;
2014-07-08 03:11:14 -04:00
//Which xform to mutate?
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
modXform = m_Rand . Rand ( ember . TotalXformCount ( ) ) ;
2016-02-02 20:51:58 -05:00
auto xform1 = ember . GetTotalXform ( modXform ) ;
auto xform2 = mutation . GetTotalXform ( 0 ) ;
2014-07-08 03:11:14 -04:00
os < < " mutate xform " < < modXform < < " coefs " ;
//If less than 3 xforms, then change only the translation part.
if ( ember . TotalXformCount ( ) < 2 )
{
xform1 - > m_Affine . C ( xform2 - > m_Affine . C ( ) ) ;
xform1 - > m_Affine . F ( xform2 - > m_Affine . F ( ) ) ;
}
else
{
2014-10-14 11:53:15 -04:00
for ( glm : : length_t i = 0 ; i < 2 ; i + + )
for ( glm : : length_t j = 0 ; j < 3 ; j + + )
2014-07-08 03:11:14 -04:00
xform1 - > m_Affine . m_Mat [ i ] [ j ] = xform2 - > m_Affine . m_Mat [ i ] [ j ] ;
}
}
2016-01-04 19:50:15 -05:00
else if ( mode = = eMutateMode : : MUTATE_ADD_SYMMETRY )
2014-07-08 03:11:14 -04:00
{
os < < " mutate symmetry " ;
ember . AddSymmetry ( 0 , m_Rand ) ;
}
2016-01-04 19:50:15 -05:00
else if ( mode = = eMutateMode : : MUTATE_POST_XFORMS )
2014-07-08 03:11:14 -04:00
{
2014-10-14 11:53:15 -04:00
bool same = ( m_Rand . Rand ( ) & 3 ) > 0 ; //25% chance of using the same post for all of them.
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
size_t b = 1 + m_Rand . Rand ( 6 ) ;
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
os < < " mutate post xforms " < < b < < ( same ? " same " : " " ) ;
2014-07-08 03:11:14 -04:00
2014-10-14 11:53:15 -04:00
for ( size_t i = 0 ; i < ember . TotalXformCount ( ) ; i + + )
2014-07-08 03:11:14 -04:00
{
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
bool copy = ( i > 0 ) & & same ;
2016-02-02 20:51:58 -05:00
auto xform = ember . GetTotalXform ( i ) ;
2014-07-08 03:11:14 -04:00
if ( copy ) //Copy the post from the first xform to the rest of them.
2014-09-10 01:41:26 -04:00
{
2014-07-08 03:11:14 -04:00
xform - > m_Post = ember . GetTotalXform ( 0 ) - > m_Post ;
}
else
{
//50% chance.
if ( b & 1 )
{
T f = T ( M_PI ) * m_Rand . Frand11 < T > ( ) ;
2014-09-10 01:41:26 -04:00
T ra , rb , rd , re ;
--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
ra = ( xform - > m_Affine . A ( ) * std : : cos ( f ) + xform - > m_Affine . B ( ) * - std : : sin ( f ) ) ;
rd = ( xform - > m_Affine . A ( ) * std : : sin ( f ) + xform - > m_Affine . D ( ) * std : : cos ( f ) ) ;
rb = ( xform - > m_Affine . B ( ) * std : : cos ( f ) + xform - > m_Affine . E ( ) * - std : : sin ( f ) ) ;
re = ( xform - > m_Affine . B ( ) * std : : sin ( f ) + xform - > m_Affine . E ( ) * std : : cos ( f ) ) ;
2014-09-10 01:41:26 -04:00
xform - > m_Affine . A ( ra ) ;
xform - > m_Affine . B ( rb ) ;
xform - > m_Affine . D ( rd ) ;
xform - > m_Affine . E ( re ) ;
2014-07-08 03:11:14 -04:00
f * = - 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
ra = ( xform - > m_Post . A ( ) * std : : cos ( f ) + xform - > m_Post . B ( ) * - std : : sin ( f ) ) ;
rd = ( xform - > m_Post . A ( ) * std : : sin ( f ) + xform - > m_Post . D ( ) * std : : cos ( f ) ) ;
rb = ( xform - > m_Post . B ( ) * std : : cos ( f ) + xform - > m_Post . E ( ) * - std : : sin ( f ) ) ;
re = ( xform - > m_Post . B ( ) * std : : sin ( f ) + xform - > m_Post . E ( ) * std : : cos ( f ) ) ;
2014-09-10 01:41:26 -04:00
xform - > m_Post . A ( ra ) ;
xform - > m_Post . B ( rb ) ;
xform - > m_Post . D ( rd ) ;
xform - > m_Post . E ( re ) ;
2014-07-08 03:11:14 -04:00
}
//33% chance.
if ( b & 2 )
2014-09-10 01:41:26 -04:00
{
2014-07-08 03:11:14 -04:00
T f = T ( 0.2 ) + m_Rand . Frand01 < T > ( ) ;
T g = T ( 0.2 ) + m_Rand . Frand01 < T > ( ) ;
if ( m_Rand . RandBit ( ) )
f = 1 / f ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( m_Rand . RandBit ( ) )
g = f ;
2015-12-31 19:00:36 -05:00
else if ( m_Rand . RandBit ( ) )
g = 1 / g ;
2014-07-08 03:11:14 -04:00
xform - > m_Affine . A ( xform - > m_Affine . A ( ) / f ) ;
xform - > m_Affine . D ( xform - > m_Affine . D ( ) / f ) ;
xform - > m_Affine . B ( xform - > m_Affine . B ( ) / g ) ;
xform - > m_Affine . E ( xform - > m_Affine . E ( ) / g ) ;
xform - > m_Post . A ( xform - > m_Post . A ( ) * f ) ;
xform - > m_Post . B ( xform - > m_Post . B ( ) * f ) ;
xform - > m_Post . D ( xform - > m_Post . D ( ) * g ) ;
xform - > m_Post . E ( xform - > m_Post . E ( ) * g ) ;
}
if ( b & 4 ) //16% chance.
2014-09-10 01:41:26 -04:00
{
2014-07-08 03:11:14 -04:00
T f = m_Rand . Frand11 < T > ( ) ;
T g = m_Rand . Frand11 < T > ( ) ;
xform - > m_Affine . C ( xform - > m_Affine . C ( ) - f ) ;
xform - > m_Affine . F ( xform - > m_Affine . F ( ) - g ) ;
xform - > m_Post . C ( xform - > m_Post . C ( ) + f ) ;
xform - > m_Post . F ( xform - > m_Post . F ( ) + g ) ;
}
}
}
}
2016-01-04 19:50:15 -05:00
else if ( mode = = eMutateMode : : MUTATE_COLOR_PALETTE )
2014-07-08 03:11:14 -04:00
{
T s = m_Rand . Frand01 < T > ( ) ;
if ( s < T ( 0.4 ) ) //Randomize xform color coords.
2014-09-10 01:41:26 -04:00
{
2014-07-08 03:11:14 -04:00
ImproveColors ( ember , 100 , false , 10 ) ;
os < < " mutate color coords " ;
}
else if ( s < T ( 0.8 ) ) //Randomize xform color coords and palette.
2014-09-10 01:41:26 -04:00
{
2014-07-08 03:11:14 -04:00
ImproveColors ( ember , 25 , true , 10 ) ;
os < < " mutate color all " ;
}
else //Randomize palette only.
{
2017-02-26 12:34:43 -05:00
if ( m_PaletteList - > Size ( ) )
ember . m_Palette = * m_PaletteList - > GetRandomPalette ( ) ;
2014-07-08 03:11:14 -04:00
//If the palette retrieval fails, skip the mutation.
if ( ember . m_Palette . m_Index > = 0 )
{
os < < " mutate color palette " ;
}
else
{
2015-08-10 23:10:23 -04:00
ember . m_Palette . Clear ( false ) ;
2016-05-02 19:54:56 -04:00
cerr < < " Failure getting random palette, palette set to white \n " ;
2014-07-08 03:11:14 -04:00
}
}
}
2016-01-04 19:50:15 -05:00
else if ( mode = = eMutateMode : : MUTATE_DELETE_XFORM )
2014-07-08 03:11:14 -04:00
{
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
size_t nx = m_Rand . Rand ( ember . TotalXformCount ( ) ) ;
2014-07-08 03:11:14 -04:00
os < < " mutate delete xform " < < nx ;
if ( ember . TotalXformCount ( ) > 1 )
ember . DeleteTotalXform ( nx ) ;
}
2016-01-04 19:50:15 -05:00
else if ( mode = = eMutateMode : : MUTATE_ALL_COEFS )
2014-09-10 01:41:26 -04:00
{
2014-07-08 03:11:14 -04:00
os < < " mutate all coefs " ;
--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
Random ( mutation , useVars , sym , ember . TotalXformCount ( ) , maxVars ) ;
2014-07-08 03:11:14 -04:00
//Change all the coefs by a fraction of the random.
2014-10-14 11:53:15 -04:00
for ( size_t x = 0 ; x < ember . TotalXformCount ( ) ; x + + )
2014-07-08 03:11:14 -04:00
{
2016-02-02 20:51:58 -05:00
auto xform1 = ember . GetTotalXform ( x ) ;
auto xform2 = mutation . GetTotalXform ( x ) ;
2014-07-08 03:11:14 -04:00
2014-10-14 11:53:15 -04:00
for ( glm : : length_t i = 0 ; i < 2 ; i + + )
for ( glm : : length_t j = 0 ; j < 3 ; j + + )
2014-07-08 03:11:14 -04:00
xform1 - > m_Affine . m_Mat [ i ] [ j ] + = speed * xform2 - > m_Affine . m_Mat [ i ] [ j ] ;
//Eventually, mutate the parametric variation parameters here.
}
}
return os . str ( ) ;
}
/// <summary>
/// Crosse the two embers and place the result in emberOut.
/// </summary>
/// <param name="ember0">The first ember to cross</param>
/// <param name="ember1">The second ember to cross</param>
/// <param name="emberOut">The result ember</param>
/// <param name="crossMode">The cross mode</param>
/// <returns>A string describing what was done</returns>
2016-01-04 19:50:15 -05:00
string Cross ( Ember < T > & ember0 , Ember < T > & ember1 , Ember < T > & emberOut , eCrossMode crossMode )
2014-07-08 03:11:14 -04:00
{
2014-12-06 00:05:09 -05:00
uint rb ;
2014-10-14 11:53:15 -04:00
size_t i ;
2014-07-08 03:11:14 -04:00
T t ;
ostringstream os ;
2016-01-04 19:50:15 -05:00
if ( crossMode = = eCrossMode : : CROSS_NOT_SPECIFIED )
2014-07-08 03:11:14 -04:00
{
T s = m_Rand . Frand01 < T > ( ) ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( s < 0.1 )
2016-01-04 19:50:15 -05:00
crossMode = eCrossMode : : CROSS_UNION ;
2014-07-08 03:11:14 -04:00
else if ( s < 0.2 )
2016-01-04 19:50:15 -05:00
crossMode = eCrossMode : : CROSS_INTERPOLATE ;
2014-07-08 03:11:14 -04:00
else
2016-01-04 19:50:15 -05:00
crossMode = eCrossMode : : CROSS_ALTERNATE ;
2014-07-08 03:11:14 -04:00
}
2016-01-04 19:50:15 -05:00
if ( crossMode = = eCrossMode : : CROSS_UNION )
2014-07-08 03:11:14 -04:00
{
//Make a copy of the first ember.
emberOut = ember0 ;
//Copy all xforms in the second ember except the final. Default behavior keeps the final from parent0.
for ( i = 0 ; i < ember1 . XformCount ( ) ; i + + )
emberOut . AddXform ( * ember1 . GetXform ( i ) ) ;
os < < " cross union " ;
}
2016-01-04 19:50:15 -05:00
else if ( crossMode = = eCrossMode : : CROSS_INTERPOLATE )
2014-07-08 03:11:14 -04:00
{
//Linearly interpolate somewhere between the two.
//t = 0.5;//If you ever need to test.
t = m_Rand . Frand01 < T > ( ) ;
2016-04-23 12:02:09 -04:00
m_Parents [ 0 ] = ember0 ;
m_Parents [ 1 ] = ember1 ;
m_Parents [ 0 ] . m_Time = T ( 0 ) ;
m_Parents [ 1 ] . m_Time = T ( 1 ) ;
m_Interpolater . Interpolate ( m_Parents , 2 , t , 0 , emberOut ) ;
2014-07-08 03:11:14 -04:00
for ( i = 0 ; i < emberOut . TotalXformCount ( ) ; i + + )
emberOut . GetTotalXform ( i ) - > DeleteMotionElements ( ) ;
2016-12-05 22:04:33 -05:00
os < < " cross interpolate " < < std : : to_string ( t ) ;
2014-07-08 03:11:14 -04:00
}
else //Alternate mode.
{
int got0 , got1 , usedParent ;
string trystr ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
//Each xform comes from a random parent, possible for an entire parent to be excluded.
do
{
got0 = got1 = 0 ;
rb = m_Rand . RandBit ( ) ;
os < < rb < < " : " ;
//Copy the parent, sorting the final xform to the end if it's present.
emberOut = rb ? ember1 : ember0 ;
usedParent = rb ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
//Only replace non-final xforms.
for ( i = 0 ; i < emberOut . XformCount ( ) ; i + + )
{
rb = m_Rand . RandBit ( ) ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
//Replace xform if bit is 1.
if ( rb = = 1 )
{
if ( usedParent = = 0 )
{
2014-09-10 01:41:26 -04:00
if ( i < ember1 . XformCount ( ) & & ember1 . GetXform ( i ) - > m_Weight > 0 )
2014-07-08 03:11:14 -04:00
{
2016-02-02 20:51:58 -05:00
auto xform = emberOut . GetXform ( i ) ;
2014-07-08 03:11:14 -04:00
* xform = * ember1 . GetXform ( i ) ;
os < < " 1 " ;
got1 = 1 ;
}
else
{
os < < " 0 " ;
got0 = 1 ;
}
}
else
{
if ( i < ember0 . XformCount ( ) & & ember0 . GetXform ( i ) - > m_Weight > 0 )
{
2016-02-02 20:51:58 -05:00
auto xform = emberOut . GetXform ( i ) ;
2014-07-08 03:11:14 -04:00
* xform = * ember0 . GetXform ( i ) ;
os < < " 0 " ;
got0 = 1 ;
}
else
{
os < < " 1 " ;
got1 = 1 ;
}
}
}
else
{
os < < " " < < usedParent ;
if ( usedParent )
got1 = 1 ;
else
got0 = 1 ;
}
}
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( usedParent = = 0 & & ember0 . UseFinalXform ( ) )
got0 = 1 ;
else if ( usedParent = = 1 & & ember1 . UseFinalXform ( ) )
got1 = 1 ;
2015-12-31 19:00:36 -05:00
}
while ( ( i > 1 ) & & ! ( got0 & & got1 ) ) ;
2014-09-10 01:41:26 -04:00
2016-05-02 19:54:56 -04:00
os < < " cross alternate " ;
2014-07-08 03:11:14 -04:00
os < < trystr ;
}
//Reset color coords.
for ( i = 0 ; i < emberOut . TotalXformCount ( ) ; i + + )
{
emberOut . GetTotalXform ( i ) - > m_ColorX = T ( i & 1 ) ; //Original pingponged between 0 and 1, which gives bad coloring but is useful for testing.
//emberOut.GetTotalXform(i)->m_ColorX = m_Rand.Frand01<T>();//Do rand which gives better coloring but produces different results every time it's run.
//emberOut.GetTotalXform(i)->m_ColorY = ?????;//Will need to update this if 2D coordinates are ever supported.
}
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
//Potentially genetically cross the two palettes together.
if ( m_Rand . Frand01 < T > ( ) < T ( 0.4 ) )
{
//Select the starting parent.
2014-10-14 11:53:15 -04:00
size_t ci ;
2014-12-06 00:05:09 -05:00
uint startParent = m_Rand . RandBit ( ) ;
2014-07-08 03:11:14 -04:00
os < < " cmap_cross " < < startParent < < " : " ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
//Loop over the entries, switching to the other parent 1% of the time.
for ( ci = 0 ; ci < 256 ; ci + + ) //Will need to update this if 2D coordinates are ever supported.
{
if ( m_Rand . Frand01 < T > ( ) < T ( .01 ) )
{
startParent = 1 - startParent ;
os < < " " < < ci ;
}
emberOut . m_Palette . m_Entries [ ci ] = startParent ? ember1 . m_Palette . m_Entries [ ci ] : ember0 . m_Palette . m_Entries [ ci ] ;
}
}
return os . str ( ) ;
}
/// <summary>
/// Thin wrapper around Random() that passes an empty vector for useVars, a random value for symmetry and 0 for max xforms.
/// </summary>
/// <param name="ember">The newly created random ember</param>
--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
/// <param name="maxVars">The maximum number of variations to allow in any single xform in the ember.</param>
void Random ( Ember < T > & ember , size_t maxVars )
2014-07-08 03:11:14 -04:00
{
vector < eVariationId > useVars ;
--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
Random ( ember , useVars , static_cast < intmax_t > ( m_Rand . Frand < T > ( - 2 , 2 ) ) , 0 , maxVars ) ;
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Create a random ember.
/// </summary>
/// <param name="ember">The newly created random ember</param>
/// <param name="useVars">A list of variations to use. If empty, any variation can be used.</param>
/// <param name="sym">The symmetry type to use from -2 to 2</param>
/// <param name="specXforms">The number of xforms to use. If 0, a quasi random count is used.</param>
--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
/// <param name="maxVars">The maximum number of variations to allow in any single xform in the ember.</param>
void Random ( Ember < T > & ember , vector < eVariationId > & useVars , intmax_t sym , size_t specXforms , size_t maxVars )
2014-07-08 03:11:14 -04:00
{
bool postid , addfinal = false ;
int var , samed , multid , samepost ;
2014-10-14 11:53:15 -04:00
glm : : length_t i , j , k , n ;
2016-04-13 23:59:57 -04:00
size_t varCount = m_VariationList - > Size ( ) ;
2014-10-14 11:53:15 -04:00
static size_t xformDistrib [ ] =
2014-07-08 03:11:14 -04:00
{
2 , 2 , 2 , 2 ,
3 , 3 , 3 , 3 ,
4 , 4 , 4 ,
5 , 5 ,
6
} ;
ember . Clear ( ) ;
2017-02-26 12:34:43 -05:00
if ( m_PaletteList - > Size ( ) )
ember . m_Palette = * m_PaletteList - > GetRandomPalette ( ) ;
2014-07-08 03:11:14 -04:00
ember . m_Time = 0 ;
2015-12-31 19:00:36 -05:00
ember . m_Interp = eInterp : : EMBER_INTERP_LINEAR ;
ember . m_PaletteInterp = ePaletteInterp : : INTERP_HSV ;
2014-07-08 03:11:14 -04:00
//Choose the number of xforms.
if ( specXforms > 0 )
{
ember . AddXforms ( specXforms ) ;
}
else
{
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
ember . AddXforms ( xformDistrib [ m_Rand . Rand ( Vlen ( xformDistrib ) ) ] ) ;
2014-07-08 03:11:14 -04:00
addfinal = m_Rand . Frand01 < T > ( ) < T ( 0.15 ) ; //Add a final xform 15% of the time.
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( addfinal )
{
Xform < T > xform ;
xform . m_Affine . A ( T ( 1.1 ) ) ; //Just put something in there so it doesn't show up as being an empty final xform.
ember . SetFinalXform ( xform ) ;
}
2014-09-10 01:41:26 -04:00
}
2016-01-04 19:50:15 -05:00
//If useVars is empty, randomly choose one to use or decide to use multiple.
if ( useVars . empty ( ) )
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
var = m_Rand . RandBit ( ) ? m_Rand . Rand ( varCount ) : - 1 ;
2014-07-08 03:11:14 -04:00
else
var = - 2 ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
samed = m_Rand . RandBit ( ) ;
multid = m_Rand . RandBit ( ) ;
postid = m_Rand . Frand01 < T > ( ) < T ( 0.6 ) ;
samepost = m_Rand . RandBit ( ) ;
//Loop over xforms.
for ( i = 0 ; i < ember . TotalXformCount ( ) ; i + + )
{
2016-02-02 20:51:58 -05:00
auto xform = ember . GetTotalXform ( i ) ;
2014-07-08 03:11:14 -04:00
xform - > m_Weight = T ( 1 ) / ember . TotalXformCount ( ) ;
xform - > m_ColorX = m_Rand . Frand01 < T > ( ) ; //Original pingponged between 0 and 1, which gives bad coloring. Ember does random instead.
xform - > m_ColorY = m_Rand . Frand01 < T > ( ) ; //Will need to update this if 2D coordinates are ever supported.
xform - > m_ColorSpeed = T ( 0.5 ) ;
xform - > m_Animate = 1 ;
xform - > m_Affine . A ( m_Rand . Frand11 < T > ( ) ) ;
xform - > m_Affine . B ( m_Rand . Frand11 < T > ( ) ) ;
xform - > m_Affine . C ( m_Rand . Frand11 < T > ( ) ) ;
xform - > m_Affine . D ( m_Rand . Frand11 < T > ( ) ) ;
xform - > m_Affine . E ( m_Rand . Frand11 < T > ( ) ) ;
xform - > m_Affine . F ( m_Rand . Frand11 < T > ( ) ) ;
xform - > m_Post . MakeID ( ) ;
if ( ! ember . IsFinalXform ( xform ) )
{
if ( ! postid )
{
for ( j = 0 ; j < 2 ; j + + )
{
for ( k = 0 ; k < 3 ; k + + )
{
if ( samepost | | ( i = = 0 ) )
xform - > m_Post . m_Mat [ j ] [ k ] = m_Rand . Frand11 < T > ( ) ;
else
xform - > m_Post . m_Mat [ j ] [ k ] = ember . GetTotalXform ( 0 ) - > m_Post . m_Mat [ j ] [ k ] ;
}
}
}
if ( var > - 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
if ( xform - > TotalVariationCount ( ) < maxVars )
2016-04-13 23:59:57 -04:00
xform - > AddVariation ( m_VariationList - > GetVariation ( var ) - > Copy ( ) ) ; //Use only one variation specified for all xforms.
2014-07-08 03:11:14 -04:00
}
else if ( multid & & var = = - 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
if ( xform - > TotalVariationCount ( ) < maxVars )
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
xform - > AddVariation ( m_VariationList - > GetVariation ( m_Rand . Rand ( varCount ) ) - > Copy ( ) ) ; //Choose a random var for this xform.
2014-07-08 03:11:14 -04:00
}
else
{
if ( samed & & i > 0 )
{
//Copy the same variations from the previous xform.
2016-02-02 20:51:58 -05:00
auto prevXform = ember . GetXform ( i - 1 ) ;
2014-07-08 03:11:14 -04:00
for ( j = 0 ; j < prevXform - > TotalVariationCount ( ) ; j + + )
--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 ( xform - > TotalVariationCount ( ) < maxVars )
xform - > AddVariation ( prevXform - > GetVariation ( j ) - > Copy ( ) ) ;
2014-07-08 03:11:14 -04:00
}
else
{
//Choose a random number of vars to use, at least 2
//but less than varCount. Probability leans
//towards fewer variations.
n = 2 ;
2015-12-31 19:00:36 -05:00
2014-07-08 03:11:14 -04:00
while ( m_Rand . RandBit ( ) & & ( n < varCount ) )
n + + ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
//Randomly choose n variations, and change their weights.
//A var can be selected more than once, further reducing
//the probability that multiple vars are used.
for ( j = 0 ; j < n ; j + + )
{
--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 ( xform - > TotalVariationCount ( ) < maxVars )
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 ( var ! = - 2 )
{
//Pick a random variation and use a random weight from 0-1.
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
Variation < T > * v = m_VariationList - > GetVariationCopy ( static_cast < size_t > ( m_Rand . Rand ( varCount ) ) , m_Rand . Frand < T > ( T ( 0.001 ) , 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
if ( v & & ! xform - > AddVariation ( v ) )
delete v ; //It already existed and therefore was not added.
}
else
{
//Pick a random variation from the suppled IDs and use a random weight from 0-1.
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
Variation < T > * v = m_VariationList - > GetVariationCopy ( useVars [ m_Rand . Rand ( useVars . size ( ) ) ] , m_Rand . Frand < T > ( T ( 0.001 ) , 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
if ( v & & ! xform - > AddVariation ( v ) )
delete v ;
}
2014-07-08 03:11:14 -04:00
}
}
xform - > NormalizeVariationWeights ( ) ; //Normalize weights to 1.0 total.
}
}
}
else
{
//Handle final xform randomness.
n = 1 ;
if ( m_Rand . RandBit ( ) )
n + + ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
//Randomly choose n variations, and change their weights.
//A var can be selected more than once, further reducing
//the probability that multiple vars are used.
for ( j = 0 ; j < n ; j + + )
{
--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 ( xform - > TotalVariationCount ( ) < maxVars )
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 ( var ! = - 2 )
{
//Pick a random variation and use a random weight from 0-1.
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
xform - > AddVariation ( m_VariationList - > GetVariationCopy ( static_cast < size_t > ( m_Rand . Rand ( varCount ) ) , m_Rand . Frand < T > ( T ( 0.001 ) , 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
}
else
{
//Pick a random variation from the suppled IDs and use a random weight from 0-1.
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
xform - > AddVariation ( m_VariationList - > GetVariationCopy ( useVars [ m_Rand . Rand ( useVars . size ( ) ) ] , m_Rand . Frand < T > ( T ( 0.001 ) , 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
}
2014-07-08 03:11:14 -04:00
}
}
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
xform - > NormalizeVariationWeights ( ) ; //Normalize weights to 1.0 total.
}
//Randomize parametric variations.
for ( j = 0 ; j < xform - > TotalVariationCount ( ) ; j + + )
xform - > GetVariation ( j ) - > Random ( m_Rand ) ;
}
//Randomly add symmetry (but not if we've already added a final xform).
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
if ( sym | | ( ! ( m_Rand . Rand ( 4 ) ) & & ! addfinal ) )
2014-07-08 03:11:14 -04:00
ember . AddSymmetry ( sym , m_Rand ) ;
else
ember . m_Symmetry = 0 ;
}
/// <summary>
/// Attempt to make colors better by doing some test renders.
/// </summary>
/// <param name="ember">The ember to render</param>
/// <param name="tries">The number of test renders to try before giving up</param>
/// <param name="changePalette">Change palette if true, else keep trying with the same palette.</param>
/// <param name="colorResolution">The resolution of the test histogram. This value ^ 3 will be used for the total size. Common value is 10.</param>
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
void ImproveColors ( Ember < T > & ember , size_t tries , bool changePalette , size_t colorResolution )
2014-07-08 03:11:14 -04:00
{
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
size_t i ;
2014-07-08 03:11:14 -04:00
T best , b ;
Ember < T > bestEmber = ember ;
best = TryColors ( ember , colorResolution ) ;
if ( best < 0 )
{
2016-05-02 19:54:56 -04:00
cerr < < " Error in TryColors(), skipping ImproveColors() \n " ;
2014-07-08 03:11:14 -04:00
return ;
}
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
for ( i = 0 ; i < tries ; i + + )
{
ChangeColors ( ember , changePalette ) ;
b = TryColors ( ember , colorResolution ) ;
if ( b < 0 )
{
2016-05-02 19:54:56 -04:00
cerr < < " Error in TryColors, aborting tries. \n " ;
2014-07-08 03:11:14 -04:00
break ;
}
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( b > best )
{
best = b ;
bestEmber = ember ;
}
}
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
ember = bestEmber ;
}
/// <summary>
/// Run a test render to improve the colors.
2016-05-02 19:54:56 -04:00
/// This checks to see how much of the possible color space is actually used in the final output image.
/// Images which contain a small number or range of colors will return a lower value.
2014-07-08 03:11:14 -04:00
/// </summary>
/// <param name="ember">The ember to render</param>
2016-05-02 19:54:56 -04:00
/// <param name="colorResolution">The color resolution of the test histogram. This value ^ 3 will be used for the total size. Common value is 10.</param>
/// <returns>The percentage possible color values that were present in the final output image</returns>
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
T TryColors ( Ember < T > & ember , size_t colorResolution )
2014-07-08 03:11:14 -04:00
{
2014-10-14 11:53:15 -04:00
size_t i , hits = 0 , res = colorResolution ;
size_t pixTotal , res3 = res * res * res ;
2014-07-08 03:11:14 -04:00
T scalar ;
Ember < T > adjustedEmber = ember ;
adjustedEmber . m_Quality = 1 ;
adjustedEmber . m_Supersample = 1 ;
adjustedEmber . m_MaxRadDE = 0 ;
//Scale the image so that the total number of pixels is ~10,000.
2014-09-10 01:41:26 -04:00
pixTotal = ember . m_FinalRasW * ember . m_FinalRasH ;
2015-04-13 07:32:58 -04:00
scalar = std : : sqrt ( T ( 10000 ) / pixTotal ) ;
2018-06-19 22:32:20 -04:00
adjustedEmber . m_FinalRasW = static_cast < size_t > ( std : : ceil ( ember . m_FinalRasW * scalar ) ) ;
adjustedEmber . m_FinalRasH = static_cast < size_t > ( std : : ceil ( ember . m_FinalRasH * scalar ) ) ;
2014-07-08 03:11:14 -04:00
adjustedEmber . m_PixelsPerUnit * = scalar ;
adjustedEmber . m_TemporalSamples = 1 ;
2020-03-18 22:34:56 -04:00
m_Renderer - > SetEmber ( adjustedEmber , eProcessAction : : FULL_RENDER , true ) ;
2014-07-08 03:11:14 -04:00
m_Renderer - > EarlyClip ( true ) ;
2014-09-10 01:41:26 -04:00
2015-12-31 19:00:36 -05:00
if ( m_Renderer - > Run ( m_FinalImage ) ! = eRenderStatus : : RENDER_OK )
2014-07-08 03:11:14 -04:00
{
2016-05-02 19:54:56 -04:00
cerr < < " Error rendering test image for TryColors(). Aborting. \n " ;
2014-07-08 03:11:14 -04:00
return - 1 ;
}
2018-06-19 22:32:20 -04:00
m_Hist . resize ( res + res + ( res * res ) + ( res * res * res ) ) ; //Add one extra res just to be safe.
2016-05-02 19:54:56 -04:00
Memset ( m_Hist ) ;
2014-07-08 03:11:14 -04:00
2018-06-19 22:32:20 -04:00
for ( i = 0 ; i < m_FinalImage . size ( ) ; i + + )
2014-07-08 03:11:14 -04:00
{
2018-06-19 22:32:20 -04:00
auto & p = m_FinalImage [ i ] ;
m_Hist [ size_t ( ( p . r * res ) +
( p . g * res ) * res +
( p . b * res ) * res * res ) ] + + ; //A specific histogram index representing the sum of R,G,B values.
2014-07-08 03:11:14 -04:00
}
for ( i = 0 ; i < res3 ; i + + )
2016-05-02 19:54:56 -04:00
if ( m_Hist [ i ] ) //The greater range of RGB values used...
2014-07-08 03:11:14 -04:00
hits + + ;
2016-05-02 19:54:56 -04:00
return T ( hits / res3 ) ; //...the higher this returned ratio will be.
2014-07-08 03:11:14 -04:00
}
/// <summary>
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
/// Change around color coordinates. Optionally change out the entire palette.
2014-07-08 03:11:14 -04:00
/// </summary>
/// <param name="ember">The ember whose xform's color coordinates will be changed</param>
/// <param name="changePalette">Change palette if true, else don't</param>
void ChangeColors ( Ember < T > & ember , bool changePalette )
{
if ( changePalette )
{
2017-02-26 12:34:43 -05:00
if ( m_PaletteList - > Size ( ) )
2014-07-08 03:11:14 -04:00
{
2017-02-26 12:34:43 -05:00
ember . m_Palette = * m_PaletteList - > GetRandomPalette ( ) ;
2014-07-08 03:11:14 -04:00
}
else
{
ember . m_Palette . Clear ( false ) ;
2016-05-02 19:54:56 -04:00
cerr < < " Error retrieving random palette, setting to all white. \n " ;
2014-07-08 03:11:14 -04:00
}
}
2016-02-02 20:51:58 -05:00
for ( size_t i = 0 ; i < ember . TotalXformCount ( ) ; i + + )
2014-07-08 03:11:14 -04:00
{
ember . GetTotalXform ( i ) - > m_ColorX = m_Rand . Frand01 < T > ( ) ;
ember . GetTotalXform ( i ) - > m_ColorY = m_Rand . Frand01 < T > ( ) ;
}
2014-09-10 01:41:26 -04:00
2016-02-02 20:51:58 -05:00
auto xform0 = RandomXform ( ember , - 1 ) ;
auto xform1 = RandomXform ( ember , ember . GetXformIndex ( xform0 ) ) ;
2014-09-10 01:41:26 -04:00
--Bug fixes
-Fix improper usage of rand() in cpow2, cpow3, hypertile1, hypertile3D1, hypertile3D2, juliac, juliaq.
-Fix program crashing during density filtering on some Nvidia cards.
-hypertile3D1 was wrong.
-Parsing phoenix_julia when coming from Apophysis was wrong.
-Density filtering was freezing on certain Nvidia cards.
--Code changes
-Optimize juliac, npolar.
-Add a new function Crand() which behaves like the legacy C rand() which returns an integer between 0 and 32766, inclusive.
-Use RandBit() in some places.
-Remove Zeps() from vignette, it's not needed.
-Restructure OpenCL code for density filtering such that it does not hang after being compiled on some Nvidia cards, such as the gtx 1660. Remove barriers from conditionals where possible.
2020-12-29 00:46:55 -05:00
if ( xform0 & & ( m_Rand . RandBit ( ) ) )
2014-07-08 03:11:14 -04:00
{
xform0 - > m_ColorX = 0 ;
xform0 - > m_ColorY = 0 ;
}
2014-09-10 01:41:26 -04:00
--Bug fixes
-Fix improper usage of rand() in cpow2, cpow3, hypertile1, hypertile3D1, hypertile3D2, juliac, juliaq.
-Fix program crashing during density filtering on some Nvidia cards.
-hypertile3D1 was wrong.
-Parsing phoenix_julia when coming from Apophysis was wrong.
-Density filtering was freezing on certain Nvidia cards.
--Code changes
-Optimize juliac, npolar.
-Add a new function Crand() which behaves like the legacy C rand() which returns an integer between 0 and 32766, inclusive.
-Use RandBit() in some places.
-Remove Zeps() from vignette, it's not needed.
-Restructure OpenCL code for density filtering such that it does not hang after being compiled on some Nvidia cards, such as the gtx 1660. Remove barriers from conditionals where possible.
2020-12-29 00:46:55 -05:00
if ( xform1 & & ( m_Rand . RandBit ( ) ) )
2014-07-08 03:11:14 -04:00
{
xform1 - > m_ColorX = 1 ;
xform1 - > m_ColorY = 1 ;
}
}
/// <summary>
/// Try to get a random xform from the ember, including final, whose density is non-zero.
/// Give up after 100 tries.
/// </summary>
/// <param name="ember">The ember to get a random xform from</param>
/// <param name="excluded">Optionally exclude an xform. Pass -1 to include all for consideration.</param>
2014-09-10 01:41:26 -04:00
/// <returns>The random xform if successful, else nullptr.</returns>
2014-10-14 11:53:15 -04:00
Xform < T > * RandomXform ( Ember < T > & ember , intmax_t excluded )
2014-07-08 03:11:14 -04:00
{
2014-10-14 11:53:15 -04:00
size_t ntries = 0 ;
2014-07-08 03:11:14 -04:00
while ( ntries + + < 100 )
{
--User changes
-Improve performance in the following variations: cpow2, dc_cube, julia3d, julia3dz, julian2, log_db, nblur, npolar, waffle, wavesn, xtrb.
--Code changes
-Rand range now uses multiply + shift rather than modulo.
2019-07-24 21:29:33 -04:00
size_t i = m_Rand . Rand ( ember . TotalXformCount ( ) ) ;
2014-07-08 03:11:14 -04:00
if ( i ! = excluded )
{
2016-02-02 20:51:58 -05:00
auto xform = ember . GetTotalXform ( i ) ;
2014-07-08 03:11:14 -04:00
if ( xform - > m_Weight > 0 )
return xform ;
}
}
2014-09-10 01:41:26 -04:00
return nullptr ;
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Rotate affine transforms and optionally apply motion elements,
/// and store the result in rotated.
/// </summary>
/// <param name="ember">The ember to rotate</param>
/// <param name="rotated">The rotated xform</param>
/// <param name="blend">The time percentage value which dictates how much of a percentage of 360 degrees it should be rotated and the time position for the motion elements</param>
2016-12-05 22:04:33 -05:00
/// <param name="cw">True to rotate clockwise, else rotate counter clockwise. Ignored if rotations is 0.</param>
void Loop ( Ember < T > & ember , Ember < T > & rotated , T blend , bool cw )
2014-07-08 03:11:14 -04:00
{
rotated = ember ;
//Insert motion magic here :
//If there are motion elements, modify the contents of
//the result xforms before rotate is called.
2014-10-14 11:53:15 -04:00
for ( size_t i = 0 ; i < ember . TotalXformCount ( ) ; i + + )
2014-07-08 03:11:14 -04:00
{
2016-02-02 20:51:58 -05:00
auto xform1 = ember . GetTotalXform ( i ) ;
auto xform2 = rotated . GetTotalXform ( i ) ;
2014-07-08 03:11:14 -04:00
if ( ! xform1 - > m_Motion . empty ( ) )
xform2 - > ApplyMotion ( * xform1 , blend ) ;
}
2015-07-02 13:01:37 -04:00
rotated . ApplyFlameMotion ( blend ) ;
2016-12-05 22:04:33 -05:00
rotated . RotateAffines ( ( cw ? blend : - blend ) * 360 ) ; //Rotate the affines.
2015-07-07 00:36:46 -04:00
rotated . DeleteMotionElements ( ) ; //Delete all motion elements from the looped ember, at the xform level and at the parent ember level.
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Interpolate two embers and place the output in result.
/// The embers parameter is expected to be a pointer to an array of at least 2 elements.
/// </summary>
/// <param name="embers">The embers to interpolate</param>
/// <param name="result">The result of the interpolation</param>
/// <param name="blend">The interpolation time</param>
2016-12-05 22:04:33 -05:00
/// <param name="rotations">The number of times to rotate within the interpolation</param>
/// <param name="cw">True to rotate clockwise, else rotate counter clockwise. Ignored if rotations is 0.</param>
2014-07-08 03:11:14 -04:00
/// <param name="seqFlag">True if embers points to the first or last ember in the entire sequence, else false.</param>
2016-12-05 22:04:33 -05:00
void Edge ( Ember < T > * embers , Ember < T > & result , T blend , size_t rotations , bool cw , bool seqFlag )
2014-07-08 03:11:14 -04:00
{
2014-10-14 11:53:15 -04:00
size_t i , si ;
2014-07-08 03:11:14 -04:00
//Insert motion magic here :
//If there are motion elements, modify the contents of
//the result xforms before rotate is called.
for ( si = 0 ; si < 2 ; si + + )
{
2016-04-23 12:02:09 -04:00
m_EdgePrealign [ si ] = embers [ si ] ;
2014-09-10 01:41:26 -04:00
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
for ( i = 0 ; i < m_EdgePrealign [ si ] . TotalXformCount ( ) ; i + + )
2014-07-08 03:11:14 -04:00
{
2016-02-02 20:51:58 -05:00
auto xform = embers [ si ] . GetTotalXform ( i ) ;
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
auto prealignxform = m_EdgePrealign [ si ] . GetTotalXform ( i ) ;
2014-07-08 03:11:14 -04:00
if ( ! xform - > m_Motion . empty ( ) )
--User changes
-No longer constrain pitch, yaw or depth spinners to -180 - 180.
--Bug fixes
-Properly set color index on padded xforms.
-Adding a padding final xform included a linear variation with a weight of zero to not appear empty. Made it have a weight of 1.
-Always write animate tag on final xform when saving to Xml.
-Motion was being applied to the wrong flame in SheepTools::Edge(), so apply it to the correct one.
-Prevent divide by zero when normalizing variation weights.
-Was accidentally adding the placeholder value of -9999 for motion_offset to varation weights and parameters when applying motion. Set to zero if no value present.
-Clamp flame rotation values to -180 - 180 when reading a flame from Xml.
-Events were not properly wired for user changes in the random rotations per blend controls in the sequencer.
-Fix major UI bugs with sequencer min/max random controls which made it nearly impossible to hand type values.
-Values from rotations per blend and rotations per blend max were not being saved to file between program runs.
-Checking animate for an xform was not applied to all flames even if Apply All was checked.
-Changing interpolation type, temporal filter width, temporal type, and affine interpolation type were not actually saving to the flame when changed.
-Grid on the main window was not being drawn at the right scale initially due to some OpenGL initialization occurring in the wrong order.
-Severe bugs in sequence generation code:
--Improperly detected padding xforms.
--When looking for specific variations during xform aligning, only presence was detected, when it should have been presence plus a weight greater than zero.
--When adding specific variations during xform aligning, must first remove any variations of that type.
--Two variables were unsigned when they should have been signed. This prevented large blocks of code from ever executing.
--When interpolating affines, an EPS that was too small was used, causing affine values to interpolate incorrectly. Instead use 1e-10 to ensure results equal to flam3.
--Code changes
-Modify FractoriumEmberController::UpdateXform() to pass the selected xform index as well as the absolute index to func().
2018-06-13 00:20:15 -04:00
prealignxform - > ApplyMotion ( * xform , blend ) ; //Apply motion parameters to result.xform[i] using blend parameter.
2014-07-08 03:11:14 -04:00
}
}
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
//Use the un-padded original for blend=0 when creating a sequence.
//This keeps the original interpolation type intact.
if ( seqFlag & & blend = = 0 )
{
2016-04-23 12:02:09 -04:00
result = m_EdgePrealign [ 0 ] ;
2014-07-08 03:11:14 -04:00
}
else
{
//Align what's going to be interpolated.
2016-04-23 12:02:09 -04:00
Interpolater < T > : : Align ( m_EdgePrealign , m_EdgeSpun , 2 ) ;
m_EdgeSpun [ 0 ] . m_Time = 0 ;
m_EdgeSpun [ 1 ] . m_Time = 1 ;
2014-07-08 03:11:14 -04:00
//Call this first to establish the asymmetric reference angles.
2016-04-23 12:02:09 -04:00
Interpolater < T > : : AsymmetricRefAngles ( m_EdgeSpun , 2 ) ;
2016-12-05 22:04:33 -05:00
2014-07-08 03:11:14 -04:00
//Rotate the aligned xforms.
2016-12-05 22:04:33 -05:00
if ( rotations )
{
auto cwblend = cw ? blend : - blend ;
m_EdgeSpun [ 0 ] . RotateAffines ( cwblend * ( 360 * rotations ) ) ;
m_EdgeSpun [ 1 ] . RotateAffines ( cwblend * ( 360 * rotations ) ) ;
}
2016-04-23 12:02:09 -04:00
m_Interpolater . Interpolate ( m_EdgeSpun , 2 , m_Smooth ? Interpolater < T > : : Smoother ( blend ) : blend , m_Stagger , result ) ;
2014-07-08 03:11:14 -04:00
}
//Make sure there are no motion elements in the result.
result . DeleteMotionElements ( ) ;
}
/// <summary>
/// Spin the specified ember, optionally apply a template ember, and place the output in result.
/// Create auto-generated name
/// Append edits using the Nick, Url and Id members.
/// Apply subpixel jitter to center using offset members.
/// </summary>
/// <param name="parent">The ember to spin</param>
2014-09-10 01:41:26 -04:00
/// <param name="templ">The template to apply if not nullptr, else ignore.</param>
2014-07-08 03:11:14 -04:00
/// <param name="result">The result of the spin</param>
/// <param name="frame">The frame in the sequence to be stored in the m_Time member of result</param>
/// <param name="blend">The interpolation time</param>
2016-12-05 22:04:33 -05:00
/// <param name="cw">True to rotate clockwise, else rotate counter clockwise. Ignored if rotations is 0.</param>
void Spin ( Ember < T > & parent , Ember < T > * templ , Ember < T > & result , size_t frame , T blend , bool cw )
2014-07-08 03:11:14 -04:00
{
2016-12-05 22:04:33 -05:00
auto cwblend = cw ? blend : - blend ;
string temp = " rotate " + std : : to_string ( cwblend * 360.0 ) ;
2014-07-08 03:11:14 -04:00
//Spin the parent blend degrees.
2016-12-05 22:04:33 -05:00
Loop ( parent , result , blend , cw ) ;
2014-07-08 03:11:14 -04:00
//Apply the template if necessary.
if ( templ )
ApplyTemplate ( result , * templ ) ;
//Set ember parameters accordingly.
result . m_Time = T ( frame ) ;
2015-12-31 19:00:36 -05:00
result . m_Interp = eInterp : : EMBER_INTERP_LINEAR ;
result . m_PaletteInterp = ePaletteInterp : : INTERP_HSV ;
2014-07-08 03:11:14 -04:00
//Create the edit doc xml.
result . ClearEdit ( ) ;
2014-09-10 01:41:26 -04:00
result . m_Edits = m_EmberToXml . CreateNewEditdoc ( & parent , nullptr , temp , m_Nick , m_Url , m_Id , m_Comment , m_SheepGen , m_SheepId ) ;
2014-07-08 03:11:14 -04:00
//Subpixel jitter.
Offset ( result , m_OffsetX , m_OffsetY ) ;
//Make the name of the flame the time.
2016-12-05 22:04:33 -05:00
result . m_Name = std : : to_string ( result . m_Time ) ;
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Call Edge() on parents, optionally apply a template ember, and place the output in result.
/// Create auto-generated name
/// Append edits using the Nick, Url and Id members.
/// Apply subpixel jitter to center using offset members.
/// </summary>
/// <param name="parents">The embers to interpolate</param>
2014-09-10 01:41:26 -04:00
/// <param name="templ">The template to apply if not nullptr, else ignore.</param>
2014-07-08 03:11:14 -04:00
/// <param name="result">The result of the spin</param>
/// <param name="frame">The frame in the sequence to be stored in the m_Time member of result</param>
/// <param name="seqFlag">True if embers points to the first or last ember in the entire sequence, else false.</param>
/// <param name="blend">The interpolation time</param>
2016-12-05 22:04:33 -05:00
/// <param name="rotations">The number of times to rotate within the interpolation</param>
/// <param name="cw">True to rotate clockwise, else rotate counter clockwise. Ignored if rotations is 0.</param>
void SpinInter ( Ember < T > * parents , Ember < T > * templ , Ember < T > & result , size_t frame , bool seqFlag , T blend , size_t rotations , bool cw )
2014-07-08 03:11:14 -04:00
{
2016-12-05 22:04:33 -05:00
auto cwblend = cw ? blend : - blend ;
string temp = " interpolate " + std : : to_string ( cwblend * 360.0 ) ;
2014-07-08 03:11:14 -04:00
//Interpolate between spun parents.
2016-12-05 22:04:33 -05:00
Edge ( parents , result , blend , rotations , cw , seqFlag ) ;
2014-07-08 03:11:14 -04:00
//Original did an interpolated palette hack here for random palettes, but it was never used anywhere so ember omits it.//ORIG
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
//Apply the template if necessary.
if ( templ )
ApplyTemplate ( result , * templ ) ;
//Set ember parameters accordingly.
result . m_Time = T ( frame ) ;
//Create the edit doc xml.
result . ClearEdit ( ) ;
result . m_Edits = m_EmberToXml . CreateNewEditdoc ( & parents [ 0 ] , & parents [ 1 ] , temp , m_Nick , m_Url , m_Id , m_Comment , m_SheepGen , m_SheepId ) ;
//Subpixel jitter.
Offset ( result , m_OffsetX , m_OffsetY ) ;
//Make the name of the flame the time.
2016-12-05 22:04:33 -05:00
result . m_Name = std : : to_string ( result . m_Time ) ;
2014-07-08 03:11:14 -04:00
}
/// <summary>
/// Apply a template to an ember.
/// </summary>
/// <param name="ember">The ember to apply the template to</param>
/// <param name="templ">The template to apply</param>
void ApplyTemplate ( Ember < T > & ember , Ember < T > & templ )
{
//Check for invalid values - only replace those with valid ones.
2014-10-14 11:53:15 -04:00
for ( glm : : length_t i = 0 ; i < 3 ; i + + )
2014-07-08 03:11:14 -04:00
if ( templ . m_Background [ i ] > = 0 )
ember . m_Background [ i ] = templ . m_Background [ i ] ;
2016-05-02 19:54:56 -04:00
if ( templ . m_Zoom < 999999 )
2014-07-08 03:11:14 -04:00
ember . m_Zoom = templ . m_Zoom ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_Supersample > 0 )
ember . m_Supersample = templ . m_Supersample ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_SpatialFilterRadius > = 0 )
ember . m_SpatialFilterRadius = templ . m_SpatialFilterRadius ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_Quality > 0 )
ember . m_Quality = templ . m_Quality ;
2014-09-10 01:41:26 -04:00
2016-05-02 19:54:56 -04:00
if ( templ . m_SubBatchSize > 0 )
ember . m_SubBatchSize = templ . m_SubBatchSize ;
if ( templ . m_FuseCount > 0 )
ember . m_FuseCount = templ . m_FuseCount ;
2014-07-08 03:11:14 -04:00
if ( templ . m_TemporalSamples > 0 )
ember . m_TemporalSamples = templ . m_TemporalSamples ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_FinalRasW > 0 )
{
//Preserving scale should be an option.
ember . m_PixelsPerUnit = ember . m_PixelsPerUnit * templ . m_FinalRasW / ember . m_FinalRasW ;
ember . m_FinalRasW = templ . m_FinalRasW ;
}
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_FinalRasH > 0 )
ember . m_FinalRasH = templ . m_FinalRasH ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_MaxRadDE > = 0 )
ember . m_MaxRadDE = templ . m_MaxRadDE ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_MinRadDE > = 0 )
ember . m_MinRadDE = templ . m_MinRadDE ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_CurveDE > = 0 )
ember . m_CurveDE = templ . m_CurveDE ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_GammaThresh > = 0 )
ember . m_GammaThresh = templ . m_GammaThresh ;
2014-09-10 01:41:26 -04:00
2015-12-31 19:00:36 -05:00
if ( templ . m_SpatialFilterType > eSpatialFilterType : : GAUSSIAN_SPATIAL_FILTER )
2014-07-08 03:11:14 -04:00
ember . m_SpatialFilterType = templ . m_SpatialFilterType ;
2014-09-10 01:41:26 -04:00
2016-05-02 19:54:56 -04:00
if ( templ . m_Interp ! = eInterp : : EMBER_INTERP_SMOOTH )
2014-07-08 03:11:14 -04:00
ember . m_Interp = templ . m_Interp ;
2014-09-10 01:41:26 -04:00
2016-05-02 19:54:56 -04:00
if ( templ . m_AffineInterp ! = eAffineInterp : : AFFINE_INTERP_LOG )
2014-07-08 03:11:14 -04:00
ember . m_AffineInterp = templ . m_AffineInterp ;
2014-09-10 01:41:26 -04:00
2015-12-31 19:00:36 -05:00
if ( templ . m_TemporalFilterType > = eTemporalFilterType : : BOX_TEMPORAL_FILTER )
2014-07-08 03:11:14 -04:00
ember . m_TemporalFilterType = templ . m_TemporalFilterType ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( templ . m_TemporalFilterWidth > 0 )
ember . m_TemporalFilterWidth = templ . m_TemporalFilterWidth ;
2014-09-10 01:41:26 -04:00
2016-05-02 19:54:56 -04:00
if ( templ . m_TemporalFilterExp > - 999 )
2014-07-08 03:11:14 -04:00
ember . m_TemporalFilterExp = templ . m_TemporalFilterExp ;
2014-09-10 01:41:26 -04:00
2016-05-02 19:54:56 -04:00
if ( templ . m_HighlightPower ! = 1 )
2014-07-08 03:11:14 -04:00
ember . m_HighlightPower = templ . m_HighlightPower ;
2014-09-10 01:41:26 -04:00
2016-05-02 19:54:56 -04:00
if ( templ . m_PaletteMode ! = ePaletteMode : : PALETTE_LINEAR )
2014-07-08 03:11:14 -04:00
ember . m_PaletteMode = templ . m_PaletteMode ;
}
/// <summary>
/// Move the center of the ember by the specified amount.
/// </summary>
/// <param name="ember">The ember to move</param>
/// <param name="offsetX">The x offset.</param>
/// <param name="offsetY">The y offset.</param>
void Offset ( Ember < T > & ember , T offsetX , T offsetY )
{
if ( ! IsNearZero < T > ( offsetX ) )
ember . m_CenterX + = offsetX / ( ember . m_PixelsPerUnit * ember . m_Supersample ) ;
if ( ! IsNearZero < T > ( offsetY ) )
ember . m_CenterY + = offsetY / ( ember . m_PixelsPerUnit * ember . m_Supersample ) ;
}
/// <summary>
/// Translate the first center point by the second, rotate it, translate back.
/// </summary>
/// <param name="newCenterX">The new center x</param>
/// <param name="newCenterY">The new center y</param>
/// <param name="oldCenterX">The old center x</param>
/// <param name="oldCenterY">The old center y</param>
/// <param name="by">The angle to rotate by</param>
void RotateOldCenterBy ( T & newCenterX , T & newCenterY , T oldCenterX , T oldCenterY , T by )
{
T r [ 2 ] ;
T th = by * 2 * T ( M_PI ) / 360 ;
--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 c = std : : cos ( th ) ;
T s = - std : : sin ( th ) ;
2014-07-08 03:11:14 -04:00
newCenterX - = oldCenterX ;
newCenterY - = oldCenterY ;
r [ 0 ] = c * newCenterX - s * newCenterY ;
r [ 1 ] = s * newCenterX + c * newCenterY ;
newCenterX = r [ 0 ] + oldCenterX ;
newCenterY = r [ 1 ] + oldCenterY ;
}
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
/// <summary>
/// Find a 2D bounding box that does not enclose eps of the fractal density in each compass direction.
/// This will run the inner loops of iteration without all of the surrounding interpolation and filtering.
/// </summary>
/// <param name="ember">The ember to iterate</param>
/// <param name="eps">The eps</param>
/// <param name="samples">The number samples to iterate</param>
/// <param name="bmin">The bmin[0] and bmin[1] will be the minimum x and y values.</param>
/// <param name="bmax">The bmax[0] and bmax[1] will be the maximum x and y values.</param>
/// <returns>The number of iterations ran</returns>
2014-10-14 11:53:15 -04:00
size_t EstimateBoundingBox ( Ember < T > & ember , T eps , size_t samples , T * bmin , T * bmax )
2014-07-08 03:11:14 -04:00
{
2014-10-14 11:53:15 -04:00
size_t i , lowTarget , highTarget ;
2014-07-08 03:11:14 -04:00
T min [ 2 ] , max [ 2 ] ;
2014-11-28 04:37:51 -05:00
IterParams < T > params ;
2017-05-12 18:31:48 -04:00
m_Renderer - > SetEmber ( ember , eProcessAction : : FULL_RENDER , true ) ;
2014-07-08 03:11:14 -04:00
if ( ember . XaosPresent ( ) )
m_Iterator = m_XaosIterator . get ( ) ;
else
m_Iterator = m_StandardIterator . get ( ) ;
m_Iterator - > InitDistributions ( ember ) ;
m_Samples . resize ( samples ) ;
2014-11-28 04:37:51 -05:00
params . m_Count = samples ;
params . m_Skip = 20 ;
2020-01-19 01:29:08 -05:00
auto & ctr = m_Renderer - > CoordMap ( ) ;
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
//params.m_OneColDiv2 = m_Renderer->CoordMap().OneCol() / 2;
//params.m_OneRowDiv2 = m_Renderer->CoordMap().OneRow() / 2;
2020-01-19 01:29:08 -05:00
size_t bv = m_Iterator - > Iterate ( ember , params , ctr , m_Samples . data ( ) , m_Rand ) ; //Use a special fuse of 20, all other calls to this will use 15, or 100.
2014-09-01 00:25:15 -04:00
2014-07-08 03:11:14 -04:00
if ( bv / T ( samples ) > eps )
eps = 3 * bv / T ( samples ) ;
2014-09-10 01:41:26 -04:00
2014-07-08 03:11:14 -04:00
if ( eps > T ( 0.3 ) )
eps = T ( 0.3 ) ;
2014-12-07 02:51:44 -05:00
lowTarget = static_cast < size_t > ( samples * eps ) ;
2014-07-08 03:11:14 -04:00
highTarget = samples - lowTarget ;
min [ 0 ] = min [ 1 ] = 1e10 ;
max [ 0 ] = max [ 1 ] = - 1e10 ;
for ( i = 0 ; i < samples ; i + + )
{
if ( m_Samples [ i ] . m_X < min [ 0 ] ) min [ 0 ] = m_Samples [ i ] . m_X ;
2015-12-31 19:00:36 -05:00
2014-07-08 03:11:14 -04:00
if ( m_Samples [ i ] . m_Y < min [ 1 ] ) min [ 1 ] = m_Samples [ i ] . m_Y ;
2015-12-31 19:00:36 -05:00
2014-07-08 03:11:14 -04:00
if ( m_Samples [ i ] . m_X > max [ 0 ] ) max [ 0 ] = m_Samples [ i ] . m_X ;
2015-12-31 19:00:36 -05:00
2014-07-08 03:11:14 -04:00
if ( m_Samples [ i ] . m_Y > max [ 1 ] ) max [ 1 ] = m_Samples [ i ] . m_Y ;
}
if ( lowTarget = = 0 )
{
bmin [ 0 ] = min [ 0 ] ;
bmin [ 1 ] = min [ 1 ] ;
bmax [ 0 ] = max [ 0 ] ;
bmax [ 1 ] = max [ 1 ] ;
return bv ;
}
std : : sort ( m_Samples . begin ( ) , m_Samples . end ( ) , & SortPointByX < T > ) ;
bmin [ 0 ] = m_Samples [ lowTarget ] . m_X ;
bmax [ 0 ] = m_Samples [ highTarget ] . m_X ;
std : : sort ( m_Samples . begin ( ) , m_Samples . end ( ) , & SortPointByY < T > ) ;
bmin [ 1 ] = m_Samples [ lowTarget + 1 ] . m_Y ;
bmax [ 1 ] = m_Samples [ highTarget + 1 ] . m_Y ;
return bv ;
}
/// <summary>
/// When doing spin or edge, an edit doc is made to record what was done.
/// Doing so takes many extra parameters such as name and url. Passing these every
/// time is cumbersome and are unlikely to change for the duration of a program run, so
/// they are made to be member variables. After setting these, their values will be used
/// in all edits within this class.
/// </summary>
/// <param name="smooth">Use smoothing if true, else false</param>
/// <param name="stagger">Use stagger if > 0, else false</param>
/// <param name="offsetX">X amount of subpixel jitter to apply in Spin() and Edge()</param>
/// <param name="offsetY">Y amount of subpixel jitter to apply in Spin() and Edge()</param>
/// <param name="nick">The nickname of the author</param>
/// <param name="url">The Url of the author</param>
/// <param name="id">The id of the author</param>
/// <param name="comment">The comment to include</param>
/// <param name="sheepGen">The sheep generation used if > 0. Default: 0.</param>
/// <param name="sheepId">The sheep id used if > 0. Default: 0.</param>
--User changes
-Add support for multiple GPU devices.
--These options are present in the command line and in Fractorium.
-Change scheme of specifying devices from platform,device to just total device index.
--Single number on the command line.
--Change from combo boxes for device selection to a table of all devices in Fractorium.
-Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Bug fixes
-EmberAnimate, EmberRender, FractoriumSettings, FinalRenderDialog: Fix wrong order of arguments to Clamp() when assigning thread priority.
-VariationsDC.h: Fix NVidia OpenCL compilation error in DCTriangleVariation.
-FractoriumXformsColor.cpp: Checking for null pixmap pointer is not enough, must also check if the underlying buffer is null via call to QPixmap::isNull().
--Code changes
-Ember.h: Add case for FLAME_MOTION_NONE and default in ApplyFlameMotion().
-EmberMotion.h: Call base constructor.
-EmberPch.h: #pragma once only on Windows.
-EmberToXml.h:
--Handle different types of exceptions.
--Add default cases to ToString().
-Isaac.h: Remove unused variable in constructor.
-Point.h: Call base constructor in Color().
-Renderer.h/cpp:
--Add bool to Alloc() to only allocate memory for the histogram. Needed for multi-GPU.
--Make CoordMap() return a const ref, not a pointer.
-SheepTools.h:
--Use 64-bit types like the rest of the code already does.
--Fix some comment misspellings.
-Timing.h: Make BeginTime(), EndTime(), ElapsedTime() and Format() be const functions.
-Utils.h:
--Add new functions Equal() and Split().
--Handle more exception types in ReadFile().
--Get rid of most legacy blending of C and C++ argument parsing.
-XmlToEmber.h:
--Get rid of most legacy blending of C and C++ code from flam3.
--Remove some unused variables.
-EmberAnimate:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--If a render fails, exit since there is no point in continuing an animation with a missing frame.
--Pass variables to threaded save better, which most likely fixes a very subtle bug that existed before.
--Remove some unused variables.
-EmberGenome, EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
-EmberRender:
--Support multi-GPU processing that alternates full frames between devices.
--Use OpenCLInfo instead of OpenCLWrapper for --openclinfo option.
--Remove bucketT template parameter, and hard code float in its place.
--Only print values when not rendering with OpenCL, since they're always 0 in that case.
-EmberCLPch.h:
--#pragma once only on Windows.
--#include <atomic>.
-IterOpenCLKernelCreator.h: Add new kernel for summing two histograms. This is needed for multi-GPU.
-OpenCLWrapper.h:
--Move all OpenCL info related code into its own class OpenCLInfo.
--Add members to cache the values of global memory size and max allocation size.
-RendererCL.h/cpp:
--Redesign to accomodate multi-GPU.
--Constructor now takes a vector of devices.
--Remove DumpErrorReport() function, it's handled in the base.
--ClearBuffer(), ReadPoints(), WritePoints(), ReadHist() and WriteHist() now optionally take a device index as a parameter.
--MakeDmap() override and m_DmapCL member removed because it no longer applies since the histogram is always float since the last commit.
--Add new function SumDeviceHist() to sum histograms from two devices by first copying to a temporary on the host, then a temporary on the device, then summing.
--m_Calls member removed, as it's now per-device.
--OpenCLWrapper removed.
--m_Seeds member is now a vector of vector of seeds, to accomodate a separate and different array of seeds for each device.
--Added member m_Devices, a vector of unique_ptr of RendererCLDevice.
-EmberCommon.h
--Added Devices() function to convert from a vector of device indices to a vector of platform,device indices.
--Changed CreateRenderer() to accept a vector of devices to create a single RendererCL which will split work across multiple devices.
--Added CreateRenderers() function to accept a vector of devices to create multiple RendererCL, each which will render on a single device.
--Add more comments to some existing functions.
-EmberCommonPch.h: #pragma once only on Windows.
-EmberOptions.h:
--Remove --platform option, it's just sequential device number now with the --device option.
--Make --out be OPT_USE_RENDER instead of OPT_RENDER_ANIM since it's an error condition when animating. It makes no sense to write all frames to a single image.
--Add Devices() function to parse comma separated --device option string and return a vector of device indices.
--Make int and uint types be 64-bit, so intmax_t and size_t.
--Make better use of macros.
-JpegUtils.h: Make string parameters to WriteJpeg() and WritePng() be const ref.
-All project files: Turn off buffer security check option in Visual Studio (/Gs-)
-deployment.pri: Remove the line OTHER_FILES +=, it's pointless and was causing problems.
-Ember.pro, EmberCL.pro: Add CONFIG += plugin, otherwise it wouldn't link.
-EmberCL.pro: Add new files for multi-GPU support.
-build_all.sh: use -j4 and QMAKE=${QMAKE:/usr/bin/qmake}
-shared_settings.pri:
-Add version string.
-Remove old DESTDIR definitions.
-Add the following lines or else nothing would build:
CONFIG(release, debug|release) {
CONFIG += warn_off
DESTDIR = ../../../Bin/release
}
CONFIG(debug, debug|release) {
DESTDIR = ../../../Bin/debug
}
QMAKE_POST_LINK += $$quote(cp --update ../../../Data/flam3-palettes.xml $${DESTDIR}$$escape_expand(\n\t))
LIBS += -L/usr/lib -lpthread
-AboutDialog.ui: Another futile attempt to make it look correct on Linux.
-FinalRenderDialog.h/cpp:
--Add support for multi-GPU.
--Change from combo boxes for device selection to a table of all devices.
--Ensure device selection makes sense.
--Remove "FinalRender" prefix of various function names, it's implied given the context.
-FinalRenderEmberController.h/cpp:
--Add support for multi-GPU.
--Change m_FinishedImageCount to be atomic.
--Move CancelRender() from the base to FinalRenderEmberController<T>.
--Refactor RenderComplete() to omit any progress related functionality or image saving since it can be potentially ran in a thread.
--Consolidate setting various renderer fields into SyncGuiToRenderer().
-Fractorium.cpp: Allow for resizing of the options dialog to show the entire device table.
-FractoriumCommon.h: Add various functions to handle a table showing the available OpenCL devices on the system.
-FractoriumEmberController.h/cpp: Remove m_FinalImageIndex, it's no longer needed.
-FractoriumRender.cpp: Scale the interactive sub batch count and quality by the number of devices used.
-FractoriumSettings.h/cpp:
--Temporal samples defaults to 100 instead of 1000 which was needless overkill.
--Add multi-GPU support, remove old device,platform pair.
-FractoriumToolbar.cpp: Disable OpenCL toolbar button if there are no devices present on the system.
-FractoriumOptionsDialog.h/cpp:
--Add support for multi-GPU.
--Consolidate more assignments in DataToGui().
--Enable/disable CPU/OpenCL items in response to OpenCL checkbox event.
-Misc: Convert almost everything to size_t for unsigned, intmax_t for signed.
2015-09-12 21:33:45 -04:00
void SetSpinParams ( bool smooth , T stagger , T offsetX , T offsetY , const string & nick , const string & url , const string & id , const string & comment , intmax_t sheepGen , intmax_t sheepId )
2014-07-08 03:11:14 -04:00
{
m_Smooth = smooth ;
m_SheepGen = sheepGen ;
m_SheepId = sheepId ;
m_Stagger = stagger ;
m_OffsetX = offsetX ;
m_OffsetY = offsetY ;
m_Nick = nick ;
m_Url = url ;
m_Id = id ;
m_Comment = comment ;
}
2016-06-11 20:47:03 -04:00
/// <summary>
/// Set stagger value.
/// Greater than 0 means interpolate xforms one at a time, else interpolate all at once.
/// </summary>
/// <param name="stagger">The stagger value to set.</param>
void Stagger ( T stagger )
{
m_Stagger = stagger ;
}
2014-07-08 03:11:14 -04:00
private :
2016-04-03 21:55:12 -04:00
bool m_Smooth = true ;
intmax_t m_SheepGen = - 1 ;
intmax_t m_SheepId = - 1 ;
T m_Stagger = 0 ;
T m_OffsetX = 0 ;
T m_OffsetY = 0 ;
2014-07-08 03:11:14 -04:00
string m_Nick ;
string m_Url ;
string m_Id ;
string m_Comment ;
vector < Point < T > > m_Samples ;
2017-07-22 16:43:35 -04:00
vector < v4F > m_FinalImage ;
2014-12-06 00:05:09 -05:00
vector < uint > m_Hist ;
2014-07-08 03:11:14 -04:00
EmberToXml < T > m_EmberToXml ;
Iterator < T > * m_Iterator ;
2016-04-23 12:02:09 -04:00
Interpolater < T > m_Interpolater ;
Ember < T > m_Parents [ 2 ] ;
Ember < T > m_EdgeSpun [ 2 ] ;
Ember < T > m_EdgePrealign [ 2 ] ;
2016-04-03 21:55:12 -04:00
unique_ptr < StandardIterator < T > > m_StandardIterator = make_unique < StandardIterator < T > > ( ) ;
unique_ptr < XaosIterator < T > > m_XaosIterator = make_unique < XaosIterator < T > > ( ) ;
2014-09-10 01:41:26 -04:00
unique_ptr < Renderer < T , bucketT > > m_Renderer ;
2014-07-08 03:11:14 -04:00
QTIsaac < ISAAC_SIZE , ISAAC_INT > m_Rand ;
2017-02-26 12:34:43 -05:00
shared_ptr < PaletteList < float > > m_PaletteList ;
2016-04-13 23:59:57 -04:00
shared_ptr < VariationList < T > > m_VariationList ;
2014-07-08 03:11:14 -04:00
} ;
2014-09-10 01:41:26 -04:00
}