From c94c1eba66dc8d0fef279a69be193a435fa3e19c Mon Sep 17 00:00:00 2001 From: mfeemster Date: Sat, 16 Jan 2016 14:23:22 -0800 Subject: [PATCH] --Bug fixes -Long standing animation looping but that goes all the way back to flam3. -Build failure in hexes variation. --- Source/Ember/Variations01.h | 2 +- Source/Ember/Variations06.h | 2 +- Source/EmberCommon/EmberOptions.h | 2 +- Source/EmberGenome/EmberGenome.cpp | 12 +++++++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Source/Ember/Variations01.h b/Source/Ember/Variations01.h index 7621c95..f4c3053 100644 --- a/Source/Ember/Variations01.h +++ b/Source/Ember/Variations01.h @@ -4735,7 +4735,7 @@ public: else helper.Out.y = m_Weight * (helper.In.y - m_Y); - helper.Out.z = m_Weight * helper.In.z; + helper.Out.z = m_Weight * helper.In.z;//Original does *not* have this. search through all for this and sync.//TODO! } virtual string OpenCLString() const override diff --git a/Source/Ember/Variations06.h b/Source/Ember/Variations06.h index bafb4dc..5d9669d 100644 --- a/Source/Ember/Variations06.h +++ b/Source/Ember/Variations06.h @@ -239,7 +239,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Zeps", "Sqr", "Vratio", "Closest", "Vratio" }; + return vector { "Zeps", "Sqr", "Vratio", "Voronoi", "Closest" }; } virtual string OpenCLFuncsString() const override diff --git a/Source/EmberCommon/EmberOptions.h b/Source/EmberCommon/EmberOptions.h index ac2100d..6aac54d 100644 --- a/Source/EmberCommon/EmberOptions.h +++ b/Source/EmberCommon/EmberOptions.h @@ -348,7 +348,7 @@ public: INITUINTOPTION(Time, Eou(eOptionUse::OPT_ANIM_GENOME, eOptionIDs::OPT_TIME, _T("--time"), 0, SO_REQ_SEP, "\t--time= Time of first and last frame (ie do one frame).\n")); INITUINTOPTION(Frame, Eou(eOptionUse::OPT_ANIM_GENOME, eOptionIDs::OPT_FRAME, _T("--frame"), 0, SO_REQ_SEP, "\t--frame= Synonym for \"time\".\n")); INITUINTOPTION(Dtime, Eou(eOptionUse::OPT_USE_ANIMATE, eOptionIDs::OPT_DTIME, _T("--dtime"), 1, SO_REQ_SEP, "\t--dtime= Time between frames [default: 1].\n")); - INITUINTOPTION(Frames, Eou(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_NFRAMES, _T("--nframes"), 20, SO_REQ_SEP, "\t--nframes= Number of frames for each stage of the animation [default: 20].\n")); + INITUINTOPTION(Frames, Eou(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_NFRAMES, _T("--nframes"), 20, SO_REQ_SEP, "\t--nframes= Number of frames per loop and per interpolation in the animation [default: 20].\n")); INITUINTOPTION(Repeat, Eou(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_REPEAT, _T("--repeat"), 1, SO_REQ_SEP, "\t--repeat= Number of new flames to create. Ignored if sequence, inter or rotate were specified [default: 1].\n")); INITUINTOPTION(Tries, Eou(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_TRIES, _T("--tries"), 10, SO_REQ_SEP, "\t--tries= Number times to try creating a flame that meets the specified constraints. Ignored if sequence, inter or rotate were specified [default: 10].\n")); INITUINTOPTION(MaxXforms, Eou(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_MAX_XFORMS, _T("--maxxforms"), UINT_MAX, SO_REQ_SEP, "\t--maxxforms= The maximum number of xforms allowed in the final output.\n")); diff --git a/Source/EmberGenome/EmberGenome.cpp b/Source/EmberGenome/EmberGenome.cpp index abf0878..138c286 100644 --- a/Source/EmberGenome/EmberGenome.cpp +++ b/Source/EmberGenome/EmberGenome.cpp @@ -386,16 +386,26 @@ bool EmberGenome(EmberOptions& opt) { if (opt.Loops() > 0) { - for (frame = 0; frame < round(T(opt.Frames()) * opt.Loops()); frame++) + for (frame = 0; frame < std::round(opt.Frames() * opt.Loops()); frame++) { blend = T(frame) / T(opt.Frames()); tools.Spin(embers[i], pTemplate, result, frameCount++, blend);//Result is cleared and reassigned each time inside of Spin(). cout << emberToXml.ToString(result, opt.Extras(), opt.PrintEditDepth(), !opt.NoEdits(), false, opt.HexPalette()); } + + //The loop above will have rotated just shy of a complete rotation. + //Rotate the next step and save in result, but do not print. + //result will be the starting point for the interp phase below. + frame = size_t(std::round(opt.Frames() * opt.Loops())); + blend = T(frame) / T(opt.Frames()); + tools.Spin(embers[i], pTemplate, result, frameCount, blend);//Do not increment frameCount here. } if (i < embers.size() - 1) { + if (opt.Loops() > 0)//Store the last result as the flame to interpolate from. This applies for whole or fractional values of opt.Loops(). + embers[i] = result; + for (frame = 0; frame < opt.Frames(); frame++) { seqFlag = (frame == 0 || frame == opt.Frames() - 1);