05/12/2017

--Bug fixes
 -Fractorium would occasionally freeze after dismissing the final render dialog because some values were not properly re-initialized.

--Code changes
 -Remove VS 2013 build files.
 -Qualify sqrt with std:: in ColorTriangle.cpp
This commit is contained in:
Person
2017-05-12 15:31:48 -07:00
parent 272ebcf0c0
commit f4bdc1c50a
41 changed files with 45 additions and 2929 deletions

View File

@ -37,7 +37,7 @@ static void sincos(float x, float* s, float* c)
namespace EmberNs
{
#define EMBER_VERSION "1.0.0.3"
#define EMBER_VERSION "1.0.0.4"
#define EPS6 T(1e-6)
#define EPS std::numeric_limits<T>::epsilon()//Apoplugin.h uses -20, but it's more mathematically correct to do it this way.
#define ISAAC_SIZE 4

View File

@ -119,9 +119,11 @@ void Renderer<T, bucketT>::ComputeCamera()
/// <param name="action">The requested process action. Note that it's critical the user supply the proper value here.
/// For example: Changing dimensions without setting action to eProcessAction::FULL_RENDER will crash the program.
/// However, changing only the brightness and setting action to ACCUM_ONLY is perfectly fine.
/// <param name="prep">Whether to also compute bounds, camera, filters etc. This is useful when other code outside of this needs these values
/// before the render actually starts. Default: false.</param>
/// </param>
template <typename T, typename bucketT>
void Renderer<T, bucketT>::SetEmber(const Ember<T>& ember, eProcessAction action)
void Renderer<T, bucketT>::SetEmber(const Ember<T>& ember, eProcessAction action, bool prep)
{
ChangeVal([&]
{
@ -131,6 +133,16 @@ void Renderer<T, bucketT>::SetEmber(const Ember<T>& ember, eProcessAction action
m_Ember = m_Embers[0];
m_EmbersP = &m_Embers;
}, action);
if (prep)
{
bool b = false;
CreateSpatialFilter(b);
CreateTemporalFilter(b);
ComputeBounds();
ComputeQuality();
ComputeCamera();
}
}
/// <summary>

View File

@ -58,7 +58,7 @@ public:
virtual void ComputeBounds() override;
virtual void ComputeQuality() override;
virtual void ComputeCamera() override;
virtual void SetEmber(const Ember<T>& ember, eProcessAction action = eProcessAction::FULL_RENDER) override;
virtual void SetEmber(const Ember<T>& ember, eProcessAction action = eProcessAction::FULL_RENDER, bool prep = false) override;
template <typename C>
void SetEmber(const C& embers);
void MoveEmbers(vector<Ember<T>>& embers);

View File

@ -110,8 +110,8 @@ public:
//Virtual processing functions.
virtual bool Ok() const;
virtual size_t MemoryAvailable();
virtual void SetEmber(const Ember<float>& ember, eProcessAction action = eProcessAction::FULL_RENDER) { }
virtual void SetEmber(const Ember<double>& ember, eProcessAction action = eProcessAction::FULL_RENDER) { }
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.

View File

@ -1236,16 +1236,10 @@ public:
/// <returns>The number of iterations ran</returns>
size_t EstimateBoundingBox(Ember<T>& ember, T eps, size_t samples, T* bmin, T* bmax)
{
bool newAlloc = false;
size_t i, lowTarget, highTarget;
T min[2], max[2];
IterParams<T> params;
m_Renderer->SetEmber(ember);
m_Renderer->CreateSpatialFilter(newAlloc);
m_Renderer->CreateDEFilter(newAlloc);
m_Renderer->ComputeBounds();
m_Renderer->ComputeQuality();
m_Renderer->ComputeCamera();
m_Renderer->SetEmber(ember, eProcessAction::FULL_RENDER, true);
if (ember.XaosPresent())
m_Iterator = m_XaosIterator.get();

View File

@ -1492,7 +1492,6 @@ void TestCpuGpuResults(size_t platform, size_t device)
for (int iter = 0; iter < iters; iter++)
{
bool newAlloc = false;
Point<T> p, p2;
Ember<T> ember;
Xform<T> xform;
@ -1506,12 +1505,7 @@ void TestCpuGpuResults(size_t platform, size_t device)
xform.AddVariation(varCopy);
ember.AddXform(xform);
ember.CacheXforms();
renderer.SetEmber(ember);
renderer.CreateSpatialFilter(newAlloc);
renderer.CreateDEFilter(newAlloc);
renderer.ComputeBounds();
renderer.ComputeQuality();
renderer.ComputeCamera();
renderer.SetEmber(ember, eProcessAction::FULL_RENDER, true);
renderer.AssignIterator();
if (!renderer.Alloc())
@ -1570,7 +1564,6 @@ void TestGpuVectorRead(size_t platform, size_t device)
RendererCL<T, float> renderer(devices);
points.resize(renderer.TotalIterKernelCount());
Variation<T>* var = vlf->GetVariation(eVariationId::VAR_LINEAR);
bool newAlloc = false;
Point<T> p, p2;
Ember<T> ember;
Xform<T> xform;
@ -1584,12 +1577,7 @@ void TestGpuVectorRead(size_t platform, size_t device)
xform.AddVariation(varCopy);
ember.AddXform(xform);
ember.CacheXforms();
renderer.SetEmber(ember);
renderer.CreateSpatialFilter(newAlloc);
renderer.CreateDEFilter(newAlloc);
renderer.ComputeBounds();
renderer.ComputeQuality();
renderer.ComputeCamera();
renderer.SetEmber(ember, eProcessAction::FULL_RENDER, true);
renderer.AssignIterator();
if (!renderer.Alloc())

View File

@ -58,7 +58,7 @@
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Fractorium 1.0.0.3&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;A Qt-based fractal flame editor which uses a C++ re-write of the flam3 algorithm named Ember and a GPU capable version named EmberCL which implements a portion of the cuburn algorithm in OpenCL.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://fractorium.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;fractorium.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;Lead: Matt Feemster&lt;br/&gt;Contributors: Simon Detheridge, Michel Mastriani&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Fractorium 1.0.0.4&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;A Qt-based fractal flame editor which uses a C++ re-write of the flam3 algorithm named Ember and a GPU capable version named EmberCL which implements a portion of the cuburn algorithm in OpenCL.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://fractorium.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;fractorium.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;Lead: Matt Feemster&lt;br/&gt;Contributors: Simon Detheridge, Michel Mastriani&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>

View File

@ -634,7 +634,6 @@ tuple<size_t, size_t, size_t> FinalRenderEmberController<T>::SyncAndComputeMemor
size_t iterCount;
pair<size_t, size_t> p(0, 0);
size_t strips;
bool b = false;
uint channels = m_FinalRenderDialog->Ext() == "png" ? 4 : 3;//4 channels for Png, else 3.
SyncGuiToEmbers();
@ -642,13 +641,8 @@ tuple<size_t, size_t, size_t> FinalRenderEmberController<T>::SyncAndComputeMemor
{
strips = VerifyStrips(m_Ember->m_FinalRasH, m_FinalRenderDialog->Strips(),
[&](const string & s) {}, [&](const string & s) {}, [&](const string & s) {});
m_Renderer->SetEmber(*m_Ember);
m_Renderer->CreateSpatialFilter(b);
m_Renderer->CreateTemporalFilter(b);
m_Renderer->SetEmber(*m_Ember, eProcessAction::FULL_RENDER, true);
m_Renderer->NumChannels(channels);
m_Renderer->ComputeBounds();
m_Renderer->ComputeQuality();
m_Renderer->ComputeCamera();
m_FinalPreviewRenderer->Render(UINT_MAX, UINT_MAX);
p = m_Renderer->MemoryRequired(strips, true, m_FinalRenderDialog->DoSequence());
iterCount = m_Renderer->TotalIterCount(strips);
@ -657,13 +651,8 @@ tuple<size_t, size_t, size_t> FinalRenderEmberController<T>::SyncAndComputeMemor
{
for (auto& renderer : m_Renderers)
{
renderer->SetEmber(*m_Ember);
renderer->CreateSpatialFilter(b);
renderer->CreateTemporalFilter(b);
renderer->SetEmber(*m_Ember, eProcessAction::FULL_RENDER, true);
renderer->NumChannels(channels);
renderer->ComputeBounds();
renderer->ComputeQuality();
renderer->ComputeCamera();
}
m_FinalPreviewRenderer->Render(UINT_MAX, UINT_MAX);

View File

@ -569,7 +569,9 @@ bool FractoriumEmberController<T>::CreateRenderer(eRendererType renderType, cons
m_Renderer->Callback(this);
m_Renderer->NumChannels(4);//Always using 4 since the GL texture is RGBA.
m_Renderer->ReclaimOnResize(true);
m_Renderer->SetEmber(m_Ember);//Give it an initial ember, will be updated many times later.
//Give it an initial ember, will be updated many times later.
//Even though the bounds are computed when starting the next render. The OpenGL draw calls use these values, which might get called before the render starts.
m_Renderer->SetEmber(m_Ember, eProcessAction::FULL_RENDER, true);
m_Renderer->EarlyClip(s->EarlyClip());
m_Renderer->YAxisUp(s->YAxisUp());
m_Renderer->ThreadCount(s->ThreadCount());

View File

@ -843,7 +843,7 @@ double ColorTriangle::RadiusAt(const QPointF& pos, const QRect& rect) const
{
double mousexdist = pos.x() - (double) rect.center().x();
double mouseydist = pos.y() - (double) rect.center().y();
return sqrt(mousexdist * mousexdist + mouseydist * mouseydist);
return std::sqrt(mousexdist * mousexdist + mouseydist * mouseydist);
}
/*!
@ -857,7 +857,7 @@ double ColorTriangle::AngleAt(const QPointF& pos, const QRect& rect) const
{
double mousexdist = pos.x() - (double) rect.center().x();
double mouseydist = pos.y() - (double) rect.center().y();
double mouserad = sqrt(mousexdist * mousexdist + mouseydist * mouseydist);
double mouserad = std::sqrt(mousexdist * mousexdist + mouseydist * mouseydist);
if (mouserad == 0.0)
return 0.0;
@ -885,7 +885,7 @@ inline double qsqr(double a)
*/
inline double vlen(double x, double y)
{
return sqrt(qsqr(x) + qsqr(y));
return std::sqrt(qsqr(x) + qsqr(y));
}
/*! \internal
@ -1162,7 +1162,7 @@ QPointF ColorTriangle::MovePointToTriangle(double x, double y, const Vertex& a,
// the a-b vector with this distance and the angle between a-b
// and a-(x,y) to determine the point of intersection of the
// perpendicular projection from (x,y) onto a-b.
double pdist = sqrt(qsqr(x - a.point.x()) + qsqr(y - a.point.y()));
double pdist = std::sqrt(qsqr(x - a.point.x()) + qsqr(y - a.point.y()));
// the length of all edges is always > 0
double p0x = a.point.x() + ((b.point.x() - a.point.x()) / vlen(v2xB, v2yB)) * cos(alphaA) * pdist;
double p0y = a.point.y() + ((b.point.y() - a.point.y()) / vlen(v2xB, v2yB)) * cos(alphaA) * pdist;
@ -1186,7 +1186,7 @@ QPointF ColorTriangle::MovePointToTriangle(double x, double y, const Vertex& a,
else if (angleBetweenAngles(angleP, angleB, angleC))
{
// If (x,y) is in the b-c area, project onto the b-c vector.
double pdist = sqrt(qsqr(x - b.point.x()) + qsqr(y - b.point.y()));
double pdist = std::sqrt(qsqr(x - b.point.x()) + qsqr(y - b.point.y()));
// the length of all edges is always > 0
double p0x = b.point.x() + ((c.point.x() - b.point.x()) / vlen(v2xC, v2yC)) * cos(alphaB) * pdist;
double p0y = b.point.y() + ((c.point.y() - b.point.y()) / vlen(v2xC, v2yC)) * cos(alphaB) * pdist;
@ -1206,7 +1206,7 @@ QPointF ColorTriangle::MovePointToTriangle(double x, double y, const Vertex& a,
else if (angleBetweenAngles(angleP, angleC, angleA))
{
// If (x,y) is in the c-a area, project onto the c-a vector.
double pdist = sqrt(qsqr(x - c.point.x()) + qsqr(y - c.point.y()));
double pdist = std::sqrt(qsqr(x - c.point.x()) + qsqr(y - c.point.y()));
// the length of all edges is always > 0
double p0x = c.point.x() + ((a.point.x() - c.point.x()) / vlen(v2xA, v2yA)) * cos(alphaC) * pdist;
double p0y = c.point.y() + ((a.point.y() - c.point.y()) / vlen(v2xA, v2yA)) * cos(alphaC) * pdist;