--User changes

-Add variations changes to the list of functionality that can be applied to all xforms using the Select tab.
 -Allow for graphical affine adjustments to apply to multiple selected xforms.
 -Slight optimization of the pie variation.
 -Undo state is only saved when the render completes and the mouse buttons are released. This helps avoid intermediate steps for quickly completing renders while dragging.
 -Add some keyboard shortcuts for toolbar and menu items.
 -Make info tab tree always expanded.

--Bug fixes
 -Make precalcs for all hypertile variations safer by using Zeps() for denominators.
 -Changing the current xform with more than one selected would set all xform's color index value that of the current one.
 -Use hard found palette path information for randoms as well.
 -OpenCL build and assignment errors for Z value in epispiral variation.
 -Unitialized local variables in hexaplay3D, crob, pRose3D.

--Code changes
 -Change static member variables from m_ to s_.
 -Get rid of excessive endl and replace with "\n".
 -Remove old IMAGEGL2D define from before Nvidia supported OpenCL 1.2.
 -Remove old CriticalSection code and use std::recursive_mutex.
 -Make Affine2D Rotate() and RotateTrans() take radians instead of angles.
 -More C++11 work.
 -General cleanup.
This commit is contained in:
mfeemster
2016-02-11 21:38:21 -08:00
parent a345e2d5e1
commit a800b08b67
69 changed files with 981 additions and 1094 deletions

View File

@ -208,16 +208,25 @@ void Affine2D<T>::Scale(T amount)
/// </summary>
/// <param name="angle">The angle to rotate by</param>
template <typename T>
void Affine2D<T>::Rotate(T angle)
void Affine2D<T>::Rotate(T rad)
{
m4T origMat4 = ToMat4ColMajor(true);//Must center and use column major for glm to work.
m4T newMat4 = glm::rotate(origMat4, angle * DEG_2_RAD_T, v3T(0, 0, 1));//Assuming only rotating around z.
m4T newMat4 = glm::rotate(origMat4, rad, v3T(0, 0, 1));//Assuming only rotating around z.
A(newMat4[0][0]);//Use direct assignments instead of constructor to skip assigning C and F.
B(newMat4[0][1]);
D(newMat4[1][0]);
E(newMat4[1][1]);
}
template <typename T>
void Affine2D<T>::RotateTrans(T rad)
{
m4T origMat4 = TransToMat4ColMajor();//Only put translation in this matrix.
m4T newMat4 = glm::rotate(origMat4, rad, v3T(0, 0, 1));//Assuming only rotating around z.
C(newMat4[0][3]);//Use direct assignments instead of constructor to skip assigning A, B, D, E.
F(newMat4[1][3]);
}
/// <summary>
/// Move by v.
/// </summary>
@ -341,6 +350,16 @@ typename m4T Affine2D<T>::ToMat4RowMajor(bool center) const
return mat;
}
template <typename T>
typename m4T Affine2D<T>::TransToMat4ColMajor() const
{
m4T mat(1, 0, 0, C(), //Col0...
0, 1, 0, F(), //1
0, 0, 1, 0, //2
0, 0, 0, 1);//3
return mat;
}
/// <summary>
/// Accessors.
/// </summary>
@ -366,6 +385,19 @@ template <typename T> void Affine2D<T>::X(const v2T& x) { A(x.x); D(x.y); }//X A
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.
template <typename T>
string Affine2D<T>::ToString() const
{
ostringstream ss;
ss << "A: " << A() << " "
<< "B: " << B() << " "
<< "C: " << C()
<< "\nD: " << D() << " "
<< "E: " << E() << " "
<< "F: " << F();
return ss.str();
}
/// <summary>
/// Rotate and scale this affine transform and return as a copy. Orginal is unchanged.
/// </summary>

View File

@ -77,7 +77,8 @@ public:
bool IsEmpty() const;
void Scale(T amount);
Affine2D<T> ScaleCopy(T amount);
void Rotate(T angle);
void Rotate(T rad);
void RotateTrans(T rad);
void Translate(const v2T& v);
void RotateScaleXTo(const v2T& v);
void RotateScaleYTo(const v2T& v);
@ -88,6 +89,7 @@ public:
m2T ToMat2RowMajor() const;
m4T ToMat4ColMajor(bool center = false) const;
m4T ToMat4RowMajor(bool center = false) const;
m4T TransToMat4ColMajor() const;
//Note that returning a copy is actually faster than a const ref&.
T A() const;
@ -112,6 +114,8 @@ public:
void Y(const v2T& y);
void O(const v2T& t);
string ToString() const;
static Affine2D CalcRotateScale(const v2T& from, const v2T& to);
static void CalcRSAC(const v2T& from, const v2T& to, T& a, T& c);

View File

@ -99,7 +99,6 @@ public:
m_PadCarLlY = T(carToRas.PadCarLlY());
m_PadCarUrX = T(carToRas.PadCarUrX());
m_PadCarUrY = T(carToRas.PadCarUrY());
return *this;
}
@ -117,29 +116,22 @@ public:
{
m_RasWidth = rasW;
m_RasHeight = rasH;
m_CarLlX = carLlX;
m_CarLlY = carLlY;
m_CarUrX = carUrX;
m_CarUrY = carUrY;
T carW = m_CarUrX - m_CarLlX;//Right minus left.
T carH = m_CarUrY - m_CarLlY;//Top minus bottom.
T invSizeW = T(1.0) / carW;
T invSizeH = T(1.0) / carH;
m_PixPerImageUnitW = static_cast<T>(rasW) * invSizeW;
m_RasLlX = m_PixPerImageUnitW * carLlX;
m_PixPerImageUnitH = static_cast<T>(rasH) * invSizeH;
m_RasLlY = m_PixPerImageUnitH * carLlY;
m_OneRow = abs(m_CarUrY - m_CarLlY) / m_RasHeight;
m_OneCol = abs(m_CarUrX - m_CarLlX) / m_RasWidth;
m_PadCarLlX = m_CarLlX + m_OneCol;
m_PadCarUrX = m_CarUrX - m_OneCol;
m_PadCarLlY = m_CarLlY + m_OneRow;
m_PadCarUrY = m_CarUrY - m_OneRow;
}
@ -209,9 +201,8 @@ public:
//if (point.m_Y > m_CarLlY && point.m_Y <= m_PadCarLlY && //Mapped to top row...
// point.m_X > m_CarLlX && point.m_X <= m_PadCarLlX)//...first col.
//{
// cout << "First pixel hit." << endl;
// cout << "First pixel hit.\n";
//}
return point.m_X >= m_CarLlX &&
point.m_X < m_CarUrX &&
point.m_Y < m_CarUrY &&

