mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 05:00:06 -05:00
--User changes
-Add a new option to EmberAnimate --ignore-existing which makes it skip rendering a frame if the files from all of the requested extensions for that frame already exist. --Code changes -Migrate to VS2022 and no longer use a version specific folder for the VS solution and project files. It is now under a version agnostic folder called Solution.
This commit is contained in:
parent
a2a5479c81
commit
f787c4f58a
3
.gitignore
vendored
3
.gitignore
vendored
@ -257,6 +257,5 @@ Builds/include/GL
|
||||
/.vs/slnx.sqlite
|
||||
/Deps/Include/OpenEXR
|
||||
/main.pro.user.294b646
|
||||
/Builds/MSVC/VS2019/.vs/Fractorium
|
||||
/Builds/MSVC/VS2017/.vs/config
|
||||
/Deps/Include/Imath
|
||||
/Builds/MSVC/Solution/.vs/Fractorium
|
||||
|
@ -23,14 +23,14 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
@ -23,14 +23,14 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
@ -23,14 +23,14 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
@ -23,14 +23,14 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
@ -23,14 +23,14 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
@ -23,14 +23,14 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
@ -19,12 +19,12 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
@ -336,6 +336,14 @@ bool EmberAnimate(int argc, _TCHAR* argv[], EmberOptions& opt)
|
||||
r->Priority(eThreadPriority(Clamp<intmax_t>(intmax_t(opt.Priority()), intmax_t(eThreadPriority::LOWEST), intmax_t(eThreadPriority::HIGHEST))));
|
||||
}
|
||||
|
||||
const auto doBmp = Find(opt.Format(), "bmp");
|
||||
const auto doJpg = Find(opt.Format(), "jpg");
|
||||
const auto doExr16 = Find(opt.Format(), "exr");
|
||||
const auto doExr32 = Find(opt.Format(), "exr32");
|
||||
const auto doPng8 = Find(opt.Format(), "png");
|
||||
const auto doPng16 = Find(opt.Format(), "png16");
|
||||
const auto doOnlyPng8 = doPng8 && !doPng16;
|
||||
const auto doOnlyExr16 = doExr16 && !doExr32;
|
||||
std::function<void (vector<v4F>&, string, EmberImageComments, size_t, size_t, size_t)> saveFunc = [&](vector<v4F>& finalImage,
|
||||
string baseFilename,//These are copies because this will be launched in a thread.
|
||||
EmberImageComments comments,
|
||||
@ -345,14 +353,6 @@ bool EmberAnimate(int argc, _TCHAR* argv[], EmberOptions& opt)
|
||||
{
|
||||
const auto finalImagep = finalImage.data();
|
||||
const auto size = w * h;
|
||||
const auto doBmp = Find(opt.Format(), "bmp");
|
||||
const auto doJpg = Find(opt.Format(), "jpg");
|
||||
const auto doExr16 = Find(opt.Format(), "exr");
|
||||
const auto doExr32 = Find(opt.Format(), "exr32");
|
||||
const auto doPng8 = Find(opt.Format(), "png");
|
||||
const auto doPng16 = Find(opt.Format(), "png16");
|
||||
const auto doOnlyPng8 = doPng8 && !doPng16;
|
||||
const auto doOnlyExr16 = doExr16 && !doExr32;
|
||||
vector<byte> rgb8Image;
|
||||
vector<std::thread> writeFileThreads;
|
||||
writeFileThreads.reserve(6);
|
||||
@ -514,6 +514,84 @@ bool EmberAnimate(int argc, _TCHAR* argv[], EmberOptions& opt)
|
||||
while ((ftime = (atomfTime.fetch_add(opt.Dtime()) + opt.Dtime())) <= opt.LastFrame())
|
||||
{
|
||||
const auto localTime = static_cast<T>(ftime) - opt.Dtime();
|
||||
const auto baseFilename = MakeAnimFilename(inputPath, opt.Prefix(), opt.Suffix(), "", padding, size_t(localTime));
|
||||
|
||||
if (opt.IgnoreExisting())
|
||||
{
|
||||
auto doRender = false;
|
||||
|
||||
if (doBmp)
|
||||
{
|
||||
const auto fn = baseFilename + ".bmp";
|
||||
|
||||
if (!FileExists(fn))
|
||||
doRender = true;
|
||||
}
|
||||
|
||||
if (!doRender && doJpg)
|
||||
{
|
||||
const auto fn = baseFilename + ".jpg";
|
||||
|
||||
if (!FileExists(fn))
|
||||
doRender = true;
|
||||
}
|
||||
|
||||
if (!doRender && doPng8)
|
||||
{
|
||||
bool doBothPng = doPng16 && (opt.Format().find("png") != opt.Format().rfind("png"));
|
||||
|
||||
if (doBothPng || doOnlyPng8)//8-bit PNG.
|
||||
{
|
||||
const auto fn = baseFilename + ".png";
|
||||
|
||||
if (!FileExists(fn))
|
||||
doRender = true;
|
||||
}
|
||||
|
||||
if (!doRender && doPng16)//16-bit PNG.
|
||||
{
|
||||
auto fn = baseFilename;
|
||||
|
||||
if (doBothPng)//Add suffix if they specified both PNG.
|
||||
fn += "_p16";
|
||||
|
||||
fn += ".png";
|
||||
|
||||
if (!FileExists(fn))
|
||||
doRender = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doRender && doExr16)
|
||||
{
|
||||
bool doBothExr = doExr32 && (opt.Format().find("exr") != opt.Format().rfind("exr"));
|
||||
|
||||
if (doBothExr || doOnlyExr16)//16-bit EXR
|
||||
{
|
||||
const auto fn = baseFilename + ".exr";
|
||||
|
||||
if (!FileExists(fn))
|
||||
doRender = true;
|
||||
}
|
||||
|
||||
if (!doRender && doExr32)//32-bit EXR.
|
||||
{
|
||||
auto fn = baseFilename;
|
||||
|
||||
if (doBothExr)//Add suffix if they specified both EXR.
|
||||
fn += "_exr32";
|
||||
|
||||
fn += ".exr"; if (!FileExists(fn))
|
||||
doRender = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doRender)
|
||||
{
|
||||
VerbosePrint("Skipping " + baseFilename + " because --ignore-existing was specified and all of the files with the requested extensions already exist.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (opt.Verbose() && ((opt.LastFrame() - opt.FirstFrame()) / opt.Dtime() >= 1))
|
||||
{
|
||||
@ -568,7 +646,6 @@ bool EmberAnimate(int argc, _TCHAR* argv[], EmberOptions& opt)
|
||||
//when running with OpenCL. Call join() to ensure the previous thread call has completed.
|
||||
Join(writeThread);
|
||||
const auto threadVecIndex = finalImageIndex;//Cache before launching thread.
|
||||
const auto baseFilename = MakeAnimFilename(inputPath, opt.Prefix(), opt.Suffix(), "", padding, size_t(localTime));
|
||||
|
||||
if (opt.ThreadedWrite())//Copies of all but the first parameter are passed to saveFunc(), to avoid conflicting with those values changing when starting the render for the next image.
|
||||
{
|
||||
|
@ -864,7 +864,7 @@ static vector<const Variation<T>*> FindVarsWithWithout(const vector<const Variat
|
||||
/// This is useful for finding variations without certain characteristics since it's not possible
|
||||
/// to query the CPU C++ code at runtime.
|
||||
/// </summary>
|
||||
/// <param name="stringVec">The vector of variation pointers to search</param>
|
||||
/// <param name="vars">The vector of variation pointers to search</param>
|
||||
/// <param name="stringVec">The vector of strings to search for</param>
|
||||
/// <param name="findAll">True to find all variations which don't match any strings, false to break after the first non-match is found.</param>
|
||||
/// <returns>A vector of pointers to variations whose OpenCL string did not match any string in stringVec</returns>
|
||||
@ -887,6 +887,32 @@ static vector<const Variation<T>*> FindVarsWithout(const vector<const Variation<
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether a file exists, and optionally if it's not empty.
|
||||
/// </summary>
|
||||
/// <param name="filename">The full path and file name to check for</param>
|
||||
/// <param name="notempty">Whether to only return true if the file is found and is not empty. Default: true.</param>
|
||||
/// <returns>True if the file was found and optionally not empty, else false.</returns>
|
||||
static bool FileExists(const string& filename, bool notempty = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
ifstream ifs;
|
||||
ifs.exceptions(ifstream::failbit);
|
||||
ifs.open(filename, ios::binary | ios::ate);
|
||||
|
||||
if (notempty)
|
||||
return ifs.tellg() > 0;//Ensure it exists and wasn't empty.
|
||||
else
|
||||
return true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -69,6 +69,7 @@ enum class eOptionIDs : et
|
||||
OPT_LOCK_ACCUM,
|
||||
OPT_DUMP_KERNEL,
|
||||
OPT_FLAM3_COMPAT,
|
||||
OPT_IGNORE_EXISTING,
|
||||
|
||||
//Value args.
|
||||
OPT_NTHREADS,//Int value args.
|
||||
@ -376,6 +377,7 @@ public:
|
||||
INITBOOLOPTION(LockAccum, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_LOCK_ACCUM, _T("--lock_accum"), false, SO_NONE, " --lock_accum Lock threads when accumulating to the histogram using the CPU. This will drop performance to that of single threading [default: false].\n"));
|
||||
INITBOOLOPTION(DumpKernel, Eob(eOptionUse::OPT_USE_RENDER, eOptionIDs::OPT_DUMP_KERNEL, _T("--dump_kernel"), false, SO_NONE, " --dump_kernel Print the iteration kernel string when using OpenCL (ignored for CPU) [default: false].\n"));
|
||||
INITBOOLOPTION(Flam3Compat, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_FLAM3_COMPAT, _T("--flam3_compat"), false, SO_NONE, " --flam3_compat The behavior of the cos, cosh, cot, coth, csc, csch, sec, sech, sin, sinh, tan and tanh variations are different in flam3/Apophysis versus Chaotica. True for flam3/Apophysis behavior, false for Chaotica behavior [default: true].\n"));
|
||||
INITBOOLOPTION(IgnoreExisting, Eob(eOptionUse::OPT_USE_ANIMATE, eOptionIDs::OPT_IGNORE_EXISTING, _T("--ignore-existing"), false, SO_NONE, " --ignore-existing Skip animating a frame if the output images for all of the specified file output types already exist in the output folder [default: false].\n"));
|
||||
//Int.
|
||||
INITINTOPTION(Symmetry, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SYMMETRY, _T("--symmetry"), 0, SO_REQ_SEP, " --symmetry=<val> Set symmetry of result [default: 0].\n"));
|
||||
INITINTOPTION(SheepGen, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SHEEP_GEN, _T("--sheep_gen"), -1, SO_REQ_SEP, " --sheep_gen=<val> Sheep generation of this flame [default: -1].\n"));
|
||||
@ -538,6 +540,7 @@ public:
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_LOCK_ACCUM, LockAccum);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_DUMP_KERNEL, DumpKernel);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_FLAM3_COMPAT, Flam3Compat);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_IGNORE_EXISTING, IgnoreExisting);
|
||||
PARSEOPTION(eOptionIDs::OPT_SYMMETRY, Symmetry);//Int args
|
||||
PARSEOPTION(eOptionIDs::OPT_SHEEP_GEN, SheepGen);
|
||||
PARSEOPTION(eOptionIDs::OPT_SHEEP_ID, SheepId);
|
||||
@ -829,6 +832,7 @@ public:
|
||||
Eob LockAccum;
|
||||
Eob DumpKernel;
|
||||
Eob Flam3Compat;
|
||||
Eob IgnoreExisting;
|
||||
|
||||
Eoi Symmetry;//Value int.
|
||||
Eoi SheepGen;
|
||||
|
Loading…
Reference in New Issue
Block a user