mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-02 06:16:17 -04:00
Replace unsigned int, and char with uint and uchar.
This commit is contained in:
@ -110,7 +110,7 @@ public:
|
||||
int rowSize;
|
||||
size_t filterLoop;
|
||||
int keepThresh = 100;
|
||||
unsigned int filterCoefIndex = 0;
|
||||
uint filterCoefIndex = 0;
|
||||
T decFilterCount;
|
||||
T finalMinRad = m_MinRad * m_Supersample + 1;//Should scale the filter width by the oversample.
|
||||
T finalMaxRad = m_MaxRad * m_Supersample + 1;//The '+1' comes from the assumed distance to the first pixel.
|
||||
@ -329,7 +329,7 @@ public:
|
||||
inline size_t CoefsIndicesSizeBytes() const { return (m_CoefIndices.size() * sizeof(m_CoefIndices[0])); }
|
||||
inline const T* Coefs() const { return m_Coefs.data(); }
|
||||
inline const T* Widths() const { return m_Widths.data(); }
|
||||
inline const unsigned int* CoefIndices() const { return m_CoefIndices.data(); }
|
||||
inline const uint* CoefIndices() const { return m_CoefIndices.data(); }
|
||||
|
||||
private:
|
||||
T m_MinRad;
|
||||
@ -342,6 +342,6 @@ private:
|
||||
intmax_t m_FilterWidth;//The new radius after scaling for super sample and rounding. This is what's actually used.
|
||||
vector<T> m_Coefs;
|
||||
vector<T> m_Widths;
|
||||
vector<unsigned int> m_CoefIndices;
|
||||
vector<uint> m_CoefIndices;
|
||||
};
|
||||
}
|
@ -73,6 +73,10 @@ namespace EmberNs
|
||||
#define FLOAT_MIN_TAN -FLOAT_MAX_TAN
|
||||
typedef std::chrono::high_resolution_clock Clock;
|
||||
|
||||
#ifndef byte
|
||||
typedef unsigned char byte;
|
||||
#endif
|
||||
|
||||
#define DO_DOUBLE 1//Comment this out for shorter build times during development. Always uncomment for release.
|
||||
//#define ISAAC_FLAM3_DEBUG 1//This is almost never needed, but is very useful when troubleshooting difficult bugs. Enable it to do a side by side comparison with flam3.
|
||||
|
||||
@ -84,14 +88,14 @@ typedef std::chrono::high_resolution_clock Clock;
|
||||
#define m4T glm::detail::tmat4x4<T, glm::defaultp>
|
||||
#define m23T glm::detail::tmat2x3<T, glm::defaultp>
|
||||
|
||||
enum eInterp : unsigned int { EMBER_INTERP_LINEAR = 0, EMBER_INTERP_SMOOTH = 1 };
|
||||
enum eAffineInterp : unsigned int { INTERP_LINEAR = 0, INTERP_LOG = 1, INTERP_COMPAT = 2, INTERP_OLDER = 3 };
|
||||
enum ePaletteMode : unsigned int { PALETTE_STEP = 0, PALETTE_LINEAR = 1 };
|
||||
enum ePaletteInterp : unsigned int { INTERP_HSV = 0, INTERP_SWEEP = 1 };
|
||||
enum eMotion : unsigned int { MOTION_SIN = 1, MOTION_TRIANGLE = 2, MOTION_HILL = 3 };
|
||||
enum eProcessAction : unsigned int { NOTHING = 0, ACCUM_ONLY = 1, FILTER_AND_ACCUM = 2, KEEP_ITERATING = 3, FULL_RENDER = 4 };
|
||||
enum eProcessState : unsigned int { NONE = 0, ITER_STARTED = 1, ITER_DONE = 2, FILTER_DONE = 3, ACCUM_DONE = 4 };
|
||||
enum eInteractiveFilter : unsigned int { FILTER_LOG = 0, FILTER_DE = 1 };
|
||||
enum eScaleType : unsigned int { SCALE_NONE = 0, SCALE_WIDTH = 1, SCALE_HEIGHT = 2 };
|
||||
enum eRenderStatus : unsigned int { RENDER_OK = 0, RENDER_ERROR = 1, RENDER_ABORT = 2 };
|
||||
enum eInterp : uint { EMBER_INTERP_LINEAR = 0, EMBER_INTERP_SMOOTH = 1 };
|
||||
enum eAffineInterp : uint { INTERP_LINEAR = 0, INTERP_LOG = 1, INTERP_COMPAT = 2, INTERP_OLDER = 3 };
|
||||
enum ePaletteMode : uint { PALETTE_STEP = 0, PALETTE_LINEAR = 1 };
|
||||
enum ePaletteInterp : uint { INTERP_HSV = 0, INTERP_SWEEP = 1 };
|
||||
enum eMotion : uint { MOTION_SIN = 1, MOTION_TRIANGLE = 2, MOTION_HILL = 3 };
|
||||
enum eProcessAction : uint { NOTHING = 0, ACCUM_ONLY = 1, FILTER_AND_ACCUM = 2, KEEP_ITERATING = 3, FULL_RENDER = 4 };
|
||||
enum eProcessState : uint { NONE = 0, ITER_STARTED = 1, ITER_DONE = 2, FILTER_DONE = 3, ACCUM_DONE = 4 };
|
||||
enum eInteractiveFilter : uint { FILTER_LOG = 0, FILTER_DE = 1 };
|
||||
enum eScaleType : uint { SCALE_NONE = 0, SCALE_WIDTH = 1, SCALE_HEIGHT = 2 };
|
||||
enum eRenderStatus : uint { RENDER_OK = 0, RENDER_ERROR = 1, RENDER_ABORT = 2 };
|
||||
}
|
||||
|
@ -63,6 +63,7 @@
|
||||
|
||||
//glm is what's used for matrix math.
|
||||
#include "glm/glm.hpp"
|
||||
#include "glm/detail/type_int.hpp"
|
||||
#include "glm/gtc/matrix_transform.hpp"
|
||||
#include "glm/gtc/type_ptr.hpp"
|
||||
#include "glm/gtx/string_cast.hpp"
|
||||
@ -70,3 +71,5 @@
|
||||
using namespace tbb;
|
||||
using namespace std;
|
||||
using namespace std::chrono;
|
||||
using glm::uint;
|
||||
using glm::uint16;
|
||||
|
@ -32,7 +32,7 @@
|
||||
/// </summary>
|
||||
|
||||
#ifndef __ISAAC64
|
||||
typedef unsigned int ISAAC_INT;
|
||||
typedef uint ISAAC_INT;
|
||||
const ISAAC_INT GOLDEN_RATIO = ISAAC_INT(0x9e3779b9);
|
||||
#else
|
||||
typedef size_t ISAAC_INT;
|
||||
@ -48,7 +48,6 @@ template <int ALPHA = 4, class T = ISAAC_INT>
|
||||
class EMBER_API QTIsaac
|
||||
{
|
||||
public:
|
||||
typedef unsigned char byte;
|
||||
enum { N = (1 << ALPHA) };
|
||||
|
||||
/// <summary>
|
||||
@ -167,7 +166,7 @@ public:
|
||||
/// Returns a random 0 or 1.
|
||||
/// </summary>
|
||||
/// <returns>A random 0 or 1</returns>
|
||||
inline unsigned int RandBit()
|
||||
inline uint RandBit()
|
||||
{
|
||||
return Rand() & 1;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
/// <summary>
|
||||
/// Accessors.
|
||||
/// </summary>
|
||||
const unsigned char* XformDistributions() const { return m_XformDistributions.empty() ? nullptr : &m_XformDistributions[0]; }
|
||||
const byte* XformDistributions() const { return m_XformDistributions.empty() ? nullptr : &m_XformDistributions[0]; }
|
||||
const size_t XformDistributionsSize() const { return m_XformDistributions.size(); }
|
||||
|
||||
/// <summary>
|
||||
@ -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] = (unsigned char)i;
|
||||
m_XformDistributions[(distrib * CHOOSE_XFORM_GRAIN) + j] = (byte)i;
|
||||
tempDensity += densityPerElement;
|
||||
j++;
|
||||
}
|
||||
@ -262,7 +262,7 @@ protected:
|
||||
return (size_t)m_XformDistributions[(index % CHOOSE_XFORM_GRAIN) + (CHOOSE_XFORM_GRAIN * distribOffset)];
|
||||
}
|
||||
|
||||
vector<unsigned char> m_XformDistributions;
|
||||
vector<byte> m_XformDistributions;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
/// <param name="index">The index in the palette file</param>
|
||||
/// <param name="size">The size of the palette which should be 256</param>
|
||||
/// <param name="xmlPaletteEntries">A pointer to 256 color entries</param>
|
||||
Palette(const string& name, int index, unsigned int size, v4T* xmlPaletteEntries)
|
||||
Palette(const string& name, int index, uint size, v4T* xmlPaletteEntries)
|
||||
{
|
||||
m_Name = name;
|
||||
m_Index = index;
|
||||
@ -52,7 +52,7 @@ public:
|
||||
else//They passed in null, so just fill with hard coded values so they at least have something.
|
||||
{
|
||||
//Palette 15 used in the test ember file.
|
||||
unsigned char palette15[COLORMAP_LENGTH * 4] = {
|
||||
byte palette15[COLORMAP_LENGTH * 4] = {
|
||||
0x00, 0xda, 0xde, 0xbc, 0x00, 0xee, 0xe6, 0xc5, 0x00, 0xee, 0xf2, 0xce, 0x00, 0xee, 0xf2, 0xcf, 0x00, 0xe6, 0xee, 0xe1, 0x00, 0xea, 0xee, 0xd8, 0x00, 0xf2, 0xf1, 0xeb, 0x00, 0xf2, 0xf5, 0xd8,
|
||||
0x00, 0xe6, 0xf2, 0xce, 0x00, 0xde, 0xea, 0xc5, 0x00, 0xd6, 0xda, 0xc6, 0x00, 0xce, 0xd2, 0xbc, 0x00, 0xc2, 0xca, 0xa9, 0x00, 0xbe, 0xca, 0xa0, 0x00, 0xce, 0xd6, 0xaa, 0x00, 0xde, 0xe2, 0xc5,
|
||||
0x00, 0xea, 0xed, 0xce, 0x00, 0xea, 0xf2, 0xc5, 0x00, 0xde, 0xe2, 0xc5, 0x00, 0xc2, 0xca, 0xaa, 0x00, 0xae, 0xbe, 0xaa, 0x00, 0xa5, 0xb2, 0x96, 0x00, 0xa2, 0xa9, 0x8d, 0x00, 0x96, 0xa2, 0x84,
|
||||
@ -86,7 +86,7 @@ public:
|
||||
0x00, 0x81, 0x96, 0x8d, 0x00, 0x81, 0x9a, 0x8d, 0x00, 0x85, 0x9a, 0x8d, 0x00, 0x89, 0x9e, 0x8d, 0x00, 0x89, 0x9e, 0x8d, 0x00, 0x8d, 0xa2, 0x97, 0x00, 0x95, 0xa2, 0x97, 0x00, 0x8d, 0xa2, 0x97,
|
||||
0x00, 0x96, 0xa6, 0x8d, 0x00, 0x9a, 0xa1, 0x8d, 0x00, 0x9e, 0xa9, 0x84, 0x00, 0x9e, 0xa6, 0x7a, 0x00, 0xa2, 0xa5, 0x71, 0x00, 0x9e, 0xa6, 0x71, 0x00, 0x9a, 0xa6, 0x71, 0x00, 0x95, 0x9d, 0x71 };
|
||||
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
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];
|
||||
@ -206,7 +206,7 @@ public:
|
||||
palette.m_Name = m_Name;
|
||||
palette.m_Entries.resize(Size());
|
||||
|
||||
for (unsigned int i = 0; i < Size(); i++)
|
||||
for (uint i = 0; i < Size(); i++)
|
||||
{
|
||||
size_t ii = (i * 256) / COLORMAP_LENGTH;
|
||||
T rgb[3], hsv[3];
|
||||
@ -241,7 +241,7 @@ public:
|
||||
/// <param name="cont">Contrast -1 - 2</param>
|
||||
/// <param name="blur">Blur 0 - 127</param>
|
||||
/// <param name="freq">Frequency 1 - 10</param>
|
||||
void MakeAdjustedPalette(Palette<T>& palette, int rot, T hue, T sat, T bright, T cont, unsigned int blur, unsigned int freq)
|
||||
void MakeAdjustedPalette(Palette<T>& palette, int rot, T hue, T sat, T bright, T cont, uint blur, uint freq)
|
||||
{
|
||||
T rgb[3], hsv[3];
|
||||
|
||||
@ -344,7 +344,7 @@ public:
|
||||
if (palette.Size() != Size())
|
||||
palette.m_Entries.resize(Size());
|
||||
|
||||
for (unsigned int j = 0; j < palette.Size(); j++)
|
||||
for (uint j = 0; j < palette.Size(); j++)
|
||||
{
|
||||
palette.m_Entries[j] = m_Entries[j] * colorScalar;
|
||||
palette.m_Entries[j].a = 1;
|
||||
@ -358,20 +358,20 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="height">The height of the output block</param>
|
||||
/// <returns>A vector holding the color values</returns>
|
||||
vector<unsigned char> MakeRgbPaletteBlock(unsigned int height)
|
||||
vector<byte> MakeRgbPaletteBlock(uint height)
|
||||
{
|
||||
size_t width = Size();
|
||||
vector<unsigned char> v(height * width * 3);
|
||||
vector<byte> v(height * width * 3);
|
||||
|
||||
if (v.size() == (height * Size() * 3))
|
||||
{
|
||||
for (unsigned int i = 0; i < height; i++)
|
||||
for (uint i = 0; i < height; i++)
|
||||
{
|
||||
for (unsigned int j = 0; j < width; j++)
|
||||
for (uint j = 0; j < width; j++)
|
||||
{
|
||||
v[(width * 3 * i) + (j * 3)] = (unsigned char)(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] = (unsigned char)(m_Entries[j][1] * T(255));
|
||||
v[(width * 3 * i) + (j * 3) + 2] = (unsigned char)(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
/// <returns>A pointer to the palette if found, else nullptr</returns>
|
||||
Palette<T>* GetPaletteByName(const string&& name)
|
||||
{
|
||||
for (unsigned int i = 0; i < Size(); i++)
|
||||
for (uint i = 0; i < Size(); i++)
|
||||
if (m_Palettes[i].m_Name == name)
|
||||
return &m_Palettes[i];
|
||||
|
||||
@ -166,7 +166,7 @@ private:
|
||||
if (!Compare(attr->name, "data"))
|
||||
{
|
||||
int colorIndex = 0;
|
||||
unsigned int r, g, b;
|
||||
uint r, g, b;
|
||||
int colorCount = 0;
|
||||
hexError = false;
|
||||
|
||||
|
@ -318,7 +318,7 @@ bool Renderer<T, bucketT>::CreateTemporalFilter(bool& newAlloc)
|
||||
/// <param name="finalOffset">Offset in finalImage to store the pixels to. Default: 0.</param>
|
||||
/// <returns>True if nothing went wrong, else false.</returns>
|
||||
template <typename T, typename bucketT>
|
||||
eRenderStatus Renderer<T, bucketT>::Run(vector<unsigned char>& finalImage, double time, size_t subBatchCountOverride, bool forceOutput, size_t finalOffset)
|
||||
eRenderStatus Renderer<T, bucketT>::Run(vector<byte>& finalImage, double time, size_t subBatchCountOverride, bool forceOutput, size_t finalOffset)
|
||||
{
|
||||
m_InRender = true;
|
||||
EnterRender();
|
||||
@ -988,7 +988,7 @@ eRenderStatus Renderer<T, bucketT>::GaussianDensityFilter()
|
||||
/// <param name="finalOffset">Offset in the buffer to store the pixels to</param>
|
||||
/// <returns>True if not prematurely aborted, else false.</returns>
|
||||
template <typename T, typename bucketT>
|
||||
eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(vector<unsigned char>& pixels, size_t finalOffset)
|
||||
eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(vector<byte>& pixels, size_t finalOffset)
|
||||
{
|
||||
if (PrepFinalAccumVector(pixels))
|
||||
return AccumulatorToFinalImage(pixels.data(), finalOffset);
|
||||
@ -1004,7 +1004,7 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(vector<unsigned char
|
||||
/// <param name="finalOffset">Offset in the buffer to store the pixels to. Default: 0.</param>
|
||||
/// <returns>True if not prematurely aborted, else false.</returns>
|
||||
template <typename T, typename bucketT>
|
||||
eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(unsigned char* pixels, size_t finalOffset)
|
||||
eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(byte* pixels, size_t finalOffset)
|
||||
{
|
||||
if (!pixels)
|
||||
return RENDER_ERROR;
|
||||
@ -1048,7 +1048,7 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(unsigned char* pixel
|
||||
Color<bucketT> newBucket;
|
||||
size_t pixelsRowStart = (m_YAxisUp ? ((FinalRasH() - j) - 1) : j) * FinalRowSize();//Pull out of inner loop for optimization.
|
||||
size_t y = m_DensityFilterOffset + (j * Supersample());//Start at the beginning row of each super sample block.
|
||||
unsigned short* p16;
|
||||
uint16* p16;
|
||||
|
||||
for (size_t i = 0; i < FinalRasW(); i++, pixelsRowStart += PixelSize())
|
||||
{
|
||||
@ -1074,18 +1074,18 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(unsigned char* pixel
|
||||
|
||||
if (BytesPerChannel() == 2)
|
||||
{
|
||||
p16 = (unsigned short*)(pixels + pixelsRowStart);
|
||||
p16 = (uint16*)(pixels + pixelsRowStart);
|
||||
|
||||
if (EarlyClip())
|
||||
{
|
||||
p16[0] = (unsigned short)(Clamp<bucketT>(newBucket.r, 0, 255) * bucketT(256));
|
||||
p16[1] = (unsigned short)(Clamp<bucketT>(newBucket.g, 0, 255) * bucketT(256));
|
||||
p16[2] = (unsigned short)(Clamp<bucketT>(newBucket.b, 0, 255) * bucketT(256));
|
||||
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] = (unsigned char)(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;
|
||||
}
|
||||
@ -1099,14 +1099,14 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(unsigned char* pixel
|
||||
{
|
||||
if (EarlyClip())
|
||||
{
|
||||
pixels[pixelsRowStart] = (unsigned char)Clamp<bucketT>(newBucket.r, 0, 255);
|
||||
pixels[pixelsRowStart + 1] = (unsigned char)Clamp<bucketT>(newBucket.g, 0, 255);
|
||||
pixels[pixelsRowStart + 2] = (unsigned char)Clamp<bucketT>(newBucket.b, 0, 255);
|
||||
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] = (unsigned char)(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;
|
||||
}
|
||||
@ -1131,11 +1131,11 @@ eRenderStatus Renderer<T, bucketT>::AccumulatorToFinalImage(unsigned char* pixel
|
||||
{
|
||||
for (i = 0; i < FinalRasW(); i++)
|
||||
{
|
||||
unsigned char* p = pixels + (NumChannels() * (i + j * FinalRasW()));
|
||||
byte* p = pixels + (NumChannels() * (i + j * FinalRasW()));
|
||||
|
||||
p[0] = (unsigned char)(m_TempEmber.m_Palette[i * 256 / FinalRasW()][0] * WHITE);//The palette is [0..1], output image is [0..255].
|
||||
p[1] = (unsigned char)(m_TempEmber.m_Palette[i * 256 / FinalRasW()][1] * WHITE);
|
||||
p[2] = (unsigned char)(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1357,7 +1357,7 @@ template <typename T, typename bucketT> size_t Renderer<T, bucketT>::FuseCount()
|
||||
/// Non-virtual iterator wrappers.
|
||||
/// </summary>
|
||||
|
||||
template <typename T, typename bucketT> const unsigned char* Renderer<T, bucketT>::XformDistributions() const { return m_Iterator != nullptr ? m_Iterator->XformDistributions() : 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> 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; }
|
||||
|
||||
@ -1523,7 +1523,7 @@ void Renderer<T, bucketT>::AddToAccum(const glm::detail::tvec4<bucketT, glm::def
|
||||
/// Because this code is used in both early and late clipping, a few extra arguments are passed
|
||||
/// to specify what actions to take. Coupled with an additional template argument, this allows
|
||||
/// using one function to perform all color clipping, gamma correction and final accumulation.
|
||||
/// Template argument accumT is expected to match T for the case of early clipping, unsigned char for late clip for
|
||||
/// Template argument accumT is expected to match T for the case of early clipping, byte for late clip for
|
||||
/// images with one byte per channel and unsigned short for images with two bytes per channel.
|
||||
/// </summary>
|
||||
/// <param name="bucket">The pixel to correct</param>
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
virtual bool CreateSpatialFilter(bool& newAlloc) override;
|
||||
virtual bool CreateTemporalFilter(bool& newAlloc) override;
|
||||
virtual size_t HistBucketSize() const override { return sizeof(glm::detail::tvec4<bucketT, glm::defaultp>); }
|
||||
virtual eRenderStatus Run(vector<unsigned char>& finalImage, double time = 0, size_t subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) override;
|
||||
virtual eRenderStatus Run(vector<byte>& finalImage, double time = 0, size_t subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) override;
|
||||
virtual EmberImageComments ImageComments(EmberStats& stats, size_t printEditDepth = 0, bool intPalette = false, bool hexPalette = true) override;
|
||||
|
||||
protected:
|
||||
@ -73,8 +73,8 @@ protected:
|
||||
virtual bool ResetBuckets(bool resetHist = true, bool resetAccum = true);
|
||||
virtual eRenderStatus LogScaleDensityFilter();
|
||||
virtual eRenderStatus GaussianDensityFilter();
|
||||
virtual eRenderStatus AccumulatorToFinalImage(vector<unsigned char>& pixels, size_t finalOffset);
|
||||
virtual eRenderStatus AccumulatorToFinalImage(unsigned char* pixels, size_t finalOffset);
|
||||
virtual eRenderStatus AccumulatorToFinalImage(vector<byte>& pixels, size_t finalOffset);
|
||||
virtual eRenderStatus AccumulatorToFinalImage(byte* pixels, size_t finalOffset);
|
||||
virtual EmberStats Iterate(size_t iterCount, size_t temporalSample);
|
||||
|
||||
public:
|
||||
@ -139,7 +139,7 @@ public:
|
||||
virtual size_t FuseCount() const override;
|
||||
|
||||
//Non-virtual iterator wrappers.
|
||||
const unsigned char* XformDistributions() const;
|
||||
const byte* XformDistributions() const;
|
||||
const size_t XformDistributionsSize() const;
|
||||
Point<T>* Samples(size_t threadIndex) const;
|
||||
|
||||
|
@ -176,7 +176,7 @@ bool RendererBase::RandVec(vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>>& randVec)
|
||||
/// </summary>
|
||||
/// <param name="pixels">The vector to allocate</param>
|
||||
/// <returns>True if the vector contains enough space to hold the output image</returns>
|
||||
bool RendererBase::PrepFinalAccumVector(vector<unsigned char>& pixels)
|
||||
bool RendererBase::PrepFinalAccumVector(vector<byte>& pixels)
|
||||
{
|
||||
EnterResize();
|
||||
size_t size = FinalBufferSize();
|
||||
@ -470,7 +470,7 @@ void RendererBase::ThreadCount(size_t threads, const char* seedString)
|
||||
m_Rand.push_back(isaac);
|
||||
|
||||
for (i = 0; i < (isaacSize * sizeof(ISAAC_INT)); i++)
|
||||
((unsigned char*)seeds)[i]++;
|
||||
((byte*)seeds)[i]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
void ChangeVal(std::function<void(void)> func, eProcessAction action);
|
||||
size_t MemoryRequired(size_t strips, bool includeFinal);
|
||||
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> RandVec();
|
||||
bool PrepFinalAccumVector(vector<unsigned char>& pixels);
|
||||
bool PrepFinalAccumVector(vector<byte>& pixels);
|
||||
|
||||
//Virtual processing functions.
|
||||
virtual bool Ok() const;
|
||||
@ -117,7 +117,7 @@ public:
|
||||
virtual bool CreateTemporalFilter(bool& newAlloc) = 0;
|
||||
virtual void ComputeBounds() = 0;
|
||||
virtual void ComputeCamera() = 0;
|
||||
virtual eRenderStatus Run(vector<unsigned char>& finalImage, double time = 0, size_t subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) = 0;
|
||||
virtual eRenderStatus Run(vector<byte>& finalImage, double time = 0, size_t subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) = 0;
|
||||
virtual EmberImageComments ImageComments(EmberStats& stats, size_t printEditDepth = 0, bool intPalette = false, bool hexPalette = true) = 0;
|
||||
virtual DensityFilterBase* GetDensityFilter() = 0;
|
||||
|
||||
|
@ -285,7 +285,7 @@ public:
|
||||
else if (mode == MUTATE_POST_XFORMS)
|
||||
{
|
||||
bool same = (m_Rand.Rand() & 3) > 0;//25% chance of using the same post for all of them.
|
||||
unsigned int b = 1 + m_Rand.Rand() % 6;
|
||||
uint b = 1 + m_Rand.Rand() % 6;
|
||||
|
||||
sprintf_s(ministr, 32, "(%d%s)", b, same ? " same" : "");
|
||||
os << "mutate post xforms " << ministr;
|
||||
@ -444,7 +444,7 @@ public:
|
||||
/// <returns>A string describing what was done</returns>
|
||||
string Cross(Ember<T>& ember0, Ember<T>& ember1, Ember<T>& emberOut, int crossMode)
|
||||
{
|
||||
unsigned int rb;
|
||||
uint rb;
|
||||
size_t i;
|
||||
T t;
|
||||
ostringstream os;
|
||||
@ -582,7 +582,7 @@ public:
|
||||
{
|
||||
//Select the starting parent.
|
||||
size_t ci;
|
||||
unsigned int startParent = m_Rand.RandBit();
|
||||
uint startParent = m_Rand.RandBit();
|
||||
|
||||
os << " cmap_cross " << startParent << ":";
|
||||
|
||||
@ -856,7 +856,7 @@ public:
|
||||
/// <returns>The number of histogram cells that weren't black</returns>
|
||||
T TryColors(Ember<T>& ember, int colorResolution)
|
||||
{
|
||||
unsigned char* p;
|
||||
byte* p;
|
||||
size_t i, hits = 0, res = colorResolution;
|
||||
size_t pixTotal, res3 = res * res * res;
|
||||
T scalar;
|
||||
@ -1389,8 +1389,8 @@ private:
|
||||
string m_Comment;
|
||||
|
||||
vector<Point<T>> m_Samples;
|
||||
vector<unsigned char> m_FinalImage;
|
||||
vector<unsigned int> m_Hist;
|
||||
vector<byte> m_FinalImage;
|
||||
vector<uint> m_Hist;
|
||||
EmberToXml<T> m_EmberToXml;
|
||||
Iterator<T>* m_Iterator;
|
||||
unique_ptr<StandardIterator<T>> m_StandardIterator;
|
||||
|
@ -159,7 +159,7 @@ protected:
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Open a file in binary mode and read its entire contents into a vector of unsigned chars. Optionally null terminate.
|
||||
/// Open a file in binary mode and read its entire contents into a vector of bytes. Optionally null terminate.
|
||||
/// </summary>
|
||||
/// <param name="filename">The full path to the file to read</param>
|
||||
/// <param name="buf">The vector which will be populated with the file's contents</param>
|
||||
@ -262,7 +262,7 @@ static void CopyVec(vector<T>& dest, const vector<U>& source, std::function<void
|
||||
template <typename T>
|
||||
static void ClearVec(vector<T*>& vec, bool arrayDelete = false)
|
||||
{
|
||||
for (unsigned int i = 0; i < vec.size(); i++)
|
||||
for (uint i = 0; i < vec.size(); i++)
|
||||
{
|
||||
if (vec[i] != nullptr)
|
||||
{
|
||||
@ -451,7 +451,7 @@ static inline float LRint(float x)
|
||||
/// <returns>The rounded value</returns>
|
||||
static inline double LRint(double x)
|
||||
{
|
||||
int64_t temp = (x >= 0 ? (int64_t)(x + 0.5) : (int64_t)(x - 0.5));
|
||||
glm::int64_t temp = (x >= 0 ? (int64_t)(x + 0.5) : (int64_t)(x - 0.5));
|
||||
return (double)temp;
|
||||
}
|
||||
|
||||
@ -893,7 +893,7 @@ int Arg<int>(char* name, int def)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Template specialization for Arg<>() with a type of unsigned int.
|
||||
/// Template specialization for Arg<>() with a type of uint.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the environment variable to query</param>
|
||||
/// <param name="def">The default value to return if the environment variable was not present</param>
|
||||
@ -902,7 +902,7 @@ template <>
|
||||
#ifdef _WIN32
|
||||
static
|
||||
#endif
|
||||
unsigned int Arg<unsigned int>(char* name, unsigned int def)
|
||||
uint Arg<uint>(char* name, uint def)
|
||||
{
|
||||
return Arg<int>(name, (int)def);
|
||||
}
|
||||
@ -1003,9 +1003,9 @@ string Arg<string>(char* name, string def)
|
||||
/// <param name="replace">The value to replace with</param>
|
||||
/// <returns>The number of instances replaced</returns>
|
||||
template<typename T>
|
||||
static unsigned int FindAndReplace(T& source, const T& find, const T& replace)
|
||||
static uint FindAndReplace(T& source, const T& find, const T& replace)
|
||||
{
|
||||
unsigned int replaceCount = 0;
|
||||
uint replaceCount = 0;
|
||||
typename T::size_type fLen = find.size();
|
||||
typename T::size_type rLen = replace.size();
|
||||
|
||||
|
@ -355,7 +355,7 @@ public:
|
||||
|
||||
//Keep a list of which variations derive from ParametricVariation.
|
||||
//Note that these are not new copies, rather just pointers to the original instances in m_Variations.
|
||||
for (unsigned int i = 0; i < m_Variations.size(); i++)
|
||||
for (uint i = 0; i < m_Variations.size(); i++)
|
||||
{
|
||||
if (ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(m_Variations[i]))
|
||||
m_ParametricVariations.push_back(parVar);
|
||||
@ -412,7 +412,7 @@ public:
|
||||
/// <returns>A pointer to the variation if found, else nullptr.</returns>
|
||||
Variation<T>* GetVariation(eVariationId id)
|
||||
{
|
||||
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
||||
for (uint i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
||||
if (id == m_Variations[i]->VariationId())
|
||||
return m_Variations[i];
|
||||
|
||||
@ -435,7 +435,7 @@ public:
|
||||
/// <returns>A pointer to the variation if found, else nullptr.</returns>
|
||||
Variation<T>* GetVariation(const string& name)
|
||||
{
|
||||
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
||||
for (uint 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];
|
||||
|
||||
@ -466,7 +466,7 @@ public:
|
||||
/// <returns>The parametric variation with a matching name, else nullptr.</returns>
|
||||
ParametricVariation<T>* GetParametricVariation(const string& name)
|
||||
{
|
||||
for (unsigned int i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != nullptr; i++)
|
||||
for (uint 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];
|
||||
|
||||
@ -480,7 +480,7 @@ public:
|
||||
/// <returns>The index of the variation with the matching name, else -1</returns>
|
||||
int GetVariationIndex(const string& name)
|
||||
{
|
||||
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
||||
for (uint i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
|
||||
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
|
||||
return i;
|
||||
|
||||
|
@ -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((unsigned int)m_Spread);
|
||||
int n = rand.Rand((uint)m_Spread);
|
||||
|
||||
if (a < 0)
|
||||
n++;
|
||||
|
@ -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((unsigned int)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((unsigned int)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);
|
||||
|
@ -183,8 +183,8 @@ public:
|
||||
T x, y, z;
|
||||
T p = 2 * rand.Frand01<T>() - 1;
|
||||
T q = 2 * rand.Frand01<T>() - 1;
|
||||
unsigned int i = rand.Rand(3);
|
||||
unsigned int j = rand.RandBit();
|
||||
uint i = rand.Rand(3);
|
||||
uint j = rand.RandBit();
|
||||
|
||||
switch (i)
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ public:
|
||||
/// <param name="filename">Full path and filename, optionally empty</param>
|
||||
/// <param name="embers">The newly constructed embers based on what was parsed</param>
|
||||
/// <returns>True if there were no errors, else false.</returns>
|
||||
bool Parse(unsigned char* buf, const char* filename, vector<Ember<T>>& embers)
|
||||
bool Parse(byte* buf, const char* filename, vector<Ember<T>>& embers)
|
||||
{
|
||||
char* bn;
|
||||
const char* xmlPtr;
|
||||
@ -310,7 +310,7 @@ public:
|
||||
//An adjustment of +/- 360 degrees is made until this is true.
|
||||
if (emberSize > 1)
|
||||
{
|
||||
for (unsigned int i = 1; i < emberSize; i++)
|
||||
for (uint i = 1; i < emberSize; i++)
|
||||
{
|
||||
//Only do this adjustment if not in compat mode..
|
||||
if (embers[i - 1].m_AffineInterp != INTERP_COMPAT && embers[i - 1].m_AffineInterp != INTERP_OLDER)
|
||||
@ -349,7 +349,7 @@ public:
|
||||
if (ReadFile(filename, buf))
|
||||
{
|
||||
std::replace(buf.begin(), buf.end(), '&', '+');
|
||||
return Parse((unsigned char*)buf.data(), filename, embers);
|
||||
return Parse((byte*)buf.data(), filename, embers);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
@ -395,19 +395,19 @@ public:
|
||||
/// See error report for errors.
|
||||
/// </summary>
|
||||
/// <param name="str">The string to convert</param>
|
||||
/// <param name="val">The converted unsigned integer value</param>
|
||||
/// <param name="val">The converted uinteger value</param>
|
||||
/// <returns>True if success, else false.</returns>
|
||||
bool Atoi(const char* str, unsigned int& val)
|
||||
bool Atoi(const char* str, uint& val)
|
||||
{
|
||||
return Atoi(str, (int&)val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the string to an unsigned integer value and return a bool indicating success.
|
||||
/// Convert the string to an uinteger value and return a bool indicating success.
|
||||
/// See error report for errors.
|
||||
/// </summary>
|
||||
/// <param name="str">The string to convert</param>
|
||||
/// <param name="val">The converted unsigned integer value</param>
|
||||
/// <param name="val">The converted uinteger value</param>
|
||||
/// <returns>True if success, else false.</returns>
|
||||
bool Atoi(const char* str, int& val)
|
||||
{
|
||||
@ -542,11 +542,11 @@ private:
|
||||
bool ParseEmberElement(xmlNode* emberNode, Ember<T>& currentEmber)
|
||||
{
|
||||
bool ret = true;
|
||||
unsigned int newLinear = 0;
|
||||
uint newLinear = 0;
|
||||
char* attStr;
|
||||
const char* loc = __FUNCTION__;
|
||||
int soloXform = -1;
|
||||
unsigned int i, count, index = 0;
|
||||
uint i, count, index = 0;
|
||||
double vals[10];
|
||||
xmlAttrPtr att, curAtt;
|
||||
xmlNodePtr editNode, childNode, motionNode;
|
||||
@ -1041,7 +1041,7 @@ private:
|
||||
bool success = true;
|
||||
char* attStr;
|
||||
const char* loc = __FUNCTION__;
|
||||
unsigned int j;
|
||||
uint j;
|
||||
T temp;
|
||||
double a, b, c, d, e, f;
|
||||
double vals[10];
|
||||
@ -1203,7 +1203,7 @@ private:
|
||||
|
||||
if (Atof(attStr, temp))
|
||||
{
|
||||
unsigned int iTemp = (unsigned int)temp;
|
||||
uint iTemp = (uint)temp;
|
||||
|
||||
if (iTemp < xform.TotalVariationCount())
|
||||
{
|
||||
@ -1246,7 +1246,7 @@ private:
|
||||
}
|
||||
|
||||
//Now that all xforms have been parsed, go through and try to find params for the parametric variations.
|
||||
for (unsigned int i = 0; i < xform.TotalVariationCount(); i++)
|
||||
for (uint i = 0; i < xform.TotalVariationCount(); i++)
|
||||
{
|
||||
if (ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(xform.GetVariation(i)))
|
||||
{
|
||||
@ -1361,7 +1361,7 @@ private:
|
||||
{
|
||||
int colorIndex = 0;
|
||||
int colorCount = 0;
|
||||
unsigned int r, g, b, a;
|
||||
uint r, g, b, a;
|
||||
int ret;
|
||||
char tmps[2];
|
||||
int skip = (int)abs(chan);
|
||||
|
Reference in New Issue
Block a user