View File

@ -115,10 +115,8 @@ public:
T finalMinRad = m_MinRad * m_Supersample + 1;//Should scale the filter width by the oversample.
T finalMaxRad = m_MaxRad * m_Supersample + 1;//The '+1' comes from the assumed distance to the first pixel.
GaussianFilter<T> gaussianFilter(m_MaxRad, m_Supersample);
m_KernelSize = 0;
m_MaxFilterIndex = 0;
//Calculate how many filter kernels are needed based on the decay function
//
// num filters = (de_max_width / de_min_width)^(1 / estimator_curve)
@ -146,7 +144,6 @@ public:
rowSize = static_cast<int>(2 * ceil(finalMaxRad) - 1);
m_FilterWidth = (rowSize - 1) / 2;
m_KernelSize = (m_FilterWidth + 1) * (2 + m_FilterWidth) / 2;
m_Coefs.resize(maxIndex * m_KernelSize);
m_Widths.resize(maxIndex);
@ -261,7 +258,6 @@ public:
{
T finalMaxRad = m_MaxRad * m_Supersample + 1;
T finalMinRad = m_MinRad * m_Supersample + 1;
return std::pow(finalMaxRad / finalMinRad, T(1.0) / m_Curve) <= 1e7;
}
@ -273,30 +269,28 @@ public:
{
size_t i, j, coefIndex = 0, w = m_FilterWidth + 1;
stringstream ss;
ss
<< "Density Filter:" << endl
<< " Min radius: " << MinRad() << endl
<< " Max radius: " << MaxRad() << endl
<< " Curve: " << Curve() << endl
<< " Kernel size: " << KernelSize() << endl
<< " Max filter index: " << MaxFilterIndex() << endl
<< "Max Filtered counts: " << MaxFilteredCounts() << endl
<< " Filter width: " << FilterWidth() << endl;
ss << "Coefficients: " << endl;
<< "Density Filter:"
<< "\n Min radius: " << MinRad()
<< "\n Max radius: " << MaxRad()
<< "\n Curve: " << Curve()
<< "\n Kernel size: " << KernelSize()
<< "\n Max filter index: " << MaxFilterIndex()
<< "\nMax Filtered counts: " << MaxFilteredCounts()
<< "\n Filter width: " << FilterWidth();
ss << "\nCoefficients: \n";
for (i = 0; i < m_Widths.size(); i++)
{
for (coefIndex = 0; coefIndex < m_KernelSize; coefIndex++)
ss << "Kernel[" << i << "].Coefs[" << coefIndex << "]: " << m_Coefs[(i * m_KernelSize) + coefIndex] << endl;
ss << "Kernel[" << i << "].Coefs[" << coefIndex << "]: " << m_Coefs[(i * m_KernelSize) + coefIndex] << "\n";
}
ss << endl << "Widths: " << endl;
ss << "\nWidths: \n";
for (i = 0; i < m_Widths.size(); i++)
{
ss << "Widths[" << i << "]: " << m_Widths[i] << endl;
ss << "Widths[" << i << "]: " << m_Widths[i] << "\n";
}
for (i = 0; i < w; i++)
@ -306,7 +300,7 @@ public:
cout << std::setw(2) << std::setfill('0') << m_CoefIndices[i * w + j] << "\t";
}
cout << endl;
cout << "\n";
}
return ss.str();

View File

@ -5,7 +5,7 @@
namespace EmberNs
{
template<> unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>> QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand = unique_ptr<QTIsaac<ISAAC_SIZE, ISAAC_INT>>(new QTIsaac<ISAAC_SIZE, ISAAC_INT>());
template<> CriticalSection QTIsaac<ISAAC_SIZE, ISAAC_INT>::m_CS = CriticalSection();
template<> std::recursive_mutex QTIsaac<ISAAC_SIZE, ISAAC_INT>::s_CS = std::recursive_mutex();
}
#include "Curves.h"
@ -56,7 +56,7 @@ uint Timing::m_ProcessorCount;
#define EXPORT_SINGLE_TYPE_EMBER(T) \
template<> const char* PaletteList<T>::m_DefaultFilename = "flam3-palettes.xml"; \
template<> map<string, vector<Palette<T>>> PaletteList<T>::m_Palettes = map<string, vector<Palette<T>>>(); \
template<> map<string, vector<Palette<T>>> PaletteList<T>::s_Palettes = map<string, vector<Palette<T>>>(); \
template<> bool XmlToEmber<T>::m_Init = false; \
template<> vector<string> XmlToEmber<T>::m_FlattenNames = vector<string>(); \
template<> unordered_map<string, string> XmlToEmber<T>::m_BadParamNames = unordered_map<string, string>(); \

View File

@ -1034,7 +1034,7 @@ public:
if (m_Xforms[i].Empty() && m_AffineInterp != eAffineInterp::AFFINE_INTERP_LOG)
continue;
m_Xforms[i].m_Affine.Rotate(angle);
m_Xforms[i].m_Affine.Rotate(angle * DEG_2_RAD_T);
//Don't rotate post.
}
}

View File

@ -74,6 +74,7 @@ namespace EmberNs
#define EMPTYFIELD -9999
typedef std::chrono::high_resolution_clock Clock;
typedef uint et;
typedef std::lock_guard <std::recursive_mutex> rlg;
/// <summary>
/// Thin wrapper around getting the current time in milliseconds.

View File

@ -46,6 +46,7 @@
#include <map>
#include <math.h>
#include <memory>
#include <mutex>
#include <numeric>
#include <ostream>
#include <sstream>

View File

@ -116,18 +116,18 @@ public:
}
else
{
cout << "Error: Writing flame " << filename << " failed." << endl;
cout << "Error: Writing flame " << filename << " failed.\n";
b = false;
}
}
catch (const std::exception& e)
{
cout << "Error: Writing flame " << filename << " failed: " << e.what() << endl;
cout << "Error: Writing flame " << filename << " failed: " << e.what() << "\n";
b = false;
}
catch (...)
{
cout << "Error: Writing flame " << filename << " failed." << endl;
cout << "Error: Writing flame " << filename << " failed.\n";
b = false;
}
@ -275,7 +275,7 @@ public:
os << hex << setw(2) << setfill('0') << int(std::rint(ember.m_Palette[idx][2] * 255));
}
os << endl;
os << "\n";
}
os << " </palette>\n";
@ -472,7 +472,7 @@ public:
}
else
{
cout << "Failed to parse comment into Xml." << endl;
cout << "Failed to parse comment into Xml.\n";
}
}

