mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 21:20:07 -05:00
--User changes
-Add a button to randomize both pre and post affine transforms to values between -1 to 1.
This commit is contained in:
parent
cffeceec99
commit
991275a656
@ -233,6 +233,7 @@ public slots:
|
|||||||
void OnScaleDownButtonClicked(bool checked);
|
void OnScaleDownButtonClicked(bool checked);
|
||||||
void OnScaleUpButtonClicked(bool checked);
|
void OnScaleUpButtonClicked(bool checked);
|
||||||
void OnResetAffineButtonClicked(bool checked);
|
void OnResetAffineButtonClicked(bool checked);
|
||||||
|
void OnRandomAffineButtonClicked(bool checked);
|
||||||
|
|
||||||
void OnAffineGroupBoxToggled(bool on);
|
void OnAffineGroupBoxToggled(bool on);
|
||||||
void OnAffineDrawAllCurrentRadioButtonToggled(bool checked);
|
void OnAffineDrawAllCurrentRadioButtonToggled(bool checked);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -178,6 +178,7 @@ public:
|
|||||||
virtual void MoveXforms(double x, double y, bool pre) { }
|
virtual void MoveXforms(double x, double y, bool pre) { }
|
||||||
virtual void ScaleXforms(double scale, bool pre) { }
|
virtual void ScaleXforms(double scale, bool pre) { }
|
||||||
virtual void ResetXformsAffine(bool pre) { }
|
virtual void ResetXformsAffine(bool pre) { }
|
||||||
|
virtual void RandomXformsAffine(bool pre) { }
|
||||||
virtual void FillBothAffines() { }
|
virtual void FillBothAffines() { }
|
||||||
double LockedScale() { return m_LockedScale; }
|
double LockedScale() { return m_LockedScale; }
|
||||||
void LockedScale(double scale) { m_LockedScale = scale; }
|
void LockedScale(double scale) { m_LockedScale = scale; }
|
||||||
@ -424,6 +425,7 @@ public:
|
|||||||
virtual void MoveXforms(double x, double y, bool pre) override;
|
virtual void MoveXforms(double x, double y, bool pre) override;
|
||||||
virtual void ScaleXforms(double scale, bool pre) override;
|
virtual void ScaleXforms(double scale, bool pre) override;
|
||||||
virtual void ResetXformsAffine(bool pre) override;
|
virtual void ResetXformsAffine(bool pre) override;
|
||||||
|
virtual void RandomXformsAffine(bool pre) override;
|
||||||
virtual void FillBothAffines() override;
|
virtual void FillBothAffines() override;
|
||||||
virtual void LockAffineScaleCheckBoxStateChanged(int state) override;
|
virtual void LockAffineScaleCheckBoxStateChanged(int state) override;
|
||||||
void FillAffineWithXform(Xform<T>* xform, bool pre);
|
void FillAffineWithXform(Xform<T>* xform, bool pre);
|
||||||
|
@ -75,6 +75,7 @@ void Fractorium::InitXformsAffineUI()
|
|||||||
connect(ui.PreScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PreScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PreScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PreScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PreResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PreResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
|
connect(ui.PreRandomButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostFlipHorizontalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipHorizontalButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostFlipHorizontalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipHorizontalButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostFlipVerticalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipVerticalButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostFlipVerticalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipVerticalButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostRotate90CcButton, SIGNAL(clicked(bool)), this, SLOT(OnRotate90CcButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostRotate90CcButton, SIGNAL(clicked(bool)), this, SLOT(OnRotate90CcButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
@ -88,6 +89,7 @@ void Fractorium::InitXformsAffineUI()
|
|||||||
connect(ui.PostScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostScaleDownButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleDownButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostScaleUpButton, SIGNAL(clicked(bool)), this, SLOT(OnScaleUpButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PostResetButton, SIGNAL(clicked(bool)), this, SLOT(OnResetAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
|
connect(ui.PostRandomButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomAffineButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PreAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
|
connect(ui.PreAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PostAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
|
connect(ui.PostAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.ShowPreAffineAllRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
connect(ui.ShowPreAffineAllRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
|
||||||
@ -569,12 +571,30 @@ void FractoriumEmberController<T>::ResetXformsAffine(bool pre)
|
|||||||
FillAffineWithXform(CurrentXform(), pre);
|
FillAffineWithXform(CurrentXform(), pre);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Fractorium::OnResetAffineButtonClicked(bool checked) { m_Controller->ResetXformsAffine(sender() == ui.PreResetButton); }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset pre/post affine to the identity matrix.
|
/// Randomize all values in selected pre/post affines to a range of -1 to 1.
|
||||||
/// Called when reset pre/post affine buttons are clicked.
|
/// Called when random pre/post affine buttons are clicked.
|
||||||
/// Resets the rendering process.
|
/// Resets the rendering process.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Fractorium::OnResetAffineButtonClicked(bool checked) { m_Controller->ResetXformsAffine(sender() == ui.PreResetButton); }
|
template <typename T>
|
||||||
|
void FractoriumEmberController<T>::RandomXformsAffine(bool pre)
|
||||||
|
{
|
||||||
|
UpdateXform([&](Xform<T>* xform)
|
||||||
|
{
|
||||||
|
auto affine = pre ? &xform->m_Affine : &xform->m_Post;
|
||||||
|
xform->m_Affine.A(m_Rand.Frand11<T>());
|
||||||
|
xform->m_Affine.B(m_Rand.Frand11<T>());
|
||||||
|
xform->m_Affine.C(m_Rand.Frand11<T>());
|
||||||
|
xform->m_Affine.D(m_Rand.Frand11<T>());
|
||||||
|
xform->m_Affine.E(m_Rand.Frand11<T>());
|
||||||
|
xform->m_Affine.F(m_Rand.Frand11<T>());
|
||||||
|
}, eXformUpdate::UPDATE_SELECTED);
|
||||||
|
FillAffineWithXform(CurrentXform(), pre);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fractorium::OnRandomAffineButtonClicked(bool checked) { m_Controller->RandomXformsAffine(sender() == ui.PreRandomButton); }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fill the GUI with the pre and post affine xform values.
|
/// Fill the GUI with the pre and post affine xform values.
|
||||||
|
Loading…
Reference in New Issue
Block a user