More C++11

This commit is contained in:
mfeemster 2014-09-09 22:41:26 -07:00
parent e4a47d0d16
commit 44c90abb32
39 changed files with 881 additions and 730 deletions

View File

@ -16,10 +16,10 @@
<Option createStaticLib="1" />
<Compiler>
<Add option="-D_DEBUG" />
<Add option="-D_USRDLL" />
<Add option="-DBUILDING_EMBER" />
<Add option="-D_M_X64" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
<Target title="ReleaseNvidia Win32">
<Option output="Ember" prefix_auto="1" extension_auto="1" />
@ -27,16 +27,6 @@
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_WINDOWS" />
<Add option="-D_USRDLL" />
<Add option="-DBUILDING_EMBER" />
<Add directory="../../../glm" />
<Add directory="../../../libxml2/include" />
<Add directory="../../../tbb/include" />
</Compiler>
</Target>
<Target title="ReleaseNvidia x64">
<Option output="Ember" prefix_auto="1" extension_auto="1" />
@ -45,15 +35,13 @@
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-DWIN32" />
<Add option="-fomit-frame-pointer" />
<Add option="-O2" />
<Add option="-DNDEBUG" />
<Add option="-D_WINDOWS" />
<Add option="-D_USRDLL" />
<Add option="-DBUILDING_EMBER" />
<Add directory="../../../glm" />
<Add directory="../../../libxml2/include" />
<Add directory="../../../tbb/include" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
<Target title="Release x64">
<Option output="Ember" prefix_auto="1" extension_auto="1" />
@ -62,15 +50,13 @@
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-DWIN32" />
<Add option="-fomit-frame-pointer" />
<Add option="-O2" />
<Add option="-DNDEBUG" />
<Add option="-D_WINDOWS" />
<Add option="-D_USRDLL" />
<Add option="-DBUILDING_EMBER" />
<Add directory="../../../glm" />
<Add directory="../../../libxml2/include" />
<Add directory="../../../tbb/include" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
<Target title="Release Win32">
<Option output="Ember" prefix_auto="1" extension_auto="1" />
@ -78,16 +64,6 @@
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_WINDOWS" />
<Add option="-D_USRDLL" />
<Add option="-DBUILDING_EMBER" />
<Add directory="../../../glm" />
<Add directory="../../../libxml2/include" />
<Add directory="../../../tbb/include" />
</Compiler>
</Target>
<Target title="Debug Win32">
<Option output="Ember" prefix_auto="1" extension_auto="1" />
@ -95,23 +71,30 @@
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-DWIN32" />
<Add option="-D_DEBUG" />
<Add option="-D_WINDOWS" />
<Add option="-D_USRDLL" />
<Add option="-DBUILDING_EMBER" />
<Add directory="../../../glm" />
<Add directory="../../../libxml2/include" />
<Add directory="../../../tbb/include" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-march=k8" />
<Add option="-Wnon-virtual-dtor" />
<Add option="-Wshadow" />
<Add option="-Winit-self" />
<Add option="-Wredundant-decls" />
<Add option="-Wcast-align" />
<Add option="-Winline" />
<Add option="-Wunreachable-code" />
<Add option="-Wmissing-include-dirs" />
<Add option="-Wswitch-enum" />
<Add option="-Wswitch-default" />
<Add option="-Wmain" />
<Add option="-pedantic" />
<Add option="-Wzero-as-null-pointer-constant" />
<Add option="-std=c++11" />
<Add option="-Wall" />
<Add option="-fpermissive" />
<Add option="-fPIC" />
<Add option="-D_M_X64" />
<Add option="-D_USRDLL" />
<Add option="-DBUILDING_EMBER" />
<Add directory="/usr/include/libxml2" />
</Compiler>
<Linker>

View File

@ -1,64 +1,169 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug x64" />
<File name="../../Source/Ember/XmlToEmber.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<ActiveTarget name="Release x64" />
<File name="../../Source/Ember/Ember.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="../../Source/Ember/Affine2D.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/VariationsDC.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6270" topLine="202" />
</Cursor>
</File>
<File name="../../Source/Ember/Variations05.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="37378" topLine="1097" />
</Cursor>
</File>
<File name="../../Source/Ember/EmberToXml.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="20943" topLine="583" />
</Cursor>
</File>
<File name="../../Source/Ember/TemporalFilter.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9058" topLine="269" />
</Cursor>
</File>
<File name="../../Source/Ember/Affine2D.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1969" topLine="12" />
</Cursor>
</File>
<File name="../../Source/Ember/VariationList.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="14159" topLine="419" />
</Cursor>
</File>
<File name="../../Source/Ember/Timing.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1699" topLine="12" />
</Cursor>
</File>
<File name="../../Source/Ember/EmberDefines.h" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2838" topLine="47" />
</Cursor>
</File>
<File name="../../Source/Ember/DllMain.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="../../Source/Ember/EmberToXml.h" open="1" top="1" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/Variations04.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6418" topLine="129" />
<Cursor1 position="98407" topLine="3204" />
</Cursor>
</File>
<File name="../../Source/Ember/Renderer.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/XmlToEmber.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5242" topLine="116" />
<Cursor1 position="16510" topLine="323" />
</Cursor>
</File>
<File name="../../Source/Ember/Renderer.cpp" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/Interpolate.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18225" topLine="507" />
</Cursor>
</File>
<File name="../../Source/Ember/Palette.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="8808" topLine="105" />
</Cursor>
</File>
<File name="../../Source/Ember/SheepTools.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="26633" topLine="913" />
</Cursor>
</File>
<File name="../../Source/Ember/Affine2D.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="../../Source/Ember/Ember.h" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/Utils.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="22496" topLine="746" />
</Cursor>
</File>
<File name="../../Source/Ember/Isaac.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="8062" topLine="258" />
</Cursor>
</File>
<File name="../../Source/Ember/Ember.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="19820" topLine="664" />
</Cursor>
</File>
<File name="../../Source/Ember/Variations01.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="136093" topLine="4660" />
</Cursor>
</File>
<File name="../../Source/Ember/Renderer.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="16331" topLine="326" />
</Cursor>
</File>
<File name="../../Source/Ember/Point.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3653" topLine="148" />
</Cursor>
</File>
<File name="../../Source/Ember/Xform.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="32608" topLine="1024" />
</Cursor>
</File>
<File name="../../Source/Ember/EmberPch.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="../../Source/Ember/Utils.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/SpatialFilter.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="21424" topLine="713" />
<Cursor1 position="22861" topLine="816" />
</Cursor>
</File>
<File name="../../Source/Ember/CarToRas.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/CarToRas.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="2973" topLine="67" />
</Cursor>
</File>
<File name="../../Source/Ember/Ember.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/EmberPch.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="953" topLine="25" />
</Cursor>
</File>
<File name="../../Source/Ember/Affine2D.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/PaletteList.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="1381" topLine="37" />
</Cursor>
</File>
<File name="../../Source/Ember/DllMain.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/Variation.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="42788" topLine="1649" />
</Cursor>
</File>
<File name="../../Source/Ember/EmberPch.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="../../Source/Ember/Iterator.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="2509" topLine="39" />
</Cursor>
</File>
<File name="../../Source/Ember/Variations03.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="62259" topLine="1950" />
</Cursor>
</File>
<File name="../../Source/Ember/Renderer.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="13576" topLine="347" />
</Cursor>
</File>
<File name="../../Source/Ember/Variations02.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="116327" topLine="3912" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -1,4 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug x64" />
<ActiveTarget name="Release x64" />
<File name="../../Source/EmberCommon/EmberCommon.h" open="1" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="../../Source/EmberAnimate/EmberAnimate.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9928" topLine="290" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug x64" />
<ActiveTarget name="Release x64" />
</CodeBlocks_layout_file>

View File

@ -1,4 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug x64" />
<ActiveTarget name="Release x64" />
<File name="../../Source/EmberCommon/EmberCommon.h" open="1" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
<Folding>
<Collapse line="17" />
</Folding>
</File>
<File name="../../Source/EmberCommon/EmberCommonPch.cpp" open="1" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -161,18 +161,18 @@
</Linker>
</Target>
</Build>
<Unit filename="../../EmberCommon/EmberCommon.h" />
<Unit filename="../../EmberCommon/EmberCommonPch.cpp" />
<Unit filename="../../EmberCommon/EmberCommonPch.h" />
<Unit filename="../../EmberCommon/EmberOptions.h" />
<Unit filename="../../EmberCommon/JpegUtils.h" />
<Unit filename="../../EmberCommon/SimpleGlob.h" />
<Unit filename="../../EmberCommon/SimpleOpt.h" />
<Unit filename="../../EmberRender/EmberRender.cpp" />
<Unit filename="../../EmberRender/EmberRender.h" />
<Unit filename="../../EmberRender/EmberRender.rc" />
<Unit filename="../../EmberRender/resource.h" />
<Unit filename="../../Fractorium/Icons/Fractorium.ico" />
<Unit filename="../../Source/EmberCommon/EmberCommon.h" />
<Unit filename="../../Source/EmberCommon/EmberCommonPch.cpp" />
<Unit filename="../../Source/EmberCommon/EmberCommonPch.h" />
<Unit filename="../../Source/EmberCommon/EmberOptions.h" />
<Unit filename="../../Source/EmberCommon/JpegUtils.h" />
<Unit filename="../../Source/EmberCommon/SimpleGlob.h" />
<Unit filename="../../Source/EmberCommon/SimpleOpt.h" />
<Unit filename="../../Source/EmberRender/EmberRender.cpp" />
<Unit filename="../../Source/EmberRender/EmberRender.h" />
<Unit filename="../../Source/EmberRender/resource.h" />
<Unit filename="ReadMe.txt" />
<Extensions>
<code_completion />

View File

@ -1,4 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug x64" />
<ActiveTarget name="Release x64" />
<File name="../../Source/EmberCommon/EmberCommon.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="108" />
</Cursor>
</File>
<File name="../../Source/EmberRender/EmberRender.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="526" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -134,8 +134,8 @@ public:
m_PixPerImageUnitH = (T)rasH * invSizeH;
m_RasLlY = m_PixPerImageUnitH * carLlY;
T m_OneRow = abs(m_CarUrY - m_CarLlY) / m_RasHeight;
T m_OneCol = abs(m_CarUrX - m_CarLlX) / m_RasWidth;
m_OneRow = abs(m_CarUrY - m_CarLlY) / m_RasHeight;
m_OneCol = abs(m_CarUrX - m_CarLlX) / m_RasWidth;
m_PadCarLlX = m_CarLlX + m_OneCol;
m_PadCarUrX = m_CarUrX - m_OneCol;

View File

