mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-01 05:46:06 -04:00
More Linux work. Convert all casts to new style, away from legacy.
This commit is contained in:
@ -128,10 +128,10 @@ public:
|
||||
T invSizeW = T(1.0) / carW;
|
||||
T invSizeH = T(1.0) / carH;
|
||||
|
||||
m_PixPerImageUnitW = (T)rasW * invSizeW;
|
||||
m_PixPerImageUnitW = static_cast<T>(rasW) * invSizeW;
|
||||
m_RasLlX = m_PixPerImageUnitW * carLlX;
|
||||
|
||||
m_PixPerImageUnitH = (T)rasH * invSizeH;
|
||||
m_PixPerImageUnitH = static_cast<T>(rasH) * invSizeH;
|
||||
m_RasLlY = m_PixPerImageUnitH * carLlY;
|
||||
|
||||
m_OneRow = abs(m_CarUrY - m_CarLlY) / m_RasHeight;
|
||||
@ -158,8 +158,8 @@ public:
|
||||
/// <param name="rasY">The converted raster y</param>
|
||||
inline void Convert(T cartX, T cartY, size_t& rasX, size_t& rasY)
|
||||
{
|
||||
rasX = (size_t)(m_PixPerImageUnitW * cartX - m_RasLlX);
|
||||
rasY = (size_t)(m_RasLlY - (m_PixPerImageUnitH * cartY));
|
||||
rasX = static_cast<size_t>(m_PixPerImageUnitW * cartX - m_RasLlX);
|
||||
rasY = static_cast<size_t>(m_RasLlY - (m_PixPerImageUnitH * cartY));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -175,7 +175,7 @@ public:
|
||||
/// <param name="singleBufferIndex">The converted single raster buffer index</param>
|
||||
inline void Convert(T cartX, T cartY, size_t& singleBufferIndex)
|
||||
{
|
||||
singleBufferIndex = (size_t)(m_PixPerImageUnitW * cartX - m_RasLlX) + (m_RasWidth * (size_t)(m_PixPerImageUnitH * cartY - m_RasLlY));
|
||||
singleBufferIndex = static_cast<size_t>(m_PixPerImageUnitW * cartX - m_RasLlX) + (m_RasWidth * static_cast<size_t>(m_PixPerImageUnitH * cartY - m_RasLlY));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -192,7 +192,7 @@ public:
|
||||
/// <param name="singleBufferIndex">The converted single raster buffer index</param>
|
||||
inline void Convert(Point<T>& point, size_t& singleBufferIndex)
|
||||
{
|
||||
singleBufferIndex = (size_t)(m_PixPerImageUnitW * point.m_X - m_RasLlX) + (m_RasWidth * (size_t)(m_PixPerImageUnitH * point.m_Y - m_RasLlY));
|
||||
singleBufferIndex = static_cast<size_t>(m_PixPerImageUnitW * point.m_X - m_RasLlX) + (m_RasWidth * static_cast<size_t>(m_PixPerImageUnitH * point.m_Y - m_RasLlY));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -128,13 +128,13 @@ public:
|
||||
if (decFilterCount > 1e7)//Too many filters.
|
||||
return false;
|
||||
|
||||
intFilterCount = (int)ceil(decFilterCount);
|
||||
intFilterCount = static_cast<int>(ceil(decFilterCount));
|
||||
|
||||
//Condense the smaller kernels to save space.
|
||||
if (intFilterCount > keepThresh)
|
||||
{
|
||||
maxIndex = (int)ceil(DE_THRESH + pow(T(intFilterCount - DE_THRESH), m_Curve)) + 1;
|
||||
m_MaxFilteredCounts = (int)pow(T(maxIndex - DE_THRESH), T(1.0) / m_Curve) + DE_THRESH;
|
||||
maxIndex = static_cast<int>(ceil(DE_THRESH + pow(T(intFilterCount - DE_THRESH), m_Curve))) + 1;
|
||||
m_MaxFilteredCounts = static_cast<int>(pow(T(maxIndex - DE_THRESH), T(1.0) / m_Curve)) + DE_THRESH;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -143,7 +143,7 @@ public:
|
||||
}
|
||||
|
||||
//Allocate the memory for these filters and the hit/width lookup array.
|
||||
rowSize = (int)(2 * ceil(finalMaxRad) - 1);
|
||||
rowSize = static_cast<int>(2 * ceil(finalMaxRad) - 1);
|
||||
m_FilterWidth = (rowSize - 1) / 2;
|
||||
m_KernelSize = (m_FilterWidth + 1) * (2 + m_FilterWidth) / 2;
|
||||
|
||||
@ -185,7 +185,7 @@ public:
|
||||
{
|
||||
for (dek = -m_FilterWidth; dek <= m_FilterWidth; dek++)
|
||||
{
|
||||
filterVal = sqrt((T)(dej * dej + dek * dek)) / filterHeight;
|
||||
filterVal = sqrt(T(dej * dej + dek * dek)) / filterHeight;
|
||||
|
||||
//Only populate the coefs within this radius.
|
||||
if (filterVal <= 1.0)
|
||||
@ -344,4 +344,4 @@ private:
|
||||
vector<T> m_Widths;
|
||||
vector<uint> m_CoefIndices;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ public:
|
||||
Xform<T>* GetXform(size_t i) const
|
||||
{
|
||||
if (i < XformCount())
|
||||
return (Xform<T>*)&m_Xforms[i];
|
||||
return const_cast<Xform<T>*>(&m_Xforms[i]);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
@ -384,9 +384,9 @@ public:
|
||||
Xform<T>* GetTotalXform(size_t i, bool forceFinal = false) const
|
||||
{
|
||||
if (i < XformCount())
|
||||
return (Xform<T>*)&m_Xforms[i];
|
||||
return const_cast<Xform<T>*>(&m_Xforms[i]);
|
||||
else if (i == XformCount() || forceFinal)
|
||||
return (Xform<T>*)&m_FinalXform;
|
||||
return const_cast<Xform<T>*>(&m_FinalXform);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
@ -402,7 +402,7 @@ public:
|
||||
|
||||
for (size_t i = 0; i < m_Xforms.size(); i++)
|
||||
if (GetXform(i) == xform)
|
||||
return (intmax_t)i;
|
||||
return intmax_t(i);
|
||||
|
||||
return index;
|
||||
}
|
||||
@ -418,7 +418,7 @@ public:
|
||||
|
||||
for (size_t i = 0; i < totalXformCount; i++)
|
||||
if (GetTotalXform(i) == xform)
|
||||
return (intmax_t)i;
|
||||
return intmax_t(i);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -1478,7 +1478,7 @@ public:
|
||||
//The multiplier in size of the histogram and DE filtering buffers. Must be at least one, preferrably never larger than 4, only useful at 2.
|
||||
//Xml field: "supersample" or "overample (deprecated)".
|
||||
size_t m_Supersample;
|
||||
|
||||
|
||||
//When animating, split each pass into this many pieces, each doing a fraction of the total iterations. Each temporal sample
|
||||
//will render an interpolated instance of the ember that is a fraction of the current ember and the next one.
|
||||
//When rendering a single image, this field is always set to 1.
|
||||
@ -1711,7 +1711,7 @@ private:
|
||||
for (size_t k = 0; k < size; k++)
|
||||
t += coefs[k] * embers[k].*m;
|
||||
|
||||
this->*m = (size_t)Rint(t);
|
||||
this->*m = size_t(Rint(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -61,7 +61,10 @@ namespace EmberNs
|
||||
#define COLORMAP_LENGTH_MINUS_1 255
|
||||
#define WHITE 255
|
||||
#define DEFAULT_SBS (1024 * 10)
|
||||
#define XC (const xmlChar*)
|
||||
//#define XC(c) ((const xmlChar*)(c))
|
||||
#define XC(c) (reinterpret_cast<const xmlChar*>(c))
|
||||
#define CX(c) (reinterpret_cast<char*>(c))
|
||||
#define CCX(c) (reinterpret_cast<const char*>(c))
|
||||
#define BadVal(x) (((x) != (x)) || ((x) > 1e10) || ((x) < -1e10))
|
||||
#define Rint(A) floor((A) + (((A) < 0) ? T(-0.5) : T(0.5)))
|
||||
#define Vlen(x) (sizeof(x) / sizeof(*x))
|
||||
|
@ -231,9 +231,9 @@ public:
|
||||
{
|
||||
size_t idx = 8 * i + j;
|
||||
|
||||
os << hex << setw(2) << setfill('0') << (int)Rint(ember.m_Palette[idx][0] * 255);
|
||||
os << hex << setw(2) << setfill('0') << (int)Rint(ember.m_Palette[idx][1] * 255);
|
||||
os << hex << setw(2) << setfill('0') << (int)Rint(ember.m_Palette[idx][2] * 255);
|
||||
os << hex << setw(2) << setfill('0') << int(Rint(ember.m_Palette[idx][0] * 255));
|
||||
os << hex << setw(2) << setfill('0') << int(Rint(ember.m_Palette[idx][1] * 255));
|
||||
os << hex << setw(2) << setfill('0') << int(Rint(ember.m_Palette[idx][2] * 255));
|
||||
}
|
||||
|
||||
os << endl;
|
||||
@ -255,14 +255,14 @@ public:
|
||||
if (IsClose(a, 255.0))
|
||||
{
|
||||
if (intPalette)
|
||||
os << "<color index=\"" << i << "\" rgb=\"" << (int)Rint(r) << " " << (int)Rint(g) << " " << (int)Rint(b) << "\"/>";
|
||||
os << "<color index=\"" << i << "\" rgb=\"" << int(Rint(r)) << " " << int(Rint(g)) << " " << int(Rint(b)) << "\"/>";
|
||||
else
|
||||
os << "<color index=\"" << i << "\" rgb=\"" << std::fixed << std::setprecision(2) << r << " " << g << " " << b << "\"/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (intPalette)
|
||||
os << " <color index=\"" << i << "\" rgba=\"" << (int)Rint(r) << " " << (int)Rint(g) << " " << (int)Rint(b) << " " << (int)Rint(a) << "\"/>";
|
||||
os << " <color index=\"" << i << "\" rgba=\"" << int(Rint(r)) << " " << int(Rint(g)) << " " << int(Rint(b)) << " " << int(Rint(a)) << "\"/>";
|
||||
else
|
||||
os << " <color index=\"" << i << "\" rgba=\"" << std::fixed << std::setprecision(2) << r << " " << g << " " << b << " " << a << "\"/>";
|
||||
}
|
||||
@ -300,13 +300,13 @@ public:
|
||||
time_t myTime;
|
||||
string s;
|
||||
xmlDocPtr commentDoc = nullptr;
|
||||
xmlDocPtr doc = xmlNewDoc(XC "1.0");
|
||||
xmlDocPtr doc = xmlNewDoc(XC("1.0"));
|
||||
xmlNodePtr rootNode = nullptr, node = nullptr, nodeCopy = nullptr;
|
||||
xmlNodePtr rootComment = nullptr;
|
||||
ostringstream os;
|
||||
|
||||
//Create the root node, called "edit".
|
||||
rootNode = xmlNewNode(nullptr, XC "edit");
|
||||
rootNode = xmlNewNode(nullptr, XC("edit"));
|
||||
xmlDocSetRootElement(doc, rootNode);
|
||||
|
||||
//Add the edit attributes.
|
||||
@ -321,37 +321,37 @@ public:
|
||||
localt = localtime(&myTime);
|
||||
strftime(timeString, 128, "%a %b %d %H:%M:%S %z %Y", localt);//XXX use standard time format including timezone.
|
||||
#endif
|
||||
xmlNewProp(rootNode, XC "date", XC timeString);
|
||||
xmlNewProp(rootNode, XC("date"), XC(timeString));
|
||||
|
||||
//Nick.
|
||||
if (nick != "")
|
||||
xmlNewProp(rootNode, XC "nick", XC nick.c_str());
|
||||
xmlNewProp(rootNode, XC("nick"), XC(nick.c_str()));
|
||||
|
||||
//Url.
|
||||
if (url != "")
|
||||
xmlNewProp(rootNode, XC "url", XC url.c_str());
|
||||
xmlNewProp(rootNode, XC("url"), XC(url.c_str()));
|
||||
|
||||
if (id != "")
|
||||
xmlNewProp(rootNode, XC "id", XC id.c_str());
|
||||
xmlNewProp(rootNode, XC("id"), XC(id.c_str()));
|
||||
|
||||
//Action.
|
||||
xmlNewProp(rootNode, XC "action", XC action.c_str());
|
||||
xmlNewProp(rootNode, XC("action"), XC(action.c_str()));
|
||||
|
||||
//Sheep info.
|
||||
if (sheepGen > 0 && sheepId > 0)
|
||||
{
|
||||
//Create a child node of the root node called sheep.
|
||||
node = xmlNewChild(rootNode, nullptr, XC "sheep", nullptr);
|
||||
node = xmlNewChild(rootNode, nullptr, XC("sheep"), nullptr);
|
||||
|
||||
//Create the sheep attributes.
|
||||
os << sheepGen;
|
||||
s = os.str();
|
||||
xmlNewProp(node, XC "generation", XC s.c_str());
|
||||
xmlNewProp(node, XC("generation"), XC(s.c_str()));
|
||||
os.str("");
|
||||
|
||||
os << sheepId;
|
||||
s = os.str();
|
||||
xmlNewProp(node, XC "id", XC s.c_str());
|
||||
xmlNewProp(node, XC("id"), XC(s.c_str()));
|
||||
os.str("");
|
||||
}
|
||||
|
||||
@ -368,16 +368,16 @@ public:
|
||||
node = xmlDocGetRootElement(parent0->m_Edits);
|
||||
nodeCopy = xmlCopyNode(node, 1);
|
||||
AddFilenameWithoutAmpersand(nodeCopy, parent0->m_ParentFilename);
|
||||
|
||||
xmlNewProp(nodeCopy, XC "index", XC s.c_str());
|
||||
|
||||
xmlNewProp(nodeCopy, XC("index"), XC(s.c_str()));
|
||||
xmlAddChild(rootNode, nodeCopy);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Insert a (parent has no edit) message.
|
||||
nodeCopy = xmlNewChild(rootNode, nullptr, XC "edit", nullptr);
|
||||
nodeCopy = xmlNewChild(rootNode, nullptr, XC("edit"), nullptr);
|
||||
AddFilenameWithoutAmpersand(nodeCopy, parent0->m_ParentFilename);
|
||||
xmlNewProp(nodeCopy, XC "index", XC s.c_str());
|
||||
xmlNewProp(nodeCopy, XC("index"), XC(s.c_str()));
|
||||
}
|
||||
|
||||
os.str("");
|
||||
@ -394,15 +394,15 @@ public:
|
||||
node = xmlDocGetRootElement(parent1->m_Edits);
|
||||
nodeCopy = xmlCopyNode(node, 1);
|
||||
AddFilenameWithoutAmpersand(nodeCopy, parent1->m_ParentFilename);
|
||||
xmlNewProp(nodeCopy, XC "index", XC s.c_str());
|
||||
xmlNewProp(nodeCopy, XC("index"), XC(s.c_str()));
|
||||
xmlAddChild(rootNode, nodeCopy);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Insert a (parent has no edit) message.
|
||||
nodeCopy = xmlNewChild(rootNode, nullptr, XC "edit",nullptr);
|
||||
nodeCopy = xmlNewChild(rootNode, nullptr, XC("edit"),nullptr);
|
||||
AddFilenameWithoutAmpersand(nodeCopy, parent1->m_ParentFilename);
|
||||
xmlNewProp(nodeCopy, XC "index", XC s.c_str());
|
||||
xmlNewProp(nodeCopy, XC("index"), XC(s.c_str()));
|
||||
}
|
||||
|
||||
os.str("");
|
||||
@ -419,7 +419,7 @@ public:
|
||||
{
|
||||
os << "<comm>" << comment << "</comm>";
|
||||
s = os.str();
|
||||
commentDoc = xmlReadMemory(s.c_str(), (int)s.length(), "comment.env", nullptr, XML_PARSE_NONET);
|
||||
commentDoc = xmlReadMemory(s.c_str(), int(s.length()), "comment.env", nullptr, XML_PARSE_NONET);
|
||||
os.str("");
|
||||
|
||||
//Check for errors.
|
||||
@ -617,9 +617,9 @@ private:
|
||||
|
||||
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)
|
||||
{
|
||||
attStr = (char*)xmlGetProp(editNode, curAtt->name);
|
||||
attStr = CX(xmlGetProp(editNode, curAtt->name));
|
||||
os << " " << curAtt->name << "=\"" << attStr << "\"";
|
||||
xmlFree((void*)attStr);
|
||||
xmlFree(reinterpret_cast<void*>(const_cast<char*>(attStr)));
|
||||
}
|
||||
|
||||
//Does this node have children?
|
||||
@ -695,7 +695,7 @@ private:
|
||||
}
|
||||
else if (editNode->type == XML_TEXT_NODE)
|
||||
{
|
||||
string s((char*)xmlNodeGetContent(editNode));
|
||||
string s(reinterpret_cast<char*>(xmlNodeGetContent(editNode)));
|
||||
os << Trim(s);
|
||||
}
|
||||
|
||||
@ -709,11 +709,11 @@ private:
|
||||
string filenameWithoutAmpersands = filename;
|
||||
|
||||
FindAndReplace<string>(filenameWithoutAmpersands, "&", "&");
|
||||
xmlNewProp(node, XC "filename", XC filenameWithoutAmpersands.c_str());
|
||||
xmlNewProp(node, XC("filename"), XC(filenameWithoutAmpersands.c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNewProp(node, XC "filename", XC filename.c_str());
|
||||
xmlNewProp(node, XC("filename"), XC(filename.c_str()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
template<typename floatType>
|
||||
inline floatType Frand(floatType fMin, floatType fMax)
|
||||
{
|
||||
floatType f = (floatType)Rand() / (floatType)std::numeric_limits<T>::max();
|
||||
floatType f = static_cast<floatType>(Rand()) / static_cast<floatType>(std::numeric_limits<T>::max());
|
||||
return fMin + (f * (fMax - fMin));
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ public:
|
||||
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;
|
||||
m_Rc.randrsl[i] = static_cast<T>(time(nullptr)) + i;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -272,9 +272,9 @@ public:
|
||||
#ifndef ISAAC_FLAM3_DEBUG
|
||||
if (a == 0 && b == 0 && c == 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);
|
||||
m_Rc.randa = static_cast<T>(time(nullptr));
|
||||
m_Rc.randb = static_cast<T>(time(nullptr)) * static_cast<T>(time(nullptr));
|
||||
m_Rc.randc = static_cast<T>(time(nullptr)) * static_cast<T>(time(nullptr)) * static_cast<T>(time(nullptr));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -351,9 +351,9 @@ protected:
|
||||
inline T Ind(T* mm, T x)
|
||||
{
|
||||
#ifndef __ISAAC64
|
||||
return (*(T*)((byte*)(mm) + ((x) & ((N - 1) << 2))));
|
||||
return (*reinterpret_cast<T*>(reinterpret_cast<byte*>(mm) + ((x) & ((N - 1) << 2))));
|
||||
#else // __ISAAC64
|
||||
return (*(T*)((byte*)(mm) + ((x) & ((N - 1) << 3))));
|
||||
return (*reinterpret_cast<T*>(reinterpret_cast<byte*>(mm) + ((x) & ((N - 1) << 3))));
|
||||
#endif // __ISAAC64
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
/// Accessors.
|
||||
/// </summary>
|
||||
const byte* XformDistributions() const { return m_XformDistributions.empty() ? nullptr : &m_XformDistributions[0]; }
|
||||
const size_t XformDistributionsSize() const { return m_XformDistributions.size(); }
|
||||
size_t XformDistributionsSize() const { return m_XformDistributions.size(); }
|
||||
|
||||
/// <summary>
|
||||
/// Virtual empty iteration function that will be overidden in derived iterator classes.
|
||||
@ -146,7 +146,7 @@ public:
|
||||
while (tempDensity < currentDensityLimit && j < CHOOSE_XFORM_GRAIN)
|
||||
{
|
||||
//printf("offset = %d, xform = %d, running sum = %f\n", j, i, tempDensity);
|
||||
m_XformDistributions[(distrib * CHOOSE_XFORM_GRAIN) + j] = (byte)i;
|
||||
m_XformDistributions[(distrib * CHOOSE_XFORM_GRAIN) + j] = byte(i);
|
||||
tempDensity += densityPerElement;
|
||||
j++;
|
||||
}
|
||||
@ -259,7 +259,7 @@ protected:
|
||||
/// <returns></returns>
|
||||
size_t NextXformFromIndex(size_t index, size_t distribOffset = 0)
|
||||
{
|
||||
return (size_t)m_XformDistributions[(index % CHOOSE_XFORM_GRAIN) + (CHOOSE_XFORM_GRAIN * distribOffset)];
|
||||
return size_t(m_XformDistributions[(index % CHOOSE_XFORM_GRAIN) + (CHOOSE_XFORM_GRAIN * distribOffset)]);
|
||||
}
|
||||
|
||||
vector<byte> m_XformDistributions;
|
||||
|
@ -88,10 +88,10 @@ public:
|
||||
|
||||
for (uint i = 0; i < size; i++)
|
||||
{
|
||||
m_Entries[i].a = (T)palette15[i * 4 + 0];
|
||||
m_Entries[i].r = (T)palette15[i * 4 + 1];
|
||||
m_Entries[i].g = (T)palette15[i * 4 + 2];
|
||||
m_Entries[i].b = (T)palette15[i * 4 + 3];
|
||||
m_Entries[i].a = T(palette15[i * 4 + 0]);
|
||||
m_Entries[i].r = T(palette15[i * 4 + 1]);
|
||||
m_Entries[i].g = T(palette15[i * 4 + 2]);
|
||||
m_Entries[i].b = T(palette15[i * 4 + 3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -307,7 +307,7 @@ public:
|
||||
rgb[1] = 0;
|
||||
rgb[2] = 0;
|
||||
|
||||
for (int j = i - (int)blur; j <= i + (int)blur; j++)
|
||||
for (int j = i - int(blur); j <= i + int(blur); j++)
|
||||
{
|
||||
n++;
|
||||
int k = (256 + j) % 256;
|
||||
@ -369,9 +369,9 @@ public:
|
||||
{
|
||||
for (uint j = 0; j < width; j++)
|
||||
{
|
||||
v[(width * 3 * i) + (j * 3)] = (byte)(m_Entries[j][0] * T(255));//Palettes are as [0..1], so convert to [0..255] here since it's for GUI display.
|
||||
v[(width * 3 * i) + (j * 3) + 1] = (byte)(m_Entries[j][1] * T(255));
|
||||
v[(width * 3 * i) + (j * 3) + 2] = (byte)(m_Entries[j][2] * T(255));
|
||||
v[(width * 3 * i) + (j * 3)] = byte(m_Entries[j][0] * T(255));//Palettes are as [0..1], so convert to [0..255] here since it's for GUI display.
|
||||
v[(width * 3 * i) + (j * 3) + 1] = byte(m_Entries[j][1] * T(255));
|
||||
v[(width * 3 * i) + (j * 3) + 2] = byte(m_Entries[j][2] * T(255));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -545,11 +545,11 @@ public:
|
||||
|
||||
//Calculate the max-value color (ranged 0 - 1).
|
||||
for (rgbi = 0; rgbi < 3; rgbi++)
|
||||
newRgb[rgbi] = (bucketT)newls * cBuf[rgbi] / bucketT(255.0);
|
||||
newRgb[rgbi] = bucketT(newls) * cBuf[rgbi] / bucketT(255.0);
|
||||
|
||||
//Reduce saturation by the lsratio.
|
||||
Palette<bucketT>::RgbToHsv(newRgb, newhsv);
|
||||
newhsv[1] *= (bucketT)lsratio;
|
||||
newhsv[1] *= bucketT(lsratio);
|
||||
Palette<bucketT>::HsvToRgb(newhsv, newRgb);
|
||||
|
||||
for (rgbi = 0; rgbi < 3; rgbi++)
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
if (ReadFile(filename.c_str(), buf))
|
||||
{
|
||||
xmlDocPtr doc = xmlReadMemory((const char*)buf.data(), (int)buf.size(), filename.c_str(), nullptr, XML_PARSE_NONET);
|
||||
xmlDocPtr doc = xmlReadMemory(static_cast<const char*>(buf.data()), int(buf.size()), filename.c_str(), nullptr, XML_PARSE_NONET);
|
||||
|
||||
if (doc != nullptr)
|
||||
{
|
||||
@ -81,7 +81,7 @@ public:
|
||||
{
|
||||
if (i == -1)
|
||||
return &m_Palettes[QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Rand() % Size()];
|
||||
else if (i < (int)m_Palettes.size())
|
||||
else if (i < int(m_Palettes.size()))
|
||||
return &m_Palettes[i];
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ private:
|
||||
|
||||
while (attr)
|
||||
{
|
||||
val = (char*)xmlGetProp(node, attr->name);
|
||||
val = reinterpret_cast<char*>(xmlGetProp(node, attr->name));
|
||||
|
||||
if (!Compare(attr->name, "data"))
|
||||
{
|
||||
@ -172,7 +172,7 @@ private:
|
||||
|
||||
do
|
||||
{
|
||||
int ret = sscanf_s((char*)&(val[colorIndex]),"00%2x%2x%2x", &r, &g, &b);
|
||||
int ret = sscanf_s(static_cast<char*>(&(val[colorIndex])),"00%2x%2x%2x", &r, &g, &b);
|
||||
|
||||
if (ret != 3)
|
||||
{
|
||||
@ -183,7 +183,7 @@ private:
|
||||
|
||||
colorIndex += 8;
|
||||
|
||||
while (isspace((int)val[colorIndex]))
|
||||
while (isspace(int(val[colorIndex])))
|
||||
colorIndex++;
|
||||
|
||||
palette[colorCount].r = T(r) / T(255);//Store as normalized colors in the range of 0-1.
|
||||
|
@ -124,11 +124,11 @@ void Renderer<T, bucketT>::ComputeBounds()
|
||||
//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 (size_t i = 0; i < m_Embers.size(); i++)
|
||||
maxDEFilterWidth = max((size_t)(ceil(m_Embers[i].m_MaxRadDE) * m_Ember.m_Supersample), maxDEFilterWidth);
|
||||
maxDEFilterWidth = max(size_t(ceil(m_Embers[i].m_MaxRadDE) * m_Ember.m_Supersample), maxDEFilterWidth);
|
||||
|
||||
//Need an extra ss = (int)floor(m_Supersample / 2.0) of pixels so that a local iteration count for DE can be determined.//SMOULDER
|
||||
if (maxDEFilterWidth > 0)
|
||||
maxDEFilterWidth += (size_t)Floor<T>(m_Ember.m_Supersample / T(2));
|
||||
maxDEFilterWidth += size_t(Floor<T>(m_Ember.m_Supersample / T(2)));
|
||||
|
||||
//To have a fully present set of pixels for the spatial filter, must
|
||||
//add the DE filter width to the spatial filter width.//SMOULDER
|
||||
@ -546,7 +546,7 @@ FilterAndAccum:
|
||||
//to be very dark. Correct it by pretending the number of iters done is the exact quality desired and then scale according to that.
|
||||
if (forceOutput)
|
||||
{
|
||||
T quality = ((T)m_Stats.m_Iters / (T)FinalDimensions()) * (m_Scale * m_Scale);
|
||||
T quality = (T(m_Stats.m_Iters) / T(FinalDimensions())) * (m_Scale * m_Scale);
|
||||
m_K2 = (Supersample() * Supersample()) / (area * quality * m_TemporalFilter->SumFilt());
|
||||
}
|
||||
else
|
||||
@ -654,7 +654,7 @@ EmberImageComments Renderer<T, bucketT>::ImageComments(EmberStats& stats, size_t
|
||||
|
||||
ss.imbue(std::locale(""));
|
||||
comments.m_Genome = m_EmberToXml.ToString(m_Ember, "", printEditDepth, false, intPalette, hexPalette);
|
||||
ss << ((double)stats.m_Badvals / (double)stats.m_Iters);//Percentage of bad values to iters.
|
||||
ss << (double(stats.m_Badvals) / double(stats.m_Iters));//Percentage of bad values to iters.
|
||||
comments.m_Badvals = ss.str(); ss.str("");
|
||||
ss << stats.m_Iters;
|
||||
comments.m_NumIters = ss.str(); ss.str("");//Total iters.
|
||||
@ -804,7 +804,7 @@ eRenderStatus Renderer<T, bucketT>::LogScaleDensityFilter()
|
||||
|
||||
//Original did a temporary assignment, then *= logScale, then passed the result to bump_no_overflow().
|
||||
//Combine here into one operation for a slight speedup.
|
||||
m_AccumulatorBuckets[index] = m_HistBuckets[index] * (bucketT)logScale;
|
||||
m_AccumulatorBuckets[index] = m_HistBuckets[index] * bucketT(logScale);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -833,14 +833,14 @@ eRenderStatus Renderer<T, bucketT>::GaussianDensityFilter()
|
||||
size_t endRow = m_SuperRasH - (Supersample() - 1);//Original did + which is most likely wrong.
|
||||
intmax_t startCol = Supersample() - 1;
|
||||
intmax_t endCol = m_SuperRasW - (Supersample() - 1);
|
||||
size_t chunkSize = (size_t)ceil(double(endRow - startRow) / double(threads));
|
||||
size_t chunkSize = size_t(ceil(double(endRow - startRow) / double(threads)));
|
||||
|
||||
//parallel_for scales very well, dividing the work almost perfectly among all processors.
|
||||
parallel_for(size_t(0), threads, [&] (size_t threadIndex)
|
||||
{
|
||||
size_t pixelNumber = 0;
|
||||
int localStartRow = (int)min(startRow + (threadIndex * chunkSize), endRow - 1);
|
||||
int localEndRow = (int)min(localStartRow + chunkSize, endRow);
|
||||
int localStartRow = int(min(startRow + (threadIndex * chunkSize), endRow - 1));
|
||||
int localEndRow = int(min(localStartRow + chunkSize, endRow));
|
||||
size_t pixelsThisThread = size_t(localEndRow - localStartRow) * m_SuperRasW;
|
||||
double lastPercent = 0;
|
||||
glm::detail::tvec4<bucketT, glm::defaultp> logScaleBucket;
|
||||
@ -876,9 +876,9 @@ eRenderStatus Renderer<T, bucketT>::GaussianDensityFilter()
|
||||
//when calculating the density for a box centered on the last row or column.
|
||||
//Clamp here to not run over the edge.
|
||||
intmax_t densityBoxLeftX = (i - min(i, ss));
|
||||
intmax_t densityBoxRightX = (i + min(ss, (intmax_t)m_SuperRasW - i - 1));
|
||||
intmax_t densityBoxRightX = (i + min(ss, intmax_t(m_SuperRasW) - i - 1));
|
||||
intmax_t densityBoxTopY = (j - min(j, ss));
|
||||
intmax_t densityBoxBottomY = (j + min(ss, (intmax_t)m_SuperRasH - j - 1));
|
||||
intmax_t densityBoxBottomY = (j + min(ss, intmax_t(m_SuperRasH) - j - 1));
|
||||
|
||||
//Count density in ssxss area.
|
||||
//Original went one col at a time, which is cache inefficient. Go one row at at time here for a slight speedup.
|
||||
@ -894,9 +894,9 @@ eRenderStatus Renderer<T, bucketT>::GaussianDensityFilter()
|
||||
if (filterSelect > m_DensityFilter->MaxFilteredCounts())
|
||||
filterSelectInt = m_DensityFilter->MaxFilterIndex();
|
||||
else if (filterSelect <= DE_THRESH)
|
||||
filterSelectInt = (size_t)ceil(filterSelect) - 1;
|
||||
filterSelectInt = size_t(ceil(filterSelect)) - 1;
|
||||
else
|
||||
filterSelectInt = DE_THRESH + (size_t)Floor<T>(pow(filterSelect - DE_THRESH, m_DensityFilter->Curve()));
|
||||
filterSelectInt = DE_THRESH + size_t(Floor<T>(pow(filterSelect - DE_THRESH, m_DensityFilter->Curve())));
|
||||
|
||||
//If the filter selected below the min specified clamp it to the min.
|
||||
if (filterSelectInt > m_DensityFilter->MaxFilterIndex())
|
||||
@ -904,7 +904,7 @@ eRenderStatus Renderer<T, bucketT>::GaussianDensityFilter()
|
||||
|
||||
//Only have to calculate the values for ~1/8 of the square.
|
||||
filterCoefIndex = filterSelectInt * m_DensityFilter->KernelSize();
|
||||
arrFilterWidth = (intmax_t)ceil(filterWidths[filterSelectInt]) - 1;
|
||||
arrFilterWidth = intmax_t(ceil(filterWidths[filterSelectInt])) - 1;
|
||||
|
||||
for (jj = 0; jj <= arrFilterWidth; jj++)
|
||||
{
|
||||
@ -1074,46 +1074,46 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(byte* pixels, size_t
|
||||
|
||||
if (BytesPerChannel() == 2)
|
||||
{
|
||||
p16 = (uint16*)(pixels + pixelsRowStart);
|
||||
p16 = reinterpret_cast<uint16*>(pixels + pixelsRowStart);
|
||||
|
||||
if (EarlyClip())
|
||||
{
|
||||
p16[0] = (uint16)(Clamp<bucketT>(newBucket.r, 0, 255) * bucketT(256));
|
||||
p16[1] = (uint16)(Clamp<bucketT>(newBucket.g, 0, 255) * bucketT(256));
|
||||
p16[2] = (uint16)(Clamp<bucketT>(newBucket.b, 0, 255) * bucketT(256));
|
||||
p16[0] = uint16(Clamp<bucketT>(newBucket.r, 0, 255) * bucketT(256));
|
||||
p16[1] = uint16(Clamp<bucketT>(newBucket.g, 0, 255) * bucketT(256));
|
||||
p16[2] = uint16(Clamp<bucketT>(newBucket.b, 0, 255) * bucketT(256));
|
||||
|
||||
if (NumChannels() > 3)
|
||||
{
|
||||
if (Transparency())
|
||||
p16[3] = (byte)(Clamp<bucketT>(newBucket.a, 0, 1) * bucketT(65535.0));
|
||||
p16[3] = byte(Clamp<bucketT>(newBucket.a, 0, 1) * bucketT(65535.0));
|
||||
else
|
||||
p16[3] = 65535;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GammaCorrection(*(glm::detail::tvec4<bucketT, glm::defaultp>*)(&newBucket), background, g, linRange, vibrancy, NumChannels() > 3, true, p16);
|
||||
GammaCorrection(*(reinterpret_cast<glm::detail::tvec4<bucketT, glm::defaultp>*>(&newBucket)), background, g, linRange, vibrancy, NumChannels() > 3, true, p16);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EarlyClip())
|
||||
{
|
||||
pixels[pixelsRowStart] = (byte)Clamp<bucketT>(newBucket.r, 0, 255);
|
||||
pixels[pixelsRowStart + 1] = (byte)Clamp<bucketT>(newBucket.g, 0, 255);
|
||||
pixels[pixelsRowStart + 2] = (byte)Clamp<bucketT>(newBucket.b, 0, 255);
|
||||
pixels[pixelsRowStart] = byte(Clamp<bucketT>(newBucket.r, 0, 255));
|
||||
pixels[pixelsRowStart + 1] = byte(Clamp<bucketT>(newBucket.g, 0, 255));
|
||||
pixels[pixelsRowStart + 2] = byte(Clamp<bucketT>(newBucket.b, 0, 255));
|
||||
|
||||
if (NumChannels() > 3)
|
||||
{
|
||||
if (Transparency())
|
||||
pixels[pixelsRowStart + 3] = (byte)(Clamp<bucketT>(newBucket.a, 0, 1) * bucketT(255.0));
|
||||
pixels[pixelsRowStart + 3] = byte(Clamp<bucketT>(newBucket.a, 0, 1) * bucketT(255.0));
|
||||
else
|
||||
pixels[pixelsRowStart + 3] = 255;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GammaCorrection(*(glm::detail::tvec4<bucketT, glm::defaultp>*)(&newBucket), background, g, linRange, vibrancy, NumChannels() > 3, true, pixels + pixelsRowStart);
|
||||
GammaCorrection(*(reinterpret_cast<glm::detail::tvec4<bucketT, glm::defaultp>*>(&newBucket)), background, g, linRange, vibrancy, NumChannels() > 3, true, pixels + pixelsRowStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1133,9 +1133,9 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(byte* pixels, size_t
|
||||
{
|
||||
byte* p = pixels + (NumChannels() * (i + j * FinalRasW()));
|
||||
|
||||
p[0] = (byte)(m_TempEmber.m_Palette[i * 256 / FinalRasW()][0] * WHITE);//The palette is [0..1], output image is [0..255].
|
||||
p[1] = (byte)(m_TempEmber.m_Palette[i * 256 / FinalRasW()][1] * WHITE);
|
||||
p[2] = (byte)(m_TempEmber.m_Palette[i * 256 / FinalRasW()][2] * WHITE);
|
||||
p[0] = byte(m_TempEmber.m_Palette[i * 256 / FinalRasW()][0] * WHITE);//The palette is [0..1], output image is [0..255].
|
||||
p[1] = byte(m_TempEmber.m_Palette[i * 256 / FinalRasW()][1] * WHITE);
|
||||
p[2] = byte(m_TempEmber.m_Palette[i * 256 / FinalRasW()][2] * WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1164,7 +1164,7 @@ EmberStats Renderer<T, bucketT>::Iterate(size_t iterCount, size_t temporalSample
|
||||
{
|
||||
//Timing t2(4);
|
||||
m_IterTimer.Tic();
|
||||
size_t totalItersPerThread = (size_t)ceil((double)iterCount / (double)m_ThreadsToUse);
|
||||
size_t totalItersPerThread = size_t(ceil(double(iterCount) / double(m_ThreadsToUse)));
|
||||
double percent, etaMs;
|
||||
EmberStats stats;
|
||||
|
||||
@ -1232,7 +1232,7 @@ EmberStats Renderer<T, bucketT>::Iterate(size_t iterCount, size_t temporalSample
|
||||
//This assumes the threads progress at roughly the same speed.
|
||||
double(m_LastIter + (m_SubBatch[threadIndex] * m_ThreadsToUse)) / double(ItersPerTemporalSample())
|
||||
) + temporalSample
|
||||
) / (double)TemporalSamples()
|
||||
) / double(TemporalSamples())
|
||||
);
|
||||
|
||||
double percentDiff = percent - m_LastIterPercent;
|
||||
@ -1305,11 +1305,11 @@ template <typename T, typename bucketT> TemporalFilter<T>* Renderer<T, buc
|
||||
/// Virtual renderer properties overridden from RendererBase, getters only.
|
||||
/// </summary>
|
||||
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::ScaledQuality() const { return (double)m_ScaledQuality; }
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::LowerLeftX(bool gutter) const { return (double)(gutter ? m_CarToRas.CarLlX() : m_LowerLeftX); }
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::LowerLeftY(bool gutter) const { return (double)(gutter ? m_CarToRas.CarLlY() : m_LowerLeftY); }
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::UpperRightX(bool gutter) const { return (double)(gutter ? m_CarToRas.CarUrX() : m_UpperRightX); }
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::UpperRightY(bool gutter) const { return (double)(gutter ? m_CarToRas.CarUrY() : m_UpperRightY); }
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::ScaledQuality() const { return double(m_ScaledQuality); }
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::LowerLeftX(bool gutter) const { return double(gutter ? m_CarToRas.CarLlX() : m_LowerLeftX); }
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::LowerLeftY(bool gutter) const { return double(gutter ? m_CarToRas.CarLlY() : m_LowerLeftY); }
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::UpperRightX(bool gutter) const { return double(gutter ? m_CarToRas.CarUrX() : m_UpperRightX); }
|
||||
template <typename T, typename bucketT> double Renderer<T, bucketT>::UpperRightY(bool gutter) const { return double(gutter ? m_CarToRas.CarUrY() : m_UpperRightY); }
|
||||
template <typename T, typename bucketT> DensityFilterBase* Renderer<T, bucketT>::GetDensityFilter() { return m_DensityFilter.get(); }
|
||||
|
||||
/// <summary>
|
||||
@ -1357,9 +1357,9 @@ template <typename T, typename bucketT> size_t Renderer<T, bucketT>::FuseCount()
|
||||
/// Non-virtual iterator wrappers.
|
||||
/// </summary>
|
||||
|
||||
template <typename T, typename bucketT> const byte* Renderer<T, bucketT>::XformDistributions() const { return m_Iterator != nullptr ? m_Iterator->XformDistributions() : nullptr; }
|
||||
template <typename T, typename bucketT> const size_t Renderer<T, bucketT>::XformDistributionsSize() const { return m_Iterator != nullptr ? m_Iterator->XformDistributionsSize() : 0; }
|
||||
template <typename T, typename bucketT> Point<T>* Renderer<T, bucketT>::Samples(size_t threadIndex) const { return threadIndex < m_Samples.size() ? (Point<T>*)m_Samples[threadIndex].data() : nullptr; }
|
||||
template <typename T, typename bucketT> const byte* Renderer<T, bucketT>::XformDistributions() const { return m_Iterator != nullptr ? m_Iterator->XformDistributions() : nullptr; }
|
||||
template <typename T, typename bucketT> size_t Renderer<T, bucketT>::XformDistributionsSize() const { return m_Iterator != nullptr ? m_Iterator->XformDistributionsSize() : 0; }
|
||||
template <typename T, typename bucketT> Point<T>* Renderer<T, bucketT>::Samples(size_t threadIndex) const { return threadIndex < m_Samples.size() ? const_cast<Point<T>*>(m_Samples[threadIndex].data()) : nullptr; }
|
||||
|
||||
/// <summary>
|
||||
/// Non-virtual functions that might be needed by a derived class.
|
||||
@ -1465,8 +1465,8 @@ void Renderer<T, bucketT>::Accumulate(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand, Poin
|
||||
//Use overloaded addition and multiplication operators in vec4 to perform the accumulation.
|
||||
if (PaletteMode() == PALETTE_LINEAR)
|
||||
{
|
||||
colorIndex = (bucketT)p.m_ColorX * COLORMAP_LENGTH;
|
||||
intColorIndex = (size_t)colorIndex;
|
||||
colorIndex = bucketT(p.m_ColorX) * COLORMAP_LENGTH;
|
||||
intColorIndex = size_t(colorIndex);
|
||||
|
||||
if (intColorIndex < 0)
|
||||
{
|
||||
@ -1480,22 +1480,22 @@ void Renderer<T, bucketT>::Accumulate(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand, Poin
|
||||
}
|
||||
else
|
||||
{
|
||||
colorIndexFrac = colorIndex - (bucketT)intColorIndex;//Interpolate between intColorIndex and intColorIndex + 1.
|
||||
colorIndexFrac = colorIndex - bucketT(intColorIndex);//Interpolate between intColorIndex and intColorIndex + 1.
|
||||
}
|
||||
|
||||
if (p.m_VizAdjusted == 1)
|
||||
m_HistBuckets[histIndex] += ((dmap[intColorIndex] * (1 - colorIndexFrac)) + (dmap[intColorIndex + 1] * colorIndexFrac));
|
||||
else
|
||||
m_HistBuckets[histIndex] += (((dmap[intColorIndex] * (1 - colorIndexFrac)) + (dmap[intColorIndex + 1] * colorIndexFrac)) * (bucketT)p.m_VizAdjusted);
|
||||
m_HistBuckets[histIndex] += (((dmap[intColorIndex] * (1 - colorIndexFrac)) + (dmap[intColorIndex + 1] * colorIndexFrac)) * bucketT(p.m_VizAdjusted));
|
||||
}
|
||||
else if (PaletteMode() == PALETTE_STEP)
|
||||
{
|
||||
intColorIndex = Clamp<size_t>((size_t)(p.m_ColorX * COLORMAP_LENGTH), 0, COLORMAP_LENGTH_MINUS_1);
|
||||
intColorIndex = Clamp<size_t>(size_t(p.m_ColorX * COLORMAP_LENGTH), 0, COLORMAP_LENGTH_MINUS_1);
|
||||
|
||||
if (p.m_VizAdjusted == 1)
|
||||
m_HistBuckets[histIndex] += dmap[intColorIndex];
|
||||
else
|
||||
m_HistBuckets[histIndex] += (dmap[intColorIndex] * (bucketT)p.m_VizAdjusted);
|
||||
m_HistBuckets[histIndex] += (dmap[intColorIndex] * bucketT(p.m_VizAdjusted));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1514,7 +1514,7 @@ void Renderer<T, bucketT>::Accumulate(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand, Poin
|
||||
template <typename T, typename bucketT>
|
||||
void Renderer<T, bucketT>::AddToAccum(const glm::detail::tvec4<bucketT, glm::defaultp>& bucket, intmax_t i, intmax_t ii, intmax_t j, intmax_t jj)
|
||||
{
|
||||
if (j + jj >= 0 && j + jj < (intmax_t)m_SuperRasH && i + ii >= 0 && i + ii < (intmax_t)m_SuperRasW)
|
||||
if (j + jj >= 0 && j + jj < intmax_t(m_SuperRasH) && i + ii >= 0 && i + ii < intmax_t(m_SuperRasW))
|
||||
m_AccumulatorBuckets[(i + ii) + ((j + jj) * m_SuperRasW)] += bucket;
|
||||
}
|
||||
|
||||
@ -1573,17 +1573,17 @@ void Renderer<T, bucketT>::GammaCorrection(glm::detail::tvec4<bucketT, glm::defa
|
||||
}
|
||||
|
||||
if (!scale)
|
||||
correctedChannels[rgbi] = (accumT)Clamp<T>(a, 0, 255);//Early clip, just assign directly.
|
||||
correctedChannels[rgbi] = accumT(Clamp<T>(a, 0, 255));//Early clip, just assign directly.
|
||||
else
|
||||
correctedChannels[rgbi] = (accumT)(Clamp<T>(a, 0, 255) * scaleVal);//Final accum, multiply by 1 for 8 bpc, or 256 for 16 bpc.
|
||||
correctedChannels[rgbi] = accumT(Clamp<T>(a, 0, 255) * scaleVal);//Final accum, multiply by 1 for 8 bpc, or 256 for 16 bpc.
|
||||
}
|
||||
|
||||
if (doAlpha)
|
||||
{
|
||||
if (!scale)
|
||||
correctedChannels[3] = (accumT)alpha;//Early clip, just assign alpha directly.
|
||||
correctedChannels[3] = accumT(alpha);//Early clip, just assign alpha directly.
|
||||
else if (Transparency())
|
||||
correctedChannels[3] = (accumT)(alpha * numeric_limits<accumT>::max());//Final accum, 4 channels, using transparency. Scale alpha from 0-1 to 0-255 for 8 bpc or 0-65535 for 16 bpc.
|
||||
correctedChannels[3] = accumT(alpha * numeric_limits<accumT>::max());//Final accum, 4 channels, using transparency. Scale alpha from 0-1 to 0-255 for 8 bpc or 0-65535 for 16 bpc.
|
||||
else
|
||||
correctedChannels[3] = numeric_limits<accumT>::max();//Final accum, 4 channels, but not using transparency. 255 for 8 bpc, 65535 for 16 bpc.
|
||||
}
|
||||
|
@ -139,9 +139,9 @@ public:
|
||||
virtual size_t FuseCount() const override;
|
||||
|
||||
//Non-virtual iterator wrappers.
|
||||
const byte* XformDistributions() const;
|
||||
const size_t XformDistributionsSize() const;
|
||||
Point<T>* Samples(size_t threadIndex) const;
|
||||
const byte* XformDistributions() const;
|
||||
size_t XformDistributionsSize() const;
|
||||
Point<T>* Samples(size_t threadIndex) const;
|
||||
|
||||
protected:
|
||||
//Non-virtual functions that might be needed by a derived class.
|
||||
|
@ -280,8 +280,8 @@ size_t RendererBase::FinalBufferSize() const { return FinalRowSize() *
|
||||
size_t RendererBase::PixelSize() const { return NumChannels() * BytesPerChannel(); }
|
||||
size_t RendererBase::GutterWidth() const { return m_GutterWidth; }
|
||||
size_t RendererBase::DensityFilterOffset() const { return m_DensityFilterOffset; }
|
||||
size_t RendererBase::TotalIterCount(size_t strips) const { return (size_t)((size_t)Round(ScaledQuality()) * FinalRasW() * FinalRasH() * strips); }//Use Round() because there can be some roundoff error when interpolating.
|
||||
size_t RendererBase::ItersPerTemporalSample() const { return (size_t)ceil(double(TotalIterCount(1)) / double(TemporalSamples())); }//Temporal samples is used with animation, which doesn't support strips, so pass 1.
|
||||
size_t RendererBase::TotalIterCount(size_t strips) const { return size_t(size_t(Round(ScaledQuality())) * FinalRasW() * FinalRasH() * strips); }//Use Round() because there can be some roundoff error when interpolating.
|
||||
size_t RendererBase::ItersPerTemporalSample() const { return size_t(ceil(double(TotalIterCount(1)) / double(TemporalSamples()))); }//Temporal samples is used with animation, which doesn't support strips, so pass 1.
|
||||
eProcessState RendererBase::ProcessState() const { return m_ProcessState; }
|
||||
eProcessAction RendererBase::ProcessAction() const { return m_ProcessAction; }
|
||||
EmberStats RendererBase::Stats() const { return m_Stats; }
|
||||
@ -449,7 +449,7 @@ void RendererBase::ThreadCount(size_t threads, const char* seedString)
|
||||
if (seedString)
|
||||
{
|
||||
memset(seeds, 0, isaacSize * sizeof(ISAAC_INT));
|
||||
memcpy((char*)seeds, seedString, min(strlen(seedString), isaacSize * sizeof(ISAAC_INT)));
|
||||
memcpy(reinterpret_cast<char*>(seeds), seedString, min(strlen(seedString), isaacSize * sizeof(ISAAC_INT)));
|
||||
}
|
||||
|
||||
//This is critical for multithreading, otherwise the threads all happen
|
||||
@ -460,7 +460,7 @@ void RendererBase::ThreadCount(size_t threads, const char* seedString)
|
||||
|
||||
if (seedString)
|
||||
{
|
||||
ISAAC_INT newSize = (ISAAC_INT)(size + 5 + (t.Toc() + t.EndTime()));
|
||||
ISAAC_INT newSize = ISAAC_INT(size + 5 + (t.Toc() + t.EndTime()));
|
||||
|
||||
#ifdef ISAAC_FLAM3_DEBUG
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> isaac(0, 0, 0, seeds);
|
||||
@ -470,18 +470,18 @@ void RendererBase::ThreadCount(size_t threads, const char* seedString)
|
||||
m_Rand.push_back(isaac);
|
||||
|
||||
for (i = 0; i < (isaacSize * sizeof(ISAAC_INT)); i++)
|
||||
((byte*)seeds)[i]++;
|
||||
reinterpret_cast<byte*>(seeds)[i]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < isaacSize; i++)
|
||||
{
|
||||
t.Toc();
|
||||
seeds[i] = (ISAAC_INT)((t.EndTime() * i) + (size + 1));
|
||||
seeds[i] = ISAAC_INT((t.EndTime() * i) + (size + 1));
|
||||
}
|
||||
|
||||
t.Toc();
|
||||
ISAAC_INT r = (ISAAC_INT)((size * i) + i + t.EndTime());
|
||||
ISAAC_INT r = ISAAC_INT((size * i) + i + t.EndTime());
|
||||
QTIsaac<ISAAC_SIZE, ISAAC_INT> isaac(r, r * 2, r * 3, seeds);
|
||||
|
||||
m_Rand.push_back(isaac);
|
||||
@ -611,4 +611,4 @@ bool RendererBase::Aborted() { return m_Abort; }
|
||||
bool RendererBase::InRender() { return m_InRender; }
|
||||
bool RendererBase::InFinalAccum() { return m_InFinalAccum; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ public:
|
||||
{
|
||||
vector<eVariationId> useVars;
|
||||
|
||||
Random(ember, useVars, (int)m_Rand.Frand<T>(-2, 2), 0);
|
||||
Random(ember, useVars, static_cast<int>(m_Rand.Frand<T>(-2, 2)), 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -747,7 +747,7 @@ public:
|
||||
if (var != -2)
|
||||
{
|
||||
//Pick a random variation and use a random weight from 0-1.
|
||||
Variation<T>* v = m_VariationList.GetVariationCopy((size_t)(m_Rand.Rand() % varCount), m_Rand.Frand<T>(T(0.001), 1));
|
||||
Variation<T>* v = m_VariationList.GetVariationCopy(static_cast<size_t>(m_Rand.Rand() % varCount), m_Rand.Frand<T>(T(0.001), 1));
|
||||
|
||||
if (v && !xform->AddVariation(v))
|
||||
delete v;//It already existed and therefore was not added.
|
||||
@ -782,7 +782,7 @@ public:
|
||||
if (var != -2)
|
||||
{
|
||||
//Pick a random variation and use a random weight from 0-1.
|
||||
xform->AddVariation(m_VariationList.GetVariationCopy((size_t)(m_Rand.Rand() % varCount), m_Rand.Frand<T>(T(0.001), 1)));
|
||||
xform->AddVariation(m_VariationList.GetVariationCopy(static_cast<size_t>(m_Rand.Rand() % varCount), m_Rand.Frand<T>(T(0.001), 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -869,8 +869,8 @@ public:
|
||||
//Scale the image so that the total number of pixels is ~10,000.
|
||||
pixTotal = ember.m_FinalRasW * ember.m_FinalRasH;
|
||||
scalar = sqrt(T(10000) / pixTotal);
|
||||
adjustedEmber.m_FinalRasW = (size_t)(ember.m_FinalRasW * scalar);
|
||||
adjustedEmber.m_FinalRasH = (size_t)(ember.m_FinalRasH * scalar);
|
||||
adjustedEmber.m_FinalRasW = static_cast<size_t>(ember.m_FinalRasW * scalar);
|
||||
adjustedEmber.m_FinalRasH = static_cast<size_t>(ember.m_FinalRasH * scalar);
|
||||
adjustedEmber.m_PixelsPerUnit *= scalar;
|
||||
adjustedEmber.m_TemporalSamples = 1;
|
||||
|
||||
@ -889,7 +889,7 @@ public:
|
||||
|
||||
m_Hist.resize(res3);
|
||||
memset(m_Hist.data(), 0, res3);
|
||||
|
||||
|
||||
p = m_FinalImage.data();
|
||||
|
||||
for (i = 0; i < m_Renderer->FinalDimensions(); i++)
|
||||
@ -1310,7 +1310,7 @@ public:
|
||||
if (eps > T(0.3))
|
||||
eps = T(0.3);
|
||||
|
||||
lowTarget = (size_t)(samples * eps);
|
||||
lowTarget = static_cast<size_t>(samples * eps);
|
||||
highTarget = samples - lowTarget;
|
||||
|
||||
min[0] = min[1] = 1e10;
|
||||
|
@ -110,7 +110,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 fwidth = int(fw) + 1;
|
||||
int i, j;
|
||||
|
||||
//Make sure the filter kernel has same parity as oversample.
|
||||
@ -147,7 +147,7 @@ public:
|
||||
m_FinalFilterWidth = fwidth;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
m_FilterRadius += T(0.01);//Values were too small.
|
||||
} while (1);
|
||||
}
|
||||
|
@ -62,13 +62,13 @@ public:
|
||||
/// Return the begin time as a double.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
double BeginTime() { return (double)m_BeginTime.time_since_epoch().count(); }
|
||||
double BeginTime() { return static_cast<double>(m_BeginTime.time_since_epoch().count()); }
|
||||
|
||||
/// <summary>
|
||||
/// Return the end time as a double.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
double EndTime() { return (double)m_EndTime.time_since_epoch().count(); }
|
||||
double EndTime() { return static_cast<double>(m_EndTime.time_since_epoch().count()); }
|
||||
|
||||
/// <summary>
|
||||
/// Return the elapsed time in milliseconds.
|
||||
@ -103,13 +103,13 @@ public:
|
||||
double days = x;
|
||||
|
||||
if (days >= 1)
|
||||
ss << (int)days << "d ";
|
||||
ss << static_cast<int>(days) << "d ";
|
||||
|
||||
if (hours >= 1)
|
||||
ss << (int)hours << "h ";
|
||||
ss << static_cast<int>(hours) << "h ";
|
||||
|
||||
if (mins >= 1)
|
||||
ss << (int)mins << "m ";
|
||||
ss << static_cast<int>(mins) << "m ";
|
||||
|
||||
ss << std::fixed << std::setprecision(m_Precision) << secs << "s";
|
||||
return ss.str();
|
||||
|
@ -188,11 +188,11 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
|
||||
{
|
||||
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() == (size_t)(statBuf.st_size + 1))//Ensure allocation succeeded.
|
||||
if (buf.size() == static_cast<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 == (size_t)statBuf.st_size)//Ensure the number of bytes read matched what was requested.
|
||||
if (bytesRead == (static_cast<size_t>(statBuf.st_size)))//Ensure the number of bytes read matched what was requested.
|
||||
{
|
||||
if (nullTerminate)//Optionally nullptr terminate if they want to treat it as a string.
|
||||
buf[buf.size() - 1] = 0;
|
||||
@ -229,7 +229,7 @@ static void CopyVec(vector<T>& dest, const vector<U>& source)
|
||||
dest.resize(source.size());
|
||||
|
||||
for (size_t i = 0; i < source.size(); i++)
|
||||
dest[i] = (T)source[i];//Valid assignment operator between T and U types must be defined somewhere.
|
||||
dest[i] = static_cast<T>(source[i]);//Valid assignment operator between T and U types must be defined somewhere.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -248,7 +248,7 @@ static void CopyVec(vector<T>& dest, const vector<U>& source, std::function<void
|
||||
|
||||
for (size_t i = 0; i < source.size(); i++)
|
||||
{
|
||||
dest[i] = (T)source[i];//Valid assignment operator between T and U types must be defined somewhere.
|
||||
dest[i] = static_cast<T>(source[i]);//Valid assignment operator between T and U types must be defined somewhere.
|
||||
perElementOperation(dest[i]);
|
||||
}
|
||||
}
|
||||
@ -287,7 +287,7 @@ static void ClearVec(vector<T*>& vec, bool arrayDelete = false)
|
||||
template<typename T>
|
||||
static inline void Memset(vector<T>& vec, int val = 0)
|
||||
{
|
||||
memset((void*)vec.data(), val, SizeOf(vec));
|
||||
memset(static_cast<void*>(vec.data()), val, SizeOf(vec));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -301,11 +301,11 @@ static inline int Floor(T val)
|
||||
{
|
||||
if (val >= 0)
|
||||
{
|
||||
return (int)val;
|
||||
return static_cast<int>(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = (int)val;//Truncate.
|
||||
int i = static_cast<int>(val);//Truncate.
|
||||
return i - (i > val);//Convert trunc to floor.
|
||||
}
|
||||
}
|
||||
@ -430,7 +430,7 @@ static inline void ClampGte0Ref(T& val)
|
||||
template <typename T>
|
||||
static inline T Round(T r)
|
||||
{
|
||||
return (r > 0) ? (T)Floor<T>(r + T(0.5)) : ceil(r - T(0.5));
|
||||
return (r > 0) ? static_cast<T>(Floor<T>(r + T(0.5))) : ceil(r - T(0.5));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -440,8 +440,8 @@ static inline T Round(T r)
|
||||
/// <returns>The rounded value</returns>
|
||||
static inline float LRint(float x)
|
||||
{
|
||||
int temp = (x >= 0 ? (int)(x + 0.5f) : (int)(x - 0.5f));
|
||||
return (float)temp;
|
||||
int temp = (x >= 0 ? static_cast<int>(x + 0.5f) : static_cast<int>(x - 0.5f));
|
||||
return static_cast<float>(temp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -451,8 +451,8 @@ static inline float LRint(float x)
|
||||
/// <returns>The rounded value</returns>
|
||||
static inline double LRint(double x)
|
||||
{
|
||||
glm::int64_t temp = (x >= 0 ? (int64_t)(x + 0.5) : (int64_t)(x - 0.5));
|
||||
return (double)temp;
|
||||
glm::int64_t temp = (x >= 0 ? static_cast<int64_t>(x + 0.5) : static_cast<int64_t>(x - 0.5));
|
||||
return static_cast<double>(temp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -468,7 +468,7 @@ static inline T Round6(T r)
|
||||
if (r < 0)
|
||||
r -= 1;
|
||||
|
||||
return T(1e-6 * (int)(r + T(0.5)));
|
||||
return static_cast<T>(1e-6 * static_cast<int>(r + T(0.5)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -480,7 +480,7 @@ static inline T Round6(T r)
|
||||
template <typename T>
|
||||
static inline T Sign(T v)
|
||||
{
|
||||
return (v < 0) ? T(-1) : (v > 0) ? T(1) : T(0);
|
||||
return (v < 0) ? static_cast<T>(-1) : (v > 0) ? static_cast<T>(1) : static_cast<T>(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -492,7 +492,7 @@ static inline T Sign(T v)
|
||||
template <typename T>
|
||||
static inline T SignNz(T v)
|
||||
{
|
||||
return (v < 0) ? T(-1) : T(1);
|
||||
return (v < 0) ? static_cast<T>(-1) : static_cast<T>(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -701,7 +701,7 @@ static inline T LogMap(T x)
|
||||
/// <returns>True if the comparison matched, else false</returns>
|
||||
static inline bool Compare(const xmlChar* name, const char* val)
|
||||
{
|
||||
return xmlStrcmp(name, XC val) != 0;
|
||||
return xmlStrcmp(name, XC(val)) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -904,7 +904,7 @@ static
|
||||
#endif
|
||||
uint Arg<uint>(char* name, uint def)
|
||||
{
|
||||
return Arg<int>(name, (int)def);
|
||||
return Arg<int>(name, static_cast<int>(def));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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<T>*)variation.ParentXform() : nullptr;
|
||||
m_Xform = typeid(T) == typeid(U) ? const_cast<Xform<T>*>(reinterpret_cast<const Xform<T>*>(variation.ParentXform())) : nullptr;
|
||||
m_NeedPrecalcSumSquares = variation.NeedPrecalcSumSquares();
|
||||
m_NeedPrecalcSqrtSumSquares = variation.NeedPrecalcSqrtSumSquares();
|
||||
m_NeedPrecalcAngles = variation.NeedPrecalcAngles();
|
||||
@ -1536,17 +1536,17 @@ public:
|
||||
|
||||
case INTEGER :
|
||||
{
|
||||
*m_Param = T((int)max(min<T>((T)Floor<T>(val + T(0.5)), m_Max), m_Min));
|
||||
*m_Param = T(int(max(min<T>(T(Floor<T>(val + T(0.5))), m_Max), m_Min)));
|
||||
break;
|
||||
}
|
||||
|
||||
case INTEGER_NONZERO :
|
||||
default:
|
||||
{
|
||||
int vi = (int)max(min<T>((T)Floor<T>(val + T(0.5)), m_Max), m_Min);
|
||||
int vi = int(max(min<T>(T(Floor<T>(val + T(0.5))), m_Max), m_Min));
|
||||
|
||||
if (vi == 0)
|
||||
vi = (int)SignNz<T>(val);
|
||||
vi = int(SignNz<T>(val));
|
||||
|
||||
*m_Param = T(vi);
|
||||
break;
|
||||
|
@ -1149,7 +1149,7 @@ public:
|
||||
{
|
||||
m_BlobLow = T(0.2) + T(0.5) * rand.Frand01<T>();
|
||||
m_BlobHigh = T(0.8) + T(0.4) * rand.Frand01<T>();
|
||||
m_BlobWaves = (T)(int)(2 + 5 * rand.Frand01<T>());
|
||||
m_BlobWaves = T(int(2 + 5 * rand.Frand01<T>()));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -1293,7 +1293,7 @@ public:
|
||||
{
|
||||
T a = helper.m_PrecalcAtanxy;
|
||||
T r = m_Weight * helper.m_PrecalcSqrtSumSquares;
|
||||
T t = a + m_Fan2Y - m_Fan2Dx * (int)((a + m_Fan2Y) / m_Fan2Dx);
|
||||
T t = a + m_Fan2Y - m_Fan2Dx * int((a + m_Fan2Y) / m_Fan2Dx);
|
||||
|
||||
if (t > m_Fan2Dx2)
|
||||
a = a - m_Fan2Dx2;
|
||||
@ -1390,7 +1390,7 @@ public:
|
||||
{
|
||||
T r = helper.m_PrecalcSqrtSumSquares;
|
||||
|
||||
r += -2 * m_Rings2Val2 * (int)((r + m_Rings2Val2) / (2 * m_Rings2Val2)) + r * (1 - m_Rings2Val2);
|
||||
r += -2 * m_Rings2Val2 * int((r + m_Rings2Val2) / (2 * m_Rings2Val2)) + r * (1 - m_Rings2Val2);
|
||||
helper.Out.x = m_Weight * helper.m_PrecalcSina * r;
|
||||
helper.Out.y = m_Weight * helper.m_PrecalcCosa * r;
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
@ -1689,7 +1689,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T tempr = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand((ISAAC_INT)m_Rn)) / m_Power;
|
||||
T tempr = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand(ISAAC_INT(m_Rn))) / m_Power;
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
|
||||
helper.Out.x = r * cos(tempr);
|
||||
@ -1731,7 +1731,7 @@ public:
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Dist = 1;
|
||||
m_Power = (T)(int)(5 * rand.Frand01<T>() + 2);
|
||||
m_Power = T(int(5 * rand.Frand01<T>() + 2));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -1769,7 +1769,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int rnd = (int)(m_Rn * rand.Frand01<T>());
|
||||
int rnd = int(m_Rn * rand.Frand01<T>());
|
||||
T tempr, r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
|
||||
if ((rnd & 1) == 0)
|
||||
@ -1851,7 +1851,7 @@ public:
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Dist = 1;
|
||||
m_Power = (T)(int)(5 * rand.Frand01<T>() + 2);
|
||||
m_Power = T(int(5 * rand.Frand01<T>() + 2));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -2051,7 +2051,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int sl = (int)(rand.Frand01<T>() * m_Slices + T(0.5));
|
||||
int sl = int(rand.Frand01<T>() * m_Slices + T(0.5));
|
||||
T a = m_Rotation + M_2PI * (sl + rand.Frand01<T>() * m_Thickness) / m_Slices;
|
||||
T r = m_Weight * rand.Frand01<T>();
|
||||
|
||||
@ -2187,7 +2187,7 @@ public:
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Sides = (T)(int)(rand.Frand01<T>() * 10 + 3);
|
||||
m_Sides = T(int(rand.Frand01<T>() * 10 + 3));
|
||||
m_Power = 3 * rand.Frand01<T>() + 1;
|
||||
m_Circle = 3 * rand.Frand01<T>();
|
||||
m_Corners = 2 * rand.Frand01<T>() * m_Circle;
|
||||
@ -2874,7 +2874,7 @@ public:
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Rnd = rand.Frand01<T>();
|
||||
m_M = (T)(int)(rand.Frand01<T>() * 6);
|
||||
m_M = T(int(rand.Frand01<T>() * 6));
|
||||
m_N1 = rand.Frand01<T>() * 40;
|
||||
m_N2 = rand.Frand01<T>() * 20;
|
||||
m_N3 = m_N2;
|
||||
@ -4985,7 +4985,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T roundx = (T)(int)(helper.In.x >= 0 ? (helper.In.x + T(0.5)) : (helper.In.x - T(0.5)));
|
||||
T roundx = T(int(helper.In.x >= 0 ? (helper.In.x + T(0.5)) : (helper.In.x - T(0.5))));
|
||||
T offsetx = helper.In.x - roundx;
|
||||
|
||||
helper.Out.x = m_Weight * (offsetx * (1 - m_Space) + roundx);
|
||||
@ -5053,7 +5053,7 @@ public:
|
||||
{
|
||||
T r = helper.m_PrecalcSqrtSumSquares;
|
||||
T a = helper.m_PrecalcAtanyx + m_Swirl * r;
|
||||
T c = (T)Floor<T>((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5));
|
||||
T c = T(Floor<T>((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5)));
|
||||
|
||||
a = a * m_CompFac + c * m_Angle;
|
||||
r = m_Weight * (r + m_Hole);
|
||||
@ -5098,7 +5098,7 @@ public:
|
||||
{
|
||||
m_Angle = T(M_PI) * rand.Frand01<T>();
|
||||
m_Hole = T(0.5) * rand.Frand11<T>();
|
||||
m_Count = (T)Floor<T>(5 * rand.Frand01<T>()) + 1;
|
||||
m_Count = T(Floor<T>(5 * rand.Frand01<T>())) + 1;
|
||||
m_Swirl = rand.Frand01<T>();
|
||||
}
|
||||
|
||||
@ -5140,9 +5140,9 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
int tRand = (int)(m_Rn * rand.Frand01<T>());
|
||||
int tRand = int(m_Rn * rand.Frand01<T>());
|
||||
T a = (helper.m_PrecalcAtanyx + M_2PI * tRand) / m_Power;
|
||||
T c = (T)Floor<T>((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5));
|
||||
T c = T(Floor<T>((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5)));
|
||||
|
||||
a = a * m_Cf + c * m_Angle;
|
||||
helper.Out.x = r * cos(a);
|
||||
@ -5188,9 +5188,9 @@ public:
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Power = (T)(int)(5 * rand.Frand01<T>() + 2);
|
||||
m_Power = T(int(5 * rand.Frand01<T>() + 2));
|
||||
m_Dist = 1;
|
||||
m_Count = (T)(int)(3 * rand.Frand01<T>() + 1);
|
||||
m_Count = T(int(3 * rand.Frand01<T>() + 1));
|
||||
m_Angle = T(M_PI) * rand.Frand01<T>();
|
||||
}
|
||||
|
||||
@ -5237,7 +5237,7 @@ public:
|
||||
{
|
||||
T r = 1 / Zeps(helper.m_PrecalcSqrtSumSquares);
|
||||
T a = helper.m_PrecalcAtanyx + m_Swirl * r;
|
||||
T c = (T)Floor<T>((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5));
|
||||
T c = T(Floor<T>((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5)));
|
||||
T compFac = 1 - m_Angle * m_Count * T(M_1_PI) * T(0.5);
|
||||
|
||||
a = a * compFac + c * m_Angle;
|
||||
@ -5277,7 +5277,7 @@ public:
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Angle = T(M_PI) * rand.Frand01<T>();
|
||||
m_Count = (T)Floor<T>(5 * rand.Frand01<T>()) + 1;
|
||||
m_Count = T(Floor<T>(5 * rand.Frand01<T>())) + 1;
|
||||
m_Hole = T(0.5) * rand.Frand11<T>();
|
||||
m_Swirl = rand.Frand01<T>();
|
||||
}
|
||||
@ -6116,7 +6116,7 @@ public:
|
||||
{
|
||||
m_Symmetry = 0;
|
||||
m_AugerWeight = T(0.5) + rand.Frand01<T>() / 2;
|
||||
m_Freq = (T)Floor<T>(5 * rand.Frand01<T>()) + 1;
|
||||
m_Freq = T(Floor<T>(5 * rand.Frand01<T>())) + 1;
|
||||
m_Scale = rand.Frand01<T>();
|
||||
}
|
||||
|
||||
|
@ -474,8 +474,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T x = (T)Floor<T>(helper.In.x * m_InvSize);
|
||||
T y = (T)Floor<T>(helper.In.y * m_InvSize);
|
||||
T x = T(Floor<T>(helper.In.x * m_InvSize));
|
||||
T y = T(Floor<T>(helper.In.y * m_InvSize));
|
||||
|
||||
helper.Out.x = m_V * (x + m_BlurPixelizeScale * (rand.Frand01<T>() - T(0.5)) + T(0.5));
|
||||
helper.Out.y = m_V * (y + m_BlurPixelizeScale * (rand.Frand01<T>() - T(0.5)) + T(0.5));
|
||||
@ -1366,8 +1366,8 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T roundX = (T)(int)(helper.In.x >= 0 ? (int)(helper.In.x + T(0.5)) : (int)(helper.In.x - T(0.5)));
|
||||
T roundY = (T)(int)(helper.In.y >= 0 ? (int)(helper.In.y + T(0.5)) : (int)(helper.In.y - T(0.5)));
|
||||
T roundX = T(int(helper.In.x >= 0 ? int(helper.In.x + T(0.5)) : int(helper.In.x - T(0.5))));
|
||||
T roundY = T(int(helper.In.y >= 0 ? int(helper.In.y + T(0.5)) : int(helper.In.y - T(0.5))));
|
||||
T offsetX = helper.In.x - roundX;
|
||||
T offsetY = helper.In.y - roundY;
|
||||
|
||||
@ -1578,7 +1578,7 @@ public:
|
||||
T rnx = m_Rnd * rand.Frand01<T>();
|
||||
T rny = m_Rnd * rand.Frand01<T>();
|
||||
|
||||
int isXY = (int)(LRint(helper.In.x * m_Cs) + LRint(helper.In.y * m_Cs));
|
||||
int isXY = int(LRint(helper.In.x * m_Cs) + LRint(helper.In.y * m_Cs));
|
||||
|
||||
if (isXY % 2)
|
||||
{
|
||||
@ -3456,7 +3456,7 @@ public:
|
||||
{
|
||||
T x = m_A * helper.In.x + m_B * helper.In.y + m_E;
|
||||
T y = m_C * helper.In.x + m_D * helper.In.y + m_F;
|
||||
T angle = (atan2(y, x) + M_2PI * rand.Rand((int)m_AbsN)) / m_Power;
|
||||
T angle = (atan2(y, x) + M_2PI * rand.Rand(int(m_AbsN))) / m_Power;
|
||||
T sina = sin(angle);
|
||||
T cosa = cos(angle);
|
||||
T r = m_Weight * pow(SQR(x) + SQR(y), m_Cn);
|
||||
@ -3504,7 +3504,7 @@ public:
|
||||
if (m_Power == 0)
|
||||
m_Power = 2;
|
||||
|
||||
m_AbsN = T((int)abs(m_Power));
|
||||
m_AbsN = T(int(abs(m_Power)));
|
||||
m_Cn = m_Dist / m_Power / 2;
|
||||
}
|
||||
|
||||
@ -3837,7 +3837,7 @@ public:
|
||||
{
|
||||
T x = (m_IsOdd != 0) ? helper.In.x : m_Vvar * helper.m_PrecalcAtanxy;
|
||||
T y = (m_IsOdd != 0) ? helper.In.y : m_Vvar2 * log(helper.m_PrecalcSumSquares);
|
||||
T angle = (atan2(y, x) + M_2PI * rand.Rand((int)m_AbsN)) / m_Nnz;
|
||||
T angle = (atan2(y, x) + M_2PI * rand.Rand(int(m_AbsN))) / m_Nnz;
|
||||
T r = m_Weight * pow(SQR(x) + SQR(y), m_Cn) * ((m_IsOdd == 0) ? 1 : m_Parity);
|
||||
T sina = sin(angle) * r;
|
||||
T cosa = cos(angle) * r;
|
||||
@ -3889,7 +3889,7 @@ public:
|
||||
m_Vvar2 = m_Vvar * T(0.5);
|
||||
m_AbsN = abs(m_Nnz);
|
||||
m_Cn = 1 / m_Nnz / 2;
|
||||
m_IsOdd = T(abs((int)m_Parity) % 2);
|
||||
m_IsOdd = T(abs(int(m_Parity)) % 2);
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -5161,7 +5161,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T angle = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand((int)m_AbsN)) / m_Power;
|
||||
T angle = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand(int(m_AbsN))) / m_Power;
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
T sina = sin(angle);
|
||||
T cosa = cos(angle);
|
||||
@ -5218,7 +5218,7 @@ public:
|
||||
if (m_Power == 0)
|
||||
m_Power = 2;
|
||||
|
||||
m_AbsN = T((int)fabs(m_Power));
|
||||
m_AbsN = T(int(fabs(m_Power)));
|
||||
|
||||
m_Cn = 1 / m_Power / 2;
|
||||
}
|
||||
@ -5594,7 +5594,7 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T a = helper.m_PrecalcAtanyx;
|
||||
int n = rand.Rand((uint)m_Spread);
|
||||
int n = rand.Rand(uint(m_Spread));
|
||||
|
||||
if (a < 0)
|
||||
n++;
|
||||
|
@ -278,7 +278,7 @@ public:
|
||||
{
|
||||
T r = Zeps(pow(helper.m_PrecalcSqrtSumSquares, m_Dist));
|
||||
int n = Floor<T>(m_Power * rand.Frand01<T>());
|
||||
T alpha = helper.m_PrecalcAtanyx + n * M_2PI / Zeps<T>((T)Floor<T>(m_Power));
|
||||
T alpha = helper.m_PrecalcAtanyx + n * M_2PI / Zeps<T>(T(Floor<T>(m_Power)));
|
||||
T sina = sin(alpha);
|
||||
T cosa = cos(alpha);
|
||||
|
||||
@ -923,17 +923,17 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T f = rand.Frand01<T>() * m_Power * 2;
|
||||
T angle = (T)(int)(f);
|
||||
T angle = T(int(f));
|
||||
|
||||
f -= angle;
|
||||
|
||||
T x = f * m_Length;
|
||||
T z = sqrt(1 + SQR(x) - 2 * x * cos(m_Alpha));
|
||||
|
||||
if (((int)angle) % 2)
|
||||
angle = M_2PI / m_Power * (((int)angle) / 2) + asin(sin(m_Alpha) * x / z);
|
||||
if (int(angle) % 2)
|
||||
angle = M_2PI / m_Power * (int(angle) / 2) + asin(sin(m_Alpha) * x / z);
|
||||
else
|
||||
angle = M_2PI / m_Power * (((int)angle) / 2) - asin(sin(m_Alpha) * x / z);
|
||||
angle = M_2PI / m_Power * (int(angle) / 2) - asin(sin(m_Alpha) * x / z);
|
||||
|
||||
z *= sqrt(rand.Frand01<T>());
|
||||
|
||||
@ -1186,7 +1186,7 @@ public:
|
||||
{
|
||||
T xang = (helper.m_PrecalcAtanyx + T(M_PI)) / m_Alpha;
|
||||
|
||||
xang = (xang - (int) xang) * m_Alpha;
|
||||
xang = (xang - int(xang)) * m_Alpha;
|
||||
xang = cos((xang < m_Alpha / 2) ? xang : m_Alpha - xang);
|
||||
|
||||
T xr = xang > 0 ? m_Radius / xang : 1;
|
||||
@ -1310,7 +1310,7 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T xang = (helper.m_PrecalcAtanyx + M_3PI + m_Alpha / 2) / m_Alpha;
|
||||
T zang = ((xang - (int)xang) * m_Width + (int)xang) * m_Alpha - T(M_PI) - m_Alpha / 2 * m_Width;
|
||||
T zang = ((xang - int(xang)) * m_Width + int(xang)) * m_Alpha - T(M_PI) - m_Alpha / 2 * m_Width;
|
||||
|
||||
helper.Out.x = m_Weight * helper.m_PrecalcSqrtSumSquares * cos(zang);
|
||||
helper.Out.y = m_Weight * helper.m_PrecalcSqrtSumSquares * sin(zang);
|
||||
@ -1495,7 +1495,7 @@ public:
|
||||
T z = helper.In.z / m_AbsN;
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares + SQR(z), m_Cn);
|
||||
T tmp = r * helper.m_PrecalcSqrtSumSquares;
|
||||
T ang = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand((uint)m_AbsN)) / m_N;
|
||||
T ang = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand(uint(m_AbsN))) / m_N;
|
||||
|
||||
helper.Out.x = tmp * cos(ang);
|
||||
helper.Out.y = tmp * sin(ang);
|
||||
@ -1574,7 +1574,7 @@ public:
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
T r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn);
|
||||
T temp = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand((uint)m_AbsN)) / m_N;
|
||||
T temp = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand(uint(m_AbsN))) / m_N;
|
||||
|
||||
helper.Out.x = r * cos(temp);
|
||||
helper.Out.y = r * sin(temp);
|
||||
@ -3200,7 +3200,7 @@ public:
|
||||
|
||||
if (a >= 0)
|
||||
{
|
||||
alt = (int)(a * m_KnPi);
|
||||
alt = int(a * m_KnPi);
|
||||
|
||||
if (alt % 2 == 0)
|
||||
a = alt * m_PiKn + fmod(m_KaKn + a, m_PiKn);
|
||||
@ -3209,7 +3209,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
alt = (int)(-a * m_KnPi);
|
||||
alt = int(-a * m_KnPi);
|
||||
|
||||
if (alt % 2 == 1)
|
||||
a = -(alt * m_PiKn + fmod(-m_KaKn - a, m_PiKn));
|
||||
@ -3539,7 +3539,7 @@ public:
|
||||
{
|
||||
T tau = T(0.5) * (log(Sqr(helper.In.x + 1) + SQR(helper.In.y)) - log(Sqr(helper.In.x - 1) + SQR(helper.In.y)));
|
||||
T sigma = T(M_PI) - atan2(helper.In.y, helper.In.x + 1) - atan2(helper.In.y, 1 - helper.In.x);
|
||||
int alt = (int)(sigma * m_CnPi);
|
||||
int alt = int(sigma * m_CnPi);
|
||||
|
||||
if (alt % 2 == 0)
|
||||
sigma = alt * m_PiCn + fmod(sigma + m_CaCn, m_PiCn);
|
||||
@ -3857,7 +3857,7 @@ public:
|
||||
|
||||
if (helper.In.y > 0)
|
||||
{
|
||||
alt = (int)(nu * m_CnPi);
|
||||
alt = int(nu * m_CnPi);
|
||||
|
||||
if (alt % 2 == 0)
|
||||
nu = alt * m_PiCn + fmod(nu + m_CaCn, m_PiCn);
|
||||
@ -3866,7 +3866,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
alt = (int)(nu * m_CnPi);
|
||||
alt = int(nu * m_CnPi);
|
||||
|
||||
if (alt % 2 == 0)
|
||||
nu = alt * m_PiCn + fmod(nu + m_CaCn, m_PiCn);
|
||||
|
@ -1533,24 +1533,24 @@ public:
|
||||
switch (rand.Rand(5))
|
||||
{
|
||||
case 0:
|
||||
a = (rand.Rand((ISAAC_INT)m_Slices) + rand.Frand01<T>() * m_XThickness) / m_Slices;
|
||||
r = (rand.Rand((ISAAC_INT)m_Slices) + rand.Frand01<T>() * m_YThickness) / m_Slices;
|
||||
a = (rand.Rand(ISAAC_INT(m_Slices)) + rand.Frand01<T>() * m_XThickness) / m_Slices;
|
||||
r = (rand.Rand(ISAAC_INT(m_Slices)) + rand.Frand01<T>() * m_YThickness) / m_Slices;
|
||||
break;
|
||||
case 1:
|
||||
a = (rand.Rand((ISAAC_INT)m_Slices) + rand.Frand01<T>()) / m_Slices;
|
||||
r = (rand.Rand((ISAAC_INT)m_Slices) + m_YThickness) / m_Slices;
|
||||
a = (rand.Rand(ISAAC_INT(m_Slices)) + rand.Frand01<T>()) / m_Slices;
|
||||
r = (rand.Rand(ISAAC_INT(m_Slices)) + m_YThickness) / m_Slices;
|
||||
break;
|
||||
case 2:
|
||||
a = (rand.Rand((ISAAC_INT)m_Slices) + m_XThickness) / m_Slices;
|
||||
r = (rand.Rand((ISAAC_INT)m_Slices) + rand.Frand01<T>()) / m_Slices;
|
||||
a = (rand.Rand(ISAAC_INT(m_Slices)) + m_XThickness) / m_Slices;
|
||||
r = (rand.Rand(ISAAC_INT(m_Slices)) + rand.Frand01<T>()) / m_Slices;
|
||||
break;
|
||||
case 3:
|
||||
a = rand.Frand01<T>();
|
||||
r = (rand.Rand((ISAAC_INT)m_Slices) + m_YThickness + rand.Frand01<T>() * (1 - m_YThickness)) / m_Slices;
|
||||
r = (rand.Rand(ISAAC_INT(m_Slices)) + m_YThickness + rand.Frand01<T>() * (1 - m_YThickness)) / m_Slices;
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
a = (rand.Rand((ISAAC_INT)m_Slices) + m_XThickness + rand.Frand01<T>() * (1 - m_XThickness)) / m_Slices;
|
||||
a = (rand.Rand(ISAAC_INT(m_Slices)) + m_XThickness + rand.Frand01<T>() * (1 - m_XThickness)) / m_Slices;
|
||||
r = rand.Frand01<T>();
|
||||
break;
|
||||
}
|
||||
@ -1713,7 +1713,7 @@ public:
|
||||
r1 = pow(fabs(pr1), m_N1_1) + m_Spiral * rho1;
|
||||
r2 = pow(fabs(pr2), m_N1_2);
|
||||
|
||||
if ((int)m_Toroidmap == 1)
|
||||
if (int(m_Toroidmap) == 1)
|
||||
{
|
||||
helper.Out.x = m_Weight * cosr * (r1 + r2 * cosp);
|
||||
helper.Out.y = m_Weight * sinr * (r1 + r2 * cosp);
|
||||
@ -1908,7 +1908,7 @@ public:
|
||||
helper.Out.y = helper.In.y * rY;
|
||||
|
||||
//Optional 3D calculation.
|
||||
if ((int)m_ZOn == 1)
|
||||
if (int(m_ZOn) == 1)
|
||||
{
|
||||
rZ = m_Weight / pow(t, m_StretchZ);
|
||||
helper.Out.z = helper.In.z * rZ;
|
||||
@ -1992,7 +1992,7 @@ public:
|
||||
const T c = cos(ang);
|
||||
|
||||
const int esc = rad > m_Radius;
|
||||
const int cr0 = (int)m_Zero;
|
||||
const int cr0 = int(m_Zero);
|
||||
|
||||
if (cr0 && esc)
|
||||
{
|
||||
@ -2133,7 +2133,7 @@ public:
|
||||
const T radiusOut = m_Weight * pow(helper.m_PrecalcSumSquares + z * z, m_Cn);
|
||||
const T x = m_A * helper.In.x + m_B * helper.In.y + m_E;
|
||||
const T y = m_C * helper.In.x + m_D * helper.In.y + m_F;
|
||||
const T tempRand = (T)(int)(rand.Frand01<T>() * m_AbsN);
|
||||
const T tempRand = T(int(rand.Frand01<T>() * m_AbsN));
|
||||
const T alpha = (atan2(y, x) + M_2PI * tempRand) / m_Power;
|
||||
const T gamma = radiusOut * helper.m_PrecalcSqrtSumSquares;
|
||||
|
||||
@ -2963,7 +2963,7 @@ public:
|
||||
T fp2x;
|
||||
T fp2y;
|
||||
|
||||
switch ((int)m_T1)
|
||||
switch (int(m_T1))
|
||||
{
|
||||
case 0:
|
||||
fp1x = Sine(m_A1, m_B1, m_C1, m_P1, helper.In.x);
|
||||
@ -2983,7 +2983,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((int)m_T2)
|
||||
switch (int(m_T2))
|
||||
{
|
||||
case 0:
|
||||
fp2x = Sine(m_A2, m_B2, m_C2, m_P2, helper.In.x);
|
||||
@ -4115,7 +4115,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int extended = (int)m_Extended;
|
||||
int extended = int(m_Extended);
|
||||
T seed = m_AbsSeed;
|
||||
T r = -m_Rotation;
|
||||
T r0 = 0;
|
||||
@ -4128,8 +4128,8 @@ public:
|
||||
T niter = 0;
|
||||
T x = helper.In.x * m_Scale;
|
||||
T y = helper.In.y * m_Scale;
|
||||
int intx = (int)Round(x);
|
||||
int inty = (int)Round(y);
|
||||
int intx = int(Round(x));
|
||||
int inty = int(Round(y));
|
||||
int randiter;
|
||||
|
||||
r = x - intx;
|
||||
@ -4166,11 +4166,11 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
int xrand = (int)Round(helper.In.x);
|
||||
int yrand = (int)Round(helper.In.y);
|
||||
int xrand = int(Round(helper.In.x));
|
||||
int yrand = int(Round(helper.In.y));
|
||||
|
||||
seed = (T)Floor<T>(seed);
|
||||
niter = (T)abs(xrand + yrand + xrand * yrand);
|
||||
seed = T(Floor<T>(seed));
|
||||
niter = T(abs(xrand + yrand + xrand * yrand));
|
||||
randInt = seed + niter;
|
||||
randiter = 0;
|
||||
|
||||
@ -4557,7 +4557,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
static inline T GdoffsFcip(T a) { return (T)((a < 0) ? -((int)(fabs(a)) + 1) : 0) + ((a > 1) ? ((int)(a)) : 0); }
|
||||
static inline T GdoffsFcip(T a) { return T((a < 0) ? -(int(fabs(a)) + 1) : 0) + ((a > 1) ? (int(a)) : 0); }
|
||||
static inline T GdoffsFclp(T a) { return ((a < 0) ? -(fmod(fabs(a), T(1))) : fmod(fabs(a), T(1))); }
|
||||
static inline T GdoffsFscl(T a) { return GdoffsFclp((a + 1) / 2); }
|
||||
static inline T GdoffsFosc(T p, T a) { return GdoffsFscl(-1 * cos(p * a * M_2PI)); }
|
||||
@ -5043,7 +5043,7 @@ public:
|
||||
{
|
||||
m_BlobLow = T(0.2) + T(0.5) * rand.Frand01<T>();
|
||||
m_BlobHigh = T(0.8) + T(0.4) * rand.Frand01<T>();
|
||||
m_BlobWaves = (T)(int)(2 + 5 * rand.Frand01<T>());
|
||||
m_BlobWaves = T(int(2 + 5 * rand.Frand01<T>()));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -293,7 +293,7 @@ public:
|
||||
if (++iters > 10)
|
||||
break;
|
||||
}
|
||||
while ((DiscreteNoise2((int)(m + m_Seed), n) > m_Dens) || (u > (T(0.3) + T(0.7) * DiscreteNoise2(m + 10, n + 3)) * m_Sc));
|
||||
while ((DiscreteNoise2(int(m + m_Seed), n) > m_Dens) || (u > (T(0.3) + T(0.7) * DiscreteNoise2(m + 10, n + 3)) * m_Sc));
|
||||
|
||||
helper.Out.x = m_Weight * (x + (m * 2 + 1) * m_Sc);
|
||||
helper.Out.y = m_Weight * (y + (n * 2 + 1) * m_Sc);
|
||||
@ -413,7 +413,7 @@ public:
|
||||
y = uy - (n * 2 + 1) * m_Sc;
|
||||
u = Hypot(x, y);
|
||||
|
||||
if ((DiscreteNoise2((int)(m + m_Seed), n) > m_Dens) || (u > (T(0.3) + T(0.7) * DiscreteNoise2(m + 10, n + 3)) * m_Sc))
|
||||
if ((DiscreteNoise2(int(m + m_Seed), n) > m_Dens) || (u > (T(0.3) + T(0.7) * DiscreteNoise2(m + 10, n + 3)) * m_Sc))
|
||||
{
|
||||
ux = ux;
|
||||
uy = uy;
|
||||
@ -565,7 +565,7 @@ private:
|
||||
if (++iters > 10)
|
||||
break;
|
||||
}
|
||||
while (DiscreteNoise2((int)(m + m_Seed), n) > m_Dens);
|
||||
while (DiscreteNoise2(int(m + m_Seed), n) > m_Dens);
|
||||
|
||||
*ux = x + (m * 2 + 1) * m_Sc;
|
||||
*vy = y + (n * 2 + 1) * m_Sc;
|
||||
@ -1551,7 +1551,7 @@ public:
|
||||
|
||||
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
int sl = (int)(rand.Frand01<T>() * m_Slices + T(0.5));
|
||||
int sl = int(rand.Frand01<T>() * m_Slices + T(0.5));
|
||||
T a = m_Rotation + M_2PI * (sl + rand.Frand01<T>() * m_Thickness) / m_Slices;
|
||||
T r = m_Weight * rand.Frand01<T>();
|
||||
|
||||
@ -1585,7 +1585,7 @@ public:
|
||||
|
||||
virtual void Random(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
|
||||
{
|
||||
m_Params[0].Set((int)10 * rand.Frand01<T>());//Slices.
|
||||
m_Params[0].Set(10 * rand.Frand01<T>());//Slices.
|
||||
m_Params[1].Set(M_2PI * rand.Frand11<T>());//Rotation.
|
||||
m_Thickness = rand.Frand01<T>();
|
||||
}
|
||||
@ -1835,8 +1835,8 @@ public:
|
||||
const T xrng = helper.In.x / m_XDistance;
|
||||
const T yrng = helper.In.y / m_YDistance;
|
||||
|
||||
helper.Out.x = m_Xw * ((xrng - (int)xrng) * m_XWidth + (int)xrng + (T(0.5) - xpos) * m_1mX);
|
||||
helper.Out.y = m_Yw * ((yrng - (int)yrng) * m_YWidth + (int)yrng + (T(0.5) - ypos) * m_1mY);
|
||||
helper.Out.x = m_Xw * ((xrng - int(xrng)) * m_XWidth + int(xrng) + (T(0.5) - xpos) * m_1mX);
|
||||
helper.Out.y = m_Yw * ((yrng - int(yrng)) * m_YWidth + int(yrng) + (T(0.5) - ypos) * m_1mY);
|
||||
helper.Out.z = m_Weight * helper.In.z;
|
||||
//outPoint.m_X = 0;
|
||||
//outPoint.m_Y = 0;
|
||||
@ -2125,7 +2125,7 @@ public:
|
||||
T sigma, phi, rad, sigmas, sigmac, phis, phic;
|
||||
T scale, denom;
|
||||
|
||||
switch ((int)m_Type)
|
||||
switch (int(m_Type))
|
||||
{
|
||||
case 0://Linear.
|
||||
helper.Out.x = m_Weight * (helper.In.x + m_MulX * ax * rs);
|
||||
@ -2282,7 +2282,7 @@ public:
|
||||
const T distB = m_Invert != 0 ? max<T>(1 - distA, 0) : max<T>(distA, 0);//Original called a macro named min, which internally performed max.
|
||||
const T dist = max<T>((distB - m_MinDist) * m_RMax, 0);
|
||||
|
||||
switch ((int)m_Type)
|
||||
switch (int(m_Type))
|
||||
{
|
||||
case 0://Linear.
|
||||
{
|
||||
@ -2477,7 +2477,7 @@ public:
|
||||
const v4T random(rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)), rand.Frand<T>(T(-0.5), T(0.5)));
|
||||
T radius;
|
||||
|
||||
switch ((int)m_BlurShape)
|
||||
switch (int(m_BlurShape))
|
||||
{
|
||||
case 0://Circle.
|
||||
radius = sqrt(Sqr(helper.In.x - m_CenterX) + Sqr(helper.In.y - m_CenterY) + Sqr(helper.In.z - m_CenterZ));
|
||||
@ -2490,7 +2490,7 @@ public:
|
||||
|
||||
const T dist = max<T>(((m_InvertDistance != 0 ? max<T>(1 - radius, 0) : max<T>(radius, 0)) - m_MinDistance) * m_RMax, 0);
|
||||
|
||||
switch ((int)m_BlurType)
|
||||
switch (int(m_BlurType))
|
||||
{
|
||||
case 0://Gaussian.
|
||||
{
|
||||
@ -3041,7 +3041,7 @@ public:
|
||||
if (m_Power == 0)
|
||||
m_Power = 2;
|
||||
|
||||
m_AbsN = T((int)fabs(m_Power));
|
||||
m_AbsN = T(int(fabs(m_Power)));
|
||||
m_Cn = m_Dist / m_Power / 2;
|
||||
}
|
||||
|
||||
@ -3092,7 +3092,7 @@ private:
|
||||
{
|
||||
T inx = (be - m_Radius + (al - m_Radius) * m_CosC) / m_SinC;
|
||||
T iny = al - m_Radius;
|
||||
T angle = (atan2(iny, inx) + M_2PI * (rand.Rand((int)m_AbsN))) / m_Power;
|
||||
T angle = (atan2(iny, inx) + M_2PI * (rand.Rand(int(m_AbsN)))) / m_Power;
|
||||
T r = m_Weight * pow(SQR(inx) + SQR(iny), m_Cn);
|
||||
|
||||
x = r * cos(angle);
|
||||
|
@ -185,7 +185,7 @@ public:
|
||||
|
||||
//If this xform was already part of a different ember, then do not assign, else do.
|
||||
if (!m_ParentEmber && (typeid(T) == typeid(U)))
|
||||
m_ParentEmber = (Ember<T>*)xform.ParentEmber();
|
||||
m_ParentEmber = static_cast<Ember<T>*>(xform.ParentEmber());
|
||||
|
||||
CopyVec<T, U>(m_Xaos, xform.XaosVec());
|
||||
CopyVec(m_Motion, xform.m_Motion);
|
||||
|
@ -178,7 +178,7 @@ public:
|
||||
m_FlattenNames.push_back("post_falloff2");
|
||||
m_FlattenNames.push_back("post_rotate_x");
|
||||
m_FlattenNames.push_back("post_rotate_y");
|
||||
|
||||
|
||||
m_FlattenNames.push_back("curl3D_cz");
|
||||
|
||||
//This is a vector of the param names as they are in the legacy, badly named flam3/Apophysis code.
|
||||
@ -264,10 +264,10 @@ public:
|
||||
m_ErrorReport.clear();
|
||||
|
||||
//Parse XML string into internal document.
|
||||
xmlPtr = (const char*)(&buf[0]);
|
||||
xmlPtr = CX(&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(xmlPtr, (int)bufSize, filename, "ISO-8859-1", XML_PARSE_NONET);//Forbid network access during read.
|
||||
doc = xmlReadMemory(xmlPtr, int(bufSize), filename, "ISO-8859-1", XML_PARSE_NONET);//Forbid network access during read.
|
||||
//t.Toc("xmlReadMemory");
|
||||
|
||||
if (doc == nullptr)
|
||||
@ -281,7 +281,7 @@ public:
|
||||
|
||||
//Scan for <flame> nodes, starting with this node.
|
||||
//t.Tic();
|
||||
bn = basename((char*)filename);
|
||||
bn = basename(const_cast<char*>(filename));
|
||||
ScanForEmberNodes(rootnode, bn, embers);
|
||||
xmlFreeDoc(doc);
|
||||
emberSize = embers.size();
|
||||
@ -349,7 +349,7 @@ public:
|
||||
if (ReadFile(filename, buf))
|
||||
{
|
||||
std::replace(buf.begin(), buf.end(), '&', '+');
|
||||
return Parse((byte*)buf.data(), filename, embers);
|
||||
return Parse(reinterpret_cast<byte*>(const_cast<char*>(buf.data())), filename, embers);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
@ -372,7 +372,7 @@ public:
|
||||
errno = 0;//Note that this is not thread-safe.
|
||||
|
||||
//Convert the string using strtod().
|
||||
val = (T)strtod(str, &endp);
|
||||
val = T(strtod(str, &endp));
|
||||
|
||||
//Check errno & return string.
|
||||
if (endp != str + strlen(str))
|
||||
@ -399,7 +399,7 @@ public:
|
||||
/// <returns>True if success, else false.</returns>
|
||||
bool Atoi(const char* str, uint& val)
|
||||
{
|
||||
return Atoi(str, (int&)val);
|
||||
return Atoi(str, reinterpret_cast<int&>(val));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -562,7 +562,7 @@ private:
|
||||
|
||||
for (curAtt = att; curAtt; curAtt = curAtt->next)
|
||||
{
|
||||
attStr = (char*)xmlGetProp(emberNode, curAtt->name);
|
||||
attStr = reinterpret_cast<char*>(xmlGetProp(emberNode, curAtt->name));
|
||||
|
||||
//First parse out simple float reads.
|
||||
if (ParseAndAssignFloat(curAtt->name, attStr, "time", currentEmber.m_Time, ret)) { }
|
||||
@ -723,7 +723,7 @@ private:
|
||||
|
||||
for (curAtt = att; curAtt; curAtt = curAtt->next)
|
||||
{
|
||||
attStr = (char*)xmlGetProp(childNode, curAtt->name);
|
||||
attStr = reinterpret_cast<char*>(xmlGetProp(childNode, curAtt->name));
|
||||
a = 255;
|
||||
|
||||
//This signifies that a palette is not being retrieved from the palette file, rather it's being parsed directly out of the ember xml.
|
||||
@ -752,7 +752,7 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ErrorReport.push_back(string(loc) + " : Unknown color attribute " + string((const char*)curAtt->name));
|
||||
m_ErrorReport.push_back(string(loc) + " : Unknown color attribute " + string(CCX(curAtt->name)));
|
||||
}
|
||||
|
||||
xmlFree(attStr);
|
||||
@ -789,7 +789,7 @@ private:
|
||||
|
||||
for (curAtt = att; curAtt; curAtt = curAtt->next)
|
||||
{
|
||||
attStr = (char*)xmlGetProp(childNode, curAtt->name);
|
||||
attStr = reinterpret_cast<char*>(xmlGetProp(childNode, curAtt->name));
|
||||
|
||||
if (!Compare(curAtt->name, "count"))
|
||||
{
|
||||
@ -804,7 +804,7 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ErrorReport.push_back(string(loc) + " : Unknown color attribute " + string((const char*)curAtt->name));
|
||||
m_ErrorReport.push_back(string(loc) + " : Unknown color attribute " + string(CCX(curAtt->name)));
|
||||
}
|
||||
|
||||
xmlFree(attStr);
|
||||
@ -835,7 +835,7 @@ private:
|
||||
|
||||
for (curAtt = att; curAtt; curAtt = curAtt->next)
|
||||
{
|
||||
attStr = (char*)xmlGetProp(childNode, curAtt->name);
|
||||
attStr = reinterpret_cast<char*>(xmlGetProp(childNode, curAtt->name));
|
||||
|
||||
if (!Compare(curAtt->name, "index0"))
|
||||
{
|
||||
@ -883,7 +883,7 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ErrorReport.push_back(string(loc) + " : Unknown palette attribute " + string((const char*)curAtt->name));
|
||||
m_ErrorReport.push_back(string(loc) + " : Unknown palette attribute " + string(CCX(curAtt->name)));
|
||||
}
|
||||
|
||||
xmlFree(attStr);
|
||||
@ -903,7 +903,7 @@ private:
|
||||
else
|
||||
{
|
||||
//Read formatted string from contents of tag.
|
||||
char* palStr = (char*)xmlNodeGetContent(childNode);
|
||||
char* palStr = CX(xmlNodeGetContent(childNode));
|
||||
|
||||
if (!ParseHexColors(palStr, currentEmber, numColors, numBytes))
|
||||
{
|
||||
@ -928,7 +928,7 @@ private:
|
||||
|
||||
for (curAtt = att; curAtt; curAtt = curAtt->next)
|
||||
{
|
||||
attStr = (char*)xmlGetProp(childNode, curAtt->name);
|
||||
attStr = reinterpret_cast<char*>(xmlGetProp(childNode, curAtt->name));
|
||||
|
||||
if (!Compare(curAtt->name, "kind"))
|
||||
{
|
||||
@ -1013,7 +1013,7 @@ private:
|
||||
else if (!Compare(childNode->name, "edit"))
|
||||
{
|
||||
//Create a new XML document with this edit node as the root node.
|
||||
currentEmber.m_Edits = xmlNewDoc((const xmlChar*)"1.0");
|
||||
currentEmber.m_Edits = xmlNewDoc(XC("1.0"));
|
||||
editNode = xmlCopyNode(childNode, 1);
|
||||
xmlDocSetRootElement(currentEmber.m_Edits, editNode);
|
||||
}
|
||||
@ -1058,7 +1058,7 @@ private:
|
||||
|
||||
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)
|
||||
{
|
||||
attStr = (char*)xmlGetProp(childNode, curAtt->name);
|
||||
attStr = reinterpret_cast<char*>(xmlGetProp(childNode, curAtt->name));
|
||||
|
||||
//First parse out simple float reads.
|
||||
if (ParseAndAssignFloat(curAtt->name, attStr, "weight", xform.m_Weight, success)) { }
|
||||
@ -1196,14 +1196,14 @@ private:
|
||||
|
||||
if (!Compare(curAtt->name, "var1"))
|
||||
{
|
||||
attStr = (char*)xmlGetProp(childNode, curAtt->name);
|
||||
attStr = reinterpret_cast<char*>(xmlGetProp(childNode, curAtt->name));
|
||||
|
||||
for (j = 0; j < xform.TotalVariationCount(); j++)
|
||||
xform.GetVariation(j)->m_Weight = 0;
|
||||
|
||||
if (Atof(attStr, temp))
|
||||
{
|
||||
uint iTemp = (uint)temp;
|
||||
uint iTemp = static_cast<uint>(temp);
|
||||
|
||||
if (iTemp < xform.TotalVariationCount())
|
||||
{
|
||||
@ -1227,7 +1227,7 @@ private:
|
||||
|
||||
if (!Compare(curAtt->name, "var"))
|
||||
{
|
||||
attStr = (char*)xmlGetProp(childNode, curAtt->name);
|
||||
attStr = reinterpret_cast<char*>(xmlGetProp(childNode, curAtt->name));
|
||||
|
||||
if (Atof(attStr, temp))
|
||||
{
|
||||
@ -1252,13 +1252,13 @@ private:
|
||||
{
|
||||
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)
|
||||
{
|
||||
string s = GetCorrectedParamName(m_BadParamNames, (const char*)curAtt->name);
|
||||
string s = GetCorrectedParamName(m_BadParamNames, CCX(curAtt->name));
|
||||
const char* name = s.c_str();
|
||||
|
||||
if (parVar->ContainsParam(name))
|
||||
{
|
||||
T val = 0;
|
||||
attStr = (char*)xmlGetProp(childNode, curAtt->name);
|
||||
attStr = CX(xmlGetProp(childNode, curAtt->name));
|
||||
|
||||
if (Atof(attStr, val))
|
||||
{
|
||||
@ -1309,7 +1309,7 @@ private:
|
||||
{
|
||||
for (size_t i = 0; i < vec.size(); i++)
|
||||
{
|
||||
if (!_stricmp(vec[i].first.first.c_str(), (const char*)att->name))//Do case insensitive here.
|
||||
if (!_stricmp(vec[i].first.first.c_str(), CCX(att->name)))//Do case insensitive here.
|
||||
{
|
||||
if (!vec[i].second.empty())
|
||||
{
|
||||
@ -1326,7 +1326,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
return string((const char*)att->name);
|
||||
return string(CCX(att->name));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1341,7 +1341,7 @@ private:
|
||||
|
||||
do
|
||||
{
|
||||
if (!_stricmp(name, (const char*)temp->name))
|
||||
if (!_stricmp(name, CCX(temp->name)))
|
||||
return true;
|
||||
} while ((temp = temp->next));
|
||||
|
||||
@ -1364,12 +1364,12 @@ private:
|
||||
uint r, g, b, a;
|
||||
int ret;
|
||||
char tmps[2];
|
||||
int skip = (int)abs(chan);
|
||||
int skip = static_cast<int>(abs(chan));
|
||||
bool ok = true;
|
||||
const char* loc = __FUNCTION__;
|
||||
|
||||
//Strip whitespace prior to first color.
|
||||
while (isspace((int)colstr[colorIndex]))
|
||||
while (isspace(static_cast<int>(colstr[colorIndex])))
|
||||
colorIndex++;
|
||||
|
||||
do
|
||||
@ -1394,7 +1394,7 @@ private:
|
||||
|
||||
colorIndex += 2 * skip;
|
||||
|
||||
while (isspace((int)colstr[colorIndex]))
|
||||
while (isspace(static_cast<int>(colstr[colorIndex])))
|
||||
colorIndex++;
|
||||
|
||||
ember.m_Palette.m_Entries[colorCount].r = T(r) / T(255);//Hex palette is [0..255], convert to [0..1].
|
||||
@ -1504,7 +1504,7 @@ private:
|
||||
if (!Compare(name, str))
|
||||
{
|
||||
b &= Atof(attStr, fval);
|
||||
val = (intT)fval;
|
||||
val = static_cast<intT>(fval);
|
||||
ret = true;//Means the strcmp() was right, but doesn't necessarily mean the conversion went ok.
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user