mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2026-06-09 14:51:58 -04:00
Initial VS2013, C++11 and linux commit. This most likely won't build and suffers from some compiler issues. More commits to follow.
This commit is contained in:
+79
-49
@@ -8,10 +8,20 @@ namespace EmberNs
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
Affine2D<T>::Affine2D()
|
||||
{
|
||||
{
|
||||
MakeID();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default copy constructor.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D object to copy</param>
|
||||
template <typename T>
|
||||
Affine2D<T>::Affine2D(const Affine2D<T>& affine)
|
||||
{
|
||||
Affine2D<T>::operator=<T>(affine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor which takes each column of the affine as a separate parameter.
|
||||
/// </summary>
|
||||
@@ -62,6 +72,68 @@ Affine2D<T>::Affine2D(m4T& mat)
|
||||
F(mat[1][3]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default assignment operator.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D object to copy</param>
|
||||
template <typename T>
|
||||
Affine2D<T>& Affine2D<T>::operator = (const Affine2D<T>& affine)
|
||||
{
|
||||
if (this != &affine)
|
||||
Affine2D<T>::operator=<T>(affine);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// == operator which tests if all fields are equal with another Affine2D.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D to compare to</param>
|
||||
/// <returns>True if all fields are equal, else false</returns>
|
||||
template <typename T>
|
||||
bool Affine2D<T>::operator == (const Affine2D<T>& affine)
|
||||
{
|
||||
return IsClose(A(), affine.A()) &&
|
||||
IsClose(B(), affine.B()) &&
|
||||
IsClose(C(), affine.C()) &&
|
||||
IsClose(D(), affine.D()) &&
|
||||
IsClose(E(), affine.E()) &&
|
||||
IsClose(F(), affine.F());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// * operator to multiply this affine transform by another and return the result.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D to multiply by</param>
|
||||
/// <returns>A new Affine2D which is the product of the multiplication</returns>
|
||||
template <typename T>
|
||||
Affine2D<T>& Affine2D<T>::operator * (const Affine2D<T>& affine)
|
||||
{
|
||||
v2T x = affine.X();
|
||||
v2T y = affine.Y();
|
||||
v2T o = affine.O();
|
||||
v2T tx = TransformNormal(x);
|
||||
v2T ty = TransformNormal(y);
|
||||
v2T to = TransformNormal(o);
|
||||
|
||||
X(tx);
|
||||
Y(ty);
|
||||
O(to);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// * operator to multiply this affine transform by a vec2 and return the result as a vec2.
|
||||
/// </summary>
|
||||
/// <param name="v">The vec2 to multiply by</param>
|
||||
/// <returns>A new vec2 which is the product of the multiplication</returns>
|
||||
template <typename T>
|
||||
typename v2T Affine2D<T>::operator * (const v2T& v)
|
||||
{
|
||||
return TransformVector(v);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make this affine transform the identity matrix.
|
||||
/// A and E = 1, all else 0.
|
||||
@@ -251,48 +323,6 @@ typename m4T Affine2D<T>::ToMat4RowMajor(bool center) const
|
||||
return mat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// == operator which tests if all fields are equal with another Affine2D.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D to compare to</param>
|
||||
/// <returns>True if all fields are equal, else false</returns>
|
||||
template <typename T>
|
||||
bool Affine2D<T>::operator == (const Affine2D<T>& affine)
|
||||
{
|
||||
return IsClose(A(), affine.A()) &&
|
||||
IsClose(B(), affine.B()) &&
|
||||
IsClose(C(), affine.C()) &&
|
||||
IsClose(D(), affine.D()) &&
|
||||
IsClose(E(), affine.E()) &&
|
||||
IsClose(F(), affine.F());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// * operator to multiply this affine transform by another and return the result.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D to multiply by</param>
|
||||
/// <returns>A new Affine2D which is the product of the multiplication</returns>
|
||||
template <typename T>
|
||||
Affine2D<T>& Affine2D<T>::operator * (const Affine2D<T>& affine)
|
||||
{
|
||||
X(TransformNormal(affine.X()));
|
||||
Y(TransformNormal(affine.Y()));
|
||||
O(TransformVector(affine.O()));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// * operator to multiply this affine transform by a vec2 and return the result as a vec2.
|
||||
/// </summary>
|
||||
/// <param name="v">The vec2 to multiply by</param>
|
||||
/// <returns>A new vec2 which is the product of the multiplication</returns>
|
||||
template <typename T>
|
||||
typename v2T Affine2D<T>::operator * (const v2T& v)
|
||||
{
|
||||
return TransformVector(v);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accessors.
|
||||
/// </summary>
|
||||
@@ -301,7 +331,7 @@ template <typename T> T Affine2D<T>::B() const { return m_Mat[0][1]; }//[1][0]
|
||||
template <typename T> T Affine2D<T>::C() const { return m_Mat[0][2]; }//[2][0]
|
||||
template <typename T> T Affine2D<T>::D() const { return m_Mat[1][0]; }//[0][1]
|
||||
template <typename T> T Affine2D<T>::E() const { return m_Mat[1][1]; }//[1][1]
|
||||
template <typename T> T Affine2D<T>::F() const { return m_Mat[1][2]; }//[2][1]
|
||||
template <typename T> T Affine2D<T>::F() const { return m_Mat[1][2]; }//[2][1]
|
||||
|
||||
template <typename T> void Affine2D<T>::A(T a) { m_Mat[0][0] = a; }
|
||||
template <typename T> void Affine2D<T>::B(T b) { m_Mat[0][1] = b; }
|
||||
@@ -314,9 +344,9 @@ template <typename T> typename v2T Affine2D<T>::X() const { return v2T(A(), D())
|
||||
template <typename T> typename v2T Affine2D<T>::Y() const { return v2T(B(), E()); }//Y Axis.
|
||||
template <typename T> typename v2T Affine2D<T>::O() const { return v2T(C(), F()); }//Translation.
|
||||
|
||||
template <typename T> void Affine2D<T>::X(v2T& x) { A(x.x); D(x.y); }//X Axis.
|
||||
template <typename T> void Affine2D<T>::Y(v2T& y) { B(y.x); E(y.y); }//Y Axis.
|
||||
template <typename T> void Affine2D<T>::O(v2T& t) { C(t.x); F(t.y); }//Translation.
|
||||
template <typename T> void Affine2D<T>::X(const v2T& x) { A(x.x); D(x.y); }//X Axis.
|
||||
template <typename T> void Affine2D<T>::Y(const v2T& y) { B(y.x); E(y.y); }//Y Axis.
|
||||
template <typename T> void Affine2D<T>::O(const v2T& t) { C(t.x); F(t.y); }//Translation.
|
||||
|
||||
/// <summary>
|
||||
/// Rotate and scale this affine transform and return as a copy. Orginal is unchanged.
|
||||
@@ -325,7 +355,7 @@ template <typename T> void Affine2D<T>::O(v2T& t) { C(t.x); F(t.y); }//Translati
|
||||
/// <param name="to">The ending point to rotate and scale to</param>
|
||||
/// <returns>The newly rotated and scalled Affine2D</returns>
|
||||
template <typename T>
|
||||
Affine2D<T> Affine2D<T>::CalcRotateScale(v2T& from, v2T& to)
|
||||
Affine2D<T> Affine2D<T>::CalcRotateScale(const v2T& from, const v2T& to)
|
||||
{
|
||||
T a, c;
|
||||
|
||||
@@ -342,7 +372,7 @@ Affine2D<T> Affine2D<T>::CalcRotateScale(v2T& from, v2T& to)
|
||||
/// <param name="a">a</param>
|
||||
/// <param name="c">c</param>
|
||||
template <typename T>
|
||||
void Affine2D<T>::CalcRSAC(v2T& from, v2T& to, T& a, T& c)
|
||||
void Affine2D<T>::CalcRSAC(const v2T& from, const v2T& to, T& a, T& c)
|
||||
{
|
||||
T lsq = from.x * from.x + from.y * from.y;
|
||||
|
||||
|
||||
+42
-58
@@ -29,18 +29,12 @@ class EMBER_API Affine2D
|
||||
{
|
||||
public:
|
||||
Affine2D();
|
||||
|
||||
/// <summary>
|
||||
/// Default copy constructor.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D object to copy</param>
|
||||
Affine2D(const Affine2D<T>& affine)
|
||||
{
|
||||
Affine2D<T>::operator=<T>(affine);
|
||||
}
|
||||
Affine2D(const Affine2D<T>& affine);
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor to copy an Affine2D object of type U.
|
||||
/// Special case that must be here in the header because it has
|
||||
/// a second template parameter.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D object to copy</param>
|
||||
template <typename U>
|
||||
@@ -52,21 +46,12 @@ public:
|
||||
Affine2D(v2T& x, v2T& y, v2T& t);
|
||||
Affine2D(T xx, T xy, T yx, T yy, T tx, T ty);
|
||||
Affine2D(m4T& mat);
|
||||
|
||||
/// <summary>
|
||||
/// Default assignment operator.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D object to copy</param>
|
||||
Affine2D<T>& operator = (const Affine2D<T>& affine)
|
||||
{
|
||||
if (this != &affine)
|
||||
Affine2D<T>::operator=<T>(affine);
|
||||
|
||||
return *this;
|
||||
}
|
||||
Affine2D<T>& operator = (const Affine2D<T>& affine);
|
||||
|
||||
/// <summary>
|
||||
/// Assignment operator to assign an Affine2D object of type U.
|
||||
/// Special case that must be here in the header because it has
|
||||
/// a second template parameter.
|
||||
/// </summary>
|
||||
/// <param name="affine">The Affine2D object to copy.</param>
|
||||
/// <returns>Reference to updated self</returns>
|
||||
@@ -83,50 +68,49 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void MakeID();
|
||||
inline bool IsID() const;
|
||||
inline bool IsZero() const;
|
||||
inline void Rotate(T angle);
|
||||
inline void Translate(v2T& v);
|
||||
inline void RotateScaleXTo(v2T& v);
|
||||
inline void RotateScaleYTo(v2T& v);
|
||||
inline Affine2D<T> Inverse() const;
|
||||
inline v2T TransformNormal(const v2T& v) const;
|
||||
inline v2T TransformVector(const v2T& v) const;
|
||||
inline m2T ToMat2ColMajor() const;
|
||||
inline m2T ToMat2RowMajor() const;
|
||||
inline m4T ToMat4ColMajor(bool center = false) const;
|
||||
inline m4T ToMat4RowMajor(bool center = false) const;
|
||||
|
||||
bool operator == (const Affine2D<T>& affine);
|
||||
Affine2D<T>& operator * (const Affine2D<T>& affine);
|
||||
v2T operator * (const v2T& v);
|
||||
|
||||
inline T A() const;
|
||||
inline T B() const;
|
||||
inline T C() const;
|
||||
inline T D() const;
|
||||
inline T E() const;
|
||||
inline T F() const;
|
||||
|
||||
inline void A(T a);
|
||||
inline void B(T b);
|
||||
inline void C(T c);
|
||||
inline void D(T d);
|
||||
inline void E(T e);
|
||||
inline void F(T f);
|
||||
void MakeID();
|
||||
bool IsID() const;
|
||||
bool IsZero() const;
|
||||
void Rotate(T angle);
|
||||
void Translate(v2T& v);
|
||||
void RotateScaleXTo(v2T& v);
|
||||
void RotateScaleYTo(v2T& v);
|
||||
Affine2D<T> Inverse() const;
|
||||
v2T TransformNormal(const v2T& v) const;
|
||||
v2T TransformVector(const v2T& v) const;
|
||||
m2T ToMat2ColMajor() const;
|
||||
m2T ToMat2RowMajor() const;
|
||||
m4T ToMat4ColMajor(bool center = false) const;
|
||||
m4T ToMat4RowMajor(bool center = false) const;
|
||||
|
||||
inline v2T X() const;
|
||||
inline v2T Y() const;
|
||||
inline v2T O() const;
|
||||
T A() const;
|
||||
T B() const;
|
||||
T C() const;
|
||||
T D() const;
|
||||
T E() const;
|
||||
T F() const;
|
||||
|
||||
inline void X(v2T& x);
|
||||
inline void Y(v2T& y);
|
||||
inline void O(v2T& t);
|
||||
void A(T a);
|
||||
void B(T b);
|
||||
void C(T c);
|
||||
void D(T d);
|
||||
void E(T e);
|
||||
void F(T f);
|
||||
|
||||
//static Affine2D Identity();//Complains about inline.
|
||||
static inline Affine2D CalcRotateScale(v2T& from, v2T& to);
|
||||
static inline void CalcRSAC(v2T& from, v2T& to, T& a, T& c);
|
||||
v2T X() const;
|
||||
v2T Y() const;
|
||||
v2T O() const;
|
||||
|
||||
void X(const v2T& x);
|
||||
void Y(const v2T& y);
|
||||
void O(const v2T& t);
|
||||
|
||||
static Affine2D CalcRotateScale(const v2T& from, const v2T& to);
|
||||
static void CalcRSAC(const v2T& from, const v2T& to, T& a, T& c);
|
||||
|
||||
m23T m_Mat;
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
DensityFilterBase() { }
|
||||
virtual ~DensityFilterBase() { }
|
||||
|
||||
virtual int FilterWidth() { return 0; }
|
||||
virtual int FilterWidth() const { return 0; }
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
{
|
||||
if (this != &filter)
|
||||
{
|
||||
m_MinRad = filter.m_MinRad;
|
||||
m_MinRad = filter.m_MinRad;
|
||||
m_MaxRad = filter.m_MaxRad;
|
||||
m_Curve = filter.m_Curve;
|
||||
m_Supersample = filter.m_Supersample;
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
|
||||
/// <summary>
|
||||
/// Create the filter vector of up to 10M entries.
|
||||
/// If more than that are requested, it isn't created and
|
||||
/// If more than that are requested, it isn't created and
|
||||
/// false is returned.
|
||||
/// </summary>
|
||||
/// <returns>True if success, else false.</returns>
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
// num filters = (de_max_width / de_min_width)^(1 / estimator_curve)
|
||||
//
|
||||
decFilterCount = pow(finalMaxRad / finalMinRad, T(1.0) / m_Curve);
|
||||
|
||||
|
||||
if (decFilterCount > 1e7)//Too many filters.
|
||||
return false;
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
|
||||
//Condense the smaller kernels to save space.
|
||||
if (intFilterCount > keepThresh)
|
||||
{
|
||||
{
|
||||
maxIndex = (int)ceil(DE_THRESH + pow(T(intFilterCount - DE_THRESH), m_Curve)) + 1;
|
||||
m_MaxFilteredCounts = (int)pow(T(maxIndex - DE_THRESH), T(1.0) / m_Curve) + DE_THRESH;
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
m_Coefs[coefIndex] = 0.0;
|
||||
else
|
||||
m_Coefs[coefIndex] = gaussianFilter.Filter(gaussianFilter.Support() * filterVal) / filterSum;
|
||||
|
||||
|
||||
coefIndex++;
|
||||
}
|
||||
}
|
||||
@@ -316,11 +316,11 @@ public:
|
||||
inline unsigned int KernelSize() const { return m_KernelSize; }
|
||||
inline unsigned int MaxFilterIndex() const { return m_MaxFilterIndex; }
|
||||
inline unsigned int MaxFilteredCounts() const { return m_MaxFilteredCounts; }
|
||||
virtual int FilterWidth() const { return m_FilterWidth; }
|
||||
virtual int FilterWidth() const override { return m_FilterWidth; }
|
||||
inline unsigned int BufferSize() const { return (unsigned int)m_Widths.size(); }
|
||||
inline unsigned int CoefsSizeBytes() const { return BufferSize() * m_KernelSize * sizeof(T); }
|
||||
inline unsigned int WidthsSizeBytes() const { return BufferSize() * sizeof(T); }
|
||||
inline unsigned int CoefsIndicesSizeBytes() const { return unsigned int(m_CoefIndices.size() * sizeof(unsigned int)); }
|
||||
inline unsigned int CoefsIndicesSizeBytes() const { return (unsigned int)(m_CoefIndices.size() * sizeof(unsigned int)); }
|
||||
inline const T* Coefs() const { return m_Coefs.data(); }
|
||||
inline const T* Widths() const { return m_Widths.data(); }
|
||||
inline const unsigned int* CoefIndices() const { return m_CoefIndices.data(); }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "EmberPch.h"
|
||||
|
||||
#ifdef WIN32
|
||||
/// <summary>
|
||||
/// Generated by Visual Studio to make the DLL run properly.
|
||||
/// </summary>
|
||||
@@ -18,3 +19,4 @@ BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
+9
-13
@@ -37,8 +37,7 @@ namespace EmberNs
|
||||
{
|
||||
bool Timing::m_TimingInit = false;
|
||||
int Timing::m_ProcessorCount;
|
||||
LARGE_INTEGER Timing::m_Freq;
|
||||
auto_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand = auto_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>>(new QTIsaac<ISAAC_SIZE, ISAAC_INT>());
|
||||
template<> unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand = unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>>(new QTIsaac<ISAAC_SIZE, ISAAC_INT>());
|
||||
|
||||
#define EXPORTPREPOSTREGVAR(varName, T) \
|
||||
template EMBER_API class varName##Variation<T>; \
|
||||
@@ -47,8 +46,7 @@ auto_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalR
|
||||
|
||||
#define EXPORT_SINGLE_TYPE_EMBER(T) \
|
||||
template EMBER_API class Point<T>; \
|
||||
template EMBER_API class Color<T>; \
|
||||
template EMBER_API class Affine2D<T>; \
|
||||
template EMBER_API struct Color<T>; \
|
||||
template EMBER_API class Palette<T>; \
|
||||
template EMBER_API class PaletteList<T>; \
|
||||
template EMBER_API class Iterator<T>; \
|
||||
@@ -278,7 +276,6 @@ auto_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalR
|
||||
EXPORTPREPOSTREGVAR(ZScale, T) \
|
||||
EXPORTPREPOSTREGVAR(ZTranslate, T) \
|
||||
EXPORTPREPOSTREGVAR(ZCone, T) \
|
||||
EXPORTPREPOSTREGVAR(Boarders2, T) \
|
||||
EXPORTPREPOSTREGVAR(RotateX, T) \
|
||||
EXPORTPREPOSTREGVAR(RotateY, T) \
|
||||
EXPORTPREPOSTREGVAR(RotateZ, T) \
|
||||
@@ -389,17 +386,16 @@ auto_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalR
|
||||
template EMBER_API class CarToRas<T>; \
|
||||
template EMBER_API class XmlToEmber<T>; \
|
||||
template EMBER_API class EmberToXml<T>; \
|
||||
bool PaletteList<T>::m_Init = false; \
|
||||
vector<Palette<T>> PaletteList<T>::m_Palettes = vector<Palette<T>>(); \
|
||||
bool XmlToEmber<T>::m_Init = false; \
|
||||
vector<string> XmlToEmber<T>::m_FlattenNames = vector<string>(); \
|
||||
vector<pair<string, string>> XmlToEmber<T>::m_BadParamNames = vector<pair<string, string>>(); \
|
||||
vector<pair<pair<string, string>, vector<string>>> XmlToEmber<T>::m_BadVariationNames = vector<pair<pair<string, string>, vector<string>>>();
|
||||
template<> bool PaletteList<T>::m_Init = false; \
|
||||
template<> vector<Palette<T>> PaletteList<T>::m_Palettes = vector<Palette<T>>(); \
|
||||
template<> bool XmlToEmber<T>::m_Init = false; \
|
||||
template<> vector<string> XmlToEmber<T>::m_FlattenNames = vector<string>(); \
|
||||
template<> vector<pair<string, string>> XmlToEmber<T>::m_BadParamNames = vector<pair<string, string>>(); \
|
||||
template<> vector<pair<pair<string, string>, vector<string>>> XmlToEmber<T>::m_BadVariationNames = vector<pair<pair<string, string>, vector<string>>>();
|
||||
|
||||
EXPORT_SINGLE_TYPE_EMBER(float)
|
||||
|
||||
#define EXPORT_TWO_TYPE_EMBER(T, bucketT) \
|
||||
template EMBER_API class Renderer<T, bucketT>; \
|
||||
template EMBER_API class SheepTools<T, bucketT>;
|
||||
|
||||
EXPORT_TWO_TYPE_EMBER(float, float)
|
||||
@@ -408,4 +404,4 @@ EXPORT_TWO_TYPE_EMBER(float, float)
|
||||
EXPORT_SINGLE_TYPE_EMBER(double)
|
||||
EXPORT_TWO_TYPE_EMBER(double, double)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
+17
-13
@@ -6,11 +6,21 @@
|
||||
/// Basic #defines used throughout the library.
|
||||
/// </summary>
|
||||
|
||||
//MSVC specific?
|
||||
#if defined(BUILDING_EMBER)
|
||||
#define EMBER_API __declspec(dllexport)
|
||||
#ifdef _WIN32
|
||||
#if defined(BUILDING_EMBER)
|
||||
#define EMBER_API __declspec(dllexport)
|
||||
#else
|
||||
#define EMBER_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define EMBER_API __declspec(dllimport)
|
||||
#define EMBER_API
|
||||
#define fopen_s(pFile,filename,mode) ((*(pFile))=fopen((filename),(mode)))==NULL
|
||||
#define _stat stat
|
||||
#define _fstat fstat
|
||||
#define _stricmp strcmp
|
||||
#define sscanf_s sscanf
|
||||
#define sprintf_s snprintf
|
||||
typedef int errno_t;
|
||||
#endif
|
||||
|
||||
#define RESTRICT __restrict//This might make things faster, unsure if it really does though.
|
||||
@@ -23,9 +33,10 @@ namespace EmberNs
|
||||
#define sincos(x, s, c) *(s)=sin(x); *(c)=cos(x);
|
||||
#else
|
||||
extern void sincos(double x, double *s, double *c);
|
||||
extern void sincos(float x, float *s, float *c);
|
||||
#endif
|
||||
|
||||
#define EMBER_VERSION "0.4.1.2"
|
||||
#define EMBER_VERSION "0.4.1.3"
|
||||
#define EPS6 T(1e-6)
|
||||
#define EPS std::numeric_limits<T>::epsilon()//Apoplugin.h uses -20, but it's more mathematically correct to do it this way.
|
||||
#define ISAAC_SIZE 4
|
||||
@@ -51,14 +62,7 @@ namespace EmberNs
|
||||
#define CUBE(x) ((x) * (x) * (x))
|
||||
#define TLOW std::numeric_limits<T>::lowest()
|
||||
#define TMAX std::numeric_limits<T>::max()
|
||||
|
||||
#ifndef acosh
|
||||
#define acosh(x) (log(x + sqrt(SQR(x) - 1)))//Remove this once you upgrade compilers to VS 2013 or later.//TODO
|
||||
#endif
|
||||
|
||||
#ifndef fma
|
||||
#define fma(x, y, z) ((x * y) + z)
|
||||
#endif
|
||||
typedef std::chrono::high_resolution_clock Clock;
|
||||
|
||||
#define DO_DOUBLE 1//Comment this out for shorter build times during development. Always uncomment for release.
|
||||
//#define ISAAC_FLAM3_DEBUG 1//This is almost never needed, but is very useful when troubleshooting difficult bugs. Enable it to do a side by side comparison with flam3.
|
||||
|
||||
+12
-2
@@ -26,24 +26,33 @@
|
||||
|
||||
//Standard headers.
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <complex>
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <inttypes.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <thread>
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
|
||||
//Third party headers.
|
||||
#include <libxml/parser.h>
|
||||
#ifdef _WIN32
|
||||
#include "libxml/parser.h"
|
||||
#else
|
||||
#include "libxml2/libxml/parser.h"
|
||||
#endif
|
||||
|
||||
//Intel's Threading Building Blocks is what's used for all threading.
|
||||
#include "tbb/task_group.h"
|
||||
@@ -60,3 +69,4 @@
|
||||
|
||||
using namespace tbb;
|
||||
using namespace std;
|
||||
using namespace std::chrono;
|
||||
|
||||
@@ -127,6 +127,7 @@ public:
|
||||
string ToString(Ember<T>& ember, string extraAttributes, unsigned int printEditDepth, bool doEdits, bool intPalette, bool hexPalette = true)
|
||||
{
|
||||
unsigned int i, j;
|
||||
string s;
|
||||
ostringstream os;
|
||||
vector<Variation<T>*> variations;
|
||||
|
||||
@@ -296,7 +297,6 @@ public:
|
||||
char timeString[128];
|
||||
char buffer[128];
|
||||
char commentString[128];
|
||||
tm localt;
|
||||
time_t myTime;
|
||||
xmlDocPtr commentDoc = NULL;
|
||||
xmlDocPtr doc = xmlNewDoc(XC "1.0");
|
||||
@@ -306,12 +306,19 @@ public:
|
||||
//Create the root node, called "edit".
|
||||
rootNode = xmlNewNode(NULL, XC "edit");
|
||||
xmlDocSetRootElement(doc, rootNode);
|
||||
|
||||
|
||||
//Add the edit attributes.
|
||||
//Date.
|
||||
myTime = time(NULL);
|
||||
#ifdef WIN32
|
||||
tm localt;
|
||||
localtime_s(&localt, &myTime);
|
||||
strftime(timeString, 128, "%a %b %d %H:%M:%S %z %Y", &localt);//XXX use standard time format including timezone.
|
||||
#else
|
||||
tm* localt;
|
||||
localt = localtime(&myTime);
|
||||
strftime(timeString, 128, "%a %b %d %H:%M:%S %z %Y", localt);//XXX use standard time format including timezone.
|
||||
#endif
|
||||
xmlNewProp(rootNode, XC "date", XC timeString);
|
||||
|
||||
//Nick.
|
||||
@@ -557,7 +564,9 @@ private:
|
||||
string ToString(xmlNodePtr editNode, unsigned int tabs, bool formatting, unsigned int printEditDepth)
|
||||
{
|
||||
bool indentPrinted = false;
|
||||
char* tabString = " ", *attStr;
|
||||
const char* tabString = " ", *attStr;
|
||||
const char* editString = "edit";
|
||||
const char* sheepString = "sheep";
|
||||
unsigned int ti, editOrSheep = 0;
|
||||
xmlAttrPtr attPtr = NULL, curAtt = NULL;
|
||||
xmlNodePtr childPtr = NULL, curChild = NULL;
|
||||
@@ -578,12 +587,12 @@ private:
|
||||
|
||||
//This can either be an edit node or a sheep node.
|
||||
//If it's an edit node, add one to the tab.
|
||||
if (!Compare(editNode->name, "edit"))
|
||||
if (!Compare(editNode->name, editString))
|
||||
{
|
||||
editOrSheep = 1;
|
||||
tabs++;
|
||||
}
|
||||
else if (!Compare(editNode->name, "sheep"))
|
||||
else if (!Compare(editNode->name, sheepString))
|
||||
editOrSheep = 2;
|
||||
else
|
||||
editOrSheep = 0;
|
||||
@@ -595,7 +604,7 @@ private:
|
||||
{
|
||||
attStr = (char*)xmlGetProp(editNode, curAtt->name);
|
||||
os << " " << curAtt->name << "=\"" << attStr << "\"";
|
||||
xmlFree(attStr);
|
||||
xmlFree((void*)attStr);
|
||||
}
|
||||
|
||||
//Does this node have children?
|
||||
@@ -623,9 +632,9 @@ private:
|
||||
|
||||
for (curChild = childPtr; curChild; curChild = curChild->next)
|
||||
{
|
||||
//If child is an element, indent first and then print it.
|
||||
//If child is an element, indent first and then print it.
|
||||
if (curChild->type == XML_ELEMENT_NODE &&
|
||||
(!Compare(curChild->name, "edit") || !Compare(curChild->name, "sheep")))
|
||||
(!Compare(curChild->name, editString) || !Compare(curChild->name, sheepString)))
|
||||
{
|
||||
if (indentPrinted)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Variation.h"
|
||||
#include "Ember.h"
|
||||
|
||||
/// <summary>
|
||||
/// Interpolater class.
|
||||
@@ -8,6 +8,11 @@
|
||||
|
||||
namespace EmberNs
|
||||
{
|
||||
/// <summary>
|
||||
/// g++ needs a forward declaration here.
|
||||
/// </summary>
|
||||
template <typename T> class Ember;
|
||||
|
||||
/// <summary>
|
||||
/// Contains many static functions for handling interpolation and other miscellaneous operations on
|
||||
/// embers and vectors of embers. This class is similar to, and used in conjunction with SheepTools.
|
||||
@@ -22,7 +27,7 @@ public:
|
||||
/// This is used to prepare embers before interpolating them.
|
||||
/// Alignment means that every ember in a list will have the same number of xforms.
|
||||
/// Each xform at a given position will have mostly the same variations as the xform
|
||||
/// in the same position in the rest of the embers. However some
|
||||
/// in the same position in the rest of the embers. However some
|
||||
/// intelligence is applied to add or remove variations that wouldn't look good with
|
||||
/// the others present.
|
||||
/// After this function completes, sourceEmbers will remain unchanged and destEmbers
|
||||
@@ -418,7 +423,7 @@ public:
|
||||
|
||||
//To interpolate the xforms, make copies of the source embers
|
||||
//and ensure that they both have the same number of xforms before progressing.
|
||||
if (embers[i1].m_Interp == INTERP_LINEAR)
|
||||
if (embers[i1].m_Interp == EMBER_INTERP_LINEAR)
|
||||
{
|
||||
Align(&embers[i1], &localEmbers[0], 2);
|
||||
smoothFlag = false;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
typedef unsigned long int ISAAC_INT;
|
||||
const ISAAC_INT GOLDEN_RATIO = ISAAC_INT(0x9e3779b9);
|
||||
#else
|
||||
typedef unsigned __int64 ISAAC_INT;
|
||||
typedef uint64_t ISAAC_INT;
|
||||
const ISAAC_INT GOLDEN_RATIO = ISAAC_INT(0x9e3779b97f4a7c13);
|
||||
#endif
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
/// Global ISAAC RNG to be used from anywhere. This is not thread safe, so take caution to only
|
||||
/// use it when no other threads are.
|
||||
/// </summary>
|
||||
static auto_ptr<QTIsaac<ALPHA, ISAAC_INT>> GlobalRand;
|
||||
static unique_ptr<QTIsaac<ALPHA, ISAAC_INT>> GlobalRand;
|
||||
|
||||
/// <summary>
|
||||
/// The structure which holds all of the random information.
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
|
||||
namespace EmberNs
|
||||
{
|
||||
#define ITERATORUSINGS \
|
||||
using Iterator<T>::NextXformFromIndex; \
|
||||
using Iterator<T>::DoFinalXform; \
|
||||
using Iterator<T>::DoBadVals;
|
||||
|
||||
/// <summary>
|
||||
/// Iterator base class.
|
||||
/// Iterating is one loop level outside of the inner xform application loop so it's still very important
|
||||
@@ -255,6 +260,7 @@ protected:
|
||||
template <typename T>
|
||||
class EMBER_API StandardIterator : public Iterator<T>
|
||||
{
|
||||
ITERATORUSINGS
|
||||
public:
|
||||
/// <summary>
|
||||
/// Empty constructor.
|
||||
@@ -375,6 +381,7 @@ public:
|
||||
template <typename T>
|
||||
class EMBER_API XaosIterator : public Iterator<T>
|
||||
{
|
||||
ITERATORUSINGS
|
||||
public:
|
||||
/// <summary>
|
||||
/// Empty constructor.
|
||||
|
||||
+11
-1
@@ -129,8 +129,14 @@ static int SortPointByY(const Point<T>& a, const Point<T>& b)
|
||||
/// specific to color handling.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EMBER_API Color : public v4T
|
||||
struct EMBER_API Color : public v4T
|
||||
{
|
||||
#ifndef _WIN32
|
||||
using v4T::r;
|
||||
using v4T::g;
|
||||
using v4T::b;
|
||||
using v4T::a;
|
||||
#endif
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructor to set color values to zero, with full visibility.
|
||||
@@ -179,7 +185,11 @@ public:
|
||||
template <typename U>
|
||||
Color<T>& operator = (const Color<U>& color)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
v4T::operator=<U>(color);
|
||||
#else
|
||||
v4T::template operator=<U>(color);
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
+27
-27
@@ -364,7 +364,10 @@ eRenderStatus Renderer<T, bucketT>::Run(vector<unsigned char>& finalImage, doubl
|
||||
bool resume = m_ProcessState != NONE;
|
||||
bool newFilterAlloc;
|
||||
unsigned int temporalSample, pass;
|
||||
T deTime;
|
||||
eRenderStatus success = RENDER_OK;
|
||||
//double iterationTime = 0;
|
||||
//double accumulationTime = 0;
|
||||
//Timing it;
|
||||
|
||||
//Reset timers and progress percent if: Beginning anew or only filtering and/or accumulating.
|
||||
@@ -455,14 +458,11 @@ eRenderStatus Renderer<T, bucketT>::Run(vector<unsigned char>& finalImage, doubl
|
||||
|
||||
if (!resume)
|
||||
ResetBuckets(true, false);//Only reset hist here and do accum when needed later on.
|
||||
|
||||
double iterationTime = 0;
|
||||
double accumulationTime = 0;
|
||||
|
||||
//Passes, outermost loop 1.
|
||||
for (; (pass < Passes()) && !m_Abort;)
|
||||
{
|
||||
T deTime = T(time) + m_TemporalFilter->Deltas()[pass * m_Ember.m_TemporalSamples];
|
||||
deTime = T(time) + m_TemporalFilter->Deltas()[pass * m_Ember.m_TemporalSamples];
|
||||
|
||||
//Interpolate and get an ember for DE purposes.
|
||||
//Additional interpolation will be done in the temporal samples loop.
|
||||
@@ -509,10 +509,10 @@ eRenderStatus Renderer<T, bucketT>::Run(vector<unsigned char>& finalImage, doubl
|
||||
//The actual number of times to iterate. Each thread will get (totalIters / ThreadCount) iters to do.
|
||||
//This is based on zoom and scale calculated in ComputeCamera().
|
||||
//Note that the iter count is based on the final image dimensions, and not the super sampled dimensions.
|
||||
unsigned __int64 totalIterCount = TotalIterCount();
|
||||
unsigned __int64 itersPerTemporalSample = ItersPerTemporalSample();//The total number of iterations for this temporal sample in this pass without overrides.
|
||||
unsigned __int64 sampleItersToDo;//The number of iterations to actually do in this sample in this pass, considering overrides.
|
||||
|
||||
uint64_t totalIterCount = TotalIterCount();
|
||||
uint64_t itersPerTemporalSample = ItersPerTemporalSample();//The total number of iterations for this temporal sample in this pass without overrides.
|
||||
uint64_t sampleItersToDo;//The number of iterations to actually do in this sample in this pass, considering overrides.
|
||||
|
||||
if (subBatchCountOverride > 0)
|
||||
sampleItersToDo = subBatchCountOverride * SubBatchSize() * ThreadCount();//Run a specific number of sub batches.
|
||||
else
|
||||
@@ -735,7 +735,7 @@ EmberImageComments Renderer<T, bucketT>::ImageComments(unsigned int printEditDep
|
||||
/// <param name="includeFinal">If true include the memory needed for the final output image, else don't.</param>
|
||||
/// <returns>The memory required to render the current ember</returns>
|
||||
template <typename T, typename bucketT>
|
||||
unsigned __int64 Renderer<T, bucketT>::MemoryRequired(bool includeFinal)
|
||||
uint64_t Renderer<T, bucketT>::MemoryRequired(bool includeFinal)
|
||||
{
|
||||
bool newFilterAlloc = false;
|
||||
|
||||
@@ -744,7 +744,7 @@ unsigned __int64 Renderer<T, bucketT>::MemoryRequired(bool includeFinal)
|
||||
ComputeBounds();
|
||||
|
||||
//Because ComputeBounds() was called, this includes gutter.
|
||||
unsigned __int64 histSize = SuperSize() * sizeof(glm::detail::tvec4<bucketT, glm::defaultp>);
|
||||
uint64_t histSize = SuperSize() * sizeof(glm::detail::tvec4<bucketT, glm::defaultp>);
|
||||
|
||||
return (histSize * 2) + (includeFinal ? FinalBufferSize() : 0);//Multiply hist by 2 to account for the density filtering buffer which is the same size as the histogram.
|
||||
}
|
||||
@@ -758,9 +758,9 @@ unsigned __int64 Renderer<T, bucketT>::MemoryRequired(bool includeFinal)
|
||||
/// </summary>
|
||||
/// <returns>An unsigned 64-bit integer specifying how much memory is available</returns>
|
||||
template <typename T, typename bucketT>
|
||||
unsigned __int64 Renderer<T, bucketT>::MemoryAvailable()
|
||||
uint64_t Renderer<T, bucketT>::MemoryAvailable()
|
||||
{
|
||||
unsigned __int64 memAvailable = 0;
|
||||
uint64_t memAvailable = 0;
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
@@ -1053,7 +1053,7 @@ void Renderer<T, bucketT>::Callback(RenderCallback* callback)
|
||||
template <typename T, typename bucketT>
|
||||
void Renderer<T, bucketT>::MakeDmap(T colorScalar)
|
||||
{
|
||||
m_Ember.m_Palette.MakeDmap<bucketT>(m_Dmap, colorScalar);
|
||||
m_Ember.m_Palette.template MakeDmap<bucketT>(m_Dmap, colorScalar);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1487,7 +1487,7 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(unsigned char* pixel
|
||||
p16[0] = (unsigned short)(Clamp<bucketT>(newBucket.r, 0, 255) * bucketT(256));
|
||||
p16[1] = (unsigned short)(Clamp<bucketT>(newBucket.g, 0, 255) * bucketT(256));
|
||||
p16[2] = (unsigned short)(Clamp<bucketT>(newBucket.b, 0, 255) * bucketT(256));
|
||||
|
||||
|
||||
if (NumChannels() > 3)
|
||||
{
|
||||
if (Transparency())
|
||||
@@ -1508,7 +1508,7 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(unsigned char* pixel
|
||||
pixels[pixelsRowStart] = (unsigned char)Clamp<bucketT>(newBucket.r, 0, 255);
|
||||
pixels[pixelsRowStart + 1] = (unsigned char)Clamp<bucketT>(newBucket.g, 0, 255);
|
||||
pixels[pixelsRowStart + 2] = (unsigned char)Clamp<bucketT>(newBucket.b, 0, 255);
|
||||
|
||||
|
||||
if (NumChannels() > 3)
|
||||
{
|
||||
if (Transparency())
|
||||
@@ -1567,16 +1567,16 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(unsigned char* pixel
|
||||
/// <param name="temporalSample">The temporal sample within the current pass this is running for</param>
|
||||
/// <returns>Rendering statistics</returns>
|
||||
template <typename T, typename bucketT>
|
||||
EmberStats Renderer<T, bucketT>::Iterate(unsigned __int64 iterCount, unsigned int pass, unsigned int temporalSample)
|
||||
EmberStats Renderer<T, bucketT>::Iterate(uint64_t iterCount, unsigned int pass, unsigned int temporalSample)
|
||||
{
|
||||
//Timing t2(4);
|
||||
m_IterTimer.Tic();
|
||||
unsigned int fuse = EarlyClip() ? 100 : 15;//EarlyClip was one way of detecting a later version of flam3, so it used 100 which is a better value.
|
||||
unsigned __int64 totalItersPerThread = (unsigned __int64)ceil((double)iterCount / (double)m_ThreadsToUse);
|
||||
uint64_t totalItersPerThread = (uint64_t)ceil((double)iterCount / (double)m_ThreadsToUse);
|
||||
double percent, etaMs;
|
||||
EmberStats stats;
|
||||
|
||||
#ifdef TG
|
||||
#ifdef TG
|
||||
unsigned int threadIndex;
|
||||
|
||||
for (unsigned int i = 0; i < m_ThreadsToUse; i++)
|
||||
@@ -1588,7 +1588,7 @@ EmberStats Renderer<T, bucketT>::Iterate(unsigned __int64 iterCount, unsigned in
|
||||
{
|
||||
#endif
|
||||
Timing t;
|
||||
unsigned __int64 subBatchSize = (unsigned int)min(totalItersPerThread, (unsigned __int64)m_SubBatchSize);
|
||||
uint64_t subBatchSize = (unsigned int)min(totalItersPerThread, (uint64_t)m_SubBatchSize);
|
||||
|
||||
m_BadVals[threadIndex] = 0;
|
||||
|
||||
@@ -1610,7 +1610,7 @@ EmberStats Renderer<T, bucketT>::Iterate(unsigned __int64 iterCount, unsigned in
|
||||
//Finally, iterate.
|
||||
//t.Tic();
|
||||
//Iterating, loop 4.
|
||||
m_BadVals[threadIndex] += (unsigned __int64)m_Iterator->Iterate(m_Ember, (unsigned int)subBatchSize, fuse, m_Samples[threadIndex].data(), m_Rand[threadIndex]);
|
||||
m_BadVals[threadIndex] += (uint64_t)m_Iterator->Iterate(m_Ember, (uint32_t)subBatchSize, fuse, m_Samples[threadIndex].data(), m_Rand[threadIndex]);
|
||||
//iterationTime += t.Toc();
|
||||
|
||||
if (m_LockAccum)
|
||||
@@ -1933,9 +1933,9 @@ void Renderer<T, bucketT>::PrepFinalAccumVals(Color<T>& background, T& g, T& lin
|
||||
linRange = GammaThresh();
|
||||
vibrancy /= vibGamCount;
|
||||
|
||||
background.r = (IsNearZero(m_Background.r) ? m_Ember.m_Background.r : m_Background.r) / (vibGamCount / T(256.0));//Background is [0, 1].
|
||||
background.g = (IsNearZero(m_Background.g) ? m_Ember.m_Background.g : m_Background.g) / (vibGamCount / T(256.0));
|
||||
background.b = (IsNearZero(m_Background.b) ? m_Ember.m_Background.b : m_Background.b) / (vibGamCount / T(256.0));
|
||||
background.x = (IsNearZero(m_Background.r) ? m_Ember.m_Background.r : m_Background.r) / (vibGamCount / T(256.0));//Background is [0, 1].
|
||||
background.y = (IsNearZero(m_Background.g) ? m_Ember.m_Background.g : m_Background.g) / (vibGamCount / T(256.0));
|
||||
background.z = (IsNearZero(m_Background.b) ? m_Ember.m_Background.b : m_Background.b) / (vibGamCount / T(256.0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2087,8 +2087,8 @@ void Renderer<T, bucketT>::GammaCorrection(glm::detail::tvec4<bucketT, glm::defa
|
||||
ls = vibrancy * T(255) * alpha / bucket.a;
|
||||
ClampRef<T>(alpha, 0, 1);
|
||||
}
|
||||
|
||||
Palette<T>::CalcNewRgb<bucketT>(&bucket[0], ls, HighlightPower(), newRgb);
|
||||
|
||||
Palette<T>::template CalcNewRgb<bucketT>(&bucket[0], ls, HighlightPower(), newRgb);
|
||||
|
||||
for (unsigned int rgbi = 0; rgbi < 3; rgbi++)
|
||||
{
|
||||
@@ -2189,8 +2189,8 @@ template <typename T, typename bucketT> double Renderer<T,
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::UpperRightY(bool gutter) const { return gutter ? m_CarToRas.CarUrY() : m_UpperRightY; }
|
||||
template <typename T, typename bucketT> T Renderer<T, bucketT>::K1() const { return m_K1; }
|
||||
template <typename T, typename bucketT> T Renderer<T, bucketT>::K2() const { return m_K2; }
|
||||
template <typename T, typename bucketT> unsigned __int64 Renderer<T, bucketT>::TotalIterCount() const { return (unsigned __int64)((unsigned __int64)Round(m_ScaledQuality) * (unsigned __int64)FinalRasW() * (unsigned __int64)FinalRasH()); }//Use Round() because there can be some roundoff error when interpolating.
|
||||
template <typename T, typename bucketT> unsigned __int64 Renderer<T, bucketT>::ItersPerTemporalSample() const { return (unsigned __int64)ceil(double(TotalIterCount()) / double(Passes() * TemporalSamples())); }
|
||||
template <typename T, typename bucketT> uint64_t Renderer<T, bucketT>::TotalIterCount() const { return (uint64_t)((uint64_t)Round(m_ScaledQuality) * (uint64_t)FinalRasW() * (uint64_t)FinalRasH()); }//Use Round() because there can be some roundoff error when interpolating.
|
||||
template <typename T, typename bucketT> uint64_t Renderer<T, bucketT>::ItersPerTemporalSample() const { return (uint64_t)ceil(double(TotalIterCount()) / double(Passes() * TemporalSamples())); }
|
||||
template <typename T, typename bucketT> eProcessState Renderer<T, bucketT>::ProcessState() const { return m_ProcessState; }
|
||||
template <typename T, typename bucketT> eProcessAction Renderer<T, bucketT>::ProcessAction() const { return m_ProcessAction; }
|
||||
template <typename T, typename bucketT> EmberStats Renderer<T, bucketT>::Stats() const { return m_Stats; }
|
||||
|
||||
+15
-15
@@ -70,7 +70,7 @@ public:
|
||||
m_RenderMs = 0;
|
||||
}
|
||||
|
||||
unsigned __int64 m_Iters, m_Badvals;
|
||||
uint64_t m_Iters, m_Badvals;
|
||||
double m_IterMs, m_RenderMs;
|
||||
};
|
||||
|
||||
@@ -133,8 +133,8 @@ public:
|
||||
virtual double LowerLeftY(bool gutter = true) const { return 0; }
|
||||
virtual double UpperRightX(bool gutter = true) const { return 0; }
|
||||
virtual double UpperRightY(bool gutter = true) const { return 0; }
|
||||
virtual unsigned __int64 MemoryRequired(bool includeFinal) { return 0; }
|
||||
virtual unsigned __int64 MemoryAvailable() { return 0; }
|
||||
virtual uint64_t MemoryRequired(bool includeFinal) { return 0; }
|
||||
virtual uint64_t MemoryAvailable() { return 0; }
|
||||
virtual bool PrepFinalAccumVector(vector<unsigned char>& pixels) { return false; }
|
||||
virtual eProcessState ProcessState() const { return NONE; }
|
||||
virtual eProcessAction ProcessAction() const { return NOTHING; }
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
virtual bool PrepFinalAccumVector(vector<unsigned char>& pixels);
|
||||
virtual eRenderStatus Run(vector<unsigned char>& finalImage, double time = 0, unsigned int subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0);
|
||||
virtual EmberImageComments ImageComments(unsigned int printEditDepth = 0, bool intPalette = false, bool hexPalette = true);
|
||||
virtual unsigned __int64 MemoryRequired(bool includeFinal);
|
||||
virtual uint64_t MemoryRequired(bool includeFinal);
|
||||
|
||||
//Virtual functions to be overriden in derived renderers that use the GPU.
|
||||
virtual unsigned __int64 MemoryAvailable();
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
virtual bool CreateSpatialFilter(bool& newAlloc);
|
||||
virtual unsigned int SubBatchSize() const;
|
||||
virtual void SubBatchSize(unsigned int sbs);
|
||||
virtual unsigned int NumChannels() const;
|
||||
virtual unsigned int NumChannels() const;
|
||||
virtual void NumChannels(unsigned int numChannels);
|
||||
virtual eRendererType RendererType() const;
|
||||
virtual unsigned int ThreadCount() const;
|
||||
@@ -216,7 +216,7 @@ protected:
|
||||
virtual eRenderStatus GaussianDensityFilter();
|
||||
virtual eRenderStatus AccumulatorToFinalImage(vector<unsigned char>& pixels, size_t finalOffset);
|
||||
virtual eRenderStatus AccumulatorToFinalImage(unsigned char* pixels, size_t finalOffset);
|
||||
virtual EmberStats Iterate(unsigned __int64 iterCount, unsigned int pass, unsigned int temporalSample);
|
||||
virtual EmberStats Iterate(uint64_t iterCount, unsigned int pass, unsigned int temporalSample);
|
||||
|
||||
public:
|
||||
//Accessors for render properties.
|
||||
@@ -268,7 +268,7 @@ public:
|
||||
inline unsigned int SuperSize() const;
|
||||
virtual unsigned int FinalBufferSize() const;
|
||||
inline unsigned int FinalRowSize() const;
|
||||
inline unsigned int FinalDimensions() const;
|
||||
unsigned int FinalDimensions() const;
|
||||
inline unsigned int PixelSize() const;
|
||||
virtual unsigned int GutterWidth() const;
|
||||
inline unsigned int DensityFilterOffset() const;
|
||||
@@ -282,8 +282,8 @@ public:
|
||||
virtual double UpperRightY(bool gutter = true) const;
|
||||
inline T K1() const;
|
||||
inline T K2() const;
|
||||
inline unsigned __int64 TotalIterCount() const;
|
||||
inline unsigned __int64 ItersPerTemporalSample() const;
|
||||
inline uint64_t TotalIterCount() const;
|
||||
inline uint64_t ItersPerTemporalSample() const;
|
||||
virtual eProcessState ProcessState() const;
|
||||
virtual eProcessAction ProcessAction() const;
|
||||
virtual EmberStats Stats() const;
|
||||
@@ -295,9 +295,9 @@ public:
|
||||
virtual DensityFilter<T>* GetDensityFilter();
|
||||
|
||||
//Ember wrappers, getters only.
|
||||
inline bool XaosPresent();
|
||||
virtual inline unsigned int FinalRasW() const;
|
||||
virtual inline unsigned int FinalRasH() const;
|
||||
inline bool XaosPresent();
|
||||
unsigned int FinalRasW() const;
|
||||
unsigned int FinalRasH() const;
|
||||
inline unsigned int Supersample() const;
|
||||
inline unsigned int Passes() const;
|
||||
inline unsigned int TemporalSamples() const;
|
||||
@@ -382,7 +382,7 @@ protected:
|
||||
unsigned int m_VibGamCount;
|
||||
unsigned int m_LastPass;
|
||||
unsigned int m_LastTemporalSample;
|
||||
unsigned __int64 m_LastIter;
|
||||
uint64_t m_LastIter;
|
||||
double m_LastIterPercent;
|
||||
eProcessAction m_ProcessAction;
|
||||
eProcessState m_ProcessState;
|
||||
@@ -404,8 +404,8 @@ protected:
|
||||
auto_ptr<TemporalFilter<T>> m_TemporalFilter;
|
||||
auto_ptr<DensityFilter<T>> m_DensityFilter;
|
||||
vector<vector<Point<T>>> m_Samples;
|
||||
vector<unsigned __int64> m_SubBatch;
|
||||
vector<unsigned __int64> m_BadVals;
|
||||
vector<uint64_t> m_SubBatch;
|
||||
vector<uint64_t> m_BadVals;
|
||||
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> m_Rand;
|
||||
tbb::task_group m_TaskGroup;
|
||||
CriticalSection m_RenderingCs, m_AccumCs, m_FinalAccumCs, m_ResizeCs;
|
||||
|
||||
@@ -1280,7 +1280,7 @@ public:
|
||||
/// <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>
|
||||
unsigned __int64 EstimateBoundingBox(Ember<T>& ember, T eps, unsigned int samples, T* bmin, T* bmax)
|
||||
uint64_t EstimateBoundingBox(Ember<T>& ember, T eps, unsigned int samples, T* bmin, T* bmax)
|
||||
{
|
||||
unsigned int i, lowTarget, highTarget;
|
||||
T min[2], max[2];
|
||||
@@ -1293,8 +1293,8 @@ public:
|
||||
m_Iterator->InitDistributions(ember);
|
||||
m_Samples.resize(samples);
|
||||
|
||||
unsigned __int64 bv = m_Iterator->Iterate(ember, samples, 20, m_Samples.data(), m_Rand);//Use a special fuse of 20, all other calls to this will use 15, or 100.
|
||||
|
||||
uint64_t bv = m_Iterator->Iterate(ember, samples, 20, m_Samples.data(), m_Rand);//Use a special fuse of 20, all other calls to this will use 15, or 100.
|
||||
|
||||
if (bv / T(samples) > eps)
|
||||
eps = 3 * bv / T(samples);
|
||||
|
||||
|
||||
@@ -481,7 +481,7 @@ public:
|
||||
t = -t;
|
||||
|
||||
if (t < 3)
|
||||
return Sinc(t) * Sinc(t / 3);
|
||||
return SpatialFilter<T>::Sinc(t) * SpatialFilter<T>::Sinc(t / 3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -515,7 +515,7 @@ public:
|
||||
t = -t;
|
||||
|
||||
if (t < 2)
|
||||
return Sinc(t) * Sinc(t / 2);
|
||||
return SpatialFilter<T>::Sinc(t) * SpatialFilter<T>::Sinc(t / 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,17 @@ enum eTemporalFilterType
|
||||
EXP_TEMPORAL_FILTER = 2
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// g++ needs a forward declaration here.
|
||||
/// </summary>
|
||||
template <typename T> class TemporalFilterCreator;
|
||||
|
||||
#define TEMPORALFILTERUSINGS \
|
||||
using TemporalFilter<T>::m_Filter; \
|
||||
using TemporalFilter<T>::m_FilterExp; \
|
||||
using TemporalFilter<T>::Size; \
|
||||
using TemporalFilter<T>::FinishFilter;
|
||||
|
||||
/// <summary>
|
||||
/// Temporal filter is for doing motion blur while rendering a series of frames for animation.
|
||||
/// The filter created is used as a vector of scalar values to multiply the time value by in between embers.
|
||||
@@ -178,6 +189,7 @@ protected:
|
||||
template <typename T>
|
||||
class EMBER_API ExpTemporalFilter : public TemporalFilter<T>
|
||||
{
|
||||
TEMPORALFILTERUSINGS
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructor to create an Exp filter.
|
||||
@@ -220,6 +232,7 @@ public:
|
||||
template <typename T>
|
||||
class EMBER_API GaussianTemporalFilter : public TemporalFilter<T>
|
||||
{
|
||||
TEMPORALFILTERUSINGS
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructor to create a Gaussian filter.
|
||||
@@ -255,6 +268,7 @@ public:
|
||||
template <typename T>
|
||||
class EMBER_API BoxTemporalFilter : public TemporalFilter<T>
|
||||
{
|
||||
TEMPORALFILTERUSINGS
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructor to create a Box filter.
|
||||
|
||||
+22
-32
@@ -32,13 +32,13 @@ public:
|
||||
/// <summary>
|
||||
/// Set the begin time.
|
||||
/// </summary>
|
||||
/// <returns>The quad part of the begin time cast to a double</returns>
|
||||
/// <returns>The begin time cast to a double</returns>
|
||||
double Tic()
|
||||
{
|
||||
QueryPerformanceCounter(&m_BeginTime);
|
||||
m_BeginTime = Clock::now();
|
||||
return BeginTime();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set the end time and optionally output a string showing the elapsed time.
|
||||
/// </summary>
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
/// <returns>The elapsed time in milliseconds as a double</returns>
|
||||
double Toc(const char* str = NULL, bool fullString = false)
|
||||
{
|
||||
QueryPerformanceCounter(&m_EndTime);
|
||||
m_EndTime = Clock::now();
|
||||
double ms = ElapsedTime();
|
||||
|
||||
if (str != NULL)
|
||||
@@ -59,22 +59,27 @@ public:
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the quad part of the begin time as a double.
|
||||
/// Return the begin time as a double.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
double BeginTime() { return (double)m_BeginTime.QuadPart; }
|
||||
double BeginTime() { return (double)m_BeginTime.time_since_epoch().count(); }
|
||||
|
||||
/// <summary>
|
||||
/// Return the quad part of the end time as a double.
|
||||
/// Return the end time as a double.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
double EndTime() { return (double)m_EndTime.QuadPart; }
|
||||
double EndTime() { return (double)m_EndTime.time_since_epoch().count(); }
|
||||
|
||||
/// <summary>
|
||||
/// Return the elapsed time in milliseconds.
|
||||
/// </summary>
|
||||
/// <returns>The elapsed time in milliseconds as a double</returns>
|
||||
double ElapsedTime() { return double(m_EndTime.QuadPart - m_BeginTime.QuadPart) * 1000.0 / double(m_Freq.QuadPart); }
|
||||
double ElapsedTime()
|
||||
{
|
||||
duration<double> elapsed = duration_cast<milliseconds, Clock::rep, Clock::period>(m_EndTime - m_BeginTime);
|
||||
|
||||
return elapsed.count() * 1000.0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats a specified milliseconds value as a string.
|
||||
@@ -87,7 +92,7 @@ public:
|
||||
string Format(double ms)
|
||||
{
|
||||
stringstream ss;
|
||||
|
||||
|
||||
double x = ms / 1000;
|
||||
double secs = fmod(x, 60);
|
||||
x /= 60;
|
||||
@@ -110,16 +115,6 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the frequency of the clock as a double.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
static double Freq()
|
||||
{
|
||||
Init();
|
||||
return (double)m_Freq.QuadPart;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the number of cores in the system.
|
||||
/// </summary>
|
||||
@@ -140,21 +135,16 @@ private:
|
||||
{
|
||||
if (!m_TimingInit)
|
||||
{
|
||||
SYSTEM_INFO sysinfo;
|
||||
|
||||
QueryPerformanceFrequency(&m_Freq);
|
||||
GetSystemInfo(&sysinfo);
|
||||
m_ProcessorCount = sysinfo.dwNumberOfProcessors;
|
||||
m_ProcessorCount = thread::hardware_concurrency();
|
||||
m_TimingInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
int m_Precision;//How many digits after the decimal place to print for seconds.
|
||||
LARGE_INTEGER m_BeginTime;//The start of the timing, set with Tic().
|
||||
LARGE_INTEGER m_EndTime;//The end of the timing, set with Toc().
|
||||
time_point<Clock> m_BeginTime;//The start of the timing, set with Tic().
|
||||
time_point<Clock> m_EndTime;//The end of the timing, set with Toc().
|
||||
static bool m_TimingInit;//Whether the performance info has bee queried.
|
||||
static int m_ProcessorCount;//The number of cores on the system, set in Init().
|
||||
static LARGE_INTEGER m_Freq;//The clock frequency, set in Init().
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -162,9 +152,9 @@ private:
|
||||
/// </summary>
|
||||
class EMBER_API CriticalSection
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
public:
|
||||
|
||||
#ifdef _WIN32
|
||||
/// <summary>
|
||||
/// Constructor which initialized the underlying CRITICAL_SECTION object.
|
||||
/// </summary>
|
||||
@@ -176,7 +166,7 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="spinCount">The spin count.</param>
|
||||
CriticalSection(DWORD spinCount) { InitializeCriticalSectionAndSpinCount(&m_CriticalSection, spinCount); }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the underlying CRITICAL_SECTION object.
|
||||
/// </summary>
|
||||
@@ -228,4 +218,4 @@ private:
|
||||
|
||||
#endif
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+72
-31
@@ -153,7 +153,12 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
|
||||
if (f != NULL)
|
||||
{
|
||||
struct _stat statBuf;
|
||||
|
||||
#ifdef _WIN32
|
||||
int statResult = _fstat(f->_file, &statBuf);//Get data associated with file.
|
||||
#else
|
||||
int statResult = _fstat(f->_fileno, &statBuf);//Get data associated with file.
|
||||
#endif
|
||||
|
||||
if (statResult == 0)//Check if statistics are valid.
|
||||
{
|
||||
@@ -166,7 +171,7 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
|
||||
if (bytesRead == statBuf.st_size)//Ensure the number of bytes read matched what was requested.
|
||||
{
|
||||
if (nullTerminate)//Optionally NULL terminate if they want to treat it as a string.
|
||||
buf[buf.size() - 1] = NULL;
|
||||
buf[buf.size() - 1] = 0;
|
||||
|
||||
b = true;//Success.
|
||||
}
|
||||
@@ -247,6 +252,26 @@ static void RgbaToRgb(vector<unsigned char>& rgba, vector<unsigned char>& rgb, u
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System floor() extremely slow because it accounts for various error conditions.
|
||||
/// This is a much faster version that works on data that is not NaN.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to return the floor of</param>
|
||||
/// <returns>The floored value</returns>
|
||||
template <typename T>
|
||||
static inline int Floor(T val)
|
||||
{
|
||||
if (val >= 0)
|
||||
{
|
||||
return (int)val;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = (int)val;//Truncate.
|
||||
return i - (i > val);//Convert trunc to floor.
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clamp and return a value to be greater than or equal to a specified minimum and less than
|
||||
/// or equal to a specified maximum.
|
||||
@@ -388,30 +413,10 @@ inline float LRint(float x)
|
||||
/// <returns>The rounded value</returns>
|
||||
inline double LRint(double x)
|
||||
{
|
||||
__int64 temp = (x >= 0 ? (__int64)(x + 0.5) : (__int64)(x - 0.5));
|
||||
int64_t temp = (x >= 0 ? (int64_t)(x + 0.5) : (int64_t)(x - 0.5));
|
||||
return (double)temp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System floor() extremely slow because it accounts for various error conditions.
|
||||
/// This is a much faster version that works on data that is not NaN.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to return the floor of</param>
|
||||
/// <returns>The floored value</returns>
|
||||
template <typename T>
|
||||
static inline int Floor(T val)
|
||||
{
|
||||
if (val >= 0)
|
||||
{
|
||||
return (int)val;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = (int)val;//Truncate.
|
||||
return i - (i > val);//Convert trunc to floor.
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Never really understood what this did.
|
||||
/// </summary>
|
||||
@@ -421,7 +426,7 @@ template <typename T>
|
||||
static inline T Round6(T r)
|
||||
{
|
||||
r *= 1e6;
|
||||
|
||||
|
||||
if (r < 0)
|
||||
r -= 1;
|
||||
|
||||
@@ -632,7 +637,7 @@ static inline T LogMap(T x)
|
||||
/// <param name="name">The name of the tag of the to inspect</param>
|
||||
/// <param name="val">The value compare against</param>
|
||||
/// <returns>True if the comparison matched, else false</returns>
|
||||
static inline bool Compare(const xmlChar* name, char* val)
|
||||
static inline bool Compare(const xmlChar* name, const char* val)
|
||||
{
|
||||
return xmlStrcmp(name, XC val) != 0;
|
||||
}
|
||||
@@ -722,7 +727,7 @@ static inline string ToLower(string& str)
|
||||
/// </summary>
|
||||
/// <param name="str">The string to copy and make upper case</param>
|
||||
/// <returns>The upper case string</returns>
|
||||
static inline string ToUpper(string& str)
|
||||
static inline string ToUpper(const string& str)
|
||||
{
|
||||
string upper;
|
||||
|
||||
@@ -781,19 +786,29 @@ static T Arg(char* name, T def)
|
||||
/// <param name="def">The default value to return if the environment variable was not present</param>
|
||||
/// <returns>The value of the specified environment variable if found, else default</returns>
|
||||
template <>
|
||||
static int Arg<int>(char* name, int def)
|
||||
#ifdef _WIN32
|
||||
static
|
||||
#endif
|
||||
int Arg<int>(char* name, int def)
|
||||
{
|
||||
char* ch;
|
||||
int returnVal;
|
||||
size_t len;
|
||||
#ifdef WIN32
|
||||
errno_t err = _dupenv_s(&ch, &len, name);
|
||||
#else
|
||||
int err = 1;
|
||||
ch = getenv(name);
|
||||
#endif
|
||||
|
||||
if (err || !ch)
|
||||
returnVal = def;
|
||||
else
|
||||
returnVal = atoi(ch);
|
||||
|
||||
#ifdef WIN32
|
||||
free(ch);
|
||||
#endif
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
@@ -804,7 +819,10 @@ static int Arg<int>(char* name, int def)
|
||||
/// <param name="def">The default value to return if the environment variable was not present</param>
|
||||
/// <returns>The value of the specified environment variable if found, else default</returns>
|
||||
template <>
|
||||
static unsigned int Arg<unsigned int>(char* name, unsigned int def)
|
||||
#ifdef _WIN32
|
||||
static
|
||||
#endif
|
||||
unsigned int Arg<unsigned int>(char* name, unsigned int def)
|
||||
{
|
||||
return Arg<int>(name, (int)def);
|
||||
}
|
||||
@@ -816,7 +834,10 @@ static unsigned int Arg<unsigned int>(char* name, unsigned int def)
|
||||
/// <param name="def">The default value to return if the environment variable was not present</param>
|
||||
/// <returns>The value of the specified environment variable if found, else default</returns>
|
||||
template <>
|
||||
static bool Arg<bool>(char* name, bool def)
|
||||
#ifdef _WIN32
|
||||
static
|
||||
#endif
|
||||
bool Arg<bool>(char* name, bool def)
|
||||
{
|
||||
return (Arg<int>(name, -999) != -999) ? true : def;
|
||||
}
|
||||
@@ -828,19 +849,29 @@ static bool Arg<bool>(char* name, bool def)
|
||||
/// <param name="def">The default value to return if the environment variable was not present</param>
|
||||
/// <returns>The value of the specified environment variable if found, else default</returns>
|
||||
template <>
|
||||
static double Arg<double>(char* name, double def)
|
||||
#ifdef _WIN32
|
||||
static
|
||||
#endif
|
||||
double Arg<double>(char* name, double def)
|
||||
{
|
||||
char* ch;
|
||||
double returnVal;
|
||||
size_t len;
|
||||
#ifdef WIN32
|
||||
errno_t err = _dupenv_s(&ch, &len, name);
|
||||
#else
|
||||
int err = 1;
|
||||
ch = getenv(name);
|
||||
#endif
|
||||
|
||||
if (err || !ch)
|
||||
returnVal = def;
|
||||
else
|
||||
returnVal = atof(ch);
|
||||
|
||||
#ifdef WIN32
|
||||
free(ch);
|
||||
#endif
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
@@ -851,12 +882,20 @@ static double Arg<double>(char* name, double def)
|
||||
/// <param name="def">The default value to return if the environment variable was not present</param>
|
||||
/// <returns>The value of the specified environment variable if found, else default</returns>
|
||||
template <>
|
||||
static string Arg<string>(char* name, string def)
|
||||
#ifdef _WIN32
|
||||
static
|
||||
#endif
|
||||
string Arg<string>(char* name, string def)
|
||||
{
|
||||
char* ch;
|
||||
string returnVal;
|
||||
size_t len;
|
||||
#ifdef WIN32
|
||||
errno_t err = _dupenv_s(&ch, &len, name);
|
||||
#else
|
||||
int err = 1;
|
||||
ch = getenv(name);
|
||||
#endif
|
||||
|
||||
if (err || !ch)
|
||||
{
|
||||
@@ -866,7 +905,9 @@ static string Arg<string>(char* name, string def)
|
||||
else
|
||||
returnVal = string(ch);
|
||||
|
||||
#ifdef WIN32
|
||||
free(ch);
|
||||
#endif
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
@@ -905,7 +946,7 @@ unsigned int inline FindAndReplace(T& source, const T& find, const T& replace)
|
||||
/// <summary>
|
||||
/// Return a character pointer to a version string composed of the EMBER_OS and EMBER_VERSION values.
|
||||
/// </summary>
|
||||
static char* EmberVersion()
|
||||
static const char* EmberVersion()
|
||||
{
|
||||
return EMBER_OS "-" EMBER_VERSION;
|
||||
}
|
||||
|
||||
+78
-168
@@ -1017,7 +1017,7 @@ public:
|
||||
m_NeedPrecalcAngles = needPrecalcAngles;
|
||||
m_NeedPrecalcAtanXY = needPrecalcAtanXY;
|
||||
m_NeedPrecalcAtanYX = needPrecalcAtanYX;
|
||||
|
||||
|
||||
//Make absolutely sure that flag logic makes sense.
|
||||
if (m_NeedPrecalcSqrtSumSquares)
|
||||
m_NeedPrecalcSumSquares = true;
|
||||
@@ -1027,7 +1027,7 @@ public:
|
||||
m_NeedPrecalcSumSquares = true;
|
||||
m_NeedPrecalcSqrtSumSquares = true;
|
||||
}
|
||||
|
||||
|
||||
m_AssignType = ASSIGNTYPE_SET;
|
||||
SetType();
|
||||
}
|
||||
@@ -1100,7 +1100,7 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="iteratorHelper">The helper to read values from in the case of pre, and store precalc values to in both cases.</param>
|
||||
/// <param name="point">The point to read values from in the case of post, ignored for pre.</param>
|
||||
void Precalc(IteratorHelper<T>& iteratorHelper, Point<T>* point)
|
||||
void PrecalcHelper(IteratorHelper<T>& iteratorHelper, Point<T>* point)
|
||||
{
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
@@ -1122,7 +1122,7 @@ public:
|
||||
|
||||
if (m_NeedPrecalcAtanXY)
|
||||
iteratorHelper.m_PrecalcAtanxy = atan2(iteratorHelper.m_TransX, iteratorHelper.m_TransY);
|
||||
|
||||
|
||||
if (m_NeedPrecalcAtanYX)
|
||||
iteratorHelper.m_PrecalcAtanyx = atan2(iteratorHelper.m_TransY, iteratorHelper.m_TransX);
|
||||
}
|
||||
@@ -1146,7 +1146,7 @@ public:
|
||||
|
||||
if (m_NeedPrecalcAtanXY)
|
||||
iteratorHelper.m_PrecalcAtanxy = atan2(point->m_X, point->m_Y);
|
||||
|
||||
|
||||
if (m_NeedPrecalcAtanYX)
|
||||
iteratorHelper.m_PrecalcAtanyx = atan2(point->m_Y, point->m_X);
|
||||
}
|
||||
@@ -1180,7 +1180,7 @@ public:
|
||||
|
||||
if (m_NeedPrecalcAtanXY)
|
||||
ss << "\tprecalcAtanxy = atan2(transX, transY);\n";
|
||||
|
||||
|
||||
if (m_NeedPrecalcAtanYX)
|
||||
ss << "\tprecalcAtanyx = atan2(transY, transX);\n";
|
||||
}
|
||||
@@ -1204,7 +1204,7 @@ public:
|
||||
|
||||
if (m_NeedPrecalcAtanXY)
|
||||
ss << "\tprecalcAtanxy = atan2(outPoint->m_X, outPoint->m_Y);\n";
|
||||
|
||||
|
||||
if (m_NeedPrecalcAtanYX)
|
||||
ss << "\tprecalcAtanyx = atan2(outPoint->m_Y, outPoint->m_X);\n";
|
||||
}
|
||||
@@ -1266,7 +1266,7 @@ public:
|
||||
/// <param name="outPoint">The point to store the result in</param>
|
||||
/// <param name="rand">The random number generator to use.</param>
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return a string which performs the equivalent calculation in Func(), but on the GPU in OpenCL.
|
||||
/// Derived classes will implement this.
|
||||
@@ -1296,7 +1296,7 @@ public:
|
||||
{
|
||||
m_Weight = rand.Frand11<T>();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string prefix to be used with params and the variation name.
|
||||
/// </summary>
|
||||
@@ -1405,7 +1405,7 @@ public:
|
||||
{
|
||||
Init(NULL, "", 0, REAL, TLOW, TMAX);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for a precalc param that takes arguments.
|
||||
/// </summary>
|
||||
@@ -1543,7 +1543,7 @@ public:
|
||||
case INTEGER_NONZERO :
|
||||
{
|
||||
int vi = (int)max(min<T>((T)Floor<T>(val + T(0.5)), m_Max), m_Min);
|
||||
|
||||
|
||||
if (vi == 0)
|
||||
vi = (int)SignNz<T>(val);
|
||||
|
||||
@@ -1605,6 +1605,8 @@ private:
|
||||
template <typename T>
|
||||
class EMBER_API ParametricVariation : public Variation<T>
|
||||
{
|
||||
using Variation<T>::Precalc;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructor which takes arguments and just passes them to the base class.
|
||||
@@ -1657,7 +1659,7 @@ public:
|
||||
//to the addresses of its members and then assign values from var.
|
||||
m_Params.reserve(5);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determine whether the params vector contains a parameter with the specified name.
|
||||
/// </summary>
|
||||
@@ -1724,7 +1726,7 @@ public:
|
||||
});
|
||||
|
||||
if (b)
|
||||
Precalc();
|
||||
this->Precalc();
|
||||
|
||||
return b;
|
||||
}
|
||||
@@ -1743,21 +1745,26 @@ public:
|
||||
m_Params[index].Set(val);
|
||||
|
||||
if (b)
|
||||
Precalc();
|
||||
this->Precalc();
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Severe hack to get g++ to compile this.
|
||||
/// </summary>
|
||||
virtual void Precalc() override { }
|
||||
|
||||
/// <summary>
|
||||
/// Place the parametric variation in a random state by setting all of the
|
||||
/// non-precalc params to values between -1 and 1;
|
||||
/// </summary>
|
||||
/// <param name="rand">The rand.</param>
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
Variation<T>::Random(rand);
|
||||
ForEach(m_Params, [&](ParamWithName<T>& param) { param.Set(rand.Frand11<T>()); });
|
||||
Precalc();
|
||||
this->Precalc();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1766,9 +1773,9 @@ public:
|
||||
void Clear()
|
||||
{
|
||||
ForEach(m_Params, [&](ParamWithName<T>& param) { *(param.Param()) = 0; });
|
||||
Precalc();
|
||||
this->Precalc();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return a vector of all parameter names, optionally including precalcs.
|
||||
/// </summary>
|
||||
@@ -1825,7 +1832,7 @@ protected:
|
||||
if (!m_Params[i].IsPrecalc())
|
||||
m_Params[i].Set(T(params[i].ParamVal()));
|
||||
|
||||
Precalc();
|
||||
this->Precalc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1838,77 +1845,36 @@ protected:
|
||||
/// Defining assignment operators isn't really needed because Variations are always held as pointers.
|
||||
/// </summary>
|
||||
|
||||
#ifdef DO_DOUBLE
|
||||
#define VARCOPY(name) \
|
||||
public: \
|
||||
name(const name<T>& var) \
|
||||
: Variation<T>(var) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
template <typename U> \
|
||||
name(const name<U>& var) \
|
||||
: Variation<T>(var) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<float>*& var) const \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<float>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<double>*& var) const \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<double>(*this); \
|
||||
}
|
||||
#define VARUSINGS \
|
||||
using Variation<T>::m_Weight; \
|
||||
using Variation<T>::m_Xform; \
|
||||
using Variation<T>::m_VariationId; \
|
||||
using Variation<T>::m_Name; \
|
||||
using Variation<T>::m_VarType; \
|
||||
using Variation<T>::m_AssignType; \
|
||||
using Variation<T>::SetType; \
|
||||
using Variation<T>::IndexInXform; \
|
||||
using Variation<T>::XformIndexInEmber; \
|
||||
using Variation<T>::Prefix;
|
||||
|
||||
#define PREPOSTVARCOPY(name, base) \
|
||||
name(const name<T>& var) \
|
||||
: base<T>(var) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
template <typename U> \
|
||||
name(const name<U>& var) \
|
||||
: base<T>(var) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<float>*& var) const \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<float>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<double>*& var) const \
|
||||
//using Variation<T>::Precalc; \
|
||||
|
||||
#ifdef DO_DOUBLE
|
||||
#define VARCOPYDOUBLE(name) \
|
||||
virtual void Copy(Variation<double>*& var) const override \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<double>(*this); \
|
||||
}
|
||||
} \
|
||||
|
||||
#else
|
||||
#define VARCOPYDOUBLE(name)
|
||||
#endif // DO_DOUBLE
|
||||
|
||||
#define VARCOPY(name) \
|
||||
VARUSINGS \
|
||||
public: \
|
||||
name(const name<T>& var) \
|
||||
: Variation<T>(var) \
|
||||
@@ -1921,18 +1887,20 @@ protected:
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() \
|
||||
virtual Variation<T>* Copy() override \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<float>*& var) const \
|
||||
virtual void Copy(Variation<float>*& var) const override \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<float>(*this); \
|
||||
}
|
||||
} \
|
||||
\
|
||||
VARCOPYDOUBLE(name) \
|
||||
|
||||
#define PREPOSTVARCOPY(name, base) \
|
||||
name(const name<T>& var) \
|
||||
@@ -1946,19 +1914,20 @@ protected:
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() \
|
||||
virtual Variation<T>* Copy() override \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<float>*& var) const \
|
||||
virtual void Copy(Variation<float>*& var) const override \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<float>(*this); \
|
||||
}
|
||||
#endif
|
||||
} \
|
||||
\
|
||||
VARCOPYDOUBLE(name) \
|
||||
|
||||
/// <summary>
|
||||
/// Macro to create pre and post counterparts to a variation.
|
||||
@@ -1970,6 +1939,7 @@ protected:
|
||||
template <typename T> \
|
||||
class EMBER_API Pre##varName##Variation : public varName##Variation<T> \
|
||||
{ \
|
||||
VARUSINGS \
|
||||
public: \
|
||||
Pre##varName##Variation(T weight = 1.0) : varName##Variation<T>(weight) \
|
||||
{ \
|
||||
@@ -1985,6 +1955,7 @@ protected:
|
||||
template <typename T> \
|
||||
class EMBER_API Post##varName##Variation : public varName##Variation<T> \
|
||||
{ \
|
||||
VARUSINGS \
|
||||
public:\
|
||||
Post##varName##Variation(T weight = 1.0) : varName##Variation<T>(weight) \
|
||||
{ \
|
||||
@@ -2006,9 +1977,15 @@ protected:
|
||||
/// Instead, every class must define it as a non-virtual function and explicitly call it in its constructor.
|
||||
/// </summary>
|
||||
|
||||
#ifdef DO_DOUBLE
|
||||
#define PARVARUSINGS \
|
||||
using ParametricVariation<T>::m_Params; \
|
||||
using ParametricVariation<T>::CopyParamVals;
|
||||
|
||||
//using Variation<T>::Precalc; \
|
||||
|
||||
#define PARVARCOPY(name) \
|
||||
VARUSINGS \
|
||||
PARVARUSINGS \
|
||||
public: \
|
||||
name(const name<T>& var) \
|
||||
: ParametricVariation<T>(var) \
|
||||
@@ -2025,12 +2002,12 @@ protected:
|
||||
CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() \
|
||||
virtual Variation<T>* Copy() override \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<float>*& var) const \
|
||||
virtual void Copy(Variation<float>*& var) const override \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
@@ -2038,13 +2015,7 @@ protected:
|
||||
var = new name<float>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<double>*& var) const \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<double>(*this); \
|
||||
}
|
||||
VARCOPYDOUBLE(name) \
|
||||
|
||||
#define PREPOSTPARVARCOPY(name, base) \
|
||||
name(const name<T>& var) \
|
||||
@@ -2062,12 +2033,12 @@ protected:
|
||||
CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() \
|
||||
virtual Variation<T>* Copy() override \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<float>*& var) const \
|
||||
virtual void Copy(Variation<float>*& var) const override \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
@@ -2075,74 +2046,7 @@ protected:
|
||||
var = new name<float>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<double>*& var) const \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<double>(*this); \
|
||||
}
|
||||
#else
|
||||
|
||||
#define PARVARCOPY(name) \
|
||||
public: \
|
||||
name(const name<T>& var) \
|
||||
: ParametricVariation<T>(var) \
|
||||
{ \
|
||||
Init(); /* Assign the addresses of the members to the vector. */ \
|
||||
CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \
|
||||
} \
|
||||
\
|
||||
template <typename U> \
|
||||
name(const name<U>& var) \
|
||||
: ParametricVariation<T>(var) \
|
||||
{ \
|
||||
Init(); /* Assign the addresses of the members to the vector. */ \
|
||||
CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<float>*& var) const \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<float>(*this); \
|
||||
}
|
||||
|
||||
#define PREPOSTPARVARCOPY(name, base) \
|
||||
name(const name<T>& var) \
|
||||
: base<T>(var) \
|
||||
{ \
|
||||
Init(); /* Assign the addresses of the members to the vector. */ \
|
||||
CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \
|
||||
} \
|
||||
\
|
||||
template <typename U> \
|
||||
name(const name<U>& var) \
|
||||
: base<T>(var) \
|
||||
{ \
|
||||
Init(); /* Assign the addresses of the members to the vector. */ \
|
||||
CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \
|
||||
} \
|
||||
\
|
||||
virtual Variation<T>* Copy() \
|
||||
{ \
|
||||
return new name<T>(*this); \
|
||||
} \
|
||||
\
|
||||
virtual void Copy(Variation<float>*& var) const \
|
||||
{ \
|
||||
if (var != NULL) \
|
||||
delete var; \
|
||||
\
|
||||
var = new name<float>(*this); \
|
||||
}
|
||||
#endif
|
||||
VARCOPYDOUBLE(name)
|
||||
|
||||
/// <summary>
|
||||
/// Macro to create pre and post counterparts to a parametric variation.
|
||||
@@ -2156,6 +2060,9 @@ protected:
|
||||
template <typename T> \
|
||||
class EMBER_API Pre##varName##Variation : public varName##Variation <T> \
|
||||
{ \
|
||||
VARUSINGS \
|
||||
PARVARUSINGS \
|
||||
using varName##Variation<T>::Init; \
|
||||
public:\
|
||||
Pre##varName##Variation(T weight = 1.0) : varName##Variation<T>(weight) \
|
||||
{ \
|
||||
@@ -2172,6 +2079,9 @@ protected:
|
||||
template <typename T> \
|
||||
class EMBER_API Post##varName##Variation : public varName##Variation<T> \
|
||||
{ \
|
||||
VARUSINGS \
|
||||
PARVARUSINGS \
|
||||
using varName##Variation<T>::Init; \
|
||||
public:\
|
||||
Post##varName##Variation(T weight = 1.0) : varName##Variation<T>(weight) \
|
||||
{ \
|
||||
@@ -2184,4 +2094,4 @@ protected:
|
||||
\
|
||||
PREPOSTPARVARCOPY(Post##varName##Variation, varName##Variation) \
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+472
-472
File diff suppressed because it is too large
Load Diff
+316
-316
File diff suppressed because it is too large
Load Diff
+238
-238
File diff suppressed because it is too large
Load Diff
+233
-233
File diff suppressed because it is too large
Load Diff
+125
-125
@@ -17,8 +17,8 @@ public:
|
||||
}
|
||||
|
||||
PARVARCOPY(Bubble2Variation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T t = T(0.25) * (helper.m_PrecalcSumSquares + SQR(helper.In.z)) + 1;
|
||||
T r = m_Weight / t;
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
helper.Out.z += helper.In.z * r * m_Z;//The += is intentional.
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -66,7 +66,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_X, prefix + "bubble2_x", 1));//Original used a prefix of bubble_, which is incompatible with Ember's design.
|
||||
m_Params.push_back(ParamWithName<T>(&m_Y, prefix + "bubble2_y", 1));
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
|
||||
PARVARCOPY(CircleLinearVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int m = Floor<T>(T(0.5) * helper.In.x / m_Sc);
|
||||
int n = Floor<T>(T(0.5) * helper.In.y / m_Sc);
|
||||
@@ -141,8 +141,8 @@ public:
|
||||
helper.Out.y = m_Weight * (y + (n * 2 + 1) * m_Sc);
|
||||
helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string seed = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\tint m = (int)floor(0.5 * vIn.x / " << sc << ");\n"
|
||||
<< "\t\tint n = (int)floor(0.5 * vIn.y / " << sc << ");\n"
|
||||
@@ -238,7 +238,7 @@ protected:
|
||||
m_Params.push_back(ParamWithName<T>(&m_Y, prefix + "CircleLinear_Y", 10));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Seed, prefix + "CircleLinear_Seed", 0, INTEGER));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
T DiscreteNoise2(int x, int y)
|
||||
{
|
||||
@@ -275,7 +275,7 @@ public:
|
||||
|
||||
PARVARCOPY(CircleRandVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int m, n, iters = 0;
|
||||
T x, y, u;
|
||||
@@ -299,8 +299,8 @@ public:
|
||||
helper.Out.y = m_Weight * (y + (n * 2 + 1) * m_Sc);
|
||||
helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -311,7 +311,7 @@ public:
|
||||
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string seed = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\tint m, n, iters = 0;\n"
|
||||
<< "\t\treal_t x, y, u;\n"
|
||||
@@ -366,7 +366,7 @@ protected:
|
||||
m_Params.push_back(ParamWithName<T>(&m_Y, prefix + "CircleRand_Y", 10));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Seed, prefix + "CircleRand_Seed", 0, INTEGER));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
T DiscreteNoise2(int x, int y)
|
||||
{
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
|
||||
PARVARCOPY(CircleTrans1Variation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T ux, uy, u, x, y;
|
||||
|
||||
@@ -427,8 +427,8 @@ public:
|
||||
helper.Out.y = m_Weight * uy;
|
||||
helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -439,7 +439,7 @@ public:
|
||||
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string seed = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t ux, uy, u, x, y;\n"
|
||||
<< "\n"
|
||||
@@ -528,7 +528,7 @@ protected:
|
||||
m_Params.push_back(ParamWithName<T>(&m_Y, prefix + "CircleTrans1_Y", 10));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Seed, prefix + "CircleTrans1_Seed", 0, INTEGER));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
T DiscreteNoise2(int x, int y)
|
||||
{
|
||||
@@ -561,12 +561,12 @@ private:
|
||||
u = T(0.3) + T(0.7) * DiscreteNoise2(m + 10, n + 3);
|
||||
x = u * cos(alpha);
|
||||
y = u * sin(alpha);
|
||||
|
||||
|
||||
if (++iters > 10)
|
||||
break;
|
||||
}
|
||||
while (DiscreteNoise2((int)(m + m_Seed), n) > m_Dens);
|
||||
|
||||
|
||||
*ux = x + (m * 2 + 1) * m_Sc;
|
||||
*vy = y + (n * 2 + 1) * m_Sc;
|
||||
}
|
||||
@@ -591,8 +591,8 @@ public:
|
||||
}
|
||||
|
||||
PARVARCOPY(Cubic3DVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int useNode = rand.Rand() & 7;//Faster than % 8.
|
||||
T exnze, wynze, znxy;
|
||||
@@ -665,7 +665,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -693,7 +693,7 @@ public:
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
ss <<
|
||||
ss <<
|
||||
"\t\tpx = vIn.x;\n"
|
||||
"\t\tpy = vIn.y;\n"
|
||||
"\t\tpz = vIn.z;\n";
|
||||
@@ -754,8 +754,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
if (fabs(m_Xpand) <= 1)
|
||||
m_Fill = m_Xpand * T(0.5);
|
||||
@@ -784,7 +784,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Xpand, prefix + "cubic3D_xpand", T(0.25)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Style, prefix + "cubic3D_style"));
|
||||
@@ -814,8 +814,8 @@ public:
|
||||
}
|
||||
|
||||
PARVARCOPY(CubicLattice3DVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int useNode = rand.Rand() & 7;//Faster than % 8.
|
||||
T exnze, wynze, znxy, px, py, pz, lattd = m_Weight;
|
||||
@@ -825,7 +825,7 @@ public:
|
||||
exnze = cos(atan2(helper.In.x, helper.In.z));
|
||||
wynze = sin(atan2(helper.In.y, helper.In.z));
|
||||
znxy = (exnze + wynze) * T(0.5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
exnze = 1;
|
||||
@@ -895,7 +895,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -924,7 +924,7 @@ public:
|
||||
|
||||
if (m_VarType == VARTYPE_PRE)
|
||||
{
|
||||
ss <<
|
||||
ss <<
|
||||
"\t\tpx = vIn.x;\n"
|
||||
"\t\tpy = vIn.y;\n"
|
||||
"\t\tpz = vIn.z;\n";
|
||||
@@ -989,7 +989,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
virtual void Precalc() override
|
||||
{
|
||||
if (fabs(m_Xpand) <= 1)
|
||||
m_Fill = m_Xpand * T(0.5);
|
||||
@@ -1001,7 +1001,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Xpand, prefix + "cubicLattice_3D_xpand", T(0.2)));//Original used a prefix of cubic3D_, which is incompatible with Ember's design.
|
||||
m_Params.push_back(ParamWithName<T>(&m_Style, prefix + "cubicLattice_3D_style", 1, INTEGER, 1, 2));
|
||||
@@ -1025,7 +1025,7 @@ public:
|
||||
|
||||
VARCOPY(Foci3DVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T expx = exp(helper.In.x) * T(0.5);
|
||||
T expnx = T(0.25) / expx;
|
||||
@@ -1037,7 +1037,7 @@ public:
|
||||
helper.Out.z = sin(boot) * tmp;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss;
|
||||
int varIndex = IndexInXform();
|
||||
@@ -1070,8 +1070,8 @@ public:
|
||||
}
|
||||
|
||||
PARVARCOPY(HoVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T uu = SQR(helper.In.x);
|
||||
T vv = SQR(helper.In.y);
|
||||
@@ -1094,7 +1094,7 @@ public:
|
||||
helper.Out.z = m_Weight * z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -1133,7 +1133,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_XPow, prefix + "ho_xpow", 3));
|
||||
m_Params.push_back(ParamWithName<T>(&m_YPow, prefix + "ho_ypow", 3));
|
||||
@@ -1160,7 +1160,7 @@ public:
|
||||
|
||||
PARVARCOPY(Julia3DqVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T temp = helper.m_PrecalcAtanyx * m_InvPower + rand.Rand() * m_InvPower2pi;
|
||||
T sina = sin(temp);
|
||||
@@ -1175,7 +1175,7 @@ public:
|
||||
helper.Out.z = r * z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -1187,7 +1187,7 @@ public:
|
||||
string absInvPower = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string halfInvPower = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string invPower2pi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t temp = precalcAtanyx * " << invPower << " + MwcNext(mwc) * " << invPower2pi << ";\n"
|
||||
<< "\t\treal_t sina = sin(temp);\n"
|
||||
@@ -1205,7 +1205,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_InvPower = m_Divisor / m_Power;
|
||||
m_AbsInvPower = fabs(m_InvPower);
|
||||
@@ -1250,7 +1250,7 @@ public:
|
||||
|
||||
PARVARCOPY(LineVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = rand.Frand01<T>() * m_Weight;
|
||||
|
||||
@@ -1259,7 +1259,7 @@ public:
|
||||
helper.Out.z = m_Uz * r;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -1270,7 +1270,7 @@ public:
|
||||
string ux = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string uy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string uz = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t r = MwcNext01(mwc) * xform->m_VariationWeights[" << varIndex << "];\n"
|
||||
<< "\n"
|
||||
@@ -1282,7 +1282,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
virtual void Precalc() override
|
||||
{
|
||||
//Unit vector of the line.
|
||||
m_Ux = cos(m_Delta * T(M_PI)) * cos(m_Phi * T(M_PI));
|
||||
@@ -1332,7 +1332,7 @@ public:
|
||||
|
||||
PARVARCOPY(Loonie3DVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T rmod = rand.Frand01<T>() * T(0.5) + T(0.125);
|
||||
T kikr = helper.m_PrecalcAtanyx;
|
||||
@@ -1355,14 +1355,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string vv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t rmod = MwcNext01(mwc) * 0.5 + 0.125;\n"
|
||||
<< "\t\treal_t kikr = precalcAtanyx;\n"
|
||||
@@ -1388,7 +1388,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Vv = SQR(m_Weight);
|
||||
}
|
||||
@@ -1420,7 +1420,7 @@ public:
|
||||
|
||||
PARVARCOPY(McarpetVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T t = helper.m_PrecalcSumSquares * T(0.25) + 1;
|
||||
T r = m_Weight / t;
|
||||
@@ -1432,7 +1432,7 @@ public:
|
||||
helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -1442,7 +1442,7 @@ public:
|
||||
string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string twist = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string tilt = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t t = precalcSumSquares * 0.25 + 1;\n"
|
||||
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] / t;\n"
|
||||
@@ -1493,7 +1493,7 @@ public:
|
||||
|
||||
PARVARCOPY(Waves23DVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T avgxy = (helper.In.x + helper.In.y) * T(0.5);
|
||||
|
||||
@@ -1502,7 +1502,7 @@ public:
|
||||
helper.Out.z = m_Weight * (helper.In.z + m_Scale * sin(avgxy * m_Freq));//Averages the XY to get Z.
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -1510,7 +1510,7 @@ public:
|
||||
string index = ss2.str();
|
||||
string freq = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t avgxy = (vIn.x + vIn.y) * 0.5;\n"
|
||||
<< "\n"
|
||||
@@ -1551,7 +1551,7 @@ public:
|
||||
|
||||
PARVARCOPY(Pie3DVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int sl = (int)(rand.Frand01<T>() * m_Slices + T(0.5));
|
||||
T a = m_Rotation + M_2PI * (sl + rand.Frand01<T>() * m_Thickness) / m_Slices;
|
||||
@@ -1561,8 +1561,8 @@ public:
|
||||
helper.Out.y = r * sin(a);
|
||||
helper.Out.z = m_Weight * sin(r);
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -1584,8 +1584,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Params[0].Set((int)10 * rand.Frand01<T>());//Slices.
|
||||
m_Params[1].Set(M_2PI * rand.Frand11<T>());//Rotation.
|
||||
@@ -1596,7 +1596,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Slices, prefix + "pie3D_slices", 6, INTEGER_NONZERO, 1));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Rotation, prefix + "pie3D_rotation", T(0.5), REAL_CYCLIC, 0, M_2PI));
|
||||
@@ -1623,7 +1623,7 @@ public:
|
||||
|
||||
PARVARCOPY(Popcorn23DVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T otherZ, tempPZ = 0;
|
||||
T tempTZ = helper.In.z == 0 ? m_Vv * m_SinTanC * helper.m_PrecalcAtanyx : helper.In.z;
|
||||
@@ -1634,14 +1634,14 @@ public:
|
||||
otherZ = outPoint.m_Z;
|
||||
|
||||
if (otherZ == 0)
|
||||
tempPZ = m_Vv * m_SinTanC * helper.m_PrecalcAtanyx;
|
||||
tempPZ = m_Vv * m_SinTanC * helper.m_PrecalcAtanyx;
|
||||
|
||||
helper.Out.x = m_HalfWeight * (helper.In.x + m_X * sin(tan(m_C * helper.In.y)));
|
||||
helper.Out.y = m_HalfWeight * (helper.In.y + m_Y * sin(tan(m_C * helper.In.x)));
|
||||
helper.Out.z = tempPZ + m_Vv * (m_Z * m_SinTanC * tempTZ);
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -1674,8 +1674,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_SinTanC = sin(tan(m_C));
|
||||
m_HalfWeight = m_Weight * T(0.5);
|
||||
@@ -1686,7 +1686,7 @@ public:
|
||||
m_Vv = m_Weight;
|
||||
}
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_X = T(0.2) + rand.Frand01<T>();
|
||||
m_Y = T(0.2) * rand.Frand01<T>();
|
||||
@@ -1698,7 +1698,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_X, prefix + "popcorn2_3D_x", T(0.1)));
|
||||
m_Params.push_back(ParamWithName<T>(&m_Y, prefix + "popcorn2_3D_y", T(0.1)));
|
||||
@@ -1708,7 +1708,7 @@ protected:
|
||||
m_Params.push_back(ParamWithName<T>(true, &m_HalfWeight, prefix + "popcorn2_3D_half_weight"));
|
||||
m_Params.push_back(ParamWithName<T>(true, &m_Vv, prefix + "popcorn2_3D_vv"));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
T m_X;
|
||||
T m_Y;
|
||||
@@ -1730,14 +1730,14 @@ public:
|
||||
|
||||
VARCOPY(Sinusoidal3DVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * sin(helper.In.x);
|
||||
helper.Out.y = m_Weight * sin(helper.In.y);
|
||||
helper.Out.z = m_Weight * (atan2(SQR(helper.In.x), SQR(helper.In.y)) * cos(helper.In.z));
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss;
|
||||
int varIndex = IndexInXform();
|
||||
@@ -1766,7 +1766,7 @@ public:
|
||||
|
||||
PARVARCOPY(Scry3DVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T t = helper.m_PrecalcSumSquares + SQR(helper.In.z);
|
||||
T r = 1 / (sqrt(t) * (t + m_InvWeight));
|
||||
@@ -1777,7 +1777,7 @@ public:
|
||||
helper.Out.z = z * r;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -1797,8 +1797,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_InvWeight = 1 / Zeps(m_Weight);
|
||||
}
|
||||
@@ -1807,11 +1807,11 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(true, &m_InvWeight, prefix + "scry_3D_inv_weight"));//Precalcs only, no params.
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
T m_InvWeight;//Precalcs only, no params.
|
||||
};
|
||||
@@ -1830,7 +1830,7 @@ public:
|
||||
|
||||
PARVARCOPY(ShredlinVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
const int xpos = helper.In.x < 0;
|
||||
const int ypos = helper.In.y < 0;
|
||||
@@ -1843,8 +1843,8 @@ public:
|
||||
//outPoint.m_X = 0;
|
||||
//outPoint.m_Y = 0;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -1873,7 +1873,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Xw = m_Weight * m_XDistance;
|
||||
m_Yw = m_Weight * m_YDistance;
|
||||
@@ -1885,7 +1885,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_XDistance, prefix + "shredlin_xdistance", 1, REAL_NONZERO));
|
||||
m_Params.push_back(ParamWithName<T>(&m_XWidth, prefix + "shredlin_xwidth", T(0.5), REAL, -1, 1));
|
||||
@@ -1922,7 +1922,7 @@ public:
|
||||
|
||||
PARVARCOPY(SplitBrdrVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T b = m_Weight / (helper.m_PrecalcSumSquares * T(0.25) + 1);
|
||||
T roundX = Rint(helper.In.x);
|
||||
@@ -1932,7 +1932,7 @@ public:
|
||||
|
||||
helper.Out.x = helper.In.x * b;
|
||||
helper.Out.y = helper.In.y * b;
|
||||
|
||||
|
||||
if (rand.Frand01<T>() >= T(0.75))
|
||||
{
|
||||
helper.Out.x += m_Weight * (offsetX * T(0.5) + roundX);
|
||||
@@ -1950,7 +1950,7 @@ public:
|
||||
else
|
||||
{
|
||||
helper.Out.x += m_Weight * (offsetX * T(0.5) + roundX - m_Y);
|
||||
helper.Out.y += m_Weight * (offsetY * T(0.5) + roundY - m_Y * offsetY / offsetX);
|
||||
helper.Out.y += m_Weight * (offsetY * T(0.5) + roundY - m_Y * offsetY / offsetX);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1972,8 +1972,8 @@ public:
|
||||
helper.Out.y += helper.In.y * m_Py;
|
||||
helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -2041,7 +2041,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_X, prefix + "SplitBrdr_x", T(0.25)));//Original used a prefix of splitb_, which is incompatible with Ember's design.
|
||||
m_Params.push_back(ParamWithName<T>(&m_Y, prefix + "SplitBrdr_y", T(0.25)));
|
||||
@@ -2067,11 +2067,11 @@ public:
|
||||
|
||||
VARCOPY(WdiscVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T a = T(M_PI) / (helper.m_PrecalcSqrtSumSquares + 1);
|
||||
T r = helper.m_PrecalcAtanyx * T(M_1_PI);
|
||||
|
||||
|
||||
if (r > 0)
|
||||
a = T(M_PI) - a;
|
||||
|
||||
@@ -2080,7 +2080,7 @@ public:
|
||||
helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss;
|
||||
int varIndex = IndexInXform();
|
||||
@@ -2115,7 +2115,7 @@ public:
|
||||
|
||||
PARVARCOPY(FalloffVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
const T ax = rand.Frand<T>(T(-0.5), T(0.5));
|
||||
const T ay = rand.Frand<T>(T(-0.5), T(0.5));
|
||||
@@ -2157,8 +2157,8 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -2222,7 +2222,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_InternalScatter = T(0.04) * m_Scatter;
|
||||
}
|
||||
@@ -2231,7 +2231,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scatter, prefix + "falloff_scatter", 1, REAL, EPS, TMAX));
|
||||
m_Params.push_back(ParamWithName<T>(&m_MinDist, prefix + "falloff_mindist", T(0.5), REAL, 0, TMAX));
|
||||
@@ -2276,7 +2276,7 @@ public:
|
||||
|
||||
PARVARCOPY(Falloff2Variation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
const v4T random(rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)));
|
||||
const T distA = sqrt(Sqr(helper.In.x - m_X0) + Sqr(helper.In.y - m_Y0) + Sqr(helper.In.z - m_Z0));
|
||||
@@ -2290,7 +2290,7 @@ public:
|
||||
helper.Out.x = helper.In.x + m_MulX * random.x * dist;
|
||||
helper.Out.y = helper.In.y + m_MulY * random.y * dist;
|
||||
helper.Out.z = helper.In.z + m_MulZ * random.z * dist;
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, 1));
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, T(1)));
|
||||
}
|
||||
break;
|
||||
case 1://Radial.
|
||||
@@ -2314,7 +2314,7 @@ public:
|
||||
helper.Out.x = r * sigmac * phic;
|
||||
helper.Out.y = r * sigmac * phis;
|
||||
helper.Out.z = r * sigmas;
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, 1));
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, T(1)));
|
||||
}
|
||||
break;
|
||||
case 2://Gaussian.
|
||||
@@ -2330,13 +2330,13 @@ public:
|
||||
helper.Out.x = helper.In.x + m_MulX * rad * sigmac * phic;
|
||||
helper.Out.y = helper.In.y + m_MulY * rad * sigmac * phis;
|
||||
helper.Out.z = helper.In.z + m_MulZ * rad * sigmas;
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, 1));
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, T(1)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -2418,7 +2418,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_RMax = T(0.04) * m_Scatter;
|
||||
}
|
||||
@@ -2427,7 +2427,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Scatter, prefix + "falloff2_scatter", 1, REAL, EPS, TMAX));
|
||||
m_Params.push_back(ParamWithName<T>(&m_MinDist, prefix + "falloff2_mindist", T(0.5), REAL, 0, TMAX));
|
||||
@@ -2472,7 +2472,7 @@ public:
|
||||
|
||||
PARVARCOPY(Falloff3Variation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
const v4T random(rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)));
|
||||
T radius;
|
||||
@@ -2504,7 +2504,7 @@ public:
|
||||
helper.Out.x = helper.In.x + m_MulX * rad * sigmac * phic;
|
||||
helper.Out.y = helper.In.y + m_MulY * rad * sigmac * phis;
|
||||
helper.Out.z = helper.In.z + m_MulZ * rad * sigmas;
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, 1));
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, T(1)));
|
||||
}
|
||||
break;
|
||||
case 1://Radial.
|
||||
@@ -2528,7 +2528,7 @@ public:
|
||||
helper.Out.x = r * sigmac * phic;
|
||||
helper.Out.y = r * sigmac * phis;
|
||||
helper.Out.z = r * sigmas;
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, 1));
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + m_MulC * random.w * dist, T(1)));
|
||||
}
|
||||
break;
|
||||
case 2://Log.
|
||||
@@ -2538,13 +2538,13 @@ public:
|
||||
helper.Out.x = helper.In.x + LogMap(m_MulX) * LogScale(random.x) * coeff,
|
||||
helper.Out.y = helper.In.y + LogMap(m_MulY) * LogScale(random.y) * coeff,
|
||||
helper.Out.z = helper.In.z + LogMap(m_MulZ) * LogScale(random.z) * coeff,
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + LogMap(m_MulC) * LogScale(random.w) * coeff, 1));
|
||||
outPoint.m_ColorX = fabs(fmod(outPoint.m_ColorX + LogMap(m_MulC) * LogScale(random.w) * coeff, T(1)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -2642,7 +2642,7 @@ public:
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_RMax = T(0.04) * m_BlurStrength;
|
||||
}
|
||||
@@ -2700,7 +2700,7 @@ public:
|
||||
|
||||
PARVARCOPY(XtrbVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int m, n;
|
||||
T alpha, beta, offsetAl, offsetBe, offsetGa, x, y;
|
||||
@@ -2736,8 +2736,8 @@ public:
|
||||
helper.Out.y = m_Weight * y;
|
||||
helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -2771,7 +2771,7 @@ public:
|
||||
string width3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string absN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
|
||||
|
||||
ss << "\t{\n"
|
||||
<< "\t\tint m, n;\n"
|
||||
<< "\t\treal_t alpha, beta, offsetAl, offsetBe, offsetGa, x, y;\n"
|
||||
@@ -2995,7 +2995,7 @@ public:
|
||||
;
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
virtual void Precalc() override
|
||||
{
|
||||
T s2, sinA2, cosA2, sinB2, cosB2, sinC2, cosC2;
|
||||
T br = T(0.047) + m_A;
|
||||
@@ -3078,7 +3078,7 @@ protected:
|
||||
m_Params.push_back(ParamWithName<T>(true, &m_AbsN, prefix + "xtrb_absn"));
|
||||
m_Params.push_back(ParamWithName<T>(true, &m_Cn, prefix + "xtrb_cn"));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
inline void DirectTrilinear(T x, T y, T& al, T& be)
|
||||
{
|
||||
@@ -3096,7 +3096,7 @@ private:
|
||||
x = r * cos(angle);
|
||||
y = r * sin(angle);
|
||||
}
|
||||
|
||||
|
||||
void Hex(T al, T be, T ga, T& al1, T& be1, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
{
|
||||
T ga1, de1, r = rand.Frand01<T>();
|
||||
@@ -3133,7 +3133,7 @@ private:
|
||||
de1 = m_Width1 * be + m_Width2 * m_Hb * be / ga;
|
||||
ga1 = m_Width1 * ga + m_Width2 * m_S2ac * (3 - be / ga);
|
||||
}
|
||||
|
||||
|
||||
al1 = m_S2a - m_Ba * de1 - m_Ca * ga1;
|
||||
be1 = de1;
|
||||
}
|
||||
@@ -3166,7 +3166,7 @@ private:
|
||||
ga1 = m_Width1 * ga + m_Width2 * m_Hc * ga / al;
|
||||
de1 = m_Width1 * al + m_Width2 * m_S2ab * (3 - ga / al);
|
||||
}
|
||||
|
||||
|
||||
be1 = m_S2b - m_Ab * de1 - m_Cb * ga1;
|
||||
al1 = de1;
|
||||
}
|
||||
@@ -3184,7 +3184,7 @@ private:
|
||||
de1 = m_Width1 * al + m_Width2 * m_Ha * al / ga;
|
||||
ga1 = m_Width1 * ga + m_Width2 * m_S2bc * (3 - al / ga);
|
||||
}
|
||||
|
||||
|
||||
be1 = m_S2b - m_Ab * de1 - m_Cb * ga1;
|
||||
al1 = de1;
|
||||
}
|
||||
|
||||
+57
-57
@@ -20,7 +20,7 @@ public:
|
||||
|
||||
PARVARCOPY(DCBubbleVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = helper.m_PrecalcSumSquares;
|
||||
T r4_1 = Zeps(r / 4 + 1);
|
||||
@@ -35,8 +35,8 @@ public:
|
||||
|
||||
outPoint.m_ColorX = fmod(fabs(m_Bdcs * (Sqr<T>(tempX + m_CenterX) + Sqr<T>(tempY + m_CenterY))), T(1.0));
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -64,8 +64,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Bdcs = 1 / (m_Scale == 0 ? T(10E-6) : m_Scale);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_CenterX, prefix + "dc_bubble_centerx"));//Params.
|
||||
m_Params.push_back(ParamWithName<T>(&m_CenterY, prefix + "dc_bubble_centery"));
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
|
||||
PARVARCOPY(DCCarpetVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int x0 = rand.RandBit() ? -1 : 1;
|
||||
int y0 = rand.RandBit() ? -1 : 1;
|
||||
@@ -111,14 +111,14 @@ public:
|
||||
T y = helper.In.y + y0;
|
||||
T x0_xor_y0 = T(x0 ^ y0);
|
||||
T h = -m_H + (1 - x0_xor_y0) * m_H;
|
||||
|
||||
helper.Out.x = m_Weight * (m_Xform->m_Affine.A() * x + m_Xform->m_Affine.B() * y + m_Xform->m_Affine.E());
|
||||
|
||||
helper.Out.x = m_Weight * (m_Xform->m_Affine.A() * x + m_Xform->m_Affine.B() * y + m_Xform->m_Affine.E());
|
||||
helper.Out.y = m_Weight * (m_Xform->m_Affine.C() * x + m_Xform->m_Affine.D() * y + m_Xform->m_Affine.F());
|
||||
helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z;
|
||||
outPoint.m_ColorX = fmod(fabs(outPoint.m_ColorX * T(0.5) * (1 + h) + x0_xor_y0 * (1 - h) * T(0.5)), T(1.0));
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -143,8 +143,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_H = T(0.1) * m_Origin;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Origin, prefix + "dc_carpet_origin"));//Params.
|
||||
m_Params.push_back(ParamWithName<T>(true, &m_H, prefix + "dc_carpet_h"));//Precalc.
|
||||
@@ -178,14 +178,14 @@ public:
|
||||
|
||||
PARVARCOPY(DCCubeVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x, y, z;
|
||||
T p = 2 * rand.Frand01<T>() - 1;
|
||||
T q = 2 * rand.Frand01<T>() - 1;
|
||||
unsigned int i = rand.Rand(3);
|
||||
unsigned int j = rand.RandBit();
|
||||
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
@@ -197,7 +197,7 @@ public:
|
||||
outPoint.m_ColorX = m_ClampC1;
|
||||
else
|
||||
outPoint.m_ColorX = m_ClampC2;
|
||||
|
||||
|
||||
break;
|
||||
case 1:
|
||||
x = m_Weight * p;
|
||||
@@ -208,18 +208,18 @@ public:
|
||||
outPoint.m_ColorX = m_ClampC3;
|
||||
else
|
||||
outPoint.m_ColorX = m_ClampC4;
|
||||
|
||||
|
||||
break;
|
||||
case 2:
|
||||
x = m_Weight * p;
|
||||
y = m_Weight * q;
|
||||
z = m_Weight * (j ? -1 : 1);
|
||||
|
||||
|
||||
if (j)
|
||||
outPoint.m_ColorX = m_ClampC5;
|
||||
else
|
||||
outPoint.m_ColorX = m_ClampC6;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -227,8 +227,8 @@ public:
|
||||
helper.Out.y = y * m_DcCubeY;
|
||||
helper.Out.z = z * m_DcCubeZ;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -301,8 +301,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_ClampC1 = Clamp<T>(m_DcCubeC1, 0, 1);
|
||||
m_ClampC2 = Clamp<T>(m_DcCubeC2, 0, 1);
|
||||
@@ -316,7 +316,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_DcCubeC1, prefix + "dc_cube_c1"));//Params.
|
||||
m_Params.push_back(ParamWithName<T>(&m_DcCubeC2, prefix + "dc_cube_c2"));
|
||||
@@ -369,7 +369,7 @@ public:
|
||||
|
||||
PARVARCOPY(DCCylinderVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T temp = rand.Frand01<T>() * M_2PI;
|
||||
T sr = sin(temp);
|
||||
@@ -385,8 +385,8 @@ public:
|
||||
|
||||
outPoint.m_ColorX = fmod(fabs(T(0.5) * (m_Ldcs * ((m_Cosa * tempX + m_Sina * tempY + m_Offset)) + 1)), T(1.0));
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -420,8 +420,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
sincos(m_Angle, &m_Sina, &m_Cosa);
|
||||
m_Ldcs = 1 / (m_Scale == 0.0 ? T(10E-6) : m_Scale);
|
||||
@@ -432,7 +432,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Offset, prefix + "dc_cylinder_offset"));//Params.
|
||||
m_Params.push_back(ParamWithName<T>(&m_Angle, prefix + "dc_cylinder_angle"));//Original used a prefix of dc_cyl_, which is incompatible with Ember's design.
|
||||
@@ -470,7 +470,7 @@ public:
|
||||
|
||||
VARCOPY(DCGridOutVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x = LRint(helper.In.x);
|
||||
T y = LRint(helper.In.y);
|
||||
@@ -547,7 +547,7 @@ public:
|
||||
outPoint.m_ColorX = fmod(c, T(1.0));
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss;
|
||||
int varIndex = IndexInXform();
|
||||
@@ -648,7 +648,7 @@ public:
|
||||
|
||||
PARVARCOPY(DCLinearVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
helper.Out.x = m_Weight * helper.In.x;
|
||||
helper.Out.y = m_Weight * helper.In.y;
|
||||
@@ -659,8 +659,8 @@ public:
|
||||
|
||||
outPoint.m_ColorX = fmod(fabs(T(0.5) * (m_Ldcs * ((m_Cosa * tempX + m_Sina * tempY + m_Offset)) + T(1.0))), T(1.0));
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -687,8 +687,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_Ldcs = 1 / (m_Scale == 0 ? T(10E-6) : m_Scale);
|
||||
m_Ldca = m_Offset * T(M_PI);
|
||||
@@ -699,7 +699,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_Offset, prefix + "dc_linear_offset"));//Params.
|
||||
m_Params.push_back(ParamWithName<T>(&m_Angle, prefix + "dc_linear_angle"));
|
||||
@@ -734,32 +734,32 @@ public:
|
||||
|
||||
PARVARCOPY(DCTriangleVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
// set up triangle
|
||||
const T
|
||||
const T
|
||||
xx = m_Xform->m_Affine.A(), xy = m_Xform->m_Affine.B(), // X
|
||||
yx = m_Xform->m_Affine.C() * -1, yy = m_Xform->m_Affine.D() * -1, // Y
|
||||
ox = m_Xform->m_Affine.E(), oy = m_Xform->m_Affine.F(), // O
|
||||
px = helper.In.x - ox, py = helper.In.y - oy; // P
|
||||
|
||||
|
||||
// calculate dot products
|
||||
const T dot00 = xx * xx + xy * xy; // X * X
|
||||
const T dot01 = xx * yx + xy * yy; // X * Y
|
||||
const T dot02 = xx * px + xy * py; // X * P
|
||||
const T dot11 = yx * yx + yy * yy; // Y * Y
|
||||
const T dot12 = yx * px + yy * py; // Y * P
|
||||
|
||||
|
||||
// calculate barycentric coordinates
|
||||
const T denom = (dot00 * dot11 - dot01 * dot01);
|
||||
const T num_u = (dot11 * dot02 - dot01 * dot12);
|
||||
const T num_v = (dot00 * dot12 - dot01 * dot02);
|
||||
|
||||
|
||||
// u, v must not be constant
|
||||
T u = num_u / denom;
|
||||
T v = num_v / denom;
|
||||
int inside = 0, f = 1;
|
||||
|
||||
|
||||
// case A - point escapes edge XY
|
||||
if (u + v > 1)
|
||||
{
|
||||
@@ -785,7 +785,7 @@ public:
|
||||
{
|
||||
inside = 1;// case C - point is in triangle
|
||||
}
|
||||
|
||||
|
||||
// handle outside points
|
||||
if (m_ZeroEdges && !inside)
|
||||
{
|
||||
@@ -820,8 +820,8 @@ public:
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
outPoint.m_ColorX = fmod(fabs(u + v), T(1.0));
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -911,8 +911,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_A = Clamp<T>(m_ScatterArea, -1, 1);
|
||||
}
|
||||
@@ -921,7 +921,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_ScatterArea, prefix + "dc_triangle_scatter_area", 0, REAL, -1, 1));//Params.
|
||||
m_Params.push_back(ParamWithName<T>(&m_ZeroEdges, prefix + "dc_triangle_zero_edges", 0, INTEGER, 0, 1));
|
||||
@@ -950,7 +950,7 @@ public:
|
||||
|
||||
PARVARCOPY(DCZTranslVariation)
|
||||
|
||||
void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T zf = m_Factor * (outPoint.m_ColorX - m_X0_) / m_X1_m_x0;
|
||||
|
||||
@@ -965,8 +965,8 @@ public:
|
||||
else
|
||||
helper.Out.z = m_Weight * zf;
|
||||
}
|
||||
|
||||
virtual string OpenCLString()
|
||||
|
||||
virtual string OpenCLString() override
|
||||
{
|
||||
ostringstream ss, ss2;
|
||||
int i = 0, varIndex = IndexInXform();
|
||||
@@ -998,8 +998,8 @@ public:
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual void Precalc()
|
||||
|
||||
virtual void Precalc() override
|
||||
{
|
||||
m_X0_ = m_X0 < m_X1 ? m_X0 : m_X1;
|
||||
m_X1_ = m_X0 > m_X1 ? m_X0 : m_X1;
|
||||
@@ -1010,7 +1010,7 @@ protected:
|
||||
void Init()
|
||||
{
|
||||
string prefix = Prefix();
|
||||
|
||||
|
||||
m_Params.clear();
|
||||
m_Params.push_back(ParamWithName<T>(&m_X0, prefix + "dc_ztransl_x0", 0, REAL, 0, 1));//Params.
|
||||
m_Params.push_back(ParamWithName<T>(&m_X1, prefix + "dc_ztransl_x1", 1, REAL, 0, 1));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "VariationList.h"
|
||||
#include "Interpolate.h"
|
||||
|
||||
/// <summary>
|
||||
/// Xform class.
|
||||
@@ -600,7 +601,7 @@ public:
|
||||
iterHelper.In.x = iterHelper.m_TransX;//Read must be done before every pre variation because transX/Y are changing.
|
||||
iterHelper.In.y = iterHelper.m_TransY;
|
||||
iterHelper.In.z = iterHelper.m_TransZ;
|
||||
m_PreVariations[i]->Precalc(iterHelper, inPoint);//Apply per-variation precalc, the second parameter is unused for pre variations.
|
||||
m_PreVariations[i]->PrecalcHelper(iterHelper, inPoint);//Apply per-variation precalc, the second parameter is unused for pre variations.
|
||||
m_PreVariations[i]->Func(iterHelper, *outPoint, rand);
|
||||
WritePre(iterHelper, m_PreVariations[i]->AssignType());
|
||||
}
|
||||
@@ -652,7 +653,7 @@ public:
|
||||
iterHelper.In.x = outPoint->m_X;//Read must be done before every post variation because the out point is changing.
|
||||
iterHelper.In.y = outPoint->m_Y;
|
||||
iterHelper.In.z = outPoint->m_Z;
|
||||
m_PostVariations[i]->Precalc(iterHelper, outPoint);//Apply per-variation precalc.
|
||||
m_PostVariations[i]->PrecalcHelper(iterHelper, outPoint);//Apply per-variation precalc.
|
||||
m_PostVariations[i]->Func(iterHelper, *outPoint, rand);
|
||||
WritePost(iterHelper, *outPoint, m_PostVariations[i]->AssignType());
|
||||
}
|
||||
|
||||
+22
-10
@@ -275,7 +275,7 @@ public:
|
||||
rootnode = xmlDocGetRootElement(doc);
|
||||
|
||||
//Scan for <flame> nodes, starting with this node.
|
||||
bn = basename(filename);
|
||||
bn = basename((char*)filename);
|
||||
ScanForEmberNodes(rootnode, bn, embers);
|
||||
xmlFreeDoc(doc);
|
||||
emberSize = (unsigned int)embers.size();
|
||||
@@ -358,7 +358,7 @@ public:
|
||||
/// <param name="str">The string to convert</param>
|
||||
/// <param name="val">The converted value</param>
|
||||
/// <returns>True if success, else false.</returns>
|
||||
bool Atof(char* str, T& val)
|
||||
bool Atof(const char* str, T& val)
|
||||
{
|
||||
bool b = true;
|
||||
char* endp;
|
||||
@@ -393,7 +393,7 @@ public:
|
||||
/// <param name="str">The string to convert</param>
|
||||
/// <param name="val">The converted unsigned integer value</param>
|
||||
/// <returns>True if success, else false.</returns>
|
||||
bool Atoi(char* str, unsigned int& val)
|
||||
bool Atoi(const char* str, unsigned int& val)
|
||||
{
|
||||
return Atoi(str, (int&)val);
|
||||
}
|
||||
@@ -405,7 +405,7 @@ public:
|
||||
/// <param name="str">The string to convert</param>
|
||||
/// <param name="val">The converted unsigned integer value</param>
|
||||
/// <returns>True if success, else false.</returns>
|
||||
bool Atoi(char* str, int& val)
|
||||
bool Atoi(const char* str, int& val)
|
||||
{
|
||||
bool b = true;
|
||||
char* endp;
|
||||
@@ -444,7 +444,11 @@ public:
|
||||
{
|
||||
char ch[16];
|
||||
|
||||
#ifdef WIN32
|
||||
_itoa_s(i, ch, 16, radix);
|
||||
#else
|
||||
sprintf(ch, "%d", i);
|
||||
#endif
|
||||
return string(ch);
|
||||
}
|
||||
|
||||
@@ -455,11 +459,15 @@ public:
|
||||
/// <param name="i">The unsigned 64-bit integer to convert</param>
|
||||
/// <param name="radix">The radix of the integer. Default: 10.</param>
|
||||
/// <returns>The converted string</returns>
|
||||
static string Itos64(unsigned __int64 i, int radix = 10)
|
||||
static string Itos64(uint64_t i, int radix = 10)
|
||||
{
|
||||
char ch[64];
|
||||
|
||||
#ifdef WIN32
|
||||
_ui64toa_s(i, ch, 64, radix);
|
||||
#else
|
||||
sprintf(ch, "%lu", i);
|
||||
#endif
|
||||
return string(ch);
|
||||
}
|
||||
|
||||
@@ -1393,8 +1401,12 @@ private:
|
||||
colorCount++;
|
||||
|
||||
} while (colorCount < numColors && colorCount < ember.m_Palette.m_Entries.size());
|
||||
|
||||
if (sscanf_s(&(colstr[colorIndex]),"%1s", tmps, sizeof(tmps)) > 0)
|
||||
|
||||
#ifdef WIN32
|
||||
if (sscanf_s(&(colstr[colorIndex]),"%1s", tmps, sizeof(tmps)) > 0)//Really need to migrate all of this parsing to C++.//TODO
|
||||
#else
|
||||
if (sscanf_s(&(colstr[colorIndex]),"%1s", tmps) > 0)
|
||||
#endif
|
||||
{
|
||||
m_ErrorReport.push_back(string(loc) + " : Extra data at end of hex color data " + string(&(colstr[colorIndex])));
|
||||
ok = false;
|
||||
@@ -1457,7 +1469,7 @@ private:
|
||||
/// <param name="val">The parsed value</param>
|
||||
/// <param name="b">Bitwise ANDed with true if name matched str and the call to Atof() succeeded, else false. Used for keeping a running value between successive calls.</param>
|
||||
/// <returns>True if the tag was matched, else false</returns>
|
||||
bool ParseAndAssignFloat(const xmlChar* name, char* attStr, char* str, T& val, bool& b)
|
||||
bool ParseAndAssignFloat(const xmlChar* name, const char* attStr, const char* str, T& val, bool& b)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
@@ -1479,7 +1491,7 @@ private:
|
||||
/// <param name="val">The parsed value</param>
|
||||
/// <param name="b">Bitwise ANDed with true if name matched str and the call to Atoi() succeeded, else false. Used for keeping a running value between successive calls.</param>
|
||||
/// <returns>True if the tag was matched, else false</returns>
|
||||
bool ParseAndAssignInt(const xmlChar* name, char* attStr, char* str, unsigned int& val, bool& b)
|
||||
bool ParseAndAssignInt(const xmlChar* name, const char* attStr, const char* str, unsigned int& val, bool& b)
|
||||
{
|
||||
return ParseAndAssignInt(name, attStr, str, (int&)val, b);
|
||||
}
|
||||
@@ -1493,7 +1505,7 @@ private:
|
||||
/// <param name="val">The parsed value</param>
|
||||
/// <param name="b">Bitwise ANDed with true if name matched str and the call to Atoi() succeeded, else false. Used for keeping a running value between successive calls.</param>
|
||||
/// <returns>True if the tag was matched, else false</returns>
|
||||
bool ParseAndAssignInt(const xmlChar* name, char* attStr, char* str, int& val, bool& b)
|
||||
bool ParseAndAssignInt(const xmlChar* name, const char* attStr, const char* str, int& val, bool& b)
|
||||
{
|
||||
bool ret = false;
|
||||
T fval = 0;
|
||||
|
||||
Reference in New Issue
Block a user