diff --git a/Builds/MSVC/VS2013/Ember.vcxproj b/Builds/MSVC/VS2013/Ember.vcxproj
index 51e8293..a302f49 100644
--- a/Builds/MSVC/VS2013/Ember.vcxproj
+++ b/Builds/MSVC/VS2013/Ember.vcxproj
@@ -144,7 +144,6 @@
-
diff --git a/Builds/MSVC/VS2013/Ember.vcxproj.filters b/Builds/MSVC/VS2013/Ember.vcxproj.filters
index 70e574d..88dd77d 100644
--- a/Builds/MSVC/VS2013/Ember.vcxproj.filters
+++ b/Builds/MSVC/VS2013/Ember.vcxproj.filters
@@ -128,9 +128,6 @@
Header Files\Variations
-
- Header Files
-
diff --git a/Builds/MSVC/VS2013/Fractorium.vcxproj b/Builds/MSVC/VS2013/Fractorium.vcxproj
index 5e3de1a..00001fe 100644
--- a/Builds/MSVC/VS2013/Fractorium.vcxproj
+++ b/Builds/MSVC/VS2013/Fractorium.vcxproj
@@ -158,6 +158,7 @@ xcopy /F /Y /R /D "$(QTDIR)\plugins\platforms\qwindows.dll" "$(OutDir)\platforms
+
@@ -198,6 +199,9 @@ xcopy /F /Y /R /D "$(QTDIR)\plugins\platforms\qwindows.dll" "$(OutDir)\platforms
true
+
+ true
+
true
@@ -255,6 +259,9 @@ xcopy /F /Y /R /D "$(QTDIR)\plugins\platforms\qwindows.dll" "$(OutDir)\platforms
true
+
+ true
+
true
@@ -311,6 +318,16 @@ xcopy /F /Y /R /D "$(QTDIR)\plugins\platforms\qwindows.dll" "$(OutDir)\platforms
$(QTDIR)\bin\moc.exe;%(FullPath)
$(QTDIR)\bin\moc.exe;%(FullPath)
+
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+ Moc%27ing LibraryTreeWidget.h...
+ .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp
+ "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/LibraryTreeWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)\include" "-I.\GeneratedFiles\$(ConfigurationName)\."
+ $(QTDIR)\bin\moc.exe;%(FullPath)
+ Moc%27ing LibraryTreeWidget.h...
+ .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp
+ "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fFractoriumPch.h" "-f../../../../../Source/Fractorium/LibraryTreeWidget.h" -DUNICODE -DWIN32 -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_HELP_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_MBCS "-I." "-I$(QTDIR)\include" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles" "-I$(ProjectDir)..\..\..\Fractorium\GeneratedFiles\ConfigurationName" "-I$(QTDIR)\..\qtmultimedia\include\QtMultimedia" "-I$(QTDIR)\..\qtmultimedia\include" "-I$(QTDIR)\..\qttools\include" "-I$(QTDIR)\..\qttools\include\QtHelp" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtXml" "-I.\GeneratedFiles" "-I$(ProjectDir)..\..\..\Source\Ember" "-I$(ProjectDir)..\..\..\Source\EmberCL" "-I$(ProjectDir)..\..\..\Source\EmberCommon" "-I$(ProjectDir)..\..\..\..\glm" "-I$(ProjectDir)..\..\..\..\tbb\include" "-I$(ProjectDir)..\..\..\..\libjpeg" "-I$(ProjectDir)..\..\..\..\libpng" "-I$(ProjectDir)..\..\..\..\libxml2\include" "-I$(AMDAPPSDKROOT)\include" "-I$(CUDA_PATH)\include" "-I.\GeneratedFiles\$(ConfigurationName)\."
+
diff --git a/Builds/MSVC/VS2013/Fractorium.vcxproj.filters b/Builds/MSVC/VS2013/Fractorium.vcxproj.filters
index 8dd37fd..36aabeb 100644
--- a/Builds/MSVC/VS2013/Fractorium.vcxproj.filters
+++ b/Builds/MSVC/VS2013/Fractorium.vcxproj.filters
@@ -257,6 +257,15 @@
Generated Files\Release
+
+ Generated Files\Debug
+
+
+ Generated Files\Release
+
+
+ Widgets
+
@@ -393,6 +402,9 @@
Dialogs\Qss
+
+ Widgets
+
diff --git a/Builds/QtCreator/Fractorium/Fractorium.pro b/Builds/QtCreator/Fractorium/Fractorium.pro
index 272f0ed..8231734 100644
--- a/Builds/QtCreator/Fractorium/Fractorium.pro
+++ b/Builds/QtCreator/Fractorium/Fractorium.pro
@@ -113,7 +113,8 @@ SOURCES += \
$$PRJ_SRC_DIR/QssDialog.cpp \
$$PRJ_SRC_DIR/QssTextEdit.cpp \
$$PRJ_SRC_DIR/SpinBox.cpp \
- $$PRJ_SRC_DIR/VariationsDialog.cpp
+ $$PRJ_SRC_DIR/VariationsDialog.cpp \
+ $$PRJ_SRC_DIR/LibraryTreeWidget.cpp
HEADERS += \
$$SRC_COMMON_DIR/EmberCommon.h \
@@ -148,7 +149,8 @@ HEADERS += \
$$PRJ_SRC_DIR/TableWidget.h \
$$PRJ_SRC_DIR/TwoButtonComboWidget.h \
$$PRJ_SRC_DIR/VariationsDialog.h \
- $$PRJ_SRC_DIR/VariationTreeWidgetItem.h
+ $$PRJ_SRC_DIR/VariationTreeWidgetItem.h \
+ $$PRJ_SRC_DIR/LibraryTreeWidget.h
FORMS += \
$$PRJ_SRC_DIR/AboutDialog.ui \
diff --git a/Builds/QtCreator/defaults.pri b/Builds/QtCreator/defaults.pri
index 83ad867..1a90047 100644
--- a/Builds/QtCreator/defaults.pri
+++ b/Builds/QtCreator/defaults.pri
@@ -158,7 +158,7 @@ win32 {
QMAKE_CXXFLAGS += -fPIC
QMAKE_CXXFLAGS += -fpermissive
QMAKE_CXXFLAGS += -pedantic
- QMAKE_CXXFLAGS += -std=c++11
+ QMAKE_CXXFLAGS += -std=c++14
QMAKE_CXXFLAGS += -Wnon-virtual-dtor
QMAKE_CXXFLAGS += -Wshadow
QMAKE_CXXFLAGS += -Winit-self
diff --git a/Source/Ember/CarToRas.h b/Source/Ember/CarToRas.h
index 265782b..54bf2a7 100644
--- a/Source/Ember/CarToRas.h
+++ b/Source/Ember/CarToRas.h
@@ -25,9 +25,7 @@ public:
///
/// Empty constructor. This class should never be used unless it's been properly constructed with the constructor that takes arguments.
///
- CarToRas()
- {
- }
+ CarToRas() = default;
///
/// Constructor that takes arguments to set up the bounds and passes them to Init().
diff --git a/Source/Ember/Ember.h b/Source/Ember/Ember.h
index 9643b21..16272be 100644
--- a/Source/Ember/Ember.h
+++ b/Source/Ember/Ember.h
@@ -44,9 +44,12 @@ public:
/// Default constructor which calls Init() to set default values.
///
Ember()
- : m_VariationList(VariationList::Instance())
{
- Init();
+ m_Background.Reset();
+ m_Curves.Init();
+ m_Xforms.reserve(12);
+ m_CamMat = m3T(0);
+ m_ProjFunc = &EmberNs::Ember::ProjectNone;
}
///
@@ -54,8 +57,6 @@ public:
///
/// The Ember object to copy
Ember(const Ember& ember)
- : m_Edits(nullptr),
- m_VariationList(VariationList::Instance())
{
Ember::operator=(ember);
}
@@ -66,8 +67,6 @@ public:
/// The Ember object to copy
template
Ember(const Ember& ember)
- : m_Edits(nullptr),
- m_VariationList(VariationList::Instance())
{
Ember::operator=(ember);
}
@@ -178,74 +177,10 @@ public:
if (ember.m_Edits)
m_Edits = xmlCopyDoc(ember.m_Edits, 1);
- CopyVec(m_EmberMotionElements, ember.m_EmberMotionElements);
+ CopyCont(m_EmberMotionElements, ember.m_EmberMotionElements);
return *this;
}
- ///
- /// Set common default values.
- ///
- void Init()
- {
- m_FinalRasW = 1920;
- m_FinalRasH = 1080;
- m_OrigFinalRasW = 1920;
- m_OrigFinalRasH = 1080;
- m_OrigPixPerUnit = 240;
- m_SubBatchSize = DEFAULT_SBS;
- m_FuseCount = 15;
- m_Supersample = 1;
- m_TemporalSamples = 100;
- m_Symmetry = 0;
- m_Quality = 100;
- m_PixelsPerUnit = 240;
- m_Zoom = 0;
- m_ProjFunc = &EmberNs::Ember::ProjectNone;
- m_CamZPos = 0;
- m_CamPerspective = 0;
- m_CamYaw = 0;
- m_CamPitch = 0;
- m_CamDepthBlur = 0;
- m_BlurCoef = 0;
- m_CamMat = m3T(0);
- m_CenterX = 0;
- m_CenterY = 0;
- m_RotCenterY = 0;
- m_Rotate = 0;
- m_Brightness = 4;
- m_Gamma = 4;
- m_Vibrancy = 1;
- m_GammaThresh = T(0.01);
- m_HighlightPower = -1;
- m_Time = 0;
- m_Background.Reset();
- m_Interp = eInterp::EMBER_INTERP_SMOOTH;
- m_AffineInterp = eAffineInterp::AFFINE_INTERP_LOG;
- //DE filter.
- m_MinRadDE = 0;
- m_MaxRadDE = 9;
- m_CurveDE = T(0.4);
- //Spatial filter.
- m_SpatialFilterType = eSpatialFilterType::GAUSSIAN_SPATIAL_FILTER;
- m_SpatialFilterRadius = T(0.5);
- //Temporal filter.
- m_TemporalFilterType = eTemporalFilterType::BOX_TEMPORAL_FILTER;
- m_TemporalFilterExp = 0;
- m_TemporalFilterWidth = 1;
- //Palette.
- m_PaletteMode = ePaletteMode::PALETTE_LINEAR;
- m_PaletteInterp = ePaletteInterp::INTERP_HSV;
- //Curves.
- m_Curves.Init();
- m_Name = "No name";
- m_ParentFilename = "No parent";
- //Internal values.
- m_Index = 0;
- m_ScaleType = eScaleType::SCALE_NONE;
- m_Xforms.reserve(12);
- m_Edits = nullptr;
- }
-
///
/// Add a copy of a new xform to the xforms vector.
///
@@ -286,7 +221,7 @@ public:
/// The total number of xforms if additional padding xforms are desired. Default: 0.
/// Whether to copy the final xform. Default: false.
/// The newly constructed ember
- Ember Copy(size_t xformPad = 0, bool doFinal = false)
+ Ember Copy(size_t xformPad = 0, bool doFinal = false) const
{
Ember ember(*this);
ember.PadXforms(xformPad);
@@ -443,7 +378,7 @@ public:
///
/// A pointer to the xform to test
/// True if matched, else false.
- bool IsFinalXform(Xform* xform)
+ bool IsFinalXform(Xform* xform) const
{
return &m_FinalXform == xform;
}
@@ -695,7 +630,7 @@ public:
/// Vector of embers
/// Coefficients vector which must be the same length as the vector of embers
/// Stagger if greater than 0
- void Interpolate(vector>& embers, vector& coefs, T stagger)
+ void Interpolate(const vector>& embers, vector& coefs, T stagger)
{
Interpolate(embers.data(), embers.size(), coefs, stagger);
}
@@ -708,7 +643,7 @@ public:
/// Number of elements in the buffer of embers
/// Coefficients vector which must be the same length as the vector of embers
/// Stagger if greater than 0
- void Interpolate(Ember* embers, size_t size, vector& coefs, T stagger)
+ void Interpolate(const Ember* embers, size_t size, vector& coefs, T stagger)
{
if (size != coefs.size() || size < 2)
return;
@@ -996,7 +931,7 @@ public:
///
/// Vector of embers
/// Used in calculating Catmull-Rom coefficients
- void InterpolateCatmullRom(vector>& embers, T t)
+ void InterpolateCatmullRom(const vector>& embers, T t)
{
InterpolateCatmullRom(embers.data(), embers.size(), t);
}
@@ -1008,7 +943,7 @@ public:
/// Pointer to buffer of embers
/// Number of elements in the buffer of embers
/// Used in calculating Catmull-Rom coefficients
- void InterpolateCatmullRom(Ember* embers, size_t size, T t)
+ void InterpolateCatmullRom(const Ember* embers, size_t size, T t)
{
T t2 = t * t;
T t3 = t2 * t;
@@ -1537,50 +1472,50 @@ public:
//The width and height in pixels of the final output image. The size of the histogram and DE filtering buffers will differ from this.
//Xml fields: "size".
- size_t m_FinalRasW;
- size_t m_FinalRasH;
- size_t m_OrigFinalRasW;//Keep track of the originals read from the Xml, because...
- size_t m_OrigFinalRasH;//the dimension may change in an editor and the originals are needed for the aspect ratio.
- T m_OrigPixPerUnit;
+ size_t m_FinalRasW = 1920;
+ size_t m_FinalRasH = 1080;
+ size_t m_OrigFinalRasW = 1920;//Keep track of the originals read from the Xml, because...
+ size_t m_OrigFinalRasH = 1080;//the dimension may change in an editor and the originals are needed for the aspect ratio.
+ T m_OrigPixPerUnit = 240;
//The iteration depth. This was a rendering parameter in flam3 but has been made a member here
//so that it can be adjusted more easily.
- size_t m_SubBatchSize;
+ size_t m_SubBatchSize = DEFAULT_SBS;
//The number of iterations to disregard for each sub batch. This was a rendering parameter in flam3 but has been made a member here
//so that it can be adjusted more easily.
- size_t m_FuseCount;
+ size_t m_FuseCount = 15;
//The multiplier in size of the histogram and DE filtering buffers. Must be at least one, preferrably never larger than 4, only useful at 2.
//Xml field: "supersample" or "overample (deprecated)".
- size_t m_Supersample;
+ size_t m_Supersample = 1;
//When animating, split each pass into this many pieces, each doing a fraction of the total iterations. Each temporal sample
//will render an interpolated instance of the ember that is a fraction of the current ember and the next one.
//When rendering a single image, this field is always set to 1.
//Xml field: "temporal_samples".
- size_t m_TemporalSamples;
+ size_t m_TemporalSamples = 100;
//Whether or not any symmetry was added. This field is in a bit of a state of conflict right now as flam3 has a severe bug.
//Xml field: "symmetry".
- intmax_t m_Symmetry;
+ intmax_t m_Symmetry = 0;
//The number of iterations per pixel of the final output image. Note this is not affected by the increase in pixels in the
//histogram and DE filtering buffer due to supersampling. It can be affected by a non-zero zoom value though.
//10 is a good value for interactive/real-time rendering, 100-200 is good for previewing, 1000 is good for final output. Above that is mostly a waste of energy.
//Xml field: "quality".
- T m_Quality;
+ T m_Quality = 100;
//The number of pixels in the final output image that corresponds to the distance from 0-1 in the cartesian plane used for iterating.
//A larger value produces a more zoomed in imgage. A value of 240 is commonly used, but in practice it varies widely depending on the image.
//Note that increasing this value does not adjust the quality by a proportional amount, so an increased value may produce a degraded image.
//Xml field: "scale".
- T m_PixelsPerUnit;
+ T m_PixelsPerUnit = 240;
//A value greater than 0 will zoom in the field of view, however it will also increase the quality by a proportional amount. This is used to
//overcome the shortcoming of scale by also adjusting the quality.
//Xml field: "zoom".
- T m_Zoom;
+ T m_Zoom = 0;
//3D fields.
private:
@@ -1589,22 +1524,22 @@ private:
public:
//Xml field: "cam_zpos".
- T m_CamZPos;
+ T m_CamZPos = 0;
//Xml field: "cam_persp".
- T m_CamPerspective;
+ T m_CamPerspective = 0;
//Xml field: "cam_yaw".
- T m_CamYaw;
+ T m_CamYaw = 0;
//Xml field: "cam_pitch".
- T m_CamPitch;
+ T m_CamPitch = 0;
//Xml field: "cam_dof".
- T m_CamDepthBlur;
+ T m_CamDepthBlur = 0;
private:
- T m_BlurCoef;
+ T m_BlurCoef = 0;
public:
m3T m_CamMat;
@@ -1612,38 +1547,38 @@ public:
//The camera offset from the center of the cartesian plane. Since this is the camera offset, the final output image will be moved in the opposite
//direction of the values specified. There is also a second copy of the Y coordinate needed because m_CenterY will be modified during strips rendering.
//Xml field: "center".
- T m_CenterX;
- T m_CenterY;
- T m_RotCenterY;
+ T m_CenterX = 0;
+ T m_CenterY = 0;
+ T m_RotCenterY = 0;
//Rotate the camera by this many degrees. Since this is a camera rotation, the final output image will be rotated counter-clockwise.
//Xml field: "rotate".
- T m_Rotate;
+ T m_Rotate = 0;
//Determine how bright to make the image during final accumulation.
//Xml field: "brightness".
- T m_Brightness;
+ T m_Brightness = 4;
//Gamma level used in gamma correction during final accumulation.
//Xml field: "gamma".
- T m_Gamma;
+ T m_Gamma = 4;
//Used in color correction during final accumulation.
//Xml field: "vibrancy".
- T m_Vibrancy;
+ T m_Vibrancy = 1;
//Gamma threshold used in gamma correction during final accumulation.
//Xml field: "gamma_threshold".
- T m_GammaThresh;
+ T m_GammaThresh = T(0.01);
//Value to control saturation of some pixels in gamma correction during final accumulation.
//Xml field: "highlight_power".
- T m_HighlightPower;
+ T m_HighlightPower = -1;
//When animating a file full of many embers, this value is used to specify the time in the animation
//that this ember should be rendered. They must all be sequential and increase by a default value of 1.
//Xml field: "time".
- T m_Time;
+ T m_Time = 0;
//The background color of the image used in final accumulation, ranged 0-1.
//Xml field: "background".
@@ -1653,66 +1588,66 @@ public:
//The type of interpolation to use when interpolating between embers for animation.
//Xml field: "interpolation".
- eInterp m_Interp;
+ eInterp m_Interp = eInterp::EMBER_INTERP_SMOOTH;
//The type of interpolation to use on affine transforms when interpolating embers for animation.
//Xml field: "interpolation_type" or "interpolation_space (deprecated)".
- eAffineInterp m_AffineInterp;
+ eAffineInterp m_AffineInterp = eAffineInterp::AFFINE_INTERP_LOG;
//The type of interpolation to use for the palette when interpolating embers for animation.
//Xml field: "palette_interpolation".
- ePaletteInterp m_PaletteInterp;
+ ePaletteInterp m_PaletteInterp = ePaletteInterp::INTERP_HSV;
//Temporal Filter.
//Only used if temporal filter type is exp, else unused.
//Xml field: "temporal_filter_exp".
- T m_TemporalFilterExp;
+ T m_TemporalFilterExp = 0;
//The width of the temporal filter.
//Xml field: "temporal_filter_width".
- T m_TemporalFilterWidth;
+ T m_TemporalFilterWidth = 1;
//The type of the temporal filter: Gaussian, Box or Exp.
//Xml field: "temporal_filter_type".
- eTemporalFilterType m_TemporalFilterType;
+ eTemporalFilterType m_TemporalFilterType = eTemporalFilterType::BOX_TEMPORAL_FILTER;
//Density Estimation Filter.
//The minimum radius of the DE filter.
//Xml field: "estimator_minimum".
- T m_MinRadDE;
+ T m_MinRadDE = 0;
//The maximum radius of the DE filter.
//Xml field: "estimator_radius".
- T m_MaxRadDE;
+ T m_MaxRadDE = 9;
//The shape of the curve that governs how quickly or slowly the filter drops off as it moves away from the center point.
//Xml field: "estimator_curve".
- T m_CurveDE;
+ T m_CurveDE = T(0.4);
//Spatial Filter.
//The radius of the spatial filter used in final accumulation.
//Xml field: "filter".
- T m_SpatialFilterRadius;
+ T m_SpatialFilterRadius = T(0.5);
//The type of spatial filter used in final accumulation:
//Gaussian, Hermite, Box, Triangle, Bell, Bspline, Lanczos3
//Lanczos2, Mitchell, Blackman, Catrom, Hamming, Hanning, Quadratic.
//Xml field: "filter_shape".
- eSpatialFilterType m_SpatialFilterType;
+ eSpatialFilterType m_SpatialFilterType = eSpatialFilterType::GAUSSIAN_SPATIAL_FILTER;
//Palette.
//The method used for retrieving a color from the palette when accumulating to the histogram: step, linear.
//Xml field: "palette_mode".
- ePaletteMode m_PaletteMode;
+ ePaletteMode m_PaletteMode = ePaletteMode::PALETTE_LINEAR;
//The color palette to use. Can be specified inline as Xml color fields, or as a hex buffer. Can also be specified
//as an index into the palette file with an optional hue rotation applied. Inserting as a hex buffer is the preferred method.
//Xml field: "color" or "colors" or "palette" .
- Palette m_Palette;
+ Palette m_Palette;//Final palette that is actually used is a copy of this inside of render, which will be of type bucketT (float).
//Curves used to adjust the color during final accumulation.
Curves m_Curves;
@@ -1721,18 +1656,18 @@ public:
//The name of this ember.
//Xml field: "name".
- string m_Name;
+ string m_Name = string("No name");
//The name of the file that this ember was contained in.
//Xml field: "".
- string m_ParentFilename;
+ string m_ParentFilename = string("No parent");
//An Xml edit document describing information about the author as well as an edit history of the ember.
//Xml field: "edit".
- xmlDocPtr m_Edits;
+ xmlDocPtr m_Edits = nullptr;
//The 0-based position of this ember in the file it was contained in.
- size_t m_Index;
+ size_t m_Index = 0;
//The list of motion elements for the top-level flame params
vector> m_EmberMotionElements;
@@ -1741,7 +1676,7 @@ private:
///
/// The type of scaling used when resizing.
///
- eScaleType m_ScaleType;
+ eScaleType m_ScaleType = eScaleType::SCALE_NONE;
//The vector containing all of the xforms.
//Xml field: "xform".
@@ -1753,7 +1688,7 @@ private:
Xform m_FinalXform;
//Single global reference to create variations with.
- VariationList& m_VariationList;
+ VariationList& m_VariationList = VariationList::Instance();
///
/// Interpolation function that takes the address of a member variable of type T as a template parameter.
@@ -1763,7 +1698,7 @@ private:
/// The list of coefficients to interpolate
/// The size of the lists, both must match.
template ::*m>
- void InterpT(Ember* embers, vector& coefs, size_t size)
+ void InterpT(const Ember* embers, const vector& coefs, size_t size)
{
this->*m = 0;
@@ -1778,7 +1713,7 @@ private:
/// The list of coefficients to interpolate
/// The size of the lists, both must match.
template ::*m>
- void InterpX(Ember* embers, vector& coefs, size_t size)
+ void InterpX(const Ember* embers, const vector& coefs, size_t size)
{
this->*m = M();
@@ -1793,7 +1728,7 @@ private:
/// The list of coefficients to interpolate
/// The size of the lists, both must match.
template ::*m>
- void InterpI(Ember* embers, vector& coefs, size_t size)
+ void InterpI(const Ember* embers, const vector& coefs, size_t size)
{
T t = 0;
@@ -1813,7 +1748,7 @@ private:
/// The list of coefficients to interpolate
/// The size of the lists, both must match.
template ::*m>
- void InterpXform(Xform* xform, size_t i, Ember* embers, vector& coefs, size_t size)
+ void InterpXform(Xform* xform, size_t i, const Ember* embers, const vector& coefs, size_t size)
{
xform->*m = T(0);
diff --git a/Source/Ember/EmberDefines.h b/Source/Ember/EmberDefines.h
index 61d36fe..cc8cc69 100644
--- a/Source/Ember/EmberDefines.h
+++ b/Source/Ember/EmberDefines.h
@@ -94,8 +94,10 @@ static inline size_t NowMs()
//These two must always match.
#ifdef _WIN32
#define ALIGN __declspec(align(16))
+ #define STATIC static
#else
#define ALIGN __attribute__ ((aligned (16)))
+ #define STATIC
#endif
#define ALIGN_CL "((aligned (16)))"//The extra parens are necessary.
diff --git a/Source/Ember/EmberMotion.h b/Source/Ember/EmberMotion.h
index 7690422..e841931 100644
--- a/Source/Ember/EmberMotion.h
+++ b/Source/Ember/EmberMotion.h
@@ -17,9 +17,7 @@ public:
///
/// Default constructor, which calls the base, which sets first and second to their defaults.
///
- MotionParam()
- {
- }
+ MotionParam() = default;
///
/// Member-wise constructor.
@@ -90,12 +88,8 @@ public:
///
/// Default constructor to initialize motion freq and offset to 0 and the motion func to SIN.
///
- EmberMotion()
- {
- m_MotionFreq = 0;
- m_MotionFunc = eMotion::MOTION_SIN;
- m_MotionOffset = 0;
- }
+ EmberMotion() = default;
+ ~EmberMotion() = default;
///
/// Default copy constructor.
@@ -136,16 +130,16 @@ public:
template
EmberMotion& operator = (const EmberMotion& other)
{
- CopyVec(m_MotionParams, other.m_MotionParams);
+ CopyCont(m_MotionParams, other.m_MotionParams);
m_MotionFunc = other.m_MotionFunc;
m_MotionFreq = T(other.m_MotionFreq);
m_MotionOffset = T(other.m_MotionOffset);
return *this;
}
- T m_MotionFreq;
- T m_MotionOffset;
- eMotion m_MotionFunc;
+ T m_MotionFreq = 0;
+ T m_MotionOffset = 0;
+ eMotion m_MotionFunc = eMotion::MOTION_SIN;
vector> m_MotionParams;
};
}
diff --git a/Source/Ember/EmberPch.h b/Source/Ember/EmberPch.h
index 4b0d4f1..0661215 100644
--- a/Source/Ember/EmberPch.h
+++ b/Source/Ember/EmberPch.h
@@ -40,6 +40,7 @@
#include
#include
#include
+#include
#ifdef __APPLE__
#include
#else
diff --git a/Source/Ember/EmberToXml.h b/Source/Ember/EmberToXml.h
index 3269833..3206bdb 100644
--- a/Source/Ember/EmberToXml.h
+++ b/Source/Ember/EmberToXml.h
@@ -23,9 +23,9 @@ public:
///
/// Empty constructor.
///
- EmberToXml()
- {
- }
+ EmberToXml() = default;
+ ~EmberToXml() = default;
+ EmberToXml(const EmberToXml& e) = delete;
///
/// Save the ember to the specified file.
@@ -34,33 +34,32 @@ public:
/// The ember to save
/// How deep the edit depth goes
/// If true included edit tags, else don't.
- /// If true use integers instead of floating point numbers when embedding a non-hex formatted palette, else use floating point numbers.
/// If true, embed a hexadecimal palette instead of Xml Color tags, else use Xml color tags.
/// If true, append to the file if it already exists, else create a new file.
/// Whether a new file is to be started
/// Whether an existing file is to be ended
/// True if successful, else false
- bool Save(const string& filename, Ember& ember, size_t printEditDepth, bool doEdits, bool intPalette, bool hexPalette, bool append = false, bool start = false, bool finish = false)
+ bool Save(const string& filename, Ember& ember, size_t printEditDepth, bool doEdits, bool hexPalette, bool append = false, bool start = false, bool finish = false)
{
vector> vec;
vec.push_back(ember);
- return Save(filename, vec, printEditDepth, doEdits, intPalette, hexPalette, append, start, finish);
+ return Save(filename, vec, printEditDepth, doEdits, hexPalette, append, start, finish);
}
///
- /// Save a vector of embers to the specified file.
+ /// Save a container of embers to the specified file.
///
/// Full path and filename
- /// The vector of embers to save
+ /// The container of embers to save
/// How deep the edit depth goes
/// If true included edit tags, else don't.
- /// If true use integers instead of floating point numbers when embedding a non-hex formatted palette, else use floating point numbers.
/// If true, embed a hexadecimal palette instead of Xml Color tags, else use Xml color tags.
/// If true, append to the file if it already exists, else create a new file.
/// Whether a new file is to be started
/// Whether an existing file is to be ended
/// True if successful, else false
- bool Save(const string& filename, vector>& embers, size_t printEditDepth, bool doEdits, bool intPalette, bool hexPalette, bool append = false, bool start = false, bool finish = false)
+ template class C>
+ bool Save(const string& filename, C, Alloc>& embers, size_t printEditDepth, bool doEdits, bool hexPalette, bool append = false, bool start = false, bool finish = false)
{
bool b = false;
bool hasTimes = false;
@@ -77,15 +76,19 @@ public:
if (f.is_open())
{
+ auto prev = embers.begin();
+
//Check to see if there are valid times by checking if any differed.
//If so, assume they were intentionally entered times.
- for (size_t i = 1; i < embers.size(); i++)
+ for (auto it = Advance(embers.begin(), 1); it != embers.end(); ++it)
{
- if (embers[i].m_Time != embers[i - 1].m_Time)
+ if (it->m_Time != prev->m_Time)
{
hasTimes = true;
break;
}
+
+ prev = it;
}
if (!hasTimes)
@@ -101,7 +104,7 @@ public:
for (auto& ember : embers)
{
- string s = ToString(ember, "", printEditDepth, doEdits, intPalette, hexPalette);
+ string s = ToString(ember, "", printEditDepth, doEdits, hexPalette);
f.write(s.c_str(), s.size());
}
@@ -144,10 +147,9 @@ public:
/// If true, add extra attributes, else don't
/// How deep the edit depth goes
/// If true included edit tags, else don't.
- /// If true use integers instead of floating point numbers when embedding a non-hex formatted palette, else use floating point numbers.
/// If true, embed a hexadecimal palette instead of Xml Color tags, else use Xml color tags.
/// The Xml string representation of the passed in ember
- string ToString(Ember& ember, const string& extraAttributes, size_t printEditDepth, bool doEdits, bool intPalette, bool hexPalette = true)
+ string ToString(Ember& ember, const string& extraAttributes, size_t printEditDepth, bool doEdits, bool hexPalette = true)
{
size_t i, j;
string s;
@@ -292,19 +294,9 @@ public:
//The original used a precision of 6 which is totally unnecessary, use 2.
if (IsClose(a, 255.0))
- {
- if (intPalette)
- os << "";
- else
- os << "";
- }
+ os << "";
else
- {
- if (intPalette)
- os << " ";
- else
- os << " ";
- }
+ os << " ";
os << "\n";
}
diff --git a/Source/Ember/Interpolate.h b/Source/Ember/Interpolate.h
index e89bbec..6626f16 100644
--- a/Source/Ember/Interpolate.h
+++ b/Source/Ember/Interpolate.h
@@ -38,7 +38,7 @@ public:
/// The array of embers to align
/// The array which will contain the aligned embers
/// The number of elements in sourceEmbers
- static void Align(Ember* sourceEmbers, Ember* destEmbers, size_t count)
+ static void Align(const Ember* sourceEmbers, Ember* destEmbers, size_t count)
{
bool aligned = true;
bool currentFinal, final = sourceEmbers[0].UseFinalXform();
@@ -297,7 +297,7 @@ public:
///
/// The vector of embers to inspect for xaos
/// True if at least one ember contained xaos, else false.
- static bool AnyXaosPresent(vector>& embers)
+ static bool AnyXaosPresent(const vector>& embers)
{
return AnyXaosPresent(embers.data(), embers.size());
}
@@ -308,7 +308,7 @@ public:
/// The array of embers to inspect
/// The size of the embers array
/// True if at least one ember contained xaos, else false.
- static bool AnyXaosPresent(Ember* embers, size_t size)
+ static bool AnyXaosPresent(const Ember* embers, size_t size)
{
for (size_t i = 0; i < size; i++)
if (embers[i].XaosPresent())
@@ -333,7 +333,7 @@ public:
/// The array of embers to inspect
/// The size of the embers array
/// The greatest non-final xform count in any of the embers
- static size_t MaxXformCount(Ember* embers, size_t size)
+ static size_t MaxXformCount(const Ember* embers, size_t size)
{
size_t i, maxCount = 0;
@@ -349,7 +349,7 @@ public:
///
/// The vector of embers to inspect the presence of a final xform
/// True if any contained a non-empty final xform, else false.
- static bool AnyFinalPresent(vector>& embers)
+ static bool AnyFinalPresent(const vector>& embers)
{
return AnyFinalPresent(embers.data(), embers.size());
}
@@ -360,7 +360,7 @@ public:
/// The array of embers to inspect the presence of a final xform
/// The size of the embers array
/// True if any contained a final xform, else false.
- static bool AnyFinalPresent(Ember* embers, size_t size)
+ static bool AnyFinalPresent(const Ember* embers, size_t size)
{
for (size_t i = 0; i < size; i++)
if (embers[i].UseFinalXform())
@@ -376,7 +376,7 @@ public:
/// The time position in the vector specifying the point of interpolation
/// Stagger if > 0
/// The interpolated result
- static void Interpolate(vector>& embers, T time, T stagger, Ember& result)
+ static void Interpolate(const vector>& embers, T time, T stagger, Ember& result)
{
Interpolate(embers.data(), embers.size(), time, stagger, result);
}
@@ -389,7 +389,7 @@ public:
/// The time position in the vector specifying the point of interpolation
/// Stagger if > 0
/// The interpolated result
- static void Interpolate(Ember* embers, size_t size, T time, T stagger, Ember& result)
+ static void Interpolate(const Ember* embers, size_t size, T time, T stagger, Ember& result)
{
if (size == 1)
{
@@ -585,7 +585,7 @@ public:
/// The vec2 vector to store the polar angular values
/// The vec2 vector to store the polar magnitude values
/// The vec2 vector to store the polar translation values
- static void ConvertLinearToPolar(vector>& embers, size_t xfi, size_t cflag, vector& cxAng, vector& cxMag, vector& cxTrn)
+ static void ConvertLinearToPolar(const vector>& embers, size_t xfi, size_t cflag, vector& cxAng, vector& cxMag, vector& cxTrn)
{
ConvertLinearToPolar(embers.data(), embers.size(), xfi, cflag, cxAng, cxMag, cxTrn);
}
@@ -601,7 +601,7 @@ public:
/// The vec2 vector to store the polar angular values
/// The vec2 vector to store the polar magnitude values
/// The vec2 vector to store the polar translation values
- static void ConvertLinearToPolar(Ember* embers, size_t size, size_t xfi, size_t cflag, vector& cxAng, vector& cxMag, vector& cxTrn)
+ static void ConvertLinearToPolar(const Ember* embers, size_t size, size_t xfi, size_t cflag, vector& cxAng, vector& cxMag, vector& cxTrn)
{
if (size == cxAng.size() &&
size == cxMag.size() &&
@@ -765,7 +765,7 @@ public:
/// The vec2 vector to store the polar magnitude values
/// The vec2 vector to store the polar translation values
/// The Affine2D to store the inerpolated values in
- static void InterpAndConvertBack(vector& coefs, vector& cxAng, vector& cxMag, vector& cxTrn, Affine2D& store)
+ static void InterpAndConvertBack(const vector& coefs, const vector& cxAng, const vector& cxMag, const vector& cxTrn, Affine2D& store)
{
size_t size = coefs.size();
glm::length_t i, col, accmode[2] = { 0, 0 };
diff --git a/Source/Ember/Isaac.h b/Source/Ember/Isaac.h
index 220317f..58e0298 100644
--- a/Source/Ember/Isaac.h
+++ b/Source/Ember/Isaac.h
@@ -56,7 +56,7 @@ class EMBER_API QTIsaac
public:
enum { N = (1 << ALPHA) };
UintBytes m_Cache;
- size_t m_LastIndex;
+ size_t m_LastIndex = 0;
///
/// The structure which holds all of the random information.
@@ -85,7 +85,6 @@ public:
QTIsaac(T a = 0, T b = 0, T c = 0, T* s = nullptr)
{
Srand(a, b, c, s);
- m_LastIndex = 0;
m_Cache.Uint = Rand();
RandByte();//Need to call at least once so other libraries can link.
}
diff --git a/Source/Ember/Iterator.h b/Source/Ember/Iterator.h
index b6a2cc0..1f9734c 100644
--- a/Source/Ember/Iterator.h
+++ b/Source/Ember/Iterator.h
@@ -52,18 +52,11 @@ class EMBER_API Iterator
{
public:
///
- /// Empty constructor.
+ /// Empty constructor and virtual destructor so proper derived class destructors get called.
///
- Iterator()
- {
- }
-
- ///
- /// Empty virtual destructor so proper derived class destructors get called.
- ///
- virtual ~Iterator()
- {
- }
+ Iterator() = default;
+ virtual ~Iterator() = default;
+ Iterator(const Iterator& iter) = delete;
///
/// Accessors.
diff --git a/Source/Ember/Palette.h b/Source/Ember/Palette.h
index 6bab110..18c58fc 100644
--- a/Source/Ember/Palette.h
+++ b/Source/Ember/Palette.h
@@ -25,8 +25,6 @@ public:
///
Palette()
{
- m_Name = "-";
- m_Index = -1;
m_Entries.resize(COLORMAP_LENGTH);
Clear();
}
@@ -119,12 +117,9 @@ public:
}
///
- /// Empty destructor.
/// Needed to eliminate warnings about inlining.
///
- ~Palette()
- {
- }
+ ~Palette() = default;
///
/// Default assignment operator.
@@ -149,7 +144,7 @@ public:
m_Index = palette.m_Index;
m_Name = palette.m_Name;
m_Filename = palette.m_Filename;
- CopyVec(m_Entries, palette.m_Entries);
+ CopyCont(m_Entries, palette.m_Entries);
return *this;
}
@@ -163,6 +158,16 @@ public:
return m_Entries[i];
}
+ ///
+ /// Convenience [] operator to index into the color entries vector in a const context.
+ ///
+ /// The index to get
+ /// The color value at the specified index
+ const v4T& operator[] (size_t i) const
+ {
+ return m_Entries[i];
+ }
+
///
/// Convenience * operator to get a pointer to the beginning of the color entries vector.
///
@@ -421,7 +426,7 @@ public:
///
/// The RGB buffer
/// The HSV buffer
- static void RgbToHsv(T* rgb, T* hsv)
+ static void RgbToHsv(const T* rgb, T* hsv)
{
RgbToHsv(rgb[0], rgb[1], rgb[2], hsv[0], hsv[1], hsv[2]);
}
@@ -576,9 +581,9 @@ public:
}
}
- int m_Index;//Index in the xml palette file of this palette, use -1 for random.
- string m_Name;//Name of this palette.
+ int m_Index = -1;//Index in the xml palette file of this palette, use -1 for random.
+ string m_Name = "-";//Name of this palette.
shared_ptr m_Filename;//Name of the parent file this palette came from, can be empty.
- vector m_Entries;//Storage for the color values.
+ vector m_Entries;
};
}
diff --git a/Source/Ember/PaletteList.h b/Source/Ember/PaletteList.h
index 702fb13..d782d85 100644
--- a/Source/Ember/PaletteList.h
+++ b/Source/Ember/PaletteList.h
@@ -28,6 +28,9 @@ public:
Add(string(m_DefaultFilename));
}
+ ~PaletteList() = default;
+ PaletteList(const PaletteList& paletteList) = delete;
+
///
/// Read an Xml palette file into memory.
/// This must be called before any palette file usage.
diff --git a/Source/Ember/Point.h b/Source/Ember/Point.h
index d4e8274..a71bee2 100644
--- a/Source/Ember/Point.h
+++ b/Source/Ember/Point.h
@@ -25,10 +25,8 @@ public:
///
/// Constructor to initialize spatial and color coordinates to zero, with full visibility.
///
- Point()
- {
- Init();
- }
+ Point() = default;
+ ~Point() = default;
///
/// Default copy constructor.
@@ -75,29 +73,16 @@ public:
m_ColorX = point.m_ColorX;
//m_ColorY = point.m_ColorY;
m_VizAdjusted = point.m_VizAdjusted;
-
return *this;
}
- ///
- /// Set spatial and color coordinates to zero, with full visibility.
- ///
- void Init()
- {
- m_X = 0;
- m_Y = 0;
- m_Z = 0;
- m_ColorX = 0;
- //m_ColorY = 0;
- m_VizAdjusted = 1;
- }
-
- T m_X;
- T m_Y;
- T m_Z;
- T m_ColorX;
+ //Set spatial and color coordinates to zero, with full visibility.
+ T m_X = 0;
+ T m_Y = 0;
+ T m_Z = 0;
+ T m_ColorX = 0;
//T m_ColorY;
- T m_VizAdjusted;
+ T m_VizAdjusted = 1;
};
///
@@ -132,10 +117,10 @@ template
struct EMBER_API Color : public v4T
{
#ifndef _WIN32
-using v4T::r;
-using v4T::g;
-using v4T::b;
-using v4T::a;
+ using v4T::r;
+ using v4T::g;
+ using v4T::b;
+ using v4T::a;
#endif
public:
///
diff --git a/Source/Ember/Renderer.cpp b/Source/Ember/Renderer.cpp
index ab87d37..d780bd4 100644
--- a/Source/Ember/Renderer.cpp
+++ b/Source/Ember/Renderer.cpp
@@ -3,27 +3,6 @@
namespace EmberNs
{
-///
-/// Constructor that sets default values and allocates iterators.
-/// The thread count is set to the number of cores detected on the system.
-///
-template
-Renderer::Renderer()
-{
- m_PixelAspectRatio = 1;
- m_StandardIterator = unique_ptr>(new StandardIterator());
- m_XaosIterator = unique_ptr>(new XaosIterator());
- m_Iterator = m_StandardIterator.get();
-}
-
-///
-/// Virtual destructor so derived class destructors get called.
-///
-template
-Renderer::~Renderer()
-{
-}
-
///
/// Non-virtual processing functions.
///
@@ -89,7 +68,7 @@ void Renderer::ComputeBounds()
////Check the size of the density estimation filter.
////If the radius of the density estimation filter is greater than the
////gutter width, have to pad with more. Otherwise, use the same value.
- //for (auto& ember : m_Embers)
+ //for (auto& ember : *m_EmbersP)
// maxDEFilterWidth = std::max(size_t(ceil(ember.m_MaxRadDE) * m_Ember.m_Supersample), maxDEFilterWidth);
//
////Need an extra ss = (int)floor(m_Supersample / 2.0) of pixels so that a local iteration count for DE can be determined.//SMOULDER
@@ -162,7 +141,7 @@ void Renderer::ComputeCamera()
/// However, changing only the brightness and setting action to ACCUM_ONLY is perfectly fine.
///
template
-void Renderer::SetEmber(Ember& ember, eProcessAction action)
+void Renderer::SetEmber(const Ember& ember, eProcessAction action)
{
ChangeVal([&]
{
@@ -170,26 +149,64 @@ void Renderer::SetEmber(Ember& ember, eProcessAction action)
m_Embers.push_back(ember);
m_Embers[0].m_TemporalSamples = 1;//Set temporal samples here to 1 because using the real value only makes sense when using a vector of Embers for animation.
m_Ember = m_Embers[0];
+ m_EmbersP = &m_Embers;
}, action);
}
///
-/// Set the vector of embers and set the m_Ember member to a copy of the first element.
+/// Copy the embers in the passed in container to the internal vector of embers
+/// and set the m_Ember member to a copy of the first element.
/// Reset the rendering process.
///
-/// The vector of embers
+/// The container of embers to be copied
template
-void Renderer::SetEmber(vector>& embers)
+template
+void Renderer::SetEmber(const C& embers)
{
ChangeVal([&]
{
- m_Embers = embers;
+ CopyCont(m_Embers, embers);
+ m_EmbersP = &m_Embers;
if (!m_Embers.empty())
m_Ember = m_Embers[0];
}, eProcessAction::FULL_RENDER);
}
+///
+/// Move the embers in the passed in vector to the internal vector of embers
+/// and set the m_Ember member to a copy of the first element.
+/// Reset the rendering process.
+/// This is preferred over SetEmber when the size of embers is large and/or
+/// the caller no longer needs to use the argument after this function returns.
+///
+/// The vector of embers to be moved
+template
+void Renderer::MoveEmbers(vector>& embers)
+{
+ ChangeVal([&]
+ {
+ m_Embers = std::move(embers);
+ m_EmbersP = &m_Embers;
+
+ if (!m_Embers.empty())
+ m_Ember = m_Embers[0];
+ }, eProcessAction::FULL_RENDER);
+}
+
+template
+void Renderer::SetExternalEmbersPointer(vector>* embers)
+{
+ ChangeVal([&]
+ {
+ m_Embers.clear();
+ m_EmbersP = embers;
+
+ if (!m_EmbersP->empty())
+ m_Ember = (*m_EmbersP)[0];
+ }, eProcessAction::FULL_RENDER);
+}
+
///
/// Create the density filter if the current filter parameters differ
/// from the last density filter created.
@@ -213,7 +230,7 @@ bool Renderer::CreateDEFilter(bool& newAlloc)
(m_Ember.m_CurveDE != m_DensityFilter->Curve()) ||
(m_Ember.m_Supersample != m_DensityFilter->Supersample()))
{
- m_DensityFilter = unique_ptr>(new DensityFilter(bucketT(m_Ember.m_MinRadDE), bucketT(m_Ember.m_MaxRadDE), bucketT(m_Ember.m_CurveDE), m_Ember.m_Supersample));
+ m_DensityFilter = make_unique>(bucketT(m_Ember.m_MinRadDE), bucketT(m_Ember.m_MaxRadDE), bucketT(m_Ember.m_CurveDE), m_Ember.m_Supersample);
newAlloc = true;
}
@@ -384,7 +401,7 @@ eRenderStatus Renderer::Run(vector& finalImage, double time, s
//Vib, gam and background are normally summed for each temporal sample. However if iteration is skipped, make sure to get the latest.
if ((filterAndAccumOnly || accumOnly) && TemporalSamples() == 1)//Disallow jumping when temporal samples > 1.
{
- m_Ember = m_Embers[0];
+ m_Ember = (*m_EmbersP)[0];
m_Vibrancy = Vibrancy();
m_Gamma = Gamma();
m_Background = m_Ember.m_Background;
@@ -398,8 +415,8 @@ eRenderStatus Renderer::Run(vector& finalImage, double time, s
//it.Tic();
//Interpolate.
- if (m_Embers.size() > 1)
- Interpolater::Interpolate(m_Embers, T(time), 0, m_Ember);
+ if (m_EmbersP->size() > 1)
+ Interpolater::Interpolate(*m_EmbersP, T(time), 0, m_Ember);
//it.Toc("Interp 1");
@@ -436,8 +453,8 @@ eRenderStatus Renderer::Run(vector& finalImage, double time, s
//Interpolate and get an ember for DE purposes.
//Additional interpolation will be done in the temporal samples loop.
//it.Tic();
- if (m_Embers.size() > 1)
- Interpolater::Interpolate(m_Embers, deTime, 0, m_Ember);
+ if (m_EmbersP->size() > 1)
+ Interpolater::Interpolate(*m_EmbersP, deTime, 0, m_Ember);
//it.Toc("Interp 2");
ClampGteRef(m_Ember.m_MinRadDE, 0);
@@ -461,8 +478,8 @@ eRenderStatus Renderer::Run(vector& finalImage, double time, s
//Interpolate again.
//it.Tic();
- if (TemporalSamples() > 1 && m_Embers.size() > 1)
- Interpolater::Interpolate(m_Embers, temporalTime, 0, m_Ember);//This will perform all necessary precalcs via the ember/xform/variation assignment operators.
+ if (TemporalSamples() > 1 && m_EmbersP->size() > 1)
+ Interpolater::Interpolate(*m_EmbersP, temporalTime, 0, m_Ember);//This will perform all necessary precalcs via the ember/xform/variation assignment operators.
//it.Toc("Interp 3");
@@ -678,16 +695,15 @@ Finish:
/// Run() should have completed before calling this.
///
/// The depth of the edit tags
-/// If true use integers instead of floating point numbers when embedding a non-hex formatted palette, else use floating point numbers.
/// If true, embed a hexadecimal palette instead of Xml Color tags, else use Xml color tags.
/// The EmberImageComments object with image comments filled out
template
-EmberImageComments Renderer::ImageComments(const EmberStats& stats, size_t printEditDepth, bool intPalette, bool hexPalette)
+EmberImageComments Renderer::ImageComments(const EmberStats& stats, size_t printEditDepth, bool hexPalette)
{
ostringstream ss;
EmberImageComments comments;
ss.imbue(std::locale(""));
- comments.m_Genome = m_EmberToXml.ToString(m_Ember, "", printEditDepth, false, intPalette, hexPalette);
+ comments.m_Genome = m_EmberToXml.ToString(m_Ember, "", printEditDepth, false, hexPalette);
ss << (double(stats.m_Badvals) / double(stats.m_Iters));//Percentage of bad values to iters.
comments.m_Badvals = ss.str(); ss.str("");
ss << stats.m_Iters;
@@ -1702,8 +1718,12 @@ void Renderer::CurveAdjust(bucketT& a, const glm::length_t& index)
//So the explicit instantiation must be declared here rather than in Ember.cpp where
//all of the other classes are done.
template EMBER_API class Renderer;
+template EMBER_API void Renderer::SetEmber(const vector>& embers);
+template EMBER_API void Renderer::SetEmber(const list>& embers);
#ifdef DO_DOUBLE
template EMBER_API class Renderer;
+ template EMBER_API void Renderer::SetEmber(const vector>& embers);
+ template EMBER_API void Renderer::SetEmber(const list>& embers);
#endif
}
diff --git a/Source/Ember/Renderer.h b/Source/Ember/Renderer.h
index 6e0d7d0..cc942d5 100644
--- a/Source/Ember/Renderer.h
+++ b/Source/Ember/Renderer.h
@@ -43,10 +43,12 @@ namespace EmberNs
template
class EMBER_API Renderer : public RendererBase
{
-//using EmberReport::m_ErrorReport;
public:
- Renderer();
- virtual ~Renderer();
+
+ Renderer() = default;
+ Renderer(const Renderer& renderer) = delete;
+ Renderer& operator = (const Renderer& renderer) = delete;
+ virtual ~Renderer() = default;
//Non-virtual processing functions.
void AddEmber(Ember& ember);
@@ -56,14 +58,17 @@ public:
virtual void ComputeBounds() override;
virtual void ComputeQuality() override;
virtual void ComputeCamera() override;
- virtual void SetEmber(Ember& ember, eProcessAction action = eProcessAction::FULL_RENDER) override;
- virtual void SetEmber(vector>& embers) override;
+ virtual void SetEmber(const Ember& ember, eProcessAction action = eProcessAction::FULL_RENDER) override;
+ template
+ void SetEmber(const C& embers);
+ void MoveEmbers(vector>& embers);
+ void SetExternalEmbersPointer(vector>* embers);
virtual bool CreateDEFilter(bool& newAlloc) override;
virtual bool CreateSpatialFilter(bool& newAlloc) override;
virtual bool CreateTemporalFilter(bool& newAlloc) override;
virtual size_t HistBucketSize() const override { return sizeof(tvec4); }
virtual eRenderStatus Run(vector& finalImage, double time = 0, size_t subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) override;
- virtual EmberImageComments ImageComments(const EmberStats& stats, size_t printEditDepth = 0, bool intPalette = false, bool hexPalette = true) override;
+ virtual EmberImageComments ImageComments(const EmberStats& stats, size_t printEditDepth = 0, bool hexPalette = true) override;
protected:
//New virtual functions to be overridden in derived renderers that use the GPU, but not accessed outside.
@@ -158,7 +163,7 @@ protected:
T m_Scale;
T m_PixelsPerUnitX;
T m_PixelsPerUnitY;
- T m_PixelAspectRatio;
+ T m_PixelAspectRatio = 1;
T m_LowerLeftX;
T m_LowerLeftY;
T m_UpperRightX;
@@ -173,12 +178,16 @@ protected:
Ember m_Ember;
Ember m_TempEmber;
Ember m_LastEmber;
+private:
vector> m_Embers;
+
+protected:
+ vector>* m_EmbersP = &m_Embers;
vector> m_ThreadEmbers;
CarToRas m_CarToRas;
- Iterator* m_Iterator;
- unique_ptr> m_StandardIterator;
- unique_ptr> m_XaosIterator;
+ unique_ptr> m_StandardIterator = make_unique>();
+ unique_ptr> m_XaosIterator = make_unique>();
+ Iterator* m_Iterator = m_StandardIterator.get();
Palette m_Dmap, m_Csa;
vector> m_HistBuckets;
vector> m_AccumulatorBuckets;
diff --git a/Source/Ember/RendererBase.cpp b/Source/Ember/RendererBase.cpp
index d39889a..02c27e6 100644
--- a/Source/Ember/RendererBase.cpp
+++ b/Source/Ember/RendererBase.cpp
@@ -8,31 +8,8 @@ namespace EmberNs
/// The thread count is set to the number of cores detected on the system.
///
RendererBase::RendererBase()
- : m_TaskGroup(new tbb::task_group)
{
- m_Abort = false;
- m_LockAccum = false;
- m_EarlyClip = false;
- m_YAxisUp = false;
- m_InsertPalette = false;
- m_ReclaimOnResize = false;
- m_CurvesSet = false;
- m_NumChannels = 3;
- m_BytesPerChannel = 1;
- m_SuperSize = 0;
- m_Transparency = false;
ThreadCount(Timing::ProcessorCount());
- m_Callback = nullptr;
- m_ProgressParameter = nullptr;
- m_LastTemporalSample = 0;
- m_LastIter = 0;
- m_LastIterPercent = 0;
- m_InteractiveFilter = eInteractiveFilter::FILTER_LOG;
- m_Priority = eThreadPriority::NORMAL;
- m_ProcessState = eProcessState::NONE;
- m_ProcessAction = eProcessAction::FULL_RENDER;
- m_InRender = false;
- m_InFinalAccum = false;
}
///
diff --git a/Source/Ember/RendererBase.h b/Source/Ember/RendererBase.h
index fbdcabc..36bb163 100644
--- a/Source/Ember/RendererBase.h
+++ b/Source/Ember/RendererBase.h
@@ -21,10 +21,13 @@ namespace EmberNs
class EMBER_API RenderCallback
{
public:
+ RenderCallback() = default;
+ RenderCallback(RenderCallback& callback) = delete;
+
///
/// Virtual destructor to ensure anything declared in derived classes gets cleaned up.
///
- virtual ~RenderCallback() { }
+ virtual ~RenderCallback() = default;
///
/// Empty progress function to be implemented in derived classes to take action on progress updates.
@@ -91,10 +94,11 @@ enum class eRendererType : et { CPU_RENDERER, OPENCL_RENDERER };
///
class EMBER_API RendererBase : public EmberReport
{
-//using EmberReport::m_ErrorReport;
public:
RendererBase();
- virtual ~RendererBase() { }
+ RendererBase(const RendererBase& renderer) = delete;
+ RendererBase& operator = (const RendererBase& renderer) = delete;
+ virtual ~RendererBase() = default;
//Non-virtual processing functions.
void ChangeVal(std::function func, eProcessAction action);
@@ -106,10 +110,8 @@ public:
//Virtual processing functions.
virtual bool Ok() const;
virtual size_t MemoryAvailable();
- virtual void SetEmber(Ember& ember, eProcessAction action = eProcessAction::FULL_RENDER) { }
- virtual void SetEmber(vector>& embers) { }
- virtual void SetEmber(Ember& ember, eProcessAction action = eProcessAction::FULL_RENDER) { }
- virtual void SetEmber(vector>& embers) { }
+ virtual void SetEmber(const Ember& ember, eProcessAction action = eProcessAction::FULL_RENDER) { }
+ virtual void SetEmber(const Ember& ember, eProcessAction action = eProcessAction::FULL_RENDER) { }
virtual bool RandVec(vector>& randVec);
//Abstract processing functions.
@@ -120,7 +122,7 @@ public:
virtual void ComputeQuality() = 0;
virtual void ComputeCamera() = 0;
virtual eRenderStatus Run(vector& 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 intPalette = false, bool hexPalette = true) = 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.
@@ -193,41 +195,41 @@ public:
bool InRender();
bool InFinalAccum();
- void* m_ProgressParameter;
+ void* m_ProgressParameter = nullptr;
protected:
- bool m_EarlyClip;
- bool m_YAxisUp;
- bool m_Transparency;
- bool m_LockAccum;
- bool m_InRender;
- bool m_InFinalAccum;
- bool m_InsertPalette;
- bool m_ReclaimOnResize;
- bool m_CurvesSet;
- volatile bool m_Abort;
+ bool m_EarlyClip = false;
+ bool m_YAxisUp = false;
+ bool m_Transparency = 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;
size_t m_SuperRasW;
size_t m_SuperRasH;
- size_t m_SuperSize;
+ size_t m_SuperSize = 0;
size_t m_GutterWidth;
size_t m_DensityFilterOffset;
- size_t m_NumChannels;
- size_t m_BytesPerChannel;
+ size_t m_NumChannels = 3;
+ size_t m_BytesPerChannel = 1;
size_t m_ThreadsToUse;
size_t m_VibGamCount;
- size_t m_LastTemporalSample;
- size_t m_LastIter;
- double m_LastIterPercent;
- eThreadPriority m_Priority;
- eProcessAction m_ProcessAction;
- eProcessState m_ProcessState;
- eInteractiveFilter m_InteractiveFilter;
+ 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;
+ RenderCallback* m_Callback = nullptr;
vector m_SubBatch;
vector m_BadVals;
vector> m_Rand;
- auto_ptr m_TaskGroup;
+ unique_ptr m_TaskGroup = make_unique();
std::recursive_mutex m_RenderingCs, m_AccumCs, m_FinalAccumCs, m_ResizeCs;
Timing m_RenderTimer, m_IterTimer, m_ProgressTimer;
};
diff --git a/Source/Ember/SheepTools.h b/Source/Ember/SheepTools.h
index 87853c3..60c2f87 100644
--- a/Source/Ember/SheepTools.h
+++ b/Source/Ember/SheepTools.h
@@ -65,19 +65,14 @@ public:
: m_VariationList(VariationList::Instance())
{
Timing t;
- m_Smooth = true;
- m_SheepGen = -1;
- m_SheepId = -1;
- m_Stagger = 0;
- m_OffsetX = 0;
- m_OffsetY = 0;
m_PaletteList.Add(palettePath);
- m_StandardIterator = unique_ptr>(new StandardIterator());
- m_XaosIterator = unique_ptr>(new XaosIterator());
m_Renderer = unique_ptr>(renderer);
m_Rand = QTIsaac(ISAAC_INT(t.Tic()), ISAAC_INT(t.Tic() * 2), ISAAC_INT(t.Tic() * 3));
}
+ SheepTools(const SheepTools& sheepTools) = delete;
+ SheepTools& operator = (const SheepTools& sheepTools) = delete;
+
///
/// Create the linear default ember with a random palette.
///
@@ -1329,12 +1324,12 @@ public:
}
private:
- bool m_Smooth;
- intmax_t m_SheepGen;
- intmax_t m_SheepId;
- T m_Stagger;
- T m_OffsetX;
- T m_OffsetY;
+ bool m_Smooth = true;
+ intmax_t m_SheepGen = -1;
+ intmax_t m_SheepId = -1;
+ T m_Stagger = 0;
+ T m_OffsetX = 0;
+ T m_OffsetY = 0;
string m_Nick;
string m_Url;
string m_Id;
@@ -1345,8 +1340,8 @@ private:
vector m_Hist;
EmberToXml m_EmberToXml;
Iterator* m_Iterator;
- unique_ptr> m_StandardIterator;
- unique_ptr> m_XaosIterator;
+ unique_ptr> m_StandardIterator = make_unique>();
+ unique_ptr> m_XaosIterator = make_unique>();
unique_ptr> m_Renderer;
QTIsaac m_Rand;
PaletteList m_PaletteList;
diff --git a/Source/Ember/Utils.h b/Source/Ember/Utils.h
index f90a75a..5f3db64 100644
--- a/Source/Ember/Utils.h
+++ b/Source/Ember/Utils.h
@@ -72,12 +72,16 @@ class EMBER_API EmberImageComments
{
public:
///
- /// Empty destructor.
+ /// Basic defaults.
+ ///
+ EmberImageComments() = default;
+ EmberImageComments(const EmberImageComments& comments) = default;
+ EmberImageComments& operator = (const EmberImageComments& comments) = default;
+
+ ///
/// Needed to eliminate warnings about inlining.
///
- ~EmberImageComments()
- {
- }
+ ~EmberImageComments() = default;
///
/// Set all values to the empty string.
@@ -304,81 +308,105 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
}
///
-/// Clear dest and copy all of the elements of vector source with elements of type U to the vector
-/// dest with elements of type T.
+/// Thin wrapper around std::advance that returns the advanced iterator.
+/// Note the passed in iterator is constant so it will not be changed, unlike
+/// std::advance does.
///
-/// The vector of type T to copy to
-/// The vector of type U to copy from
-template
-static void CopyVec(vector& dest, const vector& source)
+/// A const reference to an iterator, a copy of which will be advanced.
+/// How far to move the iterator forward
+/// A copy of the passed in iterator, advanced the specified number of elements
+template
+static iter Advance(const iter& it, diff off)
{
- dest.clear();
- dest.resize(source.size());
-
- for (size_t i = 0; i < source.size(); i++)
- dest[i] = static_cast(source[i]);//Valid assignment operator between T and U types must be defined somewhere.
+ auto temp = it;
+ std::advance(temp, off);
+ return temp;
}
///
-/// Clear dest and copy all of the elements of vector source with elements of type U to the vector
+/// Clear dest and copy all of the elements of container source with elements of type U to the container
/// dest with elements of type T.
-/// Call a function on each element after it's been copied.
///
-/// The vector of type T to copy to
-/// The vector of type U to copy from
-/// A function to call on each element after it's copied
-template
-static void CopyVec(vector& dest, const vector& source, std::function perElementOperation)
+/// The container of type Cdest with elements of type T to copy to
+/// The container of type Csource with elements of type U to copy from
+template class Cdest, template class Csource>
+static void CopyCont(Cdest& dest, const Csource& source)
{
dest.clear();
dest.resize(source.size());
+ auto it1 = source.begin();
+ auto it2 = dest.begin();
- for (size_t i = 0; i < source.size(); i++)
+ for (; it1 != source.end(); it1++, it2++)
+ *it2 = static_cast(*it1);//Valid assignment operator between T and U types must be defined somewhere.
+}
+
+///
+/// Clear dest and copy all of the elements of container source with elements of type U to the container
+/// dest with elements of type T.
+/// Call a function on each element after it's been copied.
+///
+/// The container of type Cdest with elements of type T to copy to
+/// The container of type Csource with elements of type U to copy from
+/// A function to call on each element after it's copied
+template class Cdest, template class Csource>
+static void CopyCont(Cdest& dest, const Csource& source, std::function perElementOperation)
+{
+ dest.clear();
+ dest.resize(source.size());
+ auto it1 = source.begin();
+ auto it2 = dest.begin();
+
+ for (; it1 != source.end(); it1++, it2++)
{
- dest[i] = static_cast(source[i]);//Valid assignment operator between T and U types must be defined somewhere.
- perElementOperation(dest[i]);
+ *it2 = static_cast(*it1);//Valid assignment operator between T and U types must be defined somewhere.
+ perElementOperation(*it2);
}
}
///
-/// Clear a vector of pointers to any type by checking each element for nullptr and calling delete on it, then clearing the entire vector.
+/// Clear a container of pointers to any type by checking each element for nullptr and calling delete on it, then clearing the entire vector.
/// Optionally call array delete if the elements themselves are pointers to dynamically allocated arrays.
///
/// The vector to be cleared
/// Whether to call delete or delete []. Default: false.
-template
-static void ClearVec(vector& vec, bool arrayDelete = false)
+template class C>
+static void ClearVec(C& cont, bool arrayDelete = false)
{
- for (size_t i = 0; i < vec.size(); i++)
+ for (auto& it : cont)
{
- if (vec[i])
+ if (it)
{
if (arrayDelete)
- delete [] vec[i];
+ delete [] it;
else
- delete vec[i];
+ delete it;
}
- vec[i] = nullptr;
+ it = nullptr;
}
- vec.clear();
+ cont.clear();
}
///
/// Determine whether all elements in two containers are equal.
+/// The container types do not have to match, but their element types do.
///
/// The first collection to compare
/// The second collection to compare
/// True if the sizes and all elements in both collections are equal, else false.
-template
-static bool Equal(const T& c1, const T& c2)
+template class C1, template class C2>
+static bool Equal(const C1& c1, const C2& c2)
{
bool equal = c1.size() == c2.size();
if (equal)
{
- for (auto it1 = c1.begin(), it2 = c2.begin(); it1 != c1.end(); ++it1, ++it2)
+ auto it1 = c1.begin();
+ auto it2 = c2.begin();
+
+ for (; it1 != c1.end(); ++it1, ++it2)
{
if (*it1 != *it2)
{
@@ -443,10 +471,7 @@ static inline T Clamp(T val, T min, T max)
}
template <>
-#ifdef _WIN32
- static
-#endif
-float Clamp(float val, float min, float max)
+STATIC float Clamp(float val, float min, float max)
{
if (val < min)
return min;
@@ -459,10 +484,7 @@ float Clamp(float val, float min, float max)
}
template <>
-#ifdef _WIN32
- static
-#endif
-double Clamp(double val, double min, double max)
+STATIC double Clamp(double val, double min, double max)
{
if (val < min)
return min;
@@ -512,10 +534,7 @@ static inline void ClampRef(T& val, T min, T max)
}
template <>
-#ifdef _WIN32
- static
-#endif
-void ClampRef(float& val, float min, float max)
+STATIC void ClampRef(float& val, float min, float max)
{
if (val < min)
val = min;
@@ -526,10 +545,7 @@ void ClampRef(float& val, float min, float max)
}
template <>
-#ifdef _WIN32
- static
-#endif
-void ClampRef(double& val, double min, double max)
+STATIC void ClampRef(double& val, double min, double max)
{
if (val < min)
val = min;
@@ -552,20 +568,14 @@ static inline void ClampLteRef(T& val, T lte)
}
template <>
-#ifdef _WIN32
- static
-#endif
-void ClampLteRef(float& val, float lte)
+STATIC void ClampLteRef(float& val, float lte)
{
if (val > lte || !std::isfinite(val))
val = lte;
}
template <>
-#ifdef _WIN32
- static
-#endif
-void ClampLteRef(double& val, double lte)
+STATIC void ClampLteRef(double& val, double lte)
{
if (val > lte || !std::isfinite(val))
val = lte;
@@ -585,10 +595,7 @@ static inline T ClampGte(T val, T gte)
}
template <>
-#ifdef _WIN32
- static
-#endif
-float ClampGte(float val, float gte)
+STATIC float ClampGte(float val, float gte)
{
if (val < gte || !std::isfinite(val))
return gte;
@@ -597,10 +604,7 @@ float ClampGte(float val, float gte)
}
template <>
-#ifdef _WIN32
- static
-#endif
-double ClampGte(double val, double gte)
+STATIC double ClampGte(double val, double gte)
{
if (val < gte || !std::isfinite(val))
return gte;
@@ -621,20 +625,14 @@ static inline void ClampGteRef(T& val, T gte)
}
template <>
-#ifdef _WIN32
- static
-#endif
-void ClampGteRef(float& val, float gte)
+STATIC void ClampGteRef(float& val, float gte)
{
if (val < gte || !std::isfinite(val))
val = gte;
}
template <>
-#ifdef _WIN32
- static
-#endif
-void ClampGteRef(double& val, double gte)
+STATIC void ClampGteRef(double& val, double gte)
{
if (val < gte || !std::isfinite(val))
val = gte;
@@ -721,19 +719,13 @@ static inline T SafeTan(T x)
}
template <>
-#ifdef _WIN32
- static
-#endif
-float SafeTan(float x)
+STATIC float SafeTan(float x)
{
return std::tan(Clamp(x, FLOAT_MIN_TAN, FLOAT_MAX_TAN));
}
template <>
-#ifdef _WIN32
- static
-#endif
-double SafeTan(double x)
+STATIC double SafeTan(double x)
{
return std::tan(x);
}
@@ -940,10 +932,7 @@ static inline T Arg(char* name, T def)
/// The default value to return if the environment variable was not present
/// The value of the specified environment variable if found, else default
template <>
-#ifdef _WIN32
- static
-#endif
-bool Arg(char* name, bool def)
+STATIC bool Arg(char* name, bool def)
{
return (Arg(name, -999) != -999) ? true : def;
}
@@ -955,10 +944,7 @@ bool Arg(char* name, bool def)
/// The default value to return if the environment variable was not present
/// The value of the specified environment variable if found, else default
template <>
-#ifdef _WIN32
- static
-#endif
-string Arg(char* name, string def)
+STATIC string Arg(char* name, string def)
{
char* ch;
string returnVal;
diff --git a/Source/Ember/Xform.h b/Source/Ember/Xform.h
index aebc342..e8d6bf5 100644
--- a/Source/Ember/Xform.h
+++ b/Source/Ember/Xform.h
@@ -69,9 +69,9 @@ public:
T pe = 1,
T pc = 0,
T pf = 0)
+ : Xform()
{
- Init();
m_Weight = weight;
m_ColorX = colorX;
m_ColorSpeed = colorSpeed;
@@ -184,8 +184,8 @@ public:
if (!m_ParentEmber && (typeid(T) == typeid(U)))
m_ParentEmber = reinterpret_cast*>(xform.ParentEmber());
- CopyVec(m_Xaos, xform.XaosVec());
- CopyVec(m_Motion, xform.m_Motion);
+ CopyCont(m_Xaos, xform.XaosVec());// needed?//TODO
+ CopyCont(m_Motion, xform.m_Motion);
m_Name = xform.m_Name;
return *this;
}
diff --git a/Source/Ember/XmlToEmber.h b/Source/Ember/XmlToEmber.h
index 1dbbdf1..bf69e1b 100644
--- a/Source/Ember/XmlToEmber.h
+++ b/Source/Ember/XmlToEmber.h
@@ -296,14 +296,15 @@ public:
}
///
- /// Parse the specified buffer and place the results in the vector of embers passed in.
+ /// Parse the specified buffer and place the results in the container of embers passed in.
///
/// The buffer to parse
/// Full path and filename, optionally empty
/// The newly constructed embers based on what was parsed
/// True to use defaults if they are not present in the file, else false to use invalid values as placeholders to indicate the values were not present. Default: true.
/// True if there were no errors, else false.
- bool Parse(byte* buf, const char* filename, vector>& embers, bool useDefaults = true)
+ template class C>
+ bool Parse(byte* buf, const char* filename, C, Alloc>& embers, bool useDefaults = true)
{
char* bn;
const char* xmlPtr;
@@ -318,7 +319,7 @@ public:
//Parse XML string into internal document.
xmlPtr = CX(&buf[0]);
bufSize = strlen(xmlPtr);
- embers.reserve(bufSize / 2500);//The Xml text for an ember is around 2500 bytes, but can be much more. Pre-allocate to aovid unnecessary resizing.
+ //embers.reserve(bufSize / 2500);//The Xml text for an ember is around 2500 bytes, but can be much more. Pre-allocate to aovid unnecessary resizing.
doc = xmlReadMemory(xmlPtr, int(bufSize), filename, "ISO-8859-1", XML_PARSE_NONET);//Forbid network access during read.
//t.Toc("xmlReadMemory");
@@ -336,6 +337,8 @@ public:
ScanForEmberNodes(rootnode, bn, embers, useDefaults);
xmlFreeDoc(doc);
emberSize = embers.size();
+ auto b = embers.begin();
+ auto secondToLast = Advance(embers.begin(), emberSize - 2);
//t.Toc("ScanForEmberNodes");
//Check to see if the first control point or the second-to-last
@@ -343,11 +346,11 @@ public:
//and should be reset to linear (with a warning).
if (emberSize > 0)
{
- if (embers[0].m_Interp == eInterp::EMBER_INTERP_SMOOTH)
- embers[0].m_Interp = eInterp::EMBER_INTERP_LINEAR;
+ if (b->m_Interp == eInterp::EMBER_INTERP_SMOOTH)
+ b->m_Interp = eInterp::EMBER_INTERP_LINEAR;
- if (emberSize >= 2 && embers[emberSize - 2].m_Interp == eInterp::EMBER_INTERP_SMOOTH)
- embers[emberSize - 2].m_Interp = eInterp::EMBER_INTERP_LINEAR;
+ if (emberSize >= 2 && secondToLast->m_Interp == eInterp::EMBER_INTERP_SMOOTH)
+ secondToLast->m_Interp = eInterp::EMBER_INTERP_LINEAR;
}
//Finally, ensure that consecutive 'rotate' parameters never exceed
@@ -355,17 +358,22 @@ public:
//An adjustment of +/- 360 degrees is made until this is true.
if (emberSize > 1)
{
- for (size_t i = 1; i < emberSize; i++)
+ auto prev = embers.begin();
+ auto second = Advance(embers.begin(), 1);
+
+ for (auto it = second; it != embers.end(); ++it)
{
//Only do this adjustment if not in compat mode.
- if (embers[i - 1].m_AffineInterp != eAffineInterp::AFFINE_INTERP_COMPAT && embers[i - 1].m_AffineInterp != eAffineInterp::AFFINE_INTERP_OLDER)
+ if (prev->m_AffineInterp != eAffineInterp::AFFINE_INTERP_COMPAT && prev->m_AffineInterp != eAffineInterp::AFFINE_INTERP_OLDER)
{
- while (embers[i].m_Rotate < embers[i - 1].m_Rotate - 180)
- embers[i].m_Rotate += 360;
+ while (it->m_Rotate < prev->m_Rotate - 180)
+ it->m_Rotate += 360;
- while (embers[i].m_Rotate > embers[i - 1].m_Rotate + 180)
- embers[i].m_Rotate -= 360;
+ while (it->m_Rotate > prev->m_Rotate + 180)
+ it->m_Rotate -= 360;
}
+
+ prev = it;
}
}
@@ -373,14 +381,16 @@ public:
}
///
- /// Parse the specified file and place the results in the vector of embers passed in.
+ /// Parse the specified file and place the results in the container of embers passed in.
/// This will strip out ampersands because the Xml parser can't handle them.
///
/// Full path and filename
/// The newly constructed embers based on what was parsed
/// True to use defaults if they are not present in the file, else false to use invalid values as placeholders to indicate the values were not present. Default: true.
/// True if there were no errors, else false.
- bool Parse(const char* filename, vector>& embers, bool useDefaults = true)
+ //template class C>
+ template class C>
+ bool Parse(const char* filename, C, Alloc>& embers, bool useDefaults = true)
{
const char* loc = __FUNCTION__;
string buf;
@@ -465,13 +475,14 @@ public:
private:
///
- /// Scan the file for ember nodes, and parse them out into the vector of embers.
+ /// Scan the file for ember nodes, and parse them out into the container of embers.
///
/// The current node to parse
/// The full path and filename
/// The newly constructed embers based on what was parsed
/// True to use defaults if they are not present in the file, else false to use invalid values as placeholders to indicate the values were not present.
- void ScanForEmberNodes(xmlNode* curNode, char* parentFile, vector>& embers, bool useDefaults)
+ template class C>
+ void ScanForEmberNodes(xmlNode* curNode, char* parentFile, C, Alloc>& embers, bool useDefaults)
{
bool parseEmberSuccess;
xmlNodePtr thisNode = nullptr;
diff --git a/Source/EmberAnimate/EmberAnimate.cpp b/Source/EmberAnimate/EmberAnimate.cpp
index 3542585..77c5f90 100644
--- a/Source/EmberAnimate/EmberAnimate.cpp
+++ b/Source/EmberAnimate/EmberAnimate.cpp
@@ -38,7 +38,7 @@ bool EmberAnimate(EmberOptions& opt)
const vector> devices = Devices(opt.Devices());
std::atomic atomfTime;
vector threadVec;
- unique_ptr> progress;
+ auto progress = make_unique>();
vector>> renderers;
vector errorReport;
std::recursive_mutex verboseCs;
@@ -58,10 +58,7 @@ bool EmberAnimate(EmberOptions& opt)
}
if (opt.DoProgress())
- {
- progress = unique_ptr>(new RenderProgress());
renderers[0]->Callback(progress.get());
- }
cout << "Using OpenCL to render.\n";
@@ -103,10 +100,7 @@ bool EmberAnimate(EmberOptions& opt)
}
if (opt.DoProgress())
- {
- progress = unique_ptr>(new RenderProgress());
tempRenderer->Callback(progress.get());
- }
if (opt.ThreadCount() == 0)
{
@@ -304,7 +298,7 @@ bool EmberAnimate(EmberOptions& opt)
for (auto& r : renderers)
{
- r->SetEmber(embers);
+ r->SetExternalEmbersPointer(&embers);//All will share a pointer to the original vector to conserve memory with large files. Ok because the vec doesn't get modified.
r->EarlyClip(opt.EarlyClip());
r->YAxisUp(opt.YAxisUp());
r->LockAccum(opt.LockAccum());
@@ -390,12 +384,12 @@ bool EmberAnimate(EmberOptions& opt)
}
Interpolater::Interpolate(embers, localTime, 0, centerEmber);//Get center flame.
- emberToXml.Save(flameName, centerEmber, opt.PrintEditDepth(), true, opt.IntPalette(), opt.HexPalette(), true, false, false);
+ emberToXml.Save(flameName, centerEmber, opt.PrintEditDepth(), true, opt.HexPalette(), true, false, false);
centerEmber.Clear();
}
stats = renderer->Stats();
- comments = renderer->ImageComments(stats, opt.PrintEditDepth(), opt.IntPalette(), opt.HexPalette());
+ comments = renderer->ImageComments(stats, opt.PrintEditDepth(), opt.HexPalette());
os.str("");
size_t iterCount = renderer->TotalIterCount(1);
os << comments.m_NumIters << " / " << iterCount << " (" << std::fixed << std::setprecision(2) << ((double(stats.m_Iters) / double(iterCount)) * 100) << "%)";
diff --git a/Source/EmberCL/DEOpenCLKernelCreator.cpp b/Source/EmberCL/DEOpenCLKernelCreator.cpp
index 2c2910a..f794617 100644
--- a/Source/EmberCL/DEOpenCLKernelCreator.cpp
+++ b/Source/EmberCL/DEOpenCLKernelCreator.cpp
@@ -16,14 +16,6 @@ DEOpenCLKernelCreator::DEOpenCLKernelCreator(bool doublePrecision, bool nVidia)
{
m_DoublePrecision = doublePrecision;
m_NVidia = nVidia;
-#ifdef ROW_ONLY_DE
- m_LogScaleAssignDEEntryPoint = "LogScaleAssignDensityFilterKernel";
- m_GaussianDEWithoutSsEntryPoint = "GaussianDEWithoutSsKernel";
- m_GaussianDESsWithScfEntryPoint = "GaussianDESsWithScfKernel";
- m_GaussianDESsWithoutScfEntryPoint = "GaussianDESsWithoutScfKernel";
- m_GaussianDEWithoutSsNoCacheEntryPoint = "GaussianDEWithoutSsNoCacheKernel";
- m_GaussianDESsWithScfNoCacheEntryPoint = "GaussianDESsWithScfNoCacheKernel";
- m_GaussianDESsWithoutScfNoCacheEntryPoint = "GaussianDESsWithoutScfNoCacheKernel";
m_LogScaleAssignDEKernel = CreateLogScaleAssignDEKernelString();
m_GaussianDEWithoutSsKernel = CreateGaussianDEKernel(1);
m_GaussianDESsWithScfKernel = CreateGaussianDEKernel(2);
@@ -31,22 +23,6 @@ DEOpenCLKernelCreator::DEOpenCLKernelCreator(bool doublePrecision, bool nVidia)
m_GaussianDEWithoutSsNoCacheKernel = CreateGaussianDEKernelNoLocalCache(1);
m_GaussianDESsWithScfNoCacheKernel = CreateGaussianDEKernelNoLocalCache(2);
m_GaussianDESsWithoutScfNoCacheKernel = CreateGaussianDEKernelNoLocalCache(3);
-#else
- m_LogScaleAssignDEEntryPoint = "LogScaleAssignDensityFilterKernel";
- m_GaussianDEWithoutSsEntryPoint = "GaussianDEWithoutSsKernel";
- m_GaussianDESsWithScfEntryPoint = "GaussianDESsWithScfKernel";
- m_GaussianDESsWithoutScfEntryPoint = "GaussianDESsWithoutScfKernel";
- m_GaussianDEWithoutSsNoCacheEntryPoint = "GaussianDEWithoutSsNoCacheKernel";
- m_GaussianDESsWithScfNoCacheEntryPoint = "GaussianDESsWithScfNoCacheKernel";
- m_GaussianDESsWithoutScfNoCacheEntryPoint = "GaussianDESsWithoutScfNoCacheKernel";
- m_LogScaleAssignDEKernel = CreateLogScaleAssignDEKernelString();
- m_GaussianDEWithoutSsKernel = CreateGaussianDEKernel(1);
- m_GaussianDESsWithScfKernel = CreateGaussianDEKernel(2);
- m_GaussianDESsWithoutScfKernel = CreateGaussianDEKernel(3);
- m_GaussianDEWithoutSsNoCacheKernel = CreateGaussianDEKernelNoLocalCache(1);
- m_GaussianDESsWithScfNoCacheKernel = CreateGaussianDEKernelNoLocalCache(2);
- m_GaussianDESsWithoutScfNoCacheKernel = CreateGaussianDEKernelNoLocalCache(3);
-#endif
}
///
@@ -64,8 +40,6 @@ const string& DEOpenCLKernelCreator::LogScaleAssignDEEntryPoint() const { return
/// The kernel source
const string& DEOpenCLKernelCreator::GaussianDEKernel(size_t ss, uint filterWidth) const
{
-#ifndef ROW_ONLY_DE
-
if (filterWidth > MaxDEFilterSize())
{
if (ss > 1)
@@ -79,7 +53,6 @@ const string& DEOpenCLKernelCreator::GaussianDEKernel(size_t ss, uint filterWidt
return m_GaussianDEWithoutSsNoCacheKernel;//SS 1;
}
else//Use cache.
-#endif
{
if (ss > 1)
{
@@ -101,8 +74,6 @@ const string& DEOpenCLKernelCreator::GaussianDEKernel(size_t ss, uint filterWidt
/// The name of the density estimation filtering entry point kernel function
const string& DEOpenCLKernelCreator::GaussianDEEntryPoint(size_t ss, uint filterWidth) const
{
-#ifndef ROW_ONLY_DE
-
if (filterWidth > MaxDEFilterSize())
{
if (ss > 1)
@@ -116,7 +87,6 @@ const string& DEOpenCLKernelCreator::GaussianDEEntryPoint(size_t ss, uint filter
return m_GaussianDEWithoutSsNoCacheEntryPoint;
}
else
-#endif
{
if (ss > 1)
{
@@ -206,210 +176,6 @@ string DEOpenCLKernelCreator::CreateLogScaleAssignDEKernelString()
return os.str();
}
-#ifdef ROW_ONLY_DE
-string DEOpenCLKernelCreator::CreateGaussianDEKernel(size_t ss)
-{
- bool doSS = ss > 1;
- bool doScf = !(ss & 1);
- ostringstream os;
- os <<
- ConstantDefinesString(m_DoublePrecision) <<
- DensityFilterCLStructString <<
- UnionCLStructString <<
- "__kernel void " << GaussianDEEntryPoint(ss, MaxDEFilterSize()) << "(\n" <<
- " const __global real4_bucket* histogram,\n"
- " __global real4reals_bucket* accumulator,\n"
- " __constant DensityFilterCL* densityFilter,\n"
- " const __global real_bucket_t* filterCoefs,\n"
- " const __global real_bucket_t* filterWidths,\n"
- " const __global uint* coefIndices,\n"
- " const uint chunkSizeW,\n"
- " const uint chunkSizeH,\n"
- " const uint colChunkPass,\n"
- " const uint rowChunkPass\n"
- "\t)\n"
- "{\n"
- " uint rowsToProcess = 32;\n"//Rows to process.
- "\n"
- " if (((((BLOCK_ID_X * chunkSizeW) + colChunkPass) * BLOCK_SIZE_X) + THREAD_ID_X >= densityFilter->m_SuperRasW) ||\n"
- " ((((BLOCK_ID_Y * chunkSizeH) + rowChunkPass) * rowsToProcess) + THREAD_ID_Y >= densityFilter->m_SuperRasH))\n"
- " return;\n"
- "\n";
-
- if (doSS)
- {
- os <<
- " uint ss = (uint)floor((real_bucket_t)densityFilter->m_Supersample / 2.0);\n"
- " int densityBoxLeftX;\n"
- " int densityBoxRightX;\n"
- " int densityBoxTopY;\n"
- " int densityBoxBottomY;\n"
- "\n";
-
- if (doScf)
- os <<
- " real_bucket_t scfact = pow(densityFilter->m_Supersample / (densityFilter->m_Supersample + (real_bucket_t)1.0), (real_bucket_t)2.0);\n";
- }
-
- os <<
- " uint fullTempBoxWidth;\n"
- " uint leftBound, rightBound, topBound, botBound;\n"
- " uint blockHistStartRow, blockHistEndRow, histCol;\n"
- " uint blockHistStartCol, boxReadStartCol, boxReadEndCol;\n"
- " uint accumWriteStartCol, colsToWrite, colOffset, colsToWriteOffset;\n"
- " int histRow, filterRow, accumWriteOffset;\n"
- "\n"
- " fullTempBoxWidth = BLOCK_SIZE_X + (densityFilter->m_FilterWidth * 2);\n"
- //Compute the bounds of the area to be sampled, which is just the ends minus the super sample minus 1.
- " leftBound = densityFilter->m_Supersample - 1;\n"
- " rightBound = densityFilter->m_SuperRasW - (densityFilter->m_Supersample - 1);\n"
- " topBound = densityFilter->m_Supersample - 1;\n"
- " botBound = densityFilter->m_SuperRasH - (densityFilter->m_Supersample - 1);\n"
- "\n"
- //Start and end values are the indices in the histogram read from
- //and written to in the accumulator. They are not the indices for the local block of data.
- //Before computing local offsets, compute the global offsets first to determine if any rows or cols fall outside of the bounds.
- " blockHistStartRow = min(botBound, topBound + (((BLOCK_ID_Y * chunkSizeH) + rowChunkPass) * rowsToProcess));\n"//The first histogram row this block will process.
- " blockHistEndRow = min(botBound, blockHistStartRow + rowsToProcess);\n"//The last histogram row this block will process, clamped to the last row.
- " blockHistStartCol = min(rightBound, leftBound + (((BLOCK_ID_X * chunkSizeW) + colChunkPass) * BLOCK_SIZE_X));\n"//The first histogram column this block will process.
- " boxReadStartCol = densityFilter->m_FilterWidth - min(densityFilter->m_FilterWidth, blockHistStartCol);\n"//The first box col this block will read from when copying to the accumulator.
- " boxReadEndCol = densityFilter->m_FilterWidth + min(densityFilter->m_FilterWidth + BLOCK_SIZE_X, densityFilter->m_SuperRasW - blockHistStartCol);\n"//The last box col this block will read from when copying to the accumulator.
- "\n"
- //Last, the indices in the global accumulator that the local bounds will be writing to.
- " accumWriteStartCol = blockHistStartCol - min(densityFilter->m_FilterWidth, blockHistStartCol);\n"//The first column in the accumulator this block will write to.
- " colsToWrite = ceil((real_bucket_t)(boxReadEndCol - boxReadStartCol) / (real_bucket_t)BLOCK_SIZE_X);\n"//Elements per thread to be written to the accumulator.
- " histCol = blockHistStartCol + THREAD_ID_X;\n"//The histogram column this individual thread will be reading from.
- "\n"
- " if (histCol >= rightBound)\n"
- " return;\n"
- "\n"
- //Compute the col position in this local box to serve as the center position
- //from which filter application offsets are computed.
- //These are the local indices for the local data that are temporarily accumulated to before
- //writing out to the global accumulator.
- " uint boxCol = densityFilter->m_FilterWidth + THREAD_ID_X;\n"
- " uint colsToZeroOffset, colsToZero = ceil((real_bucket_t)fullTempBoxWidth / (real_bucket_t)(BLOCK_SIZE_X));\n"//Usually is 2.
- " int i, j, k, jmin, jmax;\n"
- " uint filterSelectInt, filterCoefIndex;\n"
- " real_bucket_t cacheLog;\n"
- " real_bucket_t filterSelect;\n"
- " real4_bucket bucket;\n"
- ;
- os << " __local real4reals_bucket filterBox[192];\n";//Must be >= fullTempBoxWidth.
- os <<
- "\n"
- " colsToZeroOffset = colsToZero * THREAD_ID_X;\n"
- " colsToWriteOffset = colsToWrite * THREAD_ID_X;\n"
- " k = (int)densityFilter->m_FilterWidth;\n"//Need a signed int to use below, really is filter width, but reusing a variable to save space.
- "\n"
- " for (histRow = blockHistStartRow; histRow < blockHistEndRow; histRow++)\n"//Process pixels by row, for 32 rows.
- " {\n"
- " bucket = histogram[(histRow * densityFilter->m_SuperRasW) + histCol];\n"
- "\n"
- " if (bucket.w != 0)\n"
- " cacheLog = (densityFilter->m_K1 * log(1.0 + bucket.w * densityFilter->m_K2)) / bucket.w;\n"
- "\n";
-
- if (doSS)
- {
- os <<
- " filterSelect = 0;\n"
- " densityBoxLeftX = histCol - min(histCol, ss);\n"
- " densityBoxRightX = histCol + min(ss, (densityFilter->m_SuperRasW - histCol) - 1);\n"
- " densityBoxTopY = histRow - min((uint)histRow, ss);\n"
- " densityBoxBottomY = histRow + min(ss, (densityFilter->m_SuperRasH - histRow) - 1);\n"
- "\n"
- " for (j = densityBoxTopY; j <= densityBoxBottomY; j++)\n"
- " {\n"
- " for (i = densityBoxLeftX; i <= densityBoxRightX; i++)\n"
- " {\n"
- " filterSelect += histogram[(j * densityFilter->m_SuperRasW) + i].w;\n"
- " }\n"
- " }\n"
- "\n";
-
- if (doScf)
- os << " filterSelect *= scfact;\n";
- }
- else
- {
- os
- << " filterSelect = bucket.w;\n";
- }
-
- os <<
- "\n"
- " if (filterSelect > densityFilter->m_MaxFilteredCounts)\n"
- " filterSelectInt = densityFilter->m_MaxFilterIndex;\n"
- " else if (filterSelect <= DE_THRESH)\n"
- " filterSelectInt = (int)ceil(filterSelect) - 1;\n"
- " else if (filterSelect != 0)\n"
- " filterSelectInt = (int)DE_THRESH + (int)floor(pow((real_bucket_t)(filterSelect - DE_THRESH), densityFilter->m_Curve));\n"
- " else\n"
- " filterSelectInt = 0;\n"
- "\n"
- " if (filterSelectInt > densityFilter->m_MaxFilterIndex)\n"
- " filterSelectInt = densityFilter->m_MaxFilterIndex;\n"
- "\n"
- " filterCoefIndex = filterSelectInt * densityFilter->m_KernelSize;\n"
- "\n"
- //With this new method, only accumulate to the temp local buffer first. Write to the final accumulator last.
- //For each loop through, note that there is a local memory barrier call inside of each call to AddToAccumNoCheck().
- //If this isn't done, pixel errors occurr and even an out of resources error occurrs because too many writes are done to the same place in memory at once.
- " jmin = min(k, histRow);\n"
- " jmax = (int)min((densityFilter->m_SuperRasH - 1) - histRow, densityFilter->m_FilterWidth);\n"
- "\n"
- " for (j = -jmin; j <= jmax; j++)\n"
- " {\n"
- " for (i = 0; i < colsToZero && (colsToZeroOffset + i) < fullTempBoxWidth; i++)\n"//Each thread zeroizes a few columns.
- " {\n"
- " filterBox[colsToZeroOffset + i].m_Real4 = 0;\n"
- " }\n"
- "\n"
- " barrier(CLK_LOCAL_MEM_FENCE);\n"
- "\n"
- " if (bucket.w != 0)\n"
- " {\n"
- " filterRow = abs(j) * (densityFilter->m_FilterWidth + 1);\n"
- "\n"
- " for (i = -k; i <= k; i++)\n"
- " {\n"
- " filterSelectInt = filterCoefIndex + coefIndices[filterRow + abs(i)];\n"//Really is filterCoeffIndexPlusOffset, but reusing a variable to save space.
- " filterBox[i + boxCol].m_Real4 += (bucket * (filterCoefs[filterSelectInt] * cacheLog));\n"
- " }\n"
- " }\n"
- "\n"
- " barrier(CLK_LOCAL_MEM_FENCE);\n"
- "\n"
- //At this point, all threads in this block have applied the filter to their surrounding pixels and stored the results in the temp local box.
- //Add the cells of it that are in bounds to the global accumulator.
- //Compute offsets in local box to read from, and offsets into global accumulator to write to.
- //Use a method here that is similar to the zeroization above: Each thread (column) in the first row iterates through all of the
- //rows and adds a few columns to the accumulator.
- //" if (THREAD_ID_X == 0)\n"
- //" {\n"
- //" for (int kk = boxReadStartCol, i = 0; kk < boxReadEndCol; kk++, i++)\n"//Each thread writes a few columns.//Could do away with kk//TODO//OPT
- //" {\n"
- //" accumulator[((histRow + j) * densityFilter->m_SuperRasW) + (accumWriteStartCol + i)].m_Real4 += filterBox[kk].m_Real4;\n"
- //" }\n"
- //" }\n"
- " accumWriteOffset = ((histRow + j) * densityFilter->m_SuperRasW) + accumWriteStartCol;\n"
- "\n"
- " for (i = 0; i < colsToWrite; i++)\n"//Each thread writes a few columns.
- " {\n"
- " colOffset = colsToWriteOffset + i;\n"
- "\n"
- " if (boxReadStartCol + colOffset < boxReadEndCol)\n"
- " accumulator[accumWriteOffset + colOffset].m_Real4 += filterBox[boxReadStartCol + colOffset].m_Real4;\n"
- " }\n"
- " }\n"//for() filter rows.
- " barrier(CLK_GLOBAL_MEM_FENCE);\n"
- " }\n"//for() histogram rows.
- "}\n";
- return os.str();
-}
-
-#else
///
/// Create the gaussian density filtering kernel string.
/// 6 different methods of processing were tried before settling on this final and fastest 7th one.
@@ -660,7 +426,6 @@ string DEOpenCLKernelCreator::CreateGaussianDEKernel(size_t ss)
"}\n";
return os.str();
}
-#endif
///
/// Create the gaussian density filtering kernel string, but use no local cache and perform
diff --git a/Source/EmberCL/DEOpenCLKernelCreator.h b/Source/EmberCL/DEOpenCLKernelCreator.h
index c396572..59087c1 100644
--- a/Source/EmberCL/DEOpenCLKernelCreator.h
+++ b/Source/EmberCL/DEOpenCLKernelCreator.h
@@ -8,8 +8,6 @@
/// DEOpenCLKernelCreator class.
///
-//#define ROW_ONLY_DE 1
-
namespace EmberCLns
{
///
@@ -51,25 +49,25 @@ private:
string CreateGaussianDEKernelNoLocalCache(size_t ss);
string m_LogScaleAssignDEKernel;
- string m_LogScaleAssignDEEntryPoint;
+ string m_LogScaleAssignDEEntryPoint = "LogScaleAssignDensityFilterKernel";
string m_GaussianDEWithoutSsKernel;
- string m_GaussianDEWithoutSsEntryPoint;
+ string m_GaussianDEWithoutSsEntryPoint = "GaussianDEWithoutSsKernel";
string m_GaussianDESsWithScfKernel;
- string m_GaussianDESsWithScfEntryPoint;
+ string m_GaussianDESsWithScfEntryPoint = "GaussianDESsWithScfKernel";
string m_GaussianDESsWithoutScfKernel;
- string m_GaussianDESsWithoutScfEntryPoint;
+ string m_GaussianDESsWithoutScfEntryPoint = "GaussianDESsWithoutScfKernel";
string m_GaussianDEWithoutSsNoCacheKernel;
- string m_GaussianDEWithoutSsNoCacheEntryPoint;
+ string m_GaussianDEWithoutSsNoCacheEntryPoint = "GaussianDEWithoutSsNoCacheKernel";
string m_GaussianDESsWithScfNoCacheKernel;
- string m_GaussianDESsWithScfNoCacheEntryPoint;
+ string m_GaussianDESsWithScfNoCacheEntryPoint = "GaussianDESsWithScfNoCacheKernel";
string m_GaussianDESsWithoutScfNoCacheKernel;
- string m_GaussianDESsWithoutScfNoCacheEntryPoint;
+ string m_GaussianDESsWithoutScfNoCacheEntryPoint = "GaussianDESsWithoutScfNoCacheKernel";
bool m_DoublePrecision;
bool m_NVidia;
diff --git a/Source/EmberCL/FinalAccumOpenCLKernelCreator.cpp b/Source/EmberCL/FinalAccumOpenCLKernelCreator.cpp
index a595d41..d8ba24c 100644
--- a/Source/EmberCL/FinalAccumOpenCLKernelCreator.cpp
+++ b/Source/EmberCL/FinalAccumOpenCLKernelCreator.cpp
@@ -10,22 +10,14 @@ namespace EmberCLns
FinalAccumOpenCLKernelCreator::FinalAccumOpenCLKernelCreator(bool doublePrecision)
{
m_DoublePrecision = doublePrecision;
- m_GammaCorrectionWithAlphaCalcEntryPoint = "GammaCorrectionWithAlphaCalcKernel";
- m_GammaCorrectionWithoutAlphaCalcEntryPoint = "GammaCorrectionWithoutAlphaCalcKernel";
- m_GammaCorrectionWithAlphaCalcKernel = CreateGammaCorrectionKernelString(true);
- m_GammaCorrectionWithoutAlphaCalcKernel = CreateGammaCorrectionKernelString(false);
- m_FinalAccumEarlyClipEntryPoint = "FinalAccumEarlyClipKernel";
- m_FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumEntryPoint = "FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumKernel";
- m_FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumEntryPoint = "FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumKernel";
+ m_GammaCorrectionWithAlphaCalcKernel = CreateGammaCorrectionKernelString(true);
+ m_GammaCorrectionWithoutAlphaCalcKernel = CreateGammaCorrectionKernelString(false);
m_FinalAccumEarlyClipKernel = CreateFinalAccumKernelString(true, false, false);
m_FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumKernel = CreateFinalAccumKernelString(true, true, true);
m_FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumKernel = CreateFinalAccumKernelString(true, false, true);
- m_FinalAccumLateClipEntryPoint = "FinalAccumLateClipKernel";
- m_FinalAccumLateClipWithAlphaCalcWithAlphaAccumEntryPoint = "FinalAccumLateClipWithAlphaCalcWithAlphaAccumKernel";
- m_FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumEntryPoint = "FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumKernel";
- m_FinalAccumLateClipKernel = CreateFinalAccumKernelString(false, false, false);
- m_FinalAccumLateClipWithAlphaCalcWithAlphaAccumKernel = CreateFinalAccumKernelString(false, true, true);
- m_FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumKernel = CreateFinalAccumKernelString(false, false, true);
+ m_FinalAccumLateClipKernel = CreateFinalAccumKernelString(false, false, false);
+ m_FinalAccumLateClipWithAlphaCalcWithAlphaAccumKernel = CreateFinalAccumKernelString(false, true, true);
+ m_FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumKernel = CreateFinalAccumKernelString(false, false, true);
}
///
diff --git a/Source/EmberCL/FinalAccumOpenCLKernelCreator.h b/Source/EmberCL/FinalAccumOpenCLKernelCreator.h
index 1018768..bd66e93 100644
--- a/Source/EmberCL/FinalAccumOpenCLKernelCreator.h
+++ b/Source/EmberCL/FinalAccumOpenCLKernelCreator.h
@@ -58,24 +58,24 @@ private:
string CreateCalcNewRgbFunctionString(bool globalBucket);
string m_GammaCorrectionWithAlphaCalcKernel;
- string m_GammaCorrectionWithAlphaCalcEntryPoint;
+ string m_GammaCorrectionWithAlphaCalcEntryPoint = "GammaCorrectionWithAlphaCalcKernel";
string m_GammaCorrectionWithoutAlphaCalcKernel;
- string m_GammaCorrectionWithoutAlphaCalcEntryPoint;
+ string m_GammaCorrectionWithoutAlphaCalcEntryPoint = "GammaCorrectionWithoutAlphaCalcKernel";
string m_FinalAccumEarlyClipKernel;//False, false.
- string m_FinalAccumEarlyClipEntryPoint;
+ string m_FinalAccumEarlyClipEntryPoint = "FinalAccumEarlyClipKernel";
string m_FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumKernel;//True, true.
- string m_FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumEntryPoint;
+ string m_FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumEntryPoint = "FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumKernel";
string m_FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumKernel;//False, true.
- string m_FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumEntryPoint;
+ string m_FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumEntryPoint = "FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumKernel";
string m_FinalAccumLateClipKernel;//False, false.
- string m_FinalAccumLateClipEntryPoint;
+ string m_FinalAccumLateClipEntryPoint = "FinalAccumLateClipKernel";
string m_FinalAccumLateClipWithAlphaCalcWithAlphaAccumKernel;//True, true.
- string m_FinalAccumLateClipWithAlphaCalcWithAlphaAccumEntryPoint;
+ string m_FinalAccumLateClipWithAlphaCalcWithAlphaAccumEntryPoint = "FinalAccumLateClipWithAlphaCalcWithAlphaAccumKernel";
string m_FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumKernel;//False, true.
- string m_FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumEntryPoint;
+ string m_FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumEntryPoint = "FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumKernel";
string m_Empty;
bool m_DoublePrecision;
diff --git a/Source/EmberCL/IterOpenCLKernelCreator.cpp b/Source/EmberCL/IterOpenCLKernelCreator.cpp
index 317d61d..97e2772 100644
--- a/Source/EmberCL/IterOpenCLKernelCreator.cpp
+++ b/Source/EmberCL/IterOpenCLKernelCreator.cpp
@@ -12,9 +12,6 @@ namespace EmberCLns
template
IterOpenCLKernelCreator::IterOpenCLKernelCreator()
{
- m_IterEntryPoint = "IterateKernel";
- m_ZeroizeEntryPoint = "ZeroizeKernel";
- m_SumHistEntryPoint = "SumHisteKernel";
m_ZeroizeKernel = CreateZeroizeKernelString();
m_SumHistKernel = CreateSumHistKernelString();
}
@@ -23,11 +20,11 @@ IterOpenCLKernelCreator::IterOpenCLKernelCreator()
/// Accessors.
///
-template const string& IterOpenCLKernelCreator::ZeroizeKernel() const { return m_ZeroizeKernel; }
+template const string& IterOpenCLKernelCreator::ZeroizeKernel() const { return m_ZeroizeKernel; }
template const string& IterOpenCLKernelCreator::ZeroizeEntryPoint() const { return m_ZeroizeEntryPoint; }
-template const string& IterOpenCLKernelCreator::SumHistKernel() const { return m_SumHistKernel; }
+template const string& IterOpenCLKernelCreator::SumHistKernel() const { return m_SumHistKernel; }
template const string& IterOpenCLKernelCreator::SumHistEntryPoint() const { return m_SumHistEntryPoint; }
-template const string& IterOpenCLKernelCreator::IterEntryPoint() const { return m_IterEntryPoint; }
+template