0.4.1.7 Beta 01/02/2015

--User changes
 Use actual strips count when computing memory requirements in the final render dialog.
 Output CL_DEVICE_ADDRESS_BITS when passing --openclinfo to command line programs.
 Warn if single/total allocations are greater than the max allowed for OpenCL in the final render dialog.
 Make about box properly sized for different fonts.
 Dock widget is slightly resizable now.
 Center scroll area when loading a new ember.

--Bug Fixes
 Fix bad values left in an ember when a render with strips > 1 fails in the final render dialog.
 Fix incorrect calculation in dc_cube variation when using OpenCL.

--Code Changes
 Major work to get it running on Linux.
 Migrate from QGLWidget to QOpenGLWidget.
 Delayed init due to QOpenGLWidget.
 Break RendererBase::MemoryRequired() into two functions, it and HistMemRequired() and return a tuple.
 Add GlobalMemSize() and MaxAllocSize() functions in OpenCLWrapper.
 Change CHOOSE_XFORM_GRAIN to be 16384, so we can & with 16383 instead of using modulo when selecting an xform. This results in a 9% speed increase on the CPU.
 Save each newly loaded ember in a file called "last.flame" in the executable folder. This will help diagnose crashes that occur when switching embers.
 Use nullptr instead of NULL in the Fractorium project. It had previously been done in all other places.
This commit is contained in:
mfeemster 2015-01-02 15:11:36 -08:00
parent 3cf6141e27
commit 5354e96fe2
24 changed files with 228 additions and 98 deletions

View File

@ -80,6 +80,11 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "FractoriumInstaller", "..\I
{6547D5FA-64CE-44BA-9D3C-B6E217456445} = {6547D5FA-64CE-44BA-9D3C-B6E217456445}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5CD06D80-903E-45D6-90F3-3C3EB4FFE46F}"
ProjectSection(SolutionItems) = preProject
..\..\..\Data\Version History.txt = ..\..\..\Data\Version History.txt
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Library|Mixed Platforms = Debug Library|Mixed Platforms

View File

@ -1,16 +1,25 @@
0.4.1.7 Beta 01/02/2015
--User changes
Use actual strips count when computing memory requirements in the final render dialog.
Output CL_DEVICE_ADDRESS_BITS when passing --openclinfo to command line programs.
Warn if single/total allocations are greater than the max allowed for OpenCL in the final render dialog.
Make about box properly sized for different fonts.
Dock widget is slightly resizable now.
Center scroll area when loading a new ember.
--Bug Fixes
Fix bad values left in an ember when a render with strips > 1 fails in the final render dialog.
Fix incorrect calculation in dc_cube variation when using OpenCL.
--Code Changes
Major work to get it running on Linux.
Migrate from QGLWidget to QOpenGLWidget.
Delayed init due to QOpenGLWidget.
Break RendererBase::MemoryRequired() into two functions, it and HistMemRequired() and return a tuple.
Add GlobalMemSize() and MaxAllocSize() functions in OpenCLWrapper.
Change CHOOSE_XFORM_GRAIN to be 16384, so we can & with 16383 instead of using modulo when selecting an xform. This results in a 9% speed increase on the CPU.
Save each newly loaded ember in a file called "last.flame" in the executable folder. This will help diagnose crashes that occur when switching embers.
Use nullptr instead of NULL in the Fractorium project. It had previously been done in all other places.
0.4.1.6 Beta 11/29/2014
--User Changes

View File

@ -5,10 +5,15 @@
/// Constructor that takes a parent widget and passes it to the base, then
/// sets up the GUI.
/// </summary>
/// <param name="p">The parent widget. Default: NULL.</param>
/// <param name="p">The parent widget. Default: nullptr.</param>
/// <param name="f">The window flags. Default: 0.</param>
FractoriumAboutDialog::FractoriumAboutDialog(QWidget* p, Qt::WindowFlags f)
: QDialog(p, f)
{
ui.setupUi(this);
adjustSize();//Must do this to ensure all text is displayed when using different fonts.
setMinimumHeight(height());//Once properly sized, disallow resizing.
setMaximumHeight(height());
setMinimumWidth(width());
setMaximumWidth(width());
}

