2014-07-08 03:11:14 -04:00
# pragma once
# include "EmberFile.h"
# include "DoubleSpinBox.h"
# include "GLEmberController.h"
/// <summary>
/// FractoriumEmberControllerBase and FractoriumEmberController<T> classes.
/// </summary>
/// <summary>
/// An enum representing the type of edit being done.
/// </summary>
2014-12-06 00:05:09 -05:00
enum eEditUndoState : uint { REGULAR_EDIT = 0 , UNDO_REDO = 1 , EDIT_UNDO = 2 } ;
2014-07-08 03:11:14 -04:00
/// <summary>
/// FractoriumEmberController and Fractorium need each other, but each can't include the other.
/// So Fractorium includes this file, and Fractorium is declared as a forward declaration here.
/// </summary>
class Fractorium ;
# define PREVIEW_SIZE 256
# define UNDO_SIZE 128
/// <summary>
/// FractoriumEmberControllerBase serves as a non-templated base class with virtual
/// functions which will be overridden in a derived class that takes a template parameter.
/// The controller serves as a way to access both the Fractorium GUI and the underlying ember
/// objects through an interface that doesn't require template argument, but does allow
/// templated objects to be used underneath.
/// Note that there are a few functions which access a templated object, so for those both
/// versions for float and double must be provided, then overridden in the templated derived
/// class. It's definitely a design flaw, but C++ doesn't offer any alternative since
/// templated virtual functions are not supported.
/// The functions not implemented in this file can be found in the GUI files which use them.
/// </summary>
class FractoriumEmberControllerBase : public RenderCallback
{
public :
FractoriumEmberControllerBase ( Fractorium * fractorium ) ;
virtual ~ FractoriumEmberControllerBase ( ) ;
//Embers.
virtual void SetEmber ( const Ember < float > & ember , bool verbatim = false ) { }
2015-01-19 11:39:50 -05:00
virtual void CopyEmber ( Ember < float > & ember , std : : function < void ( Ember < float > & ember ) > perEmberOperation /* = [&](Ember<float>& ember) { } */ ) { } //Uncomment default lambdas once LLVM fixes a crash in their compiler with default lambda parameters.//TODO
2014-07-08 03:11:14 -04:00
virtual void SetEmberFile ( const EmberFile < float > & emberFile ) { }
2015-01-14 08:15:23 -05:00
virtual void CopyEmberFile ( EmberFile < float > & emberFile , std : : function < void ( Ember < float > & ember ) > perEmberOperation /* = [&](Ember<float>& ember) { } */ ) { }
2014-07-08 03:11:14 -04:00
virtual void SetTempPalette ( const Palette < float > & palette ) { }
virtual void CopyTempPalette ( Palette < float > & palette ) { }
# ifdef DO_DOUBLE
virtual void SetEmber ( const Ember < double > & ember , bool verbatim = false ) { }
2015-01-14 08:15:23 -05:00
virtual void CopyEmber ( Ember < double > & ember , std : : function < void ( Ember < double > & ember ) > perEmberOperation /* = [&](Ember<double>& ember) { } */ ) { }
2014-07-08 03:11:14 -04:00
virtual void SetEmberFile ( const EmberFile < double > & emberFile ) { }
2015-01-14 08:15:23 -05:00
virtual void CopyEmberFile ( EmberFile < double > & emberFile , std : : function < void ( Ember < double > & ember ) > perEmberOperation /* = [&](Ember<double>& ember) { } */ ) { }
2014-07-08 03:11:14 -04:00
virtual void SetTempPalette ( const Palette < double > & palette ) { }
virtual void CopyTempPalette ( Palette < double > & palette ) { }
# endif
virtual void SetEmber ( size_t index ) { }
virtual void Clear ( ) { }
virtual void AddXform ( ) { }
virtual void DuplicateXform ( ) { }
virtual void ClearCurrentXform ( ) { }
virtual void DeleteCurrentXform ( ) { }
virtual void AddFinalXform ( ) { }
virtual bool UseFinalXform ( ) { return false ; }
2014-10-14 11:53:15 -04:00
virtual size_t XformCount ( ) const { return 0 ; }
virtual size_t TotalXformCount ( ) const { return 0 ; }
virtual QString Name ( ) const { return " " ; }
virtual void Name ( const string & s ) { }
2014-12-06 00:05:09 -05:00
virtual uint FinalRasW ( ) const { return 0 ; }
virtual void FinalRasW ( uint w ) { }
virtual uint FinalRasH ( ) const { return 0 ; }
virtual void FinalRasH ( uint h ) { }
2014-10-14 11:53:15 -04:00
virtual size_t Index ( ) const { return 0 ; }
2014-07-08 03:11:14 -04:00
virtual void AddSymmetry ( int sym , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) { }
virtual void CalcNormalizedWeights ( ) { }
//Menu.
2014-12-06 00:05:09 -05:00
virtual void NewFlock ( uint count ) { } //File.
2014-07-08 03:11:14 -04:00
virtual void NewEmptyFlameInCurrentFile ( ) { }
virtual void NewRandomFlameInCurrentFile ( ) { }
virtual void CopyFlameInCurrentFile ( ) { }
2014-10-14 11:53:15 -04:00
virtual void OpenAndPrepFiles ( const QStringList & filenames , bool append ) { }
2014-07-08 03:11:14 -04:00
virtual void SaveCurrentAsXml ( ) { }
virtual void SaveEntireFileAsXml ( ) { }
virtual void SaveCurrentToOpenedFile ( ) { }
virtual void Undo ( ) { } //Edit.
virtual void Redo ( ) { }
virtual void CopyXml ( ) { }
virtual void CopyAllXml ( ) { }
virtual void PasteXmlAppend ( ) { }
virtual void PasteXmlOver ( ) { }
virtual void AddReflectiveSymmetry ( ) { } //Tools.
virtual void AddRotationalSymmetry ( ) { }
virtual void AddBothSymmetry ( ) { }
Numerous fixes
0.4.0.5 Beta 07/18/2014
--User Changes
Allow for vibrancy values > 1.
Add flatten and unflatten menu items.
Automatically flatten like Apophysis does.
Add plugin and new_linear tags to Xml to be compatible with Apophysis.
--Bug Fixes
Fix blur, blur3d, bubble, cropn, cross, curl, curl3d, epispiral, ho,
julia3d, julia3dz, loonie, mirror_x, mirror_y, mirror_z, rotate_x,
sinusoidal, spherical, spherical3d, stripes.
Unique filename on final render was completely broken.
Two severe OpenCL bugs. Random seeds were biased and fusing was being
reset too often leading to results that differ from the CPU.
Subtle, but sometimes severe bug in the setup of the xaos weights.
Use properly defined epsilon by getting the value from
std::numeric_limits, rather than hard coding 1e-6 or 1e-10.
Omit incorrect usage of epsilon everywhere. It should not be
automatically added to denominators. Rather, it should only be used if
the denominator is zero.
Force final render progress bars to 100 on completion. Sometimes they
didn't seem to make it there.
Make variation name and params comparisons be case insensitive.
--Code Changes
Make ForEach and FindIf wrappers around std::for_each and std::find_if.
2014-07-19 02:33:18 -04:00
virtual void Flatten ( ) { }
virtual void Unflatten ( ) { }
2014-07-08 03:11:14 -04:00
virtual void ClearFlame ( ) { }
//Toolbar.
//Params.
virtual void SetCenter ( double x , double y ) { }
virtual void FillParamTablesAndPalette ( ) { }
virtual void BrightnessChanged ( double d ) { }
virtual void GammaChanged ( double d ) { }
virtual void GammaThresholdChanged ( double d ) { }
virtual void VibrancyChanged ( double d ) { }
virtual void HighlightPowerChanged ( double d ) { }
2014-12-06 00:05:09 -05:00
virtual void PaletteModeChanged ( uint i ) { }
virtual void WidthChanged ( uint i ) { }
virtual void HeightChanged ( uint i ) { }
2014-07-08 03:11:14 -04:00
virtual void CenterXChanged ( double d ) { }
virtual void CenterYChanged ( double d ) { }
virtual void ScaleChanged ( double d ) { }
virtual void ZoomChanged ( double d ) { }
virtual void RotateChanged ( double d ) { }
virtual void ZPosChanged ( double d ) { }
virtual void PerspectiveChanged ( double d ) { }
virtual void PitchChanged ( double d ) { }
virtual void YawChanged ( double d ) { }
virtual void DepthBlurChanged ( double d ) { }
virtual void SpatialFilterWidthChanged ( double d ) { }
virtual void SpatialFilterTypeChanged ( const QString & text ) { }
virtual void TemporalFilterWidthChanged ( double d ) { }
virtual void TemporalFilterTypeChanged ( const QString & text ) { }
virtual void DEFilterMinRadiusWidthChanged ( double d ) { }
virtual void DEFilterMaxRadiusWidthChanged ( double d ) { }
virtual void DEFilterCurveWidthChanged ( double d ) { }
2014-11-28 04:37:51 -05:00
virtual void SbsChanged ( int d ) { }
virtual void FuseChanged ( int d ) { }
2014-07-08 03:11:14 -04:00
virtual void QualityChanged ( double d ) { }
virtual void SupersampleChanged ( int d ) { }
2014-11-28 04:37:51 -05:00
virtual void TemporalSamplesChanged ( int d ) { }
2014-07-08 03:11:14 -04:00
virtual void AffineInterpTypeChanged ( int i ) { }
virtual void InterpTypeChanged ( int i ) { }
virtual void BackgroundChanged ( const QColor & color ) { }
//Xforms.
virtual void CurrentXformComboChanged ( int index ) { }
virtual void XformWeightChanged ( double d ) { }
virtual void EqualizeWeights ( ) { }
virtual void XformNameChanged ( int row , int col ) { }
//Xforms Affine.
virtual void AffineSetHelper ( double d , int index , bool pre ) { }
virtual void FlipCurrentXform ( bool horizontal , bool vertical , bool pre ) { }
virtual void RotateCurrentXformByAngle ( double angle , bool pre ) { }
virtual void MoveCurrentXform ( double x , double y , bool pre ) { }
virtual void ScaleCurrentXform ( double scale , bool pre ) { }
virtual void ResetCurrentXformAffine ( bool pre ) { }
//Xforms Color.
virtual void XformColorIndexChanged ( double d , bool updateRender ) { }
virtual void XformScrollColorIndexChanged ( int d ) { }
virtual void XformColorSpeedChanged ( double d ) { }
virtual void XformOpacityChanged ( double d ) { }
virtual void XformDirectColorChanged ( double d ) { }
void SetPaletteRefTable ( QPixmap * pixmap ) ;
//Xforms Variations.
virtual void SetupVariationTree ( ) { }
virtual void ClearVariationsTree ( ) { }
virtual void VariationSpinBoxValueChanged ( double d ) { }
//Xforms Xaos.
virtual void FillXaosWithCurrentXform ( ) { }
2014-12-06 00:05:09 -05:00
virtual QString MakeXaosNameString ( uint i ) { return " " ; }
2014-07-08 03:11:14 -04:00
virtual void XaosChanged ( DoubleSpinBox * sender ) { }
virtual void ClearXaos ( ) { }
2014-10-15 23:09:44 -04:00
virtual void RandomXaos ( ) { }
2014-07-08 03:11:14 -04:00
//Palette.
2014-10-14 11:53:15 -04:00
virtual bool InitPaletteTable ( const string & s ) { return false ; }
2014-07-08 03:11:14 -04:00
virtual void ApplyPaletteToEmber ( ) { }
virtual void PaletteAdjust ( ) { }
2014-12-06 00:05:09 -05:00
virtual QRgb GetQRgbFromPaletteIndex ( uint i ) { return QRgb ( ) ; }
2014-07-08 03:11:14 -04:00
virtual void PaletteCellClicked ( int row , int col ) { }
//Library.
virtual void SyncNames ( ) { }
virtual void FillLibraryTree ( int selectIndex = - 1 ) { }
virtual void UpdateLibraryTree ( ) { }
virtual void EmberTreeItemChanged ( QTreeWidgetItem * item , int col ) { }
virtual void EmberTreeItemDoubleClicked ( QTreeWidgetItem * item , int col ) { }
2014-12-06 00:05:09 -05:00
virtual void RenderPreviews ( uint start = UINT_MAX , uint end = UINT_MAX ) { }
2014-07-08 03:11:14 -04:00
virtual void StopPreviewRender ( ) { }
//Info.
//Rendering/progress.
virtual bool Render ( ) { return false ; }
2014-12-06 00:05:09 -05:00
virtual bool CreateRenderer ( eRendererType renderType , uint platform , uint device , bool shared = true ) { return false ; }
virtual uint SizeOfT ( ) const { return 0 ; }
2014-07-08 03:11:14 -04:00
virtual void ClearUndo ( ) { }
2015-01-02 18:11:36 -05:00
virtual GLEmberControllerBase * GLController ( ) { return nullptr ; }
2014-07-08 03:11:14 -04:00
bool RenderTimerRunning ( ) ;
void StartRenderTimer ( ) ;
void DelayedStartRenderTimer ( ) ;
void StopRenderTimer ( bool wait ) ;
void Shutdown ( ) ;
void UpdateRender ( eProcessAction action = FULL_RENDER ) ;
void DeleteRenderer ( ) ;
2014-10-14 11:53:15 -04:00
void SaveCurrentRender ( const QString & filename , bool forcePull ) ;
2014-07-08 03:11:14 -04:00
RendererBase * Renderer ( ) { return m_Renderer . get ( ) ; }
2015-01-19 11:39:50 -05:00
vector < byte > * FinalImage ( ) { return & ( m_FinalImage [ m_FinalImageIndex ] ) ; }
2014-12-06 00:05:09 -05:00
vector < byte > * PreviewFinalImage ( ) { return & m_PreviewFinalImage ; }
2014-07-08 03:11:14 -04:00
protected :
//Rendering/progress.
void AddProcessAction ( eProcessAction action ) ;
eProcessAction CondenseAndClearProcessActions ( ) ;
eProcessState ProcessState ( ) { return m_Renderer . get ( ) ? m_Renderer - > ProcessState ( ) : NONE ; }
//Non-templated members.
bool m_Rendering ;
bool m_Shared ;
bool m_LastEditWasUndoRedo ;
2015-01-19 11:39:50 -05:00
uint m_FinalImageIndex ;
2014-12-06 00:05:09 -05:00
uint m_Platform ;
uint m_Device ;
uint m_SubBatchCount ;
uint m_FailedRenders ;
uint m_UndoIndex ;
2014-07-08 03:11:14 -04:00
eRendererType m_RenderType ;
eEditUndoState m_EditState ;
GLuint m_OutputTexID ;
Timing m_RenderElapsedTimer ;
2014-10-14 11:53:15 -04:00
EmberStats m_Stats ;
2014-07-08 03:11:14 -04:00
QImage m_FinalPaletteImage ;
QString m_LastSaveAll ;
QString m_LastSaveCurrent ;
CriticalSection m_Cs ;
2015-01-19 11:39:50 -05:00
std : : thread m_WriteThread ;
vector < byte > m_FinalImage [ 2 ] ;
2014-12-06 00:05:09 -05:00
vector < byte > m_PreviewFinalImage ;
2014-07-08 03:11:14 -04:00
vector < eProcessAction > m_ProcessActions ;
2014-10-18 17:07:07 -04:00
unique_ptr < EmberNs : : RendererBase > m_Renderer ;
2014-07-08 03:11:14 -04:00
QTIsaac < ISAAC_SIZE , ISAAC_INT > m_Rand ;
Fractorium * m_Fractorium ;
QTimer * m_RenderTimer ;
QTimer * m_RenderRestartTimer ;
} ;
/// <summary>
/// Templated derived class which implements all interaction functionality between the embers
/// of a specific template type and the GUI.
/// Switching between template arguments requires complete re-creation of the controller and the
/// underlying renderer. Switching between CPU and OpenCL only requires re-creation of the renderer.
/// </summary>
template < typename T >
class FractoriumEmberController : public FractoriumEmberControllerBase
{
public :
FractoriumEmberController ( Fractorium * fractorium ) ;
virtual ~ FractoriumEmberController ( ) ;
//Embers.
2014-10-14 11:53:15 -04:00
virtual void SetEmber ( const Ember < float > & ember , bool verbatim = false ) override ;
2015-01-14 08:15:23 -05:00
virtual void CopyEmber ( Ember < float > & ember , std : : function < void ( Ember < float > & ember ) > perEmberOperation /* = [&](Ember<float>& ember) { } */ ) override ;
2014-10-14 11:53:15 -04:00
virtual void SetEmberFile ( const EmberFile < float > & emberFile ) override ;
2015-01-14 08:15:23 -05:00
virtual void CopyEmberFile ( EmberFile < float > & emberFile , std : : function < void ( Ember < float > & ember ) > perEmberOperation /* = [&](Ember<float>& ember) { } */ ) override ;
2014-10-14 11:53:15 -04:00
virtual void SetTempPalette ( const Palette < float > & palette ) override ;
virtual void CopyTempPalette ( Palette < float > & palette ) override ;
2014-07-08 03:11:14 -04:00
# ifdef DO_DOUBLE
2014-10-14 11:53:15 -04:00
virtual void SetEmber ( const Ember < double > & ember , bool verbatim = false ) override ;
2015-01-14 08:15:23 -05:00
virtual void CopyEmber ( Ember < double > & ember , std : : function < void ( Ember < double > & ember ) > perEmberOperation /* = [&](Ember<double>& ember) { } */ ) override ;
2014-10-14 11:53:15 -04:00
virtual void SetEmberFile ( const EmberFile < double > & emberFile ) override ;
2015-01-14 08:15:23 -05:00
virtual void CopyEmberFile ( EmberFile < double > & emberFile , std : : function < void ( Ember < double > & ember ) > perEmberOperation /* = [&](Ember<double>& ember) { } */ ) override ;
2014-10-14 11:53:15 -04:00
virtual void SetTempPalette ( const Palette < double > & palette ) override ;
virtual void CopyTempPalette ( Palette < double > & palette ) override ;
2014-07-08 03:11:14 -04:00
# endif
2014-10-14 11:53:15 -04:00
virtual void SetEmber ( size_t index ) override ;
virtual void Clear ( ) override { }
virtual void AddXform ( ) override ;
virtual void DuplicateXform ( ) override ;
virtual void ClearCurrentXform ( ) override ;
virtual void DeleteCurrentXform ( ) override ;
virtual void AddFinalXform ( ) override ;
virtual bool UseFinalXform ( ) override { return m_Ember . UseFinalXform ( ) ; }
2014-12-06 00:05:09 -05:00
//virtual bool IsFinal(uint i) { return false; }
2014-10-14 11:53:15 -04:00
virtual size_t XformCount ( ) const override { return m_Ember . XformCount ( ) ; }
virtual size_t TotalXformCount ( ) const override { return m_Ember . TotalXformCount ( ) ; }
virtual QString Name ( ) const override { return QString : : fromStdString ( m_Ember . m_Name ) ; }
virtual void Name ( const string & s ) override { m_Ember . m_Name = s ; }
2014-12-06 00:05:09 -05:00
virtual uint FinalRasW ( ) const override { return m_Ember . m_FinalRasW ; }
virtual void FinalRasW ( uint w ) override { m_Ember . m_FinalRasW = w ; }
virtual uint FinalRasH ( ) const override { return m_Ember . m_FinalRasH ; }
virtual void FinalRasH ( uint h ) override { m_Ember . m_FinalRasH = h ; }
2014-10-14 11:53:15 -04:00
virtual size_t Index ( ) const override { return m_Ember . m_Index ; }
virtual void AddSymmetry ( int sym , QTIsaac < ISAAC_SIZE , ISAAC_INT > & rand ) override { m_Ember . AddSymmetry ( sym , rand ) ; }
virtual void CalcNormalizedWeights ( ) override { m_Ember . CalcNormalizedWeights ( m_NormalizedWeights ) ; }
void ConstrainDimensions ( Ember < T > & ember ) ;
2014-07-08 03:11:14 -04:00
Ember < T > * CurrentEmber ( ) ;
//Menu.
2014-12-06 00:05:09 -05:00
virtual void NewFlock ( uint count ) override ;
2014-10-14 11:53:15 -04:00
virtual void NewEmptyFlameInCurrentFile ( ) override ;
virtual void NewRandomFlameInCurrentFile ( ) override ;
virtual void CopyFlameInCurrentFile ( ) override ;
virtual void OpenAndPrepFiles ( const QStringList & filenames , bool append ) override ;
virtual void SaveCurrentAsXml ( ) override ;
virtual void SaveEntireFileAsXml ( ) override ;
virtual void SaveCurrentToOpenedFile ( ) override ;
virtual void Undo ( ) override ;
virtual void Redo ( ) override ;
virtual void CopyXml ( ) override ;
virtual void CopyAllXml ( ) override ;
virtual void PasteXmlAppend ( ) override ;
virtual void PasteXmlOver ( ) override ;
virtual void AddReflectiveSymmetry ( ) override ;
virtual void AddRotationalSymmetry ( ) override ;
virtual void AddBothSymmetry ( ) override ;
virtual void Flatten ( ) override ;
virtual void Unflatten ( ) override ;
virtual void ClearFlame ( ) override ;
2014-07-08 03:11:14 -04:00
//Toolbar.
//Params.
2014-10-14 11:53:15 -04:00
virtual void SetCenter ( double x , double y ) override ;
virtual void FillParamTablesAndPalette ( ) override ;
virtual void BrightnessChanged ( double d ) override ;
virtual void GammaChanged ( double d ) override ;
virtual void GammaThresholdChanged ( double d ) override ;
virtual void VibrancyChanged ( double d ) override ;
virtual void HighlightPowerChanged ( double d ) override ;
2014-12-06 00:05:09 -05:00
virtual void PaletteModeChanged ( uint i ) override ;
virtual void WidthChanged ( uint i ) override ;
virtual void HeightChanged ( uint i ) override ;
2014-10-14 11:53:15 -04:00
virtual void CenterXChanged ( double d ) override ;
virtual void CenterYChanged ( double d ) override ;
virtual void ScaleChanged ( double d ) override ;
virtual void ZoomChanged ( double d ) override ;
virtual void RotateChanged ( double d ) override ;
virtual void ZPosChanged ( double d ) override ;
virtual void PerspectiveChanged ( double d ) override ;
virtual void PitchChanged ( double d ) override ;
virtual void YawChanged ( double d ) override ;
virtual void DepthBlurChanged ( double d ) override ;
virtual void SpatialFilterWidthChanged ( double d ) override ;
virtual void SpatialFilterTypeChanged ( const QString & text ) override ;
virtual void TemporalFilterWidthChanged ( double d ) override ;
virtual void TemporalFilterTypeChanged ( const QString & text ) override ;
virtual void DEFilterMinRadiusWidthChanged ( double d ) override ;
virtual void DEFilterMaxRadiusWidthChanged ( double d ) override ;
virtual void DEFilterCurveWidthChanged ( double d ) override ;
2014-11-28 04:37:51 -05:00
virtual void SbsChanged ( int d ) override ;
virtual void FuseChanged ( int d ) override ;
2014-10-14 11:53:15 -04:00
virtual void QualityChanged ( double d ) override ;
virtual void SupersampleChanged ( int d ) override ;
2014-11-28 04:37:51 -05:00
virtual void TemporalSamplesChanged ( int d ) override ;
2014-10-14 11:53:15 -04:00
virtual void AffineInterpTypeChanged ( int index ) override ;
virtual void InterpTypeChanged ( int index ) override ;
virtual void BackgroundChanged ( const QColor & col ) override ;
2014-07-08 03:11:14 -04:00
//Xforms.
2014-10-14 11:53:15 -04:00
virtual void CurrentXformComboChanged ( int index ) override ;
virtual void XformWeightChanged ( double d ) override ;
virtual void EqualizeWeights ( ) override ;
virtual void XformNameChanged ( int row , int col ) override ;
2014-07-08 03:11:14 -04:00
void FillWithXform ( Xform < T > * xform ) ;
Xform < T > * CurrentXform ( ) ;
//Xforms Affine.
2014-10-14 11:53:15 -04:00
virtual void AffineSetHelper ( double d , int index , bool pre ) override ;
virtual void FlipCurrentXform ( bool horizontal , bool vertical , bool pre ) override ;
virtual void RotateCurrentXformByAngle ( double angle , bool pre ) override ;
virtual void MoveCurrentXform ( double x , double y , bool pre ) override ;
virtual void ScaleCurrentXform ( double scale , bool pre ) override ;
virtual void ResetCurrentXformAffine ( bool pre ) override ;
2014-07-08 03:11:14 -04:00
void FillAffineWithXform ( Xform < T > * xform , bool pre ) ;
//Xforms Color.
2014-10-14 11:53:15 -04:00
virtual void XformColorIndexChanged ( double d , bool updateRender ) override ;
virtual void XformScrollColorIndexChanged ( int d ) override ;
virtual void XformColorSpeedChanged ( double d ) override ;
virtual void XformOpacityChanged ( double d ) override ;
virtual void XformDirectColorChanged ( double d ) override ;
2014-07-08 03:11:14 -04:00
void FillColorWithXform ( Xform < T > * xform ) ;
//Xforms Variations.
2014-10-14 11:53:15 -04:00
virtual void SetupVariationTree ( ) override ;
virtual void ClearVariationsTree ( ) override ;
virtual void VariationSpinBoxValueChanged ( double d ) override ;
2014-07-08 03:11:14 -04:00
void FillVariationTreeWithXform ( Xform < T > * xform ) ;
//Xforms Xaos.
2014-10-14 11:53:15 -04:00
virtual void FillXaosWithCurrentXform ( ) override ;
2014-12-06 00:05:09 -05:00
virtual QString MakeXaosNameString ( uint i ) override ;
2014-10-14 11:53:15 -04:00
virtual void XaosChanged ( DoubleSpinBox * sender ) override ;
virtual void ClearXaos ( ) override ;
2014-10-15 23:09:44 -04:00
virtual void RandomXaos ( ) override ;
2014-07-08 03:11:14 -04:00
//Palette.
2014-10-14 11:53:15 -04:00
virtual bool InitPaletteTable ( const string & s ) override ;
virtual void ApplyPaletteToEmber ( ) override ;
virtual void PaletteAdjust ( ) override ;
2014-12-06 00:05:09 -05:00
virtual QRgb GetQRgbFromPaletteIndex ( uint i ) override { return QRgb ( ) ; }
2014-10-14 11:53:15 -04:00
virtual void PaletteCellClicked ( int row , int col ) override ;
2014-07-08 03:11:14 -04:00
//Library.
2014-10-14 11:53:15 -04:00
virtual void SyncNames ( ) override ;
virtual void FillLibraryTree ( int selectIndex = - 1 ) override ;
virtual void UpdateLibraryTree ( ) override ;
virtual void EmberTreeItemChanged ( QTreeWidgetItem * item , int col ) override ;
virtual void EmberTreeItemDoubleClicked ( QTreeWidgetItem * item , int col ) override ;
2014-12-06 00:05:09 -05:00
virtual void RenderPreviews ( uint start = UINT_MAX , uint end = UINT_MAX ) override ;
2014-10-14 11:53:15 -04:00
virtual void StopPreviewRender ( ) override ;
2014-07-08 03:11:14 -04:00
//Info.
//Rendering/progress.
2014-10-14 11:53:15 -04:00
virtual bool Render ( ) override ;
2014-12-06 00:05:09 -05:00
virtual bool CreateRenderer ( eRendererType renderType , uint platform , uint device , bool shared = true ) override ;
virtual uint SizeOfT ( ) const override { return sizeof ( T ) ; }
2014-10-14 11:53:15 -04:00
virtual int ProgressFunc ( Ember < T > & ember , void * foo , double fraction , int stage , double etaMs ) override ;
virtual void ClearUndo ( ) override ;
virtual GLEmberControllerBase * GLController ( ) override { return m_GLController . get ( ) ; }
2014-07-08 03:11:14 -04:00
private :
//Embers.
void ApplyXmlSavingTemplate ( Ember < T > & ember ) ;
template < typename U > void SetEmberPrivate ( const Ember < U > & ember , bool verbatim ) ;
//Params.
void ParamsToEmber ( Ember < T > & ember ) ;
//Xforms.
void SetNormalizedWeightText ( Xform < T > * xform ) ;
bool IsFinal ( Xform < T > * xform ) ;
//Xforms Color.
void SetCurrentXformColorIndex ( double d ) ;
//Palette.
void UpdateAdjustedPaletteGUI ( Palette < T > & palette ) ;
//Rendering/progress.
void Update ( std : : function < void ( void ) > func , bool updateRender = true , eProcessAction action = FULL_RENDER ) ;
void UpdateCurrentXform ( std : : function < void ( Xform < T > * ) > func , bool updateRender = true , eProcessAction action = FULL_RENDER ) ;
2014-10-14 11:53:15 -04:00
bool SyncSizes ( ) ;
2014-07-08 03:11:14 -04:00
//Templated members.
bool m_PreviewRun ;
bool m_PreviewRunning ;
vector < T > m_TempOpacities ;
vector < T > m_NormalizedWeights ;
Ember < T > m_Ember ;
EmberFile < T > m_EmberFile ;
deque < Ember < T > > m_UndoList ;
Palette < T > m_TempPalette ;
PaletteList < T > m_PaletteList ;
VariationList < T > m_VariationList ;
2014-10-18 17:07:07 -04:00
unique_ptr < SheepTools < T , T > > m_SheepTools ;
unique_ptr < GLEmberController < T > > m_GLController ;
unique_ptr < EmberNs : : Renderer < T , T > > m_PreviewRenderer ;
2014-07-08 03:11:14 -04:00
QFuture < void > m_PreviewResult ;
2014-12-06 00:05:09 -05:00
std : : function < void ( uint , uint ) > m_PreviewRenderFunc ;
2014-07-08 03:11:14 -04:00
} ;