diff --git a/Builds/CB/Ember.cbp b/Builds/CB/Ember.cbp
index 3122619..646ee7f 100644
--- a/Builds/CB/Ember.cbp
+++ b/Builds/CB/Ember.cbp
@@ -16,10 +16,10 @@
-
-
-
+
+
+
@@ -27,16 +27,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -45,15 +35,13 @@
-
+
+
-
-
-
-
-
-
+
+
+
@@ -62,15 +50,13 @@
-
+
+
-
-
-
-
-
-
+
+
+
@@ -78,16 +64,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -95,23 +71,30 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Builds/CB/Ember.layout b/Builds/CB/Ember.layout
index b6c6b33..ae9f246 100644
--- a/Builds/CB/Ember.layout
+++ b/Builds/CB/Ember.layout
@@ -1,64 +1,169 @@
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Builds/CB/EmberAnimate.layout b/Builds/CB/EmberAnimate.layout
index ee1a61a..defe901 100644
--- a/Builds/CB/EmberAnimate.layout
+++ b/Builds/CB/EmberAnimate.layout
@@ -1,4 +1,14 @@
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Builds/CB/EmberCL.layout b/Builds/CB/EmberCL.layout
index ee1a61a..b1439f4 100644
--- a/Builds/CB/EmberCL.layout
+++ b/Builds/CB/EmberCL.layout
@@ -1,4 +1,4 @@
-
+
diff --git a/Builds/CB/EmberGenome.layout b/Builds/CB/EmberGenome.layout
index ee1a61a..92cf068 100644
--- a/Builds/CB/EmberGenome.layout
+++ b/Builds/CB/EmberGenome.layout
@@ -1,4 +1,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Builds/CB/EmberRender.cbp b/Builds/CB/EmberRender.cbp
index 9c96d6d..690ad18 100644
--- a/Builds/CB/EmberRender.cbp
+++ b/Builds/CB/EmberRender.cbp
@@ -161,18 +161,18 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/Builds/CB/EmberRender.layout b/Builds/CB/EmberRender.layout
index ee1a61a..131d06f 100644
--- a/Builds/CB/EmberRender.layout
+++ b/Builds/CB/EmberRender.layout
@@ -1,4 +1,14 @@
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Source/Ember/CarToRas.h b/Source/Ember/CarToRas.h
index 3d0e649..8590b78 100644
--- a/Source/Ember/CarToRas.h
+++ b/Source/Ember/CarToRas.h
@@ -134,8 +134,8 @@ public:
m_PixPerImageUnitH = (T)rasH * invSizeH;
m_RasLlY = m_PixPerImageUnitH * carLlY;
- T m_OneRow = abs(m_CarUrY - m_CarLlY) / m_RasHeight;
- T m_OneCol = abs(m_CarUrX - m_CarLlX) / m_RasWidth;
+ 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;
@@ -249,4 +249,4 @@ private:
T m_CarLlX, m_CarLlY, m_CarUrX, m_CarUrY;//The bounds of the cartesian plane.
T m_PadCarLlX, m_PadCarLlY, m_PadCarUrX, m_PadCarUrY;//The bounds of the cartesian plane padded by one raster row and column on each side.
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/Ember.h b/Source/Ember/Ember.h
index 18019c4..22aec38 100644
--- a/Source/Ember/Ember.h
+++ b/Source/Ember/Ember.h
@@ -43,9 +43,9 @@ public:
{
Init();
}
-
+
Ember(const Ember& ember)
- : m_Edits(NULL)
+ : m_Edits(nullptr)
{
Ember::operator=(ember);
}
@@ -56,7 +56,7 @@ public:
/// The Ember object to copy
template
Ember(const Ember& ember)
- : m_Edits(NULL)
+ : m_Edits(nullptr)
{
Ember::operator=(ember);
}
@@ -106,7 +106,7 @@ public:
m_CamDepthBlur = T(ember.m_CamDepthBlur);
m_CamMat = ember.m_CamMat;
m_CenterX = T(ember.m_CenterX);
- m_CenterY = T(ember.m_CenterY);
+ m_CenterY = T(ember.m_CenterY);
m_Rotate = T(ember.m_Rotate);
m_Hue = T(ember.m_Hue);
m_Brightness = T(ember.m_Brightness);
@@ -165,8 +165,8 @@ public:
SetProjFunc();
ClearEdit();
-
- if (ember.m_Edits != NULL)
+
+ if (ember.m_Edits != nullptr)
m_Edits = xmlCopyDoc(ember.m_Edits, 1);
return *this;
@@ -235,9 +235,9 @@ public:
m_Index = 0;
m_Xforms.reserve(12);
- m_Edits = NULL;
+ m_Edits = nullptr;
}
-
+
///
/// Add a copy of a new xform to the xforms vector.
///
@@ -284,7 +284,7 @@ public:
Ember ember(*this);
ember.PadXforms(xformPad);
-
+
if (doFinal)
{
if (UseFinalXform())//Caller wanted one and this ember has one.
@@ -301,7 +301,7 @@ public:
ember.m_FinalXform.AddVariation(new LinearVariation(0));//Do this so it doesn't appear empty.
}
}
-
+
return ember;
}
@@ -322,7 +322,7 @@ public:
//Now shuffle xaos values from i on back by 1 for every xform.
for (unsigned int x1 = 0; x1 < XformCount(); x1++)
{
- if (xform = GetXform(x1))
+ if ((xform = GetXform(x1)))
{
for (unsigned int x2 = i + 1; x2 <= XformCount(); x2++)//Iterate from the position after the deletion index up to the old count.
xform->SetXaos(x2 - 1, xform->Xaos(x2));
@@ -330,7 +330,7 @@ public:
xform->TruncateXaos();//Make sure no old values are hanging around in case more xforms are added to this ember later.
}
}
-
+
return true;
}
@@ -358,13 +358,13 @@ public:
/// Get a pointer to the xform at the specified index, excluding the final one.
///
/// The index to get
- /// A pointer to the xform at the index if successful, else NULL.
+ /// A pointer to the xform at the index if successful, else nullptr.
Xform* GetXform(unsigned int i) const
{
if (i < XformCount())
return (Xform*)&m_Xforms[i];
else
- return NULL;
+ return nullptr;
}
///
@@ -372,7 +372,7 @@ public:
///
/// The index to get
/// If true, return the final xform when its index is requested even if one is not present
- /// A pointer to the xform at the index if successful, else NULL.
+ /// A pointer to the xform at the index if successful, else nullptr.
Xform* GetTotalXform(unsigned int i, bool forceFinal = false) const
{
if (i < XformCount())
@@ -380,7 +380,7 @@ public:
else if (i == XformCount() || forceFinal)
return (Xform*)&m_FinalXform;
else
- return NULL;
+ return nullptr;
}
///
@@ -407,7 +407,7 @@ public:
int GetTotalXformIndex(Xform* xform) const
{
unsigned int totalXformCount = TotalXformCount();
-
+
for (unsigned int i = 0; i < totalXformCount; i++)
if (GetTotalXform(i) == xform)
return (int)i;
@@ -461,7 +461,7 @@ public:
for (unsigned int i = 0; i < TotalXformCount(); i++)
{
Xform* xform = GetTotalXform(i);
-
+
xform->CacheColorVals();
xform->SetPrecalcFlags();
}
@@ -677,29 +677,29 @@ public:
bool allID, final;
unsigned int i, j, k, l, maxXformCount, totalXformCount;
T bgAlphaSave = m_Background.a;
- T coefSave[2];
+ T coefSave[2] {0, 0};
vector*> xformVec;
- //Palette and others
+ //Palette and others
if (embers[0].m_PaletteInterp == INTERP_HSV)
{
for (i = 0; i < 256; i++)
{
T t[3], s[4] = { 0, 0, 0, 0 };
-
+
for (k = 0; k < size; k++)
{
Palette::RgbToHsv(glm::value_ptr(embers[k].m_Palette[i]), t);
for (j = 0; j < 3; j++)
s[j] += coefs[k] * t[j];
-
+
s[3] += coefs[k] * embers[k].m_Palette[i][3];
}
-
+
Palette::HsvToRgb(s, glm::value_ptr(m_Palette[i]));
m_Palette[i][3] = s[3];
-
+
for (j = 0; j < 4; j++)
Clamp(m_Palette[i][j], 0, 1);
}
@@ -803,7 +803,7 @@ public:
var->m_Weight = 0;
- if (parVar != NULL)
+ if (parVar != nullptr)
parVar->Clear();
for (k = 0; k < size; k++)//For each ember in the list.
@@ -814,17 +814,17 @@ public:
{
Variation* tempVar = tempXform->GetVariationById(var->VariationId());//See if the variation at this xform index exists in that ember at this xform index.
- if (tempVar != NULL)
+ if (tempVar != nullptr)
{
//Interp weight.
var->m_Weight += tempVar->m_Weight * coefs[k];
//If it was a parametric variation, interp params.
- if (parVar != NULL)
+ if (parVar != nullptr)
{
ParametricVariation* tempParVar = dynamic_cast*>(tempVar);
- if (tempParVar != NULL && (parVar->ParamCount() == tempParVar->ParamCount()))//This check will should always be true, but just check to be absolutely sure to avoid clobbering memory.
+ if (tempParVar != nullptr && (parVar->ParamCount() == tempParVar->ParamCount()))//This check will should always be true, but just check to be absolutely sure to avoid clobbering memory.
{
ParamWithName* params = parVar->Params();
ParamWithName* tempParams = tempParVar->Params();
@@ -846,7 +846,7 @@ public:
InterpXform<&Xform::m_ColorSpeed>(thisXform, i, embers, coefs, size);
InterpXform<&Xform::m_Opacity> (thisXform, i, embers, coefs, size);
InterpXform<&Xform::m_Animate> (thisXform, i, embers, coefs, size);
-
+
ClampGte0Ref(thisXform->m_Weight);
ClampRef(thisXform->m_ColorX, 0, 1);
ClampRef(thisXform->m_ColorSpeed, -1, 1);
@@ -857,9 +857,9 @@ public:
vector cxMag(size);
vector cxAng(size);
vector cxTrn(size);
-
+
thisXform->m_Affine.m_Mat = m23T(0);
-
+
//Affine part.
Interpolater::ConvertLinearToPolar(embers, size, i, 0, cxAng, cxMag, cxTrn);
Interpolater::InterpAndConvertBack(coefs, cxAng, cxMag, cxTrn, thisXform->m_Affine);
@@ -887,7 +887,7 @@ public:
{
Interpolater::ConvertLinearToPolar(embers, size, i, 1, cxAng, cxMag, cxTrn);
Interpolater::InterpAndConvertBack(coefs, cxAng, cxMag, cxTrn, thisXform->m_Post);
- }
+ }
}
else if (m_AffineInterp == INTERP_LINEAR)
{
@@ -999,7 +999,7 @@ public:
//Don't rotate xforms with animate set to 0.
if (m_Xforms[i].m_Animate == 0)
continue;
-
+
//Assume that if there are no variations, then it's a padding xform.
if (m_Xforms[i].Empty() && m_AffineInterp != INTERP_LOG)
continue;
@@ -1066,7 +1066,7 @@ public:
m_Xforms[i].m_Affine.E(1);
m_Xforms[i].m_Affine.F(0);
m_Xforms[i].AddVariation(new LinearVariation());
-
+
result++;
sym = -sym;
}
@@ -1201,9 +1201,9 @@ public:
T z = point.m_Z - m_CamZPos;
T x = m_CamMat[0][0] * point.m_X + m_CamMat[1][0] * point.m_Y;
T y = m_CamMat[0][1] * point.m_X + m_CamMat[1][1] * point.m_Y + m_CamMat[2][1] * z;
-
+
z = m_CamMat[0][2] * point.m_X + m_CamMat[1][2] * point.m_Y + m_CamMat[2][2] * z;
-
+
T zr = Zeps(1 - m_CamPerspective * z);
T dr = rand.Frand01() * m_BlurCoef * z;
@@ -1294,7 +1294,7 @@ public:
m_Supersample = 0;
m_SpatialFilterRadius = -1;
m_Zoom = 999999;
- m_ProjFunc = NULL;
+ m_ProjFunc = nullptr;
m_CamZPos = 999999;
m_CamPerspective = 999999;
m_CamYaw = 999999;
@@ -1316,21 +1316,21 @@ public:
m_TemporalFilterExp = -999;
m_PaletteMode = PALETTE_STEP;
}
-
+
m_Xforms.clear();
m_FinalXform.Clear();
ClearEdit();
}
///
- /// Thin wrapper to clear edit doc if not NULL and set to NULL.
+ /// Thin wrapper to clear edit doc if not nullptr and set to nullptr.
///
void ClearEdit()
{
- if (m_Edits != NULL)
+ if (m_Edits != nullptr)
xmlFreeDoc(m_Edits);
- m_Edits = NULL;
+ m_Edits = nullptr;
}
///
@@ -1384,7 +1384,7 @@ public:
<< "Temporal Filter Type: " << m_TemporalFilterType << endl
<< "Temporal Filter Exp: " << m_TemporalFilterExp << endl
<< "Temporal Filter Width: " << m_TemporalFilterWidth << endl
-
+
<< "Palette Mode: " << m_PaletteMode << endl
<< "Palette Interp: " << m_PaletteInterp << endl
<< "Palette Index: " << m_Palette.m_Index << endl
@@ -1454,14 +1454,14 @@ public:
//Note that increasing this value does not adjust the quality by a proportional amount, so an increased value may produce a degraded image.
//Xml field: "scale".
T m_PixelsPerUnit;
-
- //A value greater than 0 will zoom in the field of view, however it will also increase the quality by a proportional amount. This is used to
+
+ //A value greater than 0 will zoom in the field of view, however it will also increase the quality by a proportional amount. This is used to
//overcome the shortcoming of scale by also adjusting the quality.
//Xml field: "zoom".
T m_Zoom;
-
+
//3D fields.
-private:
+private:
typedef void (Ember::*ProjFuncPtr)(Point&, QTIsaac&);
ProjFuncPtr m_ProjFunc;
@@ -1492,41 +1492,41 @@ public:
//Xml field: "center".
T m_CenterX;
T m_CenterY;
-
+
//Rotate the camera by this many degrees. Since this is a camera rotation, the final output image will be rotated counter-clockwise.
//Xml field: "rotate".
T m_Rotate;
-
+
//When specifying the palette as an index in the palette file, rather than inserted in the Xml, it can optionally have its hue
//rotated by this amount.
//Xml field: "hue".
T m_Hue;
-
+
//Determine how bright to make the image during final accumulation.
//Xml field: "brightness".
T m_Brightness;
-
+
//Gamma level used in gamma correction during final accumulation.
//Xml field: "gamma".
T m_Gamma;
-
+
//Used in color correction during final accumulation.
//Xml field: "vibrancy".
T m_Vibrancy;
-
+
//Gamma threshold used in gamma correction during final accumulation.
//Xml field: "gamma_threshold".
T m_GammaThresh;
-
+
//Value to control saturation of some pixels in gamma correction during final accumulation.
//Xml field: "highlight_power".
T m_HighlightPower;
-
+
//When animating a file full of many embers, this value is used to specify the time in the animation
//that this ember should be rendered. They must all be sequential and increase by a default value of 1.
//Xml field: "time".
T m_Time;
-
+
//The background color of the image used in final accumulation, ranged 0-1.
//Xml field: "background".
Color m_Background;
@@ -1544,7 +1544,7 @@ public:
//The type of interpolation to use for the palette when interpolating embers for animation.
//Xml field: "palette_interpolation".
ePaletteInterp m_PaletteInterp;
-
+
//Temporal Filter.
//Only used if temporal filter type is exp, else unused.
@@ -1564,11 +1564,11 @@ public:
//The minimum radius of the DE filter.
//Xml field: "estimator_minimum".
T m_MinRadDE;
-
+
//The maximum radius of the DE filter.
//Xml field: "estimator_radius".
T m_MaxRadDE;
-
+
//The shape of the curve that governs how quickly or slowly the filter drops off as it moves away from the center point.
//Xml field: "estimator_curve".
T m_CurveDE;
@@ -1584,7 +1584,7 @@ public:
//Lanczos2, Mitchell, Blackman, Catrom, Hamming, Hanning, Quadratic.
//Xml field: "filter_shape".
eSpatialFilterType m_SpatialFilterType;
-
+
//Palette.
//The method used for retrieving a color from the palette when accumulating to the histogram: step, linear.
@@ -1701,4 +1701,4 @@ static inline bool CompareEmbers(const Ember& a, const Ember& b)
{
return a.m_Time < b.m_Time;
}
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/EmberDefines.h b/Source/Ember/EmberDefines.h
index fa9c212..452944e 100644
--- a/Source/Ember/EmberDefines.h
+++ b/Source/Ember/EmberDefines.h
@@ -14,7 +14,7 @@
#endif
#else
#define EMBER_API
- #define fopen_s(pFile,filename,mode) ((*(pFile))=fopen((filename),(mode)))==NULL
+ #define fopen_s(pFile,filename,mode) ((*(pFile)=fopen((filename),(mode)))==nullptr)
#define _stat stat
#define _fstat fstat
#define _stricmp strcmp
diff --git a/Source/Ember/EmberToXml.h b/Source/Ember/EmberToXml.h
index 649ea06..e1e1a14 100644
--- a/Source/Ember/EmberToXml.h
+++ b/Source/Ember/EmberToXml.h
@@ -146,7 +146,7 @@ public:
os << " rotate=\"" << ember.m_Rotate << "\"";
os << " supersample=\"" << max(1u, ember.m_Supersample) << "\"";
os << " filter=\"" << ember.m_SpatialFilterRadius << "\"";
-
+
os << " filter_shape=\"" << ToLower(SpatialFilterCreator::ToString(ember.m_SpatialFilterType)) << "\"";
os << " temporal_filter_type=\"" << ToLower(TemporalFilterCreator::ToString(ember.m_TemporalFilterType)) << "\"";
@@ -247,7 +247,7 @@ public:
double g = ember.m_Palette[i][1] * 255;
double b = ember.m_Palette[i][2] * 255;
double a = ember.m_Palette[i][3] * 255;
-
+
os << " ";
//The original used a precision of 6 which is totally unnecessary, use 2.
if (IsClose(a, 255.0))
@@ -269,7 +269,7 @@ public:
}
}
- if (doEdits && ember.m_Edits != NULL)
+ if (doEdits && ember.m_Edits != nullptr)
os << ToString(xmlDocGetRootElement(ember.m_Edits), 1, true, printEditDepth);
os << "\n";
@@ -282,8 +282,8 @@ public:
/// This is used when an ember is made out of some mutation or edit from one or two existing embers and
/// the user wants to capture the genetic lineage history information in the edit doc of the new ember.
///
- /// The first parent, optionally NULL.
- /// The second parent, optionally NULL.
+ /// The first parent, optionally nullptr.
+ /// The second parent, optionally nullptr.
/// The action that was taken to create the new ember
/// The nickname of the author
/// The Url of the author
@@ -298,18 +298,18 @@ public:
char buffer[128];
char commentString[128];
time_t myTime;
- xmlDocPtr commentDoc = NULL;
+ xmlDocPtr commentDoc = nullptr;
xmlDocPtr doc = xmlNewDoc(XC "1.0");
- xmlNodePtr rootNode = NULL, node = NULL, nodeCopy = NULL;
- xmlNodePtr rootComment = NULL;
+ xmlNodePtr rootNode = nullptr, node = nullptr, nodeCopy = nullptr;
+ xmlNodePtr rootComment = nullptr;
//Create the root node, called "edit".
- rootNode = xmlNewNode(NULL, XC "edit");
+ rootNode = xmlNewNode(nullptr, XC "edit");
xmlDocSetRootElement(doc, rootNode);
//Add the edit attributes.
//Date.
- myTime = time(NULL);
+ myTime = time(nullptr);
#ifdef WIN32
tm localt;
localtime_s(&localt, &myTime);
@@ -339,7 +339,7 @@ public:
if (sheepGen > 0 && sheepId > 0)
{
//Create a child node of the root node called sheep.
- node = xmlNewChild(rootNode, NULL, XC "sheep", NULL);
+ node = xmlNewChild(rootNode, nullptr, XC "sheep", nullptr);
//Create the sheep attributes.
sprintf_s(buffer, 128, "%d", sheepGen);
@@ -366,7 +366,7 @@ public:
else
{
//Insert a (parent has no edit) message.
- nodeCopy = xmlNewChild(rootNode, NULL, XC "edit", NULL);
+ nodeCopy = xmlNewChild(rootNode, nullptr, XC "edit", nullptr);
AddFilenameWithoutAmpersand(nodeCopy, parent0->m_ParentFilename);
sprintf_s(buffer, 128, "%d", parent0->m_Index);
xmlNewProp(nodeCopy, XC "index", XC buffer);
@@ -388,7 +388,7 @@ public:
else
{
//Insert a (parent has no edit) message.
- nodeCopy = xmlNewChild(rootNode, NULL, XC "edit",NULL);
+ nodeCopy = xmlNewChild(rootNode, nullptr, XC "edit",nullptr);
AddFilenameWithoutAmpersand(nodeCopy, parent1->m_ParentFilename);
sprintf_s(buffer, 128, "%d", parent1->m_Index);
xmlNewProp(nodeCopy, XC "index", XC buffer);
@@ -405,10 +405,10 @@ public:
if (comment != "")
{
sprintf_s(commentString, 128, "%s", comment.c_str());
- commentDoc = xmlReadMemory(commentString, (int)strlen(commentString), "comment.env", NULL, XML_PARSE_NONET);
+ commentDoc = xmlReadMemory(commentString, (int)strlen(commentString), "comment.env", nullptr, XML_PARSE_NONET);
//Check for errors.
- if (commentDoc != NULL)
+ if (commentDoc != nullptr)
{
//Loop through the children of the new document and copy them into the rootNode.
@@ -567,9 +567,9 @@ private:
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;
+ unsigned int ti;//, editOrSheep = 0;
+ xmlAttrPtr attPtr = nullptr, curAtt = nullptr;
+ xmlNodePtr childPtr = nullptr, curChild = nullptr;
ostringstream os;
if (printEditDepth > 0 && tabs > printEditDepth)
@@ -589,13 +589,13 @@ private:
//If it's an edit node, add one to the tab.
if (!Compare(editNode->name, editString))
{
- editOrSheep = 1;
+ //editOrSheep = 1;
tabs++;
}
- else if (!Compare(editNode->name, sheepString))
- editOrSheep = 2;
- else
- editOrSheep = 0;
+ else if (!Compare(editNode->name, sheepString)) { }
+ //editOrSheep = 2;
+ else { }
+ //editOrSheep = 0;
//Print the attributes.
attPtr = editNode->properties;
@@ -649,15 +649,15 @@ private:
//Child is a text node, don't want to indent more than once.
if (xmlIsBlankNode(curChild))
continue;
-
+
if (!indentPrinted && formatting)
{
for (ti = 0; ti < tabs; ti++)
os << tabString;
-
+
indentPrinted = true;
}
-
+
//Print nodes without formatting.
os << ToString(curChild, tabs, false, printEditDepth);
}
@@ -702,4 +702,4 @@ private:
}
}
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/Interpolate.h b/Source/Ember/Interpolate.h
index b405673..7c3d0da 100644
--- a/Source/Ember/Interpolate.h
+++ b/Source/Ember/Interpolate.h
@@ -85,14 +85,14 @@ public:
for (xf = 0; xf < maxCount; xf++)//This will include both normal xforms and the final.
{
destXform = destEmbers[i].GetTotalXform(xf, final);
-
+
//Ensure every parametric variation contained in every xform at either position i - 1 or i + 1 is also contained in the dest xform.
if (i > 0)
destOtherXform = destEmbers[i - 1].GetTotalXform(xf);
else if (i < count - 1)
destOtherXform = destEmbers[i + 1].GetTotalXform(xf);
else
- destOtherXform = NULL;//Should never happen
+ destOtherXform = nullptr;//Should never happen
if (destOtherXform)
MergeXformVariations1Way(destOtherXform, destXform, true, true);
@@ -130,15 +130,15 @@ public:
//with weight -1.
//Added JULIAN/JULIASCOPE to get rid of black wedges.
if (destOtherXform->GetVariationById(VAR_SPHERICAL) ||
- destOtherXform->GetVariationById(VAR_NGON) ||
- destOtherXform->GetVariationById(VAR_JULIAN) ||
+ destOtherXform->GetVariationById(VAR_NGON) ||
+ destOtherXform->GetVariationById(VAR_JULIAN) ||
destOtherXform->GetVariationById(VAR_JULIASCOPE) ||
destOtherXform->GetVariationById(VAR_POLAR) ||
destOtherXform->GetVariationById(VAR_WEDGE_SPH) ||
destOtherXform->GetVariationById(VAR_WEDGE_JULIA))
{
destXform->AddVariation(new LinearVariation(-1));
-
+
//Set the coefs appropriately.
destXform->m_Affine.A(-1);
destXform->m_Affine.D(0);
@@ -244,7 +244,7 @@ public:
if (xf >= sourceEmbers[i + ii].TotalXformCount())
continue;
- Xform* destOtherXform = destEmbers[i + ii].GetTotalXform(xf);
+ destOtherXform = destEmbers[i + ii].GetTotalXform(xf);
if (destOtherXform->GetVariationById(VAR_FAN))
{
@@ -413,7 +413,7 @@ public:
while (embers[i1].m_Time < time)
i1++;
-
+
i1--;
i2 = i1 + 1;
}
@@ -437,7 +437,7 @@ public:
Align(&embers[i1], &localEmbers[0], 2);
smoothFlag = false;
}
-
+
if (i2 == size - 1)
{
//fprintf(stderr, "error: cannot use smooth interpolation on last segment.\n");
@@ -445,7 +445,7 @@ public:
Align(&embers[i1], &localEmbers[0], 2);
smoothFlag = false;
}
-
+
Align(&embers[i1 - 1], &localEmbers[0], 4);//Should really be doing some sort of checking here to ensure the ember vectors have 4 elements.
smoothFlag = true;
}
@@ -545,7 +545,7 @@ public:
static void InterpParametricVar(vector*>& first, ParametricVariation* second, vector& c)
{
//First, make sure the variation vector is the same size as the coefficient vector.
- if (second != NULL && first.size() == c.size())
+ if (second != nullptr && first.size() == c.size())
{
second->Clear();
ParamWithName* secondParams = second->Params();
@@ -616,7 +616,7 @@ public:
//Establish the angles and magnitudes for each component.
//Keep translation linear.
zlm[0] = zlm[1] = 0;
-
+
if (Xform* xform = embers[k].GetTotalXform(xfi))
{
for (col = 0; col < 2; col++)
@@ -633,16 +633,16 @@ public:
c1[1] = xform->m_Post.m_Mat[1][col];
t = xform->m_Post.m_Mat[col][2];
}
-
+
cxAng[k][col] = atan2(c1[1], c1[0]);
cxMag[k][col] = sqrt(c1[0] * c1[0] + c1[1] * c1[1]);
-
+
if (cxMag[k][col] == 0)
zlm[col] = 1;
-
+
cxTrn[k][col] = t;
}
-
+
if (zlm[0] == 1 && zlm[1] == 0)
cxAng[k][0] = cxAng[k][1];
else if (zlm[0] == 0 && zlm[1] == 1)
@@ -671,7 +671,7 @@ public:
//Make sure both angles are within [refang refang + 2 * pi].
while(cxAng[k - 1][col] < refang)
cxAng[k - 1][col] += M_2PI;
-
+
while(cxAng[k - 1][col] > refang + M_2PI)
cxAng[k - 1][col] -= M_2PI;
@@ -722,7 +722,7 @@ public:
{
c1[0] = embers[k].GetXform(xfi)->m_Affine.m_Mat[0][col];//A,D then B,E.
c1[1] = embers[k].GetXform(xfi)->m_Affine.m_Mat[1][col];
-
+
cxang[k][col] = atan2(c1[1], c1[0]);
}
}
@@ -772,7 +772,7 @@ public:
size_t size = coefs.size();
glm::length_t i, col, accmode[2] = { 0, 0 };
T expmag, accang[2] = { 0, 0 }, accmag[2] = { 0, 0 };
-
+
//Accumulation mode defaults to logarithmic, but in special
//cases switch to linear accumulation.
for (col = 0; col < 2; col++)
@@ -783,23 +783,23 @@ public:
accmode[col] = 1;//Mode set to linear interp.
}
}
-
+
for (i = 0; i < size; i++)
{
for (col = 0; col < 2; col++)
{
accang[col] += coefs[i] * cxAng[i][col];
-
+
if (accmode[col] == 0)
accmag[col] += coefs[i] * log(cxMag[i][col]);
- else
+ else
accmag[col] += coefs[i] * (cxMag[i][col]);
-
+
//Translation is ready to go.
store.m_Mat[col][2] += coefs[i] * cxTrn[i][col];
}
}
-
+
//Convert the angle back to rectangular.
for (col = 0; col < 2; col++)
{
@@ -807,7 +807,7 @@ public:
expmag = exp(accmag[col]);
else
expmag = accmag[col];
-
+
store.m_Mat[0][col] = expmag * cos(accang[col]);
store.m_Mat[1][col] = expmag * sin(accang[col]);
}
@@ -836,7 +836,7 @@ public:
{
//maxStag is the spacing between xform start times if staggerPercent = 1.0.
T maxStag = T(numXforms - 1) / numXforms;
-
+
//Scale the spacing by staggerPercent.
T stagScaled = staggerPercent * maxStag;
@@ -845,7 +845,7 @@ public:
//The second line makes the last xform interpolate first.
T st = stagScaled * (numXforms - 1 - thisXform) / (numXforms - 1);
T et = st + (1 - stagScaled);
-
+
if (t <= st)
return 0;
else if (t >= et)
@@ -871,17 +871,17 @@ public:
else if (funcNum == MOTION_TRIANGLE)
{
T fr = fmod(timeVal, T(1.0));
-
+
if (fr < 0)
fr += 1;
-
+
if (fr <= T(0.25))
fr *= 4;
else if (fr <= T(0.75))
fr = -4 * fr + 2;
else
fr = 4 * fr - 4;
-
+
return fr;
}
else//MOTION_HILL
@@ -889,7 +889,7 @@ public:
return ((1 - cos(T(2.0) * T(M_PI) * timeVal)) * T(0.5));
}
}
-
+
/*
//Will need to alter this to handle 2D palettes.
static bool InterpMissingColors(vector>& palette)
@@ -914,18 +914,18 @@ public:
break;
}
}
-
+
if (i == 256)
{
//No colors. Set all indices properly.
for (i = 0; i < 256; i++)
- palette[i].m_Index = (T)i;
+ palette[i].m_Index = (T)i;
return false;
}
-
+
wrapMin = minIndex + 256;
-
+
for (i = 255; i >= 0; i--)//Moving backwards, ouch!
{
if (palette[i].m_Index >= 0)
@@ -934,9 +934,9 @@ public:
break;
}
}
-
+
wrapMax = maxIndex - 256;
-
+
//Loop over the indices looking for negs,
i = 0;
@@ -956,29 +956,29 @@ public:
colorri = intr;
i++;
}
-
+
if (intl == -1)
{
intl = wrapMax;
colorli = maxIndex;
}
-
+
if (intr == 256)
{
intr = wrapMin;
colorri = minIndex;
}
-
+
for (j = str; j <= enr; j++)
{
prcr = (j - intl) / T(intr - intl);
-
+
for (k = 0; k <= 3; k++)
palette[j].Channels[k] = T(palette[colorli].Channels[k] * (1 - prcr) + palette[colorri].Channels[k] * prcr);
-
+
palette[j].m_Index = T(j);
}
-
+
i = colorri + 1;
}
else
@@ -1020,4 +1020,4 @@ public:
return ad > bd;
}
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/Isaac.h b/Source/Ember/Isaac.h
index dec05e7..dba7d41 100644
--- a/Source/Ember/Isaac.h
+++ b/Source/Ember/Isaac.h
@@ -5,29 +5,29 @@
///
/// C++ TEMPLATE VERSION OF Robert J. Jenkins Jr.'s
/// ISAAC Random Number Generator.
-///
+///
/// Ported from vanilla C to to template C++ class
/// by Quinn Tyler Jackson on 16-23 July 1998.
-///
+///
/// quinn@qtj.net
-///
+///
/// The function for the expected period of this
/// random number generator, according to Jenkins is:
-///
+///
/// f(a,b) = 2**((a+b*(3+2^^a)-1)
-///
+///
/// (where a is ALPHA and b is bitwidth)
-///
+///
/// So, for a bitwidth of 32 and an ALPHA of 8,
/// the expected period of ISAAC is:
-///
+///
/// 2^^(8+32*(3+2^^8)-1) = 2^^8295
-///
+///
/// Jackson has been able to run implementations
/// with an ALPHA as high as 16, or
-///
+///
/// 2^^2097263
-///
+///
/// -Modified by Matt Feemster to eliminate needless dynamic memory allocation and virtual functions and bring inline with Ember coding style.
///
@@ -38,13 +38,13 @@
typedef uint64_t ISAAC_INT;
const ISAAC_INT GOLDEN_RATIO = ISAAC_INT(0x9e3779b97f4a7c13);
#endif
-
+
namespace EmberNs
{
///
/// QTIsaac class which allows using ISAAC in an OOP manner.
///
-template
+template
class EMBER_API QTIsaac
{
public:
@@ -69,7 +69,7 @@ public:
T randb;
T randc;
};
-
+
///
/// Constructor which initialized the random context using the values passed in.
/// Leaving these as their defaults is fine, and will still give different
@@ -80,8 +80,8 @@ public:
/// First random seed. Default: 0.
/// Second random seed. Default: 0.
/// Third random seed. Default: 0.
- /// Pointer to a buffer of 256 random integer seeds. Default: NULL.
- QTIsaac(T a = 0, T b = 0, T c = 0, T* s = NULL)
+ /// Pointer to a buffer of 256 random integer seeds. Default: nullptr.
+ QTIsaac(T a = 0, T b = 0, T c = 0, T* s = nullptr)
{
Srand(a, b, c, s);
}
@@ -193,44 +193,44 @@ 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)
{
ctx->randa = 0;
ctx->randb = 0;
ctx->randc = 0;
}
-
+
//Scramble it.
- for (i = 0; i < 4; ++i)
+ for (i = 0; i < 4; ++i)
{
Shuffle(a, b, c, d, e, f, g, h);
}
-
- if (useSeed)
+
+ if (useSeed)
{
//Initialize using the contents of r[] as the seed.
for (i = 0; i < N; i += 8)
{
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;
- }
-
+ }
+
//Do a second pass to make all of the seed affect all of m.
for (i = 0; i < N; i += 8)
{
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;
}
@@ -239,11 +239,11 @@ 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;
}
-
+
Isaac(ctx); //Fill in the first set of results.
ctx->randcnt = N;//TODO//0;//Prepare to use the first set of results.
}
@@ -255,10 +255,10 @@ public:
/// First random seed. Default: 0.
/// Second random seed. Default: 0.
/// Third random seed. Default: 0.
- /// Pointer to a buffer of 256 random integer seeds. Default: NULL.
- void Srand(T a = 0, T b = 0, T c = 0, T* s = NULL)
+ /// Pointer to a buffer of 256 random integer seeds. Default: nullptr.
+ void Srand(T a = 0, T b = 0, T c = 0, T* s = nullptr)
{
- if (s == NULL)//Default to using time plus index as the seed if s was NULL.
+ if (s == nullptr)//Default to using time plus index as the seed if s was nullptr.
{
for (int i = 0; i < N; i++)
m_Rc.randrsl[i] = (T)time(0) + i;
@@ -272,9 +272,9 @@ public:
#ifndef ISAAC_FLAM3_DEBUG
if (a == 0 && b == 0 && c == 0)
{
- m_Rc.randa = (T)time(0);
- m_Rc.randb = (T)time(0) * (T)time(0);
- m_Rc.randc = (T)time(0) * (T)time(0) * (T)time(0);
+ m_Rc.randa = (T)time(nullptr);
+ m_Rc.randb = (T)time(nullptr) * (T)time(nullptr);
+ m_Rc.randc = (T)time(nullptr) * (T)time(nullptr) * (T)time(nullptr);
}
else
#endif
@@ -283,10 +283,10 @@ public:
m_Rc.randb = b;
m_Rc.randc = c;
}
-
+
RandInit(&m_Rc, true);
}
-
+
protected:
///
/// Compute the next batch of random numbers for a random context.
@@ -295,17 +295,17 @@ protected:
void Isaac(randctx* ctx)
{
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* m = mm;
T* m2 = (m + (N / 2));
T* mend = m2;
-
+
for(; m < mend; )
{
#ifndef __ISAAC64
@@ -320,9 +320,9 @@ protected:
RngStep( a ^ (a >> 33) , a, b, mm, m, m2, r, x, y);
#endif // __ISAAC64
}
-
+
m2 = mm;
-
+
for(; m2> 33) , a, b, mm, m, m2, r, x, y);
#endif // __ISAAC64
}
-
+
ctx->randb = b;
ctx->randa = a;
}
-
+
///
/// Retrieves a value using indirection.
///
@@ -362,26 +362,26 @@ protected:
///
void RngStep(T mix, T& a, T& b, T*& mm, T*& m, T*& m2, T*& r, T& x, T& y)
{
- x = *m;
- a = (a ^ (mix)) + *(m2++);
- *(m++) = y = Ind(mm, x) + a + b;
- *(r++) = b = Ind(mm, y >> ALPHA) + x;
+ x = *m;
+ a = (a ^ (mix)) + *(m2++);
+ *(m++) = y = Ind(mm, x) + a + b;
+ *(r++) = b = Ind(mm, y >> ALPHA) + x;
}
///
/// Unsure what this does.
///
void Shuffle(T& a, T& b, T& c, T& d, T& e, T& f, T& g, T& h)
- {
+ {
#ifndef __ISAAC64
- a ^= b << 11; d += a; b += c;
- b ^= c >> 2; e += b; c += d;
- c ^= d << 8; f += c; d += e;
- d ^= e >> 16; g += d; e += f;
- e ^= f << 10; h += e; f += g;
- f ^= g >> 4; a += f; g += h;
- g ^= h << 8; b += g; h += a;
- h ^= a >> 9; c += h; a += b;
+ a ^= b << 11; d += a; b += c;
+ b ^= c >> 2; e += b; c += d;
+ c ^= d << 8; f += c; d += e;
+ d ^= e >> 16; g += d; e += f;
+ e ^= f << 10; h += e; f += g;
+ f ^= g >> 4; a += f; g += h;
+ g ^= h << 8; b += g; h += a;
+ h ^= a >> 9; c += h; a += b;
#else // __ISAAC64
a -= e; f ^= h >> 9; h += a;
b -= f; g ^= a << 9; a += b;
@@ -393,8 +393,8 @@ protected:
h -= d; e ^= g << 14; g += h;
#endif // __ISAAC64
}
-
+
private:
randctx m_Rc;//The random context which holds all of the seed and state information as well as the random number values.
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/Iterator.h b/Source/Ember/Iterator.h
index 1efa3d3..d1a77a8 100644
--- a/Source/Ember/Iterator.h
+++ b/Source/Ember/Iterator.h
@@ -57,7 +57,7 @@ public:
///
/// Accessors.
///
- const unsigned char* XformDistributions() const { return m_XformDistributions.empty() ? NULL : &m_XformDistributions[0]; }
+ const unsigned char* XformDistributions() const { return m_XformDistributions.empty() ? nullptr : &m_XformDistributions[0]; }
const unsigned int XformDistributionsSize() const { return (unsigned int)m_XformDistributions.size(); }
///
@@ -70,7 +70,7 @@ public:
/// The random context to use
/// The number of bad values
virtual unsigned int Iterate(Ember& ember, unsigned int count, unsigned int skip, Point* samples, QTIsaac& rand) { return 0; }
-
+
///
/// Initialize the xform selection vector by normalizing the weights of all xforms and
/// setting the corresponding percentage of elements in the vector to each xform's index in its
@@ -103,7 +103,7 @@ public:
for (i = 0; i < ember.XformCount(); i++)
{
T d = xforms[i].m_Weight;
-
+
if (distrib > 0)
d *= xforms[distrib - 1].Xaos(i);
@@ -124,12 +124,12 @@ public:
for (i = 0; i < ember.XformCount(); i++)
{
T temp = xforms[i].m_Weight;
-
+
if (distrib > 0)
temp *= xforms[distrib - 1].Xaos(i);
-
+
currentDensityLimit += temp;
-
+
//Populate points corresponding to this xform's weight/density.
//Also check that j is within the bounds of the distribution array just to be safe in the case of a rounding error.
while (tempDensity < currentDensityLimit && j < CHOOSE_XFORM_GRAIN)
@@ -169,7 +169,7 @@ public:
return true;
}
-protected:
+protected:
///
/// When iterating, if the computed location of the point is either very close to zero, or very close to infinity,
/// it's considered a bad value. In that case, a new random input point is fed into a new randomly chosen xform. This
@@ -240,7 +240,7 @@ protected:
///
/// Retrieve an element in the distributions vector between 0 and CHOOSE_XFORM_GRAIN which will
- /// contain the index of the next xform to use. When xaos is prsent, the offset is the index in
+ /// contain the index of the next xform to use. When xaos is prsent, the offset is the index in
/// the ember of the previous xform used when.
///
/// The index to retrieve
@@ -344,7 +344,7 @@ public:
}
DoFinalXform(ember, p1, samples, rand);//Apply to last fuse point and store as the first element in samples.
-
+
for (i = 1; i < count; i++)//Real loop.
{
if (xforms[NextXformFromIndex(rand.Rand())].Apply(&p1, &p1, rand))//Feed the resulting value of applying the randomly selected xform back into the next iter, and not the result of applying the final xform.
@@ -405,7 +405,7 @@ public:
{
unsigned int consec = 0;
Point firstBadPoint;
-
+
while (consec < 5)
{
consec++;
@@ -468,11 +468,11 @@ public:
DoFinalXform(ember, p1, samples, rand);//Apply to last fuse point and store as the first element in samples.
ember.Proj(samples[0], rand);
-
+
for (i = 1; i < count; i++)//Real loop.
{
xformIndex = NextXformFromIndex(rand.Rand(), lastXformUsed);
-
+
if (xforms[xformIndex].Apply(&p1, &p1, rand))//Feed the resulting value of applying the randomly selected xform back into the next iter, and not the result of applying the final xform.
DoBadVals(xforms, xformIndex, lastXformUsed, badVals, &p1, rand);
@@ -520,7 +520,7 @@ public:
for (i = 0; i < skip; i++)//Fuse.
{
xformIndex = NextXformFromIndex(rand.Rand(), lastXformUsed);
-
+
if (xforms[xformIndex].Apply(&p1, &p1, rand))
DoBadVals(xforms, xformIndex, lastXformUsed, badVals, &p1, rand);
@@ -532,7 +532,7 @@ public:
for (i = 1; i < count; i++)//Real loop.
{
xformIndex = NextXformFromIndex(rand.Rand(), lastXformUsed);
-
+
if (xforms[xformIndex].Apply(&p1, &p1, rand))//Feed the resulting value of applying the randomly selected xform back into the next iter, and not the result of applying the final xform.
DoBadVals(xforms, xformIndex, lastXformUsed, badVals, &p1, rand);
@@ -547,7 +547,7 @@ public:
for (i = 0; i < skip; i++)//Fuse.
{
xformIndex = NextXformFromIndex(rand.Rand(), lastXformUsed);
-
+
if (xforms[xformIndex].Apply(&p1, &p1, rand))
DoBadVals(xforms, xformIndex, lastXformUsed, badVals, &p1, rand);
@@ -559,7 +559,7 @@ public:
for (i = 0; i < count - 1; i++)//Real loop.
{
xformIndex = NextXformFromIndex(rand.Rand(), lastXformUsed);
-
+
if (xforms[xformIndex].Apply(samples + i, samples + i + 1, rand))
DoBadVals(xforms, xformIndex, lastXformUsed, badVals, samples + i + 1, rand);
@@ -571,4 +571,4 @@ public:
return badVals;
}
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/Palette.h b/Source/Ember/Palette.h
index f1f41e5..7afcac9 100644
--- a/Source/Ember/Palette.h
+++ b/Source/Ember/Palette.h
@@ -44,7 +44,7 @@ public:
m_Name = name;
m_Index = index;
m_Entries.resize(size);
-
+
if (xmlPaletteEntries)
{
memcpy(&m_Entries[0], xmlPaletteEntries, Size() * sizeof(m_Entries[0]));
@@ -115,6 +115,14 @@ public:
Palette::operator=(palette);
}
+ ///
+ /// Empty destructor.
+ /// Needed to eliminate warnings about inlining.
+ ///
+ ~Palette()
+ {
+ }
+
///
/// Default assignment operator.
///
@@ -197,16 +205,16 @@ public:
palette.m_Index = m_Index;
palette.m_Name = m_Name;
palette.m_Entries.resize(Size());
-
+
for (unsigned int i = 0; i < Size(); i++)
{
size_t ii = (i * 256) / COLORMAP_LENGTH;
T rgb[3], hsv[3];
-
+
rgb[0] = m_Entries[ii].r;
rgb[1] = m_Entries[ii].g;
rgb[2] = m_Entries[ii].b;
-
+
RgbToHsv(rgb, hsv);
hsv[0] += hue * T(6.0);
HsvToRgb(hsv, rgb);
@@ -264,7 +272,7 @@ public:
for (size_t i = 0; i < Size(); i++)
{
size_t ii = (i * 256) / COLORMAP_LENGTH;
-
+
rgb[0] = palette[(COLORMAP_LENGTH + ii - rot) % COLORMAP_LENGTH].r;//Rotation.
rgb[1] = palette[(COLORMAP_LENGTH + ii - rot) % COLORMAP_LENGTH].g;
rgb[2] = palette[(COLORMAP_LENGTH + ii - rot) % COLORMAP_LENGTH].b;
@@ -284,7 +292,7 @@ public:
palette[i].r = rgb[0];
palette[i].g = rgb[1];
palette[i].b = rgb[2];
- palette[i].a = 1;
+ palette[i].a = 1;
}
if (blur > 0)
@@ -445,7 +453,7 @@ public:
p = v * (1 - s);
q = v * (1 - (s * f));
t = v * (1 - (s * (1 - f)));
-
+
switch (j)
{
case 0: r = v; g = t; b = p; break;
@@ -481,7 +489,7 @@ public:
{
T frac, alpha;
T funcval = pow(linrange, gamma);
-
+
if (density > 0)
{
if (density < linrange)
@@ -494,7 +502,7 @@ public:
}
else
alpha = 0;
-
+
return alpha;
}
@@ -534,7 +542,7 @@ public:
{
newls = T(255.0) / maxc;
lsratio = pow(newls / ls, highPow);
-
+
//Calculate the max-value color (ranged 0 - 1).
for (rgbi = 0; rgbi < 3; rgbi++)
newRgb[rgbi] = (bucketT)newls * cBuf[rgbi] / bucketT(255.0);
@@ -551,7 +559,7 @@ public:
{
newls = T(255.0) / maxc;
adjustedHighlight = -highPow;
-
+
if (adjustedHighlight > 1)
adjustedHighlight = 1;
diff --git a/Source/Ember/PaletteList.h b/Source/Ember/PaletteList.h
index c89c45a..d1b1843 100644
--- a/Source/Ember/PaletteList.h
+++ b/Source/Ember/PaletteList.h
@@ -45,9 +45,9 @@ public:
if (ReadFile(filename.c_str(), buf))
{
- xmlDocPtr doc = xmlReadMemory((const char*)buf.data(), (int)buf.size(), filename.c_str(), NULL, XML_PARSE_NONET);
+ xmlDocPtr doc = xmlReadMemory((const char*)buf.data(), (int)buf.size(), filename.c_str(), nullptr, XML_PARSE_NONET);
- if (doc != NULL)
+ if (doc != nullptr)
{
xmlNode* rootNode = xmlDocGetRootElement(doc);
@@ -74,7 +74,7 @@ public:
/// Gets the palette at a specified index.
///
/// The index of the palette to read. A value of -1 indicates a random palette.
- /// A pointer to the requested palette if the index was in range, else NULL.
+ /// A pointer to the requested palette if the index was in range, else nullptr.
Palette* GetPalette(int i)
{
if (!m_Palettes.empty())
@@ -85,21 +85,21 @@ public:
return &m_Palettes[i];
}
- return NULL;
+ return nullptr;
}
-
+
///
/// Gets a pointer to a palette with a specified name.
///
/// The name of the palette to retrieve
- /// A pointer to the palette if found, else NULL
+ /// A pointer to the palette if found, else nullptr
Palette* GetPaletteByName(string& name)
{
for (unsigned int i = 0; i < Count(); i++)
if (m_Palettes[i].m_Name == name)
return &m_Palettes[i];
- return NULL;
+ return nullptr;
}
///
@@ -166,7 +166,7 @@ private:
if (!Compare(attr->name, "data"))
{
int colorIndex = 0;
- int r, g, b;
+ unsigned int r, g, b;
int colorCount = 0;
hexError = false;
@@ -223,4 +223,4 @@ private:
static bool m_Init;//Initialized to false in Ember.cpp, and will be set to true upon successful reading of an Xml palette file.
static vector> m_Palettes;//The vector that stores the palettes.
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/Point.h b/Source/Ember/Point.h
index 5febe09..b157b6d 100644
--- a/Source/Ember/Point.h
+++ b/Source/Ember/Point.h
@@ -224,4 +224,4 @@ public:
a = norm ? T(1) : T(255);
}
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/Renderer.cpp b/Source/Ember/Renderer.cpp
index d5a8087..4f47c19 100644
--- a/Source/Ember/Renderer.cpp
+++ b/Source/Ember/Renderer.cpp
@@ -23,11 +23,11 @@ Renderer::Renderer()
m_PixelAspectRatio = 1;
m_Transparency = false;
ThreadCount(Timing::ProcessorCount());
- m_StandardIterator = auto_ptr>(new StandardIterator());
- m_XaosIterator = auto_ptr>(new XaosIterator());
+ m_StandardIterator = unique_ptr>(new StandardIterator());
+ m_XaosIterator = unique_ptr>(new XaosIterator());
m_Iterator = m_StandardIterator.get();
- m_Callback = NULL;
- m_ProgressParameter = NULL;
+ m_Callback = nullptr;
+ m_ProgressParameter = nullptr;
m_LastPass = 0;
m_LastTemporalSample = 0;
m_LastIter = 0;
@@ -60,7 +60,7 @@ void Renderer::ComputeBounds()
m_GutterWidth = ClampGte((m_SpatialFilter->FinalFilterWidth() - Supersample()) / 2, 0u);
//Check the size of the density estimation filter.
- //If the radius of the density estimation filter is greater than the
+ //If the radius of the density estimation filter is greater than the
//gutter width, have to pad with more. Otherwise, use the same value.
for (unsigned int i = 0; i < m_Embers.size(); i++)
maxDEFilterWidth = max((unsigned int)(ceil(m_Embers[i].m_MaxRadDE) * m_Ember.m_Supersample), maxDEFilterWidth);
@@ -130,7 +130,7 @@ void Renderer::ChangeVal(std::function func, eProcessAc
Abort();
EnterRender();
func();
-
+
//If they want a full render, don't bother inspecting process state, just start over.
if (action == FULL_RENDER)
{
@@ -138,7 +138,7 @@ void Renderer::ChangeVal(std::function func, eProcessAc
m_ProcessAction = FULL_RENDER;
}
//Keep iterating is when rendering has completed and the user increases the quality.
- //Rendering can be started where it left off by adding just the difference between the
+ //Rendering can be started where it left off by adding just the difference between the
//new and old quality values.
else if (action == KEEP_ITERATING)
{
@@ -190,7 +190,7 @@ void Renderer::ChangeVal(std::function func, eProcessAc
m_ProcessAction = ACCUM_ONLY;
}
}
-
+
LeaveRender();
}
@@ -209,7 +209,7 @@ template
void Renderer::SetEmber(Ember& ember, eProcessAction action)
{
ChangeVal([&]
- {
+ {
m_Embers.clear();
m_Embers.push_back(ember);
m_Embers[0].m_TemporalSamples = 1;//Set temporal samples here to 1 because using the real value only makes sense when using a vector of Embers for animation.
@@ -256,7 +256,7 @@ void Renderer::AddEmber(Ember& ember)
/// from the last temporal filter created.
///
/// True if a new filter instance was created, else false.
-/// True if the filter is not NULL (whether a new one was created or not), else false.
+/// True if the filter is not nullptr (whether a new one was created or not), else false.
template
bool Renderer::CreateTemporalFilter(bool& newAlloc)
{
@@ -270,12 +270,12 @@ bool Renderer::CreateTemporalFilter(bool& newAlloc)
(m_Ember.m_TemporalFilterWidth != m_TemporalFilter->FilterWidth()) ||
(m_Ember.m_TemporalFilterExp != m_TemporalFilter->FilterExp()))
{
- m_TemporalFilter = auto_ptr>(
+ m_TemporalFilter = unique_ptr>(
TemporalFilterCreator::Create(m_Ember.m_TemporalFilterType, m_Ember.m_Passes, m_Ember.m_TemporalSamples, m_Ember.m_TemporalFilterWidth, m_Ember.m_TemporalFilterExp));
newAlloc = true;
}
- return m_TemporalFilter.get() != NULL;
+ return m_TemporalFilter.get() != nullptr;
}
///
@@ -363,7 +363,7 @@ eRenderStatus Renderer::Run(vector& finalImage, doubl
bool accumOnly = m_ProcessAction == ACCUM_ONLY;
bool resume = m_ProcessState != NONE;
bool newFilterAlloc;
- unsigned int temporalSample, pass;
+ unsigned int temporalSample = 0, pass;
T deTime;
eRenderStatus success = RENDER_OK;
//double iterationTime = 0;
@@ -419,10 +419,10 @@ eRenderStatus Renderer::Run(vector& finalImage, doubl
m_Vibrancy = m_Ember.m_Vibrancy;
m_Gamma = m_Ember.m_Gamma;
m_Background = m_Ember.m_Background;
-
+
if (filterAndAccumOnly)
goto FilterAndAccum;
-
+
if (accumOnly)
goto AccumOnly;
}
@@ -442,7 +442,7 @@ eRenderStatus Renderer::Run(vector& finalImage, doubl
CreateTemporalFilter(newFilterAlloc);
ComputeBounds();
- if (m_SpatialFilter.get() == NULL || m_TemporalFilter.get() == NULL)
+ if (m_SpatialFilter.get() == nullptr || m_TemporalFilter.get() == nullptr)
{
m_ErrorReport.push_back("Spatial and temporal filter allocations failed, aborting.\n");
success = RENDER_ERROR;
@@ -509,7 +509,6 @@ eRenderStatus Renderer::Run(vector& 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.
- 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.
@@ -596,7 +595,7 @@ FilterAndAccum:
}
else
m_K2 = (Supersample() * Supersample() * Passes()) / (area * m_ScaledQuality * m_TemporalFilter->SumFilt());
-
+
if (filterAndAccumOnly || pass == 0)
ResetBuckets(false, true);//Only the histogram was reset above, now reset the density filtering buffer.
//t.Tic();
@@ -645,7 +644,7 @@ FilterAndAccum:
//Also skip if rendering jumped straight here after completely finishing beforehand.
if (!filterAndAccumOnly && temporalSample >= TemporalSamples())//This may not work if filtering was prematurely exited.
pass++;
-
+
if (!filterAndAccumOnly)
m_LastPass = pass;
@@ -662,14 +661,14 @@ AccumOnly:
success = RENDER_ABORT;
goto Finish;
}
-
+
//Make sure a filter has been created.
CreateSpatialFilter(newFilterAlloc);
if (AccumulatorToFinalImage(finalImage, finalOffset) == RENDER_OK)
{
m_Stats.m_RenderMs = m_RenderTimer.Toc();//Record total time from the very beginning to the very end, including all intermediate calls.
-
+
//Even though the ember changes throughought the inner loops because of interpolation, it's probably ok to assign here.
//This will hold the last interpolated value (even though spatial and temporal filters were created based off of one of the first interpolated values).
m_LastEmber = m_Ember;
@@ -786,7 +785,7 @@ uint64_t Renderer::MemoryAvailable()
static int mib[2] = { CTL_HW, HW_PHYSMEM };
#endif
- if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0 && len == sizeof(physmem))
+ if (sysctl(mib, 2, &physmem, &len, nullptr, 0) == 0 && len == sizeof(physmem))
{
memAvailable = physmem;
}
@@ -840,7 +839,7 @@ bool Renderer::Ok() const
/// log scale filtering will be used.
///
/// True if a new filter instance was created, else false.
-/// True if the filter is not NULL (whether a new one was created or not) or if max rad is 0, else false.
+/// True if the filter is not nullptr (whether a new one was created or not) or if max rad is 0, else false.
template
bool Renderer::CreateDEFilter(bool& newAlloc)
{
@@ -856,7 +855,7 @@ bool Renderer::CreateDEFilter(bool& newAlloc)
(m_Ember.m_CurveDE != m_DensityFilter->Curve()) ||
(m_Ember.m_Supersample != m_DensityFilter->Supersample()))
{
- m_DensityFilter = auto_ptr>(new DensityFilter(m_Ember.m_MinRadDE, m_Ember.m_MaxRadDE, m_Ember.m_CurveDE, m_Ember.m_Supersample));
+ m_DensityFilter = unique_ptr>(new DensityFilter(m_Ember.m_MinRadDE, m_Ember.m_MaxRadDE, m_Ember.m_CurveDE, m_Ember.m_Supersample));
newAlloc = true;
}
@@ -882,7 +881,7 @@ bool Renderer::CreateDEFilter(bool& newAlloc)
/// from the last spatial filter created.
///
/// True if a new filter instance was created, else false.
-/// True if the filter is not NULL (whether a new one was created or not), else false.
+/// True if the filter is not nullptr (whether a new one was created or not), else false.
template
bool Renderer::CreateSpatialFilter(bool& newAlloc)
{
@@ -895,12 +894,12 @@ bool Renderer::CreateSpatialFilter(bool& newAlloc)
(m_Ember.m_Supersample != m_SpatialFilter->Supersample()) ||
(m_PixelAspectRatio != m_SpatialFilter->PixelAspectRatio()))
{
- m_SpatialFilter = auto_ptr>(
+ m_SpatialFilter = unique_ptr>(
SpatialFilterCreator::Create(m_Ember.m_SpatialFilterType, m_Ember.m_SpatialFilterRadius, m_Ember.m_Supersample, m_PixelAspectRatio));
newAlloc = true;
}
- return m_SpatialFilter.get() != NULL;
+ return m_SpatialFilter.get() != nullptr;
}
///
@@ -972,7 +971,7 @@ unsigned int Renderer::ThreadCount() const { return m_ThreadsToUse;
/// Reset the rendering process.
///
/// The number of threads to use
-/// The seed string to use if threads is 1. Default: NULL.
+/// The seed string to use if threads is 1. Default: nullptr.
template
void Renderer::ThreadCount(unsigned int threads, const char* seedString)
{
@@ -1194,7 +1193,7 @@ eRenderStatus Renderer::LogScaleDensityFilter()
parallel_for(startRow, endRow, [&] (unsigned int j)
{
unsigned int row = j * m_SuperRasW;
-
+
for (unsigned int i = startCol; (i < endCol) && !m_Abort; i++)
{
unsigned int index = row + i;
@@ -1240,7 +1239,7 @@ eRenderStatus Renderer::GaussianDensityFilter()
unsigned int startCol = Supersample() - 1;
unsigned int endCol = m_SuperRasW - (Supersample() - 1);
unsigned int chunkSize = (unsigned int)ceil(double(endRow - startRow) / double(threads));
-
+
//parallel_for scales very well, dividing the work almost perfectly among all processors.
parallel_for((unsigned int)0, threads, [&] (unsigned int threadIndex)
{
@@ -1311,7 +1310,7 @@ eRenderStatus Renderer::GaussianDensityFilter()
//Only have to calculate the values for ~1/8 of the square.
filterCoefIndex = filterSelectInt * m_DensityFilter->KernelSize();
arrFilterWidth = (int)ceil(filterWidths[filterSelectInt]) - 1;
-
+
for (jj = 0; jj <= arrFilterWidth; jj++)
{
for (ii = 0; ii <= jj; ii++, filterCoefIndex++)
@@ -1369,7 +1368,7 @@ eRenderStatus Renderer::GaussianDensityFilter()
if (percentDiff >= 10 || (toc > 1000 && percentDiff >= 1))
{
double etaMs = ((100.0 - percent) / percent) * totalTime.Toc();
-
+
if (!m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, percent, 1, etaMs))
Abort();
@@ -1379,7 +1378,7 @@ eRenderStatus Renderer::GaussianDensityFilter()
}
}
});
-
+
if (m_Callback && !m_Abort)
m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, 100.0, 1, 0);
@@ -1398,7 +1397,7 @@ eRenderStatus Renderer::AccumulatorToFinalImage(vector::AccumulatorToFinalImage(unsigned char* pixel
parallel_for((unsigned int)0, m_SuperRasH, [&] (unsigned int j)
{
unsigned int rowStart = j * m_SuperRasW;//Pull out of inner loop for optimization.
-
+
for (unsigned int i = 0; i < m_SuperRasW && !m_Abort; i++)
{
GammaCorrection(m_AccumulatorBuckets[i + rowStart], background, g, linRange, vibrancy, true, false, &(m_AccumulatorBuckets[i + rowStart][0]));//Write back in place.
@@ -1461,14 +1460,14 @@ eRenderStatus Renderer::AccumulatorToFinalImage(unsigned char* pixel
unsigned int ii, jj;
unsigned int x = m_DensityFilterOffset + (i * Supersample());//Start at the beginning column of each super sample block.
newBucket.Clear();
-
+
//Original was iterating column-wise, which is slow.
//Here, iterate one row at a time, giving a 10% speed increase.
for (jj = 0; jj < filterWidth; jj++)
{
unsigned int filterKRowIndex = jj * filterWidth;
unsigned int accumRowIndex = (y + jj) * m_SuperRasW;//Pull out of inner loop for optimization.
-
+
for (ii = 0; ii < filterWidth; ii++)
{
//Need to dereference the spatial filter pointer object to use the [] operator. Makes no speed difference.
@@ -1477,7 +1476,7 @@ eRenderStatus Renderer::AccumulatorToFinalImage(unsigned char* pixel
newBucket += (m_AccumulatorBuckets[(x + ii) + accumRowIndex] * k);
}
}
-
+
if (BytesPerChannel() == 2)
{
p16 = (unsigned short*)(pixels + pixelsRowStart);
@@ -1524,7 +1523,7 @@ eRenderStatus Renderer::AccumulatorToFinalImage(unsigned char* pixel
}
}
});
-
+
//Insert the palette into the image for debugging purposes. Only works with 8bpc.
if (m_InsertPalette && BytesPerChannel() == 1)
{
@@ -1532,7 +1531,7 @@ eRenderStatus Renderer::AccumulatorToFinalImage(unsigned char* pixel
if (ph >= FinalRasH())
ph = FinalRasH();
-
+
for (j = 0; j < ph; j++)
{
for (i = 0; i < FinalRasW(); i++)
@@ -1621,7 +1620,7 @@ EmberStats Renderer::Iterate(uint64_t iterCount, unsigned int pass,
//accumulationTime += t.Toc();
if (m_LockAccum)
m_AccumCs.Leave();
-
+
if (m_Callback && threadIndex == 0)
{
percent = 100.0 *
@@ -1647,7 +1646,7 @@ EmberStats Renderer::Iterate(uint64_t iterCount, unsigned int pass,
if (percentDiff >= 10 || (toc > 1000 && percentDiff >= 1))//Call callback function if either 10% has passed, or one second (and 1%).
{
etaMs = ((100.0 - percent) / percent) * m_RenderTimer.Toc();
-
+
if (!m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, percent, 0, etaMs))
Abort();
@@ -1681,7 +1680,7 @@ EmberStats Renderer::Iterate(uint64_t iterCount, unsigned int pass,
///
/// The vector of random contexts to assign
template
-vector> Renderer::RandVec() { return m_Rand; };
+vector> Renderer::RandVec() { return m_Rand; }
///
/// Set the vector of random contexts.
@@ -1706,7 +1705,7 @@ bool Renderer::RandVec(vector>& randV
}
return b;
-};
+}
///
/// Get whether the histogram is locked during accumulation.
@@ -1957,7 +1956,7 @@ void Renderer::Accumulate(Point* samples, unsigned int sampleCoun
const glm::detail::tvec4* dmap = &(palette->m_Entries[0]);
//It's critical to understand what's going on here as it's one of the most important parts of the algorithm.
- //A color value gets retrieved from the palette and
+ //A color value gets retrieved from the palette and
//its RGB values are added to the existing RGB values in the histogram bucket.
//Alpha is always 1 in the palettes, so that serves as the hit count.
//This differs from the original since redundantly adding both an alpha component and a hit count is omitted.
@@ -1985,7 +1984,7 @@ void Renderer::Accumulate(Point* samples, unsigned int sampleCoun
if (samples[i].m_VizAdjusted != 0)
{
m_CarToRas.Convert(samples[i], histIndex);
-
+
//There is a very slim chance that a point will be right on the border and will technically be in bounds, passing the InBounds() test,
//but ends up being mapped to a histogram bucket that is out of bounds due to roundoff error. Perform one final check before proceeding.
//This will result in a few points at the very edges getting discarded, but prevents a crash and doesn't seem to make a speed difference.
@@ -2016,7 +2015,7 @@ void Renderer::Accumulate(Point* samples, unsigned int sampleCoun
{
colorIndexFrac = colorIndex - (bucketT)intColorIndex;//Interpolate between intColorIndex and intColorIndex + 1.
}
-
+
if (samples[i].m_VizAdjusted == 1)
m_HistBuckets[histIndex] += ((dmap[intColorIndex] * (1 - colorIndexFrac)) + (dmap[intColorIndex + 1] * colorIndexFrac));
else
@@ -2141,7 +2140,7 @@ bool Renderer::AssignIterator()
m_Iterator = m_XaosIterator.get();
else
m_Iterator = m_StandardIterator.get();
-
+
//Timing t;
return m_Iterator->InitDistributions(m_Ember);
//t.Toc("Distrib creation");
@@ -2240,7 +2239,7 @@ template ePaletteMode Renderer
-template const unsigned char* Renderer::XformDistributions() const { return m_Iterator != NULL ? m_Iterator->XformDistributions() : NULL; }
-template const unsigned int Renderer::XformDistributionsSize() const { return m_Iterator != NULL ? m_Iterator->XformDistributionsSize() : 0; }
-template Point* Renderer::Samples(unsigned int threadIndex) const { return threadIndex < m_Samples.size() ? (Point*)m_Samples[threadIndex].data() : NULL; }
-}
\ No newline at end of file
+template const unsigned char* Renderer::XformDistributions() const { return m_Iterator != nullptr ? m_Iterator->XformDistributions() : nullptr; }
+template const unsigned int Renderer::XformDistributionsSize() const { return m_Iterator != nullptr ? m_Iterator->XformDistributionsSize() : 0; }
+template Point* Renderer::Samples(unsigned int threadIndex) const { return threadIndex < m_Samples.size() ? (Point*)m_Samples[threadIndex].data() : nullptr; }
+}
diff --git a/Source/Ember/Renderer.h b/Source/Ember/Renderer.h
index 96165d6..6b6fb32 100644
--- a/Source/Ember/Renderer.h
+++ b/Source/Ember/Renderer.h
@@ -119,7 +119,7 @@ public:
virtual void EarlyClip(bool earlyClip) { }
virtual bool YAxisUp() const { return false; }
virtual void YAxisUp(bool yup) { }
- virtual void ThreadCount(unsigned int threads, const char* seedString = NULL) { }
+ virtual void ThreadCount(unsigned int threads, const char* seedString = nullptr) { }
virtual void Transparency(bool transparency) { }
virtual void InteractiveFilter(eInteractiveFilter filter) { }
virtual unsigned int FinalRasW() const { return 0; }
@@ -141,7 +141,7 @@ public:
virtual EmberStats Stats() const { EmberStats stats; return stats; }
virtual eRenderStatus Run(vector& finalImage, double time = 0, unsigned int subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) { return RENDER_ERROR; }
virtual EmberImageComments ImageComments(unsigned int printEditDepth = 0, bool intPalette = false, bool hexPalette = true) { EmberImageComments comments; return comments; }
- virtual DensityFilterBase* GetDensityFilter() { return NULL; }
+ virtual DensityFilterBase* GetDensityFilter() { return nullptr; }
};
///
@@ -204,7 +204,7 @@ public:
virtual void NumChannels(unsigned int numChannels);
virtual eRendererType RendererType() const;
virtual unsigned int ThreadCount() const;
- virtual void ThreadCount(unsigned int threads, const char* seedString = NULL);
+ virtual void ThreadCount(unsigned int threads, const char* seedString = nullptr);
virtual void Callback(RenderCallback* callback);
protected:
@@ -341,7 +341,7 @@ protected:
private:
//Miscellaneous functions used only in this class.
void Accumulate(Point* samples, unsigned int sampleCount, const Palette* palette);
- inline void AddToAccum(const glm::detail::tvec4& bucket, int i, int ii, int j, int jj);
+ /*inline*/ void AddToAccum(const glm::detail::tvec4& bucket, int i, int ii, int j, int jj);
template void GammaCorrection(glm::detail::tvec4& bucket, Color& background, T g, T linRange, T vibrancy, bool doAlpha, bool scale, accumT* correctedChannels);
protected:
@@ -395,14 +395,14 @@ protected:
CarToRas m_CarToRas;
RenderCallback* m_Callback;
Iterator* m_Iterator;
- auto_ptr> m_StandardIterator;
- auto_ptr> m_XaosIterator;
+ unique_ptr> m_StandardIterator;
+ unique_ptr> m_XaosIterator;
Palette m_Dmap;
vector> m_HistBuckets;
vector> m_AccumulatorBuckets;
- auto_ptr> m_SpatialFilter;
- auto_ptr> m_TemporalFilter;
- auto_ptr> m_DensityFilter;
+ unique_ptr> m_SpatialFilter;
+ unique_ptr> m_TemporalFilter;
+ unique_ptr> m_DensityFilter;
vector>> m_Samples;
vector m_SubBatch;
vector m_BadVals;
diff --git a/Source/Ember/SheepTools.h b/Source/Ember/SheepTools.h
index a41d05f..e79e323 100644
--- a/Source/Ember/SheepTools.h
+++ b/Source/Ember/SheepTools.h
@@ -33,7 +33,7 @@ enum eCrossMode
{
CROSS_NOT_SPECIFIED = -1,
CROSS_UNION = 0,
- CROSS_INTERPOLATE = 1,
+ CROSS_INTERPOLATE = 1,
CROSS_ALTERNATE = 2
};
@@ -56,7 +56,7 @@ class EMBER_API SheepTools
public:
///
/// Constructor which takes a palette path and pre-constructed renderer.
- /// This class will take over ownership of the passed in renderer so the
+ /// This class will take over ownership of the passed in renderer so the
/// caller should not delete it.
///
/// The full path and filename of the palette file
@@ -73,9 +73,9 @@ public:
m_OffsetY = 0;
m_PaletteList.Init(palettePath);
- m_StandardIterator = auto_ptr>(new StandardIterator());
- m_XaosIterator = auto_ptr>(new XaosIterator());
- m_Renderer = auto_ptr>(renderer);
+ m_StandardIterator = unique_ptr>(new StandardIterator());
+ m_XaosIterator = unique_ptr>(new XaosIterator());
+ m_Renderer = unique_ptr>(renderer);
m_Rand = QTIsaac(ISAAC_INT(t.Tic()), ISAAC_INT(t.Tic() * 2), ISAAC_INT(t.Tic() * 3));
}
@@ -98,7 +98,7 @@ public:
ember.AddXform(xform1);
ember.AddXform(xform2);
ember.AddXform(xform3);
-
+
if (m_PaletteList.Init())
ember.m_Palette = *m_PaletteList.GetPalette(-1);
@@ -140,8 +140,8 @@ public:
do
{
- Variation* var = NULL;
- Variation* smallestVar = NULL;
+ Variation* var = nullptr;
+ Variation* smallestVar = nullptr;
numVars = 0;
smallest = -1;
@@ -200,7 +200,7 @@ public:
if (mode == MUTATE_NOT_SPECIFIED)
{
randSelect = m_Rand.Frand01();
-
+
if (randSelect < T(0.1))
mode = MUTATE_ALL_VARIATIONS;
else if (randSelect < T(0.3))
@@ -216,7 +216,7 @@ public:
else
mode = MUTATE_ALL_COEFS;
}
-
+
if (mode == MUTATE_ALL_VARIATIONS)
{
os << "mutate all variations";
@@ -238,7 +238,7 @@ public:
Variation* var1 = xform1->GetVariation(j);
Variation* var2 = xform2->GetVariationById(var1->VariationId());
- if ((var1 == NULL) ^ (var2 == NULL))//If any of them are different, clear the first and copy all of the second and exit the while loop.
+ if ((var1 == nullptr) ^ (var2 == nullptr))//If any of them are different, clear the first and copy all of the second and exit the while loop.
{
xform1->ClearAndDeleteVariations();
@@ -285,7 +285,7 @@ public:
{
unsigned int b = 1 + m_Rand.Rand() % 6;
unsigned int same = m_Rand.Rand() & 3;//25% chance of using the same post for all of them.
-
+
sprintf_s(ministr, 32, "(%d%s)", b, (same > 0) ? " same" : "");
os << "mutate post xforms " << ministr;
@@ -295,7 +295,7 @@ public:
Xform* xform = ember.GetTotalXform(i);
if (copy)//Copy the post from the first xform to the rest of them.
- {
+ {
xform->m_Post = ember.GetTotalXform(0)->m_Post;
}
else
@@ -304,40 +304,40 @@ public:
if (b & 1)
{
T f = T(M_PI) * m_Rand.Frand11();
- T a, b, d, e;
+ T ra, rb, rd, re;
- a = (xform->m_Affine.A() * cos(f) + xform->m_Affine.B() * -sin(f));
- d = (xform->m_Affine.A() * sin(f) + xform->m_Affine.D() * cos(f));
- b = (xform->m_Affine.B() * cos(f) + xform->m_Affine.E() * -sin(f));
- e = (xform->m_Affine.B() * sin(f) + xform->m_Affine.E() * cos(f));
+ ra = (xform->m_Affine.A() * cos(f) + xform->m_Affine.B() * -sin(f));
+ rd = (xform->m_Affine.A() * sin(f) + xform->m_Affine.D() * cos(f));
+ rb = (xform->m_Affine.B() * cos(f) + xform->m_Affine.E() * -sin(f));
+ re = (xform->m_Affine.B() * sin(f) + xform->m_Affine.E() * cos(f));
- xform->m_Affine.A(a);
- xform->m_Affine.B(b);
- xform->m_Affine.D(d);
- xform->m_Affine.E(e);
+ xform->m_Affine.A(ra);
+ xform->m_Affine.B(rb);
+ xform->m_Affine.D(rd);
+ xform->m_Affine.E(re);
f *= -1;
- a = (xform->m_Post.A() * cos(f) + xform->m_Post.B() * -sin(f));
- d = (xform->m_Post.A() * sin(f) + xform->m_Post.D() * cos(f));
- b = (xform->m_Post.B() * cos(f) + xform->m_Post.E() * -sin(f));
- e = (xform->m_Post.B() * sin(f) + xform->m_Post.E() * cos(f));
+ ra = (xform->m_Post.A() * cos(f) + xform->m_Post.B() * -sin(f));
+ rd = (xform->m_Post.A() * sin(f) + xform->m_Post.D() * cos(f));
+ rb = (xform->m_Post.B() * cos(f) + xform->m_Post.E() * -sin(f));
+ re = (xform->m_Post.B() * sin(f) + xform->m_Post.E() * cos(f));
- xform->m_Post.A(a);
- xform->m_Post.B(b);
- xform->m_Post.D(d);
- xform->m_Post.E(e);
+ xform->m_Post.A(ra);
+ xform->m_Post.B(rb);
+ xform->m_Post.D(rd);
+ xform->m_Post.E(re);
}
//33% chance.
if (b & 2)
- {
+ {
T f = T(0.2) + m_Rand.Frand01();
T g = T(0.2) + m_Rand.Frand01();
if (m_Rand.RandBit())
f = 1 / f;
-
+
if (m_Rand.RandBit())
g = f;
else
@@ -355,7 +355,7 @@ public:
}
if (b & 4)//16% chance.
- {
+ {
T f = m_Rand.Frand11();
T g = m_Rand.Frand11();
@@ -372,12 +372,12 @@ public:
T s = m_Rand.Frand01();
if (s < T(0.4))//Randomize xform color coords.
- {
+ {
ImproveColors(ember, 100, false, 10);
os << "mutate color coords";
}
else if (s < T(0.8))//Randomize xform color coords and palette.
- {
+ {
ImproveColors(ember, 25, true, 10);
os << "mutate color all";
}
@@ -412,7 +412,7 @@ public:
ember.DeleteTotalXform(nx);
}
else if (mode == MUTATE_ALL_COEFS)
- {
+ {
os << "mutate all coefs";
Random(mutation, useVars, sym, ember.TotalXformCount());
@@ -451,7 +451,7 @@ public:
if (crossMode == CROSS_NOT_SPECIFIED)
{
T s = m_Rand.Frand01();
-
+
if (s < 0.1)
crossMode = CROSS_UNION;
else if (s < 0.2)
@@ -494,29 +494,29 @@ public:
{
int got0, got1, usedParent;
string trystr;
-
+
//Each xform comes from a random parent, possible for an entire parent to be excluded.
do
{
got0 = got1 = 0;
rb = m_Rand.RandBit();
os << rb << ":";
-
+
//Copy the parent, sorting the final xform to the end if it's present.
emberOut = rb ? ember1 : ember0;
usedParent = rb;
-
+
//Only replace non-final xforms.
for (i = 0; i < emberOut.XformCount(); i++)
{
rb = m_Rand.RandBit();
-
+
//Replace xform if bit is 1.
if (rb == 1)
{
if (usedParent == 0)
{
- if (i < ember1.XformCount() && ember1.GetXform(i)->m_Weight > 0)
+ if (i < ember1.XformCount() && ember1.GetXform(i)->m_Weight > 0)
{
Xform* xform = emberOut.GetXform(i);
*xform = *ember1.GetXform(i);
@@ -555,14 +555,14 @@ public:
got0 = 1;
}
}
-
+
if (usedParent == 0 && ember0.UseFinalXform())
got0 = 1;
else if (usedParent == 1 && ember1.UseFinalXform())
got1 = 1;
-
+
} while ((i > 1) && !(got0 && got1));
-
+
os << "cross alternate ";
os << trystr;
}
@@ -574,15 +574,15 @@ public:
//emberOut.GetTotalXform(i)->m_ColorX = m_Rand.Frand01();//Do rand which gives better coloring but produces different results every time it's run.
//emberOut.GetTotalXform(i)->m_ColorY = ?????;//Will need to update this if 2D coordinates are ever supported.
}
-
+
//Potentially genetically cross the two palettes together.
if (m_Rand.Frand01() < T(0.4))
{
//Select the starting parent.
unsigned int ci, startParent = m_Rand.RandBit();
-
+
os << " cmap_cross " << startParent << ":";
-
+
//Loop over the entries, switching to the other parent 1% of the time.
for (ci = 0; ci < 256; ci++)//Will need to update this if 2D coordinates are ever supported.
{
@@ -653,7 +653,7 @@ public:
{
ember.AddXforms(xformDistrib[m_Rand.Rand() % Vlen(xformDistrib)]);
addfinal = m_Rand.Frand01() < T(0.15);//Add a final xform 15% of the time.
-
+
if (addfinal)
{
Xform xform;
@@ -661,14 +661,14 @@ public:
xform.m_Affine.A(T(1.1));//Just put something in there so it doesn't show up as being an empty final xform.
ember.SetFinalXform(xform);
}
- }
-
+ }
+
//If first input variation is -1 random choose one to use or decide to use multiple.
if (useVars.empty() || useVars[0] == -1)
var = m_Rand.RandBit() ? m_Rand.Rand() % varCount : -1;
else
var = -2;
-
+
samed = m_Rand.RandBit();
multid = m_Rand.RandBit();
postid = m_Rand.Frand01() < T(0.6);
@@ -734,7 +734,7 @@ public:
n = 2;
while (m_Rand.RandBit() && (n < varCount))
n++;
-
+
//Randomly choose n variations, and change their weights.
//A var can be selected more than once, further reducing
//the probability that multiple vars are used.
@@ -769,7 +769,7 @@ public:
if (m_Rand.RandBit())
n++;
-
+
//Randomly choose n variations, and change their weights.
//A var can be selected more than once, further reducing
//the probability that multiple vars are used.
@@ -786,7 +786,7 @@ public:
xform->AddVariation(m_VariationList.GetVariationCopy(useVars[m_Rand.Rand() % useVars.size()], m_Rand.Frand(T(0.001), 1)));
}
}
-
+
xform->NormalizeVariationWeights();//Normalize weights to 1.0 total.
}
@@ -822,7 +822,7 @@ public:
cout << "Error in TryColors(), skipping ImproveColors()" << endl;
return;
}
-
+
for (i = 0; i < tries; i++)
{
ChangeColors(ember, changePalette);
@@ -833,14 +833,14 @@ public:
cout << "Error in TryColors, aborting tries." << endl;
break;
}
-
+
if (b > best)
{
best = b;
bestEmber = ember;
}
}
-
+
ember = bestEmber;
}
@@ -857,13 +857,13 @@ public:
unsigned int pixTotal, res3 = res * res * res;
T scalar;
Ember adjustedEmber = ember;
-
+
adjustedEmber.m_Quality = 1;
adjustedEmber.m_Supersample = 1;
adjustedEmber.m_MaxRadDE = 0;
-
+
//Scale the image so that the total number of pixels is ~10,000.
- pixTotal = ember.m_FinalRasW * ember.m_FinalRasH;
+ pixTotal = ember.m_FinalRasW * ember.m_FinalRasH;
scalar = sqrt(T(10000) / pixTotal);
adjustedEmber.m_FinalRasW = (unsigned int)(ember.m_FinalRasW * scalar);
adjustedEmber.m_FinalRasH = (unsigned int)(ember.m_FinalRasH * scalar);
@@ -877,8 +877,8 @@ public:
m_Renderer->PixelAspectRatio(1);
m_Renderer->ThreadCount(Timing::ProcessorCount());
m_Renderer->SubBatchSize(10000);
- m_Renderer->Callback(NULL);
-
+ m_Renderer->Callback(nullptr);
+
if (m_Renderer->Run(m_FinalImage) != RENDER_OK)
{
cout << "Error rendering test image for TryColors(). Aborting." << endl;
@@ -919,7 +919,7 @@ public:
if (changePalette)
{
- Palette* palette;
+ Palette* palette = nullptr;
ember.m_Hue = 0.0;
@@ -942,16 +942,16 @@ public:
ember.GetTotalXform(i)->m_ColorX = m_Rand.Frand01();
ember.GetTotalXform(i)->m_ColorY = m_Rand.Frand01();
}
-
+
xform0 = RandomXform(ember, -1);
xform1 = RandomXform(ember, ember.GetXformIndex(xform0));
-
+
if (xform0 && (m_Rand.Rand() & 1))
{
xform0->m_ColorX = 0;
xform0->m_ColorY = 0;
}
-
+
if (xform1 && (m_Rand.Rand() & 1))
{
xform1->m_ColorX = 1;
@@ -965,7 +965,7 @@ public:
///
/// The ember to get a random xform from
/// Optionally exclude an xform. Pass -1 to include all for consideration.
- /// The random xform if successful, else NULL.
+ /// The random xform if successful, else nullptr.
Xform* RandomXform(Ember& ember, int excluded)
{
int ntries = 0;
@@ -983,7 +983,7 @@ public:
}
}
- return NULL;
+ return nullptr;
}
///
@@ -1007,7 +1007,7 @@ public:
if (!xform1->m_Motion.empty())
xform2->ApplyMotion(*xform1, blend);
-
+
xform2->DeleteMotionElements();
}
@@ -1033,7 +1033,7 @@ public:
for (si = 0; si < 2; si++)
{
prealign[si] = embers[si];
-
+
for (i = 0; i < embers[si].TotalXformCount(); i++)
{
Xform* xform = embers[si].GetTotalXform(i);
@@ -1042,7 +1042,7 @@ public:
xform->ApplyMotion(*(prealign[si].GetTotalXform(i)), blend);//Apply motion parameters to result.xform[i] using blend parameter.
}
}
-
+
//Use the un-padded original for blend=0 when creating a sequence.
//This keeps the original interpolation type intact.
if (seqFlag && blend == 0)
@@ -1053,17 +1053,17 @@ public:
{
//Align what's going to be interpolated.
Interpolater::Align(prealign, spun, 2);
-
+
spun[0].m_Time = 0;
spun[1].m_Time = 1;
-
+
//Call this first to establish the asymmetric reference angles.
Interpolater::AsymmetricRefAngles(spun, 2);
-
+
//Rotate the aligned xforms.
spun[0].RotateAffines(-blend * 360);
spun[1].RotateAffines(-blend * 360);
-
+
Interpolater::Interpolate(spun, 2, m_Smooth ? Interpolater::Smoother(blend) : blend, m_Stagger, result);
}
@@ -1078,7 +1078,7 @@ public:
/// Apply subpixel jitter to center using offset members.
///
/// The ember to spin
- /// The template to apply if not NULL, else ignore.
+ /// The template to apply if not nullptr, else ignore.
/// The result of the spin
/// The frame in the sequence to be stored in the m_Time member of result
/// The interpolation time
@@ -1101,7 +1101,7 @@ public:
//Create the edit doc xml.
sprintf_s(temp, 50, "rotate %g", blend * 360.0);
result.ClearEdit();
- result.m_Edits = m_EmberToXml.CreateNewEditdoc(&parent, NULL, temp, m_Nick, m_Url, m_Id, m_Comment, m_SheepGen, m_SheepId);
+ result.m_Edits = m_EmberToXml.CreateNewEditdoc(&parent, nullptr, temp, m_Nick, m_Url, m_Id, m_Comment, m_SheepGen, m_SheepId);
//Subpixel jitter.
Offset(result, m_OffsetX, m_OffsetY);
@@ -1118,7 +1118,7 @@ public:
/// Apply subpixel jitter to center using offset members.
///
/// The embers to interpolate
- /// The template to apply if not NULL, else ignore.
+ /// The template to apply if not nullptr, else ignore.
/// The result of the spin
/// The frame in the sequence to be stored in the m_Time member of result
/// True if embers points to the first or last ember in the entire sequence, else false.
@@ -1131,7 +1131,7 @@ public:
Edge(parents, result, blend, seqFlag);
//Original did an interpolated palette hack here for random palettes, but it was never used anywhere so ember omits it.//ORIG
-
+
//Apply the template if necessary.
if (templ)
ApplyTemplate(result, *templ);
@@ -1166,68 +1166,68 @@ public:
if (templ.m_Zoom < 999999998)
ember.m_Zoom = templ.m_Zoom;
-
+
if (templ.m_Supersample > 0)
ember.m_Supersample = templ.m_Supersample;
-
+
if (templ.m_SpatialFilterRadius >= 0)
ember.m_SpatialFilterRadius = templ.m_SpatialFilterRadius;
-
+
if (templ.m_Quality > 0)
ember.m_Quality = templ.m_Quality;
-
+
if (templ.m_Passes > 0)
ember.m_Passes = templ.m_Passes;
-
+
if (templ.m_TemporalSamples > 0)
ember.m_TemporalSamples = templ.m_TemporalSamples;
-
+
if (templ.m_FinalRasW > 0)
{
//Preserving scale should be an option.
ember.m_PixelsPerUnit = ember.m_PixelsPerUnit * templ.m_FinalRasW / ember.m_FinalRasW;
ember.m_FinalRasW = templ.m_FinalRasW;
}
-
+
if (templ.m_FinalRasH > 0)
ember.m_FinalRasH = templ.m_FinalRasH;
-
+
if (templ.m_MaxRadDE >= 0)
ember.m_MaxRadDE = templ.m_MaxRadDE;
-
+
if (templ.m_MinRadDE >= 0)
ember.m_MinRadDE = templ.m_MinRadDE;
-
+
if (templ.m_CurveDE >= 0)
ember.m_CurveDE = templ.m_CurveDE;
-
+
if (templ.m_GammaThresh >= 0)
ember.m_GammaThresh = templ.m_GammaThresh;
-
+
if (templ.m_Passes > 0)
ember.m_Passes = templ.m_Passes;
-
+
if (templ.m_SpatialFilterType > 0)
ember.m_SpatialFilterType = templ.m_SpatialFilterType;
-
+
if (templ.m_Interp >= 0)
ember.m_Interp = templ.m_Interp;
-
+
if (templ.m_AffineInterp >= 0)
ember.m_AffineInterp = templ.m_AffineInterp;
-
+
if (templ.m_TemporalFilterType >= 0)
ember.m_TemporalFilterType = templ.m_TemporalFilterType;
-
+
if (templ.m_TemporalFilterWidth > 0)
ember.m_TemporalFilterWidth = templ.m_TemporalFilterWidth;
-
+
if (templ.m_TemporalFilterExp > -900)
ember.m_TemporalFilterExp = templ.m_TemporalFilterExp;
-
+
if (templ.m_HighlightPower >= 0)
ember.m_HighlightPower = templ.m_HighlightPower;
-
+
if (templ.m_PaletteMode >= 0)
ember.m_PaletteMode = templ.m_PaletteMode;
}
@@ -1261,7 +1261,7 @@ public:
T th = by * 2 * T(M_PI) / 360;
T c = cos(th);
T s = -sin(th);
-
+
newCenterX -= oldCenterX;
newCenterY -= oldCenterY;
r[0] = c * newCenterX - s * newCenterY;
@@ -1269,7 +1269,7 @@ public:
newCenterX = r[0] + oldCenterX;
newCenterY = r[1] + oldCenterY;
}
-
+
///
/// Find a 2D bounding box that does not enclose eps of the fractal density in each compass direction.
/// This will run the inner loops of iteration without all of the surrounding interpolation and filtering.
@@ -1297,7 +1297,7 @@ public:
if (bv / T(samples) > eps)
eps = 3 * bv / T(samples);
-
+
if (eps > T(0.3))
eps = T(0.3);
@@ -1384,11 +1384,11 @@ private:
vector m_Hist;
EmberToXml m_EmberToXml;
Iterator* m_Iterator;
- auto_ptr> m_StandardIterator;
- auto_ptr> m_XaosIterator;
- auto_ptr> m_Renderer;
+ unique_ptr> m_StandardIterator;
+ unique_ptr> m_XaosIterator;
+ unique_ptr> m_Renderer;
QTIsaac m_Rand;
PaletteList m_PaletteList;
VariationList m_VariationList;
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/SpatialFilter.h b/Source/Ember/SpatialFilter.h
index 65a4011..e4cd30f 100644
--- a/Source/Ember/SpatialFilter.h
+++ b/Source/Ember/SpatialFilter.h
@@ -89,7 +89,7 @@ public:
{
m_FinalFilterWidth = filter.m_FinalFilterWidth;
m_Supersample = filter.m_Supersample;
- m_Support = filter.m_Support;
+ m_Support = filter.m_Support;
m_FilterRadius = filter.m_FilterRadius;
m_PixelAspectRatio = filter.m_PixelAspectRatio;
m_FilterType = filter.m_FilterType;
@@ -107,7 +107,7 @@ public:
{
T fw = T(2.0) * m_Support * m_Supersample * m_FilterRadius / m_PixelAspectRatio;
T adjust, ii, jj;
-
+
int fwidth = ((int)fw) + 1;
int i, j;
@@ -283,7 +283,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
HermiteFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(HERMITE_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Hermite filter to t parameter and return.
/// f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1.
@@ -318,7 +318,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
BoxFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(BOX_SPATIAL_FILTER, T(0.5), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Box filter to t parameter and return.
///
@@ -349,7 +349,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
TriangleFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(TRIANGLE_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Triangle filter to t parameter and return.
///
@@ -383,7 +383,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
BellFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(BELL_SPATIAL_FILTER, T(1.5), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Bell filter to t parameter and return.
///
@@ -392,7 +392,7 @@ public:
virtual T Filter(T t) const
{
//box (*) box (*) box.
- if (t < 0)
+ if (t < 0)
t = -t;
if (t < T(0.5))
@@ -424,7 +424,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
BsplineFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(BSPLINE_SPATIAL_FILTER, T(2.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply B Spline filter to t parameter and return.
///
@@ -467,9 +467,9 @@ public:
/// The filter radius
/// The supersample of the ember being rendered
/// The pixel aspect ratio being used to render. Default: 1.
- Lanczos3Filter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
+ Lanczos3Filter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(LANCZOS3_SPATIAL_FILTER, T(3.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Lanczos 3 filter to t parameter and return.
///
@@ -503,7 +503,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
Lanczos2Filter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(LANCZOS2_SPATIAL_FILTER, T(2.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Lanczos 2 filter to t parameter and return.
///
@@ -537,7 +537,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
MitchellFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(MITCHELL_SPATIAL_FILTER, T(2.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Mitchell filter to t parameter and return.
///
@@ -590,7 +590,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
BlackmanFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(BLACKMAN_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Blackman filter to t parameter and return.
///
@@ -618,7 +618,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
CatromFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(CATROM_SPATIAL_FILTER, T(2.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Catmull-Rom filter to t parameter and return.
///
@@ -661,7 +661,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
HammingFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(HAMMING_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Hamming filter to t parameter and return.
///
@@ -689,7 +689,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
HanningFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(HANNING_SPATIAL_FILTER, T(1.0), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Hanning filter to t parameter and return.
///
@@ -717,7 +717,7 @@ public:
/// The pixel aspect ratio being used to render. Default: 1.
QuadraticFilter(T filterRadius, unsigned int superSample, T pixelAspectRatio = T(1.0))
: SpatialFilter(QUADRATIC_SPATIAL_FILTER, T(1.5), filterRadius, superSample, pixelAspectRatio) { }
-
+
///
/// Apply Quadratic filter to t parameter and return.
///
@@ -758,7 +758,7 @@ public:
/// A pointer to the newly created filter object
static SpatialFilter* Create(eSpatialFilterType filterType, T filterRadius, unsigned int superSample, T pixelAspectRatio = 1)
{
- SpatialFilter* filter = NULL;
+ SpatialFilter* filter = nullptr;
if (filterType == GAUSSIAN_SPATIAL_FILTER)
filter = new GaussianFilter(filterRadius, superSample, pixelAspectRatio);
@@ -906,4 +906,4 @@ public:
return filter;
}
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/TemporalFilter.h b/Source/Ember/TemporalFilter.h
index 1c69190..03ba26b 100644
--- a/Source/Ember/TemporalFilter.h
+++ b/Source/Ember/TemporalFilter.h
@@ -72,7 +72,7 @@ public:
m_Deltas[i] = (T(i) / T(steps - 1) - T(0.5)) * filterWidth;
}
}
-
+
///
/// Copy constructor.
///
@@ -141,7 +141,7 @@ public:
return ss.str();
}
-
+
///
/// Accessors.
///
@@ -169,7 +169,7 @@ protected:
m_Filter[i] /= maxFilt;
m_SumFilt += m_Filter[i];
}
-
+
m_SumFilt /= Size();
}
@@ -214,7 +214,7 @@ public:
//Scale the color based on these values.
m_Filter[i] = pow(slpx, fabs(filterExp));
-
+
//Keep the max.
if (m_Filter[i] > maxFilt)
maxFilt = m_Filter[i];
@@ -251,7 +251,7 @@ public:
for (unsigned int i = 0; i < Size(); i++)
{
m_Filter[i] = gaussian.Filter(gaussian.Support() * fabs(i - halfSteps) / halfSteps);
-
+
//Keep the max.
if (m_Filter[i] > maxFilt)
maxFilt = m_Filter[i];
@@ -283,7 +283,7 @@ public:
{
for (unsigned int i = 0; i < Size(); i++)
m_Filter[i] = 1;
-
+
FinishFilter(1);
}
}
@@ -307,7 +307,7 @@ public:
/// A pointer to the newly created filter object
static TemporalFilter* Create(eTemporalFilterType filterType, unsigned int passes, unsigned int temporalSamples, T filterWidth, T filterExp = 1)
{
- TemporalFilter* filter = NULL;
+ TemporalFilter* filter = nullptr;
if (filterType == BOX_TEMPORAL_FILTER)
filter = new BoxTemporalFilter(passes, temporalSamples, filterWidth);
@@ -375,4 +375,4 @@ public:
return filter;
}
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/Timing.h b/Source/Ember/Timing.h
index 8790a96..d6de627 100644
--- a/Source/Ember/Timing.h
+++ b/Source/Ember/Timing.h
@@ -42,15 +42,15 @@ public:
///
/// Set the end time and optionally output a string showing the elapsed time.
///
- /// The string to output. Default: NULL.
+ /// The string to output. Default: nullptr.
/// If true, output the string verbatim, else output the text " processing time: " in between str and the formatted time.
/// The elapsed time in milliseconds as a double
- double Toc(const char* str = NULL, bool fullString = false)
+ double Toc(const char* str = nullptr, bool fullString = false)
{
m_EndTime = Clock::now();
double ms = ElapsedTime();
- if (str != NULL)
+ if (str != nullptr)
{
cout << string(str) << (fullString ? "" : " processing time: ") << Format(ms) << endl;
}
diff --git a/Source/Ember/Utils.h b/Source/Ember/Utils.h
index 8f4b9fb..18dcd9b 100644
--- a/Source/Ember/Utils.h
+++ b/Source/Ember/Utils.h
@@ -40,6 +40,14 @@ static inline void ForEach(c& container, fn func)
class EMBER_API EmberImageComments
{
public:
+ ///
+ /// Empty destructor.
+ /// Needed to eliminate warnings about inlining.
+ ///
+ ~EmberImageComments()
+ {
+ }
+
///
/// Set all values to the empty string.
///
@@ -68,6 +76,11 @@ public:
class EMBER_API EmberReport
{
public:
+ ///
+ /// Virtual destructor needed for virtual classes.
+ ///
+ virtual ~EmberReport() { }
+
///
/// Write the entire error report as a single string to the console.
/// Derived classes with members that also derive from EmberReport should override this to capture
@@ -144,13 +157,13 @@ protected:
static bool ReadFile(const char* filename, string& buf, bool nullTerminate = true)
{
bool b = false;
- FILE* f;
+ FILE* f = nullptr;
try
{
fopen_s(&f, filename, "rb");//Open in binary mode.
- if (f != NULL)
+ if (f != nullptr)
{
struct _stat statBuf;
@@ -162,15 +175,15 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
if (statResult == 0)//Check if statistics are valid.
{
- buf.resize(statBuf.st_size + (nullTerminate ? 1 : 0));//Allocate vector to be the size of the entire file, with an optional additional character for NULL.
+ buf.resize(statBuf.st_size + (nullTerminate ? 1 : 0));//Allocate vector to be the size of the entire file, with an optional additional character for nullptr.
- if (buf.size() == statBuf.st_size + 1)//Ensure allocation succeeded.
+ if (buf.size() == (size_t)(statBuf.st_size + 1))//Ensure allocation succeeded.
{
size_t bytesRead = fread(&buf[0], 1, statBuf.st_size, f);//Read the entire file at once.
- if (bytesRead == statBuf.st_size)//Ensure the number of bytes read matched what was requested.
+ if (bytesRead == (size_t)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.
+ if (nullTerminate)//Optionally nullptr terminate if they want to treat it as a string.
buf[buf.size() - 1] = 0;
b = true;//Success.
@@ -183,7 +196,7 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
}
catch (...)
{
- if (f != NULL)
+ if (f != nullptr)
fclose(f);
b = false;
@@ -209,7 +222,7 @@ static void CopyVec(vector& dest, const vector& source)
}
///
-/// Clear a vector of pointers to any type by checking each element for NULL and calling delete on it, then clearing the entire vector.
+/// Clear a vector of pointers to any type by checking each element for nullptr and calling delete on it, then clearing the entire vector.
/// Optionally call array delete if the elements themselves are pointers to dynamically allocated arrays.
///
/// The vector to be cleared
@@ -219,7 +232,7 @@ static void ClearVec(vector& vec, bool arrayDelete = false)
{
for (unsigned int i = 0; i < vec.size(); i++)
{
- if (vec[i] != NULL)
+ if (vec[i] != nullptr)
{
if (arrayDelete)
delete [] vec[i];
@@ -227,31 +240,12 @@ static void ClearVec(vector& vec, bool arrayDelete = false)
delete vec[i];
}
- vec[i] = NULL;
+ vec[i] = nullptr;
}
vec.clear();
}
-///
-/// Convert an RGBA buffer to an RGB buffer.
-///
-/// The RGBA buffer
-/// The RGB buffer
-/// The width of the image in pixels
-/// The height of the image in pixels
-static void RgbaToRgb(vector& rgba, vector& rgb, unsigned int width, unsigned int height)
-{
- rgb.resize(width * height * 3);
-
- for (unsigned int i = 0, j = 0; i < (width * height * 4); i += 4, j += 3)
- {
- rgb[j] = rgba[i];
- rgb[j + 1] = rgba[i + 1];
- rgb[j + 2] = rgba[i + 2];
- }
-}
-
///
/// 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.
@@ -737,7 +731,7 @@ static inline T NormalizeDeg360(T angle)
///
/// The string to copy and make lower case
/// The lower case string
-static inline string ToLower(const string& str)
+static string ToLower(const string& str)
{
string lower;
@@ -751,7 +745,7 @@ static inline string ToLower(const string& str)
///
/// The string to copy and make upper case
/// The upper case string
-static inline string ToUpper(const string& str)
+static string ToUpper(const string& str)
{
string upper;
@@ -767,7 +761,7 @@ static inline string ToUpper(const string& str)
/// The string to trim
/// The character to trim. Default: space.
/// The trimmed string
-static inline string Trim(string& str, char ch = ' ')
+static string Trim(string& str, char ch = ' ')
{
string ret;
@@ -817,8 +811,8 @@ int Arg(char* name, int def)
{
char* ch;
int returnVal;
- size_t len;
#ifdef WIN32
+ size_t len;
errno_t err = _dupenv_s(&ch, &len, name);
#else
int err = 1;
@@ -880,8 +874,8 @@ double Arg(char* name, double def)
{
char* ch;
double returnVal;
- size_t len;
#ifdef WIN32
+ size_t len;
errno_t err = _dupenv_s(&ch, &len, name);
#else
int err = 1;
@@ -913,8 +907,8 @@ string Arg(char* name, string def)
{
char* ch;
string returnVal;
- size_t len;
#ifdef WIN32
+ size_t len;
errno_t err = _dupenv_s(&ch, &len, name);
#else
int err = 1;
diff --git a/Source/Ember/Variation.h b/Source/Ember/Variation.h
index be292d8..3a41b20 100644
--- a/Source/Ember/Variation.h
+++ b/Source/Ember/Variation.h
@@ -1009,7 +1009,7 @@ public:
bool needPrecalcAtanYX = false)
: m_Name(name)//Omit unnecessary default constructor call.
{
- m_Xform = NULL;
+ m_Xform = nullptr;
m_VariationId = id;
m_Weight = weight;
m_NeedPrecalcSumSquares = needPrecalcSumSquares;
@@ -1085,7 +1085,7 @@ public:
m_AssignType = variation.AssignType();
m_VariationId = variation.VariationId();
m_Weight = T(variation.m_Weight);
- m_Xform = typeid(T) == typeid(U) ? (Xform*)variation.ParentXform() : NULL;
+ m_Xform = typeid(T) == typeid(U) ? (Xform*)variation.ParentXform() : nullptr;
m_NeedPrecalcSumSquares = variation.NeedPrecalcSumSquares();
m_NeedPrecalcSqrtSumSquares = variation.NeedPrecalcSqrtSumSquares();
m_NeedPrecalcAngles = variation.NeedPrecalcAngles();
@@ -1403,7 +1403,7 @@ public:
///
ParamWithName()
{
- Init(NULL, "", 0, REAL, TLOW, TMAX);
+ Init(nullptr, "", 0, REAL, TLOW, TMAX);
}
///
@@ -1541,6 +1541,7 @@ public:
}
case INTEGER_NONZERO :
+ default:
{
int vi = (int)max(min((T)Floor(val + T(0.5)), m_Max), m_Min);
@@ -1660,6 +1661,14 @@ public:
m_Params.reserve(5);
}
+ ///
+ /// Empty virtual destructor.
+ /// Needed to eliminate warnings about inlining.
+ ///
+ virtual ~ParametricVariation()
+ {
+ }
+
///
/// Determine whether the params vector contains a parameter with the specified name.
///
@@ -1689,7 +1698,7 @@ public:
if (!_stricmp(m_Params[i].Name().c_str(), name))
return m_Params[i].Param();
- return NULL;
+ return nullptr;
}
///
@@ -1857,13 +1866,11 @@ protected:
using Variation::XformIndexInEmber; \
using Variation::Prefix;
- //using Variation::Precalc; \
-
#ifdef DO_DOUBLE
#define VARCOPYDOUBLE(name) \
virtual void Copy(Variation*& var) const override \
{ \
- if (var != NULL) \
+ if (var != nullptr) \
delete var; \
\
var = new name(*this); \
@@ -1894,7 +1901,7 @@ protected:
\
virtual void Copy(Variation*& var) const override \
{ \
- if (var != NULL) \
+ if (var != nullptr) \
delete var; \
\
var = new name(*this); \
@@ -1921,7 +1928,7 @@ protected:
\
virtual void Copy(Variation*& var) const override \
{ \
- if (var != NULL) \
+ if (var != nullptr) \
delete var; \
\
var = new name(*this); \
@@ -1981,8 +1988,6 @@ protected:
using ParametricVariation::m_Params; \
using ParametricVariation::CopyParamVals;
- //using Variation::Precalc; \
-
#define PARVARCOPY(name) \
VARUSINGS \
PARVARUSINGS \
@@ -2009,7 +2014,7 @@ protected:
\
virtual void Copy(Variation*& var) const override \
{ \
- if (var != NULL) \
+ if (var != nullptr) \
delete var; \
\
var = new name(*this); \
@@ -2040,7 +2045,7 @@ protected:
\
virtual void Copy(Variation*& var) const override \
{ \
- if (var != NULL) \
+ if (var != nullptr) \
delete var; \
\
var = new name(*this); \
diff --git a/Source/Ember/VariationList.h b/Source/Ember/VariationList.h
index 951e0c0..01042c5 100644
--- a/Source/Ember/VariationList.h
+++ b/Source/Ember/VariationList.h
@@ -374,25 +374,25 @@ public:
/// Get a pointer to the variation at the specified index.
///
/// The index in the list to retrieve
- /// A pointer to the variation at the index if in range, else NULL.
- Variation* GetVariation(size_t index) { return index < m_Variations.size() ? m_Variations[index] : NULL; }
+ /// A pointer to the variation at the index if in range, else nullptr.
+ Variation* GetVariation(size_t index) { return index < m_Variations.size() ? m_Variations[index] : nullptr; }
///
/// Get a pointer to the variation of a specified type at the specified index.
///
/// The index in the list to retrieve
/// The type of variation to retrieve
- /// A pointer to the variation of the specified type at the index if in range, else NULL.
+ /// A pointer to the variation of the specified type at the index if in range, else nullptr.
Variation* GetVariation(size_t index, eVariationType varType)
{
if (varType == VARTYPE_REG)
- return index < m_RegVariations.size() ? m_RegVariations[index] : NULL;
+ return index < m_RegVariations.size() ? m_RegVariations[index] : nullptr;
else if (varType == VARTYPE_PRE)
- return index < m_PreVariations.size() ? m_PreVariations[index] : NULL;
+ return index < m_PreVariations.size() ? m_PreVariations[index] : nullptr;
else if (varType == VARTYPE_POST)
- return index < m_PostVariations.size() ? m_PostVariations[index] : NULL;
+ return index < m_PostVariations.size() ? m_PostVariations[index] : nullptr;
else
- return NULL;
+ return nullptr;
}
///
@@ -401,7 +401,7 @@ public:
///
/// The index in the list to make a copy of
/// The weight to assign the new copy. Default: 1
- /// A pointer to the variation at the index if in range, else NULL.
+ /// A pointer to the variation at the index if in range, else nullptr.
Variation* GetVariationCopy(size_t index, T weight = 1) { return MakeCopyWithWeight(GetVariation(index), weight); }
Variation* GetVariationCopy(size_t index, eVariationType varType, T weight = 1) { return MakeCopyWithWeight(GetVariation(index, varType), weight); }
@@ -409,14 +409,14 @@ public:
/// Get a pointer to the variation with the specified ID.
///
/// The ID to search for
- /// A pointer to the variation if found, else NULL.
+ /// A pointer to the variation if found, else nullptr.
Variation* GetVariation(eVariationId id)
{
- for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != NULL; i++)
+ for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
if (id == m_Variations[i]->VariationId())
return m_Variations[i];
- return NULL;
+ return nullptr;
}
///
@@ -425,21 +425,21 @@ public:
///
/// The id of the variation in the list to make a copy of
/// The weight to assign the new copy. Default: 1
- /// A pointer to the variation with a matching ID, else NULL.
+ /// A pointer to the variation with a matching ID, else nullptr.
Variation* GetVariationCopy(eVariationId id, T weight = 1) { return MakeCopyWithWeight(GetVariation(id), weight); }
///
/// Get a pointer to the variation with the specified name.
///
/// The name to search for
- /// A pointer to the variation if found, else NULL.
- Variation* GetVariation(string name)
+ /// A pointer to the variation if found, else nullptr.
+ Variation* GetVariation(string& name)
{
- for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != NULL; i++)
+ for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
return m_Variations[i];
-
- return NULL;
+
+ return nullptr;
}
///
@@ -448,7 +448,7 @@ public:
///
/// The name of the variation in the list to make a copy of
/// The weight to assign the new copy. Default: 1
- /// A pointer to the variation with a matching name, else NULL.
+ /// A pointer to the variation with a matching name, else nullptr.
Variation* GetVariationCopy(string name, T weight = 1) { return MakeCopyWithWeight(GetVariation(name), weight); }
///
@@ -456,21 +456,21 @@ public:
/// Note this is the index in the parametric variations list, not in the master list.
///
/// The index in the parametric variations list to retrieve
- /// The parametric variation at the index specified if in range, else NULL.
- ParametricVariation* GetParametricVariation(size_t index) { return index < m_ParametricVariations.size() ? m_ParametricVariations[index] : NULL; }
-
+ /// The parametric variation at the index specified if in range, else nullptr.
+ ParametricVariation* GetParametricVariation(size_t index) { return index < m_ParametricVariations.size() ? m_ParametricVariations[index] : nullptr; }
+
///
/// Get a parametric variation with the specified name.
///
/// The name of the variation in the parametric variations list to retrieve
- /// The parametric variation with a matching name, else NULL.
+ /// The parametric variation with a matching name, else nullptr.
ParametricVariation* GetParametricVariation(string name)
{
- for (unsigned int i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != NULL; i++)
+ for (unsigned int i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != nullptr; i++)
if (!_stricmp(name.c_str(), m_ParametricVariations[i]->Name().c_str()))
return m_ParametricVariations[i];
-
- return NULL;
+
+ return nullptr;
}
///
@@ -480,10 +480,10 @@ public:
/// The index of the variation with the matching name, else -1
int GetVariationIndex(string name)
{
- for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != NULL; i++)
+ for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
return i;
-
+
return -1;
}
@@ -503,7 +503,7 @@ private:
///
/// The variation to copy
/// The weight to assign it
- /// A pointer to the new variation copy if success, else NULL.
+ /// A pointer to the new variation copy if success, else nullptr.
Variation* MakeCopyWithWeight(Variation* var, T weight)
{
if (var)
@@ -514,7 +514,7 @@ private:
return var2;
}
- return NULL;
+ return nullptr;
}
///
@@ -534,4 +534,4 @@ private:
vector*> m_PostVariations;
vector*> m_ParametricVariations;//A list of pointers to elements in m_Variations which are derived from ParametricVariation.
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/Variations01.h b/Source/Ember/Variations01.h
index 41c8471..6b0f0d4 100644
--- a/Source/Ember/Variations01.h
+++ b/Source/Ember/Variations01.h
@@ -727,7 +727,7 @@ public:
virtual void Precalc() override
{
- if (m_Xform)//If this variation exists by itself and hasn't been added to an xform yet, m_Xform will be NULL.
+ if (m_Xform)//If this variation exists by itself and hasn't been added to an xform yet, m_Xform will be nullptr.
{
T dx = m_Xform->m_Affine.C();
T dy = m_Xform->m_Affine.F();
@@ -4674,7 +4674,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string invWeight = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
diff --git a/Source/Ember/Variations02.h b/Source/Ember/Variations02.h
index 1ca2172..be0843f 100644
--- a/Source/Ember/Variations02.h
+++ b/Source/Ember/Variations02.h
@@ -347,7 +347,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
@@ -1925,7 +1925,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string repeat = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@@ -4435,7 +4435,6 @@ public:
{
T c0 = helper.In.x * m_Vpi;
T c1 = helper.In.y * m_Vpi;
- T c2 = helper.In.z * m_Vpi;
T sinc0, cosc0, sinc1, cosc1;
sincos(c0, &sinc0, &cosc0);
@@ -4449,7 +4448,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string zscale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@@ -4458,7 +4457,6 @@ public:
ss << "\t{\n"
<< "\t\treal_t c0 = vIn.x * " << vpi << ";\n"
<< "\t\treal_t c1 = vIn.y * " << vpi << ";\n"
- << "\t\treal_t c2 = vIn.z * " << vpi << ";\n"
<< "\n"
<< "\t\treal_t sinc0 = sin(c0);\n"
<< "\t\treal_t cosc0 = cos(c0);\n"
diff --git a/Source/Ember/Variations03.h b/Source/Ember/Variations03.h
index 6f3f4de..4f50bb3 100644
--- a/Source/Ember/Variations03.h
+++ b/Source/Ember/Variations03.h
@@ -1964,7 +1964,6 @@ public:
{
T sinX = sin(helper.In.x);
T cosX = cos(helper.In.x);
- T sinY = sin(helper.In.y);
T cosY = cos(helper.In.y);
T bx = Cube(cosX*cosY);
T by = Cube(sinX*cosY);
diff --git a/Source/Ember/Variations04.h b/Source/Ember/Variations04.h
index 26ca9cd..bc7ba18 100644
--- a/Source/Ember/Variations04.h
+++ b/Source/Ember/Variations04.h
@@ -698,7 +698,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rxSin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@@ -783,7 +783,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rySin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@@ -865,7 +865,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rzSin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@@ -1549,6 +1549,7 @@ public:
r = (rand.Rand((ISAAC_INT)m_Slices) + m_YThickness + rand.Frand01() * (1 - m_YThickness)) / m_Slices;
break;
case 4:
+ default:
a = (rand.Rand((ISAAC_INT)m_Slices) + m_XThickness + rand.Frand01() * (1 - m_XThickness)) / m_Slices;
r = rand.Frand01();
break;
@@ -1562,7 +1563,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string slices = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@@ -2830,7 +2831,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string thetaPeriod = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@@ -3209,7 +3210,7 @@ public:
T c = cos(absV);
T sh = sinh(helper.In.x);
T ch = cosh(helper.In.x);
- T d = m_Weight * c * sh / absV;
+ T d = m_Weight * ch * s / absV;
helper.Out.x = m_Weight * sh * c;
helper.Out.y = d * helper.In.y;
@@ -3227,7 +3228,7 @@ public:
<< "\t\treal_t c = cos(absV);\n"
<< "\t\treal_t sh = sinh(vIn.x);\n"
<< "\t\treal_t ch = cosh(vIn.x);\n"
- << "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] * c * sh / absV;\n"
+ << "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] * ch * s / absV;\n"
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sh * c;\n"
<< "\t\tvOut.y = d * vIn.y;\n"
@@ -4238,7 +4239,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string extended = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
diff --git a/Source/Ember/Variations05.h b/Source/Ember/Variations05.h
index aa5d4d4..d3232dc 100644
--- a/Source/Ember/Variations05.h
+++ b/Source/Ember/Variations05.h
@@ -658,6 +658,7 @@ public:
helper.Out.z = ((pz - (m_Smooth * (1 - m_Fill) * pz * znxy)) + (helper.In.z * m_Smooth * m_Fill * znxy)) - lattd;
break;
case 7 :
+ default:
helper.Out.x = ((px - (m_Smooth * (1 - m_Fill) * px * exnze)) + (helper.In.x * m_Smooth * m_Fill * exnze)) - lattd;
helper.Out.y = ((py - (m_Smooth * (1 - m_Fill) * py * wynze)) + (helper.In.y * m_Smooth * m_Fill * wynze)) - lattd;
helper.Out.z = ((pz - (m_Smooth * (1 - m_Fill) * pz * znxy)) + (helper.In.z * m_Smooth * m_Fill * znxy)) - lattd;
@@ -888,6 +889,7 @@ public:
helper.Out.z = pztz * m_Fill * znxy - lattd;
break;
case 7 :
+ default:
helper.Out.x = pxtx * m_Fill * exnze - lattd;
helper.Out.y = pyty * m_Fill * wynze - lattd;
helper.Out.z = pztz * m_Fill * znxy - lattd;
@@ -1078,7 +1080,6 @@ public:
T ww = SQR(helper.In.z);
T atOmegaX = atan2(vv, ww);
T atOmegaY = atan2(uu, ww);
- T atOmegaZ = atan2(vv, uu);
T su = sin(helper.In.x);
T cu = cos(helper.In.x);
T sv = sin(helper.In.y);
@@ -1110,7 +1111,6 @@ public:
<< "\t\treal_t ww = SQR(vIn.z);\n"
<< "\t\treal_t atOmegaX = atan2(vv, ww);\n"
<< "\t\treal_t atOmegaY = atan2(uu, ww);\n"
- << "\t\treal_t atOmegaZ = atan2(vv, uu);\n"
<< "\t\treal_t su = sin(vIn.x);\n"
<< "\t\treal_t cu = cos(vIn.x);\n"
<< "\t\treal_t sv = sin(vIn.y);\n"
@@ -1334,7 +1334,6 @@ public:
virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override
{
- T rmod = rand.Frand01() * T(0.5) + T(0.125);
T kikr = helper.m_PrecalcAtanyx;
T efTez = helper.In.z == 0 ? kikr : helper.In.z;
T r2 = helper.m_PrecalcSumSquares + SQR(efTez);
@@ -1364,7 +1363,6 @@ public:
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"
<< "\t\treal_t efTez = vIn.z == 0 ? kikr : vIn.z;\n"
<< "\t\treal_t r2 = precalcSumSquares + SQR(efTez);\n"
@@ -1644,7 +1642,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@@ -1780,7 +1778,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string invWeight = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@@ -2149,6 +2147,7 @@ public:
helper.Out.z = m_Weight * (rad * sigmas);
break;
case 2://Box.
+ default:
scale = Clamp(rs, 0, T(0.9)) + T(0.1);
denom = 1 / scale;
helper.Out.x = m_Weight * Lerp(helper.In.x, floor(helper.In.x * denom) + scale * ax, m_MulX * rs) + m_MulX * pow(ax, m_BoxPow) * rs * denom;//m_BoxPow should be an integer value held in T,
@@ -2318,6 +2317,7 @@ public:
}
break;
case 2://Gaussian.
+ default:
{
const T sigma = dist * random.y * M_2PI;
const T phi = dist * random.z * T(M_PI);
@@ -2339,7 +2339,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string scatter = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@@ -2483,6 +2483,7 @@ public:
radius = sqrt(Sqr(helper.In.x - m_CenterX) + Sqr(helper.In.y - m_CenterY) + Sqr(helper.In.z - m_CenterZ));
break;
case 1://Square.
+ default:
radius = max(fabs(helper.In.x - m_CenterX), max(fabs(helper.In.y - m_CenterY), (fabs(helper.In.z - m_CenterZ))));//Original called a macro named min, which internally performed max.
break;
}
@@ -2532,6 +2533,7 @@ public:
}
break;
case 2://Log.
+ default:
{
const T coeff = m_RMax <= EPS ? dist : dist + m_Alpha * (LogMap(dist) - dist);
@@ -2547,7 +2549,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
- int i = 0, varIndex = IndexInXform();
+ int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string blurType = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
diff --git a/Source/Ember/VariationsDC.h b/Source/Ember/VariationsDC.h
index 571b221..1bb7ede 100644
--- a/Source/Ember/VariationsDC.h
+++ b/Source/Ember/VariationsDC.h
@@ -211,6 +211,7 @@ public:
break;
case 2:
+ default:
x = m_Weight * p;
y = m_Weight * q;
z = m_Weight * (j ? -1 : 1);
diff --git a/Source/Ember/Xform.h b/Source/Ember/Xform.h
index 623c319..0be6d64 100644
--- a/Source/Ember/Xform.h
+++ b/Source/Ember/Xform.h
@@ -68,7 +68,7 @@ public:
T pe = 1,
T pc = 0,
T pf = 0)
-
+
{
Init();
@@ -101,7 +101,7 @@ public:
///
/// The Xform object to copy
Xform(const Xform& xform)
- : m_ParentEmber(NULL)//Hack.
+ : m_ParentEmber(nullptr)//Hack.
{
Xform::operator=(xform);
}
@@ -112,7 +112,7 @@ public:
/// The Xform object to copy
template
Xform(const Xform& xform)
- : m_ParentEmber(NULL)//Hack.
+ : m_ParentEmber(nullptr)//Hack.
{
Xform::operator=(xform);
}
@@ -171,8 +171,8 @@ public:
//the variation's m_IndexInXform member gets properly set to this.
for (unsigned int i = 0; i < xform.TotalVariationCount(); i++)
{
- Variation* var = NULL;
-
+ Variation* var = nullptr;
+
if (Variation* varOrig = xform.GetVariation(i))
{
varOrig->Copy(var);//Will convert from type U to type T.
@@ -236,7 +236,7 @@ public:
m_NeedPrecalcAtanYX = false;
m_HasPost = false;
m_HasPreOrRegularVars = false;
- m_ParentEmber = NULL;
+ m_ParentEmber = nullptr;
m_PreVariations.reserve(MAX_VARS_PER_XFORM);
m_Variations.reserve(MAX_VARS_PER_XFORM);
m_PostVariations.reserve(MAX_VARS_PER_XFORM);
@@ -254,7 +254,7 @@ public:
/// True if the successful, else false.
bool AddVariation(Variation* variation)
{
- if (variation && (GetVariationById(variation->VariationId()) == NULL))
+ if (variation && (GetVariationById(variation->VariationId()) == nullptr))
{
string name = variation->Name();
bool pre = name.find("pre_") == 0;
@@ -294,11 +294,11 @@ public:
/// Get a pointer to the variation at the specified index.
///
/// The index in the list to retrieve
- /// A pointer to the variation at the index if in range, else NULL.
+ /// A pointer to the variation at the index if in range, else nullptr.
Variation* GetVariation(size_t index) const
{
size_t count = 0;
- Variation* var = NULL;
+ Variation* var = nullptr;
const_cast*>(this)->AllVarsFunc([&] (vector*>& variations, bool& keepGoing)
{
@@ -320,16 +320,16 @@ public:
/// Get a pointer to the variation with the specified ID.
///
/// The ID to search for
- /// A pointer to the variation if found, else NULL.
+ /// A pointer to the variation if found, else nullptr.
Variation* GetVariationById(eVariationId id) const
{
- Variation* var = NULL;
+ Variation* var = nullptr;
const_cast*>(this)->AllVarsFunc([&] (vector*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++)
{
- if (variations[i] != NULL && variations[i]->VariationId() == id)
+ if (variations[i] != nullptr && variations[i]->VariationId() == id)
{
var = variations[i];
keepGoing = false;
@@ -345,16 +345,16 @@ public:
/// Get a pointer to the variation with the specified name.
///
/// The name to search for
- /// A pointer to the variation if found, else NULL.
+ /// A pointer to the variation if found, else nullptr.
Variation* GetVariationByName(string name) const
{
- Variation* var = NULL;
+ Variation* var = nullptr;
const_cast*>(this)->AllVarsFunc([&] (vector*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++)
{
- if (variations[i] != NULL && variations[i]->Name() == name)
+ if (variations[i] != nullptr && variations[i]->Name() == name)
{
var = variations[i];
keepGoing = false;
@@ -406,7 +406,7 @@ public:
{
for (unsigned int i = 0; i < variations.size(); i++)
{
- if (variations[i] != NULL && variations[i]->VariationId() == id)
+ if (variations[i] != nullptr && variations[i]->VariationId() == id)
{
delete variations[i];
variations.erase(variations.begin() + i);
@@ -442,7 +442,7 @@ public:
/// Reset this xform to be totally empty by clearing all variations, resetting both affines to the
/// identity matrix, clearing xaos, color, visibility, wind, animate and setting name
/// to the empty string.
- /// Note that this also sets the parent ember to NULL, so if this xform is reused after calling Clear(),
+ /// Note that this also sets the parent ember to nullptr, so if this xform is reused after calling Clear(),
/// the caller must reset the parent ember to whatever ember they add it to again.
///
void Clear()
@@ -452,7 +452,7 @@ public:
m_Affine.MakeID();
m_Post.MakeID();
m_Xaos.clear();
- m_ParentEmber = NULL;
+ m_ParentEmber = nullptr;
m_ColorSpeedCache = 0;
m_OneMinusColorCache = 0;
m_VizAdjusted = 0;
@@ -537,7 +537,7 @@ public:
while (m_Xaos.size() > m_ParentEmber->XformCount())
m_Xaos.pop_back();
}
-
+
///
/// Remove all xaos from this xform.
///
@@ -657,7 +657,7 @@ public:
m_PostVariations[i]->Func(iterHelper, *outPoint, rand);
WritePost(iterHelper, *outPoint, m_PostVariations[i]->AssignType());
}
-
+
//Optionally apply the post affine transform if it's present.
if (m_HasPost)
{
@@ -688,7 +688,7 @@ public:
//Loop over the motion elements and add their contribution to the original vals.
for (i = 0; i < xform.m_Motion.size(); i++)
- {
+ {
//Original only pulls these from the first motion xform which is a bug. Want to pull it from each one.
Xform* currentMot = &xform.m_Motion[i];
int freq = currentMot->m_MotionFreq;
@@ -698,11 +698,11 @@ public:
APPMOT(m_Weight);
APPMOT(m_ColorX);
//APPMOT(m_ColorY);
- APPMOT(m_DirectColor);
- APPMOT(m_Opacity);
+ APPMOT(m_DirectColor);
+ APPMOT(m_Opacity);
APPMOT(m_ColorSpeed);
APPMOT(m_Animate);
-
+
for (j = 0; j < currentMot->TotalVariationCount(); j++)//For each variation in the motion xform.
{
Variation* motVar = currentMot->GetVariation(j);//Get the variation, which may or may not be present in this xform.
@@ -724,7 +724,7 @@ public:
//At this point, we've added if needed, or just applied the motion func to the weight.
//Now apply the motion func to the params if needed.
- if (motParVar != NULL)
+ if (motParVar != nullptr)
{
ParametricVariation* parVar = dynamic_cast*>(var);
ParamWithName* params = parVar->Params();
@@ -747,7 +747,7 @@ public:
}
}
}
-
+
//Make sure certain params are within reasonable bounds.
ClampRef(m_ColorX, 0, 1);
//ClampRef(m_ColorY, 0, 1);
@@ -866,11 +866,11 @@ public:
if (m_NeedPrecalcAtanXY)
helper.m_PrecalcAtanxy = atan2(helper.m_TransX, helper.m_TransY);
-
+
if (m_NeedPrecalcAtanYX)
helper.m_PrecalcAtanyx = atan2(helper.m_TransY, helper.m_TransX);
}
-
+
///
/// Flatten this xform by adding a flatten variation if none is present, and if any of the
/// variations or parameters in the vector are present.
@@ -881,7 +881,7 @@ public:
{
bool shouldFlatten = true;
- if (GetVariationById(VAR_FLATTEN) == NULL)
+ if (GetVariationById(VAR_FLATTEN) == nullptr)
{
AllVarsFunc([&] (vector*>& variations, bool& keepGoing)
{
@@ -953,6 +953,7 @@ public:
"\tvIn.z = transZ;\n";
break;
case VARTYPE_POST:
+ default:
s =
"\tvIn.x = outPoint->m_X;\n"
"\tvIn.y = outPoint->m_Y;\n"
@@ -980,6 +981,7 @@ public:
break;
}
case ASSIGNTYPE_SUM:
+ default:
{
helper.m_TransX += helper.Out.x;
helper.m_TransY += helper.Out.y;
@@ -1006,6 +1008,7 @@ public:
break;
}
case ASSIGNTYPE_SUM:
+ default:
{
outPoint.m_X += helper.Out.x;
outPoint.m_Y += helper.Out.y;
@@ -1014,7 +1017,7 @@ public:
}
}
}
-
+
///
/// Generate the OpenCL string for writing output values from a call to a variation.
///
@@ -1048,6 +1051,7 @@ public:
break;
}
case ASSIGNTYPE_SUM:
+ default:
{
s =
"\ttransX += vOut.x;\n"
@@ -1060,6 +1064,7 @@ public:
break;
}
case VARTYPE_POST:
+ default:
{
switch (assignType)
{
@@ -1072,6 +1077,7 @@ public:
break;
}
case ASSIGNTYPE_SUM:
+ default:
{
s =
"\toutPoint->m_X += vOut.x;\n"
@@ -1160,7 +1166,7 @@ public:
//Color coordinates for this function. This is the index into the palette used to look up a color and add to the histogram for each iter.
//The original only allows for an x coord. Will eventually allow for a y coord like Fractron for 2D palettes.
T m_ColorX, m_ColorY;
-
+
private:
T m_ColorSpeedCache;//Cache of m_ColorSpeed * m_ColorX. Need to recalc cache values whenever anything relating to color is set. Made private because one affects the other.
T m_OneMinusColorCache;//Cache of 1 - m_ColorSpeedCache.
@@ -1184,7 +1190,7 @@ public:
private:
vector*> m_PostVariations;//The list of post variations to call when applying this xform.
-
+
public:
T m_DirectColor;//Used with direct color variations.
@@ -1192,7 +1198,7 @@ public:
//Discussed on page 4 of the paper:
//Probability wi.
T m_Weight;
-
+
//Scaling factor on color added to current iteration, also known as color weight. Normally defaults to 0.5.
//Discussed on page 9 of the paper with a hard coded default value of 0.5:
//C = (C + Ci) * m_ColorSpeed.
@@ -1247,4 +1253,4 @@ private:
bool m_NeedPrecalcAtanXY;//Whether any variation uses the precalc atan XY value in its calculations.
bool m_NeedPrecalcAtanYX;//Whether any variation uses the precalc atan YX value in its calculations.
};
-}
\ No newline at end of file
+}
diff --git a/Source/Ember/XmlToEmber.h b/Source/Ember/XmlToEmber.h
index 73eb750..a7f89ae 100644
--- a/Source/Ember/XmlToEmber.h
+++ b/Source/Ember/XmlToEmber.h
@@ -28,22 +28,22 @@ public:
{
m_Category = category;
m_NewLocale = string(loc);
- m_OriginalLocale = setlocale(category, NULL);//Query.
+ m_OriginalLocale = setlocale(category, nullptr);//Query.
if (m_OriginalLocale.empty())
cout << "Couldn't get original locale." << endl;
- if (setlocale(category, loc) == NULL)//Set.
+ if (setlocale(category, loc) == nullptr)//Set.
cout << "Couldn't set new locale " << category << ", " << loc << "." << endl;
}
-
+
///
/// Reset the locale to the value stored during construction.
///
~Locale()
{
if (!m_OriginalLocale.empty())
- if (setlocale(m_Category, m_OriginalLocale.c_str()) == NULL)//Restore.
+ if (setlocale(m_Category, m_OriginalLocale.c_str()) == nullptr)//Restore.
cout << "Couldn't restore original locale " << m_Category << ", " << m_OriginalLocale << "." << endl;
}
@@ -250,7 +250,7 @@ public:
bool Parse(unsigned char* buf, const char* filename, vector>& embers)
{
char* bn;
- const char* xmlBuf;
+ const char* xmlPtr;
const char* loc = __FUNCTION__;
unsigned int emberSize;
size_t bufSize;
@@ -260,12 +260,12 @@ public:
m_ErrorReport.clear();
//Parse XML string into internal document.
- xmlBuf = (const char*)(&buf[0]);
- bufSize = strlen(xmlBuf);
+ xmlPtr = (const char*)(&buf[0]);
+ bufSize = strlen(xmlPtr);
embers.reserve(bufSize / 2500);//The Xml text for an ember is around 2500 bytes, but can be much more. Pre-allocate to aovid unnecessary resizing.
- doc = xmlReadMemory(xmlBuf, (int)bufSize, filename, NULL, XML_PARSE_NONET);//Forbid network access during read.
+ doc = xmlReadMemory(xmlPtr, (int)bufSize, filename, nullptr, XML_PARSE_NONET);//Forbid network access during read.
- if (doc == NULL)
+ if (doc == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : Error parsing xml file " + string(filename));
return false;
@@ -310,7 +310,7 @@ public:
{
while (embers[i].m_Rotate < embers[i - 1].m_Rotate - 180)
embers[i].m_Rotate += 360;
-
+
while (embers[i].m_Rotate > embers[i - 1].m_Rotate + 180)
embers[i].m_Rotate -= 360;
}
@@ -416,7 +416,7 @@ public:
//Convert the string using strtod().
val = strtol(str, &endp, 10);
-
+
//Check errno & return string.
if (endp != str + strlen(str))
{
@@ -483,7 +483,7 @@ private:
void ScanForEmberNodes(xmlNode* curNode, char* parentFile, vector>& embers)
{
bool parseEmberSuccess;
- xmlNodePtr thisNode = NULL;
+ xmlNodePtr thisNode = nullptr;
const char* loc = __FUNCTION__;
string parentFileString = string(parentFile);
@@ -537,7 +537,7 @@ private:
/// True if there were no errors, else false.
bool ParseEmberElement(xmlNode* emberNode, Ember& currentEmber)
{
- bool b = true;
+ bool ret = true;
unsigned int newLinear = 0;
char* attStr;
const char* loc = __FUNCTION__;
@@ -550,7 +550,7 @@ private:
currentEmber.m_Palette.Clear();//Wipe out the current palette.
att = emberNode->properties;//The top level element is a ember element, read the attributes of it and store them.
- if (att == NULL)
+ if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : element has no attributes");
return false;
@@ -561,36 +561,36 @@ private:
attStr = (char*)xmlGetProp(emberNode, curAtt->name);
//First parse out simple float reads.
- if (ParseAndAssignFloat(curAtt->name, attStr, "time", currentEmber.m_Time, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "scale", currentEmber.m_PixelsPerUnit, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "rotate", currentEmber.m_Rotate, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "zoom", currentEmber.m_Zoom, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "filter", currentEmber.m_SpatialFilterRadius, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "temporal_filter_width", currentEmber.m_TemporalFilterWidth, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "temporal_filter_exp", currentEmber.m_TemporalFilterExp, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "quality", currentEmber.m_Quality, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "brightness", currentEmber.m_Brightness, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "gamma", currentEmber.m_Gamma, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "highlight_power", currentEmber.m_HighlightPower, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "vibrancy", currentEmber.m_Vibrancy, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_radius", currentEmber.m_MaxRadDE, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_minimum", currentEmber.m_MinRadDE, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_curve", currentEmber.m_CurveDE, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "gamma_threshold", currentEmber.m_GammaThresh, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_zpos", currentEmber.m_CamZPos, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_persp", currentEmber.m_CamPerspective, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_perspective", currentEmber.m_CamPerspective, b)) { }//Apo bug.
- else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_yaw", currentEmber.m_CamYaw, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_pitch", currentEmber.m_CamPitch, b)) { }
- else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_dof", currentEmber.m_CamDepthBlur, b)) { }
-
+ if (ParseAndAssignFloat(curAtt->name, attStr, "time", currentEmber.m_Time, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "scale", currentEmber.m_PixelsPerUnit, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "rotate", currentEmber.m_Rotate, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "zoom", currentEmber.m_Zoom, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "filter", currentEmber.m_SpatialFilterRadius, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "temporal_filter_width", currentEmber.m_TemporalFilterWidth, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "temporal_filter_exp", currentEmber.m_TemporalFilterExp, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "quality", currentEmber.m_Quality, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "brightness", currentEmber.m_Brightness, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "gamma", currentEmber.m_Gamma, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "highlight_power", currentEmber.m_HighlightPower, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "vibrancy", currentEmber.m_Vibrancy, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_radius", currentEmber.m_MaxRadDE, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_minimum", currentEmber.m_MinRadDE, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_curve", currentEmber.m_CurveDE, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "gamma_threshold", currentEmber.m_GammaThresh, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_zpos", currentEmber.m_CamZPos, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_persp", currentEmber.m_CamPerspective, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_perspective", currentEmber.m_CamPerspective, ret)) { }//Apo bug.
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_yaw", currentEmber.m_CamYaw, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_pitch", currentEmber.m_CamPitch, ret)) { }
+ else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_dof", currentEmber.m_CamDepthBlur, ret)) { }
+
//Parse simple int reads.
- else if (ParseAndAssignInt(curAtt->name, attStr, "palette", currentEmber.m_Palette.m_Index, b)) { }
- else if (ParseAndAssignInt(curAtt->name, attStr, "oversample", currentEmber.m_Supersample , b)) { }
- else if (ParseAndAssignInt(curAtt->name, attStr, "supersample", currentEmber.m_Supersample , b)) { }
- else if (ParseAndAssignInt(curAtt->name, attStr, "temporal_samples", currentEmber.m_TemporalSamples, b)) { }
- else if (ParseAndAssignInt(curAtt->name, attStr, "soloxform", soloXform , b)) { }
- else if (ParseAndAssignInt(curAtt->name, attStr, "new_linear", newLinear , b)) { }
+ else if (ParseAndAssignInt(curAtt->name, attStr, "palette", currentEmber.m_Palette.m_Index, ret)) { }
+ else if (ParseAndAssignInt(curAtt->name, attStr, "oversample", currentEmber.m_Supersample , ret)) { }
+ else if (ParseAndAssignInt(curAtt->name, attStr, "supersample", currentEmber.m_Supersample , ret)) { }
+ else if (ParseAndAssignInt(curAtt->name, attStr, "temporal_samples", currentEmber.m_TemporalSamples, ret)) { }
+ else if (ParseAndAssignInt(curAtt->name, attStr, "soloxform", soloXform , ret)) { }
+ else if (ParseAndAssignInt(curAtt->name, attStr, "new_linear", newLinear , ret)) { }
//Parse more complicated reads that have multiple possible values.
else if (!Compare(curAtt->name, "interpolation"))
@@ -631,7 +631,7 @@ private:
}
else if (!Compare(curAtt->name, "size"))
{
- if (sscanf_s(attStr, "%d %d", ¤tEmber.m_FinalRasW, ¤tEmber.m_FinalRasH) != 2)
+ if (sscanf_s(attStr, "%u %u", ¤tEmber.m_FinalRasW, ¤tEmber.m_FinalRasH) != 2)
{
m_ErrorReport.push_back(string(loc) + " : Invalid size attribute " + string(attStr));
xmlFree(attStr);
@@ -709,7 +709,7 @@ private:
//Loop through the attributes of the color element.
att = childNode->properties;
- if (att == NULL)
+ if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : No attributes for color element");
continue;
@@ -775,7 +775,7 @@ private:
//Loop through the attributes of the color element.
att = childNode->properties;
- if (att == NULL)
+ if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : No attributes for colors element");
continue;
@@ -821,7 +821,7 @@ private:
//Loop through the attributes of the palette element.
att = childNode->properties;
- if (att == NULL)
+ if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : No attributes for palette element");
continue;
@@ -864,7 +864,7 @@ private:
else if (!Compare(curAtt->name, "format"))
{
newFormat = true;
-
+
if (!_stricmp(attStr, "RGB"))
numBytes = 3;
else if (!_stricmp(attStr, "RGBA"))
@@ -879,7 +879,7 @@ private:
{
m_ErrorReport.push_back(string(loc) + " : Unknown palette attribute " + string((const char*)curAtt->name));
}
-
+
xmlFree(attStr);
}
@@ -914,7 +914,7 @@ private:
//Loop through the attributes of the palette element.
att = childNode->properties;
- if (att == NULL)
+ if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : No attributes for palette element");
continue;
@@ -944,7 +944,7 @@ private:
}
else if (!Compare(childNode->name, "xform") || !Compare(childNode->name, "finalxform"))
{
- Xform* theXform = NULL;
+ Xform* theXform = nullptr;
if (!Compare(childNode->name, "finalxform"))
{
@@ -1033,7 +1033,7 @@ private:
bool ParseXform(xmlNode* childNode, Xform& xform, bool motion)
{
bool success = true;
- char* attStr, *copy;
+ char* attStr;
const char* loc = __FUNCTION__;
unsigned int j;
T temp;
@@ -1044,7 +1044,7 @@ private:
//Loop through the attributes of the xform element.
attPtr = childNode->properties;
- if (attPtr == NULL)
+ if (attPtr == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : Error: No attributes for element");
return false;
@@ -1052,7 +1052,7 @@ private:
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)
{
- copy = attStr = (char*)xmlGetProp(childNode, curAtt->name);
+ attStr = (char*)xmlGetProp(childNode, curAtt->name);
//First parse out simple float reads.
if (ParseAndAssignFloat(curAtt->name, attStr, "weight", xform.m_Weight, success)) { }
@@ -1095,7 +1095,6 @@ private:
}
else if (!Compare(curAtt->name, "color"))
{
- T tmpc1 = 0;
xform.m_ColorX = xform.m_ColorY = 0;
//Try two coords first .
@@ -1141,7 +1140,7 @@ private:
a = d = b = e = c = f = 0;
m_ErrorReport.push_back(string(loc) + " : Bad coeffs attribute " + string(attStr));
}
-
+
xform.m_Affine.A(T(a));
xform.m_Affine.B(T(b));
xform.m_Affine.C(T(c));
@@ -1167,7 +1166,6 @@ private:
else
{
string s = GetCorrectedVariationName(m_BadVariationNames, curAtt);
- const char* name = s.c_str();
if (Variation* var = m_VariationList.GetVariation(s))
{
@@ -1192,11 +1190,11 @@ private:
if (!Compare(curAtt->name, "var1"))
{
- copy = attStr = (char*)xmlGetProp(childNode, curAtt->name);
+ attStr = (char*)xmlGetProp(childNode, curAtt->name);
for (j = 0; j < xform.TotalVariationCount(); j++)
xform.GetVariation(j)->m_Weight = 0;
-
+
if (Atof(attStr, temp))
{
unsigned int iTemp = (unsigned int)temp;
@@ -1207,7 +1205,7 @@ private:
var1 = true;
}
}
-
+
if (!var1)
m_ErrorReport.push_back(string(loc) + " : Bad value for var1 " + string(attStr));
@@ -1223,7 +1221,7 @@ private:
if (!Compare(curAtt->name, "var"))
{
- copy = attStr = (char*)xmlGetProp(childNode, curAtt->name);
+ attStr = (char*)xmlGetProp(childNode, curAtt->name);
if (Atof(attStr, temp))
{
@@ -1232,7 +1230,7 @@ private:
var = true;
}
-
+
if (!var)
m_ErrorReport.push_back(string(loc) + " : Bad value for var " + string(attStr));
@@ -1254,7 +1252,7 @@ private:
if (parVar->ContainsParam(name))
{
T val = 0;
- copy = attStr = (char*)xmlGetProp(childNode, curAtt->name);
+ attStr = (char*)xmlGetProp(childNode, curAtt->name);
if (Atof(attStr, val))
{
@@ -1264,7 +1262,7 @@ private:
{
m_ErrorReport.push_back(string(loc) + " : Failed to parse parametric variation parameter " + s + " - " + string(attStr));
}
-
+
xmlFree(attStr);
}
}
@@ -1339,7 +1337,7 @@ private:
{
if (!_stricmp(name, (const char*)temp->name))
return true;
- } while (temp = temp->next);
+ } while ((temp = temp->next));
return false;
}
@@ -1357,13 +1355,13 @@ private:
{
int colorIndex = 0;
int colorCount = 0;
- int r, g, b, a;
+ unsigned int r, g, b, a;
int ret;
char tmps[2];
int skip = (int)abs(chan);
bool ok = true;
const char* loc = __FUNCTION__;
-
+
//Strip whitespace prior to first color.
while (isspace((int)colstr[colorIndex]))
colorIndex++;
@@ -1389,10 +1387,10 @@ private:
}
colorIndex += 2 * skip;
-
+
while (isspace((int)colstr[colorIndex]))
colorIndex++;
-
+
ember.m_Palette.m_Entries[colorCount].r = T(r) / T(255);//Hex palette is [0..255], convert to [0..1].
ember.m_Palette.m_Entries[colorCount].g = T(g) / T(255);
ember.m_Palette.m_Entries[colorCount].b = T(b) / T(255);
@@ -1411,7 +1409,7 @@ private:
m_ErrorReport.push_back(string(loc) + " : Extra data at end of hex color data " + string(&(colstr[colorIndex])));
ok = false;
}
-
+
return ok;
}
@@ -1443,13 +1441,13 @@ private:
Palette::RgbToHsv(glm::value_ptr(hueAdjusted0[i]), s);
Palette::RgbToHsv(glm::value_ptr(hueAdjusted1[i]), t);
-
+
s[3] = hueAdjusted0[i][3];
t[3] = hueAdjusted1[i][3];
-
+
for (j = 0; j < 4; j++)
t[j] = ((1 - blend) * s[j]) + (blend * t[j]);
-
+
Palette::HsvToRgb(t, glm::value_ptr(palette.m_Entries[i]));
palette.m_Entries[i][3] = t[3];
}
@@ -1518,7 +1516,7 @@ private:
}
return ret;
- }
+ }
static bool m_Init;
static vector> m_BadParamNames;
@@ -1526,4 +1524,4 @@ private:
VariationList m_VariationList;//The variation list used to make copies of variations to populate the embers with.
PaletteList m_PaletteList;
};
-}
\ No newline at end of file
+}
diff --git a/Source/EmberAnimate/EmberAnimate.cpp b/Source/EmberAnimate/EmberAnimate.cpp
index 3164fb9..8e4fbcc 100644
--- a/Source/EmberAnimate/EmberAnimate.cpp
+++ b/Source/EmberAnimate/EmberAnimate.cpp
@@ -311,7 +311,7 @@ bool EmberAnimate(EmberOptions& opt)
if ((opt.Format() == "jpg" || opt.Format() == "bmp") && renderer->NumChannels() == 4)
{
- EmberNs::RgbaToRgb(finalImage, vecRgb, renderer->FinalRasW(), renderer->FinalRasH());
+ RgbaToRgb(finalImage, vecRgb, renderer->FinalRasW(), renderer->FinalRasH());
finalImagep = vecRgb.data();
}
diff --git a/Source/EmberCommon/EmberCommon.h b/Source/EmberCommon/EmberCommon.h
index c214764..2e204d5 100644
--- a/Source/EmberCommon/EmberCommon.h
+++ b/Source/EmberCommon/EmberCommon.h
@@ -84,7 +84,7 @@ private:
/// True if success, else false.
template
static bool ParseEmberFile(XmlToEmber& parser, string filename, vector>& embers)
-{
+{
if (!parser.Parse(filename.c_str(), embers))
{
cout << "Error parsing flame file " << filename << ", returning without executing." << endl;
@@ -109,7 +109,7 @@ static bool ParseEmberFile(XmlToEmber& parser, string filename, vectorTrue if success, else false.
template
static bool InitPaletteList(string filename)
-{
+{
PaletteList paletteList;//Even though this is local, the members are static so they will remain.
if (!paletteList.Init(filename))
@@ -122,6 +122,25 @@ static bool InitPaletteList(string filename)
return true;
}
+///
+/// Convert an RGBA buffer to an RGB buffer.
+///
+/// The RGBA buffer
+/// The RGB buffer
+/// The width of the image in pixels
+/// The height of the image in pixels
+static void RgbaToRgb(vector& rgba, vector& rgb, unsigned int width, unsigned int height)
+{
+ rgb.resize(width * height * 3);
+
+ for (unsigned int i = 0, j = 0; i < (width * height * 4); i += 4, j += 3)
+ {
+ rgb[j] = rgba[i];
+ rgb[j + 1] = rgba[i + 1];
+ rgb[j + 2] = rgba[i + 2];
+ }
+}
+
///
/// Calculate the number of strips required if the needed amount of memory
/// is greater than the system memory, or greater than what the user want to allow.
diff --git a/Source/EmberRender/EmberRender.cpp b/Source/EmberRender/EmberRender.cpp
index b3cfdd4..16746ca 100644
--- a/Source/EmberRender/EmberRender.cpp
+++ b/Source/EmberRender/EmberRender.cpp
@@ -309,7 +309,7 @@ bool EmberRender(EmberOptions& opt)
if ((opt.Format() == "jpg" || opt.Format() == "bmp") && renderer->NumChannels() == 4)
{
- EmberNs::RgbaToRgb(finalImage, vecRgb, renderer->FinalRasW(), realHeight);
+ RgbaToRgb(finalImage, vecRgb, renderer->FinalRasW(), realHeight);
finalImagep = vecRgb.data();
}
diff --git a/Source/EmberTester/EmberTester.cpp b/Source/EmberTester/EmberTester.cpp
index e49b626..388886e 100644
--- a/Source/EmberTester/EmberTester.cpp
+++ b/Source/EmberTester/EmberTester.cpp
@@ -1748,7 +1748,7 @@ double RandD(QTIsaac& rand)
int _tmain(int argc, _TCHAR* argv[])
{
- int i;
+ //int i;
Timing t(4);
QTIsaac rand;
diff --git a/Source/Fractorium/FractoriumRender.cpp b/Source/Fractorium/FractoriumRender.cpp
index 505bba8..2e7d349 100644
--- a/Source/Fractorium/FractoriumRender.cpp
+++ b/Source/Fractorium/FractoriumRender.cpp
@@ -137,7 +137,7 @@ void FractoriumEmberControllerBase::SaveCurrentRender(QString filename)
if ((suffix == "jpg" || suffix == "bmp") && m_Renderer->NumChannels() == 4)
{
- EmberNs::RgbaToRgb(m_FinalImage, vecRgb, width, height);
+ RgbaToRgb(m_FinalImage, vecRgb, width, height);
data = vecRgb.data();
}