View File

@ -7,11 +7,11 @@
<x>0</x>
<y>0</y>
<width>488</width>
<height>565</height>
<height>567</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -19,19 +19,19 @@
<property name="minimumSize">
<size>
<width>488</width>
<height>565</height>
<height>546</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>587</width>
<height>565</height>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>6</number>
</property>
@ -45,7 +45,13 @@
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="DescriptionLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
@ -70,10 +76,22 @@
</item>
<item>
<widget class="QGroupBox" name="CodeCopiedGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Code Copied</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
<number>4</number>
</property>
@ -81,7 +99,19 @@
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="CodeCopiedLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://code.google.com/p/flam3&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;flam3&lt;/span&gt;&lt;/a&gt;: Scott Draves, Erik Reckase (GPL v2)&lt;br/&gt;&lt;a href=&quot;http://github.com/stevenrobertson/cuburn&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;cuburn&lt;/span&gt;&lt;/a&gt;: Steven Robertson, Michael Semeniuk, Matthew Znoj, Nicolas Mejia (GPL v3)&lt;br/&gt;&lt;a href=&quot;http://fractron9000.sourceforge.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Fractron 9000&lt;/span&gt;&lt;/a&gt;: Mike Thiesen (GPL)&lt;br/&gt;&lt;a href=&quot;http://sourceforge.net/projects/apophysis7x&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Apophysis&lt;/span&gt;&lt;/a&gt;: Mark Townsend, Ronald Hordijk, Peter Sdobnov, Piotr Borys, Georg Kiehne (GPL)&lt;br/&gt;&lt;a href=&quot;http://jwildfire.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;JWildfire&lt;/span&gt;&lt;/a&gt;: Andreas Maschke (LGPL)&lt;br/&gt;Numerous Apophysis plugin developers (GPL)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -101,10 +131,22 @@
</item>
<item>
<widget class="QGroupBox" name="LibrariesLinkedGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Libraries Linked</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="topMargin">
<number>4</number>
</property>
@ -112,7 +154,13 @@
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="LibrariesLinkedLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://qt-project.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Qt&lt;/span&gt;&lt;/a&gt;: Digia Plc (GPL v3, LGPL v2)&lt;br/&gt;&lt;a href=&quot;http://g-truc.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;glm&lt;/span&gt;&lt;/a&gt;: Christophe Riccio (MIT License)&lt;br/&gt;&lt;a href=&quot;http://threadingbuildingblocks.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Threading Building Blocks&lt;/span&gt;&lt;/a&gt;: Intel Corporation (GPLv2)&lt;br/&gt;&lt;a href=&quot;http://libjpeg.sourceforge.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;libjpeg&lt;/span&gt;&lt;/a&gt;: Independent JPEG Group (Free Software License)&lt;br/&gt;&lt;a href=&quot;http://libpng.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;libpng&lt;/span&gt;&lt;/a&gt;: Glenn Randers-Pehrson et al (Libpng License)&lt;br/&gt;&lt;a href=&quot;http://xmlsoft.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;libxml2&lt;/span&gt;&lt;/a&gt;: Daniel Veillard (MIT License)&lt;br/&gt;&lt;a href=&quot;http://zlib.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;zlib&lt;/span&gt;&lt;/a&gt;: Jean-loup Gailly, Mark Adler (Zlib License)&lt;br/&gt;&lt;a href=&quot;http://burtleburtle.net/bob/rand/isaac.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;QTIsaac&lt;/span&gt;&lt;/a&gt;: Robert J. Jenkins, Quinn Tyler Jackson (Public Domain)&lt;br/&gt;&lt;a href=&quot;http://cas.ee.ic.ac.uk/people/dt10/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;MWC64X Random Number Generator&lt;/span&gt;&lt;/a&gt;: David Thomas (Public Domain)&lt;br/&gt;&lt;a href=&quot;http://code.jellycan.com/simpleopt/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;SimpleOpt&lt;/span&gt;&lt;/a&gt;: Brodie Thiesfield (MIT License)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -132,10 +180,16 @@
</item>
<item>
<widget class="QGroupBox" name="IconsUsedGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Icons Used</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="topMargin">
<number>4</number>
</property>
@ -143,7 +197,13 @@
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="IconsUsedLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://famfamfam.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Silk&lt;/span&gt;&lt;/a&gt;: Mark James (Creative Commons Attribution 2.5 License)&lt;br/&gt;&lt;a href=&quot;http://momentumdesignlab.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Momentum&lt;/span&gt;&lt;/a&gt;: Momentum Design Lab (Creative Commons Attribution-ShareAlike 3.5 License)&lt;br/&gt;&lt;a href=&quot;http://everaldo.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Crystal Clear&lt;/span&gt;&lt;/a&gt;: Everaldo Coelho (LGPL)&lt;br/&gt;&lt;a href=&quot;http://openiconlibrary.sourceforge.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Open Icon Library&lt;/span&gt;&lt;/a&gt;: Jeff Israel (GPL, LGPL, Creative Commons, Public Domain)&lt;br/&gt;&lt;a href=&quot;http://icons.mysitemyway.com/category/3d-transparent-glass-icons/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;3D Transparent Glass&lt;/span&gt;&lt;/a&gt;: iconsETC (Public Domain)&lt;br/&gt;&lt;a href=&quot;http://p.yusukekamiyamane.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Fugue&lt;/span&gt;&lt;/a&gt;: Yusuke Kamiyamane (Creative Commons Attribution 3.0 License)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -162,12 +222,9 @@
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>6</number>
</property>
<layout class="QGridLayout" name="gridLayout" rowminimumheight="0">
<property name="verticalSpacing">
<number>0</number>
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="okButton">

