--User changes

-Optimization and correction for hexaplay3D and hexnix3D.
 -Major optimization on the GPU for flames which only have one xform, by skipping all random xform selection code.
 -Changes to how xaos is "preserved" when adding new xforms, copying xforms and duplicating xforms.
 --Duplicating xforms when no xaos is present in the flame now maintains not using xaos, and keeps all values as one.
 --Duplicating xforms when xaos is present, will result in xaos rows and columns that are the same as the xforms being duplicated, with the new row and column area having values of 1.
 --Duplicating xforms when xaos is present, while Control is pressed, will result in xaos rows and columns that have values of 0, with the new row and column area having values of 1.
 ---Copying xforms has the same behavior as duplicating with Control pressed.

--Bug fixes
 -hexaplay3D, hexnix3D and post_smartcrop were wrong on the GPU because they are the rare variations which preserve state between iterations.
 -Changing the sub batch size would improperly wrong the wrong number of iterations.

--Code changes
 -Some functions in Affine2D made const.
 -Change in the index at which points and variation state are preserved between kernel calls.
 -Some arguments in some member functions of GLEmberController made const.
This commit is contained in:
Person
2020-01-25 11:12:49 -08:00
parent 207ace6c67
commit 3b261124b2
19 changed files with 531 additions and 387 deletions

View File

@ -209,6 +209,7 @@ void Fractorium::OnAddLinkedXformButtonClicked(bool checked) { m_Controller->Add
/// <summary>
/// Duplicate the specified xforms in the current ember, and set the last one as the current xform.
/// If xaos is present in the ember, the duplicated xforms will be added with xaos preserved, else they'll just be added normally.
/// The manner in which xaos is preserved is altered when ctrl is pressed.
/// Called when the duplicate xform button is clicked.
/// Resets the rendering process.
/// </summary>
@ -217,19 +218,45 @@ template <typename T>
void FractoriumEmberController<T>::DuplicateXform()
{
bool forceFinal = m_Fractorium->HaveFinal();
vector<Xform<T>> vec;
bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
vector<std::pair<Xform<T>, size_t>> vec;
vec.reserve(m_Ember.XformCount());
UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
{
vec.push_back(*xform);
vec.emplace_back(*xform, xfindex);
}, eXformUpdate::UPDATE_SELECTED_EXCEPT_FINAL, false);
Update([&]()
{
if (m_Ember.XaosPresent())
AddXformsWithXaos(m_Ember, vec, true);
{
if (!ctrl)
{
auto oldxfcount = m_Ember.XformCount();
for (auto& it : vec)
{
m_Ember.AddXform(it.first);
auto newxfcount = m_Ember.XformCount() - 1;
auto* newxform = m_Ember.GetXform(newxfcount);
for (size_t i = 0; i < oldxfcount; i++)
{
if (auto xform = m_Ember.GetXform(i))
{
newxform->SetXaos(i, it.first.Xaos(i));
xform->SetXaos(newxfcount, xform->Xaos(it.second));
}
}
}
}
else
{
AddXformsWithXaos(m_Ember, vec, true);
}
}
else
for (auto& it : vec)
m_Ember.AddXform(it);
m_Ember.AddXform(it.first);
int index = int(m_Ember.TotalXformCount(forceFinal) - (forceFinal ? 2 : 1));//Set index to the last item before final.
FillXforms(index);//Handles xaos.