@ -45,7 +45,7 @@ public:
}
Ember(const Ember<T>& ember)
: m_Edits(NULL)
: m_Edits(nullptr)
{
Ember<T>::operator=<T>(ember);
}
@ -56,7 +56,7 @@ public:
/// <param name="ember">The Ember object to copy</param>
template <typename U>
Ember(const Ember<U>& ember)
: m_Edits(NULL)
: m_Edits(nullptr)
{
Ember<T>::operator=<U>(ember);
}
@ -166,7 +166,7 @@ public:
SetProjFunc();
ClearEdit();
if (ember.m_Edits != NULL)
if (ember.m_Edits != nullptr)
m_Edits = xmlCopyDoc(ember.m_Edits, 1);
return *this;
@ -235,7 +235,7 @@ public:
m_Index = 0;
m_Xforms.reserve(12);
m_Edits = NULL;
m_Edits = nullptr;
}
/// <summary>
@ -322,7 +322,7 @@ public:
//Now shuffle xaos values from i on back by 1 for every xform.
for (unsigned int x1 = 0; x1 < XformCount(); x1++)
{
if (xform = GetXform(x1))
if ((xform = GetXform(x1)))
{
for (unsigned int x2 = i + 1; x2 <= XformCount(); x2++)//Iterate from the position after the deletion index up to the old count.
xform->SetXaos(x2 - 1, xform->Xaos(x2));
@ -358,13 +358,13 @@ public:
/// Get a pointer to the xform at the specified index, excluding the final one.
/// </summary>
/// <param name="i">The index to get</param>
/// <returns>A pointer to the xform at the index if successful, else NULL.</returns>
/// <returns>A pointer to the xform at the index if successful, else nullptr.</returns>
Xform<T>* GetXform(unsigned int i) const
{
if (i < XformCount())
return (Xform<T>*)&m_Xforms[i];
else
return NULL;
return nullptr;
}
/// <summary>
@ -372,7 +372,7 @@ public:
/// </summary>
/// <param name="i">The index to get</param>
/// <param name="forceFinal">If true, return the final xform when its index is requested even if one is not present</param>
/// <returns>A pointer to the xform at the index if successful, else NULL.</returns>
/// <returns>A pointer to the xform at the index if successful, else nullptr.</returns>
Xform<T>* GetTotalXform(unsigned int i, bool forceFinal = false) const
{
if (i < XformCount())
@ -380,7 +380,7 @@ public:
else if (i == XformCount() || forceFinal)
return (Xform<T>*)&m_FinalXform;
else
return NULL;
return nullptr;
}
/// <summary>
@ -677,7 +677,7 @@ public:
bool allID, final;
unsigned int i, j, k, l, maxXformCount, totalXformCount;
T bgAlphaSave = m_Background.a;
T coefSave[2];
T coefSave[2] {0, 0};
vector<Xform<T>*> xformVec;
//Palette and others
@ -803,7 +803,7 @@ public:
var->m_Weight = 0;
if (parVar != NULL)
if (parVar != nullptr)
parVar->Clear();
for (k = 0; k < size; k++)//For each ember in the list.
@ -814,17 +814,17 @@ public:
{
Variation<T>* tempVar = tempXform->GetVariationById(var->VariationId());//See if the variation at this xform index exists in that ember at this xform index.
if (tempVar != NULL)
if (tempVar != nullptr)
{
//Interp weight.
var->m_Weight += tempVar->m_Weight * coefs[k];
//If it was a parametric variation, interp params.
if (parVar != NULL)
if (parVar != nullptr)
{
ParametricVariation<T>* tempParVar = dynamic_cast<ParametricVariation<T>*>(tempVar);
if (tempParVar != NULL && (parVar->ParamCount() == tempParVar->ParamCount()))//This check will should always be true, but just check to be absolutely sure to avoid clobbering memory.
if (tempParVar != nullptr && (parVar->ParamCount() == tempParVar->ParamCount()))//This check will should always be true, but just check to be absolutely sure to avoid clobbering memory.
{
ParamWithName<T>* params = parVar->Params();
ParamWithName<T>* tempParams = tempParVar->Params();
@ -1294,7 +1294,7 @@ public:
m_Supersample = 0;
m_SpatialFilterRadius = -1;
m_Zoom = 999999;
m_ProjFunc = NULL;
m_ProjFunc = nullptr;
m_CamZPos = 999999;
m_CamPerspective = 999999;
m_CamYaw = 999999;
@ -1323,14 +1323,14 @@ public:
}
/// <summary>
/// Thin wrapper to clear edit doc if not NULL and set to NULL.
/// Thin wrapper to clear edit doc if not nullptr and set to nullptr.
/// </summary>
void ClearEdit()
{
if (m_Edits != NULL)
if (m_Edits != nullptr)
xmlFreeDoc(m_Edits);
m_Edits = NULL;
m_Edits = nullptr;
}
/// <summary>

View File

@ -14,7 +14,7 @@
#endif
#else
#define EMBER_API
#define fopen_s(pFile,filename,mode) ((*(pFile))=fopen((filename),(mode)))==NULL
#define fopen_s(pFile,filename,mode) ((*(pFile)=fopen((filename),(mode)))==nullptr)
#define _stat stat
#define _fstat fstat
#define _stricmp strcmp

View File

@ -269,7 +269,7 @@ public:
}
}
if (doEdits && ember.m_Edits != NULL)
if (doEdits && ember.m_Edits != nullptr)
os << ToString(xmlDocGetRootElement(ember.m_Edits), 1, true, printEditDepth);
os << "</flame>\n";
@ -282,8 +282,8 @@ public:
/// This is used when an ember is made out of some mutation or edit from one or two existing embers and
/// the user wants to capture the genetic lineage history information in the edit doc of the new ember.
/// </summary>
/// <param name="parent0">The first parent, optionally NULL.</param>
/// <param name="parent1">The second parent, optionally NULL.</param>
/// <param name="parent0">The first parent, optionally nullptr.</param>
/// <param name="parent1">The second parent, optionally nullptr.</param>
/// <param name="action">The action that was taken to create the new ember</param>
/// <param name="nick">The nickname of the author</param>
/// <param name="url">The Url of the author</param>
@ -298,18 +298,18 @@ public:
char buffer[128];
char commentString[128];
time_t myTime;
xmlDocPtr commentDoc = NULL;
xmlDocPtr commentDoc = nullptr;
xmlDocPtr doc = xmlNewDoc(XC "1.0");
xmlNodePtr rootNode = NULL, node = NULL, nodeCopy = NULL;
xmlNodePtr rootComment = NULL;
xmlNodePtr rootNode = nullptr, node = nullptr, nodeCopy = nullptr;
xmlNodePtr rootComment = nullptr;
//Create the root node, called "edit".
rootNode = xmlNewNode(NULL, XC "edit");
rootNode = xmlNewNode(nullptr, XC "edit");
xmlDocSetRootElement(doc, rootNode);
//Add the edit attributes.
//Date.
myTime = time(NULL);
myTime = time(nullptr);
#ifdef WIN32
tm localt;
localtime_s(&localt, &myTime);
@ -339,7 +339,7 @@ public:
if (sheepGen > 0 && sheepId > 0)
{
//Create a child node of the root node called sheep.
node = xmlNewChild(rootNode, NULL, XC "sheep", NULL);
node = xmlNewChild(rootNode, nullptr, XC "sheep", nullptr);
//Create the sheep attributes.
sprintf_s(buffer, 128, "%d", sheepGen);
@ -366,7 +366,7 @@ public:
else
{
//Insert a (parent has no edit) message.
nodeCopy = xmlNewChild(rootNode, NULL, XC "edit", NULL);
nodeCopy = xmlNewChild(rootNode, nullptr, XC "edit", nullptr);
AddFilenameWithoutAmpersand(nodeCopy, parent0->m_ParentFilename);
sprintf_s(buffer, 128, "%d", parent0->m_Index);
xmlNewProp(nodeCopy, XC "index", XC buffer);
@ -388,7 +388,7 @@ public:
else
{
//Insert a (parent has no edit) message.
nodeCopy = xmlNewChild(rootNode, NULL, XC "edit",NULL);
nodeCopy = xmlNewChild(rootNode, nullptr, XC "edit",nullptr);
AddFilenameWithoutAmpersand(nodeCopy, parent1->m_ParentFilename);
sprintf_s(buffer, 128, "%d", parent1->m_Index);
xmlNewProp(nodeCopy, XC "index", XC buffer);
@ -405,10 +405,10 @@ public:
if (comment != "")
{
sprintf_s(commentString, 128, "<comm>%s</comm>", comment.c_str());
commentDoc = xmlReadMemory(commentString, (int)strlen(commentString), "comment.env", NULL, XML_PARSE_NONET);
commentDoc = xmlReadMemory(commentString, (int)strlen(commentString), "comment.env", nullptr, XML_PARSE_NONET);
//Check for errors.
if (commentDoc != NULL)
if (commentDoc != nullptr)
{
//Loop through the children of the new document and copy them into the rootNode.
@ -567,9 +567,9 @@ private:
const char* tabString = " ", *attStr;
const char* editString = "edit";
const char* sheepString = "sheep";
unsigned int ti, editOrSheep = 0;
xmlAttrPtr attPtr = NULL, curAtt = NULL;
xmlNodePtr childPtr = NULL, curChild = NULL;
unsigned int ti;//, editOrSheep = 0;
xmlAttrPtr attPtr = nullptr, curAtt = nullptr;
xmlNodePtr childPtr = nullptr, curChild = nullptr;
ostringstream os;
if (printEditDepth > 0 && tabs > printEditDepth)
@ -589,13 +589,13 @@ private:
//If it's an edit node, add one to the tab.
if (!Compare(editNode->name, editString))
{
editOrSheep = 1;
//editOrSheep = 1;
tabs++;
}
else if (!Compare(editNode->name, sheepString))
editOrSheep = 2;
else
editOrSheep = 0;
else if (!Compare(editNode->name, sheepString)) { }
//editOrSheep = 2;
else { }
//editOrSheep = 0;
//Print the attributes.
attPtr = editNode->properties;

View File

@ -92,7 +92,7 @@ public:
else if (i < count - 1)
destOtherXform = destEmbers[i + 1].GetTotalXform(xf);
else
destOtherXform = NULL;//Should never happen
destOtherXform = nullptr;//Should never happen
if (destOtherXform)
MergeXformVariations1Way(destOtherXform, destXform, true, true);
@ -244,7 +244,7 @@ public:
if (xf >= sourceEmbers[i + ii].TotalXformCount())
continue;
Xform<T>* destOtherXform = destEmbers[i + ii].GetTotalXform(xf);
destOtherXform = destEmbers[i + ii].GetTotalXform(xf);
if (destOtherXform->GetVariationById(VAR_FAN))
{
@ -545,7 +545,7 @@ public:
static void InterpParametricVar(vector<ParametricVariation<T>*>& first, ParametricVariation<T>* second, vector<T>& c)
{
//First, make sure the variation vector is the same size as the coefficient vector.
if (second != NULL && first.size() == c.size())
if (second != nullptr && first.size() == c.size())
{
second->Clear();
ParamWithName<T>* secondParams = second->Params();

View File

@ -80,8 +80,8 @@ public:
/// <param name="a">First random seed. Default: 0.</param>
/// <param name="b">Second random seed. Default: 0.</param>
/// <param name="c">Third random seed. Default: 0.</param>
/// <param name="s">Pointer to a buffer of 256 random integer seeds. Default: NULL.</param>
QTIsaac(T a = 0, T b = 0, T c = 0, T* s = NULL)
/// <param name="s">Pointer to a buffer of 256 random integer seeds. Default: nullptr.</param>
QTIsaac(T a = 0, T b = 0, T c = 0, T* s = nullptr)
{
Srand(a, b, c, s);
}
@ -255,10 +255,10 @@ public:
/// <param name="a">First random seed. Default: 0.</param>
/// <param name="b">Second random seed. Default: 0.</param>
/// <param name="c">Third random seed. Default: 0.</param>
/// <param name="s">Pointer to a buffer of 256 random integer seeds. Default: NULL.</param>
void Srand(T a = 0, T b = 0, T c = 0, T* s = NULL)
/// <param name="s">Pointer to a buffer of 256 random integer seeds. Default: nullptr.</param>
void Srand(T a = 0, T b = 0, T c = 0, T* s = nullptr)
{
if (s == NULL)//Default to using time plus index as the seed if s was NULL.
if (s == nullptr)//Default to using time plus index as the seed if s was nullptr.
{
for (int i = 0; i < N; i++)
m_Rc.randrsl[i] = (T)time(0) + i;
@ -272,9 +272,9 @@ public:
#ifndef ISAAC_FLAM3_DEBUG
if (a == 0 && b == 0 && c == 0)
{
m_Rc.randa = (T)time(0);
m_Rc.randb = (T)time(0) * (T)time(0);
m_Rc.randc = (T)time(0) * (T)time(0) * (T)time(0);
m_Rc.randa = (T)time(nullptr);
m_Rc.randb = (T)time(nullptr) * (T)time(nullptr);
m_Rc.randc = (T)time(nullptr) * (T)time(nullptr) * (T)time(nullptr);
}
else
#endif

View File

@ -57,7 +57,7 @@ public:
/// <summary>
/// Accessors.
/// </summary>
const unsigned char* XformDistributions() const { return m_XformDistributions.empty() ? NULL : &m_XformDistributions[0]; }
const unsigned char* XformDistributions() const { return m_XformDistributions.empty() ? nullptr : &m_XformDistributions[0]; }
const unsigned int XformDistributionsSize() const { return (unsigned int)m_XformDistributions.size(); }
/// <summary>

View File

@ -115,6 +115,14 @@ public:
Palette<T>::operator=<U>(palette);
}
/// <summary>
/// Empty destructor.
/// Needed to eliminate warnings about inlining.
/// </summary>
~Palette()
{
}
/// <summary>
/// Default assignment operator.
/// </summary>

View File

@ -45,9 +45,9 @@ public:
if (ReadFile(filename.c_str(), buf))
{
xmlDocPtr doc = xmlReadMemory((const char*)buf.data(), (int)buf.size(), filename.c_str(), NULL, XML_PARSE_NONET);
xmlDocPtr doc = xmlReadMemory((const char*)buf.data(), (int)buf.size(), filename.c_str(), nullptr, XML_PARSE_NONET);
if (doc != NULL)
if (doc != nullptr)
{
xmlNode* rootNode = xmlDocGetRootElement(doc);
@ -74,7 +74,7 @@ public:
/// Gets the palette at a specified index.
/// </summary>
/// <param name="i">The index of the palette to read. A value of -1 indicates a random palette.</param>
/// <returns>A pointer to the requested palette if the index was in range, else NULL.</returns>
/// <returns>A pointer to the requested palette if the index was in range, else nullptr.</returns>
Palette<T>* GetPalette(int i)
{
if (!m_Palettes.empty())
@ -85,21 +85,21 @@ public:
return &m_Palettes[i];
}
return NULL;
return nullptr;
}
/// <summary>
/// Gets a pointer to a palette with a specified name.
/// </summary>
/// <param name="name">The name of the palette to retrieve</param>
/// <returns>A pointer to the palette if found, else NULL</returns>
/// <returns>A pointer to the palette if found, else nullptr</returns>
Palette<T>* GetPaletteByName(string& name)
{
for (unsigned int i = 0; i < Count(); i++)
if (m_Palettes[i].m_Name == name)
return &m_Palettes[i];
return NULL;
return nullptr;
}
/// <summary>
@ -166,7 +166,7 @@ private:
if (!Compare(attr->name, "data"))
{
int colorIndex = 0;
int r, g, b;
unsigned int r, g, b;
int colorCount = 0;
hexError = false;

View File

@ -23,11 +23,11 @@ Renderer<T, bucketT>::Renderer()
m_PixelAspectRatio = 1;
m_Transparency = false;
ThreadCount(Timing::ProcessorCount());
m_StandardIterator = auto_ptr<StandardIterator<T>>(new StandardIterator<T>());
m_XaosIterator = auto_ptr<XaosIterator<T>>(new XaosIterator<T>());
m_StandardIterator = unique_ptr<StandardIterator<T>>(new StandardIterator<T>());
m_XaosIterator = unique_ptr<XaosIterator<T>>(new XaosIterator<T>());
m_Iterator = m_StandardIterator.get();
m_Callback = NULL;
m_ProgressParameter = NULL;
m_Callback = nullptr;
m_ProgressParameter = nullptr;
m_LastPass = 0;
m_LastTemporalSample = 0;
m_LastIter = 0;
@ -256,7 +256,7 @@ void Renderer<T, bucketT>::AddEmber(Ember<T>& ember)
/// from the last temporal filter created.
/// </summary>
/// <param name="newAlloc">True if a new filter instance was created, else false.</param>
/// <returns>True if the filter is not NULL (whether a new one was created or not), else false.</returns>
/// <returns>True if the filter is not nullptr (whether a new one was created or not), else false.</returns>
template <typename T, typename bucketT>
bool Renderer<T, bucketT>::CreateTemporalFilter(bool& newAlloc)
{
@ -270,12 +270,12 @@ bool Renderer<T, bucketT>::CreateTemporalFilter(bool& newAlloc)
(m_Ember.m_TemporalFilterWidth != m_TemporalFilter->FilterWidth()) ||
(m_Ember.m_TemporalFilterExp != m_TemporalFilter->FilterExp()))
{
m_TemporalFilter = auto_ptr<TemporalFilter<T>>(
m_TemporalFilter = unique_ptr<TemporalFilter<T>>(
TemporalFilterCreator<T>::Create(m_Ember.m_TemporalFilterType, m_Ember.m_Passes, m_Ember.m_TemporalSamples, m_Ember.m_TemporalFilterWidth, m_Ember.m_TemporalFilterExp));
newAlloc = true;
}
return m_TemporalFilter.get() != NULL;
return m_TemporalFilter.get() != nullptr;
}
/// <summary>
@ -363,7 +363,7 @@ eRenderStatus Renderer<T, bucketT>::Run(vector<unsigned char>& finalImage, doubl
bool accumOnly = m_ProcessAction == ACCUM_ONLY;
bool resume = m_ProcessState != NONE;
bool newFilterAlloc;
unsigned int temporalSample, pass;
unsigned int temporalSample = 0, pass;
T deTime;
eRenderStatus success = RENDER_OK;
//double iterationTime = 0;
@ -442,7 +442,7 @@ eRenderStatus Renderer<T, bucketT>::Run(vector<unsigned char>& finalImage, doubl
CreateTemporalFilter(newFilterAlloc);
ComputeBounds();
if (m_SpatialFilter.get() == NULL || m_TemporalFilter.get() == NULL)
if (m_SpatialFilter.get() == nullptr || m_TemporalFilter.get() == nullptr)
{
m_ErrorReport.push_back("Spatial and temporal filter allocations failed, aborting.\n");
success = RENDER_ERROR;
@ -509,7 +509,6 @@ eRenderStatus Renderer<T, bucketT>::Run(vector<unsigned char>& finalImage, doubl
//The actual number of times to iterate. Each thread will get (totalIters / ThreadCount) iters to do.
//This is based on zoom and scale calculated in ComputeCamera().
//Note that the iter count is based on the final image dimensions, and not the super sampled dimensions.
uint64_t totalIterCount = TotalIterCount();
uint64_t itersPerTemporalSample = ItersPerTemporalSample();//The total number of iterations for this temporal sample in this pass without overrides.
uint64_t sampleItersToDo;//The number of iterations to actually do in this sample in this pass, considering overrides.
@ -786,7 +785,7 @@ uint64_t Renderer<T, bucketT>::MemoryAvailable()
static int mib[2] = { CTL_HW, HW_PHYSMEM };
#endif
if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0 && len == sizeof(physmem))
if (sysctl(mib, 2, &physmem, &len, nullptr, 0) == 0 && len == sizeof(physmem))
{
memAvailable = physmem;
}
@ -840,7 +839,7 @@ bool Renderer<T, bucketT>::Ok() const
/// log scale filtering will be used.
/// </summary>
/// <param name="newAlloc">True if a new filter instance was created, else false.</param>
/// <returns>True if the filter is not NULL (whether a new one was created or not) or if max rad is 0, else false.</returns>
/// <returns>True if the filter is not nullptr (whether a new one was created or not) or if max rad is 0, else false.</returns>
template <typename T, typename bucketT>
bool Renderer<T, bucketT>::CreateDEFilter(bool& newAlloc)
{
@ -856,7 +855,7 @@ bool Renderer<T, bucketT>::CreateDEFilter(bool& newAlloc)
(m_Ember.m_CurveDE != m_DensityFilter->Curve()) ||
(m_Ember.m_Supersample != m_DensityFilter->Supersample()))
{
m_DensityFilter = auto_ptr<DensityFilter<T>>(new DensityFilter<T>(m_Ember.m_MinRadDE, m_Ember.m_MaxRadDE, m_Ember.m_CurveDE, m_Ember.m_Supersample));
m_DensityFilter = unique_ptr<DensityFilter<T>>(new DensityFilter<T>(m_Ember.m_MinRadDE, m_Ember.m_MaxRadDE, m_Ember.m_CurveDE, m_Ember.m_Supersample));
newAlloc = true;
}
@ -882,7 +881,7 @@ bool Renderer<T, bucketT>::CreateDEFilter(bool& newAlloc)
/// from the last spatial filter created.
/// </summary>
/// <param name="newAlloc">True if a new filter instance was created, else false.</param>
/// <returns>True if the filter is not NULL (whether a new one was created or not), else false.</returns>
/// <returns>True if the filter is not nullptr (whether a new one was created or not), else false.</returns>
template <typename T, typename bucketT>
bool Renderer<T, bucketT>::CreateSpatialFilter(bool& newAlloc)
{
@ -895,12 +894,12 @@ bool Renderer<T, bucketT>::CreateSpatialFilter(bool& newAlloc)
(m_Ember.m_Supersample != m_SpatialFilter->Supersample()) ||
(m_PixelAspectRatio != m_SpatialFilter->PixelAspectRatio()))
{
m_SpatialFilter = auto_ptr<SpatialFilter<T>>(
m_SpatialFilter = unique_ptr<SpatialFilter<T>>(
SpatialFilterCreator<T>::Create(m_Ember.m_SpatialFilterType, m_Ember.m_SpatialFilterRadius, m_Ember.m_Supersample, m_PixelAspectRatio));
newAlloc = true;
}
return m_SpatialFilter.get() != NULL;
return m_SpatialFilter.get() != nullptr;
}
/// <summary>
@ -972,7 +971,7 @@ unsigned int Renderer<T, bucketT>::ThreadCount() const { return m_ThreadsToUse;
/// Reset the rendering process.
/// </summary>
/// <param name="threads">The number of threads to use</param>
/// <param name="seedString">The seed string to use if threads is 1. Default: NULL.</param>
/// <param name="seedString">The seed string to use if threads is 1. Default: nullptr.</param>
template <typename T, typename bucketT>
void Renderer<T, bucketT>::ThreadCount(unsigned int threads, const char* seedString)
{
@ -1681,7 +1680,7 @@ EmberStats Renderer<T, bucketT>::Iterate(uint64_t iterCount, unsigned int pass,
/// </summary>
/// <returns>The vector of random contexts to assign</returns>
template <typename T, typename bucketT>
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> Renderer<T, bucketT>::RandVec() { return m_Rand; };
vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>> Renderer<T, bucketT>::RandVec() { return m_Rand; }
/// <summary>
/// Set the vector of random contexts.
@ -1706,7 +1705,7 @@ bool Renderer<T, bucketT>::RandVec(vector<QTIsaac<ISAAC_SIZE, ISAAC_INT>>& randV
}
return b;
};
}
/// <summary>
/// Get whether the histogram is locked during accumulation.
@ -2240,7 +2239,7 @@ template <typename T, typename bucketT> ePaletteMode Renderer<T, bucketT
/// Iterator wrappers.
/// </summary>
template <typename T, typename bucketT> const unsigned char* Renderer<T, bucketT>::XformDistributions() const { return m_Iterator != NULL ? m_Iterator->XformDistributions() : NULL; }
template <typename T, typename bucketT> const unsigned int Renderer<T, bucketT>::XformDistributionsSize() const { return m_Iterator != NULL ? m_Iterator->XformDistributionsSize() : 0; }
template <typename T, typename bucketT> Point<T>* Renderer<T, bucketT>::Samples(unsigned int threadIndex) const { return threadIndex < m_Samples.size() ? (Point<T>*)m_Samples[threadIndex].data() : NULL; }
template <typename T, typename bucketT> const unsigned char* Renderer<T, bucketT>::XformDistributions() const { return m_Iterator != nullptr ? m_Iterator->XformDistributions() : nullptr; }
template <typename T, typename bucketT> const unsigned int Renderer<T, bucketT>::XformDistributionsSize() const { return m_Iterator != nullptr ? m_Iterator->XformDistributionsSize() : 0; }
template <typename T, typename bucketT> Point<T>* Renderer<T, bucketT>::Samples(unsigned int threadIndex) const { return threadIndex < m_Samples.size() ? (Point<T>*)m_Samples[threadIndex].data() : nullptr; }
}

View File

@ -119,7 +119,7 @@ public:
virtual void EarlyClip(bool earlyClip) { }
virtual bool YAxisUp() const { return false; }
virtual void YAxisUp(bool yup) { }
virtual void ThreadCount(unsigned int threads, const char* seedString = NULL) { }
virtual void ThreadCount(unsigned int threads, const char* seedString = nullptr) { }
virtual void Transparency(bool transparency) { }
virtual void InteractiveFilter(eInteractiveFilter filter) { }
virtual unsigned int FinalRasW() const { return 0; }
@ -141,7 +141,7 @@ public:
virtual EmberStats Stats() const { EmberStats stats; return stats; }
virtual eRenderStatus Run(vector<unsigned char>& finalImage, double time = 0, unsigned int subBatchCountOverride = 0, bool forceOutput = false, size_t finalOffset = 0) { return RENDER_ERROR; }
virtual EmberImageComments ImageComments(unsigned int printEditDepth = 0, bool intPalette = false, bool hexPalette = true) { EmberImageComments comments; return comments; }
virtual DensityFilterBase* GetDensityFilter() { return NULL; }
virtual DensityFilterBase* GetDensityFilter() { return nullptr; }
};
/// <summary>
@ -204,7 +204,7 @@ public:
virtual void NumChannels(unsigned int numChannels);
virtual eRendererType RendererType() const;
virtual unsigned int ThreadCount() const;
virtual void ThreadCount(unsigned int threads, const char* seedString = NULL);
virtual void ThreadCount(unsigned int threads, const char* seedString = nullptr);
virtual void Callback(RenderCallback* callback);
protected:
@ -341,7 +341,7 @@ protected:
private:
//Miscellaneous functions used only in this class.
void Accumulate(Point<T>* samples, unsigned int sampleCount, const Palette<bucketT>* palette);
inline void AddToAccum(const glm::detail::tvec4<bucketT, glm::defaultp>& bucket, int i, int ii, int j, int jj);
/*inline*/ void AddToAccum(const glm::detail::tvec4<bucketT, glm::defaultp>& bucket, int i, int ii, int j, int jj);
template <typename accumT> void GammaCorrection(glm::detail::tvec4<bucketT, glm::defaultp>& bucket, Color<T>& background, T g, T linRange, T vibrancy, bool doAlpha, bool scale, accumT* correctedChannels);
protected:
@ -395,14 +395,14 @@ protected:
CarToRas<T> m_CarToRas;
RenderCallback* m_Callback;
Iterator<T>* m_Iterator;
auto_ptr<StandardIterator<T>> m_StandardIterator;
auto_ptr<XaosIterator<T>> m_XaosIterator;
unique_ptr<StandardIterator<T>> m_StandardIterator;
unique_ptr<XaosIterator<T>> m_XaosIterator;
Palette<bucketT> m_Dmap;
vector<glm::detail::tvec4<bucketT, glm::defaultp>> m_HistBuckets;
vector<glm::detail::tvec4<bucketT, glm::defaultp>> m_AccumulatorBuckets;
auto_ptr<SpatialFilter<T>> m_SpatialFilter;
auto_ptr<TemporalFilter<T>> m_TemporalFilter;
auto_ptr<DensityFilter<T>> m_DensityFilter;
unique_ptr<SpatialFilter<T>> m_SpatialFilter;
unique_ptr<TemporalFilter<T>> m_TemporalFilter;
unique_ptr<DensityFilter<T>> m_DensityFilter;
vector<vector<Point<T>>> m_Samples;
vector<uint64_t> m_SubBatch;
vector<uint64_t> m_BadVals;

View File

@ -73,9 +73,9 @@ public:
m_OffsetY = 0;
m_PaletteList.Init(palettePath);
m_StandardIterator = auto_ptr<StandardIterator<T>>(new StandardIterator<T>());
m_XaosIterator = auto_ptr<XaosIterator<T>>(new XaosIterator<T>());
m_Renderer = auto_ptr<Renderer<T, bucketT>>(renderer);
m_StandardIterator = unique_ptr<StandardIterator<T>>(new StandardIterator<T>());
m_XaosIterator = unique_ptr<XaosIterator<T>>(new XaosIterator<T>());
m_Renderer = unique_ptr<Renderer<T, bucketT>>(renderer);
m_Rand = QTIsaac<ISAAC_SIZE, ISAAC_INT>(ISAAC_INT(t.Tic()), ISAAC_INT(t.Tic() * 2), ISAAC_INT(t.Tic() * 3));
}
@ -140,8 +140,8 @@ public:
do
{
Variation<T>* var = NULL;
Variation<T>* smallestVar = NULL;
Variation<T>* var = nullptr;
Variation<T>* smallestVar = nullptr;
numVars = 0;
smallest = -1;
@ -238,7 +238,7 @@ public:
Variation<T>* var1 = xform1->GetVariation(j);
Variation<T>* var2 = xform2->GetVariationById(var1->VariationId());
if ((var1 == NULL) ^ (var2 == NULL))//If any of them are different, clear the first and copy all of the second and exit the while loop.
if ((var1 == nullptr) ^ (var2 == nullptr))//If any of them are different, clear the first and copy all of the second and exit the while loop.
{
xform1->ClearAndDeleteVariations();
@ -304,29 +304,29 @@ public:
if (b & 1)
{
T f = T(M_PI) * m_Rand.Frand11<T>();
T a, b, d, e;
T ra, rb, rd, re;
a = (xform->m_Affine.A() * cos(f) + xform->m_Affine.B() * -sin(f));
d = (xform->m_Affine.A() * sin(f) + xform->m_Affine.D() * cos(f));
b = (xform->m_Affine.B() * cos(f) + xform->m_Affine.E() * -sin(f));
e = (xform->m_Affine.B() * sin(f) + xform->m_Affine.E() * cos(f));
ra = (xform->m_Affine.A() * cos(f) + xform->m_Affine.B() * -sin(f));
rd = (xform->m_Affine.A() * sin(f) + xform->m_Affine.D() * cos(f));
rb = (xform->m_Affine.B() * cos(f) + xform->m_Affine.E() * -sin(f));
re = (xform->m_Affine.B() * sin(f) + xform->m_Affine.E() * cos(f));
xform->m_Affine.A(a);
xform->m_Affine.B(b);
xform->m_Affine.D(d);
xform->m_Affine.E(e);
xform->m_Affine.A(ra);
xform->m_Affine.B(rb);
xform->m_Affine.D(rd);
xform->m_Affine.E(re);
f *= -1;
a = (xform->m_Post.A() * cos(f) + xform->m_Post.B() * -sin(f));
d = (xform->m_Post.A() * sin(f) + xform->m_Post.D() * cos(f));
b = (xform->m_Post.B() * cos(f) + xform->m_Post.E() * -sin(f));
e = (xform->m_Post.B() * sin(f) + xform->m_Post.E() * cos(f));
ra = (xform->m_Post.A() * cos(f) + xform->m_Post.B() * -sin(f));
rd = (xform->m_Post.A() * sin(f) + xform->m_Post.D() * cos(f));
rb = (xform->m_Post.B() * cos(f) + xform->m_Post.E() * -sin(f));
re = (xform->m_Post.B() * sin(f) + xform->m_Post.E() * cos(f));
xform->m_Post.A(a);
xform->m_Post.B(b);
xform->m_Post.D(d);
xform->m_Post.E(e);
xform->m_Post.A(ra);
xform->m_Post.B(rb);
xform->m_Post.D(rd);
xform->m_Post.E(re);
}
//33% chance.
@ -877,7 +877,7 @@ public:
m_Renderer->PixelAspectRatio(1);
m_Renderer->ThreadCount(Timing::ProcessorCount());
m_Renderer->SubBatchSize(10000);
m_Renderer->Callback(NULL);
m_Renderer->Callback(nullptr);
if (m_Renderer->Run(m_FinalImage) != RENDER_OK)
{
@ -919,7 +919,7 @@ public:
if (changePalette)
{
Palette<T>* palette;
Palette<T>* palette = nullptr;
ember.m_Hue = 0.0;
@ -965,7 +965,7 @@ public:
/// </summary>
/// <param name="ember">The ember to get a random xform from</param>
/// <param name="excluded">Optionally exclude an xform. Pass -1 to include all for consideration.</param>
/// <returns>The random xform if successful, else NULL.</returns>
/// <returns>The random xform if successful, else nullptr.</returns>
Xform<T>* RandomXform(Ember<T>& ember, int excluded)
{
int ntries = 0;
@ -983,7 +983,7 @@ public:
}
}
return NULL;
return nullptr;
}
/// <summary>
@ -1078,7 +1078,7 @@ public:
/// Apply subpixel jitter to center using offset members.
/// </summary>
/// <param name="parent">The ember to spin</param>
/// <param name="templ">The template to apply if not NULL, else ignore.</param>
/// <param name="templ">The template to apply if not nullptr, else ignore.</param>
/// <param name="result">The result of the spin</param>
/// <param name="frame">The frame in the sequence to be stored in the m_Time member of result</param>
/// <param name="blend">The interpolation time</param>
@ -1101,7 +1101,7 @@ public:
//Create the edit doc xml.
sprintf_s(temp, 50, "rotate %g", blend * 360.0);
result.ClearEdit();
result.m_Edits = m_EmberToXml.CreateNewEditdoc(&parent, NULL, temp, m_Nick, m_Url, m_Id, m_Comment, m_SheepGen, m_SheepId);
result.m_Edits = m_EmberToXml.CreateNewEditdoc(&parent, nullptr, temp, m_Nick, m_Url, m_Id, m_Comment, m_SheepGen, m_SheepId);
//Subpixel jitter.
Offset(result, m_OffsetX, m_OffsetY);
@ -1118,7 +1118,7 @@ public:
/// Apply subpixel jitter to center using offset members.
/// </summary>
/// <param name="parents">The embers to interpolate</param>
/// <param name="templ">The template to apply if not NULL, else ignore.</param>
/// <param name="templ">The template to apply if not nullptr, else ignore.</param>
/// <param name="result">The result of the spin</param>
/// <param name="frame">The frame in the sequence to be stored in the m_Time member of result</param>
/// <param name="seqFlag">True if embers points to the first or last ember in the entire sequence, else false.</param>
@ -1384,9 +1384,9 @@ private:
vector<unsigned int> m_Hist;
EmberToXml<T> m_EmberToXml;
Iterator<T>* m_Iterator;
auto_ptr<StandardIterator<T>> m_StandardIterator;
auto_ptr<XaosIterator<T>> m_XaosIterator;
auto_ptr<Renderer<T, bucketT>> m_Renderer;
unique_ptr<StandardIterator<T>> m_StandardIterator;
unique_ptr<XaosIterator<T>> m_XaosIterator;
unique_ptr<Renderer<T, bucketT>> m_Renderer;
QTIsaac<ISAAC_SIZE, ISAAC_INT> m_Rand;
PaletteList<T> m_PaletteList;
VariationList<T> m_VariationList;

View File

@ -758,7 +758,7 @@ public:
/// <returns>A pointer to the newly created filter object</returns>
static SpatialFilter<T>* Create(eSpatialFilterType filterType, T filterRadius, unsigned int superSample, T pixelAspectRatio = 1)
{
SpatialFilter<T>* filter = NULL;
SpatialFilter<T>* filter = nullptr;
if (filterType == GAUSSIAN_SPATIAL_FILTER)
filter = new GaussianFilter<T>(filterRadius, superSample, pixelAspectRatio);

View File

@ -307,7 +307,7 @@ public:
/// <returns>A pointer to the newly created filter object</returns>
static TemporalFilter<T>* Create(eTemporalFilterType filterType, unsigned int passes, unsigned int temporalSamples, T filterWidth, T filterExp = 1)
{
TemporalFilter<T>* filter = NULL;
TemporalFilter<T>* filter = nullptr;
if (filterType == BOX_TEMPORAL_FILTER)
filter = new BoxTemporalFilter<T>(passes, temporalSamples, filterWidth);

View File

@ -42,15 +42,15 @@ public:
/// <summary>
/// Set the end time and optionally output a string showing the elapsed time.
/// </summary>
/// <param name="str">The string to output. Default: NULL.</param>
/// <param name="str">The string to output. Default: nullptr.</param>
/// <param name="fullString">If true, output the string verbatim, else output the text " processing time: " in between str and the formatted time.</param>
/// <returns>The elapsed time in milliseconds as a double</returns>
double Toc(const char* str = NULL, bool fullString = false)
double Toc(const char* str = nullptr, bool fullString = false)
{
m_EndTime = Clock::now();
double ms = ElapsedTime();
if (str != NULL)
if (str != nullptr)
{
cout << string(str) << (fullString ? "" : " processing time: ") << Format(ms) << endl;
}

View File

@ -40,6 +40,14 @@ static inline void ForEach(c& container, fn func)
class EMBER_API EmberImageComments
{
public:
/// <summary>
/// Empty destructor.
/// Needed to eliminate warnings about inlining.
/// </summary>
~EmberImageComments()
{
}
/// <summary>
/// Set all values to the empty string.
/// </summary>
@ -68,6 +76,11 @@ public:
class EMBER_API EmberReport
{
public:
/// <summary>
/// Virtual destructor needed for virtual classes.
/// </summary>
virtual ~EmberReport() { }
/// <summary>
/// Write the entire error report as a single string to the console.
/// Derived classes with members that also derive from EmberReport should override this to capture
@ -144,13 +157,13 @@ protected:
static bool ReadFile(const char* filename, string& buf, bool nullTerminate = true)
{
bool b = false;
FILE* f;
FILE* f = nullptr;
try
{
fopen_s(&f, filename, "rb");//Open in binary mode.
if (f != NULL)
if (f != nullptr)
{
struct _stat statBuf;
@ -162,15 +175,15 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
if (statResult == 0)//Check if statistics are valid.
{
buf.resize(statBuf.st_size + (nullTerminate ? 1 : 0));//Allocate vector to be the size of the entire file, with an optional additional character for NULL.
buf.resize(statBuf.st_size + (nullTerminate ? 1 : 0));//Allocate vector to be the size of the entire file, with an optional additional character for nullptr.
if (buf.size() == statBuf.st_size + 1)//Ensure allocation succeeded.
if (buf.size() == (size_t)(statBuf.st_size + 1))//Ensure allocation succeeded.
{
size_t bytesRead = fread(&buf[0], 1, statBuf.st_size, f);//Read the entire file at once.
if (bytesRead == statBuf.st_size)//Ensure the number of bytes read matched what was requested.
if (bytesRead == (size_t)statBuf.st_size)//Ensure the number of bytes read matched what was requested.
{
if (nullTerminate)//Optionally NULL terminate if they want to treat it as a string.
if (nullTerminate)//Optionally nullptr terminate if they want to treat it as a string.
buf[buf.size() - 1] = 0;
b = true;//Success.
@ -183,7 +196,7 @@ static bool ReadFile(const char* filename, string& buf, bool nullTerminate = tru
}
catch (...)
{
if (f != NULL)
if (f != nullptr)
fclose(f);
b = false;
@ -209,7 +222,7 @@ static void CopyVec(vector<T>& dest, const vector<U>& source)
}
/// <summary>
/// Clear a vector of pointers to any type by checking each element for NULL and calling delete on it, then clearing the entire vector.
/// Clear a vector 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.
/// </summary>
/// <param name="vec">The vector to be cleared</param>
@ -219,7 +232,7 @@ static void ClearVec(vector<T*>& vec, bool arrayDelete = false)
{
for (unsigned int i = 0; i < vec.size(); i++)
{
if (vec[i] != NULL)
if (vec[i] != nullptr)
{
if (arrayDelete)
delete [] vec[i];
@ -227,31 +240,12 @@ static void ClearVec(vector<T*>& vec, bool arrayDelete = false)
delete vec[i];
}
vec[i] = NULL;
vec[i] = nullptr;
}
vec.clear();
}
/// <summary>
/// Convert an RGBA buffer to an RGB buffer.
/// </summary>
/// <param name="rgba">The RGBA buffer</param>
/// <param name="rgb">The RGB buffer</param>
/// <param name="width">The width of the image in pixels</param>
/// <param name="height">The height of the image in pixels</param>
static void RgbaToRgb(vector<unsigned char>& rgba, vector<unsigned char>& rgb, unsigned int width, unsigned int height)
{
rgb.resize(width * height * 3);
for (unsigned int i = 0, j = 0; i < (width * height * 4); i += 4, j += 3)
{
rgb[j] = rgba[i];
rgb[j + 1] = rgba[i + 1];
rgb[j + 2] = rgba[i + 2];
}
}
/// <summary>
/// System floor() extremely slow because it accounts for various error conditions.
/// This is a much faster version that works on data that is not NaN.
@ -737,7 +731,7 @@ static inline T NormalizeDeg360(T angle)
/// </summary>
/// <param name="str">The string to copy and make lower case</param>
/// <returns>The lower case string</returns>
static inline string ToLower(const string& str)
static string ToLower(const string& str)
{
string lower;
@ -751,7 +745,7 @@ static inline string ToLower(const string& str)
/// </summary>
/// <param name="str">The string to copy and make upper case</param>
/// <returns>The upper case string</returns>
static inline string ToUpper(const string& str)
static string ToUpper(const string& str)
{
string upper;
@ -767,7 +761,7 @@ static inline string ToUpper(const string& str)
/// <param name="str">The string to trim</param>
/// <param name="ch">The character to trim. Default: space.</param>
/// <returns>The trimmed string</returns>
static inline string Trim(string& str, char ch = ' ')
static string Trim(string& str, char ch = ' ')
{
string ret;
@ -817,8 +811,8 @@ int Arg<int>(char* name, int def)
{
char* ch;
int returnVal;
size_t len;
#ifdef WIN32
size_t len;
errno_t err = _dupenv_s(&ch, &len, name);
#else
int err = 1;
@ -880,8 +874,8 @@ double Arg<double>(char* name, double def)
{
char* ch;
double returnVal;
size_t len;
#ifdef WIN32
size_t len;
errno_t err = _dupenv_s(&ch, &len, name);
#else
int err = 1;
@ -913,8 +907,8 @@ string Arg<string>(char* name, string def)
{
char* ch;
string returnVal;
size_t len;
#ifdef WIN32
size_t len;
errno_t err = _dupenv_s(&ch, &len, name);
#else
int err = 1;

View File

@ -1009,7 +1009,7 @@ public:
bool needPrecalcAtanYX = false)
: m_Name(name)//Omit unnecessary default constructor call.
{
m_Xform = NULL;
m_Xform = nullptr;
m_VariationId = id;
m_Weight = weight;
m_NeedPrecalcSumSquares = needPrecalcSumSquares;
@ -1085,7 +1085,7 @@ public:
m_AssignType = variation.AssignType();
m_VariationId = variation.VariationId();
m_Weight = T(variation.m_Weight);
m_Xform = typeid(T) == typeid(U) ? (Xform<T>*)variation.ParentXform() : NULL;
m_Xform = typeid(T) == typeid(U) ? (Xform<T>*)variation.ParentXform() : nullptr;
m_NeedPrecalcSumSquares = variation.NeedPrecalcSumSquares();
m_NeedPrecalcSqrtSumSquares = variation.NeedPrecalcSqrtSumSquares();
m_NeedPrecalcAngles = variation.NeedPrecalcAngles();
@ -1403,7 +1403,7 @@ public:
/// </summary>
ParamWithName()
{
Init(NULL, "", 0, REAL, TLOW, TMAX);
Init(nullptr, "", 0, REAL, TLOW, TMAX);
}
/// <summary>
@ -1541,6 +1541,7 @@ public:
}
case INTEGER_NONZERO :
default:
{
int vi = (int)max(min<T>((T)Floor<T>(val + T(0.5)), m_Max), m_Min);
@ -1660,6 +1661,14 @@ public:
m_Params.reserve(5);
}
/// <summary>
/// Empty virtual destructor.
/// Needed to eliminate warnings about inlining.
/// </summary>
virtual ~ParametricVariation()
{
}
/// <summary>
/// Determine whether the params vector contains a parameter with the specified name.
/// </summary>
@ -1689,7 +1698,7 @@ public:
if (!_stricmp(m_Params[i].Name().c_str(), name))
return m_Params[i].Param();
return NULL;
return nullptr;
}
/// <summary>
@ -1857,13 +1866,11 @@ protected:
using Variation<T>::XformIndexInEmber; \
using Variation<T>::Prefix;
//using Variation<T>::Precalc; \
#ifdef DO_DOUBLE
#define VARCOPYDOUBLE(name) \
virtual void Copy(Variation<double>*& var) const override \
{ \
if (var != NULL) \
if (var != nullptr) \
delete var; \
\
var = new name<double>(*this); \
@ -1894,7 +1901,7 @@ protected:
\
virtual void Copy(Variation<float>*& var) const override \
{ \
if (var != NULL) \
if (var != nullptr) \
delete var; \
\
var = new name<float>(*this); \
@ -1921,7 +1928,7 @@ protected:
\
virtual void Copy(Variation<float>*& var) const override \
{ \
if (var != NULL) \
if (var != nullptr) \
delete var; \
\
var = new name<float>(*this); \
@ -1981,8 +1988,6 @@ protected:
using ParametricVariation<T>::m_Params; \
using ParametricVariation<T>::CopyParamVals;
//using Variation<T>::Precalc; \
#define PARVARCOPY(name) \
VARUSINGS \
PARVARUSINGS \
@ -2009,7 +2014,7 @@ protected:
\
virtual void Copy(Variation<float>*& var) const override \
{ \
if (var != NULL) \
if (var != nullptr) \
delete var; \
\
var = new name<float>(*this); \
@ -2040,7 +2045,7 @@ protected:
\
virtual void Copy(Variation<float>*& var) const override \
{ \
if (var != NULL) \
if (var != nullptr) \
delete var; \
\
var = new name<float>(*this); \

View File

@ -374,25 +374,25 @@ public:
/// Get a pointer to the variation at the specified index.
/// </summary>
/// <param name="index">The index in the list to retrieve</param>
/// <returns>A pointer to the variation at the index if in range, else NULL.</returns>
Variation<T>* GetVariation(size_t index) { return index < m_Variations.size() ? m_Variations[index] : NULL; }
/// <returns>A pointer to the variation at the index if in range, else nullptr.</returns>
Variation<T>* GetVariation(size_t index) { return index < m_Variations.size() ? m_Variations[index] : nullptr; }
/// <summary>
/// Get a pointer to the variation of a specified type at the specified index.
/// </summary>
/// <param name="index">The index in the list to retrieve</param>
/// <param name="varType">The type of variation to retrieve</param>
/// <returns>A pointer to the variation of the specified type at the index if in range, else NULL.</returns>
/// <returns>A pointer to the variation of the specified type at the index if in range, else nullptr.</returns>
Variation<T>* GetVariation(size_t index, eVariationType varType)
{
if (varType == VARTYPE_REG)
return index < m_RegVariations.size() ? m_RegVariations[index] : NULL;
return index < m_RegVariations.size() ? m_RegVariations[index] : nullptr;
else if (varType == VARTYPE_PRE)
return index < m_PreVariations.size() ? m_PreVariations[index] : NULL;
return index < m_PreVariations.size() ? m_PreVariations[index] : nullptr;
else if (varType == VARTYPE_POST)
return index < m_PostVariations.size() ? m_PostVariations[index] : NULL;
return index < m_PostVariations.size() ? m_PostVariations[index] : nullptr;
else
return NULL;
return nullptr;
}
/// <summary>
@ -401,7 +401,7 @@ public:
/// </summary>
/// <param name="index">The index in the list to make a copy of</param>
/// <param name="weight">The weight to assign the new copy. Default: 1</param>
/// <returns>A pointer to the variation at the index if in range, else NULL.</returns>
/// <returns>A pointer to the variation at the index if in range, else nullptr.</returns>
Variation<T>* GetVariationCopy(size_t index, T weight = 1) { return MakeCopyWithWeight(GetVariation(index), weight); }
Variation<T>* GetVariationCopy(size_t index, eVariationType varType, T weight = 1) { return MakeCopyWithWeight(GetVariation(index, varType), weight); }
@ -409,14 +409,14 @@ public:
/// Get a pointer to the variation with the specified ID.
/// </summary>
/// <param name="id">The ID to search for</param>
/// <returns>A pointer to the variation if found, else NULL.</returns>
/// <returns>A pointer to the variation if found, else nullptr.</returns>
Variation<T>* GetVariation(eVariationId id)
{
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != NULL; i++)
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
if (id == m_Variations[i]->VariationId())
return m_Variations[i];
return NULL;
return nullptr;
}
/// <summary>
@ -425,21 +425,21 @@ public:
/// </summary>
/// <param name="id">The id of the variation in the list to make a copy of</param>
/// <param name="weight">The weight to assign the new copy. Default: 1</param>
/// <returns>A pointer to the variation with a matching ID, else NULL.</returns>
/// <returns>A pointer to the variation with a matching ID, else nullptr.</returns>
Variation<T>* GetVariationCopy(eVariationId id, T weight = 1) { return MakeCopyWithWeight(GetVariation(id), weight); }
/// <summary>
/// Get a pointer to the variation with the specified name.
/// </summary>
/// <param name="name">The name to search for</param>
/// <returns>A pointer to the variation if found, else NULL.</returns>
Variation<T>* GetVariation(string name)
/// <returns>A pointer to the variation if found, else nullptr.</returns>
Variation<T>* GetVariation(string& name)
{
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != NULL; i++)
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
return m_Variations[i];
return NULL;
return nullptr;
}
/// <summary>
@ -448,7 +448,7 @@ public:
/// </summary>
/// <param name="name">The name of the variation in the list to make a copy of</param>
/// <param name="weight">The weight to assign the new copy. Default: 1</param>
/// <returns>A pointer to the variation with a matching name, else NULL.</returns>
/// <returns>A pointer to the variation with a matching name, else nullptr.</returns>
Variation<T>* GetVariationCopy(string name, T weight = 1) { return MakeCopyWithWeight(GetVariation(name), weight); }
/// <summary>
@ -456,21 +456,21 @@ public:
/// Note this is the index in the parametric variations list, not in the master list.
/// </summary>
/// <param name="index">The index in the parametric variations list to retrieve</param>
/// <returns>The parametric variation at the index specified if in range, else NULL.</returns>
ParametricVariation<T>* GetParametricVariation(size_t index) { return index < m_ParametricVariations.size() ? m_ParametricVariations[index] : NULL; }
/// <returns>The parametric variation at the index specified if in range, else nullptr.</returns>
ParametricVariation<T>* GetParametricVariation(size_t index) { return index < m_ParametricVariations.size() ? m_ParametricVariations[index] : nullptr; }
/// <summary>
/// Get a parametric variation with the specified name.
/// </summary>
/// <param name="name">The name of the variation in the parametric variations list to retrieve</param>
/// <returns>The parametric variation with a matching name, else NULL.</returns>
/// <returns>The parametric variation with a matching name, else nullptr.</returns>
ParametricVariation<T>* GetParametricVariation(string name)
{
for (unsigned int i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != NULL; i++)
for (unsigned int i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i] != nullptr; i++)
if (!_stricmp(name.c_str(), m_ParametricVariations[i]->Name().c_str()))
return m_ParametricVariations[i];
return NULL;
return nullptr;
}
/// <summary>
@ -480,7 +480,7 @@ public:
/// <returns>The index of the variation with the matching name, else -1</returns>
int GetVariationIndex(string name)
{
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != NULL; i++)
for (unsigned int i = 0; i < m_Variations.size() && m_Variations[i] != nullptr; i++)
if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str()))
return i;
@ -503,7 +503,7 @@ private:
/// </summary>
/// <param name="var">The variation to copy</param>
/// <param name="weight">The weight to assign it</param>
/// <returns>A pointer to the new variation copy if success, else NULL.</returns>
/// <returns>A pointer to the new variation copy if success, else nullptr.</returns>
Variation<T>* MakeCopyWithWeight(Variation<T>* var, T weight)
{
if (var)
@ -514,7 +514,7 @@ private:
return var2;
}
return NULL;
return nullptr;
}
/// <summary>

View File

@ -727,7 +727,7 @@ public:
virtual void Precalc() override
{
if (m_Xform)//If this variation exists by itself and hasn't been added to an xform yet, m_Xform will be NULL.
if (m_Xform)//If this variation exists by itself and hasn't been added to an xform yet, m_Xform will be nullptr.
{
T dx = m_Xform->m_Affine.C();
T dy = m_Xform->m_Affine.F();
@ -4674,7 +4674,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string invWeight = "parVars[" + ToUpper(m_Params[i++].Name()) + index;

View File

@ -347,7 +347,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
@ -1925,7 +1925,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string repeat = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4435,7 +4435,6 @@ public:
{
T c0 = helper.In.x * m_Vpi;
T c1 = helper.In.y * m_Vpi;
T c2 = helper.In.z * m_Vpi;
T sinc0, cosc0, sinc1, cosc1;
sincos(c0, &sinc0, &cosc0);
@ -4449,7 +4448,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string zscale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4458,7 +4457,6 @@ public:
ss << "\t{\n"
<< "\t\treal_t c0 = vIn.x * " << vpi << ";\n"
<< "\t\treal_t c1 = vIn.y * " << vpi << ";\n"
<< "\t\treal_t c2 = vIn.z * " << vpi << ";\n"
<< "\n"
<< "\t\treal_t sinc0 = sin(c0);\n"
<< "\t\treal_t cosc0 = cos(c0);\n"

View File

@ -1964,7 +1964,6 @@ public:
{
T sinX = sin(helper.In.x);
T cosX = cos(helper.In.x);
T sinY = sin(helper.In.y);
T cosY = cos(helper.In.y);
T bx = Cube(cosX*cosY);
T by = Cube(sinX*cosY);

View File

@ -698,7 +698,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rxSin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -783,7 +783,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rySin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -865,7 +865,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string rzSin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params.
@ -1549,6 +1549,7 @@ public:
r = (rand.Rand((ISAAC_INT)m_Slices) + m_YThickness + rand.Frand01<T>() * (1 - m_YThickness)) / m_Slices;
break;
case 4:
default:
a = (rand.Rand((ISAAC_INT)m_Slices) + m_XThickness + rand.Frand01<T>() * (1 - m_XThickness)) / m_Slices;
r = rand.Frand01<T>();
break;
@ -1562,7 +1563,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string slices = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2830,7 +2831,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string thetaPeriod = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -3209,7 +3210,7 @@ public:
T c = cos(absV);
T sh = sinh(helper.In.x);
T ch = cosh(helper.In.x);
T d = m_Weight * c * sh / absV;
T d = m_Weight * ch * s / absV;
helper.Out.x = m_Weight * sh * c;
helper.Out.y = d * helper.In.y;
@ -3227,7 +3228,7 @@ public:
<< "\t\treal_t c = cos(absV);\n"
<< "\t\treal_t sh = sinh(vIn.x);\n"
<< "\t\treal_t ch = cosh(vIn.x);\n"
<< "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] * c * sh / absV;\n"
<< "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] * ch * s / absV;\n"
<< "\n"
<< "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sh * c;\n"
<< "\t\tvOut.y = d * vIn.y;\n"
@ -4238,7 +4239,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string extended = "parVars[" + ToUpper(m_Params[i++].Name()) + index;

View File

@ -658,6 +658,7 @@ public:
helper.Out.z = ((pz - (m_Smooth * (1 - m_Fill) * pz * znxy)) + (helper.In.z * m_Smooth * m_Fill * znxy)) - lattd;
break;
case 7 :
default:
helper.Out.x = ((px - (m_Smooth * (1 - m_Fill) * px * exnze)) + (helper.In.x * m_Smooth * m_Fill * exnze)) - lattd;
helper.Out.y = ((py - (m_Smooth * (1 - m_Fill) * py * wynze)) + (helper.In.y * m_Smooth * m_Fill * wynze)) - lattd;
helper.Out.z = ((pz - (m_Smooth * (1 - m_Fill) * pz * znxy)) + (helper.In.z * m_Smooth * m_Fill * znxy)) - lattd;
@ -888,6 +889,7 @@ public:
helper.Out.z = pztz * m_Fill * znxy - lattd;
break;
case 7 :
default:
helper.Out.x = pxtx * m_Fill * exnze - lattd;
helper.Out.y = pyty * m_Fill * wynze - lattd;
helper.Out.z = pztz * m_Fill * znxy - lattd;
@ -1078,7 +1080,6 @@ public:
T ww = SQR(helper.In.z);
T atOmegaX = atan2(vv, ww);
T atOmegaY = atan2(uu, ww);
T atOmegaZ = atan2(vv, uu);
T su = sin(helper.In.x);
T cu = cos(helper.In.x);
T sv = sin(helper.In.y);
@ -1110,7 +1111,6 @@ public:
<< "\t\treal_t ww = SQR(vIn.z);\n"
<< "\t\treal_t atOmegaX = atan2(vv, ww);\n"
<< "\t\treal_t atOmegaY = atan2(uu, ww);\n"
<< "\t\treal_t atOmegaZ = atan2(vv, uu);\n"
<< "\t\treal_t su = sin(vIn.x);\n"
<< "\t\treal_t cu = cos(vIn.x);\n"
<< "\t\treal_t sv = sin(vIn.y);\n"
@ -1334,7 +1334,6 @@ public:
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T rmod = rand.Frand01<T>() * T(0.5) + T(0.125);
T kikr = helper.m_PrecalcAtanyx;
T efTez = helper.In.z == 0 ? kikr : helper.In.z;
T r2 = helper.m_PrecalcSumSquares + SQR(efTez);
@ -1364,7 +1363,6 @@ public:
string vv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t rmod = MwcNext01(mwc) * 0.5 + 0.125;\n"
<< "\t\treal_t kikr = precalcAtanyx;\n"
<< "\t\treal_t efTez = vIn.z == 0 ? kikr : vIn.z;\n"
<< "\t\treal_t r2 = precalcSumSquares + SQR(efTez);\n"
@ -1644,7 +1642,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -1780,7 +1778,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string invWeight = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2149,6 +2147,7 @@ public:
helper.Out.z = m_Weight * (rad * sigmas);
break;
case 2://Box.
default:
scale = Clamp<T>(rs, 0, T(0.9)) + T(0.1);
denom = 1 / scale;
helper.Out.x = m_Weight * Lerp<T>(helper.In.x, floor(helper.In.x * denom) + scale * ax, m_MulX * rs) + m_MulX * pow(ax, m_BoxPow) * rs * denom;//m_BoxPow should be an integer value held in T,
@ -2318,6 +2317,7 @@ public:
}
break;
case 2://Gaussian.
default:
{
const T sigma = dist * random.y * M_2PI;
const T phi = dist * random.z * T(M_PI);
@ -2339,7 +2339,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string scatter = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -2483,6 +2483,7 @@ public:
radius = sqrt(Sqr(helper.In.x - m_CenterX) + Sqr(helper.In.y - m_CenterY) + Sqr(helper.In.z - m_CenterZ));
break;
case 1://Square.
default:
radius = max(fabs(helper.In.x - m_CenterX), max(fabs(helper.In.y - m_CenterY), (fabs(helper.In.z - m_CenterZ))));//Original called a macro named min, which internally performed max.
break;
}
@ -2532,6 +2533,7 @@ public:
}
break;
case 2://Log.
default:
{
const T coeff = m_RMax <= EPS ? dist : dist + m_Alpha * (LogMap(dist) - dist);
@ -2547,7 +2549,7 @@ public:
virtual string OpenCLString() override
{
ostringstream ss, ss2;
int i = 0, varIndex = IndexInXform();
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string blurType = "parVars[" + ToUpper(m_Params[i++].Name()) + index;

View File

@ -211,6 +211,7 @@ public:
break;
case 2:
default:
x = m_Weight * p;
y = m_Weight * q;
z = m_Weight * (j ? -1 : 1);

View File

@ -101,7 +101,7 @@ public:
/// </summary>
/// <param name="xform">The Xform object to copy</param>
Xform(const Xform<T>& xform)
: m_ParentEmber(NULL)//Hack.
: m_ParentEmber(nullptr)//Hack.
{
Xform<T>::operator=<T>(xform);
}
@ -112,7 +112,7 @@ public:
/// <param name="xform">The Xform object to copy</param>
template <typename U>
Xform(const Xform<U>& xform)
: m_ParentEmber(NULL)//Hack.
: m_ParentEmber(nullptr)//Hack.
{
Xform<T>::operator=<U>(xform);
}
@ -171,7 +171,7 @@ public:
//the variation's m_IndexInXform member gets properly set to this.
for (unsigned int i = 0; i < xform.TotalVariationCount(); i++)
{
Variation<T>* var = NULL;
Variation<T>* var = nullptr;
if (Variation<U>* varOrig = xform.GetVariation(i))
{
@ -236,7 +236,7 @@ public:
m_NeedPrecalcAtanYX = false;
m_HasPost = false;
m_HasPreOrRegularVars = false;
m_ParentEmber = NULL;
m_ParentEmber = nullptr;
m_PreVariations.reserve(MAX_VARS_PER_XFORM);
m_Variations.reserve(MAX_VARS_PER_XFORM);
m_PostVariations.reserve(MAX_VARS_PER_XFORM);
@ -254,7 +254,7 @@ public:
/// <returns>True if the successful, else false.</returns>
bool AddVariation(Variation<T>* variation)
{
if (variation && (GetVariationById(variation->VariationId()) == NULL))
if (variation && (GetVariationById(variation->VariationId()) == nullptr))
{
string name = variation->Name();
bool pre = name.find("pre_") == 0;
@ -294,11 +294,11 @@ public:
/// Get a pointer to the variation at the specified index.
/// </summary>
/// <param name="index">The index in the list to retrieve</param>
/// <returns>A pointer to the variation at the index if in range, else NULL.</returns>
/// <returns>A pointer to the variation at the index if in range, else nullptr.</returns>
Variation<T>* GetVariation(size_t index) const
{
size_t count = 0;
Variation<T>* var = NULL;
Variation<T>* var = nullptr;
const_cast<Xform<T>*>(this)->AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
@ -320,16 +320,16 @@ public:
/// Get a pointer to the variation with the specified ID.
/// </summary>
/// <param name="id">The ID to search for</param>
/// <returns>A pointer to the variation if found, else NULL.</returns>
/// <returns>A pointer to the variation if found, else nullptr.</returns>
Variation<T>* GetVariationById(eVariationId id) const
{
Variation<T>* var = NULL;
Variation<T>* var = nullptr;
const_cast<Xform<T>*>(this)->AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++)
{
if (variations[i] != NULL && variations[i]->VariationId() == id)
if (variations[i] != nullptr && variations[i]->VariationId() == id)
{
var = variations[i];
keepGoing = false;
@ -345,16 +345,16 @@ public:
/// Get a pointer to the variation with the specified name.
/// </summary>
/// <param name="name">The name to search for</param>
/// <returns>A pointer to the variation if found, else NULL.</returns>
/// <returns>A pointer to the variation if found, else nullptr.</returns>
Variation<T>* GetVariationByName(string name) const
{
Variation<T>* var = NULL;
Variation<T>* var = nullptr;
const_cast<Xform<T>*>(this)->AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
for (unsigned int i = 0; i < variations.size(); i++)
{
if (variations[i] != NULL && variations[i]->Name() == name)
if (variations[i] != nullptr && variations[i]->Name() == name)
{
var = variations[i];
keepGoing = false;
@ -406,7 +406,7 @@ public:
{
for (unsigned int i = 0; i < variations.size(); i++)
{
if (variations[i] != NULL && variations[i]->VariationId() == id)
if (variations[i] != nullptr && variations[i]->VariationId() == id)
{
delete variations[i];
variations.erase(variations.begin() + i);
@ -442,7 +442,7 @@ public:
/// Reset this xform to be totally empty by clearing all variations, resetting both affines to the
/// identity matrix, clearing xaos, color, visibility, wind, animate and setting name
/// to the empty string.
/// Note that this also sets the parent ember to NULL, so if this xform is reused after calling Clear(),
/// Note that this also sets the parent ember to nullptr, so if this xform is reused after calling Clear(),
/// the caller must reset the parent ember to whatever ember they add it to again.
/// </summary>
void Clear()
@ -452,7 +452,7 @@ public:
m_Affine.MakeID();
m_Post.MakeID();
m_Xaos.clear();
m_ParentEmber = NULL;
m_ParentEmber = nullptr;
m_ColorSpeedCache = 0;
m_OneMinusColorCache = 0;
m_VizAdjusted = 0;
@ -724,7 +724,7 @@ public:
//At this point, we've added if needed, or just applied the motion func to the weight.
//Now apply the motion func to the params if needed.
if (motParVar != NULL)
if (motParVar != nullptr)
{
ParametricVariation<T>* parVar = dynamic_cast<ParametricVariation<T>*>(var);
ParamWithName<T>* params = parVar->Params();
@ -881,7 +881,7 @@ public:
{
bool shouldFlatten = true;
if (GetVariationById(VAR_FLATTEN) == NULL)
if (GetVariationById(VAR_FLATTEN) == nullptr)
{
AllVarsFunc([&] (vector<Variation<T>*>& variations, bool& keepGoing)
{
@ -953,6 +953,7 @@ public:
"\tvIn.z = transZ;\n";
break;
case VARTYPE_POST:
default:
s =
"\tvIn.x = outPoint->m_X;\n"
"\tvIn.y = outPoint->m_Y;\n"
@ -980,6 +981,7 @@ public:
break;
}
case ASSIGNTYPE_SUM:
default:
{
helper.m_TransX += helper.Out.x;
helper.m_TransY += helper.Out.y;
@ -1006,6 +1008,7 @@ public:
break;
}
case ASSIGNTYPE_SUM:
default:
{
outPoint.m_X += helper.Out.x;
outPoint.m_Y += helper.Out.y;
@ -1048,6 +1051,7 @@ public:
break;
}
case ASSIGNTYPE_SUM:
default:
{
s =
"\ttransX += vOut.x;\n"
@ -1060,6 +1064,7 @@ public:
break;
}
case VARTYPE_POST:
default:
{
switch (assignType)
{
@ -1072,6 +1077,7 @@ public:
break;
}
case ASSIGNTYPE_SUM:
default:
{
s =
"\toutPoint->m_X += vOut.x;\n"

View File

@ -28,12 +28,12 @@ public:
{
m_Category = category;
m_NewLocale = string(loc);
m_OriginalLocale = setlocale(category, NULL);//Query.
m_OriginalLocale = setlocale(category, nullptr);//Query.
if (m_OriginalLocale.empty())
cout << "Couldn't get original locale." << endl;
if (setlocale(category, loc) == NULL)//Set.
if (setlocale(category, loc) == nullptr)//Set.
cout << "Couldn't set new locale " << category << ", " << loc << "." << endl;
}
@ -43,7 +43,7 @@ public:
~Locale()
{
if (!m_OriginalLocale.empty())
if (setlocale(m_Category, m_OriginalLocale.c_str()) == NULL)//Restore.
if (setlocale(m_Category, m_OriginalLocale.c_str()) == nullptr)//Restore.
cout << "Couldn't restore original locale " << m_Category << ", " << m_OriginalLocale << "." << endl;
}
@ -250,7 +250,7 @@ public:
bool Parse(unsigned char* buf, const char* filename, vector<Ember<T>>& embers)
{
char* bn;
const char* xmlBuf;
const char* xmlPtr;
const char* loc = __FUNCTION__;
unsigned int emberSize;
size_t bufSize;
@ -260,12 +260,12 @@ public:
m_ErrorReport.clear();
//Parse XML string into internal document.
xmlBuf = (const char*)(&buf[0]);
bufSize = strlen(xmlBuf);
xmlPtr = (const char*)(&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.
doc = xmlReadMemory(xmlBuf, (int)bufSize, filename, NULL, XML_PARSE_NONET);//Forbid network access during read.
doc = xmlReadMemory(xmlPtr, (int)bufSize, filename, nullptr, XML_PARSE_NONET);//Forbid network access during read.
if (doc == NULL)
if (doc == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : Error parsing xml file " + string(filename));
return false;
@ -483,7 +483,7 @@ private:
void ScanForEmberNodes(xmlNode* curNode, char* parentFile, vector<Ember<T>>& embers)
{
bool parseEmberSuccess;
xmlNodePtr thisNode = NULL;
xmlNodePtr thisNode = nullptr;
const char* loc = __FUNCTION__;
string parentFileString = string(parentFile);
@ -537,7 +537,7 @@ private:
/// <returns>True if there were no errors, else false.</returns>
bool ParseEmberElement(xmlNode* emberNode, Ember<T>& currentEmber)
{
bool b = true;
bool ret = true;
unsigned int newLinear = 0;
char* attStr;
const char* loc = __FUNCTION__;
@ -550,7 +550,7 @@ private:
currentEmber.m_Palette.Clear();//Wipe out the current palette.
att = emberNode->properties;//The top level element is a ember element, read the attributes of it and store them.
if (att == NULL)
if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : <flame> element has no attributes");
return false;
@ -561,36 +561,36 @@ private:
attStr = (char*)xmlGetProp(emberNode, curAtt->name);
//First parse out simple float reads.
if (ParseAndAssignFloat(curAtt->name, attStr, "time", currentEmber.m_Time, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "scale", currentEmber.m_PixelsPerUnit, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "rotate", currentEmber.m_Rotate, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "zoom", currentEmber.m_Zoom, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "filter", currentEmber.m_SpatialFilterRadius, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "temporal_filter_width", currentEmber.m_TemporalFilterWidth, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "temporal_filter_exp", currentEmber.m_TemporalFilterExp, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "quality", currentEmber.m_Quality, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "brightness", currentEmber.m_Brightness, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "gamma", currentEmber.m_Gamma, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "highlight_power", currentEmber.m_HighlightPower, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "vibrancy", currentEmber.m_Vibrancy, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_radius", currentEmber.m_MaxRadDE, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_minimum", currentEmber.m_MinRadDE, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_curve", currentEmber.m_CurveDE, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "gamma_threshold", currentEmber.m_GammaThresh, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_zpos", currentEmber.m_CamZPos, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_persp", currentEmber.m_CamPerspective, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_perspective", currentEmber.m_CamPerspective, b)) { }//Apo bug.
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_yaw", currentEmber.m_CamYaw, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_pitch", currentEmber.m_CamPitch, b)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_dof", currentEmber.m_CamDepthBlur, b)) { }
if (ParseAndAssignFloat(curAtt->name, attStr, "time", currentEmber.m_Time, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "scale", currentEmber.m_PixelsPerUnit, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "rotate", currentEmber.m_Rotate, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "zoom", currentEmber.m_Zoom, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "filter", currentEmber.m_SpatialFilterRadius, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "temporal_filter_width", currentEmber.m_TemporalFilterWidth, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "temporal_filter_exp", currentEmber.m_TemporalFilterExp, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "quality", currentEmber.m_Quality, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "brightness", currentEmber.m_Brightness, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "gamma", currentEmber.m_Gamma, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "highlight_power", currentEmber.m_HighlightPower, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "vibrancy", currentEmber.m_Vibrancy, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_radius", currentEmber.m_MaxRadDE, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_minimum", currentEmber.m_MinRadDE, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "estimator_curve", currentEmber.m_CurveDE, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "gamma_threshold", currentEmber.m_GammaThresh, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_zpos", currentEmber.m_CamZPos, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_persp", currentEmber.m_CamPerspective, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_perspective", currentEmber.m_CamPerspective, ret)) { }//Apo bug.
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_yaw", currentEmber.m_CamYaw, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_pitch", currentEmber.m_CamPitch, ret)) { }
else if (ParseAndAssignFloat(curAtt->name, attStr, "cam_dof", currentEmber.m_CamDepthBlur, ret)) { }
//Parse simple int reads.
else if (ParseAndAssignInt(curAtt->name, attStr, "palette", currentEmber.m_Palette.m_Index, b)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "oversample", currentEmber.m_Supersample , b)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "supersample", currentEmber.m_Supersample , b)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "temporal_samples", currentEmber.m_TemporalSamples, b)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "soloxform", soloXform , b)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "new_linear", newLinear , b)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "palette", currentEmber.m_Palette.m_Index, ret)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "oversample", currentEmber.m_Supersample , ret)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "supersample", currentEmber.m_Supersample , ret)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "temporal_samples", currentEmber.m_TemporalSamples, ret)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "soloxform", soloXform , ret)) { }
else if (ParseAndAssignInt(curAtt->name, attStr, "new_linear", newLinear , ret)) { }
//Parse more complicated reads that have multiple possible values.
else if (!Compare(curAtt->name, "interpolation"))
@ -631,7 +631,7 @@ private:
}
else if (!Compare(curAtt->name, "size"))
{
if (sscanf_s(attStr, "%d %d", &currentEmber.m_FinalRasW, &currentEmber.m_FinalRasH) != 2)
if (sscanf_s(attStr, "%u %u", &currentEmber.m_FinalRasW, &currentEmber.m_FinalRasH) != 2)
{
m_ErrorReport.push_back(string(loc) + " : Invalid size attribute " + string(attStr));
xmlFree(attStr);
@ -709,7 +709,7 @@ private:
//Loop through the attributes of the color element.
att = childNode->properties;
if (att == NULL)
if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : No attributes for color element");
continue;
@ -775,7 +775,7 @@ private:
//Loop through the attributes of the color element.
att = childNode->properties;
if (att == NULL)
if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : No attributes for colors element");
continue;
@ -821,7 +821,7 @@ private:
//Loop through the attributes of the palette element.
att = childNode->properties;
if (att == NULL)
if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : No attributes for palette element");
continue;
@ -914,7 +914,7 @@ private:
//Loop through the attributes of the palette element.
att = childNode->properties;
if (att == NULL)
if (att == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : No attributes for palette element");
continue;
@ -944,7 +944,7 @@ private:
}
else if (!Compare(childNode->name, "xform") || !Compare(childNode->name, "finalxform"))
{
Xform<T>* theXform = NULL;
Xform<T>* theXform = nullptr;
if (!Compare(childNode->name, "finalxform"))
{
@ -1033,7 +1033,7 @@ private:
bool ParseXform(xmlNode* childNode, Xform<T>& xform, bool motion)
{
bool success = true;
char* attStr, *copy;
char* attStr;
const char* loc = __FUNCTION__;
unsigned int j;
T temp;
@ -1044,7 +1044,7 @@ private:
//Loop through the attributes of the xform element.
attPtr = childNode->properties;
if (attPtr == NULL)
if (attPtr == nullptr)
{
m_ErrorReport.push_back(string(loc) + " : Error: No attributes for element");
return false;
@ -1052,7 +1052,7 @@ private:
for (curAtt = attPtr; curAtt; curAtt = curAtt->next)
{
copy = attStr = (char*)xmlGetProp(childNode, curAtt->name);
attStr = (char*)xmlGetProp(childNode, curAtt->name);
//First parse out simple float reads.
if (ParseAndAssignFloat(curAtt->name, attStr, "weight", xform.m_Weight, success)) { }
@ -1095,7 +1095,6 @@ private:
}
else if (!Compare(curAtt->name, "color"))
{
T tmpc1 = 0;
xform.m_ColorX = xform.m_ColorY = 0;
//Try two coords first .
@ -1167,7 +1166,6 @@ private:
else
{
string s = GetCorrectedVariationName(m_BadVariationNames, curAtt);
const char* name = s.c_str();
if (Variation<T>* var = m_VariationList.GetVariation(s))
{
@ -1192,7 +1190,7 @@ private:
if (!Compare(curAtt->name, "var1"))
{
copy = attStr = (char*)xmlGetProp(childNode, curAtt->name);
attStr = (char*)xmlGetProp(childNode, curAtt->name);
for (j = 0; j < xform.TotalVariationCount(); j++)
xform.GetVariation(j)->m_Weight = 0;
@ -1223,7 +1221,7 @@ private:
if (!Compare(curAtt->name, "var"))
{
copy = attStr = (char*)xmlGetProp(childNode, curAtt->name);
attStr = (char*)xmlGetProp(childNode, curAtt->name);
if (Atof(attStr, temp))
{
@ -1254,7 +1252,7 @@ private:
if (parVar->ContainsParam(name))
{
T val = 0;
copy = attStr = (char*)xmlGetProp(childNode, curAtt->name);
attStr = (char*)xmlGetProp(childNode, curAtt->name);
if (Atof(attStr, val))
{
@ -1339,7 +1337,7 @@ private:
{
if (!_stricmp(name, (const char*)temp->name))
return true;
} while (temp = temp->next);
} while ((temp = temp->next));
return false;
}
@ -1357,7 +1355,7 @@ private:
{
int colorIndex = 0;
int colorCount = 0;
int r, g, b, a;
unsigned int r, g, b, a;
int ret;
char tmps[2];
int skip = (int)abs(chan);

View File

@ -311,7 +311,7 @@ bool EmberAnimate(EmberOptions& opt)
if ((opt.Format() == "jpg" || opt.Format() == "bmp") && renderer->NumChannels() == 4)
{
EmberNs::RgbaToRgb(finalImage, vecRgb, renderer->FinalRasW(), renderer->FinalRasH());
RgbaToRgb(finalImage, vecRgb, renderer->FinalRasW(), renderer->FinalRasH());
finalImagep = vecRgb.data();
}

View File

@ -122,6 +122,25 @@ static bool InitPaletteList(string filename)
return true;
}
/// <summary>
/// Convert an RGBA buffer to an RGB buffer.
/// </summary>
/// <param name="rgba">The RGBA buffer</param>
/// <param name="rgb">The RGB buffer</param>
/// <param name="width">The width of the image in pixels</param>
/// <param name="height">The height of the image in pixels</param>
static void RgbaToRgb(vector<unsigned char>& rgba, vector<unsigned char>& rgb, unsigned int width, unsigned int height)
{
rgb.resize(width * height * 3);
for (unsigned int i = 0, j = 0; i < (width * height * 4); i += 4, j += 3)
{
rgb[j] = rgba[i];
rgb[j + 1] = rgba[i + 1];
rgb[j + 2] = rgba[i + 2];
}
}
/// <summary>
/// Calculate the number of strips required if the needed amount of memory
/// is greater than the system memory, or greater than what the user want to allow.

View File

@ -309,7 +309,7 @@ bool EmberRender(EmberOptions& opt)
if ((opt.Format() == "jpg" || opt.Format() == "bmp") && renderer->NumChannels() == 4)
{
EmberNs::RgbaToRgb(finalImage, vecRgb, renderer->FinalRasW(), realHeight);
RgbaToRgb(finalImage, vecRgb, renderer->FinalRasW(), realHeight);
finalImagep = vecRgb.data();
}

View File

@ -1748,7 +1748,7 @@ double RandD(QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand)
int _tmain(int argc, _TCHAR* argv[])
{
int i;
//int i;
Timing t(4);
QTIsaac<ISAAC_SIZE, ISAAC_INT> rand;

View File

@ -137,7 +137,7 @@ void FractoriumEmberControllerBase::SaveCurrentRender(QString filename)
if ((suffix == "jpg" || suffix == "bmp") && m_Renderer->NumChannels() == 4)
{
EmberNs::RgbaToRgb(m_FinalImage, vecRgb, width, height);
RgbaToRgb(m_FinalImage, vecRgb, width, height);
data = vecRgb.data();
}