View File

@ -7,7 +7,7 @@
/// and change its value using the mouse wheel without explicitly having to click
/// inside of it.
/// </summary>
/// <param name="p">The parent widget. Default: NULL.</param>
/// <param name="p">The parent widget. Default: nullptr.</param>
/// <param name="height">The height of the spin box. Default: 16.</param>
/// <param name="step">The step used to increment/decrement the spin box when using the mouse wheel. Default: 0.05.</param>
DoubleSpinBox::DoubleSpinBox(QWidget* p, int h, double step)

View File

@ -19,7 +19,7 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set
uint i;
double dmax = numeric_limits<double>::max();
QTableWidget* table = ui.FinalRenderParamsTable;
QTableWidgetItem* item = NULL;
QTableWidgetItem* item = nullptr;
m_Fractorium = dynamic_cast<Fractorium*>(p);
m_Settings = settings;
@ -649,9 +649,9 @@ bool FractoriumFinalRenderDialog::CreateControllerFromGUI(bool createRenderer)
#ifdef DO_DOUBLE
size_t elementSize = Double() ? sizeof(double) : sizeof(float);
#else
size_t elementSize = sizeof(float);
size_t elementSize = sizeof(float);
#endif
if (!m_Controller.get() || (m_Controller->SizeOfT() != elementSize))
{
#ifdef DO_DOUBLE

View File

@ -40,7 +40,7 @@ class FractoriumFinalRenderDialog : public QDialog
friend Fractorium;
friend FinalRenderEmberControllerBase;
friend FinalRenderEmberController<float>;
#ifdef DO_DOUBLE
friend FinalRenderEmberController<double>;
#endif

View File

@ -93,7 +93,7 @@ FinalRenderEmberController<T>::FinalRenderEmberController(FractoriumFinalRenderD
: FinalRenderEmberControllerBase(finalRender)
{
m_FinalPreviewRenderer = unique_ptr<EmberNs::Renderer<T, T>>(new EmberNs::Renderer<T, T>());
m_FinalPreviewRenderer->Callback(NULL);
m_FinalPreviewRenderer->Callback(nullptr);
m_FinalPreviewRenderer->NumChannels(4);
m_FinalPreviewRenderFunc = [&]()
@ -669,10 +669,10 @@ void FinalRenderEmberController<T>::RenderComplete(Ember<T>& ember)
QString newPath = xmlFileInfo.absolutePath() + '/' + xmlFileInfo.completeBaseName() + ".flame";
xmlDocPtr tempEdit = ember.m_Edits;
ember.m_Edits = m_XmlWriter.CreateNewEditdoc(&ember, NULL, "edit", m_Settings->Nick().toStdString(), m_Settings->Url().toStdString(), m_Settings->Id().toStdString(), "", 0, 0);
ember.m_Edits = m_XmlWriter.CreateNewEditdoc(&ember, nullptr, "edit", m_Settings->Nick().toStdString(), m_Settings->Url().toStdString(), m_Settings->Id().toStdString(), "", 0, 0);
m_XmlWriter.Save(newPath.toStdString().c_str(), ember, 0, true, false, true);//Note that the ember passed is used, rather than m_Ember because it's what was actually rendered.
if (tempEdit != NULL)
if (tempEdit != nullptr)
xmlFreeDoc(tempEdit);
}

View File

@ -24,8 +24,8 @@ Fractorium::Fractorium(QWidget* p)
m_ColorDialog = new QColorDialog(this);
m_Settings = new FractoriumSettings(this);
m_FileDialog = NULL;//Use lazy instantiation upon first use.
m_FolderDialog = NULL;
m_FileDialog = nullptr;//Use lazy instantiation upon first use.
m_FolderDialog = nullptr;
m_FinalRenderDialog = new FractoriumFinalRenderDialog(m_Settings, this);
m_OptionsDialog = new FractoriumOptionsDialog(m_Settings, this);
m_AboutDialog = new FractoriumAboutDialog(this);
@ -122,8 +122,8 @@ Fractorium::Fractorium(QWidget* p)
//Setup pointer in the GL window to point back to here.
ui.GLDisplay->SetMainWindow(this);
showMaximized();
showMaximized();//This won't fully set things up and show them until after this constructor exits.
connect(ui.DockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(dockLocationChanged(Qt::DockWidgetArea)));
connect(ui.DockWidget, SIGNAL(topLevelChanged(bool)), this, SLOT(OnDockTopLevelChanged(bool)));
@ -155,9 +155,10 @@ Fractorium::Fractorium(QWidget* p)
ui.GLParentScrollArea->installEventFilter(this);
//At this point, everything has been setup except the renderer. Shortly after
//this constructor exits, GLWidget::initializeGL() will create the initial flock and start the rendering timer
//this constructor exits, GLWidget::InitGL() will create the initial flock and start the rendering timer
//which executes whenever the program is idle. Upon starting the timer, the renderer
//will be initialized.
QTimer::singleShot(500, [&]() { ui.GLDisplay->InitGL(); });
}
/// <summary>
@ -183,6 +184,19 @@ void Fractorium::SetCoordinateStatus(int rasX, int rasY, float worldX, float wor
m_CoordinateStatusLabel->setText(QString(m_CoordinateString));
}
/// <summary>
/// Center the scroll area.
/// Called in response to a resizing, or setting of new ember.
/// </summary>
void Fractorium::CenterScrollbars()
{
QScrollBar* w = ui.GLParentScrollArea->horizontalScrollBar();
QScrollBar* h = ui.GLParentScrollArea->verticalScrollBar();
w->setValue(w->maximum() / 2);
h->setValue(h->maximum() / 2);
}
/// <summary>
/// Apply the settings for saving an ember to an Xml file to an ember (presumably about to be saved).
/// </summary>

View File

@ -87,6 +87,7 @@ public:
void SetRotation(double rot, bool stealth);
void SetScale(double scale);
void SetCoordinateStatus(int rasX, int rasY, float worldX, float worldY);
void CenterScrollbars();
//Xforms.
void CurrentXform(uint i);

View File

@ -48,6 +48,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
@ -71,8 +74,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>926</width>
<height>941</height>
<width>923</width>
<height>942</height>
</rect>
</property>
<property name="sizePolicy">
@ -87,6 +90,12 @@
<height>0</height>
</size>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="focusPolicy">
<enum>Qt::WheelFocus</enum>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
@ -95,7 +104,7 @@
<x>0</x>
<y>0</y>
<width>1214</width>
<height>20</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="MenuFile">
@ -388,8 +397,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>261</width>
<height>845</height>
<width>259</width>
<height>852</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_11">
@ -495,8 +504,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>261</width>
<height>845</height>
<width>259</width>
<height>852</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -2816,8 +2825,8 @@ SpinBox
<rect>
<x>0</x>
<y>0</y>
<width>141</width>
<height>610</height>
<width>118</width>
<height>597</height>
</rect>
</property>
<property name="autoFillBackground">
@ -5032,8 +5041,8 @@ SpinBox
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>470</height>
<width>259</width>
<height>853</height>
</rect>
</property>
<property name="sizePolicy">

View File

@ -3,6 +3,8 @@
#include "Fractorium.h"
#include "GLEmberController.h"
#define SAVE_EACH 1
/// <summary>
/// Constructor which initializes the non-templated members contained in this class.
/// The renderer, other templated members and GUI setup will be done in the templated derived controller class.
@ -22,8 +24,8 @@ FractoriumEmberControllerBase::FractoriumEmberControllerBase(Fractorium* fractor
m_OutputTexID = 0;
m_SubBatchCount = 1;//Will be ovewritten by the options on first render.
m_Fractorium = fractorium;
m_RenderTimer = NULL;
m_RenderRestartTimer = NULL;
m_RenderTimer = nullptr;
m_RenderRestartTimer = nullptr;
m_Rand = QTIsaac<ISAAC_SIZE, ISAAC_INT>(ISAAC_INT(t.Tic()), ISAAC_INT(t.Tic() * 2), ISAAC_INT(t.Tic() * 3));//Ensure a different rand seed on each instance.
m_RenderTimer = new QTimer(m_Fractorium);
@ -46,14 +48,14 @@ FractoriumEmberControllerBase::~FractoriumEmberControllerBase()
{
m_RenderTimer->stop();
delete m_RenderTimer;
m_RenderTimer = NULL;
m_RenderTimer = nullptr;
}
if (m_RenderRestartTimer)
{
m_RenderRestartTimer->stop();
delete m_RenderRestartTimer;
m_RenderRestartTimer = NULL;
m_RenderRestartTimer = nullptr;
}
}
@ -77,7 +79,7 @@ FractoriumEmberController<T>::FractoriumEmberController(Fractorium* fractorium)
BackgroundChanged(QColor(0, 0, 0));//Default to black.
ClearUndo();
m_PreviewRenderer->Callback(NULL);
m_PreviewRenderer->Callback(nullptr);
m_PreviewRenderer->NumChannels(4);
m_PreviewRenderer->EarlyClip(m_Fractorium->m_Settings->EarlyClip());
m_PreviewRenderer->YAxisUp(m_Fractorium->m_Settings->YAxisUp());
@ -248,6 +250,9 @@ void FractoriumEmberController<T>::SetEmberPrivate(const Ember<U>& ember, bool v
if (ember.m_Name != m_Ember.m_Name)
m_LastSaveCurrent = "";
size_t w = m_Ember.m_FinalRasW;//Cache values for use below.
size_t h = m_Ember.m_FinalRasH;
m_Ember = ember;
if (!verbatim)
@ -258,8 +263,22 @@ void FractoriumEmberController<T>::SetEmberPrivate(const Ember<U>& ember, bool v
m_Ember.m_Supersample = m_Fractorium->m_SupersampleSpin->value();
}
#ifdef SAVE_EACH
static EmberToXml<T> writer;
string filename = "last.flame";
writer.Save(filename.c_str(), m_Ember, 0, true, false, true);
#endif
m_GLController->ResetMouseState();
m_Fractorium->FillXforms();//Must do this first because the palette setup in FillParamTablesAndPalette() uses the xforms combo.
FillParamTablesAndPalette();
//If a resize happened, this won't do anything because the new size is not reflected in the scroll area yet.
//However, it will have been taken care of in SyncSizes() in that case, so it's ok.
//This is for when a new ember with the same size was loaded. If it was larger than the scroll area, and was scrolled, re-center it.
if (m_Ember.m_FinalRasW == w && m_Ember.m_FinalRasH == h)
m_Fractorium->CenterScrollbars();
}
template class FractoriumEmberController<float>;

View File

@ -192,7 +192,7 @@ public:
virtual bool CreateRenderer(eRendererType renderType, uint platform, uint device, bool shared = true) { return false; }
virtual uint SizeOfT() const { return 0; }
virtual void ClearUndo() { }
virtual GLEmberControllerBase* GLController() { return NULL; }
virtual GLEmberControllerBase* GLController() { return nullptr; }
bool RenderTimerRunning();
void StartRenderTimer();
void DelayedStartRenderTimer();

View File

@ -273,9 +273,9 @@ void FractoriumEmberController<T>::SaveCurrentAsXml()
SaveCurrentToOpenedFile();//Save the current ember back to the opened file before writing to disk.
ApplyXmlSavingTemplate(ember);
ember.m_Edits = writer.CreateNewEditdoc(&ember, NULL, "edit", s->Nick().toStdString(), s->Url().toStdString(), s->Id().toStdString(), "", 0, 0);
ember.m_Edits = writer.CreateNewEditdoc(&ember, nullptr, "edit", s->Nick().toStdString(), s->Url().toStdString(), s->Id().toStdString(), "", 0, 0);
if (tempEdit != NULL)
if (tempEdit != nullptr)
xmlFreeDoc(tempEdit);
if (writer.Save(filename.toStdString().c_str(), ember, 0, true, false, true))
@ -383,7 +383,7 @@ void Fractorium::OnActionSaveCurrentToOpenedFile(bool checked) { m_Controller->S
/// <param name="checked">Ignore.</param>
void Fractorium::OnActionExit(bool checked)
{
closeEvent(NULL);
closeEvent(nullptr);
QApplication::exit();
}

View File

@ -117,7 +117,7 @@ void FractoriumEmberControllerBase::SaveCurrentRender(const QString& filename, b
uint i, j;
uint width = m_Renderer->FinalRasW();
uint height = m_Renderer->FinalRasH();
byte* data = NULL;
byte* data = nullptr;
vector<byte> vecRgb;
QFileInfo fileInfo(filename);
QString suffix = fileInfo.suffix();
@ -278,6 +278,7 @@ bool FractoriumEmberController<T>::SyncSizes()
if (m_Renderer->RendererType() == OPENCL_RENDERER && (rendererCL = dynamic_cast<RendererCL<T>*>(m_Renderer.get())))
rendererCL->SetOutputTexture(gl->OutputTexID());
m_Fractorium->CenterScrollbars();
changed = true;
}
@ -433,8 +434,8 @@ bool FractoriumEmberController<T>::Render()
if (iterBegin || ProcessState() == ACCUM_DONE)
{
if (m_FinalImage.size() == m_Renderer->FinalBufferSize())//Make absolutely sure the correct amount of data is passed.
gl->repaint();
//gl->update();
//gl->repaint();
gl->update();
//m_Fractorium->update();
//m_Fractorium->ui.GLParentScrollArea->update();
@ -673,7 +674,7 @@ bool Fractorium::CreateControllerFromOptions()
}
}
return m_Controller.get() != NULL;
return m_Controller.get() != nullptr;
}
/// <summary>
@ -704,7 +705,7 @@ void Fractorium::IdleTimer() { m_Controller->Render(); }
/// <summary>
/// Thin wrapper to determine if the controllers have been properly initialized.
/// </summary>
/// <returns>True if the ember controller and GL controllers are both not NULL, else false.</returns>
/// <returns>True if the ember controller and GL controllers are both not nullptr, else false.</returns>
bool Fractorium::ControllersOk() { return m_Controller.get() && m_Controller->GLController(); }
template class FractoriumEmberController<float>;

