diff --git a/Source/Ember/Ember.h b/Source/Ember/Ember.h index 6e3e3ee..da0726e 100644 --- a/Source/Ember/Ember.h +++ b/Source/Ember/Ember.h @@ -879,8 +879,8 @@ public: if (tempParVar != nullptr && (parVar->ParamCount() == tempParVar->ParamCount()))//This check will should always be true, but just check to be absolutely sure to avoid clobbering memory. { - ParamWithName* params = parVar->Params(); - ParamWithName* tempParams = tempParVar->Params(); + auto params = parVar->Params(); + auto tempParams = tempParVar->Params(); for (l = 0; l < parVar->ParamCount(); l++) { diff --git a/Source/Ember/EmberToXml.h b/Source/Ember/EmberToXml.h index 1b68219..9d6cbf1 100644 --- a/Source/Ember/EmberToXml.h +++ b/Source/Ember/EmberToXml.h @@ -529,7 +529,7 @@ private: if (parVar) { - ParamWithName* params = parVar->Params(); + auto params = parVar->Params(); for (j = 0; j < parVar->ParamCount(); j++) { diff --git a/Source/Ember/Interpolate.h b/Source/Ember/Interpolate.h index ca728e0..23b16d2 100644 --- a/Source/Ember/Interpolate.h +++ b/Source/Ember/Interpolate.h @@ -547,18 +547,18 @@ public: if (second != nullptr && first.size() == c.size()) { second->Clear(); - ParamWithName* secondParams = second->Params(); + auto secondParams = second->Params(); //Iterate through each of the source variations. for (size_t i = 0; i < first.size(); i++) { - ParametricVariation* firstVar = first[i]; + auto firstVar = first[i]; //Make sure the source variation at this index is the same type as the variation being written to. if (firstVar->VariationId() == second->VariationId()) { size_t size = firstVar->ParamCount(); - ParamWithName* firstParams = firstVar->Params(); + auto firstParams = firstVar->Params(); //Multiply each parameter of the variation at this index by the coefficient at this index, and add //the result to the corresponding parameter in second. diff --git a/Source/Ember/Renderer.cpp b/Source/Ember/Renderer.cpp index a8de9d9..4b1a12e 100644 --- a/Source/Ember/Renderer.cpp +++ b/Source/Ember/Renderer.cpp @@ -607,7 +607,9 @@ FilterAndAccum: AccumOnly: if (m_ProcessState == FILTER_DONE || forceOutput) { - if (m_Callback && !m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, 0, 2, 0))//Original only allowed stages 0 and 1. Add 2 to mean final accum. + //Original only allowed stages 0 and 1. Add 2 to mean final accum. + //Do not update state/progress on forced output because it will be immediately overwritten. + if (m_Callback && !forceOutput && !m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, 0, 2, 0)) { Abort(); success = RENDER_ABORT; diff --git a/Source/Ember/Variation.h b/Source/Ember/Variation.h index d146e89..500b02d 100644 --- a/Source/Ember/Variation.h +++ b/Source/Ember/Variation.h @@ -1232,7 +1232,7 @@ public: /// Abstract copy function. Derived classes must implement. /// /// A copy of this object - virtual Variation* Copy() = 0; + virtual Variation* Copy() const = 0; /// /// Create a new Variation, store it in the pointer reference passed in and @@ -1695,7 +1695,7 @@ public: /// /// The name to search for /// A pointer to the parameter value if the name matched, else false. - T* GetParam(const char* name) + T* GetParam(const char* name) const { for (auto& param : m_Params) if (!_stricmp(param.Name().c_str(), name)) @@ -1825,8 +1825,8 @@ public: /// /// Accessors. /// - ParamWithName* Params() { return &m_Params[0]; } - size_t ParamCount() { return m_Params.size(); } + const ParamWithName* Params() const { return &m_Params[0]; } + size_t ParamCount() const { return m_Params.size(); } const vector>& ParamsVec() const { return m_Params; } protected: @@ -1898,7 +1898,7 @@ protected: { \ } \ \ - virtual Variation* Copy() override \ + virtual Variation* Copy() const override \ { \ return new name(*this); \ } \ @@ -1925,7 +1925,7 @@ protected: { \ } \ \ - virtual Variation* Copy() override \ + virtual Variation* Copy() const override \ { \ return new name(*this); \ } \ @@ -2011,7 +2011,7 @@ protected: CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \ } \ \ - virtual Variation* Copy() override \ + virtual Variation* Copy() const override \ { \ return new name(*this); \ } \ @@ -2042,7 +2042,7 @@ protected: CopyParamVals(var.ParamsVec()); /* Copy values from var's vector and precalc. */ \ } \ \ - virtual Variation* Copy() override \ + virtual Variation* Copy() const override \ { \ return new name(*this); \ } \ diff --git a/Source/Ember/VariationList.h b/Source/Ember/VariationList.h index 31c4a34..9e53a53 100644 --- a/Source/Ember/VariationList.h +++ b/Source/Ember/VariationList.h @@ -375,7 +375,7 @@ public: /// /// The index in the list to retrieve /// A pointer to the variation at the index if in range, else nullptr. - Variation* GetVariation(size_t index) { return index < m_Variations.size() ? m_Variations[index] : nullptr; } + const Variation* GetVariation(size_t index) const { return index < m_Variations.size() ? m_Variations[index] : nullptr; } /// /// Get a pointer to the variation of a specified type at the specified index. @@ -383,7 +383,7 @@ public: /// The index in the list to retrieve /// The type of variation to retrieve /// A pointer to the variation of the specified type at the index if in range, else nullptr. - Variation* GetVariation(size_t index, eVariationType varType) + const Variation* GetVariation(size_t index, eVariationType varType) const { if (varType == VARTYPE_REG) return index < m_RegVariations.size() ? m_RegVariations[index] : nullptr; @@ -402,15 +402,15 @@ public: /// The index in the list to make a copy of /// The weight to assign the new copy. Default: 1 /// A pointer to the variation at the index if in range, else nullptr. - Variation* GetVariationCopy(size_t index, T weight = 1) { return MakeCopyWithWeight(GetVariation(index), weight); } - Variation* GetVariationCopy(size_t index, eVariationType varType, T weight = 1) { return MakeCopyWithWeight(GetVariation(index, varType), weight); } + Variation* GetVariationCopy(size_t index, T weight = 1) const { return MakeCopyWithWeight(GetVariation(index), weight); } + Variation* GetVariationCopy(size_t index, eVariationType varType, T weight = 1) const { return MakeCopyWithWeight(GetVariation(index, varType), weight); } /// /// Get a pointer to the variation with the specified ID. /// /// The ID to search for /// A pointer to the variation if found, else nullptr. - Variation* GetVariation(eVariationId id) + const Variation* GetVariation(eVariationId id) const { for (uint i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++) if (id == m_Variations[i]->VariationId()) @@ -426,14 +426,14 @@ public: /// The id of the variation in the list to make a copy of /// The weight to assign the new copy. Default: 1 /// A pointer to the variation with a matching ID, else nullptr. - Variation* GetVariationCopy(eVariationId id, T weight = 1) { return MakeCopyWithWeight(GetVariation(id), weight); } + Variation* GetVariationCopy(eVariationId id, T weight = 1) const { return MakeCopyWithWeight(GetVariation(id), weight); } /// /// Get a pointer to the variation with the specified name. /// /// The name to search for /// A pointer to the variation if found, else nullptr. - Variation* GetVariation(const string& name) + const Variation* GetVariation(const string& name) const { for (uint i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++) if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str())) @@ -449,7 +449,7 @@ public: /// The name of the variation in the list to make a copy of /// The weight to assign the new copy. Default: 1 /// A pointer to the variation with a matching name, else nullptr. - Variation* GetVariationCopy(const string& name, T weight = 1) { return MakeCopyWithWeight(GetVariation(name), weight); } + Variation* GetVariationCopy(const string& name, T weight = 1) const { return MakeCopyWithWeight(GetVariation(name), weight); } /// /// Get a parametric variation at the specified index. @@ -457,14 +457,14 @@ public: /// /// The index in the parametric variations list to retrieve /// The parametric variation at the index specified if in range, else nullptr. - ParametricVariation* GetParametricVariation(size_t index) { return index < m_ParametricVariations.size() ? m_ParametricVariations[index] : nullptr; } + const ParametricVariation* GetParametricVariation(size_t index) const { return index < m_ParametricVariations.size() ? m_ParametricVariations[index] : nullptr; } /// /// Get a parametric variation with the specified name. /// /// The name of the variation in the parametric variations list to retrieve /// The parametric variation with a matching name, else nullptr. - ParametricVariation* GetParametricVariation(const string& name) + const ParametricVariation* GetParametricVariation(const string& name) const { for (uint i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != nullptr; i++) if (!_stricmp(name.c_str(), m_ParametricVariations[i]->Name().c_str())) @@ -490,11 +490,11 @@ public: /// /// Accessors. /// - size_t Size() { return m_Variations.size(); } - size_t RegSize() { return m_RegVariations.size(); } - size_t PreSize() { return m_PreVariations.size(); } - size_t PostSize() { return m_PostVariations.size(); } - size_t ParametricSize() { return m_ParametricVariations.size(); } + size_t Size() const { return m_Variations.size(); } + size_t RegSize() const { return m_RegVariations.size(); } + size_t PreSize() const { return m_PreVariations.size(); } + size_t PostSize() const { return m_PostVariations.size(); } + size_t ParametricSize() const { return m_ParametricVariations.size(); } private: /// @@ -504,7 +504,7 @@ private: /// The variation to copy /// The weight to assign it /// A pointer to the new variation copy if success, else nullptr. - Variation* MakeCopyWithWeight(Variation* var, T weight) + Variation* MakeCopyWithWeight(const Variation* var, T weight) const { if (var) { diff --git a/Source/Ember/Xform.h b/Source/Ember/Xform.h index e676a34..08f0c96 100644 --- a/Source/Ember/Xform.h +++ b/Source/Ember/Xform.h @@ -766,9 +766,9 @@ public: //Now apply the motion func to the params if needed. if (motParVar != nullptr) { - ParametricVariation* parVar = dynamic_cast*>(var); - ParamWithName* params = parVar->Params(); - ParamWithName* motParams = motParVar->Params(); + auto parVar = dynamic_cast*>(var); + auto params = parVar->Params(); + auto motParams = motParVar->Params(); for (size_t k = 0; k < motParVar->ParamCount(); k++) { diff --git a/Source/Ember/XmlToEmber.h b/Source/Ember/XmlToEmber.h index 078389d..07ea62f 100644 --- a/Source/Ember/XmlToEmber.h +++ b/Source/Ember/XmlToEmber.h @@ -1154,9 +1154,9 @@ private: //Only correct names if it came from an outside source. Names originating from this library are always considered correct. string s = fromEmber ? string(CCX(curAtt->name)) : GetCorrectedVariationName(m_BadVariationNames, curAtt); - if (Variation* var = m_VariationList.GetVariation(s)) + if (auto var = m_VariationList.GetVariation(s)) { - Variation* varCopy = var->Copy(); + auto varCopy = var->Copy(); Atof(attStr, varCopy->m_Weight); xform.AddVariation(varCopy); diff --git a/Source/EmberCL/RendererCL.cpp b/Source/EmberCL/RendererCL.cpp index 03c7b62..1fb8a3f 100644 --- a/Source/EmberCL/RendererCL.cpp +++ b/Source/EmberCL/RendererCL.cpp @@ -945,7 +945,7 @@ eRenderStatus RendererCL::RunLogScaleFilter() m_ErrorReport.push_back(loc); } - if (b && m_Callback) + if (b && m_Callback && m_LastIterPercent >= 99.0)//Only update progress if we've really reached the end, not via forced output. m_Callback->ProgressFunc(m_Ember, m_ProgressParameter, 100.0, 1, 0.0); return b ? RENDER_OK : RENDER_ERROR; diff --git a/Source/EmberTester/EmberTester.cpp b/Source/EmberTester/EmberTester.cpp index f386f0f..aea0b84 100644 --- a/Source/EmberTester/EmberTester.cpp +++ b/Source/EmberTester/EmberTester.cpp @@ -397,7 +397,7 @@ bool TestVarCounts() for (; start < (uint)LAST_VAR; start++) { - Variation* var = vlf.GetVariation((eVariationId)start); + auto var = vlf.GetVariation((eVariationId)start); if (!var) { @@ -603,7 +603,7 @@ bool TestVarPrePostNames() for (size_t i = 0; i < vlf.Size(); i++) { - Variation* var = vlf.GetVariation(i); + auto var = vlf.GetVariation(i); string name = var->Name(); if (var->VarType() == VARTYPE_REG) @@ -643,7 +643,7 @@ bool TestVarPrePostNames() break; } - if (ParametricVariation* parVar = dynamic_cast*>(var)) + if (auto parVar = dynamic_cast*>(const_cast*>(var))) { vector> params = parVar->ParamsVec(); @@ -699,7 +699,7 @@ bool TestParVars() for (size_t i = 0; i < vlf.ParametricSize(); i++) { - if (ParametricVariation* parVar = vlf.GetParametricVariation(i)) + if (auto parVar = vlf.GetParametricVariation(i)) { if (parVar->ParamCount() < 1) { @@ -709,7 +709,7 @@ bool TestParVars() vector names; vector addresses; - ParamWithName* params = parVar->Params(); + auto params = parVar->Params(); names.reserve(parVar->ParamCount()); addresses.reserve(parVar->ParamCount()); @@ -754,7 +754,7 @@ bool TestVarRegPrePost() for (size_t i = 0; i < vlf.RegSize(); i++) { - Variation* regVar = vlf.GetVariation(i, VARTYPE_REG); + auto regVar = vlf.GetVariation(i, VARTYPE_REG); if (regVar) { @@ -762,8 +762,8 @@ bool TestVarRegPrePost() { string name = regVar->Name(); - Variation* preVar = vlf.GetVariation("pre_" + name); - Variation* postVar = vlf.GetVariation("post_" + name); + auto preVar = vlf.GetVariation("pre_" + name); + auto postVar = vlf.GetVariation("post_" + name); if (!preVar) { diff --git a/Source/Fractorium/DoubleSpinBox.h b/Source/Fractorium/DoubleSpinBox.h index f0cb880..305bf00 100644 --- a/Source/Fractorium/DoubleSpinBox.h +++ b/Source/Fractorium/DoubleSpinBox.h @@ -58,13 +58,12 @@ private: /// VariationTreeWidgetItem and VariationTreeDoubleSpinBox need each other, but each can't include the other. /// So VariationTreeWidgetItem includes this file, and use a forward declaration here. /// -template class VariationTreeWidgetItem; +class VariationTreeWidgetItem; /// /// Derivation for the double spin boxes that are in the /// variations tree. /// -template class VariationTreeDoubleSpinBox : public DoubleSpinBox { public: @@ -73,27 +72,27 @@ public: /// /// The parent widget /// The widget item this spinner is contained in - /// The variation this spinner is for + /// The variation this spinner is for /// The name of the parameter this is for /// The height of the spin box. Default: 16. /// The step used to increment/decrement the spin box when using the mouse wheel. Default: 0.05. - explicit VariationTreeDoubleSpinBox(QWidget* p, VariationTreeWidgetItem* widgetItem, Variation* var, string param, int h = 16, double step = 0.05) + explicit VariationTreeDoubleSpinBox(QWidget* p, VariationTreeWidgetItem* widgetItem, eVariationId id, string param, int h = 16, double step = 0.05) : DoubleSpinBox(p, h, step) { m_WidgetItem = widgetItem; m_Param = param; - m_Variation = var; + m_Id = id; setDecimals(3); } virtual ~VariationTreeDoubleSpinBox() { } bool IsParam() { return !m_Param.empty(); } string ParamName() { return m_Param; } - Variation* GetVariation() { return m_Variation; } - VariationTreeWidgetItem* WidgetItem() { return m_WidgetItem; } + eVariationId GetVariationId() { return m_Id; } + VariationTreeWidgetItem* WidgetItem() { return m_WidgetItem; } private: string m_Param; - Variation* m_Variation; - VariationTreeWidgetItem* m_WidgetItem; + eVariationId m_Id; + VariationTreeWidgetItem* m_WidgetItem; }; diff --git a/Source/Fractorium/Fractorium.cpp b/Source/Fractorium/Fractorium.cpp index c4eb5ad..b2d3b42 100644 --- a/Source/Fractorium/Fractorium.cpp +++ b/Source/Fractorium/Fractorium.cpp @@ -114,6 +114,8 @@ Fractorium::Fractorium(QWidget* p) #endif m_Controller = unique_ptr(new FractoriumEmberController(this)); + m_Controller->SetupVariationTree(); + if (m_Wrapper.CheckOpenCL() && m_Settings->OpenCL() && m_QualitySpin->value() < 30) m_QualitySpin->setValue(30); diff --git a/Source/Fractorium/FractoriumEmberController.cpp b/Source/Fractorium/FractoriumEmberController.cpp index 8185357..70a4dbe 100644 --- a/Source/Fractorium/FractoriumEmberController.cpp +++ b/Source/Fractorium/FractoriumEmberController.cpp @@ -75,7 +75,6 @@ FractoriumEmberController::FractoriumEmberController(Fractorium* fractorium) m_SheepTools = unique_ptr>(new SheepTools("flam3-palettes.xml", new EmberNs::Renderer())); m_GLController = unique_ptr>(new GLEmberController(fractorium, fractorium->ui.GLDisplay, this)); m_PreviewRenderer = unique_ptr>(new EmberNs::Renderer()); - SetupVariationTree(); //Initial combo change event to fill the palette table will be called automatically later. if (!InitPaletteList("./")) diff --git a/Source/Fractorium/FractoriumRender.cpp b/Source/Fractorium/FractoriumRender.cpp index ea2cba6..5e25da7 100644 --- a/Source/Fractorium/FractoriumRender.cpp +++ b/Source/Fractorium/FractoriumRender.cpp @@ -369,7 +369,7 @@ bool FractoriumEmberController::Render() if (ProcessState() != ACCUM_DONE) { //if (m_Renderer->Run(m_FinalImage, 0) == RENDER_OK)//Full, non-incremental render for debugging. - if (m_Renderer->Run(m_FinalImage[m_FinalImageIndex], 0, m_SubBatchCount, iterBegin) == RENDER_OK)//Force output on iterBegin. + if (m_Renderer->Run(m_FinalImage[m_FinalImageIndex], 0, m_SubBatchCount, (iterBegin || m_Fractorium->m_Settings->ContinuousUpdate())) == RENDER_OK)//Force output on iterBegin or if the settings specify to always do it. { //The amount to increment sub batch while rendering proceeds is purely empirical. //Change later if better values can be derived/observed. diff --git a/Source/Fractorium/FractoriumSettings.cpp b/Source/Fractorium/FractoriumSettings.cpp index 9219431..2770861 100644 --- a/Source/Fractorium/FractoriumSettings.cpp +++ b/Source/Fractorium/FractoriumSettings.cpp @@ -119,6 +119,9 @@ void FractoriumSettings::Double(bool b) { setValue(DOUBLEPRECISION, b); bool FractoriumSettings::ShowAllXforms() { return value(SHOWALLXFORMS).toBool(); } void FractoriumSettings::ShowAllXforms(bool b) { setValue(SHOWALLXFORMS, b); } +bool FractoriumSettings::ContinuousUpdate() { return value(CONTUPDATE).toBool(); } +void FractoriumSettings::ContinuousUpdate(bool b) { setValue(CONTUPDATE, b); } + uint FractoriumSettings::PlatformIndex() { return value(PLATFORMINDEX).toUInt(); } void FractoriumSettings::PlatformIndex(uint i) { setValue(PLATFORMINDEX, i); } diff --git a/Source/Fractorium/FractoriumSettings.h b/Source/Fractorium/FractoriumSettings.h index 39500c5..35ec9cc 100644 --- a/Source/Fractorium/FractoriumSettings.h +++ b/Source/Fractorium/FractoriumSettings.h @@ -11,6 +11,7 @@ #define TRANSPARENCY "render/transparency" #define OPENCL "render/opencl" #define DOUBLEPRECISION "render/dp64" +#define CONTUPDATE "render/continuousupdate" #define SHOWALLXFORMS "render/dragshowallxforms" #define PLATFORMINDEX "render/platformindex" #define DEVICEINDEX "render/deviceindex" @@ -89,6 +90,9 @@ public: bool ShowAllXforms(); void ShowAllXforms(bool b); + bool ContinuousUpdate(); + void ContinuousUpdate(bool b); + uint PlatformIndex(); void PlatformIndex(uint b); diff --git a/Source/Fractorium/FractoriumXformsVariations.cpp b/Source/Fractorium/FractoriumXformsVariations.cpp index c36c270..85b7b09 100644 --- a/Source/Fractorium/FractoriumXformsVariations.cpp +++ b/Source/Fractorium/FractoriumXformsVariations.cpp @@ -6,7 +6,7 @@ /// void Fractorium::InitXformsVariationsUI() { - QTreeWidget* tree = ui.VariationsTree; + auto tree = ui.VariationsTree; tree->clear(); tree->header()->setSectionsClickable(true); @@ -32,19 +32,19 @@ void FractoriumEmberController::SetupVariationTree() T fMax = TMAX; QSize hint0(75, 16); QSize hint1(30, 16); - QTreeWidget* tree = m_Fractorium->ui.VariationsTree; + auto tree = m_Fractorium->ui.VariationsTree; tree->clear(); tree->blockSignals(true); for (size_t i = 0; i < m_VariationList.Size(); i++) { - Variation* var = m_VariationList.GetVariation(i); - ParametricVariation* parVar = dynamic_cast*>(var); + auto var = m_VariationList.GetVariation(i); + auto parVar = dynamic_cast*>(var); //First add the variation, with a spinner for its weight. - VariationTreeWidgetItem* item = new VariationTreeWidgetItem(var->VariationId(), tree); - VariationTreeDoubleSpinBox* spinBox = new VariationTreeDoubleSpinBox(tree, item, parVar ? parVar : var, ""); + auto item = new VariationTreeWidgetItem(var->VariationId(), tree); + auto spinBox = new VariationTreeDoubleSpinBox(tree, item, var->VariationId(), ""); item->setText(0, QString::fromStdString(var->Name())); item->setSizeHint(0, hint0); @@ -61,14 +61,14 @@ void FractoriumEmberController::SetupVariationTree() //Check to see if the variation was parametric, and add a tree entry with a spinner for each parameter. if (parVar) { - ParamWithName* params = parVar->Params(); + auto params = parVar->Params(); for (size_t j = 0; j < parVar->ParamCount(); j++) { if (!params[j].IsPrecalc()) { - VariationTreeWidgetItem* paramWidget = new VariationTreeWidgetItem(var->VariationId(), item); - VariationTreeDoubleSpinBox* varSpinBox = new VariationTreeDoubleSpinBox(tree, paramWidget, parVar, params[j].Name()); + auto paramWidget = new VariationTreeWidgetItem(var->VariationId(), item); + auto varSpinBox = new VariationTreeDoubleSpinBox(tree, paramWidget, parVar->VariationId(), params[j].Name()); paramWidget->setText(0, params[j].Name().c_str()); paramWidget->setSizeHint(0, hint0); @@ -108,13 +108,13 @@ void FractoriumEmberController::ClearVariationsTree() for (uint i = 0; i < tree->topLevelItemCount(); i++) { QTreeWidgetItem* item = tree->topLevelItem(i); - VariationTreeDoubleSpinBox* spinBox = dynamic_cast*>(tree->itemWidget(item, 1)); + auto* spinBox = dynamic_cast(tree->itemWidget(item, 1)); spinBox->SetValueStealth(0); for (uint j = 0; j < item->childCount(); j++)//Iterate through all of the children, which will be the params. { - if ((spinBox = dynamic_cast*>(tree->itemWidget(item->child(j), 1))))//Cast the child widget to the VariationTreeDoubleSpinBox type. + if ((spinBox = dynamic_cast(tree->itemWidget(item->child(j), 1))))//Cast the child widget to the VariationTreeDoubleSpinBox type. spinBox->SetValueStealth(0); } } @@ -130,17 +130,17 @@ void FractoriumEmberController::ClearVariationsTree() template void FractoriumEmberController::VariationSpinBoxValueChanged(double d)//Would be awesome to make this work for all.//TODO { - QObject* objSender = m_Fractorium->sender(); - QTreeWidget* tree = m_Fractorium->ui.VariationsTree; - VariationTreeDoubleSpinBox* sender = dynamic_cast*>(objSender); - Xform* xform = m_Ember.GetTotalXform(m_Fractorium->ui.CurrentXformCombo->currentIndex());//Will retrieve normal xform or final if needed. + auto objSender = m_Fractorium->sender(); + auto tree = m_Fractorium->ui.VariationsTree; + auto sender = dynamic_cast(objSender); + auto xform = m_Ember.GetTotalXform(m_Fractorium->ui.CurrentXformCombo->currentIndex());//Will retrieve normal xform or final if needed. if (sender && xform) { - Variation* var = sender->GetVariation();//The variation attached to the sender, for reference only. - ParametricVariation* parVar = dynamic_cast*>(var);//The parametric cast of that variation. - Variation* xformVar = xform->GetVariationById(var->VariationId());//The corresponding variation in the currently selected xform. - VariationTreeWidgetItem* widgetItem = sender->WidgetItem(); + auto var = m_VariationList.GetVariation(sender->GetVariationId());//The variation attached to the sender, for reference only. + auto parVar = dynamic_cast*>(var);//The parametric cast of that variation. + auto xformVar = xform->GetVariationById(var->VariationId());//The corresponding variation in the currently selected xform. + auto widgetItem = sender->WidgetItem(); bool isParam = parVar && sender->IsParam(); if (isParam) @@ -175,7 +175,7 @@ void FractoriumEmberController::VariationSpinBoxValueChanged(double d)//Would { //If the item wasn't a param and the xform did not contain this variation, //it means they went from zero to a non-zero weight, so add a new copy of this xform. - Variation* newVar = var->Copy();//Create a new one with default values. + auto newVar = var->Copy();//Create a new one with default values. newVar->m_Weight = d; xform->AddVariation(newVar); @@ -185,14 +185,14 @@ void FractoriumEmberController::VariationSpinBoxValueChanged(double d)//Would //for the child parameters and assign them to the newly added variation. if (parVar) { - ParametricVariation* newParVar = dynamic_cast*>(newVar); + auto newParVar = dynamic_cast*>(newVar); for (int i = 0; i < widgetItem->childCount(); i++)//Iterate through all of the children, which will be the params. { - QTreeWidgetItem* childItem = widgetItem->child(i);//Get the child. - QWidget* itemWidget = tree->itemWidget(childItem, 1);//Get the widget for the child. + auto childItem = widgetItem->child(i);//Get the child. + auto itemWidget = tree->itemWidget(childItem, 1);//Get the widget for the child. - if (VariationTreeDoubleSpinBox* spinBox = dynamic_cast*>(itemWidget))//Cast the widget to the VariationTreeDoubleSpinBox type. + if (auto spinBox = dynamic_cast(itemWidget))//Cast the widget to the VariationTreeDoubleSpinBox type. { string s = childItem->text(0).toStdString();//Use the name of the child, and the value of the spinner widget to assign the param. @@ -218,18 +218,18 @@ void Fractorium::OnVariationSpinBoxValueChanged(double d) { m_Controller->Variat template void FractoriumEmberController::FillVariationTreeWithXform(Xform* xform) { - QTreeWidget* tree = m_Fractorium->ui.VariationsTree; + auto tree = m_Fractorium->ui.VariationsTree; tree->blockSignals(true); for (uint i = 0; i < tree->topLevelItemCount(); i++) { - VariationTreeWidgetItem* item = dynamic_cast*>(tree->topLevelItem(i)); - Variation* var = xform->GetVariationById(item->Id());//See if this variation in the tree was contained in the xform. - ParametricVariation* parVar = dynamic_cast*>(var);//Attempt cast to parametric variation for later. - ParametricVariation* origParVar = dynamic_cast*>(m_VariationList.GetVariation(item->Id())); + auto item = dynamic_cast(tree->topLevelItem(i)); + auto var = xform->GetVariationById(item->Id());//See if this variation in the tree was contained in the xform. + auto parVar = dynamic_cast*>(var);//Attempt cast to parametric variation for later. + auto origParVar = dynamic_cast*>(m_VariationList.GetVariation(item->Id())); - if (VariationTreeDoubleSpinBox* spinBox = dynamic_cast*>(tree->itemWidget(item, 1)))//Get the widget for the item, and cast the widget to the VariationTreeDoubleSpinBox type. + if (auto spinBox = dynamic_cast(tree->itemWidget(item, 1)))//Get the widget for the item, and cast the widget to the VariationTreeDoubleSpinBox type. { spinBox->SetValueStealth(var ? var->m_Weight : 0);//If the variation was present, set the spin box to its weight, else zero. item->setBackgroundColor(0, var ? QColor(200, 200, 200) : QColor(255, 255, 255));//Ensure background is always white if the value goes to zero, else gray if var present. @@ -237,10 +237,10 @@ void FractoriumEmberController::FillVariationTreeWithXform(Xform* xform) for (uint j = 0; j < item->childCount(); j++)//Iterate through all of the children, which will be the params if it was a parametric variation. { T* param = nullptr; - QTreeWidgetItem* childItem = item->child(j);//Get the child. - QWidget* childItemWidget = tree->itemWidget(childItem, 1);//Get the widget for the child. + auto childItem = item->child(j);//Get the child. + auto childItemWidget = tree->itemWidget(childItem, 1);//Get the widget for the child. - if (VariationTreeDoubleSpinBox* childSpinBox = dynamic_cast*>(childItemWidget))//Cast the widget to the VariationTreeDoubleSpinBox type. + if (auto childSpinBox = dynamic_cast(childItemWidget))//Cast the widget to the VariationTreeDoubleSpinBox type. { string s = childItem->text(0).toStdString();//Get the name of the child. diff --git a/Source/Fractorium/OptionsDialog.cpp b/Source/Fractorium/OptionsDialog.cpp index 90f8953..6a67406 100644 --- a/Source/Fractorium/OptionsDialog.cpp +++ b/Source/Fractorium/OptionsDialog.cpp @@ -65,12 +65,13 @@ FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, Q ui.OpenCLCheckBox->setEnabled(false); } - ui.EarlyClipCheckBox->setChecked( m_Settings->EarlyClip()); - ui.YAxisUpCheckBox->setChecked( m_Settings->YAxisUp()); - ui.TransparencyCheckBox->setChecked( m_Settings->Transparency()); - ui.DoublePrecisionCheckBox->setChecked(m_Settings->Double()); - ui.ShowAllXformsCheckBox->setChecked( m_Settings->ShowAllXforms()); - ui.ThreadCountSpin->setValue( m_Settings->ThreadCount()); + ui.EarlyClipCheckBox->setChecked( m_Settings->EarlyClip()); + ui.YAxisUpCheckBox->setChecked( m_Settings->YAxisUp()); + ui.TransparencyCheckBox->setChecked( m_Settings->Transparency()); + ui.ContinuousUpdateCheckBox->setChecked(m_Settings->ContinuousUpdate()); + ui.DoublePrecisionCheckBox->setChecked( m_Settings->Double()); + ui.ShowAllXformsCheckBox->setChecked( m_Settings->ShowAllXforms()); + ui.ThreadCountSpin->setValue( m_Settings->ThreadCount()); if (m_Settings->CpuDEFilter()) ui.CpuFilteringDERadioButton->setChecked(true); @@ -100,6 +101,7 @@ FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, Q bool FractoriumOptionsDialog::EarlyClip() { return ui.EarlyClipCheckBox->isChecked(); } bool FractoriumOptionsDialog::YAxisUp() { return ui.YAxisUpCheckBox->isChecked(); } bool FractoriumOptionsDialog::Transparency() { return ui.TransparencyCheckBox->isChecked(); } +bool FractoriumOptionsDialog::ContinuousUpdate() { return ui.ContinuousUpdateCheckBox->isChecked(); } bool FractoriumOptionsDialog::OpenCL() { return ui.OpenCLCheckBox->isChecked(); } bool FractoriumOptionsDialog::Double() { return ui.DoublePrecisionCheckBox->isChecked(); } bool FractoriumOptionsDialog::ShowAllXforms() { return ui.ShowAllXformsCheckBox->isChecked(); } @@ -152,6 +154,7 @@ void FractoriumOptionsDialog::accept() m_Settings->EarlyClip(EarlyClip()); m_Settings->YAxisUp(YAxisUp()); m_Settings->Transparency(Transparency()); + m_Settings->ContinuousUpdate(ContinuousUpdate()); m_Settings->OpenCL(OpenCL()); m_Settings->Double(Double()); m_Settings->ShowAllXforms(ShowAllXforms()); @@ -187,6 +190,7 @@ void FractoriumOptionsDialog::reject() ui.EarlyClipCheckBox->setChecked(m_Settings->EarlyClip()); ui.YAxisUpCheckBox->setChecked(m_Settings->YAxisUp()); ui.TransparencyCheckBox->setChecked(m_Settings->Transparency()); + ui.ContinuousUpdateCheckBox->setChecked(m_Settings->ContinuousUpdate()); ui.OpenCLCheckBox->setChecked(m_Settings->OpenCL()); ui.DoublePrecisionCheckBox->setChecked(m_Settings->Double()); ui.ShowAllXformsCheckBox->setChecked(m_Settings->ShowAllXforms()); diff --git a/Source/Fractorium/OptionsDialog.h b/Source/Fractorium/OptionsDialog.h index 81d3269..6385fd7 100644 --- a/Source/Fractorium/OptionsDialog.h +++ b/Source/Fractorium/OptionsDialog.h @@ -37,6 +37,7 @@ private: bool YAxisUp(); bool AlphaChannel(); bool Transparency(); + bool ContinuousUpdate(); bool OpenCL(); bool Double(); bool ShowAllXforms(); diff --git a/Source/Fractorium/OptionsDialog.ui b/Source/Fractorium/OptionsDialog.ui index 1a8fdb3..9c1a92a 100644 --- a/Source/Fractorium/OptionsDialog.ui +++ b/Source/Fractorium/OptionsDialog.ui @@ -113,13 +113,13 @@ - + - + - + <html><head/><body><p>The number of threads to use with CPU rendering.</p><p>Decrease for more responsive editing, increase for better performance.</p></body></html> @@ -135,7 +135,7 @@ - + CPU Filtering @@ -182,7 +182,7 @@ - + OpenCL Filtering @@ -226,7 +226,7 @@ - + The number of 10,000 iteration chunks ran per thread on the CPU @@ -243,7 +243,7 @@ in interactive mode for each mouse movement - + The number of ~8M iteration chunks ran using OpenCL @@ -300,6 +300,16 @@ in interactive mode for each mouse movement + + + + <html><head/><body><p>Continually update output image during interactive rendering.</p><p>This will slow down performance, but will give continuous updates on how the final render will look. Note that only log scale filtering is applied on each update. Full DE is not applied until iteration is complete.</p></body></html> + + + Continuous Update + + + @@ -716,11 +726,12 @@ in interactive mode for each mouse movement EarlyClipCheckBox - YAxisUpCheckBox - TransparencyCheckBox OpenCLCheckBox + YAxisUpCheckBox DoublePrecisionCheckBox + TransparencyCheckBox ShowAllXformsCheckBox + ContinuousUpdateCheckBox PlatformCombo DeviceCombo ThreadCountSpin @@ -730,9 +741,7 @@ in interactive mode for each mouse movement CpuFilteringDERadioButton OpenCLFilteringLogRadioButton OpenCLFilteringDERadioButton - OptionsXmlSavingTable - OptionsIdentityTable - OptionsButtonBox + AutoUniqueCheckBox diff --git a/Source/Fractorium/VariationTreeWidgetItem.h b/Source/Fractorium/VariationTreeWidgetItem.h index 370eb3f..2ac3b88 100644 --- a/Source/Fractorium/VariationTreeWidgetItem.h +++ b/Source/Fractorium/VariationTreeWidgetItem.h @@ -13,7 +13,6 @@ /// by index or by weight. It supports weights less than, equal to, or /// greater than zero. /// -template class VariationTreeWidgetItem : public QTreeWidgetItem { public: @@ -56,24 +55,24 @@ private: int column = treeWidget()->sortColumn(); eVariationId index1, index2; double weight1 = 0, weight2 = 0; - VariationTreeWidgetItem* varItemWidget; - VariationTreeDoubleSpinBox* spinBox1, *spinBox2; + VariationTreeWidgetItem* varItemWidget; + VariationTreeDoubleSpinBox* spinBox1, *spinBox2; - QWidget* itemWidget1 = treeWidget()->itemWidget(const_cast*>(this), 1);//Get the widget for the second column. + auto itemWidget1 = treeWidget()->itemWidget(const_cast(this), 1);//Get the widget for the second column. - if ((spinBox1 = dynamic_cast*>(itemWidget1)))//Cast the widget to the VariationTreeDoubleSpinBox type. + if ((spinBox1 = dynamic_cast(itemWidget1)))//Cast the widget to the VariationTreeDoubleSpinBox type. { - QWidget* itemWidget2 = treeWidget()->itemWidget(const_cast(&other), 1);//Get the widget for the second column of the widget item passed in. + auto itemWidget2 = treeWidget()->itemWidget(const_cast(&other), 1);//Get the widget for the second column of the widget item passed in. - if ((spinBox2 = dynamic_cast*>(itemWidget2)))//Cast the widget to the VariationTreeDoubleSpinBox type. + if ((spinBox2 = dynamic_cast(itemWidget2)))//Cast the widget to the VariationTreeDoubleSpinBox type. { if (spinBox1->IsParam() || spinBox2->IsParam())//Do not sort params, their order will always remain the same. return false; weight1 = spinBox1->value(); weight2 = spinBox2->value(); - index1 = spinBox1->GetVariation()->VariationId(); - index2 = spinBox2->GetVariation()->VariationId(); + index1 = spinBox1->GetVariationId(); + index2 = spinBox2->GetVariationId(); if (column == 0)//First column clicked, sort by variation index. {