mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-01 05:46:06 -04:00
22.21.4.2 4/19/2021
--User changes -Allow users to set the Exp value when using the Exp temporal filter type. -Set the default temporal filter type to be Box, which does not alter the palette values at all during animation. This is done to avoid confusion when using Gaussian or Exp which can produce darkened images. --Bug fixes -Sending a sequence to the final render dialog when the keyframes had non zero rotate and center Y values would produce off center animations when rendered. -Temporal filters were being unnecessarily recreated many times when rendering or generating sequences. -Exp filter was always treated like a Box filter. --Code changes -Add a new member function SaveCurrentAsXml(QString filename = "") to the controllers which is only used for testing. -Modernize some C++ code.
This commit is contained in:
@ -218,9 +218,9 @@ static void Rgba32ToRgb8(v4F* rgba, byte* rgb, size_t width, size_t height)
|
||||
{
|
||||
for (size_t i = 0, j = 0; i < (width * height); i++)
|
||||
{
|
||||
rgb[j++] = byte(Clamp<float>(rgba[i].r * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = byte(Clamp<float>(rgba[i].g * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = byte(Clamp<float>(rgba[i].b * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = static_cast<byte>(Clamp<float>(rgba[i].r * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = static_cast<byte>(Clamp<float>(rgba[i].g * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = static_cast<byte>(Clamp<float>(rgba[i].b * 255.0f, 0.0f, 255.0f));
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,10 +237,10 @@ static void Rgba32ToRgba8(v4F* rgba, byte* rgb, size_t width, size_t height, boo
|
||||
{
|
||||
for (size_t i = 0, j = 0; i < (width * height); i++)
|
||||
{
|
||||
rgb[j++] = byte(Clamp<float>(rgba[i].r * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = byte(Clamp<float>(rgba[i].g * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = byte(Clamp<float>(rgba[i].b * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = doAlpha ? byte(Clamp<float>(rgba[i].a * 255.0f, 0.0f, 255.0f)) : 255;
|
||||
rgb[j++] = static_cast<byte>(Clamp<float>(rgba[i].r * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = static_cast<byte>(Clamp<float>(rgba[i].g * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = static_cast<byte>(Clamp<float>(rgba[i].b * 255.0f, 0.0f, 255.0f));
|
||||
rgb[j++] = doAlpha ? static_cast<byte>(Clamp<float>(rgba[i].a * 255.0f, 0.0f, 255.0f)) : 255;
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,10 +257,10 @@ static void Rgba32ToRgba16(v4F* rgba, glm::uint16* rgb, size_t width, size_t hei
|
||||
{
|
||||
for (size_t i = 0, j = 0; i < (width * height); i++)
|
||||
{
|
||||
rgb[j++] = glm::uint16(Clamp<float>(rgba[i].r * 65535.0f, 0.0f, 65535.0f));
|
||||
rgb[j++] = glm::uint16(Clamp<float>(rgba[i].g * 65535.0f, 0.0f, 65535.0f));
|
||||
rgb[j++] = glm::uint16(Clamp<float>(rgba[i].b * 65535.0f, 0.0f, 65535.0f));
|
||||
rgb[j++] = doAlpha ? glm::uint16(Clamp<float>(rgba[i].a * 65535.0f, 0.0f, 65535.0f)) : glm::uint16(65535);
|
||||
rgb[j++] = static_cast<glm::uint16>(Clamp<float>(rgba[i].r * 65535.0f, 0.0f, 65535.0f));
|
||||
rgb[j++] = static_cast<glm::uint16>(Clamp<float>(rgba[i].g * 65535.0f, 0.0f, 65535.0f));
|
||||
rgb[j++] = static_cast<glm::uint16>(Clamp<float>(rgba[i].b * 65535.0f, 0.0f, 65535.0f));
|
||||
rgb[j++] = doAlpha ? static_cast<glm::uint16>(Clamp<float>(rgba[i].a * 65535.0f, 0.0f, 65535.0f)) : glm::uint16{ 65535 };
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,8 +385,6 @@ static string MakeAnimFilename(const string& path, const string& prefix, const s
|
||||
/// <returns>The number of strips to use</returns>
|
||||
static uint CalcStrips(double memRequired, double memAvailable, double useMem)
|
||||
{
|
||||
uint strips;
|
||||
|
||||
if (useMem > 0)
|
||||
memAvailable = useMem;
|
||||
else
|
||||
@ -395,8 +393,7 @@ static uint CalcStrips(double memRequired, double memAvailable, double useMem)
|
||||
if (memAvailable >= memRequired)
|
||||
return 1;
|
||||
|
||||
strips = uint(ceil(memRequired / memAvailable));
|
||||
return strips;
|
||||
return static_cast<uint>(ceil(memRequired / memAvailable));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -178,7 +178,7 @@ public:
|
||||
EmberOptionEntry(eOptionUse optUsage, eOptionIDs optId, const CharT* arg, T defaultVal, ESOArgType argType, const string& docString)
|
||||
{
|
||||
m_OptionUse = optUsage;
|
||||
m_Option.nId = int(optId);
|
||||
m_Option.nId = static_cast<int>(optId);
|
||||
m_Option.pszArg = arg;
|
||||
m_Option.nArgType = argType;
|
||||
m_DocString = docString;
|
||||
@ -478,11 +478,11 @@ public:
|
||||
//Process args.
|
||||
while (args.Next())
|
||||
{
|
||||
ESOError errorCode = args.LastError();
|
||||
const auto errorCode = args.LastError();
|
||||
|
||||
if (errorCode == SO_SUCCESS)
|
||||
{
|
||||
eOptionIDs e = eOptionIDs(args.OptionId());
|
||||
const auto e = eOptionIDs(args.OptionId());
|
||||
|
||||
switch (e)
|
||||
{
|
||||
@ -656,15 +656,15 @@ public:
|
||||
CSimpleOpt::SOption endOption = SO_END_OF_OPTIONS;
|
||||
entries.reserve(75);
|
||||
|
||||
for (auto entry : m_BoolArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option);
|
||||
for (auto entry : m_BoolArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) entries.push_back(entry->m_Option);
|
||||
|
||||
for (auto entry : m_IntArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option);
|
||||
for (auto entry : m_IntArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) entries.push_back(entry->m_Option);
|
||||
|
||||
for (auto entry : m_UintArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option);
|
||||
for (auto entry : m_UintArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) entries.push_back(entry->m_Option);
|
||||
|
||||
for (auto entry : m_DoubleArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option);
|
||||
for (auto entry : m_DoubleArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) entries.push_back(entry->m_Option);
|
||||
|
||||
for (auto entry : m_StringArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option);
|
||||
for (auto entry : m_StringArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) entries.push_back(entry->m_Option);
|
||||
|
||||
entries.push_back(endOption);
|
||||
return entries;
|
||||
@ -679,15 +679,15 @@ public:
|
||||
{
|
||||
ostringstream os;
|
||||
|
||||
for (auto entry : m_BoolArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << "\n";
|
||||
for (auto entry : m_BoolArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_DocString << "\n";
|
||||
|
||||
for (auto entry : m_IntArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << "\n";
|
||||
for (auto entry : m_IntArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_DocString << "\n";
|
||||
|
||||
for (auto entry : m_UintArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << "\n";
|
||||
for (auto entry : m_UintArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_DocString << "\n";
|
||||
|
||||
for (auto entry : m_DoubleArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << "\n";
|
||||
for (auto entry : m_DoubleArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_DocString << "\n";
|
||||
|
||||
for (auto entry : m_StringArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << "\n";
|
||||
for (auto entry : m_StringArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_DocString << "\n";
|
||||
|
||||
return os.str();
|
||||
}
|
||||
@ -702,15 +702,15 @@ public:
|
||||
ostringstream os;
|
||||
os << std::boolalpha;
|
||||
|
||||
for (auto entry : m_BoolArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
for (auto entry : m_BoolArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
|
||||
for (auto entry : m_IntArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
for (auto entry : m_IntArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
|
||||
for (auto entry : m_UintArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
for (auto entry : m_UintArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
|
||||
for (auto entry : m_DoubleArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
for (auto entry : m_DoubleArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
|
||||
for (auto entry : m_StringArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
for (auto entry : m_StringArgs) if (static_cast<et>(entry->m_OptionUse) & static_cast<et>(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << "\n";
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ static bool WriteJpeg(const char* filename, byte* image, size_t width, size_t he
|
||||
jpeg_stdio_dest(&info, file);
|
||||
info.in_color_space = JCS_RGB;
|
||||
info.input_components = 3;
|
||||
info.image_width = JDIMENSION(width);
|
||||
info.image_height = JDIMENSION(height);
|
||||
info.image_width = static_cast<JDIMENSION>(width);
|
||||
info.image_height = static_cast<JDIMENSION>(height);
|
||||
jpeg_set_defaults(&info);
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
jpeg_set_quality(&info, quality, static_cast<boolean>(TRUE));
|
||||
@ -73,14 +73,14 @@ static bool WriteJpeg(const char* filename, byte* image, size_t width, size_t he
|
||||
if (enableComments)
|
||||
{
|
||||
string s;
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(verString.c_str()), uint(verString.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(verString.c_str()), static_cast<uint>(verString.size()));
|
||||
|
||||
if (nick != "")
|
||||
{
|
||||
os.str("");
|
||||
os << "nickname: " << nick;
|
||||
s = os.str();
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(s.c_str()), uint(s.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(s.c_str()), static_cast<uint>(s.size()));
|
||||
}
|
||||
|
||||
if (url != "")
|
||||
@ -88,7 +88,7 @@ static bool WriteJpeg(const char* filename, byte* image, size_t width, size_t he
|
||||
os.str("");
|
||||
os << "url: " << url;
|
||||
s = os.str();
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(s.c_str()), uint(s.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(s.c_str()), static_cast<uint>(s.size()));
|
||||
}
|
||||
|
||||
if (id != "")
|
||||
@ -96,13 +96,13 @@ static bool WriteJpeg(const char* filename, byte* image, size_t width, size_t he
|
||||
os.str("");
|
||||
os << "id: " << id;
|
||||
s = os.str();
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(s.c_str()), uint(s.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(s.c_str()), static_cast<uint>(s.size()));
|
||||
}
|
||||
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(bvString.c_str()), uint(bvString.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(niString.c_str()), uint(niString.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(rtString.c_str()), uint(rtString.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(genomeString.c_str()), uint(genomeString.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(bvString.c_str()), static_cast<uint>(bvString.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(niString.c_str()), static_cast<uint>(niString.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(rtString.c_str()), static_cast<uint>(rtString.size()));
|
||||
jpeg_write_marker(&info, JPEG_COM, reinterpret_cast<const byte*>(genomeString.c_str()), static_cast<uint>(genomeString.size()));
|
||||
}
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
@ -200,7 +200,7 @@ static bool WritePng(const char* filename, byte* image, size_t width, size_t hei
|
||||
}
|
||||
|
||||
png_init_io(png_ptr, file);
|
||||
png_set_IHDR(png_ptr, info_ptr, png_uint_32(width), png_uint_32(height), 8 * png_uint_32(bytesPerChannel),
|
||||
png_set_IHDR(png_ptr, info_ptr, static_cast<png_uint_32>(width), static_cast<png_uint_32>(height), 8 * static_cast<png_uint_32>(bytesPerChannel),
|
||||
PNG_COLOR_TYPE_RGBA,
|
||||
PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_BASE,
|
||||
@ -241,12 +241,12 @@ static vector<byte> ConvertRGBToBMPBuffer(byte* buffer, size_t width, size_t hei
|
||||
return vector<byte>();
|
||||
|
||||
size_t padding = 0;
|
||||
size_t scanlinebytes = width * 3;
|
||||
const auto scanlinebytes = width * 3;
|
||||
|
||||
while ((scanlinebytes + padding ) % 4 != 0)
|
||||
padding++;
|
||||
|
||||
size_t psw = scanlinebytes + padding;
|
||||
const auto psw = scanlinebytes + padding;
|
||||
newSize = height * psw;
|
||||
vector<byte> newBuf(newSize);
|
||||
size_t bufpos = 0;
|
||||
@ -292,11 +292,11 @@ static bool SaveBmp(const char* filename, const byte* image, size_t width, size_
|
||||
bmfh.bfType = 0x4d42; // 0x4d42 = 'BM'
|
||||
bmfh.bfReserved1 = 0;
|
||||
bmfh.bfReserved2 = 0;
|
||||
bmfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + (DWORD)paddedSize;
|
||||
bmfh.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + static_cast<DWORD>(paddedSize);
|
||||
bmfh.bfOffBits = 0x36;
|
||||
info.biSize = sizeof(BITMAPINFOHEADER);
|
||||
info.biWidth = (LONG)width;
|
||||
info.biHeight = (LONG)height;
|
||||
info.biWidth = static_cast<LONG>(width);
|
||||
info.biHeight = static_cast<LONG>(height);
|
||||
info.biPlanes = 1;
|
||||
info.biBitCount = 24;
|
||||
info.biCompression = BI_RGB;
|
||||
@ -335,7 +335,7 @@ static bool SaveBmp(const char* filename, const byte* image, size_t width, size_
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WriteFile(file, image, (DWORD)paddedSize, &bwritten, NULL) == false)
|
||||
if (WriteFile(file, image, static_cast<DWORD>(paddedSize), &bwritten, NULL) == false)
|
||||
{
|
||||
CloseHandle(file);
|
||||
return false;
|
||||
@ -382,8 +382,8 @@ static bool WriteExr16(const char* filename, Rgba* image, size_t width, size_t h
|
||||
{
|
||||
try
|
||||
{
|
||||
int iw = int(width);
|
||||
int ih = int(height);
|
||||
const auto iw = static_cast<int>(width);
|
||||
const auto ih = static_cast<int>(height);
|
||||
std::unique_ptr<RgbaOutputFile> file;
|
||||
|
||||
try
|
||||
@ -442,8 +442,8 @@ static bool WriteExr32(const char* filename, float* r, float* g, float* b, float
|
||||
{
|
||||
try
|
||||
{
|
||||
int iw = int(width);
|
||||
int ih = int(height);
|
||||
const auto iw = static_cast<int>(width);
|
||||
const auto ih = static_cast<int>(height);
|
||||
std::unique_ptr<OutputFile> file;
|
||||
|
||||
try
|
||||
|
Reference in New Issue
Block a user