View File

@ -45,7 +45,7 @@ void Fractorium::InitXformsUI()
/// <summary>
/// Get the current xform.
/// </summary>
/// <returns>The current xform as specified by the current xform combo box index. NULL if out of range (should never happen).</returns>
/// <returns>The current xform as specified by the current xform combo box index. nullptr if out of range (should never happen).</returns>
template <typename T>
Xform<T>* FractoriumEmberController<T>::CurrentXform()
{

View File

@ -141,7 +141,7 @@ void Fractorium::OnSoloXformCheckBoxStateChanged(int state)
/// <param name="newSize">Ignored</param>
void Fractorium::OnXformRefPaletteResized(int logicalIndex, int oldSize, int newSize)
{
m_Controller->SetPaletteRefTable(NULL);
m_Controller->SetPaletteRefTable(nullptr);
}
/// <summary>

View File

@ -237,7 +237,7 @@ void FractoriumEmberController<T>::FillVariationTreeWithXform(Xform<T>* xform)
for (uint j = 0; j < item->childCount(); j++)//Iterate through all of the children, which will be the params if it was a parametric variation.
{
T* param = NULL;
T* param = nullptr;
QTreeWidgetItem* childItem = item->child(j);//Get the child.
QWidget* childItemWidget = tree->itemWidget(childItem, 1);//Get the widget for the child.

View File

@ -38,8 +38,8 @@ GLEmberController<T>::GLEmberController(Fractorium* fractorium, GLWidget* glWidg
GridStep = T(1.0 / 8.0);
m_FractoriumEmberController = controller;
m_HoverXform = NULL;
m_SelectedXform = NULL;
m_HoverXform = nullptr;
m_SelectedXform = nullptr;
m_CenterDownX = 0;
m_CenterDownY = 0;
}
@ -62,6 +62,17 @@ bool GLEmberController<T>::CheckForSizeMismatch(int w, int h)
return (m_FractoriumEmberController->FinalRasW() != w || m_FractoriumEmberController->FinalRasH() != h);
}
/// <summary>
/// Reset the drag and hover state. Called in response setting a new ember as the current one.
/// </summary>
template <typename T>
void GLEmberController<T>::ResetMouseState()
{
m_HoverType = HoverNone;
m_HoverXform = nullptr;
m_SelectedXform = nullptr;
}
/// <summary>
/// Calculate the scale.
/// Used when dragging the right mouse button.

View File

@ -63,6 +63,7 @@ public:
virtual bool SizesMatch() { return false; }
virtual bool CheckForSizeMismatch(int w, int h) { return true; }
virtual void QueryMatrices(bool print) { }
virtual void ResetMouseState() { }
protected:
uint m_DragModifier;
@ -96,6 +97,7 @@ public:
virtual void QueryMatrices(bool print) override;
virtual bool SizesMatch() override;
virtual bool CheckForSizeMismatch(int w, int h) override;
virtual void ResetMouseState() override;
T CalcScale();
T CalcRotation();

View File

@ -19,7 +19,7 @@ GLWidget::GLWidget(QWidget* p)
m_TexWidth = 0;
m_TexHeight = 0;
m_OutputTexID = 0;
m_Fractorium = NULL;
m_Fractorium = nullptr;
qsf.setSwapInterval(1);//Vsync.
qsf.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
@ -35,6 +35,28 @@ GLWidget::~GLWidget()
{
}
/// <summary>
/// A manual initialization that must be called immediately after the main window is shown
/// and the virtual initializeGL() is called.
/// </summary>
void GLWidget::InitGL()
{
if (!m_Init)
{
int w = m_Fractorium->ui.GLParentScrollArea->width();
int h = m_Fractorium->ui.GLParentScrollArea->height();
SetDimensions(w, h);
m_Fractorium->m_WidthSpin->setValue(w);
m_Fractorium->m_HeightSpin->setValue(h);
//Start with a flock of 10 random embers. Can't do this until now because the window wasn't maximized yet, so the sizes would have been off.
m_Fractorium->OnActionNewFlock(false);
m_Fractorium->m_Controller->DelayedStartRenderTimer();
m_Init = true;
}
}
/// <summary>
/// Draw the final rendered image as a texture on a quad that is the same size as the window.
/// Different action is taken based on whether a CPU or OpenCL renderer is used.
@ -114,15 +136,8 @@ template <typename T>
void GLEmberController<T>::ClearWindow()
{
Ember<T>* ember = m_FractoriumEmberController->CurrentEmber();
m_GL->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GL->glClearColor(ember->m_Background.r, ember->m_Background.g, ember->m_Background.b, 1.0);
//m_GL->update();
m_GL->makeCurrent();
//m_GL->context()->swapBuffers(;
//m_GL->context()->swapBuffers(m_GL->context()->surface());
m_GL->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_GL->glClearColor(ember->m_Background.r, ember->m_Background.g, ember->m_Background.b, 1.0);
}
@ -177,31 +192,12 @@ void GLWidget::initializeGL()
{
glClearColor(0.0, 0.0, 0.0, 1.0);
int w = m_Fractorium->width() - m_Fractorium->ui.DockWidget->width();
int h = m_Fractorium->ui.DockWidget->height();
//int w = m_Fractorium->ui.GLParentScrollArea->width();
//int h = m_Fractorium->ui.GLParentScrollArea->height();
//show();
//m_Fractorium->ui.GLParentScrollArea->showMaximized();
SetDimensions(w, h);
m_Fractorium->m_WidthSpin->setValue(w);
m_Fractorium->m_HeightSpin->setValue(h);
//m_Fractorium->ui.GLParentScrollArea->setViewport(this);
glEnable(GL_TEXTURE_2D);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_MaxTexSize);
glDisable(GL_TEXTURE_2D);
m_Fractorium->m_WidthSpin->setMaximum(m_MaxTexSize);
m_Fractorium->m_HeightSpin->setMaximum(m_MaxTexSize);
//Start with a flock of 10 random embers. Can't do this until now because the window wasn't maximized yet, so the sizes would have been off.
m_Fractorium->OnActionNewFlock(false);
//m_Fractorium->repaint();
m_Fractorium->m_Controller->DelayedStartRenderTimer();
m_Init = true;
}
}
@ -512,7 +508,7 @@ void GLEmberController<T>::MousePress(QMouseEvent* e)
}
else//Nothing was selected.
{
//m_SelectedXform = NULL;
//m_SelectedXform = nullptr;
m_DragState = DragNone;
}
}
@ -783,7 +779,7 @@ bool GLWidget::Allocate(bool force)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_TexWidth, m_TexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_TexWidth, m_TexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
alloc = true;
}
@ -1089,7 +1085,7 @@ int GLEmberController<T>::UpdateHover(v3T& glCoords)
m_HoverType = HoverNone;
//If there's a selected/current xform, check it first so it gets precedence over the others.
if (m_SelectedXform != NULL)
if (m_SelectedXform != nullptr)
{
//These checks prevent highlighting the pre/post selected xform circle, when one is set to show all, and the other
//is set to show current, and the user hovers over another xform, but doesn't select it, then moves the mouse
@ -1452,7 +1448,7 @@ GLEmberControllerBase* GLWidget::GLController()
if (m_Fractorium && m_Fractorium->ControllersOk())
return m_Fractorium->m_Controller->GLController();
return NULL;
return nullptr;
}
template class GLEmberController<float>;

