2015-04-27 01:11:56 -04:00
# include "FractoriumPch.h"
# include "Fractorium.h"
/// <summary>
/// Initialize the xforms selection UI.
/// </summary>
void Fractorium : : InitXformsSelectUI ( )
{
m_XformsSelectionLayout = ( QFormLayout * ) ui . XformsSelectGroupBoxScrollAreaWidget - > layout ( ) ;
connect ( ui . XformsSelectAllButton , SIGNAL ( clicked ( bool ) ) , this , SLOT ( OnXformsSelectAllButtonClicked ( bool ) ) , Qt : : QueuedConnection ) ;
connect ( ui . XformsSelectNoneButton , SIGNAL ( clicked ( bool ) ) , this , SLOT ( OnXformsSelectNoneButtonClicked ( bool ) ) , Qt : : QueuedConnection ) ;
ClearXformsSelections ( ) ;
}
/// <summary>
/// Check all of the xform selection checkboxes.
/// </summary>
/// <param name="checked">Ignored</param>
2017-07-27 00:25:44 -04:00
void Fractorium : : OnXformsSelectAllButtonClicked ( bool checked ) { ForEachXformCheckbox ( [ & ] ( int i , QCheckBox * w , bool isFinal ) { w - > setChecked ( true ) ; } ) ; }
2015-04-27 01:11:56 -04:00
/// <summary>
/// Uncheck all of the xform selection checkboxes.
/// </summary>
/// <param name="checked">Ignored</param>
2017-07-27 00:25:44 -04:00
void Fractorium : : OnXformsSelectNoneButtonClicked ( bool checked ) { ForEachXformCheckbox ( [ & ] ( int i , QCheckBox * w , bool isFinal ) { w - > setChecked ( false ) ; } ) ; }
2015-04-27 01:11:56 -04:00
2016-02-20 21:44:52 -05:00
/// <summary>
/// Return whether the checkbox at the specified index is checked.
/// </summary>
2016-02-21 21:53:36 -05:00
/// <param name="i">The index of the xform to check for selection</param>
2016-02-20 21:44:52 -05:00
/// <param name="checked">True if checked, else false.</param>
bool Fractorium : : IsXformSelected ( size_t i )
{
2016-12-05 22:04:33 -05:00
if ( i < m_XformSelections . size ( ) )
if ( auto w = m_XformSelections [ i ] )
2016-02-20 21:44:52 -05:00
return w - > isChecked ( ) ;
return false ;
}
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
/// <summary>
/// Return the number of xforms selected, optionally counting the final xform.
/// </summary>
/// <param name="includeFinal">Whether to include the final in the count if selected.</param>
/// <returns>The caption string</returns>
int Fractorium : : SelectedXformCount ( bool includeFinal )
{
int selCount = 0 ;
ForEachXformCheckbox ( [ & ] ( int index , QCheckBox * cb , bool isFinal )
{
if ( cb - > isChecked ( ) )
{
if ( ! isFinal | | includeFinal )
selCount + + ;
}
} ) ;
return selCount ;
}
2015-04-27 01:11:56 -04:00
/// <summary>
/// Clear all of the dynamically created xform checkboxes.
/// </summary>
void Fractorium : : ClearXformsSelections ( )
{
QLayoutItem * child = nullptr ;
m_XformSelections . clear ( ) ;
m_XformsSelectionLayout - > blockSignals ( true ) ;
while ( m_XformsSelectionLayout - > count ( ) & & ( child = m_XformsSelectionLayout - > takeAt ( 0 ) ) )
{
2016-02-20 21:44:52 -05:00
auto w = child - > widget ( ) ;
2015-04-27 01:11:56 -04:00
delete child ;
delete w ;
}
m_XformsSelectionLayout - > blockSignals ( false ) ;
}
/// <summary>
/// Make a caption from an xform.
/// The caption will be the xform count + 1, optionally followed by the xform's name.
/// For final xforms, the string "Final" will be used in place of the count.
/// </summary>
2016-02-21 21:53:36 -05:00
/// <param name="i">The index of the xform to make a caption for</param>
2015-04-27 01:11:56 -04:00
/// <returns>The caption string</returns>
template < typename T >
QString FractoriumEmberController < T > : : MakeXformCaption ( size_t i )
{
2017-07-27 00:25:44 -04:00
bool forceFinal = m_Fractorium - > HaveFinal ( ) ;
bool isFinal = m_Ember . FinalXform ( ) = = m_Ember . GetTotalXform ( i , forceFinal ) ;
2015-04-27 01:11:56 -04:00
QString caption = isFinal ? " Final " : QString : : number ( i + 1 ) ;
2017-07-27 00:25:44 -04:00
if ( auto xform = m_Ember . GetTotalXform ( i , forceFinal ) )
2015-04-27 01:11:56 -04:00
if ( ! xform - > m_Name . empty ( ) )
caption + = " ( " + QString : : fromStdString ( xform - > m_Name ) + " ) " ;
return caption ;
}
/// <summary>
/// Function to perform the specified operation on every dynamically created xform selection checkbox.
/// </summary>
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD.
-Allow for a spatial filter of radius zero, which means do not use a spatial filter.
-Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur.
-Use a new method for computing elliptic which is more precise. Developed by Discord user Claude.
-Remove the 8 variation per xform limitation on the GPU.
-Allow for loading the last flame file on startup, rather than randoms.
-Use two different default quality values in the interactive renderer, one each for CPU and GPU.
-Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once.
--Bug fixes
-No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes.
-Prevent crashing the program when adjusting a value on the main window while a final render is in progress.
-The xaos table was inverted.
--Code changes
-Convert projects to Visual Studio 2017.
-Change bad vals from +- 1e10 to +-1e20.
-Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed.
-Compiler will not let us use default values in templated member functions anymore.
2017-11-26 20:27:00 -05:00
/// <param name="func">The operation to perform which is a function taking the index of the xform, its checkbox, and a bool specifying whether it's final.</param>
2017-07-27 00:25:44 -04:00
void Fractorium : : ForEachXformCheckbox ( std : : function < void ( int , QCheckBox * , bool ) > func )
2015-04-27 01:11:56 -04:00
{
int i = 0 ;
2017-07-27 00:25:44 -04:00
bool haveFinal = HaveFinal ( ) ;
2015-04-27 01:11:56 -04:00
2016-12-05 22:04:33 -05:00
for ( auto & cb : m_XformSelections )
2017-07-27 00:25:44 -04:00
func ( i + + , cb , haveFinal & & cb = = m_XformSelections . back ( ) ) ;
2015-04-27 01:11:56 -04:00
}
/// <summary>
/// Function to perform the specified operation on one dynamically created xform selection checkbox.
/// </summary>
/// <param name="i">The index of the checkbox</param>
/// <param name="func">The operation to perform</param>
/// <returns>True if the checkbox was found, else false.</returns>
template < typename T >
bool FractoriumEmberController < T > : : XformCheckboxAt ( int i , std : : function < void ( QCheckBox * ) > func )
{
2016-12-05 22:04:33 -05:00
if ( i < m_Fractorium - > m_XformSelections . size ( ) )
2015-04-27 01:11:56 -04:00
{
2016-12-05 22:04:33 -05:00
if ( auto w = m_Fractorium - > m_XformSelections [ i ] )
2015-04-27 01:11:56 -04:00
{
func ( w ) ;
return true ;
}
}
return false ;
}
/// <summary>
/// Function to perform the specified operation on one dynamically created xform selection checkbox.
/// The checkbox is specified by the xform it corresponds to, rather than its index.
/// </summary>
/// <param name="xform">The xform that corresponds to the checkbox</param>
/// <param name="func">The operation to perform</param>
/// <returns>True if the checkbox was found, else false.</returns>
template < typename T >
bool FractoriumEmberController < T > : : XformCheckboxAt ( Xform < T > * xform , std : : function < void ( QCheckBox * ) > func )
{
2017-07-27 00:25:44 -04:00
bool forceFinal = m_Fractorium - > HaveFinal ( ) ;
return XformCheckboxAt ( m_Ember . GetTotalXformIndex ( xform , forceFinal ) , func ) ;
2015-04-27 01:11:56 -04:00
}
template class FractoriumEmberController < float > ;
# ifdef DO_DOUBLE
2017-05-31 22:50:05 -04:00
template class FractoriumEmberController < double > ;
2015-04-27 01:11:56 -04:00
# endif