View File

@ -639,7 +639,7 @@ public:
}
else
{
cout << loc << ": xform " << xfi << " is missing when it was expected, something is severely wrong." << endl;
cout << loc << ": xform " << xfi << " is missing when it was expected, something is severely wrong.\n";
}
}
@ -684,7 +684,7 @@ public:
}
else
{
cout << loc << ": xform " << xfi << " is missing when it was expected, something is severely wrong." << endl;
cout << loc << ": xform " << xfi << " is missing when it was expected, something is severely wrong.\n";
}
}
}

View File

@ -32,8 +32,8 @@
/// </summary>
#ifndef __ISAAC64
typedef uint ISAAC_INT;
const ISAAC_INT GOLDEN_RATIO = ISAAC_INT(0x9e3779b9);
typedef uint ISAAC_INT;
const ISAAC_INT GOLDEN_RATIO = ISAAC_INT(0x9e3779b9);
#else
typedef size_t ISAAC_INT;
const ISAAC_INT GOLDEN_RATIO = ISAAC_INT(0x9e3779b97f4a7c13);
@ -63,9 +63,9 @@ 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 unique_ptr<QTIsaac<ALPHA, ISAAC_INT> > GlobalRand;
static unique_ptr<QTIsaac<ALPHA, ISAAC_INT>> GlobalRand;
static CriticalSection m_CS;
static std::recursive_mutex s_CS;
/// <summary>
/// The structure which holds all of the random information.
@ -124,9 +124,8 @@ public:
/// <returns>The next random integer in the range of 0-255</returns>
static inline T LockedRandByte()
{
m_CS.Enter();
rlg l(s_CS);
T t = GlobalRand->RandByte();
m_CS.Leave();
return t;
}
@ -137,9 +136,9 @@ public:
inline T Rand()
{
#ifdef ISAAC_FLAM3_DEBUG
return (!m_Rc.randcnt-- ? (Isaac(&m_Rc), m_Rc.randcnt=N-1, m_Rc.randrsl[m_Rc.randcnt]) : m_Rc.randrsl[m_Rc.randcnt]);
return (!m_Rc.randcnt-- ? (Isaac(&m_Rc), m_Rc.randcnt = N - 1, m_Rc.randrsl[m_Rc.randcnt]) : m_Rc.randrsl[m_Rc.randcnt]);
#else
return (m_Rc.randcnt++ == N ? (Isaac(&m_Rc), m_Rc.randcnt=0, m_Rc.randrsl[m_Rc.randcnt]) : m_Rc.randrsl[m_Rc.randcnt]);
return (m_Rc.randcnt++ == N ? (Isaac(&m_Rc), m_Rc.randcnt = 0, m_Rc.randrsl[m_Rc.randcnt]) : m_Rc.randrsl[m_Rc.randcnt]);
#endif
}
@ -149,9 +148,8 @@ public:
/// <returns>The next random integer</returns>
static inline T LockedRand()
{
m_CS.Enter();
rlg l(s_CS);
T t = GlobalRand->Rand();
m_CS.Leave();
return t;
}
@ -172,9 +170,8 @@ public:
/// <returns>A value between 0 and the value passed in minus 1</returns>
static inline T LockedRand(T upper)
{
m_CS.Enter();
rlg l(s_CS);
T t = GlobalRand->Rand(upper);
m_CS.Leave();
return t;
}
@ -201,9 +198,8 @@ public:
template<typename floatType>
static inline floatType LockedFrand(floatType fMin, floatType fMax)
{
m_CS.Enter();
rlg l(s_CS);
floatType t = GlobalRand->template Frand<floatType>(fMin, fMax);
m_CS.Leave();
return t;
}
@ -229,9 +225,8 @@ public:
template<typename floatType>
static inline floatType LockedFrand01()
{
m_CS.Enter();
rlg l(s_CS);
floatType t = GlobalRand->template Frand01<floatType>();
m_CS.Leave();
return t;
}
@ -257,9 +252,8 @@ public:
template<typename floatType>
static inline floatType LockedFrand11()
{
m_CS.Enter();
rlg l(s_CS);
floatType t = GlobalRand->template Frand11<floatType>();
m_CS.Leave();
return t;
}
@ -280,9 +274,8 @@ public:
template<typename floatType>
static inline floatType LockedGoldenBit()
{
m_CS.Enter();
rlg l(s_CS);
floatType t = GlobalRand->template GoldenBit<floatType>();
m_CS.Leave();
return t;
}
@ -301,9 +294,8 @@ public:
/// <returns>A random 0 or 1</returns>
static inline uint LockedRandBit()
{
m_CS.Enter();
rlg l(s_CS);
uint t = GlobalRand->RandBit();
m_CS.Leave();
return t;
}
@ -329,7 +321,6 @@ public:
T a, b, c, d, e, f, g, h;
T* m = ctx->randmem;
T* r = ctx->randrsl;
a = b = c = d = e = f = g = h = GOLDEN_RATIO;
if (!useSeed)
@ -352,9 +343,7 @@ public:
{
a += r[i ]; b += r[i + 1]; c += r[i + 2]; d += r[i + 3];
e += r[i + 4]; f += r[i + 5]; g += r[i + 6]; h += r[i + 7];
Shuffle(a, b, c, d, e, f, g, h);
m[i ] = a; m[i + 1] = b; m[i + 2] = c; m[i + 3] = d;
m[i + 4] = e; m[i + 5] = f; m[i + 6] = g; m[i + 7] = h;
}
@ -364,9 +353,7 @@ public:
{
a += m[i ]; b += m[i + 1]; c += m[i + 2]; d += m[i + 3];
e += m[i + 4]; f += m[i + 5]; g += m[i + 6]; h += m[i + 7];
Shuffle(a, b, c, d, e, f, g, h);
m[i ] = a; m[i + 1] = b; m[i + 2] = c; m[i + 3] = d;
m[i + 4] = e; m[i + 5] = f; m[i + 6] = g; m[i + 7] = h;
}
@ -375,7 +362,6 @@ public:
{
//Fill in mm[] with messy stuff.
Shuffle(a, b, c, d, e, f, g, h);
m[i ] = a; m[i + 1] = b; m[i + 2] = c; m[i + 3] = d;
m[i + 4] = e; m[i + 5] = f; m[i + 6] = g; m[i + 7] = h;
}
@ -406,6 +392,7 @@ public:
}
#ifndef ISAAC_FLAM3_DEBUG
if (a == 0 && b == 0 && c == 0)
{
m_Rc.randa = static_cast<T>(NowMs());
@ -430,48 +417,45 @@ protected:
/// <param name="ctx">The context to populate.</param>
void Isaac(randctx* ctx)
{
T x,y;
T x, y;
T* mm = ctx->randmem;
T* r = ctx->randrsl;
T a = (ctx->randa);
T b = (ctx->randb + (++ctx->randc));
T* m = mm;
T* m2 = (m + (N / 2));
T* mend = m2;
for(; m < mend; )
for (; m < mend; )
{
#ifndef __ISAAC64
#ifndef __ISAAC64
RngStep((a << 13), a, b, mm, m, m2, r, x, y);
RngStep((a >> 6) , a, b, mm, m, m2, r, x, y);
RngStep((a << 2) , a, b, mm, m, m2, r, x, y);
RngStep((a >> 16), a, b, mm, m, m2, r, x, y);
#else // __ISAAC64
#else // __ISAAC64
RngStep(~(a ^ (a << 21)), a, b, mm, m, m2, r, x, y);
RngStep( a ^ (a >> 5) , a, b, mm, m, m2, r, x, y);
RngStep( a ^ (a << 12) , a, b, mm, m, m2, r, x, y);
RngStep( a ^ (a >> 33) , a, b, mm, m, m2, r, x, y);
#endif // __ISAAC64
#endif // __ISAAC64
}
m2 = mm;
for(; m2<mend;)
for (; m2 < mend;)
{
#ifndef __ISAAC64
#ifndef __ISAAC64
RngStep((a << 13), a, b, mm, m, m2, r, x, y);
RngStep((a >> 6) , a, b, mm, m, m2, r, x, y);
RngStep((a << 2) , a, b, mm, m, m2, r, x, y);
RngStep((a >> 16), a, b, mm, m, m2, r, x, y);
#else // __ISAAC64
#else // __ISAAC64
RngStep(~(a ^ (a << 21)), a, b, mm, m, m2, r, x, y);
RngStep( a ^ (a >> 5) , a, b, mm, m, m2, r, x, y);
RngStep( a ^ (a << 12) , a, b, mm, m, m2, r, x, y);
RngStep( a ^ (a >> 33) , a, b, mm, m, m2, r, x, y);
#endif // __ISAAC64
#endif // __ISAAC64
}
ctx->randb = b;

View File

@ -38,7 +38,7 @@ public:
bool Add(const string& filename, bool force = false)
{
bool added = true;
auto palettes = m_Palettes.insert(make_pair(filename, vector<Palette<T>>()));
auto palettes = s_Palettes.insert(make_pair(filename, vector<Palette<T>>()));
if (force || palettes.second)
{
@ -53,7 +53,6 @@ public:
{
auto rootNode = xmlDocGetRootElement(doc);
auto pfilename = shared_ptr<string>(new string(filename));
palettes.first->second.clear();
palettes.first->second.reserve(buf.size() / 2048);//Roughly what it takes per palette.
ParsePalettes(rootNode, pfilename, palettes.first->second);
@ -62,14 +61,14 @@ public:
else
{
added = false;
m_Palettes.erase(filename);
s_Palettes.erase(filename);
AddToReport(string(loc) + " : Couldn't load xml doc");
}
}
else
{
added = false;
m_Palettes.erase(filename);
s_Palettes.erase(filename);
AddToReport(string(loc) + " : Couldn't read palette file " + filename);
}
}
@ -82,11 +81,11 @@ public:
/// </summary>
Palette<T>* GetRandomPalette()
{
auto p = m_Palettes.begin();
auto p = s_Palettes.begin();
size_t i = 0, paletteFileIndex = QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Rand() % Size();
//Move p forward i elements.
while (i < paletteFileIndex && p != m_Palettes.end())
while (i < paletteFileIndex && p != s_Palettes.end())
{
++i;
++p;
@ -111,7 +110,7 @@ public:
/// <returns>A pointer to the requested palette if the index was in range, else nullptr.</returns>
Palette<T>* GetPalette(const string& filename, size_t i)
{
auto& palettes = m_Palettes[filename];
auto& palettes = s_Palettes[filename];
if (!palettes.empty() && i < palettes.size())
return &palettes[i];
@ -127,7 +126,7 @@ public:
/// <returns>A pointer to the palette if found, else nullptr</returns>
Palette<T>* GetPaletteByName(const string& filename, const string& name)
{
for (auto& palettes : m_Palettes)
for (auto& palettes : s_Palettes)
if (palettes.first == filename)
for (auto& palette : palettes.second)
if (palette.m_Name == name)
@ -163,7 +162,7 @@ public:
/// </summary>
void Clear()
{
m_Palettes.clear();
s_Palettes.clear();
}
/// <summary>
@ -171,7 +170,7 @@ public:
/// This will be the number of files read.
/// </summary>
/// <returns>The size of the palettes map</returns>
size_t Size() { return m_Palettes.size(); }
size_t Size() { return s_Palettes.size(); }
/// <summary>
/// Get the size of specified palette vector in the palettes map.
@ -181,9 +180,9 @@ public:
size_t Size(size_t index)
{
size_t i = 0;
auto p = m_Palettes.begin();
auto p = s_Palettes.begin();
while (i < index && p != m_Palettes.end())
while (i < index && p != s_Palettes.end())
{
++i;
++p;
@ -199,7 +198,7 @@ public:
/// <returns>The size of the palette vector at the specified index in the palettes map</returns>
size_t Size(const string& s)
{
return m_Palettes[s].size();
return s_Palettes[s].size();
}
/// <summary>
@ -210,9 +209,9 @@ public:
const string& Name(size_t index)
{
size_t i = 0;
auto p = m_Palettes.begin();
auto p = s_Palettes.begin();
while (i < index && p != m_Palettes.end())
while (i < index && p != s_Palettes.end())
{
++i;
++p;
@ -257,7 +256,7 @@ private:
do
{
int ret = sscanf_s(static_cast<char*>(&(val[colorIndex])),"00%2x%2x%2x", &r, &g, &b);
int ret = sscanf_s(static_cast<char*>(&(val[colorIndex])), "00%2x%2x%2x", &r, &g, &b);
if (ret != 3)
{
@ -274,9 +273,9 @@ private:
palette[colorCount].r = T(r) / T(255);//Store as normalized colors in the range of 0-1.
palette[colorCount].g = T(g) / T(255);
palette[colorCount].b = T(b) / T(255);
colorCount++;
} while (colorCount < COLORMAP_LENGTH);
}
while (colorCount < COLORMAP_LENGTH);
}
else if (!Compare(attr->name, "number"))
{
@ -306,6 +305,6 @@ private:
}
}
static map<string, vector<Palette<T>>> m_Palettes;//The map of filenames to vectors that store the palettes.
static map<string, vector<Palette<T>>> s_Palettes;//The map of filenames to vectors that store the palettes.
};
}

View File

@ -139,7 +139,7 @@ void Renderer<T, bucketT>::ComputeCamera()
T carUrX = m_UpperRightX + t0;
T carUrY = m_UpperRightY + t1 + shift;
m_RotMat.MakeID();
m_RotMat.Rotate(-Rotate());
m_RotMat.Rotate(-Rotate() * DEG_2_RAD_T);
m_CarToRas.Init(carLlX, carLlY, carUrX, carUrY, m_SuperRasW, m_SuperRasH, PixelAspectRatio());
}
@ -215,8 +215,6 @@ bool Renderer<T, bucketT>::CreateDEFilter(bool& newAlloc)
if (!m_DensityFilter.get()) { return false; }//Did object creation succeed?
if (!m_DensityFilter->Create()) { return false; }//Object creation succeeded, did filter creation succeed?
//cout << m_DensityFilter->ToString() << endl;
}
else if (!m_DensityFilter->Valid()) { return false; } //Previously created, are values ok?
}
@ -1299,7 +1297,7 @@ EmberStats Renderer<T, bucketT>::Iterate(size_t iterCount, size_t temporalSample
//iterationTime += t.Toc();
if (m_LockAccum)
m_AccumCs.Enter();
m_AccumCs.lock();
//t.Tic();
//Map temp buffer samples into the histogram using the palette for color.
@ -1307,7 +1305,7 @@ EmberStats Renderer<T, bucketT>::Iterate(size_t iterCount, size_t temporalSample
//accumulationTime += t.Toc();
if (m_LockAccum)
m_AccumCs.Leave();
m_AccumCs.unlock();
if (m_Callback && threadIndex == 0)
{

View File

@ -263,12 +263,12 @@ size_t RendererBase::MemoryAvailable()
}
else
{
cout << "Warning: unable to determine physical memory." << endl;
cout << "Warning: unable to determine physical memory.\n";
memAvailable = 4e9;
}
#else
cout << "Warning: unable to determine physical memory." << endl;
cout << "Warning: unable to determine physical memory.\n";
memAvailable = 4e9;
#endif
return memAvailable;
@ -610,14 +610,14 @@ void RendererBase::Reset()
m_ProcessAction = eProcessAction::FULL_RENDER;
}
void RendererBase::EnterRender() { m_RenderingCs.Enter(); }
void RendererBase::LeaveRender() { m_RenderingCs.Leave(); }
void RendererBase::EnterRender() { m_RenderingCs.lock(); }
void RendererBase::LeaveRender() { m_RenderingCs.unlock(); }
void RendererBase::EnterFinalAccum() { m_FinalAccumCs.Enter(); m_InFinalAccum = true; }
void RendererBase::LeaveFinalAccum() { m_FinalAccumCs.Leave(); m_InFinalAccum = false; }
void RendererBase::EnterFinalAccum() { m_FinalAccumCs.lock(); m_InFinalAccum = true; }
void RendererBase::LeaveFinalAccum() { m_FinalAccumCs.unlock(); m_InFinalAccum = false; }
void RendererBase::EnterResize() { m_ResizeCs.Enter(); }
void RendererBase::LeaveResize() { m_ResizeCs.Leave(); }
void RendererBase::EnterResize() { m_ResizeCs.lock(); }
void RendererBase::LeaveResize() { m_ResizeCs.unlock(); }
void RendererBase::Abort() { m_Abort = true; }
bool RendererBase::Aborted() { return m_Abort; }

View File

@ -228,7 +228,7 @@ protected:
vector<size_t> m_BadVals;
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> m_Rand;
auto_ptr<tbb::task_group> m_TaskGroup;
CriticalSection m_RenderingCs, m_AccumCs, m_FinalAccumCs, m_ResizeCs;
std::recursive_mutex m_RenderingCs, m_AccumCs, m_FinalAccumCs, m_ResizeCs;
Timing m_RenderTimer, m_IterTimer, m_ProgressTimer;
};
}

View File

@ -804,7 +804,7 @@ public:
if (best < 0)
{
cout << "Error in TryColors(), skipping ImproveColors()" << endl;
cout << "Error in TryColors(), skipping ImproveColors()\n";
return;
}
@ -815,7 +815,7 @@ public:
if (b < 0)
{
cout << "Error in TryColors, aborting tries." << endl;
cout << "Error in TryColors, aborting tries.\n";
break;
}
@ -861,7 +861,7 @@ public:
if (m_Renderer->Run(m_FinalImage) != eRenderStatus::RENDER_OK)
{
cout << "Error rendering test image for TryColors(). Aborting." << endl;
cout << "Error rendering test image for TryColors(). Aborting.\n";
return -1;
}
@ -902,7 +902,7 @@ public:
else
{
ember.m_Palette.Clear(false);
cout << "Error retrieving random palette, setting to all white" << endl;
cout << "Error retrieving random palette, setting to all white.\n";
}
}

View File

@ -159,18 +159,18 @@ public:
size_t i;
stringstream ss;
ss
<< "Spatial Filter:" << endl
<< " Support: " << m_Support << endl
<< " Filter radius: " << m_FilterRadius << endl
<< " Supersample: " << m_Supersample << endl
<< "Pixel aspect ratio: " << m_PixelAspectRatio << endl
<< "Final filter width: " << m_FinalFilterWidth << endl
<< "Filter buffer size: " << m_Filter.size() << endl;
ss << "Filter: " << endl;
<< "Spatial Filter:"
<< "\n Support: " << m_Support
<< "\n Filter radius: " << m_FilterRadius
<< "\n Supersample: " << m_Supersample
<< "\nPixel aspect ratio: " << m_PixelAspectRatio
<< "\nFinal filter width: " << m_FinalFilterWidth
<< "\nFilter buffer size: " << m_Filter.size();
ss << "\nFilter: \n";
for (i = 0; i < m_Filter.size(); i++)
{
ss << "Filter[" << i << "]: " << m_Filter[i] << endl;
ss << "Filter[" << i << "]: " << m_Filter[i] << "\n";
}
return ss.str();

View File

@ -115,22 +115,22 @@ public:
{
size_t i;
stringstream ss;
ss << "Temporal Filter:" << endl
<< " Size: " << Size() << endl
<< " Type: " << TemporalFilterCreator<T>::ToString(m_FilterType) << endl
<< " Sum Filt: " << SumFilt() << endl;
ss << "Deltas: " << endl;
ss << "Temporal Filter:\n"
<< "\n Size: " << Size()
<< "\n Type: " << TemporalFilterCreator<T>::ToString(m_FilterType)
<< "\n Sum Filt: " << SumFilt();
ss << "\nDeltas: \n";
for (i = 0; i < m_Deltas.size(); i++)
{
ss << "Deltas[" << i << "]: " << m_Deltas[i] << endl;
ss << "Deltas[" << i << "]: " << m_Deltas[i] << "\n";
}
ss << "Filter: " << endl;
ss << "Filter: \n";
for (i = 0; i < m_Filter.size(); i++)
{
ss << "Filter[" << i << "]: " << m_Filter[i] << endl;
ss << "Filter[" << i << "]: " << m_Filter[i] << "\n";
}
return ss.str();

View File

@ -52,7 +52,7 @@ public:
if (str)
{
cout << string(str) << (fullString ? "" : " processing time: ") << Format(ms) << endl;
cout << string(str) << (fullString ? "" : " processing time: ") << Format(ms) << "\n";
}
return ms;
@ -77,7 +77,6 @@ public:
double ElapsedTime() const
{
duration<double> elapsed = duration_cast<milliseconds, Clock::rep, Clock::period>(m_EndTime - m_BeginTime);
return elapsed.count() * 1000.0;
}
@ -92,7 +91,6 @@ public:
string Format(double ms) const
{
stringstream ss;
double x = ms / 1000;
double secs = fmod(x, 60);
x /= 60;
@ -146,78 +144,4 @@ private:
static bool m_TimingInit;//Whether the performance info has bee queried.
static uint m_ProcessorCount;//The number of cores on the system, set in Init().
};
/// <summary>
/// Cross platform critical section class which can be used for thread locking.
/// </summary>
class EMBER_API CriticalSection
{
public:
#ifdef _WIN32
/// <summary>
/// Constructor which initialized the underlying CRITICAL_SECTION object.
/// </summary>
CriticalSection() { InitializeCriticalSection(&m_CriticalSection); }
/// <summary>
/// Constructor which initialized the underlying CRITICAL_SECTION object
/// with the specified spin count value.
/// </summary>
/// <param name="spinCount">The spin count.</param>
CriticalSection(DWORD spinCount) { InitializeCriticalSectionAndSpinCount(&m_CriticalSection, spinCount); }
/// <summary>
/// Deletes the underlying CRITICAL_SECTION object.
/// </summary>
~CriticalSection() { DeleteCriticalSection(&m_CriticalSection); }
/// <summary>
/// Lock the critical section.
/// </summary>
void Enter() { EnterCriticalSection(&m_CriticalSection); }
/// <summary>
/// Unlock the critical section.
/// </summary>
void Leave() { LeaveCriticalSection(&m_CriticalSection); }
private:
CRITICAL_SECTION m_CriticalSection;//The Windows specific critical section object.
#else
/// <summary>
/// Constructor which initialized the underlying pthread_mutex_t object.
/// </summary>
CriticalSection()
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
pthread_mutex_init(&m_CriticalSection, &attr);
pthread_mutexattr_destroy(&attr);
}
/// <summary>
/// Deletes the underlying pthread_mutex_t object.
/// </summary>
~CriticalSection() { pthread_mutex_destroy(&m_CriticalSection); }
/// <summary>
/// Lock the critical section.
/// </summary>
void Enter() { pthread_mutex_lock(&m_CriticalSection); }
/// <summary>
/// Unlock the critical section.
/// </summary>
void Leave() { pthread_mutex_unlock(&m_CriticalSection); }
private:
pthread_mutex_t m_CriticalSection;//The *nix/pthread specific critical section object.
#endif
};
}

View File

@ -169,7 +169,7 @@ public:
{
stringstream ss;
for (auto& s : errorReport) ss << s << endl;
for (auto& s : errorReport) ss << s << "\n";
return ss.str();
}
@ -288,12 +288,12 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
}
catch (const std::exception& e)
{
cout << "Error: Reading file " << filename << " failed: " << e.what() << endl;
cout << "Error: Reading file " << filename << " failed: " << e.what() << "\n";
b = false;
}
catch (...)
{
cout << "Error: Reading file " << filename << " failed." << endl;
cout << "Error: Reading file " << filename << " failed.\n";
b = false;
}