View File

@ -45,6 +45,7 @@ class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions_2_0//QOpenGLFu
public:
GLWidget(QWidget* p = nullptr);
~GLWidget();
void InitGL();
void DrawQuad();
void SetMainWindow(Fractorium* f);
bool Init();
@ -62,7 +63,7 @@ protected:
virtual void mouseMoveEvent(QMouseEvent* e) override;
virtual void wheelEvent(QWheelEvent* e) override;
//virtual void resizeEvent(QResizeEvent* e) override;
private:
void SetDimensions(int w, int h);
bool Allocate(bool force = false);

View File

@ -6,7 +6,7 @@
/// Constructor that takes a pointer to the settings object and the parent widget.
/// </summary>
/// <param name="settings">A pointer to the settings object to use</param>
/// <param name="p">The parent widget. Default: NULL.</param>
/// <param name="p">The parent widget. Default: nullptr.</param>
/// <param name="f">The window flags. Default: 0.</param>
FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, QWidget* p, Qt::WindowFlags f)
: QDialog(p, f)

View File

@ -7,7 +7,7 @@
/// and change its value using the mouse wheel without explicitly having to click
/// inside of it.
/// </summary>
/// <param name="p">The parent widget. Default: NULL.</param>
/// <param name="p">The parent widget. Default: nullptr.</param>
/// <param name="h">The height of the spin box. Default: 16.</param>
/// <param name="step">The step used to increment/decrement the spin box when using the mouse wheel. Default: 1.</param>
SpinBox::SpinBox(QWidget* p, int h, int step)