mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-12 03:04:51 -04:00
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth. -Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted. -When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember. -Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render. -Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply. -Make default temporal samples be 100, whereas before it was 1000 which was overkill. -Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box. -This wasn't otherwise fixable without writing a lot more code. --Bug fixes -EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it. -EmberGenome was improperly handling the first frame of a merge after the last frame of the loop. -These bugs were due to a previous commit. Revert parts of that commit. -Prevent a zoom value of less than 0 when reading from xml. -Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already. -Unique file naming was broken because it was looking for _# and the default names ended with -#. -Disallow renaming of an ember in the library tree to an empty string. -Severe bug that prevented some variations from being read correctly from params generated outside this program. -Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1. -Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double. -Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU. -Prevent user from saving stylesheet to default.qss, it's a special reserved filename. --Code changes -Generalize using the running sum output point inside of a variation for all cases: pre, reg and post. -Allow for array variables in variations where the address of each element is stored in m_Params. -Qualify all math functions with std:: -No longer use our own Clamp() in OpenCL, instead use the standard clamp(). -Redesign how functions are used in the variations OpenCL code. -Add tests to EmberTester to verify some of the new functionality. -Place more const and override qualifiers on functions where appropriate. -Add a global rand with a lock to be used very sparingly. -Use a map instead of a vector for bad param names in Xml parsing. -Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear. -Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread. -Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember. -Add Contains() function to Utils.h. -EmberRender: print names of kernels being printed with --dump_kernel option. -Clean up EmberTester to handle some of the recent changes. -Fix various casts. -Replace % 2 with & 1, even though the compiler was likely doing this already. -Add new file Variations06.h to accommodate new variations. -General cleanup.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "EmberDefines.h"
|
||||
#include "Timing.h"
|
||||
|
||||
/// <summary>
|
||||
/// C++ TEMPLATE VERSION OF Robert J. Jenkins Jr.'s
|
||||
@ -65,6 +65,8 @@ public:
|
||||
/// </summary>
|
||||
static unique_ptr<QTIsaac<ALPHA, ISAAC_INT> > GlobalRand;
|
||||
|
||||
static CriticalSection m_CS;
|
||||
|
||||
/// <summary>
|
||||
/// The structure which holds all of the random information.
|
||||
/// </summary>
|
||||
@ -116,6 +118,18 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of RandByte().
|
||||
/// </summary>
|
||||
/// <returns>The next random integer in the range of 0-255</returns>
|
||||
static inline T LockedRandByte()
|
||||
{
|
||||
m_CS.Enter();
|
||||
T t = GlobalRand->RandByte();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the next random integer.
|
||||
/// </summary>
|
||||
@ -129,6 +143,18 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Rand().
|
||||
/// </summary>
|
||||
/// <returns>The next random integer</returns>
|
||||
static inline T LockedRand()
|
||||
{
|
||||
m_CS.Enter();
|
||||
T t = GlobalRand->Rand();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the next random integer between 0 and the value passed in minus 1.
|
||||
/// </summary>
|
||||
@ -139,6 +165,19 @@ public:
|
||||
return (upper == 0) ? Rand() : Rand() % upper;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Rand().
|
||||
/// </summary>
|
||||
/// <param name="upper">A value one greater than the maximum value that will be returned</param>
|
||||
/// <returns>A value between 0 and the value passed in minus 1</returns>
|
||||
static inline T LockedRand(T upper)
|
||||
{
|
||||
m_CS.Enter();
|
||||
T t = GlobalRand->Rand(upper);
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a random floating point value between the specified minimum and maximum.
|
||||
/// Template argument expected to be float or double.
|
||||
@ -153,6 +192,21 @@ public:
|
||||
return fMin + (f * (fMax - fMin));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Frand().
|
||||
/// </summary>
|
||||
/// <param name="fMin">The minimum value allowed, inclusive.</param>
|
||||
/// <param name="fMax">The maximum value allowed, inclusive.</param>
|
||||
/// <returns>A new random floating point value within the specified range, inclusive.</returns>
|
||||
template<typename floatType>
|
||||
static inline floatType LockedFrand(floatType fMin, floatType fMax)
|
||||
{
|
||||
m_CS.Enter();
|
||||
floatType t = GlobalRand->Frand<floatType>(fMin, fMax);
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thin wrapper around a call to Frand() with a range of 0-1.
|
||||
/// Template argument expected to be float or double.
|
||||
@ -168,6 +222,19 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Frand01().
|
||||
/// </summary>
|
||||
/// <returns>A new random number in the range of 0-1, inclusive.</returns>
|
||||
template<typename floatType>
|
||||
static inline floatType LockedFrand01()
|
||||
{
|
||||
m_CS.Enter();
|
||||
floatType t = GlobalRand->Frand01<floatType>();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Thin wrapper around a call to Frand() with a range of -1-1.
|
||||
/// Template argument expected to be float or double.
|
||||
@ -183,6 +250,19 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of Frand11().
|
||||
/// </summary>
|
||||
/// <returns>A new random number in the range of -1-1, inclusive.</returns>
|
||||
template<typename floatType>
|
||||
static inline floatType LockedFrand11()
|
||||
{
|
||||
m_CS.Enter();
|
||||
floatType t = GlobalRand->Frand11<floatType>();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not sure what this does.
|
||||
/// </summary>
|
||||
@ -193,6 +273,19 @@ public:
|
||||
return RandBit() ? floatType(0.38196) : floatType(0.61804);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of GoldenBit().
|
||||
/// </summary>
|
||||
/// <returns>Something that is golden</returns>
|
||||
template<typename floatType>
|
||||
static inline floatType LockedGoldenBit()
|
||||
{
|
||||
m_CS.Enter();
|
||||
floatType t = GlobalRand->GoldenBit<floatType>();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a random 0 or 1.
|
||||
/// </summary>
|
||||
@ -202,6 +295,18 @@ public:
|
||||
return RandByte() & 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locked version of RandBit().
|
||||
/// </summary>
|
||||
/// <returns>A random 0 or 1</returns>
|
||||
static inline uint LockedRandBit()
|
||||
{
|
||||
m_CS.Enter();
|
||||
uint t = GlobalRand->RandBit();
|
||||
m_CS.Leave();
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A different way of getting a floating point rand in the range -1-1.
|
||||
/// Flam3 used this but it seems unnecessary now, keep around if it's ever needed.
|
||||
|
Reference in New Issue
Block a user