View File

@ -288,7 +288,7 @@ public:
//released under CC share-alike license.
//Less accurate for faster rendering (still very precise).
T const CA = T(0.0003);//The accuracy is the square of CA.
T a, b, c, d, em[13], en[13];
T a, b, c, d = 1, em[13], en[13];
int bo;
int l;
int ii;

View File

@ -2023,9 +2023,9 @@ public:
virtual string ToString() const override
{
ostringstream ss;
ss << Variation<T>::ToString() << endl;
ss << Variation<T>::ToString() << "\n";
for (auto& param : m_Params) ss << param.ToString() << endl;
for (auto& param : m_Params) ss << param.ToString() << "\n";
return ss.str();
}

View File

@ -1971,7 +1971,7 @@ public:
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;
T a = m_Rotation + m_Pi2Slices * (sl + m_Thickness * rand.Frand01<T>());
T r = m_Weight * rand.Frand01<T>();
helper.Out.x = r * std::cos(a);
helper.Out.y = r * std::sin(a);
@ -1987,9 +1987,10 @@ public:
string slices = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string rotation = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string thickness = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string pi2Slices = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\tint sl = (int)(MwcNext01(mwc) * " << slices << " + (real_t)(0.5));\n"
<< "\t\treal_t a = " << rotation << " + M_2PI * (sl + MwcNext01(mwc) * " << thickness << ") / " << slices << ";\n"
<< "\t\treal_t a = " << rotation << " + " << pi2Slices << " * (sl + " << thickness << " * MwcNext01(mwc));\n"
<< "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * MwcNext01(mwc);\n"
<< "\n"
<< "\t\tvOut.x = r * cos(a);\n"
@ -1999,6 +2000,11 @@ public:
return ss.str();
}
virtual void Precalc() override
{
m_Pi2Slices = M_2PI / m_Slices;
}
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
m_Params[0].Set(10 * rand.Frand01<T>());//Slices.
@ -2014,12 +2020,14 @@ protected:
m_Params.push_back(ParamWithName<T>(&m_Slices, prefix + "pie_slices", 6, eParamType::INTEGER_NONZERO, 1));
m_Params.push_back(ParamWithName<T>(&m_Rotation, prefix + "pie_rotation", T(0.5), eParamType::REAL_CYCLIC, 0, M_2PI));
m_Params.push_back(ParamWithName<T>(&m_Thickness, prefix + "pie_thickness", T(0.5), eParamType::REAL, 0, 1));
m_Params.push_back(ParamWithName<T>(true, &m_Pi2Slices, prefix + "pie_pi2_slices"));
}
private:
T m_Slices;
T m_Rotation;
T m_Thickness;
T m_Pi2Slices;//Precalc
};
/// <summary>

