Merge branch 'master' into travis

This commit is contained in:
Simon Detheridge 2015-06-26 21:24:11 +01:00
commit 4a235c7491
7 changed files with 97 additions and 7 deletions

View File

@ -1215,8 +1215,12 @@ EmberStats Renderer<T, bucketT>::Iterate(size_t iterCount, size_t temporalSample
parallel_for(size_t(0), m_ThreadsToUse, [&] (size_t threadIndex)
{
#endif
#ifdef WIN32
#if defined(WIN32)
SetThreadPriority(GetCurrentThread(), m_Priority);
#elif defined(__APPLE__)
sched_param sp = {0};
sp.sched_priority = m_Priority;
pthread_setschedparam(pthread_self(), SCHED_RR, &sp);
#else
pthread_setschedprio(pthread_self(), (int)m_Priority);
#endif

View File

@ -190,6 +190,7 @@ public slots:
//Xforms.
void OnCurrentXformComboChanged(int index);
void OnAddXformButtonClicked(bool checked);
void OnAddLinkedXformButtonClicked(bool checked);
void OnDuplicateXformButtonClicked(bool checked);
void OnClearXformButtonClicked(bool checked);
void OnDeleteXformButtonClicked(bool checked);

View File

@ -38,6 +38,7 @@
<file>Icons/infomation.png</file>
<file>Icons/del.png</file>
<file>Icons/add.png</file>
<file>Icons/link-add.png</file>
<file>Icons/eraser.png</file>
<file>Icons/editraise.png</file>
<file>Icons/square.png</file>

View File

@ -2146,15 +2146,15 @@
<widget class="QDockWidget" name="XformsDockWidget">
<property name="geometry">
<rect>
<x>300</x>
<x>280</x>
<y>0</y>
<width>240</width>
<width>267</width>
<height>881</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>240</width>
<width>267</width>
<height>613</height>
</size>
</property>
@ -2261,6 +2261,38 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="AddLinkedXformButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Add linked xform</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Fractorium.qrc">
<normaloff>:/Fractorium/Icons/link-add.png</normaloff>:/Fractorium/Icons/link-add.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="DuplicateXformButton">
<property name="sizePolicy">
@ -3252,7 +3284,7 @@ SpinBox
<rect>
<x>0</x>
<y>0</y>
<width>216</width>
<width>237</width>
<height>745</height>
</rect>
</property>
@ -4909,7 +4941,7 @@ SpinBox
<rect>
<x>0</x>
<y>0</y>
<width>216</width>
<width>237</width>
<height>680</height>
</rect>
</property>

View File

@ -62,6 +62,7 @@ public:
virtual void SetEmber(size_t index) { }
//virtual void Clear() { }
virtual void AddXform() { }
virtual void AddLinkedXform() { }
virtual void DuplicateXform() { }
virtual void ClearXform() { }
virtual void DeleteXforms() { }
@ -290,6 +291,7 @@ public:
virtual void SetEmber(size_t index) override;
//virtual void Clear() override { }
virtual void AddXform() override;
virtual void AddLinkedXform() override;
virtual void DuplicateXform() override;
virtual void ClearXform() override;
virtual void DeleteXforms() override;

View File

@ -9,6 +9,7 @@ void Fractorium::InitXformsUI()
int spinHeight = 20, row = 0;
connect(ui.AddXformButton, SIGNAL(clicked(bool)), this, SLOT(OnAddXformButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.AddLinkedXformButton, SIGNAL(clicked(bool)), this, SLOT(OnAddLinkedXformButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.DuplicateXformButton, SIGNAL(clicked(bool)), this, SLOT(OnDuplicateXformButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.ClearXformButton, SIGNAL(clicked(bool)), this, SLOT(OnClearXformButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.DeleteXformButton, SIGNAL(clicked(bool)), this, SLOT(OnDeleteXformButtonClicked(bool)), Qt::QueuedConnection);
@ -86,6 +87,7 @@ void FractoriumEmberController<T>::CurrentXformComboChanged(int index)
m_Fractorium->ui.DuplicateXformButton->setEnabled(enable);
m_Fractorium->m_XformWeightSpin->setEnabled(enable);
m_Fractorium->ui.SoloXformCheckBox->setEnabled(enable);
m_Fractorium->ui.AddLinkedXformButton->setEnabled(enable);
m_Fractorium->ui.AddFinalXformButton->setEnabled(enable);
}
}
@ -104,7 +106,6 @@ void FractoriumEmberController<T>::AddXform()
Update([&]()
{
Xform<T> newXform;
QComboBox* combo = m_Fractorium->ui.CurrentXformCombo;
newXform.m_Weight = 0.25;
newXform.m_ColorX = m_Rand.Frand01<T>();
@ -116,6 +117,55 @@ void FractoriumEmberController<T>::AddXform()
void Fractorium::OnAddXformButtonClicked(bool checked) { m_Controller->AddXform(); }
/// <summary>
/// Add a new linked xform in the current ember and set it as the current xform.
/// Linked means:
///
/// Called when the add xform button is clicked.
/// Resets the rendering process.
/// </summary>
/// <param name="checked">Ignored</param>
template <typename T>
void FractoriumEmberController<T>::AddLinkedXform()
{
UpdateXform([&](Xform<T>* xform)
{
size_t i, count = m_Ember.XformCount();
Xform<T> newXform;
newXform.m_Weight = 0.5;
newXform.m_Opacity = 1;
newXform.m_ColorSpeed = 1;
newXform.m_ColorX = xform->m_ColorX;
//newXform.m_ColorY = xform->m_ColorY;
//Set all of the new xform's xaos values to the selected xform's xaos values,
//then set the selected xform's xaos values to 0.
for (i = 0; i < count; i++)
{
newXform.SetXaos(i, xform->Xaos(i));
xform->SetXaos(i, 0);
}
//Add the new xform and update the total count.
m_Ember.AddXform(newXform);
count = m_Ember.XformCount();
//Set the xaos for all xforms pointing to the new one to zero.
for (i = 0; i < count; i++)
if (auto* xf = m_Ember.GetXform(i))
xf->SetXaos(count - 1, 0);
xform->SetXaos(count - 1, 1);//Set the xaos value for the previous xform pointing to the new one to one.
xform->m_Opacity = 0;//Clear the opacity of the previous xform.
int index = m_Ember.TotalXformCount() - (m_Ember.UseFinalXform() ? 2 : 1);//Set index to the last item before final.
FillXforms(index);
FillXaos();
}, eXformUpdate::UPDATE_CURRENT);
}
void Fractorium::OnAddLinkedXformButtonClicked(bool checked) { m_Controller->AddLinkedXform(); }
/// <summary>
/// Duplicate the specified xforms in the current ember, and set the last one as the current xform.
/// Called when the duplicate xform button is clicked.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB