diff --git a/Builds/QtCreator/Ember/Ember.pro b/Builds/QtCreator/Ember/Ember.pro index df6ed2f..188a059 100644 --- a/Builds/QtCreator/Ember/Ember.pro +++ b/Builds/QtCreator/Ember/Ember.pro @@ -51,7 +51,8 @@ HEADERS += \ ../../../Source/Ember/Variations03.h \ ../../../Source/Ember/Variations04.h \ ../../../Source/Ember/Variations05.h \ - ../../../Source/Ember/VariationsDC.h \ + ../../../Source/Ember/Variations06.h \ + ../../../Source/Ember/VariationsDC.h \ ../../../Source/Ember/Xform.h \ ../../../Source/Ember/XmlToEmber.h \ ../../../Source/Ember/EmberMotion.h diff --git a/Builds/QtCreator/EmberCL/EmberCL.pro b/Builds/QtCreator/EmberCL/EmberCL.pro index 24277d3..9083604 100644 --- a/Builds/QtCreator/EmberCL/EmberCL.pro +++ b/Builds/QtCreator/EmberCL/EmberCL.pro @@ -18,6 +18,7 @@ SOURCES += \ ../../../Source/EmberCL/DllMain.cpp \ ../../../Source/EmberCL/DEOpenCLKernelCreator.cpp \ ../../../Source/EmberCL/FinalAccumOpenCLKernelCreator.cpp \ + ../../../Source/EmberCL/FunctionMapper.cpp \ ../../../Source/EmberCL/IterOpenCLKernelCreator.cpp \ ../../../Source/EmberCL/OpenCLInfo.cpp \ ../../../Source/EmberCL/OpenCLWrapper.cpp \ @@ -33,6 +34,7 @@ HEADERS += \ ../../../Source/EmberCL/EmberCLPch.h \ ../../../Source/EmberCL/EmberCLStructs.h \ ../../../Source/EmberCL/FinalAccumOpenCLKernelCreator.h \ + ../../../Source/EmberCL/FunctionMapper.h \ ../../../Source/EmberCL/IterOpenCLKernelCreator.h \ ../../../Source/EmberCL/OpenCLInfo.h \ ../../../Source/EmberCL/OpenCLWrapper.h \ diff --git a/Source/Ember/Ember.cpp b/Source/Ember/Ember.cpp index 37bb30a..0d2f96a 100644 --- a/Source/Ember/Ember.cpp +++ b/Source/Ember/Ember.cpp @@ -5,7 +5,7 @@ namespace EmberNs { template<> unique_ptr> QTIsaac::GlobalRand = unique_ptr>(new QTIsaac()); -CriticalSection QTIsaac::m_CS; +template<> CriticalSection QTIsaac::m_CS = CriticalSection(); } #include "Curves.h" diff --git a/Source/Ember/EmberDefines.h b/Source/Ember/EmberDefines.h index 2df878c..f8d8007 100644 --- a/Source/Ember/EmberDefines.h +++ b/Source/Ember/EmberDefines.h @@ -31,11 +31,11 @@ #if defined(__APPLE__) || defined(_MSC_VER) #define sincos(x, s, c) *(s)=std::sin(x); *(c)=std::cos(x); #else - /*static void sincos(float x, float* s, float* c) + static void sincos(float x, float* s, float* c) { *s = std::sin(x); *c = std::cos(x); - }*/ + } #endif namespace EmberNs diff --git a/Source/Ember/Renderer.cpp b/Source/Ember/Renderer.cpp index 330e879..228139b 100644 --- a/Source/Ember/Renderer.cpp +++ b/Source/Ember/Renderer.cpp @@ -840,7 +840,6 @@ eRenderStatus Renderer::LogScaleDensityFilter(bool forceOutput) { size_t startRow = 0; size_t endRow = m_SuperRasH; - size_t startCol = 0; size_t endCol = m_SuperRasW; //Timing t(4); diff --git a/Source/Ember/Variation.h b/Source/Ember/Variation.h index 2287a1d..5dd231f 100644 --- a/Source/Ember/Variation.h +++ b/Source/Ember/Variation.h @@ -1690,6 +1690,20 @@ private: bool m_IsState;//Whether the parameter changes state between iterations. This is also considered precalc. }; +#define VARUSINGS \ + using Variation::m_Weight; \ + using Variation::m_Xform; \ + using Variation::m_VariationId; \ + using Variation::m_Name; \ + using Variation::m_VarType; \ + using Variation::m_AssignType; \ + using Variation::SetType; \ + using Variation::IndexInXform; \ + using Variation::XformIndexInEmber; \ + using Variation::Prefix; \ + using Variation::Precalc; \ + using Variation::StateOpenCLString; + /// /// Parametric variations use parameters in addition to weight. /// These values are stored in members of derived classes, however @@ -1700,9 +1714,9 @@ private: template class EMBER_API ParametricVariation : public Variation { -using Variation::Precalc; - public: + VARUSINGS + /// /// Constructor which takes arguments and just passes them to the base class. /// @@ -1990,18 +2004,6 @@ protected: /// Defining assignment operators isn't really needed because Variations are always held as pointers. /// -#define VARUSINGS \ - using Variation::m_Weight; \ - using Variation::m_Xform; \ - using Variation::m_VariationId; \ - using Variation::m_Name; \ - using Variation::m_VarType; \ - using Variation::m_AssignType; \ - using Variation::SetType; \ - using Variation::IndexInXform; \ - using Variation::XformIndexInEmber; \ - using Variation::Prefix; - #ifdef DO_DOUBLE #define VARCOPYDOUBLE(name) \ virtual void Copy(Variation*& var) const override \ diff --git a/Source/Ember/Variations05.h b/Source/Ember/Variations05.h index 672307f..d8457f1 100644 --- a/Source/Ember/Variations05.h +++ b/Source/Ember/Variations05.h @@ -3724,7 +3724,6 @@ public: virtual string StateInitOpenCLString() const override { ostringstream ss, ss2; - intmax_t i = 0; ss2 << "_" << XformIndexInEmber(); string stateIndex = ss2.str(); string prefix = Prefix(); @@ -4151,7 +4150,6 @@ public: virtual string StateInitOpenCLString() const override { ostringstream ss, ss2; - intmax_t i = 0; ss2 << "_" << XformIndexInEmber(); string stateIndex = ss2.str(); string prefix = Prefix(); diff --git a/Source/Ember/Variations06.h b/Source/Ember/Variations06.h index a3bc4f6..5198a9f 100644 --- a/Source/Ember/Variations06.h +++ b/Source/Ember/Variations06.h @@ -508,7 +508,7 @@ public: virtual string OpenCLString() const override { ostringstream ss, ss2; - intmax_t i = 0, varIndex = IndexInXform(); + intmax_t i = 0; ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string numEdges = "parVars[" + ToUpper(m_Params[i++].Name()) + index; @@ -1724,7 +1724,7 @@ public: virtual string OpenCLString() const override { ostringstream ss, ss2; - intmax_t i = 0, varIndex = IndexInXform(); + intmax_t i = 0; ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string top = "parVars[" + ToUpper(m_Params[i++].Name()) + index; @@ -2881,7 +2881,7 @@ public: radius = helper.m_PrecalcSqrtSumSquares; theta = helper.m_PrecalcAtanxy; mu = Zeps(SQR(m_SynthPower)); - radius += -2 * mu * (int)((radius + mu) / (2 * mu)) + radius * (1 - mu); + radius += -2 * mu * int((radius + mu) / (2 * mu)) + radius * (1 - mu); SynthSinCos(synth, radius, s, c, synthMode); @@ -2935,6 +2935,7 @@ public: helper.Out.y = m_Weight * radius * c; break; + default: case MODE_SHIFTTHETA: // Power YES, Smooth NO // Use (adjusted) radius to move point around circle Vx = helper.In.x; @@ -3639,6 +3640,7 @@ private: y *= M_2PI / frq; x = 1 / Zeps(std::cos(y)) - 1; break; + default: case WAVE_INGON: y -= T(0.5); y *= M_2PI / frq; @@ -3659,6 +3661,7 @@ private: z = synthA + synth * x; thetaFactor = (thetaFactor > z ? thetaFactor : z); break; + default: case LAYER_MIN: z = synthA + synth * x; thetaFactor = (thetaFactor < z ? thetaFactor : z); @@ -3760,6 +3763,7 @@ private: { case LERP_LINEAR: return x * m; + default: case LERP_BEZIER: return BezierQuadMap(x, m); } @@ -3777,6 +3781,7 @@ private: s = s * SynthValue(synth, theta); c = c * SynthValue(synth, theta + T(M_PI) / 2); break; + default: case SINCOS_MIXIN: s = (1 - m_SynthMix) * s + (SynthValue(synth, theta) - 1); c = (1 - m_SynthMix) * c + (SynthValue(synth, theta + T(M_PI) / 2) - 1); @@ -3829,4 +3834,4 @@ MAKEPREPOSTPARVAR(Octapol, octapol, OCTAPOL) MAKEPREPOSTPARVAR(Crob, crob, CROB) MAKEPREPOSTPARVAR(BubbleT3D, bubbleT3D, BUBBLET3D) MAKEPREPOSTPARVAR(Synth, synth, SYNTH) -} \ No newline at end of file +} diff --git a/Source/Ember/XmlToEmber.h b/Source/Ember/XmlToEmber.h index 6f4fbc7..0d4986c 100644 --- a/Source/Ember/XmlToEmber.h +++ b/Source/Ember/XmlToEmber.h @@ -1366,7 +1366,7 @@ private: /// The corrected name if one was found, else the passed in name. static string GetCorrectedParamName(const unordered_map& names, const char* name) { - auto& newName = names.find(ToLower(name)); + const auto& newName = names.find(ToLower(name)); if (newName != names.end()) return newName->second; diff --git a/Source/EmberCL/FunctionMapper.cpp b/Source/EmberCL/FunctionMapper.cpp index cfc5a12..c771db0 100644 --- a/Source/EmberCL/FunctionMapper.cpp +++ b/Source/EmberCL/FunctionMapper.cpp @@ -141,7 +141,7 @@ FunctionMapper::FunctionMapper() const string* FunctionMapper::GetGlobalFunc(const string& func) { - auto& text = m_GlobalMap.find(func); + const auto& text = m_GlobalMap.find(func); if (text != m_GlobalMap.end()) return &text->second;