View File

@ -88,15 +88,13 @@ public:
<< "\t\t{\n"
<< "\t\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * t * cos(theta);\n"
<< "\t\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * t * sin(theta);\n"
<< "\t\t\tvOut.z = 0;\n"
<< "\t\t}\n"
<< "\t\telse\n"
<< "\t\t{\n"
<< "\t\t\tvOut.x = 0;\n"
<< "\t\t\tvOut.y = 0;\n"
<< "\t\t\tvOut.z = 0;\n"
<< "\t\t}\n"
<< "\t\tvOut.Z = " << DefaultZCl()
<< "\t\tvOut.z = " << DefaultZCl()
<< "\t}\n";
return ss.str();
}
@ -2726,8 +2724,8 @@ public:
virtual void Precalc() override
{
T pa = 2 * T(M_PI) / m_P;
T qa = 2 * T(M_PI) / m_Q;
T pa = 2 * T(M_PI) / Zeps(m_P);
T qa = 2 * T(M_PI) / Zeps(m_Q);
T r = (1 - std::cos(pa)) / (std::cos(pa) + std::cos(qa)) + 1;
T a = m_N * pa;
@ -2822,15 +2820,15 @@ public:
virtual void Precalc() override
{
T r2 = 1 - (std::cos(2 * T(M_PI) / m_P) - 1) /
(std::cos(2 * T(M_PI) / m_P) + std::cos(2 * T(M_PI) / m_Q));
T r2 = 1 - (std::cos(2 * T(M_PI) / Zeps(m_P)) - 1) /
(std::cos(2 * T(M_PI) / Zeps(m_P)) + std::cos(2 * T(M_PI) / Zeps(m_Q)));
if (r2 > 0)
m_R = 1 / std::sqrt(r2);
else
m_R = 1;
m_Pa = 2 * T(M_PI) / m_P;
m_Pa = 2 * T(M_PI) / Zeps(m_P);
}
protected:
@ -2841,7 +2839,7 @@ protected:
m_Params.push_back(ParamWithName<T>(&m_P, prefix + "hypertile1_p", 3, eParamType::INTEGER, 3, T(0x7fffffff)));
m_Params.push_back(ParamWithName<T>(&m_Q, prefix + "hypertile1_q", 7, eParamType::INTEGER, 3, T(0x7fffffff)));
m_Params.push_back(ParamWithName<T>(true, &m_Pa, prefix + "hypertile1_pa"));//Precalc.
m_Params.push_back(ParamWithName<T>(true, &m_R, prefix + "hypertile1_r"));
m_Params.push_back(ParamWithName<T>(true, &m_R, prefix + "hypertile1_r"));
}
private:
@ -2913,15 +2911,15 @@ public:
virtual void Precalc() override
{
T r2 = 1 - (std::cos(2 * T(M_PI) / m_P) - 1) /
(std::cos(2 * T(M_PI) / m_P) + std::cos(2 * T(M_PI) / m_Q));
T r2 = 1 - (std::cos(2 * T(M_PI) / Zeps(m_P)) - 1) /
(std::cos(2 * T(M_PI) / Zeps(m_P)) + std::cos(2 * T(M_PI) / Zeps(m_Q)));
if (r2 > 0)
m_R = 1 / std::sqrt(r2);
else
m_R = 1;
m_Pa = 2 * T(M_PI) / m_P;
m_Pa = 2 * T(M_PI) / Zeps(m_P);
}
protected:
@ -3001,13 +2999,13 @@ public:
virtual void Precalc() override
{
T pa = 2 * T(M_PI) / m_P;
T qa = 2 * T(M_PI) / m_Q;
T r = -(std::cos(pa) - 1) / (std::cos(pa) + std::cos(qa));
T pa = 2 * T(M_PI) / Zeps(m_P);
T qa = 2 * T(M_PI) / Zeps(m_Q);
T r = -(std::cos(pa) - 1) / Zeps(std::cos(pa) + std::cos(qa));
T na = m_N * pa;
if (r > 0)
r = 1 / std::sqrt(1 + r);
r = 1 / Zeps(std::sqrt(1 + r));
else
r = 1;
@ -3119,12 +3117,12 @@ public:
virtual void Precalc() override
{
T pa = M_2PI / m_P;
T qa = M_2PI / m_Q;
T r = -(std::cos(pa) - 1) / (std::cos(pa) + std::cos(qa));
T pa = M_2PI / Zeps(m_P);
T qa = M_2PI / Zeps(m_Q);
T r = -(std::cos(pa) - 1) / Zeps(std::cos(pa) + std::cos(qa));
if (r > 0)
r = 1 / std::sqrt(1 + r);
r = 1 / Zeps(std::sqrt(1 + r));
else
r = 1;
@ -3219,12 +3217,12 @@ public:
virtual void Precalc() override
{
T pa = M_2PI / m_P;
T qa = M_2PI / m_Q;
T r = -(std::cos(pa) - 1) / (std::cos(pa) + std::cos(qa));
T pa = M_2PI / Zeps(m_P);
T qa = M_2PI / Zeps(m_Q);
T r = -(std::cos(pa) - 1) / Zeps(std::cos(pa) + std::cos(qa));
if (r > 0)
r = 1 / std::sqrt(1 + r);
r = 1 / Zeps(std::sqrt(1 + r));
else
r = 1;

View File

@ -3466,7 +3466,7 @@ public:
int loc;
T tempx, tempy;
T lrmaj = m_Weight;//Sets hexagon length radius - major plane.
T boost;//Boost is the separation distance between the two planes.
T boost = 1;//Boost is the separation distance between the two planes.
T sumX, sumY;
if (m_VarType == eVariationType::VARTYPE_REG)
@ -3561,7 +3561,7 @@ public:
<< "\t\tint loc;\n"
<< "\t\treal_t tempx, tempy;\n"
<< "\t\treal_t lrmaj = xform->m_VariationWeights[" << varIndex << "];\n"
<< "\t\treal_t boost;\n"
<< "\t\treal_t boost = 1;\n"
<< "\t\treal_t sumX, sumY;\n\n";
if (m_VarType == eVariationType::VARTYPE_REG)

View File

@ -1495,7 +1495,7 @@ public:
/// <param name="rand">The rand.</param>
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T gradTmp, secTmp, xTmp, yTmp;
T gradTmp, secTmp, xTmp = 0, yTmp = 0;
if ((helper.In.x < m_LeftBorder) || (helper.In.x > m_RightBorder) || (helper.In.y < m_TopBorder) || (helper.In.y > m_BottomBorder))
{
@ -1591,7 +1591,7 @@ public:
string leftBorder = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string rightBorder = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t gradTmp, secTmp, xTmp, yTmp;\n"
<< "\t\treal_t gradTmp, secTmp, xTmp = 0, yTmp = 0;\n"
<< "\n"
<< "\t\tif ((vIn.x < " << leftBorder << ") || (vIn.x > " << rightBorder << ") || (vIn.y < " << topBorder << ") || (vIn.y > " << bottomBorder << "))\n"
<< "\t\t{\n"
@ -3626,8 +3626,6 @@ private:
case LERP_BEZIER:
return BezierQuadMap(x, m);
}
return x * m;
}
inline void SynthSinCos(SynthStruct& synth, T theta, T& s, T& c, int sineType)

View File

@ -573,7 +573,7 @@ public:
{
int posNeg = 1;
T th = 0;
T sth, cth, pang, wig, wag, wag2, wag3, wag12, waggle;
T sth, cth, pang, wig, wag, wag2, wag3, wag12 = 0, waggle = 0;
T rad = helper.m_PrecalcSqrtSumSquares;
T curve1 = rad / m_L;
T curve2 = Sqr(curve1);

View File

@ -1113,7 +1113,7 @@ public:
<< "C: " << m_Affine.C() << " "
<< "D: " << m_Affine.D() << " "
<< "E: " << m_Affine.E() << " "
<< "F: " << m_Affine.F() << " " << endl;
<< "F: " << m_Affine.F() << " \n";
if (m_HasPost)
{
@ -1122,27 +1122,27 @@ public:
<< "Post C: " << m_Post.C() << " "
<< "Post D: " << m_Post.D() << " "
<< "Post E: " << m_Post.E() << " "
<< "Post F: " << m_Post.F() << " " << endl;
<< "Post F: " << m_Post.F() << " \n";
}
ss << "Weight: " << m_Weight << endl;
ss << "ColorX: " << m_ColorX << endl;
ss << "ColorY: " << m_ColorY << endl;
ss << "Direct Color: " << m_DirectColor << endl;
ss << "Color Speed: " << m_ColorSpeed << endl;
ss << "Animate: " << m_Animate << endl;
ss << "Opacity: " << m_Opacity << endl;
ss << "Viz Adjusted: " << m_VizAdjusted << endl;
ss << "Wind: " << m_Wind[0] << ", " << m_Wind[1] << endl;
ss << "Motion Frequency: " << m_MotionFreq << endl;
ss << "Motion Func: " << m_MotionFunc << endl;
ss << "Motion Offset: " << m_MotionOffset << endl;
ss << "Weight: " << m_Weight;
ss << "\nColorX: " << m_ColorX;
ss << "\nColorY: " << m_ColorY;
ss << "\nDirect Color: " << m_DirectColor;
ss << "\nColor Speed: " << m_ColorSpeed;
ss << "\nAnimate: " << m_Animate;
ss << "\nOpacity: " << m_Opacity;
ss << "\nViz Adjusted: " << m_VizAdjusted;
ss << "\nWind: " << m_Wind[0] << ", " << m_Wind[1];
ss << "\nMotion Frequency: " << m_MotionFreq;
ss << "\nMotion Func: " << m_MotionFunc;
ss << "\nMotion Offset: " << m_MotionOffset;
const_cast<Xform<T>*>(this)->AllVarsFunc([&] (vector<Variation<T>*>& variations, bool & keepGoing)
{
for (auto var : variations)
ss << var->ToString() << endl;
ss << var->ToString() << "\n";
ss << endl;
ss << "\n";
});
if (XaosPresent())
@ -1150,7 +1150,7 @@ public:
for (auto xaos : m_Xaos)
ss << xaos << " ";
ss << endl;
ss << "\n";
}
return ss.str();

View File

@ -35,10 +35,10 @@ public:
m_OriginalLocale = setlocale(category, nullptr);//Query.
if (m_OriginalLocale.empty())
cout << "Couldn't get original locale." << endl;
cout << "Couldn't get original locale.\n";
if (setlocale(category, loc) == nullptr)//Set.
cout << "Couldn't set new locale " << category << ", " << loc << "." << endl;
cout << "Couldn't set new locale " << category << ", " << loc << ".\n";
}
/// <summary>
@ -48,7 +48,7 @@ public:
{
if (!m_OriginalLocale.empty())
if (setlocale(m_Category, m_OriginalLocale.c_str()) == nullptr)//Restore.
cout << "Couldn't restore original locale " << m_Category << ", " << m_OriginalLocale << "." << endl;
cout << "Couldn't restore original locale " << m_Category << ", " << m_OriginalLocale << ".\n";
}
private:
@ -327,13 +327,13 @@ public:
{
if (embers[0].m_Interp == eInterp::EMBER_INTERP_SMOOTH)
{
cout << "Warning: smooth interpolation cannot be used for first segment.\n switching to linear.\n" << endl;
cout << "Warning: smooth interpolation cannot be used for first segment.\n switching to linear.\n";
embers[0].m_Interp = eInterp::EMBER_INTERP_LINEAR;
}
if (emberSize >= 2 && embers[emberSize - 2].m_Interp == eInterp::EMBER_INTERP_SMOOTH)
{
cout << "Warning: smooth interpolation cannot be used for last segment.\n switching to linear.\n" << endl;
cout << "Warning: smooth interpolation cannot be used for last segment.\n switching to linear.\n";
embers[emberSize - 2].m_Interp = eInterp::EMBER_INTERP_LINEAR;
}
}
@ -526,7 +526,7 @@ private:
char* attStr;
const char* loc = __FUNCTION__;
int soloXform = -1;
size_t i, count, index = 0;
size_t i, count = 0, index = 0;
double vals[16];
xmlAttrPtr att, curAtt;
xmlNodePtr editNode, childNode, motionNode;