mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-22 05:30:06 -05:00
90ec5b8246
-Show common folder locations such as documents, downloads, pictures in the sidebar in all file dialogs. -Warning message about exceeding memory in final render dialog now suggests strips as the solution to the problem. -Strips now has a tooltip explaining what it does. -Allow more digits in the spinners on the color section the flame tab. -Add manually adjustable size spinners in the final render dialog. Percentage scale and absolute size are fully synced. -Default prefix in final render is now the filename when doing animations (coming from sequence section of the library tab). -Changed the elliptic variation back to using a less precise version for float, and a more precise version for double. The last release had it always using double. -New applied xaos table that shows a read-only view of actual weights by taking the base xform weights and multiplying them by the xaos values. -New table in the xaos tab that gives a graphical representation of the probability that each xform is chosen, with and without xaos. -Add button to transpose the xaos rows and columns. -Add support for importing .chaos files from Chaotica. --Pasting back to Chaotica will work for most, but not all, variations due to incompatible parameter names in some. -Curves are now splines instead of Bezier. This adds compatibility with Chaotica, but breaks it for Apophysis. Xmls are still pastable, but the color curves will look different. --The curve editor on the palette tab can now add points by clicking on the lines and remove points by clicking on the points themselves, just like Chaotica. --Splines are saved in four new xml fields: overall_curve, red_curve, green_curve and blue_curve. -Allow for specifying the percentage of a sub batch each thread should iterate through per kernel call when running with OpenCL. This gives a roughly 1% performance increase due to having to make less kernel calls while iterating. --This field is present for interactive editing (where it's not very useful) and in the final render dialog. --On the command line, this is specified as --sbpctth for EmberRender and EmberAnimate. -Allow double clicking to toggle the supersample field in the flame tab between 1 and 2 for easily checking the effect of the field. -When showing affine values as polar coordinates, show angles normalized to 360 to match Chaotica. -Fuse Count spinner now toggles between 15 and 100 when double clicking for easily checking the effect of the field. -Added field for limiting the range in the x and y direction that the initial points are chosen from. -Added a field called K2 which is an alternative way to set brightness, ignored when zero. --This has no effect for many variations, but hs a noticeable effect for some. -Added new variations: arcsech arcsech2 arcsinh arctanh asteria block bwraps_rand circlecrop2 coth_spiral crackle2 depth_blur depth_blur2 depth_gaussian depth_gaussian2 depth_ngon depth_ngon2 depth_sine depth_sine2 dragonfire dspherical dust excinis exp2 flipx flowerdb foci_p gaussian glynnia2 glynnsim4 glynnsim5 henon henon hex_rand hex_truchet hypershift lazyjess lens lozi lozi modulusx modulusy oscilloscope2 point_symmetry pointsymmetry projective pulse rotate scry2 shift smartshape spher squares starblur2 swirl3 swirl3r tanh_spiral target0 target2 tile_hlp truchet_glyph truchet_inv truchet_knot unicorngaloshen vibration vibration2 --hex_truchet, hex_rand should always use double. They are extremely sensitive. --Bug fixes: -Bounds sign was flipped for x coordinate of world space when center was not zero. -Right clicking and dragging spinner showed menu on mouse up, even if it was very far away. -Text boxes for size in final render dialog were hard to type in. Same bug as xform weight used to be so fix the same way. -Fix spelling to be plural in toggle color speed box. -Stop using the blank user palette to generate flames. Either put colored palettes in it, or exclude it from randoms. -Clicking the random palette button for a palette file with only one palette in it would freeze the program. -Clicking none scale in final render did not re-render the preview. -Use less precision on random xaos. No need for 12 decimal places. -The term sub batch is overloaded in the options dialog. Change the naming and tooltip of those settings for cpu and opencl. --Also made clear in the tooltip for the default opencl quality setting that the value is per device. -The arrows spinner in palette editor appears like a read-only label. Made it look like a spinner. -Fix border colors for various spin boxes and table headers in the style sheet. Requires reload. -Fix a bug in the bwraps variation which would produce different results than Chaotica and Apophysis. -Synth was allowed to be selected for random flame generation when using an Nvidia card but it shouldn't have been because Nvidia has a hard time compiling synth. -A casting bug in the OpenCL kernels for log scaling and density filtering was preventing successful compilations on Intel iGPUs. Fixed even though we don't support anything other than AMD and Nvidia. -Palette rotation (click and drag) position was not being reset when loading a new flame. -When the xform circles were hidden, opening and closing the options dialog would improperly reshow them. -Double click toggle was broken on integer spin boxes. -Fixed tab order of some controls. -Creating a palette from a jpg in the palette editor only produced a single color. --Needed to package imageformats/qjpeg.dll with the Windows installer. -The basic memory benchmark test flame was not really testing memory. Make it more spread out. -Remove the temporal samples field from the flame tab, it was never used because it's only an animation parameter which is specified in the final render dialog or on the command line with EmberAnimate. --Code changes: -Add IsEmpty() to Palette to determine if a palette is all black. -Attempt to avoid selecting a blank palette in PaletteList::GetRandomPalette(). -Add function ScanForChaosNodes() and some associated helper functions in XmlToEmber. -Make variation param name correction be case insensitive in XmlToEmber. -Report error when assigning a variation param value in XmlToEmber. -Add SubBatchPercentPerThread() method to RendererCL. -Override enterEvent() and leaveEvent() in DoubleSpinBox and SpinBox to prevent the context menu from showing up on right mouse up after already leaving the spinner. -Filtering the mouse wheel event in TableWidget no longer appears to be needed. It was probably an old Qt bug that has been fixed. -Gui/ember syncing code in the final render dialog needed to be reworked to accommodate absolute sizes.
237 lines
8.1 KiB
C++
237 lines
8.1 KiB
C++
#pragma once
|
|
|
|
#include "Utils.h"
|
|
#include "Ember.h"
|
|
#include "DensityFilter.h"
|
|
|
|
/// <summary>
|
|
/// RendererBase, RenderCallback and EmberStats classes.
|
|
/// </summary>
|
|
|
|
namespace EmberNs
|
|
{
|
|
/// <summary>
|
|
/// Function pointers present a major restriction when dealing
|
|
/// with member functions, and that is they can only point to
|
|
/// static ones. So instead of a straight function pointer, use
|
|
/// a callback class with a single virtual callback
|
|
/// member function.
|
|
/// Template argument expected to be float or double.
|
|
/// </summary>
|
|
class EMBER_API RenderCallback
|
|
{
|
|
public:
|
|
RenderCallback() = default;
|
|
RenderCallback(RenderCallback& callback) = delete;
|
|
|
|
/// <summary>
|
|
/// Virtual destructor to ensure anything declared in derived classes gets cleaned up.
|
|
/// </summary>
|
|
virtual ~RenderCallback() = default;
|
|
|
|
/// <summary>
|
|
/// Empty progress function to be implemented in derived classes to take action on progress updates.
|
|
/// </summary>
|
|
/// <param name="ember">The ember currently being rendered</param>
|
|
/// <param name="foo">An extra dummy parameter</param>
|
|
/// <param name="fraction">The progress fraction from 0-100</param>
|
|
/// <param name="stage">The stage of iteration. 1 is iterating, 2 is density filtering, 2 is final accumulation.</param>
|
|
/// <param name="etaMs">The estimated milliseconds to completion of the current stage</param>
|
|
/// <returns>Override should return 0 if an abort is requested, else 1 to continue rendering</returns>
|
|
virtual int ProgressFunc(Ember<float>& ember, void* foo, double fraction, int stage, double etaMs) { return 0; }
|
|
virtual int ProgressFunc(Ember<double>& ember, void* foo, double fraction, int stage, double etaMs) { return 0; }
|
|
};
|
|
|
|
/// <summary>
|
|
/// Render statistics for the number of iterations ran,
|
|
/// number of bad values calculated during iteration, and
|
|
/// the total time for the entire render from the start of
|
|
/// iteration to the end of final accumulation.
|
|
/// </summary>
|
|
class EMBER_API EmberStats
|
|
{
|
|
public:
|
|
/// <summary>
|
|
/// Constructor which sets all values to 0.
|
|
/// </summary>
|
|
EmberStats()
|
|
{
|
|
Clear();
|
|
}
|
|
|
|
void Clear()
|
|
{
|
|
m_Success = true;
|
|
m_Iters = 0;
|
|
m_Badvals = 0;
|
|
m_IterMs = 0;
|
|
m_RenderMs = 0;
|
|
}
|
|
|
|
EmberStats& operator += (const EmberStats& stats)
|
|
{
|
|
m_Success &= stats.m_Success;
|
|
m_Iters += stats.m_Iters;
|
|
m_Badvals += stats.m_Badvals;
|
|
m_IterMs += stats.m_IterMs;
|
|
m_RenderMs += stats.m_RenderMs;
|
|
return *this;
|
|
}
|
|
|
|
bool m_Success = true;
|
|
size_t m_Iters, m_Badvals;
|
|
double m_IterMs, m_RenderMs;
|
|
};
|
|
|
|
/// <summary>
|
|
/// The types of available renderers.
|
|
/// Add more in the future as different rendering methods are experimented with.
|
|
/// Possible values might be: CPU+OpenGL, Particle, Inverse.
|
|
/// </summary>
|
|
enum class eRendererType : et { CPU_RENDERER, OPENCL_RENDERER };
|
|
|
|
/// <summary>
|
|
/// A base class with virtual functions to allow both templating and polymorphism to work together.
|
|
/// Derived classes will implement all of these functions.
|
|
/// Note that functions which return a decimal number use the most precise type, double.
|
|
/// </summary>
|
|
class EMBER_API RendererBase : public EmberReport
|
|
{
|
|
public:
|
|
RendererBase();
|
|
RendererBase(const RendererBase& renderer) = delete;
|
|
RendererBase& operator = (const RendererBase& renderer) = delete;
|
|
virtual ~RendererBase() = default;
|
|
|
|
//Non-virtual processing functions.
|
|
void ChangeVal(std::function<void(void)> func, eProcessAction action);
|
|
size_t HistMemoryRequired(size_t strips);
|
|
pair<size_t, size_t> MemoryRequired(size_t strips, bool includeFinal, bool threadedWrite);
|
|
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> RandVec();
|
|
bool PrepFinalAccumVector(vector<v4F>& pixels);
|
|
|
|
//Virtual processing functions.
|
|
virtual bool Ok() const;
|
|
virtual size_t MemoryAvailable();
|
|
virtual void SetEmber(const Ember<float>& ember, eProcessAction action = eProcessAction::FULL_RENDER, bool prep = false) { }
|
|
virtual void SetEmber(const Ember<double>& ember, eProcessAction action = eProcessAction::FULL_RENDER, bool prep = false) { }
|
|
virtual bool RandVec(vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>>& randVec);
|
|
|
|
//Abstract processing functions.
|
|
virtual bool CreateDEFilter(bool& newAlloc) = 0;
|
|
virtual bool CreateSpatialFilter(bool& newAlloc) = 0;
|
|
virtual bool CreateTemporalFilter(bool& newAlloc) = 0;
|
|
virtual void ComputeBounds() = 0;
|
|
virtual void ComputeQuality() = 0;
|
|
virtual void ComputeCamera() = 0;
|
|
virtual eRenderStatus Run(vector<v4F>& finalImage, double time = 0, size_t subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) = 0;
|
|
virtual EmberImageComments ImageComments(const EmberStats& stats, size_t printEditDepth = 0, bool hexPalette = true) = 0;
|
|
virtual DensityFilterBase* GetDensityFilter() = 0;
|
|
|
|
//Non-virtual renderer properties, getters only.
|
|
size_t SuperRasW() const;
|
|
size_t SuperRasH() const;
|
|
size_t SuperSize() const;
|
|
size_t FinalRowSize() const;
|
|
size_t FinalDimensions() const;
|
|
size_t FinalBufferSize() const;
|
|
size_t PixelSize() const;
|
|
size_t GutterWidth() const;
|
|
size_t DensityFilterOffset() const;
|
|
size_t TotalIterCount(size_t strips) const;
|
|
size_t ItersPerTemporalSample() const;
|
|
eProcessState ProcessState() const;
|
|
eProcessAction ProcessAction() const;
|
|
EmberStats Stats() const;
|
|
|
|
//Non-virtual render getters and setters.
|
|
bool LockAccum() const;
|
|
void LockAccum(bool lockAccum);
|
|
bool EarlyClip() const;
|
|
void EarlyClip(bool earlyClip);
|
|
bool YAxisUp() const;
|
|
void YAxisUp(bool yup);
|
|
bool InsertPalette() const;
|
|
void InsertPalette(bool insertPalette);
|
|
bool ReclaimOnResize() const;
|
|
void ReclaimOnResize(bool reclaimOnResize);
|
|
void Callback(RenderCallback* callback);
|
|
void ThreadCount(size_t threads, const char* seedString = nullptr);
|
|
size_t BytesPerChannel() const;
|
|
size_t NumChannels() const;
|
|
eThreadPriority Priority() const;
|
|
void Priority(eThreadPriority priority);
|
|
eInteractiveFilter InteractiveFilter() const;
|
|
void InteractiveFilter(eInteractiveFilter filter);
|
|
|
|
//Virtual render properties, getters and setters.
|
|
virtual size_t ThreadCount() const;
|
|
virtual eRendererType RendererType() const;
|
|
virtual bool Shared() const;
|
|
|
|
//Abstract render properties, getters only.
|
|
virtual size_t TemporalSamples() const = 0;
|
|
virtual size_t HistBucketSize() const = 0;
|
|
virtual size_t FinalRasW() const = 0;
|
|
virtual size_t FinalRasH() const = 0;
|
|
virtual size_t SubBatchSize() const = 0;
|
|
virtual size_t FuseCount() const = 0;
|
|
virtual double ScaledQuality() const = 0;
|
|
virtual double LowerLeftX(bool gutter = true) const = 0;
|
|
virtual double LowerLeftY(bool gutter = true) const = 0;
|
|
virtual double UpperRightX(bool gutter = true) const = 0;
|
|
virtual double UpperRightY(bool gutter = true) const = 0;
|
|
|
|
//Non-virtual threading control.
|
|
void Reset();
|
|
void EnterRender();
|
|
void LeaveRender();
|
|
void EnterFinalAccum();
|
|
void LeaveFinalAccum();
|
|
void EnterResize();
|
|
void LeaveResize();
|
|
void Abort();
|
|
bool Aborted();
|
|
void Pause(bool pause);
|
|
bool Paused();
|
|
bool InRender();
|
|
bool InFinalAccum();
|
|
|
|
void* m_ProgressParameter = nullptr;
|
|
protected:
|
|
bool m_EarlyClip = false;
|
|
bool m_YAxisUp = false;
|
|
bool m_LockAccum = false;
|
|
bool m_InRender = false;
|
|
bool m_InFinalAccum = false;
|
|
bool m_InsertPalette = false;
|
|
bool m_ReclaimOnResize = false;
|
|
bool m_CurvesSet = false;
|
|
volatile bool m_Abort = false;
|
|
volatile bool m_Pause = false;
|
|
size_t m_SuperRasW;
|
|
size_t m_SuperRasH;
|
|
size_t m_SuperSize = 0;
|
|
size_t m_GutterWidth;
|
|
size_t m_DensityFilterOffset;
|
|
size_t m_NumChannels = 4;
|
|
size_t m_BytesPerChannel = 4;
|
|
size_t m_ThreadsToUse;
|
|
size_t m_VibGamCount;
|
|
size_t m_LastTemporalSample = 0;
|
|
size_t m_LastIter = 0;
|
|
double m_LastIterPercent = 0;
|
|
eThreadPriority m_Priority = eThreadPriority::NORMAL;
|
|
eProcessAction m_ProcessAction = eProcessAction::FULL_RENDER;
|
|
eProcessState m_ProcessState = eProcessState::NONE;
|
|
eInteractiveFilter m_InteractiveFilter = eInteractiveFilter::FILTER_LOG;
|
|
EmberStats m_Stats;
|
|
RenderCallback* m_Callback = nullptr;
|
|
vector<size_t> m_SubBatch;
|
|
vector<size_t> m_BadVals;
|
|
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> m_Rand;
|
|
std::recursive_mutex m_RenderingCs, m_AccumCs, m_FinalAccumCs, m_ResizeCs;
|
|
Timing m_RenderTimer, m_IterTimer, m_ProgressTimer;
|
|
};
|
|
}
|