diff --git a/Source/Ember/Ember.h b/Source/Ember/Ember.h index 56ddea3..732c63a 100644 --- a/Source/Ember/Ember.h +++ b/Source/Ember/Ember.h @@ -17,7 +17,7 @@ namespace EmberNs /// Bit position specifying the presence of each type of 3D parameter. /// One, none, some or all of these can be present. /// -enum class eProjBits : size_t +enum class eProjBits : et { PROJBITS_ZPOS = 1, PROJBITS_PERSP = 2, @@ -493,16 +493,16 @@ public: m_CamMat[1][2] = std::sin(m_CamPitch) * std::cos(-m_CamYaw); m_CamMat[2][2] = std::cos(m_CamPitch); - if (projBits & size_t(eProjBits::PROJBITS_BLUR)) + if (projBits & et(eProjBits::PROJBITS_BLUR)) { - if (projBits & size_t(eProjBits::PROJBITS_YAW)) + if (projBits & et(eProjBits::PROJBITS_YAW)) m_ProjFunc = &EmberNs::Ember::ProjectPitchYawDepthBlur; else m_ProjFunc = &EmberNs::Ember::ProjectPitchDepthBlur; } - else if ((projBits & size_t(eProjBits::PROJBITS_PITCH)) || (projBits & size_t(eProjBits::PROJBITS_YAW))) + else if ((projBits & et(eProjBits::PROJBITS_PITCH)) || (projBits & et(eProjBits::PROJBITS_YAW))) { - if (projBits & size_t(eProjBits::PROJBITS_YAW)) + if (projBits & et(eProjBits::PROJBITS_YAW)) m_ProjFunc = &EmberNs::Ember::ProjectPitchYaw; else m_ProjFunc = &EmberNs::Ember::ProjectPitch; @@ -677,9 +677,9 @@ public: while (auto xform = GetTotalXform(xformIndex++)) { - unflattened |= xform->DeleteVariationById(VAR_PRE_FLATTEN); - unflattened |= xform->DeleteVariationById(VAR_FLATTEN); - unflattened |= xform->DeleteVariationById(VAR_POST_FLATTEN); + unflattened |= xform->DeleteVariationById(eVariationId::VAR_PRE_FLATTEN); + unflattened |= xform->DeleteVariationById(eVariationId::VAR_FLATTEN); + unflattened |= xform->DeleteVariationById(eVariationId::VAR_POST_FLATTEN); } return unflattened; @@ -1136,15 +1136,15 @@ public: { size_t val = 0; - if (m_CamZPos != 0) val |= size_t(eProjBits::PROJBITS_ZPOS); + if (m_CamZPos != 0) val |= et(eProjBits::PROJBITS_ZPOS); - if (m_CamPerspective != 0) val |= size_t(eProjBits::PROJBITS_PERSP); + if (m_CamPerspective != 0) val |= et(eProjBits::PROJBITS_PERSP); - if (m_CamPitch != 0) val |= size_t(eProjBits::PROJBITS_PITCH); + if (m_CamPitch != 0) val |= et(eProjBits::PROJBITS_PITCH); - if (m_CamYaw != 0) val |= size_t(eProjBits::PROJBITS_YAW); + if (m_CamYaw != 0) val |= et(eProjBits::PROJBITS_YAW); - if (m_CamDepthBlur != 0) val |= size_t(eProjBits::PROJBITS_BLUR); + if (m_CamDepthBlur != 0) val |= et(eProjBits::PROJBITS_BLUR); return val; } diff --git a/Source/Ember/EmberDefines.h b/Source/Ember/EmberDefines.h index 256f114..34bb770 100644 --- a/Source/Ember/EmberDefines.h +++ b/Source/Ember/EmberDefines.h @@ -74,6 +74,7 @@ namespace EmberNs #define FLOAT_MIN_TAN -FLOAT_MAX_TAN #define EMPTYFIELD -9999 typedef std::chrono::high_resolution_clock Clock; +typedef uint et; /// /// Thin wrapper around getting the current time in milliseconds. @@ -119,17 +120,17 @@ static inline size_t NowMs() #define m23T glm::detail::tmat2x3 #endif -enum class eInterp : uint { EMBER_INTERP_LINEAR = 0, EMBER_INTERP_SMOOTH = 1 }; -enum class eAffineInterp : uint { AFFINE_INTERP_LINEAR = 0, AFFINE_INTERP_LOG = 1, AFFINE_INTERP_COMPAT = 2, AFFINE_INTERP_OLDER = 3 }; -enum class ePaletteMode : uint { PALETTE_STEP = 0, PALETTE_LINEAR = 1 }; -enum class ePaletteInterp : uint { INTERP_HSV = 0, INTERP_SWEEP = 1 }; -enum class eMotion : uint { MOTION_SIN = 1, MOTION_TRIANGLE = 2, MOTION_HILL = 3, MOTION_SAW = 4 }; -enum class eProcessAction : uint { NOTHING = 0, ACCUM_ONLY = 1, FILTER_AND_ACCUM = 2, KEEP_ITERATING = 3, FULL_RENDER = 4 }; -enum class eProcessState : uint { NONE = 0, ITER_STARTED = 1, ITER_DONE = 2, FILTER_DONE = 3, ACCUM_DONE = 4 }; -enum class eInteractiveFilter : uint { FILTER_LOG = 0, FILTER_DE = 1 }; -enum class eScaleType : uint { SCALE_NONE = 0, SCALE_WIDTH = 1, SCALE_HEIGHT = 2 }; -enum class eRenderStatus : uint { RENDER_OK = 0, RENDER_ERROR = 1, RENDER_ABORT = 2 }; -enum class eEmberMotionParam : uint//These must remain in this order forever. +enum class eInterp : et { EMBER_INTERP_LINEAR = 0, EMBER_INTERP_SMOOTH = 1 }; +enum class eAffineInterp : et { AFFINE_INTERP_LINEAR = 0, AFFINE_INTERP_LOG = 1, AFFINE_INTERP_COMPAT = 2, AFFINE_INTERP_OLDER = 3 }; +enum class ePaletteMode : et { PALETTE_STEP = 0, PALETTE_LINEAR = 1 }; +enum class ePaletteInterp : et { INTERP_HSV = 0, INTERP_SWEEP = 1 }; +enum class eMotion : et { MOTION_SIN = 1, MOTION_TRIANGLE = 2, MOTION_HILL = 3, MOTION_SAW = 4 }; +enum class eProcessAction : et { NOTHING = 0, ACCUM_ONLY = 1, FILTER_AND_ACCUM = 2, KEEP_ITERATING = 3, FULL_RENDER = 4 }; +enum class eProcessState : et { NONE = 0, ITER_STARTED = 1, ITER_DONE = 2, FILTER_DONE = 3, ACCUM_DONE = 4 }; +enum class eInteractiveFilter : et { FILTER_LOG = 0, FILTER_DE = 1 }; +enum class eScaleType : et { SCALE_NONE = 0, SCALE_WIDTH = 1, SCALE_HEIGHT = 2 }; +enum class eRenderStatus : et { RENDER_OK = 0, RENDER_ERROR = 1, RENDER_ABORT = 2 }; +enum class eEmberMotionParam : et//These must remain in this order forever. { FLAME_MOTION_NONE, FLAME_MOTION_ZOOM, diff --git a/Source/Ember/EmberPch.h b/Source/Ember/EmberPch.h index 5a32122..60ef744 100644 --- a/Source/Ember/EmberPch.h +++ b/Source/Ember/EmberPch.h @@ -53,6 +53,7 @@ #include #include #include +#include #include #include diff --git a/Source/Ember/Interpolate.h b/Source/Ember/Interpolate.h index cff60e2..f134544 100644 --- a/Source/Ember/Interpolate.h +++ b/Source/Ember/Interpolate.h @@ -106,7 +106,7 @@ public: { size_t found = 0; //Remove linear. - destXform->DeleteVariationById(VAR_LINEAR); + destXform->DeleteVariationById(eVariationId::VAR_LINEAR); //Only do the next substitution for log interpolation. if ((i == 0 && destEmbers[i].m_AffineInterp == eAffineInterp::AFFINE_INTERP_LOG) || @@ -128,13 +128,13 @@ public: //Interpolate these against a 180 degree rotated identity //with weight -1. //Added JULIAN/JULIASCOPE to get rid of black wedges. - if (destOtherXform->GetVariationById(VAR_SPHERICAL) || - destOtherXform->GetVariationById(VAR_NGON) || - destOtherXform->GetVariationById(VAR_JULIAN) || - destOtherXform->GetVariationById(VAR_JULIASCOPE) || - destOtherXform->GetVariationById(VAR_POLAR) || - destOtherXform->GetVariationById(VAR_WEDGE_SPH) || - destOtherXform->GetVariationById(VAR_WEDGE_JULIA)) + if (destOtherXform->GetVariationById(eVariationId::VAR_SPHERICAL) || + destOtherXform->GetVariationById(eVariationId::VAR_NGON) || + destOtherXform->GetVariationById(eVariationId::VAR_JULIAN) || + destOtherXform->GetVariationById(eVariationId::VAR_JULIASCOPE) || + destOtherXform->GetVariationById(eVariationId::VAR_POLAR) || + destOtherXform->GetVariationById(eVariationId::VAR_WEDGE_SPH) || + destOtherXform->GetVariationById(eVariationId::VAR_WEDGE_JULIA)) { destXform->AddVariation(new LinearVariation(-1)); //Set the coefs appropriately. @@ -163,7 +163,7 @@ public: destOtherXform = destEmbers[i + ii].GetTotalXform(xf); - if (destOtherXform->GetVariationById(VAR_RECTANGLES)) + if (destOtherXform->GetVariationById(eVariationId::VAR_RECTANGLES)) { RectanglesVariation* var = new RectanglesVariation(); var->SetParamVal("rectangles_x", 0); @@ -172,7 +172,7 @@ public: found++; } - if (destOtherXform->GetVariationById(VAR_RINGS2)) + if (destOtherXform->GetVariationById(eVariationId::VAR_RINGS2)) { Rings2Variation* var = new Rings2Variation(); var->SetParamVal("rings2_val", 0); @@ -180,14 +180,14 @@ public: found++; } - if (destOtherXform->GetVariationById(VAR_FAN2)) + if (destOtherXform->GetVariationById(eVariationId::VAR_FAN2)) { Fan2Variation* var = new Fan2Variation(); destXform->AddVariation(var); found++; } - if (destOtherXform->GetVariationById(VAR_BLOB)) + if (destOtherXform->GetVariationById(eVariationId::VAR_BLOB)) { BlobVariation* var = new BlobVariation(); var->SetParamVal("blob_low", 1); @@ -195,14 +195,14 @@ public: found++; } - if (destOtherXform->GetVariationById(VAR_PERSPECTIVE)) + if (destOtherXform->GetVariationById(eVariationId::VAR_PERSPECTIVE)) { PerspectiveVariation* var = new PerspectiveVariation(); destXform->AddVariation(var); found++; } - if (destOtherXform->GetVariationById(VAR_CURL)) + if (destOtherXform->GetVariationById(eVariationId::VAR_CURL)) { CurlVariation* var = new CurlVariation(); var->SetParamVal("curl_c1", 0); @@ -210,7 +210,7 @@ public: found++; } - if (destOtherXform->GetVariationById(VAR_SUPER_SHAPE)) + if (destOtherXform->GetVariationById(eVariationId::VAR_SUPER_SHAPE)) { SuperShapeVariation* var = new SuperShapeVariation(); var->SetParamVal("super_shape_n1", 2); @@ -237,13 +237,13 @@ public: destOtherXform = destEmbers[i + ii].GetTotalXform(xf); - if (destOtherXform->GetVariationById(VAR_FAN)) + if (destOtherXform->GetVariationById(eVariationId::VAR_FAN)) { destXform->AddVariation(new FanVariation()); found++; } - if (destOtherXform->GetVariationById(VAR_RINGS)) + if (destOtherXform->GetVariationById(eVariationId::VAR_RINGS)) { destXform->AddVariation(new RingsVariation()); found++; diff --git a/Source/Ember/Renderer.cpp b/Source/Ember/Renderer.cpp index 129f3ea..2ff5cc5 100644 --- a/Source/Ember/Renderer.cpp +++ b/Source/Ember/Renderer.cpp @@ -1262,7 +1262,7 @@ EmberStats Renderer::Iterate(size_t iterCount, size_t temporalSample { #endif #if defined(WIN32) - SetThreadPriority(GetCurrentThread(), m_Priority); + SetThreadPriority(GetCurrentThread(), int(m_Priority)); #elif defined(__APPLE__) sched_param sp = {0}; sp.sched_priority = m_Priority; diff --git a/Source/Ember/RendererBase.cpp b/Source/Ember/RendererBase.cpp index e7145d5..0db051a 100644 --- a/Source/Ember/RendererBase.cpp +++ b/Source/Ember/RendererBase.cpp @@ -587,10 +587,10 @@ size_t RendererBase::ThreadCount() const { return m_ThreadsToUse; } /// /// Get the renderer type enum. -/// CPU_RENDERER for this class, other values for derived classes. +/// eRendererType::CPU_RENDERER for this class, other values for derived classes. /// -/// CPU_RENDERER -eRendererType RendererBase::RendererType() const { return CPU_RENDERER; } +/// eRendererType::CPU_RENDERER +eRendererType RendererBase::RendererType() const { return eRendererType::CPU_RENDERER; } /// /// //Non-virtual threading control. diff --git a/Source/Ember/RendererBase.h b/Source/Ember/RendererBase.h index 5150e33..055d125 100644 --- a/Source/Ember/RendererBase.h +++ b/Source/Ember/RendererBase.h @@ -82,7 +82,7 @@ public: /// Add more in the future as different rendering methods are experimented with. /// Possible values might be: CPU+OpenGL, Particle, Inverse. /// -enum eRendererType { CPU_RENDERER, OPENCL_RENDERER }; +enum class eRendererType : et { CPU_RENDERER, OPENCL_RENDERER }; /// /// A base class with virtual functions to allow both templating and polymorphism to work together. diff --git a/Source/Ember/SheepTools.h b/Source/Ember/SheepTools.h index a5833f8..7e5ad75 100644 --- a/Source/Ember/SheepTools.h +++ b/Source/Ember/SheepTools.h @@ -14,7 +14,7 @@ namespace EmberNs /// /// Mutation mode enum. /// -enum eMutateMode +enum class eMutateMode : int { MUTATE_NOT_SPECIFIED = -1, MUTATE_ALL_VARIATIONS = 0, @@ -29,7 +29,7 @@ enum eMutateMode /// /// Cross mode enum. /// -enum eCrossMode +enum class eCrossMode : int { CROSS_NOT_SPECIFIED = -1, CROSS_UNION = 0, @@ -179,7 +179,7 @@ public: /// The mutation mode /// The variations to use if the mutation mode is random /// The type of symmetry to add if random specified. If 0, it will be added randomly. - /// The speed to multiply the pre affine transforms by if the mutate mode is MUTATE_ALL_COEFS, else ignored. + /// The speed to multiply the pre affine transforms by if the mutate mode is eMutateMode::MUTATE_ALL_COEFS, else ignored. /// The maximum number of variations to allow in any single xform in the ember. /// A string describing what was done string Mutate(Ember& ember, eMutateMode mode, vector& useVars, intmax_t sym, T speed, size_t maxVars) @@ -192,27 +192,27 @@ public: mutation.Clear(); //If mutate_mode = -1, choose a random mutation mode. - if (mode == MUTATE_NOT_SPECIFIED) + if (mode == eMutateMode::MUTATE_NOT_SPECIFIED) { randSelect = m_Rand.Frand01(); if (randSelect < T(0.1)) - mode = MUTATE_ALL_VARIATIONS; + mode = eMutateMode::MUTATE_ALL_VARIATIONS; else if (randSelect < T(0.3)) - mode = MUTATE_ONE_XFORM_COEFS; + mode = eMutateMode::MUTATE_ONE_XFORM_COEFS; else if (randSelect < T(0.5)) - mode = MUTATE_ADD_SYMMETRY; + mode = eMutateMode::MUTATE_ADD_SYMMETRY; else if (randSelect < T(0.6)) - mode = MUTATE_POST_XFORMS; + mode = eMutateMode::MUTATE_POST_XFORMS; else if (randSelect < T(0.7)) - mode = MUTATE_COLOR_PALETTE; + mode = eMutateMode::MUTATE_COLOR_PALETTE; else if (randSelect < T(0.8)) - mode = MUTATE_DELETE_XFORM; + mode = eMutateMode::MUTATE_DELETE_XFORM; else - mode = MUTATE_ALL_COEFS; + mode = eMutateMode::MUTATE_ALL_COEFS; } - if (mode == MUTATE_ALL_VARIATIONS) + if (mode == eMutateMode::MUTATE_ALL_VARIATIONS) { os << "mutate all variations"; @@ -248,7 +248,7 @@ public: } while (!done); } - else if (mode == MUTATE_ONE_XFORM_COEFS) + else if (mode == eMutateMode::MUTATE_ONE_XFORM_COEFS) { //Generate a 2-xform random. Random(mutation, useVars, sym, 2, maxVars); @@ -271,12 +271,12 @@ public: xform1->m_Affine.m_Mat[i][j] = xform2->m_Affine.m_Mat[i][j]; } } - else if (mode == MUTATE_ADD_SYMMETRY) + else if (mode == eMutateMode::MUTATE_ADD_SYMMETRY) { os << "mutate symmetry"; ember.AddSymmetry(0, m_Rand); } - else if (mode == MUTATE_POST_XFORMS) + else if (mode == eMutateMode::MUTATE_POST_XFORMS) { bool same = (m_Rand.Rand() & 3) > 0;//25% chance of using the same post for all of them. size_t b = 1 + m_Rand.Rand() % 6; @@ -353,7 +353,7 @@ public: } } } - else if (mode == MUTATE_COLOR_PALETTE) + else if (mode == eMutateMode::MUTATE_COLOR_PALETTE) { T s = m_Rand.Frand01(); @@ -384,7 +384,7 @@ public: } } } - else if (mode == MUTATE_DELETE_XFORM) + else if (mode == eMutateMode::MUTATE_DELETE_XFORM) { size_t nx = m_Rand.Rand() % ember.TotalXformCount(); os << "mutate delete xform " << nx; @@ -392,7 +392,7 @@ public: if (ember.TotalXformCount() > 1) ember.DeleteTotalXform(nx); } - else if (mode == MUTATE_ALL_COEFS) + else if (mode == eMutateMode::MUTATE_ALL_COEFS) { os << "mutate all coefs"; Random(mutation, useVars, sym, ember.TotalXformCount(), maxVars); @@ -422,7 +422,7 @@ public: /// The result ember /// The cross mode /// A string describing what was done - string Cross(Ember& ember0, Ember& ember1, Ember& emberOut, int crossMode) + string Cross(Ember& ember0, Ember& ember1, Ember& emberOut, eCrossMode crossMode) { uint rb; size_t i; @@ -430,19 +430,19 @@ public: ostringstream os; char ministr[32]; - if (crossMode == CROSS_NOT_SPECIFIED) + if (crossMode == eCrossMode::CROSS_NOT_SPECIFIED) { T s = m_Rand.Frand01(); if (s < 0.1) - crossMode = CROSS_UNION; + crossMode = eCrossMode::CROSS_UNION; else if (s < 0.2) - crossMode = CROSS_INTERPOLATE; + crossMode = eCrossMode::CROSS_INTERPOLATE; else - crossMode = CROSS_ALTERNATE; + crossMode = eCrossMode::CROSS_ALTERNATE; } - if (crossMode == CROSS_UNION) + if (crossMode == eCrossMode::CROSS_UNION) { //Make a copy of the first ember. emberOut = ember0; @@ -453,7 +453,7 @@ public: os << "cross union"; } - else if (crossMode == CROSS_INTERPOLATE) + else if (crossMode == eCrossMode::CROSS_INTERPOLATE) { //Linearly interpolate somewhere between the two. Ember parents[2]; @@ -640,8 +640,8 @@ public: } } - //If first input variation is -1 random choose one to use or decide to use multiple. - if (useVars.empty() || useVars[0] == -1) + //If useVars is empty, randomly choose one to use or decide to use multiple. + if (useVars.empty()) var = m_Rand.RandBit() ? m_Rand.Rand() % varCount : -1; else var = -2; diff --git a/Source/Ember/SpatialFilter.h b/Source/Ember/SpatialFilter.h index 82c0091..92537ec 100644 --- a/Source/Ember/SpatialFilter.h +++ b/Source/Ember/SpatialFilter.h @@ -11,7 +11,7 @@ namespace EmberNs /// /// The types of spatial filters available. /// -enum class eSpatialFilterType : size_t +enum class eSpatialFilterType : et { GAUSSIAN_SPATIAL_FILTER, HERMITE_SPATIAL_FILTER, diff --git a/Source/Ember/TemporalFilter.h b/Source/Ember/TemporalFilter.h index 7b9a781..b0030b5 100644 --- a/Source/Ember/TemporalFilter.h +++ b/Source/Ember/TemporalFilter.h @@ -11,7 +11,7 @@ namespace EmberNs /// /// The types of temporal filters available. /// -enum class eTemporalFilterType : size_t +enum class eTemporalFilterType : et { BOX_TEMPORAL_FILTER, GAUSSIAN_TEMPORAL_FILTER, diff --git a/Source/Ember/Utils.h b/Source/Ember/Utils.h index dc31b2a..dfc8af8 100644 --- a/Source/Ember/Utils.h +++ b/Source/Ember/Utils.h @@ -19,7 +19,7 @@ namespace EmberNs /// /// Enum to encapsulate and add type safety to the thread priority defines. /// -enum eThreadPriority +enum class eThreadPriority : int { LOWEST = THREAD_PRIORITY_LOWEST,//-2 BELOW_NORMAL = THREAD_PRIORITY_BELOW_NORMAL,//-1 @@ -227,7 +227,7 @@ public: \ private: \ x(const x& other) = delete; \ - const x& operator=(const x& other) = delete//Semicolon deliberately omitted to force it on the caller. + const x& operator=(const x& other) = delete//Semicolon deliberately omitted to force it on the caller. //Use this if the body of the destructor is empty and is will be implemented inline in the header file. #define SINGLETON_DERIVED_IMPL(x) \ @@ -237,7 +237,7 @@ public: \ private: \ x(const x& other) = delete; \ - const x& operator=(const x& other) = delete + const x& operator=(const x& other) = delete /// /// Open a file in binary mode and read its entire contents into a vector of bytes. Optionally null terminate. diff --git a/Source/Ember/Variation.h b/Source/Ember/Variation.h index 14f8b31..37218fe 100644 --- a/Source/Ember/Variation.h +++ b/Source/Ember/Variation.h @@ -20,7 +20,7 @@ template class Xform; /// /// The type of variation: regular, pre or post. /// -enum eVariationType +enum class eVariationType : et { VARTYPE_REG, VARTYPE_PRE, @@ -33,7 +33,7 @@ enum eVariationType /// to the output. However, if they did not involve the input points, they should be added /// to the output. /// -enum eVariationAssignType +enum class eVariationAssignType : et { ASSIGNTYPE_SET, ASSIGNTYPE_SUM @@ -42,7 +42,7 @@ enum eVariationAssignType /// /// Complete list of every variation class ID. /// -enum eVariationId +enum class eVariationId : et { VAR_ARCH , VAR_AUGER , @@ -520,8 +520,8 @@ enum eVariationId VAR_PRE_LINEAR, VAR_PRE_LINEAR_T, VAR_PRE_LINEAR_T3D, - //VAR_PRE_LINEAR_XZ, - //VAR_PRE_LINEAR_YZ, + //eVariationId::VAR_PRE_LINEAR_XZ, + //eVariationId::VAR_PRE_LINEAR_YZ, VAR_PRE_LINEAR3D, VAR_PRE_LISSAJOUS, VAR_PRE_LOG, @@ -1002,7 +1002,7 @@ enum eVariationId VAR_POST_DC_TRIANGLE, VAR_POST_DC_ZTRANSL, - LAST_VAR = VAR_POST_DC_ZTRANSL + 1 + LAST_VAR = eVariationId::VAR_POST_DC_ZTRANSL + 1 }; /// @@ -1077,7 +1077,7 @@ public: m_NeedPrecalcSqrtSumSquares = true; } - m_AssignType = ASSIGNTYPE_SET; + m_AssignType = eVariationAssignType::ASSIGNTYPE_SET; SetType(); } @@ -1150,7 +1150,7 @@ public: /// The point to read values from in the case of post, ignored for pre. void PrecalcHelper(IteratorHelper& iteratorHelper, Point* point) { - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { if (m_NeedPrecalcSumSquares) { @@ -1174,7 +1174,7 @@ public: if (m_NeedPrecalcAtanYX) iteratorHelper.m_PrecalcAtanyx = atan2(iteratorHelper.m_TransY, iteratorHelper.m_TransX); } - else if (m_VarType == VARTYPE_POST) + else if (m_VarType == eVariationType::VARTYPE_POST) { if (m_NeedPrecalcSumSquares) { @@ -1208,7 +1208,7 @@ public: { ostringstream ss; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { if (m_NeedPrecalcSumSquares) { @@ -1232,7 +1232,7 @@ public: if (m_NeedPrecalcAtanYX) ss << "\tprecalcAtanyx = atan2(transY, transX);\n"; } - else if (m_VarType == VARTYPE_POST) + else if (m_VarType == eVariationType::VARTYPE_POST) { if (m_NeedPrecalcSumSquares) { @@ -1385,9 +1385,9 @@ public: /// pre_, post_ or the empty string string Prefix() const { - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) return "pre_"; - else if (m_VarType == VARTYPE_POST) + else if (m_VarType == eVariationType::VARTYPE_POST) return "post_"; else return ""; @@ -1427,11 +1427,11 @@ protected: void SetType() { if (m_Name.find("pre_") == 0) - m_VarType = VARTYPE_PRE; + m_VarType = eVariationType::VARTYPE_PRE; else if (m_Name.find("post_") == 0) - m_VarType = VARTYPE_POST; + m_VarType = eVariationType::VARTYPE_POST; else - m_VarType = VARTYPE_REG; + m_VarType = eVariationType::VARTYPE_REG; } Xform* m_Xform;//The parent Xform that this variation is a child of. @@ -1452,7 +1452,7 @@ private: /// The type of parameter represented by ParamWithName. /// This allows restricting of certain parameters to sensible values. /// -enum eParamType +enum class eParamType : et { REAL, REAL_CYCLIC, @@ -1461,6 +1461,44 @@ enum eParamType INTEGER_NONZERO }; +/// +/// Thin wrapper to allow << operator on param type. +/// +/// The stream to insert into +/// The type whose string representation will be inserted into the stream +/// +static std::ostream& operator<<(std::ostream& stream, const eParamType& t) +{ + switch (t) + { + case eParamType::REAL: + stream << "real"; + break; + + case eParamType::REAL_CYCLIC: + stream << "cyclic"; + break; + + case eParamType::REAL_NONZERO: + stream << "non-zero"; + break; + + case eParamType::INTEGER: + stream << "integer"; + break; + + case eParamType::INTEGER_NONZERO: + stream << "integer non-zero"; + break; + + default: + stream << "error"; + break; + } + + return stream; +} + template class ParametricVariation; /// @@ -1487,7 +1525,7 @@ public: /// ParamWithName() { - Init(nullptr, "", 0, REAL, TLOW, TMAX); + Init(nullptr, "", 0, eParamType::REAL, TLOW, TMAX); } /// @@ -1502,7 +1540,7 @@ public: string name, size_t size = sizeof(T)) { - Init(param, name, 0, REAL, TLOW, TMAX, true, false, size); + Init(param, name, 0, eParamType::REAL, TLOW, TMAX, true, false, size); } /// @@ -1517,7 +1555,7 @@ public: T* param, string name) { - Init(param, name, 0, REAL, TLOW, TMAX, true, true); + Init(param, name, 0, eParamType::REAL, TLOW, TMAX, true, true); } /// @@ -1529,7 +1567,7 @@ public: /// The type of the parameter /// The minimum value the parameter can be /// The maximum value the parameter can be - ParamWithName(T* param, const string& name, T def = 0, eParamType type = REAL, T min = TLOW, T max = TMAX) + ParamWithName(T* param, const string& name, T def = 0, eParamType type = eParamType::REAL, T min = TLOW, T max = TMAX) { Init(param, name, def, type, min, max); } @@ -1586,7 +1624,7 @@ public: /// Whether the parameter is actually a precalculated value. Default: false. /// Whether the parameter changes state between iterations. Default: false. /// The length of the underlying memory in bytes. Needed for array types. Default: sizeof(T). - void Init(T* param, const string& name, T def = 0, eParamType type = REAL, T min = TLOW, T max = TMAX, bool isPrecalc = false, bool isState = false, size_t size = sizeof(T)) + void Init(T* param, const string& name, T def = 0, eParamType type = eParamType::REAL, T min = TLOW, T max = TMAX, bool isPrecalc = false, bool isState = false, size_t size = sizeof(T)) { m_Param = param; m_Def = def; @@ -1610,13 +1648,13 @@ public: { switch (m_Type) { - case REAL : + case eParamType::REAL: { *m_Param = std::max(std::min(val, m_Max), m_Min); break; } - case REAL_CYCLIC : + case eParamType::REAL_CYCLIC : { if (val > m_Max) *m_Param = m_Min + fmod(val - m_Min, m_Max - m_Min); @@ -1628,7 +1666,7 @@ public: break; } - case REAL_NONZERO : + case eParamType::REAL_NONZERO : { T vd = std::max(std::min(val, m_Max), m_Min); @@ -1640,13 +1678,13 @@ public: break; } - case INTEGER : + case eParamType::INTEGER : { *m_Param = T(int(std::max(std::min(T(Floor(val + T(0.5))), m_Max), m_Min))); break; } - case INTEGER_NONZERO : + case eParamType::INTEGER_NONZERO : default: { int vi = int(std::max(std::min(T(Floor(val + T(0.5))), m_Max), m_Min)); @@ -2098,7 +2136,7 @@ protected: /// Assign type defaults to set. /// -#define MAKEPREPOSTVAR(varName, stringName, enumName) MAKEPREPOSTVARASSIGN(varName, stringName, enumName, ASSIGNTYPE_SET) +#define MAKEPREPOSTVAR(varName, stringName, enumName) MAKEPREPOSTVARASSIGN(varName, stringName, enumName, eVariationAssignType::ASSIGNTYPE_SET) #define MAKEPREPOSTVARASSIGN(varName, stringName, enumName, assignType) \ template \ class EMBER_API Pre##varName##Variation : public varName##Variation \ @@ -2107,7 +2145,7 @@ protected: public: \ Pre##varName##Variation(T weight = 1.0) : varName##Variation(weight) \ { \ - m_VariationId = VAR_PRE_##enumName; \ + m_VariationId = eVariationId::VAR_PRE_##enumName; \ m_Name = "pre_"#stringName; \ m_AssignType = assignType; \ SetType(); \ @@ -2123,7 +2161,7 @@ protected: public:\ Post##varName##Variation(T weight = 1.0) : varName##Variation(weight) \ { \ - m_VariationId = VAR_POST_##enumName; \ + m_VariationId = eVariationId::VAR_POST_##enumName; \ m_Name = "post_"#stringName; \ m_AssignType = assignType; \ SetType(); \ @@ -2217,7 +2255,7 @@ protected: /// avoid having to change the constructor arguments for about 300 variations. /// -#define MAKEPREPOSTPARVAR(varName, stringName, enumName) MAKEPREPOSTPARVARASSIGN(varName, stringName, enumName, ASSIGNTYPE_SET) +#define MAKEPREPOSTPARVAR(varName, stringName, enumName) MAKEPREPOSTPARVARASSIGN(varName, stringName, enumName, eVariationAssignType::ASSIGNTYPE_SET) #define MAKEPREPOSTPARVARASSIGN(varName, stringName, enumName, assignType) \ template \ class EMBER_API Pre##varName##Variation : public varName##Variation \ @@ -2228,7 +2266,7 @@ protected: public:\ Pre##varName##Variation(T weight = 1.0) : varName##Variation(weight) \ { \ - m_VariationId = VAR_PRE_##enumName; \ + m_VariationId = eVariationId::VAR_PRE_##enumName; \ m_Name = "pre_"#stringName; \ m_AssignType = assignType; \ SetType(); \ @@ -2247,7 +2285,7 @@ protected: public:\ Post##varName##Variation(T weight = 1.0) : varName##Variation(weight) \ { \ - m_VariationId = VAR_POST_##enumName; \ + m_VariationId = eVariationId::VAR_POST_##enumName; \ m_Name = "post_"#stringName; \ m_AssignType = assignType; \ SetType(); \ diff --git a/Source/Ember/VariationList.h b/Source/Ember/VariationList.h index 3acb26e..3b26a6a 100644 --- a/Source/Ember/VariationList.h +++ b/Source/Ember/VariationList.h @@ -36,7 +36,7 @@ public: /// VariationList() { - m_Variations.reserve(eVariationId::LAST_VAR); + m_Variations.reserve(size_t(eVariationId::LAST_VAR)); ADDPREPOSTREGVAR(Linear) ADDPREPOSTREGVAR(Sinusoidal) ADDPREPOSTREGVAR(Spherical) @@ -363,17 +363,19 @@ public: m_PostVariations.reserve(m_Variations.size() / 3); m_ParametricVariations.reserve(size_t(m_Variations.size() * .90));//This is a rough guess at how many are parametric. - for (auto var : m_Variations) if (var->VarType() == VARTYPE_REG) m_RegVariations.push_back(var); - - for (auto var : m_Variations) if (var->VarType() == VARTYPE_PRE) m_PreVariations.push_back(var); - - for (auto var : m_Variations) if (var->VarType() == VARTYPE_POST) m_PostVariations.push_back(var); - - //Keep a list of which variations derive from ParametricVariation. + //Place pointers to variations in vectors specific to their type. + //Many of the elements in m_ParametricVariations will be present in the reg, pre and post vectors. //Note that these are not new copies, rather just pointers to the original instances in m_Variations. - for (size_t i = 0; i < m_Variations.size(); i++) + for (auto var : m_Variations) { - if (ParametricVariation* parVar = dynamic_cast*>(m_Variations[i])) + if (var->VarType() == eVariationType::VARTYPE_REG) + m_RegVariations.push_back(var); + else if (var->VarType() == eVariationType::VARTYPE_PRE) + m_PreVariations.push_back(var); + else if (var->VarType() == eVariationType::VARTYPE_POST) + m_PostVariations.push_back(var); + + if (auto parVar = dynamic_cast*>(var)) m_ParametricVariations.push_back(parVar); } } @@ -401,14 +403,24 @@ public: /// A pointer to the variation of the specified type at the index if in range, else nullptr. const Variation* GetVariation(size_t index, eVariationType varType) const { - if (varType == VARTYPE_REG) - return index < m_RegVariations.size() ? m_RegVariations[index] : nullptr; - else if (varType == VARTYPE_PRE) - return index < m_PreVariations.size() ? m_PreVariations[index] : nullptr; - else if (varType == VARTYPE_POST) - return index < m_PostVariations.size() ? m_PostVariations[index] : nullptr; - else - return nullptr; + switch (varType) + { + case eVariationType::VARTYPE_REG: + return index < m_RegVariations.size() ? m_RegVariations[index] : nullptr; + break; + + case eVariationType::VARTYPE_PRE: + return index < m_PreVariations.size() ? m_PreVariations[index] : nullptr; + break; + + case eVariationType::VARTYPE_POST: + return index < m_PostVariations.size() ? m_PostVariations[index] : nullptr; + break; + + default: + return nullptr; + break; + } } /// @@ -428,9 +440,9 @@ public: /// A pointer to the variation if found, else nullptr. const Variation* GetVariation(eVariationId id) const { - for (size_t i = 0; i < m_Variations.size() && m_Variations[i]; i++) - if (id == m_Variations[i]->VariationId()) - return m_Variations[i]; + for (auto var : m_Variations) + if (var && id == var->VariationId()) + return var; return nullptr; } @@ -451,9 +463,9 @@ public: /// A pointer to the variation if found, else nullptr. const Variation* GetVariation(const string& name) const { - for (size_t i = 0; i < m_Variations.size() && m_Variations[i]; i++) - if (!_stricmp(name.c_str(), m_Variations[i]->Name().c_str())) - return m_Variations[i]; + for (auto var : m_Variations) + if (var && !_stricmp(name.c_str(), var->Name().c_str())) + return var; return nullptr; } @@ -482,9 +494,9 @@ public: /// The parametric variation with a matching name, else nullptr. const ParametricVariation* GetParametricVariation(const string& name) const { - for (size_t i = 0; i < m_ParametricVariations.size() && m_ParametricVariations[i]; i++) - if (!_stricmp(name.c_str(), m_ParametricVariations[i]->Name().c_str())) - return m_ParametricVariations[i]; + for (auto var : m_ParametricVariations) + if (var && !_stricmp(name.c_str(), var->Name().c_str())) + return var; return nullptr; } @@ -524,7 +536,7 @@ private: { if (var) { - Variation* var2 = var->Copy(); + auto var2 = var->Copy(); var2->m_Weight = weight; return var2; } diff --git a/Source/Ember/Variations01.h b/Source/Ember/Variations01.h index c7af86f..df97f28 100644 --- a/Source/Ember/Variations01.h +++ b/Source/Ember/Variations01.h @@ -15,7 +15,7 @@ template class EMBER_API LinearVariation : public Variation { public: - LinearVariation(T weight = 1.0) : Variation("linear", VAR_LINEAR, weight) { } + LinearVariation(T weight = 1.0) : Variation("linear", eVariationId::VAR_LINEAR, weight) { } VARCOPY(LinearVariation) @@ -30,13 +30,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" - << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n" - << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n" - << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" - << "\t}\n"; - + << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n" + << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n" + << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" + << "\t}\n"; return ss.str(); } }; @@ -52,7 +50,7 @@ template class EMBER_API SinusoidalVariation : public Variation { public: - SinusoidalVariation(T weight = 1.0) : Variation("sinusoidal", VAR_SINUSOIDAL, weight) { } + SinusoidalVariation(T weight = 1.0) : Variation("sinusoidal", eVariationId::VAR_SINUSOIDAL, weight) { } VARCOPY(SinusoidalVariation) @@ -67,13 +65,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.y);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -90,14 +86,13 @@ template class EMBER_API SphericalVariation : public Variation { public: - SphericalVariation(T weight = 1.0) : Variation("spherical", VAR_SPHERICAL, weight, true) { } + SphericalVariation(T weight = 1.0) : Variation("spherical", eVariationId::VAR_SPHERICAL, weight, true) { } VARCOPY(SphericalVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r2 = m_Weight / Zeps(helper.m_PrecalcSumSquares); - helper.Out.x = r2 * helper.In.x; helper.Out.y = r2 * helper.In.y; helper.Out.z = m_Weight * helper.In.z; @@ -107,7 +102,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r2 = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares);\n" << "\n" @@ -115,7 +109,6 @@ public: << "\t\tvOut.y = r2 * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -139,14 +132,13 @@ template class EMBER_API SwirlVariation : public Variation { public: - SwirlVariation(T weight = 1.0) : Variation("swirl", VAR_SWIRL, weight, true) { } + SwirlVariation(T weight = 1.0) : Variation("swirl", eVariationId::VAR_SWIRL, weight, true) { } VARCOPY(SwirlVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T c1, c2; - sincos(helper.m_PrecalcSumSquares, &c1, &c2); helper.Out.x = m_Weight * (c1 * helper.In.x - c2 * helper.In.y); helper.Out.y = m_Weight * (c2 * helper.In.x + c1 * helper.In.y); @@ -157,7 +149,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t c1 = sin(precalcSumSquares);\n" << "\t\treal_t c2 = cos(precalcSumSquares);\n" @@ -166,7 +157,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (c2 * vIn.x + c1 * vIn.y);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -185,14 +175,13 @@ template class EMBER_API HorseshoeVariation : public Variation { public: - HorseshoeVariation(T weight = 1.0) : Variation("horseshoe", VAR_HORSESHOE, weight, true, true) { } + HorseshoeVariation(T weight = 1.0) : Variation("horseshoe", eVariationId::VAR_HORSESHOE, weight, true, true) { } VARCOPY(HorseshoeVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = m_Weight / Zeps(helper.m_PrecalcSqrtSumSquares); - helper.Out.x = (helper.In.x - helper.In.y) * (helper.In.x + helper.In.y) * r; helper.Out.y = 2 * helper.In.x * helper.In.y * r; helper.Out.z = m_Weight * helper.In.z; @@ -202,7 +191,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSqrtSumSquares);\n" << "\n" @@ -210,7 +198,6 @@ public: << "\t\tvOut.y = (real_t)(2.0) * vIn.x * vIn.y * r;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -231,7 +218,7 @@ template class EMBER_API PolarVariation : public Variation { public: - PolarVariation(T weight = 1.0) : Variation("polar", VAR_POLAR, weight, true, true, false, true, false) { } + PolarVariation(T weight = 1.0) : Variation("polar", eVariationId::VAR_POLAR, weight, true, true, false, true, false) { } VARCOPY(PolarVariation) @@ -246,13 +233,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (precalcAtanxy * M_1_PI);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (precalcSqrtSumSquares - (real_t)(1.0));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -268,7 +253,7 @@ template class EMBER_API HandkerchiefVariation : public Variation { public: - HandkerchiefVariation(T weight = 1.0) : Variation("handkerchief", VAR_HANDKERCHIEF, weight, true, true, false, true) { } + HandkerchiefVariation(T weight = 1.0) : Variation("handkerchief", eVariationId::VAR_HANDKERCHIEF, weight, true, true, false, true) { } VARCOPY(HandkerchiefVariation) @@ -283,13 +268,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares * sin(precalcAtanxy + precalcSqrtSumSquares);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares * cos(precalcAtanxy - precalcSqrtSumSquares);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -306,7 +289,7 @@ template class EMBER_API HeartVariation : public Variation { public: - HeartVariation(T weight = 1.0) : Variation("heart", VAR_HEART, weight, true, true, false, true) { } + HeartVariation(T weight = 1.0) : Variation("heart", eVariationId::VAR_HEART, weight, true, true, false, true) { } VARCOPY(HeartVariation) @@ -314,7 +297,6 @@ public: { T a = helper.m_PrecalcSqrtSumSquares * helper.m_PrecalcAtanxy; T r = m_Weight * helper.m_PrecalcSqrtSumSquares; - helper.Out.x = r * std::sin(a); helper.Out.y = (-r) * std::cos(a); helper.Out.z = m_Weight * helper.In.z; @@ -324,7 +306,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t a = precalcSqrtSumSquares * precalcAtanxy;\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares;\n" @@ -333,7 +314,6 @@ public: << "\t\tvOut.y = (-r) * cos(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -351,7 +331,7 @@ template class EMBER_API DiscVariation : public ParametricVariation { public: - DiscVariation(T weight = 1.0) : ParametricVariation("disc", VAR_DISC, weight, true, true, false, true) + DiscVariation(T weight = 1.0) : ParametricVariation("disc", eVariationId::VAR_DISC, weight, true, true, false, true) { Init(); } @@ -362,7 +342,6 @@ public: { T val = T(M_PI) * helper.m_PrecalcSqrtSumSquares; T r = m_WeightByPI * helper.m_PrecalcAtanxy; - helper.Out.x = std::sin(val) * r; helper.Out.y = std::cos(val) * r; helper.Out.z = m_Weight * helper.In.z; @@ -375,7 +354,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string weightByPI = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params. - ss << "\t{\n" << "\t\treal_t val = M_PI * precalcSqrtSumSquares;\n" << "\t\treal_t r = " << weightByPI << " * precalcAtanxy;\n" @@ -384,7 +362,6 @@ public: << "\t\tvOut.y = cos(val) * r;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -397,7 +374,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(true, &m_WeightByPI, prefix + "disc_weight_by_pi"));//Precalcs only, no params. } @@ -417,7 +393,7 @@ template class EMBER_API SpiralVariation : public Variation { public: - SpiralVariation(T weight = 1.0) : Variation("spiral", VAR_SPIRAL, weight, true, true, true) { } + SpiralVariation(T weight = 1.0) : Variation("spiral", eVariationId::VAR_SPIRAL, weight, true, true, true) { } VARCOPY(SpiralVariation) @@ -425,7 +401,6 @@ public: { T r = Zeps(helper.m_PrecalcSqrtSumSquares); T r1 = m_Weight / r; - helper.Out.x = r1 * (helper.m_PrecalcCosa + std::sin(r)); helper.Out.y = r1 * (helper.m_PrecalcSina - std::cos(r)); helper.Out.z = m_Weight * helper.In.z; @@ -435,7 +410,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = Zeps(precalcSqrtSumSquares);\n" << "\t\treal_t r1 = xform->m_VariationWeights[" << varIndex << "] / r;\n" @@ -444,7 +418,6 @@ public: << "\t\tvOut.y = r1 * (precalcSina - cos(r));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -465,14 +438,13 @@ template class EMBER_API HyperbolicVariation : public Variation { public: - HyperbolicVariation(T weight = 1.0) : Variation("hyperbolic", VAR_HYPERBOLIC, weight, true, true, true) { } + HyperbolicVariation(T weight = 1.0) : Variation("hyperbolic", eVariationId::VAR_HYPERBOLIC, weight, true, true, true) { } VARCOPY(HyperbolicVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = Zeps(helper.m_PrecalcSqrtSumSquares); - helper.Out.x = m_Weight * helper.m_PrecalcSina / r; helper.Out.y = m_Weight * helper.m_PrecalcCosa * r; helper.Out.z = m_Weight * helper.In.z; @@ -482,7 +454,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = Zeps(precalcSqrtSumSquares);\n" << "\n" @@ -490,7 +461,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * precalcCosa * r;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -511,7 +481,7 @@ template class EMBER_API DiamondVariation : public Variation { public: - DiamondVariation(T weight = 1.0) : Variation("diamond", VAR_DIAMOND, weight, true, true, true) { } + DiamondVariation(T weight = 1.0) : Variation("diamond", eVariationId::VAR_DIAMOND, weight, true, true, true) { } VARCOPY(DiamondVariation) @@ -526,13 +496,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * precalcSina * cos(precalcSqrtSumSquares);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * precalcCosa * sin(precalcSqrtSumSquares);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -552,7 +520,7 @@ template class EMBER_API ExVariation : public Variation { public: - ExVariation(T weight = 1.0) : Variation("ex", VAR_EX, weight, true, true, false, true) { } + ExVariation(T weight = 1.0) : Variation("ex", eVariationId::VAR_EX, weight, true, true, false, true) { } VARCOPY(ExVariation) @@ -564,7 +532,6 @@ public: T n1 = std::cos(a - r); T m0 = n0 * n0 * n0 * r; T m1 = n1 * n1 * n1 * r; - helper.Out.x = m_Weight * (m0 + m1); helper.Out.y = m_Weight * (m0 - m1); helper.Out.z = m_Weight * helper.In.z; @@ -574,7 +541,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t a = precalcAtanxy;\n" << "\t\treal_t r = precalcSqrtSumSquares;\n" @@ -587,7 +553,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (m0 - m1);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -606,7 +571,7 @@ template class EMBER_API JuliaVariation : public Variation { public: - JuliaVariation(T weight = 1.0) : Variation("julia", VAR_JULIA, weight, true, true, false, true) { } + JuliaVariation(T weight = 1.0) : Variation("julia", eVariationId::VAR_JULIA, weight, true, true, false, true) { } VARCOPY(JuliaVariation) @@ -627,7 +592,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * sqrt(precalcSqrtSumSquares);\n" << "\t\treal_t a = (real_t)(0.5) * precalcAtanxy;\n" @@ -639,7 +603,6 @@ public: << "\t\tvOut.y = r * sin(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -657,7 +620,7 @@ template class EMBER_API BentVariation : public Variation { public: - BentVariation(T weight = 1.0) : Variation("bent", VAR_BENT, weight) { } + BentVariation(T weight = 1.0) : Variation("bent", eVariationId::VAR_BENT, weight) { } VARCOPY(BentVariation) @@ -665,7 +628,6 @@ public: { T nx = helper.In.x < T(0.0) ? helper.In.x * 2 : helper.In.x; T ny = helper.In.y < T(0.0) ? helper.In.y / 2 : helper.In.y; - helper.Out.x = m_Weight * nx; helper.Out.y = m_Weight * ny; helper.Out.z = m_Weight * helper.In.z; @@ -675,7 +637,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t nx = vIn.x < (real_t)(0.0) ? (vIn.x * (real_t)(2.0)) : vIn.x;\n" << "\t\treal_t ny = vIn.y < (real_t)(0.0) ? (vIn.y / (real_t)(2.0)) : vIn.y;\n" @@ -684,7 +645,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * ny;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -703,7 +663,7 @@ template class EMBER_API WavesVariation : public ParametricVariation { public: - WavesVariation(T weight = 1.0) : ParametricVariation("waves", VAR_WAVES, weight) + WavesVariation(T weight = 1.0) : ParametricVariation("waves", eVariationId::VAR_WAVES, weight) { Init(); } @@ -716,7 +676,6 @@ public: T c11 = m_Xform->m_Affine.E(); T nx = helper.In.x + c10 * std::sin(helper.In.y * m_Dx2); T ny = helper.In.y + c11 * std::sin(helper.In.x * m_Dy2); - helper.Out.x = m_Weight * nx; helper.Out.y = m_Weight * ny; helper.Out.z = m_Weight * helper.In.z; @@ -730,7 +689,6 @@ public: string index = ss2.str(); string dx2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalcs only, no params. string dy2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t c10 = xform->m_B;\n" << "\t\treal_t c11 = xform->m_E;\n" @@ -741,7 +699,6 @@ public: << "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * ny);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -751,7 +708,6 @@ public: { T dx = m_Xform->m_Affine.C(); T dy = m_Xform->m_Affine.F(); - m_Dx2 = 1 / Zeps(dx * dx); m_Dy2 = 1 / Zeps(dy * dy); } @@ -761,7 +717,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(true, &m_Dx2, prefix + "waves_dx2"));//Precalcs only, no params. m_Params.push_back(ParamWithName(true, &m_Dy2, prefix + "waves_dy2")); @@ -786,14 +741,13 @@ template class EMBER_API FisheyeVariation : public Variation { public: - FisheyeVariation(T weight = 1.0) : Variation("fisheye", VAR_FISHEYE, weight, true, true) { } + FisheyeVariation(T weight = 1.0) : Variation("fisheye", eVariationId::VAR_FISHEYE, weight, true, true) { } VARCOPY(FisheyeVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = 2 * m_Weight / (helper.m_PrecalcSqrtSumSquares + 1); - helper.Out.x = r * helper.In.y; helper.Out.y = r * helper.In.x; helper.Out.z = m_Weight * helper.In.z; @@ -803,7 +757,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = 2 * xform->m_VariationWeights[" << varIndex << "] / (precalcSqrtSumSquares + 1);\n" << "\n" @@ -811,7 +764,6 @@ public: << "\t\tvOut.y = r * vIn.x;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -829,7 +781,7 @@ template class EMBER_API PopcornVariation : public Variation { public: - PopcornVariation(T weight = 1.0) : Variation("popcorn", VAR_POPCORN, weight) { } + PopcornVariation(T weight = 1.0) : Variation("popcorn", eVariationId::VAR_POPCORN, weight) { } VARCOPY(PopcornVariation) @@ -839,7 +791,6 @@ public: T dy = SafeTan(3 * helper.In.x); T nx = helper.In.x + m_Xform->m_Affine.C() * std::sin(dx); T ny = helper.In.y + m_Xform->m_Affine.F() * std::sin(dy); - helper.Out.x = m_Weight * nx; helper.Out.y = m_Weight * ny; helper.Out.z = m_Weight * helper.In.z; @@ -849,7 +800,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t dx = tan(3 * vIn.y);\n" << "\t\treal_t dy = tan(3 * vIn.x);\n" @@ -860,7 +810,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * ny;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -878,7 +827,7 @@ template class EMBER_API ExponentialVariation : public Variation { public: - ExponentialVariation(T weight = 1.0) : Variation("exponential", VAR_EXPONENTIAL, weight) { } + ExponentialVariation(T weight = 1.0) : Variation("exponential", eVariationId::VAR_EXPONENTIAL, weight) { } VARCOPY(ExponentialVariation) @@ -886,7 +835,6 @@ public: { T dx = m_Weight * std::exp(helper.In.x - 1); T dy = T(M_PI) * helper.In.y; - helper.Out.x = dx * std::cos(dy); helper.Out.y = dx * std::sin(dy); helper.Out.z = m_Weight * helper.In.z; @@ -896,7 +844,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t dx = xform->m_VariationWeights[" << varIndex << "] * exp(vIn.x - (real_t)(1.0));\n" << "\t\treal_t dy = M_PI * vIn.y;\n" @@ -905,7 +852,6 @@ public: << "\t\tvOut.y = dx * sin(dy);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -925,14 +871,13 @@ template class EMBER_API PowerVariation : public Variation { public: - PowerVariation(T weight = 1.0) : Variation("power", VAR_POWER, weight, true, true, true) { } + PowerVariation(T weight = 1.0) : Variation("power", eVariationId::VAR_POWER, weight, true, true, true) { } VARCOPY(PowerVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = m_Weight * std::pow(helper.m_PrecalcSqrtSumSquares, helper.m_PrecalcSina); - helper.Out.x = r * helper.m_PrecalcCosa; helper.Out.y = r * helper.m_PrecalcSina; helper.Out.z = m_Weight * helper.In.z; @@ -942,7 +887,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * pow(precalcSqrtSumSquares, precalcSina);\n" << "\n" @@ -950,7 +894,6 @@ public: << "\t\tvOut.y = r * precalcSina;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -966,7 +909,7 @@ template class EMBER_API CosineVariation : public Variation { public: - CosineVariation(T weight = 1.0) : Variation("cosine", VAR_COSINE, weight) { } + CosineVariation(T weight = 1.0) : Variation("cosine", eVariationId::VAR_COSINE, weight) { } VARCOPY(CosineVariation) @@ -975,7 +918,6 @@ public: T a = helper.In.x * T(M_PI); T nx = std::cos(a) * std::cosh(helper.In.y); T ny = -std::sin(a) * std::sinh(helper.In.y); - helper.Out.x = m_Weight * nx; helper.Out.y = m_Weight * ny; helper.Out.z = m_Weight * helper.In.z; @@ -985,7 +927,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t a = vIn.x * M_PI;\n" << "\t\treal_t nx = cos(a) * cosh(vIn.y);\n" @@ -995,7 +936,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * ny;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -1016,7 +956,7 @@ template class EMBER_API RingsVariation : public Variation { public: - RingsVariation(T weight = 1.0) : Variation("rings", VAR_RINGS, weight, true, true, true) { } + RingsVariation(T weight = 1.0) : Variation("rings", eVariationId::VAR_RINGS, weight, true, true, true) { } VARCOPY(RingsVariation) @@ -1024,7 +964,6 @@ public: { T dx = Zeps(m_Xform->m_Affine.C() * m_Xform->m_Affine.C()); T r = helper.m_PrecalcSqrtSumSquares; - r = m_Weight * (fmod(r + dx, 2 * dx) - dx + r * (1 - dx)); helper.Out.x = r * helper.m_PrecalcCosa; helper.Out.y = r * helper.m_PrecalcSina; @@ -1035,7 +974,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t dx = Zeps(xform->m_C * xform->m_C);\n" << "\t\treal_t r = precalcSqrtSumSquares;\n" @@ -1045,7 +983,6 @@ public: << "\t\tvOut.y = r * precalcSina;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1073,7 +1010,7 @@ template class EMBER_API FanVariation : public Variation { public: - FanVariation(T weight = 1.0) : Variation("fan", VAR_FAN, weight, true, true, false, true) { } + FanVariation(T weight = 1.0) : Variation("fan", eVariationId::VAR_FAN, weight, true, true, false, true) { } VARCOPY(FanVariation) @@ -1084,7 +1021,6 @@ public: T dx2 = T(0.5) * dx; T a = helper.m_PrecalcAtanxy; T r = m_Weight * helper.m_PrecalcSqrtSumSquares; - a += (fmod(a + dy, dx) > dx2) ? -dx2 : dx2; helper.Out.x = r * std::cos(a); helper.Out.y = r * std::sin(a); @@ -1095,7 +1031,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t dx = M_PI * Zeps(xform->m_C * xform->m_C);\n" << "\t\treal_t dy = xform->m_F;\n" @@ -1107,7 +1042,6 @@ public: << "\t\tvOut.y = r * sin(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1132,7 +1066,7 @@ template class EMBER_API BlobVariation : public ParametricVariation { public: - BlobVariation(T weight = 1.0) : ParametricVariation("blob", VAR_BLOB, weight, true, true, true, true) + BlobVariation(T weight = 1.0) : ParametricVariation("blob", eVariationId::VAR_BLOB, weight, true, true, true, true) { Init(); } @@ -1142,10 +1076,9 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = helper.m_PrecalcSqrtSumSquares * (m_BlobLow + m_BlobDiff * (T(0.5) + T(0.5) * std::sin(m_BlobWaves * helper.m_PrecalcAtanxy))); - helper.Out.x = m_Weight * helper.m_PrecalcSina * r; helper.Out.y = m_Weight * helper.m_PrecalcCosa * r; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1158,15 +1091,13 @@ public: string blobHigh = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string blobWaves = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string blobDiff = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r = precalcSqrtSumSquares * (" << blobLow << " + " << blobDiff << " * ((real_t)(0.5) + (real_t)(0.5) * sin(" << blobWaves << " * precalcAtanxy)));\n" << "\n" << "\t\tvOut.x = (xform->m_VariationWeights[" << varIndex << "] * precalcSina * r);\n" << "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * precalcCosa * r);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; - return ss.str(); } @@ -1186,7 +1117,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_BlobLow, prefix + "blob_low")); m_Params.push_back(ParamWithName(&m_BlobHigh, prefix + "blob_high", 1)); @@ -1215,7 +1145,7 @@ template class EMBER_API PdjVariation : public ParametricVariation { public: - PdjVariation(T weight = 1.0) : ParametricVariation("pdj", VAR_PDJ, weight) + PdjVariation(T weight = 1.0) : ParametricVariation("pdj", eVariationId::VAR_PDJ, weight) { Init(); } @@ -1228,7 +1158,6 @@ public: T nx2 = std::sin(m_PdjC * helper.In.x); T ny1 = std::sin(m_PdjA * helper.In.y); T ny2 = std::cos(m_PdjD * helper.In.y); - helper.Out.x = m_Weight * (ny1 - nx1); helper.Out.y = m_Weight * (nx2 - ny2); helper.Out.z = m_Weight * helper.In.z; @@ -1244,7 +1173,6 @@ public: string pdjB = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string pdjC = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string pdjD = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t nx1 = cos(" << pdjB << " * vIn.x)" << ";\n" << "\t\treal_t nx2 = sin(" << pdjC << " * vIn.x)" << ";\n" @@ -1255,7 +1183,6 @@ public: << "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * (nx2 - ny2));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1271,7 +1198,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_PdjA, prefix + "pdj_a")); m_Params.push_back(ParamWithName(&m_PdjB, prefix + "pdj_b")); @@ -1312,7 +1238,7 @@ template class EMBER_API Fan2Variation : public ParametricVariation { public: - Fan2Variation(T weight = 1.0) : ParametricVariation("fan2", VAR_FAN2, weight, true, true, false, true) + Fan2Variation(T weight = 1.0) : ParametricVariation("fan2", eVariationId::VAR_FAN2, weight, true, true, false, true) { Init(); } @@ -1345,7 +1271,6 @@ public: string fan2Y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string dx = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string dx2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t a = precalcAtanxy;\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares;\n" @@ -1360,7 +1285,6 @@ public: << "\t\tvOut.y = r * cos(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1380,7 +1304,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Fan2X, prefix + "fan2_x")); m_Params.push_back(ParamWithName(&m_Fan2Y, prefix + "fan2_y")); @@ -1409,7 +1332,7 @@ template class EMBER_API Rings2Variation : public ParametricVariation { public: - Rings2Variation(T weight = 1.0) : ParametricVariation("rings2", VAR_RINGS2, weight, true, true, true) + Rings2Variation(T weight = 1.0) : ParametricVariation("rings2", eVariationId::VAR_RINGS2, weight, true, true, true) { Init(); } @@ -1419,7 +1342,6 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = helper.m_PrecalcSqrtSumSquares; - r += -2 * m_Rings2Val2 * int((r + m_Rings2Val2) / (2 * m_Rings2Val2)) + r * (1 - m_Rings2Val2); helper.Out.x = m_Weight * helper.m_PrecalcSina * r; helper.Out.y = m_Weight * helper.m_PrecalcCosa * r; @@ -1434,7 +1356,6 @@ public: string index = ss2.str(); string rings2Val = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rings2Val2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r = precalcSqrtSumSquares;\n" << "\n" @@ -1443,7 +1364,6 @@ public: << "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * precalcCosa * r);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1461,7 +1381,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Rings2Val, prefix + "rings2_val", 1));//This differs from the original which used zero. Use 1 instead to avoid getting too close to dividing by zero. m_Params.push_back(ParamWithName(true, &m_Rings2Val2, prefix + "rings2_val2"));//Precalc. @@ -1482,14 +1401,13 @@ template class EMBER_API EyefishVariation : public Variation { public: - EyefishVariation(T weight = 1.0) : Variation("eyefish", VAR_EYEFISH, weight, true, true) { } + EyefishVariation(T weight = 1.0) : Variation("eyefish", eVariationId::VAR_EYEFISH, weight, true, true) { } VARCOPY(EyefishVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = 2 * m_Weight / (helper.m_PrecalcSqrtSumSquares + 1); - helper.Out.x = r * helper.In.x; helper.Out.y = r * helper.In.y; helper.Out.z = m_Weight * helper.In.z; @@ -1499,7 +1417,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = (xform->m_VariationWeights[" << varIndex << "] * (real_t)(2.0)) / (precalcSqrtSumSquares + (real_t)(1.0));\n" << "\n" @@ -1507,7 +1424,6 @@ public: << "\t\tvOut.y = r * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -1519,7 +1435,7 @@ template class EMBER_API BubbleVariation : public Variation { public: - BubbleVariation(T weight = 1.0) : Variation("bubble", VAR_BUBBLE, weight, true) { } + BubbleVariation(T weight = 1.0) : Variation("bubble", eVariationId::VAR_BUBBLE, weight, true) { } VARCOPY(BubbleVariation) @@ -1527,7 +1443,6 @@ public: { T denom = T(0.25) * helper.m_PrecalcSumSquares + 1; T r = m_Weight / denom; - helper.Out.x = r * helper.In.x; helper.Out.y = r * helper.In.y; helper.Out.z = m_Weight * (2 / denom - 1); @@ -1537,7 +1452,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t denom = (real_t)(0.25) * precalcSumSquares + 1;\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] / denom;\n" @@ -1546,7 +1460,6 @@ public: << "\t\tvOut.y = r * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (2 / denom - 1);\n" << "\t}\n"; - return ss.str(); } }; @@ -1558,7 +1471,7 @@ template class EMBER_API CylinderVariation : public Variation { public: - CylinderVariation(T weight = 1.0) : Variation("cylinder", VAR_CYLINDER, weight) { } + CylinderVariation(T weight = 1.0) : Variation("cylinder", eVariationId::VAR_CYLINDER, weight) { } VARCOPY(CylinderVariation) @@ -1573,13 +1486,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * cos(vIn.x);\n" << "\t}\n"; - return ss.str(); } }; @@ -1591,7 +1502,7 @@ template class EMBER_API PerspectiveVariation : public ParametricVariation { public: - PerspectiveVariation(T weight = 1.0) : ParametricVariation("perspective", VAR_PERSPECTIVE, weight) + PerspectiveVariation(T weight = 1.0) : ParametricVariation("perspective", eVariationId::VAR_PERSPECTIVE, weight) { Init(); } @@ -1602,7 +1513,6 @@ public: { T d = Zeps(m_Dist - helper.In.y * m_Vsin); T t = 1 / d; - helper.Out.x = m_Weight * m_Dist * helper.In.x * t; helper.Out.y = m_Weight * m_VfCos * helper.In.y * t; helper.Out.z = m_Weight * helper.In.z; @@ -1618,7 +1528,6 @@ public: string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string vSin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc. string vfCos = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t d = Zeps(" << dist << " - vIn.y * " << vSin << ");\n" << "\t\treal_t t = (real_t)(1.0) / d;\n" @@ -1627,7 +1536,6 @@ public: << "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * " << vfCos << " * vIn.y * t);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1639,7 +1547,6 @@ public: virtual void Precalc() override { T angle = m_Angle * T(M_PI) / 2; - m_Vsin = std::sin(angle); m_VfCos = m_Dist * std::cos(angle); } @@ -1654,7 +1561,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Angle, prefix + "perspective_angle"));//Params. m_Params.push_back(ParamWithName(&m_Dist, prefix + "perspective_dist")); @@ -1676,7 +1582,7 @@ template class EMBER_API NoiseVariation : public Variation { public: - NoiseVariation(T weight = 1.0) : Variation("noise", VAR_NOISE, weight) { } + NoiseVariation(T weight = 1.0) : Variation("noise", eVariationId::VAR_NOISE, weight) { } VARCOPY(NoiseVariation) @@ -1684,7 +1590,6 @@ public: { T tempr = rand.Frand01() * M_2PI; T r = m_Weight * rand.Frand01(); - helper.Out.x = helper.In.x * r * std::cos(tempr); helper.Out.y = helper.In.y * r * std::sin(tempr); helper.Out.z = m_Weight * helper.In.z; @@ -1694,7 +1599,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t tempr = MwcNext01(mwc) * M_2PI;\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * MwcNext01(mwc);\n" @@ -1703,7 +1607,6 @@ public: << "\t\tvOut.y = vIn.y * r * sin(tempr);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -1715,7 +1618,7 @@ template class EMBER_API JuliaNGenericVariation : public ParametricVariation { public: - JuliaNGenericVariation(T weight = 1.0) : ParametricVariation("julian", VAR_JULIAN, weight, true, false, false, false, true) + JuliaNGenericVariation(T weight = 1.0) : ParametricVariation("julian", eVariationId::VAR_JULIAN, weight, true, false, false, false, true) { Init(); } @@ -1726,7 +1629,6 @@ public: { T tempr = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand(ISAAC_INT(m_Rn))) / m_Power; T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn); - helper.Out.x = r * std::cos(tempr); helper.Out.y = r * std::sin(tempr); helper.Out.z = m_Weight * helper.In.z; @@ -1742,7 +1644,6 @@ public: string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc. string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tint tRnd = (int)(" << rn << " * MwcNext01(mwc));\n" << "\t\treal_t tempr = (precalcAtanyx + M_2PI * tRnd) / " << power << ";\n" @@ -1752,7 +1653,6 @@ public: << "\t\tvOut.y = r * sin(tempr);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1773,10 +1673,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Dist, prefix + "julian_dist", 1));//Params. - m_Params.push_back(ParamWithName(&m_Power, prefix + "julian_power", 1, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "julian_power", 1, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(true, &m_Rn, prefix + "julian_rn"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Cn, prefix + "julian_cn")); } @@ -1795,7 +1694,7 @@ template class EMBER_API JuliaScopeVariation : public ParametricVariation { public: - JuliaScopeVariation(T weight = 1.0) : ParametricVariation("juliascope", VAR_JULIASCOPE, weight, true, false, false, false, true) + JuliaScopeVariation(T weight = 1.0) : ParametricVariation("juliascope", eVariationId::VAR_JULIASCOPE, weight, true, false, false, false, true) { Init(); } @@ -1815,17 +1714,13 @@ public: helper.Out.x = r * std::cos(tempr); helper.Out.y = r * std::sin(tempr); helper.Out.z = m_Weight * helper.In.z; - //int rnd = (int)(m_Rn * rand.Frand01()); //T tempr, r; - //if ((rnd & 1) == 0) // tempr = (2 * T(M_PI) * (int)(m_Rn * rand.Frand01()) + helper.m_PrecalcAtanyx) / m_Power;//Fixed to get new random rather than use rnd from above.//SMOULDER //else // tempr = (2 * T(M_PI) * (int)(m_Rn * rand.Frand01()) - helper.m_PrecalcAtanyx) / m_Power; - //r = m_Weight * pow(helper.m_PrecalcSumSquares, m_Cn); - //helper.Out.x = r * cos(tempr); //helper.Out.y = r * sin(tempr); } @@ -1840,24 +1735,21 @@ public: string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc. string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - - ss << "\t{\n" - << "\t\tint rnd = (int)(" << rn << " * MwcNext01(mwc));\n" - << "\t\treal_t tempr, r;\n" - << "\n" - << "\t\tif ((rnd & 1) == 0)\n" - << "\t\t tempr = (M_2PI * rnd + precalcAtanyx) / " << power << ";\n" - << "\t\telse\n" - << "\t\t tempr = (M_2PI * rnd - precalcAtanyx) / " << power << ";\n" - << "\n" - << "\t\tr = xform->m_VariationWeights[" << varIndex << "] * pow(precalcSumSquares, " << cn << ");\n" - << "\n" - << "\t\tvOut.x = r * cos(tempr);\n" - << "\t\tvOut.y = r * sin(tempr);\n" - << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" - << "\t}\n"; - + << "\t\tint rnd = (int)(" << rn << " * MwcNext01(mwc));\n" + << "\t\treal_t tempr, r;\n" + << "\n" + << "\t\tif ((rnd & 1) == 0)\n" + << "\t\t tempr = (M_2PI * rnd + precalcAtanyx) / " << power << ";\n" + << "\t\telse\n" + << "\t\t tempr = (M_2PI * rnd - precalcAtanyx) / " << power << ";\n" + << "\n" + << "\t\tr = xform->m_VariationWeights[" << varIndex << "] * pow(precalcSumSquares, " << cn << ");\n" + << "\n" + << "\t\tvOut.x = r * cos(tempr);\n" + << "\t\tvOut.y = r * sin(tempr);\n" + << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" + << "\t}\n"; //ss << "\t{\n" // << "\t\tint rnd = (int)(" << rn << " * MwcNext01(mwc));\n" // << "\t\treal_t tempr, r;\n" @@ -1873,7 +1765,6 @@ public: // << "\t\tvOut.y = r * sin(tempr);\n" // << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" // << "\t}\n"; - return ss.str(); } @@ -1893,7 +1784,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Dist, prefix + "juliascope_dist", 1));//Params. m_Params.push_back(ParamWithName(&m_Power, prefix + "juliascope_power", 1)); @@ -1918,7 +1808,7 @@ template class EMBER_API BlurVariation : public Variation { public: - BlurVariation(T weight = 1.0) : Variation("blur", VAR_BLUR, weight) { } + BlurVariation(T weight = 1.0) : Variation("blur", eVariationId::VAR_BLUR, weight) { } VARCOPY(BlurVariation) @@ -1926,7 +1816,6 @@ public: { T tempr = rand.Frand01() * M_2PI; T r = m_Weight * rand.Frand01(); - helper.Out.x = r * std::cos(tempr); helper.Out.y = r * std::sin(tempr); helper.Out.z = m_Weight * helper.In.z; @@ -1936,7 +1825,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t tmpr = MwcNext01(mwc) * M_2PI;\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * MwcNext01(mwc);\n" @@ -1945,7 +1833,6 @@ public: << "\t\tvOut.y = r * sin(tmpr);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -1957,7 +1844,7 @@ template class EMBER_API GaussianBlurVariation : public Variation { public: - GaussianBlurVariation(T weight = 1.0) : Variation("gaussian_blur", VAR_GAUSSIAN_BLUR, weight) { } + GaussianBlurVariation(T weight = 1.0) : Variation("gaussian_blur", eVariationId::VAR_GAUSSIAN_BLUR, weight) { } VARCOPY(GaussianBlurVariation) @@ -1965,7 +1852,6 @@ public: { T angle = rand.Frand01() * M_2PI; T r = m_Weight * (rand.Frand01() + rand.Frand01() + rand.Frand01() + rand.Frand01() - 2); - helper.Out.x = r * std::cos(angle); helper.Out.y = r * std::sin(angle); helper.Out.z = m_Weight * helper.In.z; @@ -1975,7 +1861,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t angle = MwcNext01(mwc) * M_2PI;\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) - (real_t)(2.0));\n" @@ -1984,7 +1869,6 @@ public: << "\t\tvOut.y = r * sin(angle);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -1996,7 +1880,7 @@ template class EMBER_API RadialBlurVariation : public ParametricVariation { public: - RadialBlurVariation(T weight = 1.0) : ParametricVariation("radial_blur", VAR_RADIAL_BLUR, weight, true, true, false, false, true) + RadialBlurVariation(T weight = 1.0) : ParametricVariation("radial_blur", eVariationId::VAR_RADIAL_BLUR, weight, true, true, false, false, true) { Init(); } @@ -2007,13 +1891,11 @@ public: { //Get pseudo-gaussian. T rndG = m_Weight * (rand.Frand01() + rand.Frand01() - + rand.Frand01() + rand.Frand01() - 2); - + + rand.Frand01() + rand.Frand01() - 2); //Calculate angle & zoom. T ra = helper.m_PrecalcSqrtSumSquares; T tempa = helper.m_PrecalcAtanyx + m_Spin * rndG; T rz = m_Zoom * rndG - 1; - helper.Out.x = ra * std::cos(tempa) + rz * helper.In.x; helper.Out.y = ra * std::sin(tempa) + rz * helper.In.y; helper.Out.z = m_Weight * helper.In.z; @@ -2028,18 +1910,16 @@ public: string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Params. string spin = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc. string zoom = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t rndG = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) + MwcNext01(mwc) - (real_t)(2.0));\n" << "\t\treal_t ra = precalcSqrtSumSquares;\n" - << "\t\treal_t tempa = precalcAtanyx + "<< spin << " * rndG;\n" + << "\t\treal_t tempa = precalcAtanyx + " << spin << " * rndG;\n" << "\t\treal_t rz = " << zoom << " * rndG - 1;\n" << "\n" << "\t\tvOut.x = ra * cos(tempa) + rz * vIn.x;\n" << "\t\tvOut.y = ra * sin(tempa) + rz * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2057,7 +1937,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Angle, prefix + "radial_blur_angle"));//Params. m_Params.push_back(ParamWithName(true, &m_Spin, prefix + "radial_blur_spin"));//Precalc. @@ -2077,7 +1956,7 @@ template class EMBER_API PieVariation : public ParametricVariation { public: - PieVariation(T weight = 1.0) : ParametricVariation("pie", VAR_PIE, weight) + PieVariation(T weight = 1.0) : ParametricVariation("pie", eVariationId::VAR_PIE, weight) { Init(); } @@ -2089,7 +1968,6 @@ public: int sl = int(rand.Frand01() * m_Slices + T(0.5)); T a = m_Rotation + M_2PI * (sl + rand.Frand01() * m_Thickness) / m_Slices; T r = m_Weight * rand.Frand01(); - helper.Out.x = r * std::cos(a); helper.Out.y = r * std::sin(a); } @@ -2103,7 +1981,6 @@ public: string slices = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rotation = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string thickness = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tint sl = (int)(MwcNext01(mwc) * " << slices << " + (real_t)(0.5));\n" << "\t\treal_t a = " << rotation << " + M_2PI * (sl + MwcNext01(mwc) * " << thickness << ") / " << slices << ";\n" @@ -2113,7 +1990,6 @@ public: << "\t\tvOut.y = r * sin(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2128,11 +2004,10 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Slices, prefix + "pie_slices", 6, INTEGER_NONZERO, 1)); - m_Params.push_back(ParamWithName(&m_Rotation, prefix + "pie_rotation", T(0.5), REAL_CYCLIC, 0, M_2PI)); - m_Params.push_back(ParamWithName(&m_Thickness, prefix + "pie_thickness", T(0.5), REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Slices, prefix + "pie_slices", 6, eParamType::INTEGER_NONZERO, 1)); + m_Params.push_back(ParamWithName(&m_Rotation, prefix + "pie_rotation", T(0.5), eParamType::REAL_CYCLIC, 0, M_2PI)); + m_Params.push_back(ParamWithName(&m_Thickness, prefix + "pie_thickness", T(0.5), eParamType::REAL, 0, 1)); } private: @@ -2148,7 +2023,7 @@ template class EMBER_API NgonVariation : public ParametricVariation { public: - NgonVariation(T weight = 1.0) : ParametricVariation("ngon", VAR_NGON, weight, true, false, false, false, true) + NgonVariation(T weight = 1.0) : ParametricVariation("ngon", eVariationId::VAR_NGON, weight, true, false, false, false, true) { Init(); } @@ -2170,7 +2045,6 @@ public: phi -= m_CSides; T amp = (m_Corners * (1 / std::cos(phi) - 1) + m_Circle) * m_Weight * rFactor; - helper.Out.x = amp * helper.In.x; helper.Out.y = amp * helper.In.y; helper.Out.z = m_Weight * helper.In.z; @@ -2189,7 +2063,6 @@ public: string csides = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string csidesinv = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string cpower = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t rFactor;\n" << "\n" @@ -2209,7 +2082,6 @@ public: << "\t\tvOut.y = amp * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2232,9 +2104,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Sides, prefix + "ngon_sides", 5, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Sides, prefix + "ngon_sides", 5, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(&m_Power, prefix + "ngon_power", 3)); m_Params.push_back(ParamWithName(&m_Circle, prefix + "ngon_circle", 1)); m_Params.push_back(ParamWithName(&m_Corners, prefix + "ngon_corners", 2)); @@ -2263,7 +2134,7 @@ template class EMBER_API CurlVariation : public ParametricVariation { public: - CurlVariation(T weight = 1.0) : ParametricVariation("curl", VAR_CURL, weight) + CurlVariation(T weight = 1.0) : ParametricVariation("curl", eVariationId::VAR_CURL, weight) { Init(); } @@ -2275,7 +2146,6 @@ public: T re = 1 + m_C1 * helper.In.x + m_C2 * (SQR(helper.In.x) - SQR(helper.In.y)); T im = m_C1 * helper.In.y + m_C22 * helper.In.x * helper.In.y; T r = m_Weight / Zeps(SQR(re) + SQR(im)); - helper.Out.x = (helper.In.x * re + helper.In.y * im) * r; helper.Out.y = (helper.In.y * re - helper.In.x * im) * r; helper.Out.z = m_Weight * helper.In.z; @@ -2290,7 +2160,6 @@ public: string c1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string c22 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t re = (real_t)(1.0) + " << c1 << " * vIn.x + " << c2 << " * (SQR(vIn.x) - SQR(vIn.y));\n" << "\t\treal_t im = " << c1 << " * vIn.y + " << c22 << " * vIn.x * vIn.y;\n" @@ -2300,7 +2169,6 @@ public: << "\t\tvOut.y = (vIn.y * re - vIn.x * im) * r;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2324,7 +2192,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_C1, prefix + "curl_c1", 1)); m_Params.push_back(ParamWithName(&m_C2, prefix + "curl_c2")); @@ -2344,7 +2211,7 @@ template class EMBER_API RectanglesVariation : public ParametricVariation { public: - RectanglesVariation(T weight = 1.0) : ParametricVariation("rectangles", VAR_RECTANGLES, weight) + RectanglesVariation(T weight = 1.0) : ParametricVariation("rectangles", eVariationId::VAR_RECTANGLES, weight) { Init(); } @@ -2374,7 +2241,6 @@ public: string index = ss2.str(); string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tif (" << x << " == 0)\n" << "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n" @@ -2388,7 +2254,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2402,7 +2267,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "rectangles_x", 1)); m_Params.push_back(ParamWithName(&m_Y, prefix + "rectangles_y", 1)); @@ -2420,7 +2284,7 @@ template class EMBER_API ArchVariation : public Variation { public: - ArchVariation(T weight = 1.0) : Variation("arch", VAR_ARCH, weight) { } + ArchVariation(T weight = 1.0) : Variation("arch", eVariationId::VAR_ARCH, weight) { } VARCOPY(ArchVariation) @@ -2428,7 +2292,6 @@ public: { T angle = rand.Frand01() * m_Weight * T(M_PI); T sinr, cosr; - sincos(angle, &sinr, &cosr); helper.Out.x = m_Weight * sinr; helper.Out.y = m_Weight * (sinr * sinr) / cosr; @@ -2439,7 +2302,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t angle = MwcNext01(mwc) * xform->m_VariationWeights[" << varIndex << "] * M_PI;\n" << "\t\treal_t sinr = sin(angle);\n" @@ -2449,7 +2311,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (sinr * sinr) / cosr;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -2461,7 +2322,7 @@ template class EMBER_API TangentVariation : public Variation { public: - TangentVariation(T weight = 1.0) : Variation("tangent", VAR_TANGENT, weight) { } + TangentVariation(T weight = 1.0) : Variation("tangent", eVariationId::VAR_TANGENT, weight) { } VARCOPY(TangentVariation) @@ -2476,13 +2337,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) / cos(vIn.y);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * tan(vIn.y);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -2494,7 +2353,7 @@ template class EMBER_API SquareVariation : public Variation { public: - SquareVariation(T weight = 1.0) : Variation("square", VAR_SQUARE, weight) { } + SquareVariation(T weight = 1.0) : Variation("square", eVariationId::VAR_SQUARE, weight) { } VARCOPY(SquareVariation) @@ -2509,13 +2368,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) - (real_t)(0.5));\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) - (real_t)(0.5));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -2527,7 +2384,7 @@ template class EMBER_API RaysVariation : public Variation { public: - RaysVariation(T weight = 1.0) : Variation("rays", VAR_RAYS, weight, true) { } + RaysVariation(T weight = 1.0) : Variation("rays", eVariationId::VAR_RAYS, weight, true) { } VARCOPY(RaysVariation) @@ -2536,7 +2393,6 @@ public: T ang = m_Weight * rand.Frand01() * T(M_PI); T r = m_Weight / Zeps(helper.m_PrecalcSumSquares); T tanr = m_Weight * SafeTan(ang) * r; - helper.Out.x = tanr * std::cos(helper.In.x); helper.Out.y = tanr * std::sin(helper.In.y); helper.Out.z = m_Weight * helper.In.z; @@ -2546,7 +2402,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t ang = xform->m_VariationWeights[" << varIndex << "] * MwcNext01(mwc) * M_PI;\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares);\n" @@ -2556,7 +2411,6 @@ public: << "\t\tvOut.y = tanr * sin(vIn.y);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2573,7 +2427,7 @@ template class EMBER_API BladeVariation : public Variation { public: - BladeVariation(T weight = 1.0) : Variation("blade", VAR_BLADE, weight, true, true) { } + BladeVariation(T weight = 1.0) : Variation("blade", eVariationId::VAR_BLADE, weight, true, true) { } VARCOPY(BladeVariation) @@ -2581,18 +2435,16 @@ public: { T r = rand.Frand01() * m_Weight * helper.m_PrecalcSqrtSumSquares; T sinr, cosr; - sincos(r, &sinr, &cosr); helper.Out.x = m_Weight * helper.In.x * (cosr + sinr); helper.Out.y = m_Weight * helper.In.x * (cosr - sinr); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = MwcNext01(mwc) * xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares;\n" << "\t\treal_t sinr = sin(r);\n" @@ -2600,9 +2452,8 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x * (cosr + sinr);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.x * (cosr - sinr);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; - return ss.str(); } }; @@ -2614,7 +2465,7 @@ template class EMBER_API Secant2Variation : public Variation { public: - Secant2Variation(T weight = 1.0) : Variation("secant2", VAR_SECANT2, weight, true, true) { } + Secant2Variation(T weight = 1.0) : Variation("secant2", eVariationId::VAR_SECANT2, weight, true, true) { } VARCOPY(Secant2Variation) @@ -2623,7 +2474,6 @@ public: T r = m_Weight * helper.m_PrecalcSqrtSumSquares; T cr = std::cos(r); T icr = 1 / cr; - helper.Out.x = m_Weight * helper.In.x; if (cr < 0) @@ -2638,7 +2488,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares;\n" << "\t\treal_t cr = cos(r);\n" @@ -2653,7 +2502,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -2665,7 +2513,7 @@ template class EMBER_API TwinTrianVariation : public Variation { public: - TwinTrianVariation(T weight = 1.0) : Variation("TwinTrian", VAR_TWINTRIAN, weight, true, true) { } + TwinTrianVariation(T weight = 1.0) : Variation("TwinTrian", eVariationId::VAR_TWINTRIAN, weight, true, true) { } VARCOPY(TwinTrianVariation) @@ -2673,7 +2521,6 @@ public: { T r = rand.Frand01() * m_Weight * helper.m_PrecalcSqrtSumSquares; T sinr, cosr, diff; - sincos(r, &sinr, &cosr); diff = std::log10(sinr * sinr) + cosr; @@ -2689,7 +2536,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = MwcNext01(mwc) * xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares;\n" << "\t\treal_t sinr = sin(r);\n" @@ -2703,7 +2549,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.x * (diff - sinr * M_PI);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -2715,14 +2560,13 @@ template class EMBER_API CrossVariation : public Variation { public: - CrossVariation(T weight = 1.0) : Variation("cross", VAR_CROSS, weight) { } + CrossVariation(T weight = 1.0) : Variation("cross", eVariationId::VAR_CROSS, weight) { } VARCOPY(CrossVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = m_Weight / Zeps(fabs((helper.In.x - helper.In.y) * (helper.In.x + helper.In.y))); - helper.Out.x = helper.In.x * r; helper.Out.y = helper.In.y * r; helper.Out.z = m_Weight * helper.In.z; @@ -2732,7 +2576,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] /Zeps(fabs((vIn.x - vIn.y) * (vIn.x + vIn.y)));\n" << "\n" @@ -2740,7 +2583,6 @@ public: << "\t\tvOut.y = vIn.y * r;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2757,7 +2599,7 @@ template class EMBER_API Disc2Variation : public ParametricVariation { public: - Disc2Variation(T weight = 1.0) : ParametricVariation("disc2", VAR_DISC2, weight, false, false, false, true) + Disc2Variation(T weight = 1.0) : ParametricVariation("disc2", eVariationId::VAR_DISC2, weight, false, false, false, true) { Init(); } @@ -2767,7 +2609,6 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r, t, sinr, cosr; - t = m_RotTimesPi * (helper.In.x + helper.In.y); sincos(t, &sinr, &cosr); r = m_Weight * helper.m_PrecalcAtanxy / T(M_PI); @@ -2787,7 +2628,6 @@ public: string sinAdd = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc. string cosAdd = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rotTimesPi = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t t = " << rotTimesPi << " * (vIn.x + vIn.y);\n" << "\t\treal_t sinr = sin(t);\n" @@ -2798,14 +2638,12 @@ public: << "\t\tvOut.y = (cosr + " << sinAdd << ") * r;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } virtual void Precalc() override { T k, add = m_Twist; - m_RotTimesPi = m_Rot * T(M_PI); sincos(add, &m_SinAdd, &m_CosAdd); m_CosAdd -= 1; @@ -2835,7 +2673,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Rot, prefix + "disc2_rot"));//Params. m_Params.push_back(ParamWithName(&m_Twist, prefix + "disc2_twist")); @@ -2859,7 +2696,7 @@ template class EMBER_API SuperShapeVariation : public ParametricVariation { public: - SuperShapeVariation(T weight = 1.0) : ParametricVariation("super_shape", VAR_SUPER_SHAPE, weight, true, true, false, false, true) + SuperShapeVariation(T weight = 1.0) : ParametricVariation("super_shape", eVariationId::VAR_SUPER_SHAPE, weight, true, true, false, false, true) { Init(); } @@ -2869,16 +2706,12 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T theta = m_Pm4 * helper.m_PrecalcAtanyx + T(M_PI_4); - T t1 = fabs(std::cos(theta)); t1 = std::pow(t1, m_N2); - T t2 = fabs(std::sin(theta)); t2 = std::pow(t2, m_N3); - T r = m_Weight * ((m_Rnd * rand.Frand01() + (1 - m_Rnd) * helper.m_PrecalcSqrtSumSquares) - m_Holes) - * std::pow(t1 + t2, m_PNeg1N1) / helper.m_PrecalcSqrtSumSquares; - + * std::pow(t1 + t2, m_PNeg1N1) / helper.m_PrecalcSqrtSumSquares; helper.Out.x = r * helper.In.x; helper.Out.y = r * helper.In.y; helper.Out.z = m_Weight * helper.In.z; @@ -2898,7 +2731,6 @@ public: string holes = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string pm4 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc. string pNeg1N1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t theta = " << pm4 << " * precalcAtanyx + M_PI_4;\n" << "\t\treal_t t1 = fabs(cos(theta));\n" @@ -2911,7 +2743,6 @@ public: << "\t\tvOut.y = r * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2935,7 +2766,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_M, prefix + "super_shape_m"));//Params. m_Params.push_back(ParamWithName(&m_N1, prefix + "super_shape_n1", 1)); @@ -2965,7 +2795,7 @@ template class EMBER_API FlowerVariation : public ParametricVariation { public: - FlowerVariation(T weight = 1.0) : ParametricVariation("flower", VAR_FLOWER, weight, true, true, false, false, true) + FlowerVariation(T weight = 1.0) : ParametricVariation("flower", eVariationId::VAR_FLOWER, weight, true, true, false, false, true) { Init(); } @@ -2976,7 +2806,6 @@ public: { T theta = helper.m_PrecalcAtanyx; T r = m_Weight * (rand.Frand01() - m_Holes) * std::cos(m_Petals * theta) / helper.m_PrecalcSqrtSumSquares; - helper.Out.x = r * helper.In.x; helper.Out.y = r * helper.In.y; helper.Out.z = m_Weight * helper.In.z; @@ -2990,7 +2819,6 @@ public: string index = ss2.str(); string petals = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string holes = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t theta = precalcAtanyx;\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) - " << holes << ") * cos(" << petals << " * theta) / precalcSqrtSumSquares;\n" @@ -2999,7 +2827,6 @@ public: << "\t\tvOut.y = r * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3013,7 +2840,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Petals, prefix + "flower_petals")); m_Params.push_back(ParamWithName(&m_Holes, prefix + "flower_holes")); @@ -3031,7 +2857,7 @@ template class EMBER_API ConicVariation : public ParametricVariation { public: - ConicVariation(T weight = 1.0) : ParametricVariation("conic", VAR_CONIC, weight, true, true) + ConicVariation(T weight = 1.0) : ParametricVariation("conic", eVariationId::VAR_CONIC, weight, true, true) { Init(); } @@ -3042,8 +2868,7 @@ public: { T ct = helper.In.x / helper.m_PrecalcSqrtSumSquares; T r = m_Weight * (rand.Frand01() - m_Holes) * - m_Eccentricity / (1 + m_Eccentricity * ct) / helper.m_PrecalcSqrtSumSquares; - + m_Eccentricity / (1 + m_Eccentricity * ct) / helper.m_PrecalcSqrtSumSquares; helper.Out.x = r * helper.In.x; helper.Out.y = r * helper.In.y; helper.Out.z = m_Weight * helper.In.z; @@ -3057,7 +2882,6 @@ public: string index = ss2.str(); string eccentricity = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string holes = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t ct = vIn.x / precalcSqrtSumSquares;\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * (MwcNext01(mwc) - " << holes << ") * " << eccentricity << " / (1 + " << eccentricity << " * ct) / precalcSqrtSumSquares;\n" @@ -3066,7 +2890,6 @@ public: << "\t\tvOut.y = r * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3080,7 +2903,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Eccentricity, prefix + "conic_eccentricity", 1)); m_Params.push_back(ParamWithName(&m_Holes, prefix + "conic_holes")); @@ -3098,7 +2920,7 @@ template class EMBER_API ParabolaVariation : public ParametricVariation { public: - ParabolaVariation(T weight = 1.0) : ParametricVariation("parabola", VAR_PARABOLA, weight, true, true) + ParabolaVariation(T weight = 1.0) : ParametricVariation("parabola", eVariationId::VAR_PARABOLA, weight, true, true) { Init(); } @@ -3108,7 +2930,6 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T sr, cr; - sincos(helper.m_PrecalcSqrtSumSquares, &sr, &cr); helper.Out.x = m_Height * m_Weight * sr * sr * rand.Frand01(); helper.Out.y = m_Width * m_Weight * cr * rand.Frand01(); @@ -3123,7 +2944,6 @@ public: string index = ss2.str(); string height = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string width = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t sr = sin(precalcSqrtSumSquares);\n" << "\t\treal_t cr = cos(precalcSqrtSumSquares);\n" @@ -3132,7 +2952,6 @@ public: << "\t\tvOut.y = " << width << " * (xform->m_VariationWeights[" << varIndex << "] * cr * MwcNext01(mwc));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3146,7 +2965,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Height, prefix + "parabola_height")); m_Params.push_back(ParamWithName(&m_Width, prefix + "parabola_width")); @@ -3164,7 +2982,7 @@ template class EMBER_API Bent2Variation : public ParametricVariation { public: - Bent2Variation(T weight = 1.0) : ParametricVariation("bent2", VAR_BENT2, weight) + Bent2Variation(T weight = 1.0) : ParametricVariation("bent2", eVariationId::VAR_BENT2, weight) { Init(); } @@ -3196,7 +3014,6 @@ public: string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string vx = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string vy = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tif (vIn.x >= 0)\n" << "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n" @@ -3210,7 +3027,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3230,7 +3046,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "bent2_x", 1));//Params. m_Params.push_back(ParamWithName(&m_Y, prefix + "bent2_y", 1)); @@ -3252,7 +3067,7 @@ template class EMBER_API BipolarVariation : public ParametricVariation { public: - BipolarVariation(T weight = 1.0) : ParametricVariation("bipolar", VAR_BIPOLAR, weight, true) + BipolarVariation(T weight = 1.0) : ParametricVariation("bipolar", eVariationId::VAR_BIPOLAR, weight, true) { Init(); } @@ -3276,7 +3091,7 @@ public: if ((g == 0) || (f / g <= 0)) { - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.x = 0; helper.Out.y = 0; @@ -3307,7 +3122,6 @@ public: string s = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string v = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string v4 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t x2y2 = precalcSumSquares;\n" << "\t\treal_t t = x2y2 + 1;\n" @@ -3324,7 +3138,7 @@ public: << "\t\treal_t g = t - x2;\n" << "\n"; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tif ((g == 0) || (f / g <= 0))\n" << "\t\t{\n" @@ -3350,7 +3164,6 @@ public: << "\t\t vOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t\t}\n" << "\t}\n"; - return ss.str(); } @@ -3371,7 +3184,6 @@ public: if (!_stricmp(name, "bipolar_shift")) { T temp = Fabsmod(T(0.5) * (val + 1)); - m_Shift = 2 * temp - 1; Precalc(); return true; @@ -3384,7 +3196,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Shift, prefix + "bipolar_shift"));//Params. m_Params.push_back(ParamWithName(true, &m_S, prefix + "bipolar_s"));//Precalc. @@ -3406,7 +3217,7 @@ template class EMBER_API BoardersVariation : public Variation { public: - BoardersVariation(T weight = 1.0) : Variation("boarders", VAR_BOARDERS, weight) { } + BoardersVariation(T weight = 1.0) : Variation("boarders", eVariationId::VAR_BOARDERS, weight) { } VARCOPY(BoardersVariation) @@ -3459,7 +3270,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t roundX = Rint(vIn.x);\n" << "\t\treal_t roundY = Rint(vIn.y);\n" @@ -3503,7 +3313,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -3515,7 +3324,7 @@ template class EMBER_API ButterflyVariation : public Variation { public: - ButterflyVariation(T weight = 1.0) : Variation("butterfly", VAR_BUTTERFLY, weight) { } + ButterflyVariation(T weight = 1.0) : Variation("butterfly", eVariationId::VAR_BUTTERFLY, weight) { } VARCOPY(ButterflyVariation) @@ -3524,7 +3333,6 @@ public: T wx = m_Weight * T(1.3029400317411197908970256609023);//This precision came from the original. T y2 = helper.In.y * 2; T r = wx * std::sqrt(fabs(helper.In.y * helper.In.x) / Zeps(SQR(helper.In.x) + SQR(y2))); - helper.Out.x = r * helper.In.x; helper.Out.y = r * y2; helper.Out.z = m_Weight * helper.In.z; @@ -3534,7 +3342,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t wx = xform->m_VariationWeights[" << varIndex << "] * (real_t)(1.3029400317411197908970256609023);\n" << "\t\treal_t y2 = vIn.y * (real_t)(2.0);\n" @@ -3544,7 +3351,6 @@ public: << "\t\tvOut.y = r * y2;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3561,7 +3367,7 @@ template class EMBER_API CellVariation : public ParametricVariation { public: - CellVariation(T weight = 1.0) : ParametricVariation("cell", VAR_CELL, weight) + CellVariation(T weight = 1.0) : ParametricVariation("cell", eVariationId::VAR_CELL, weight) { Init(); } @@ -3622,13 +3428,11 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string size = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t invCellSize = (real_t)(1.0) / " << size << ";\n" //Float to int, orig. //<< "\t\tint x = (int)floor(vIn.x * invCellSize);\n" //<< "\t\tint y = (int)floor(vIn.y * invCellSize);\n" - //For some reason, OpenCL renders nothing if these are ints, so use floats. //Note that Cuburn also omits the usage of ints. << "\t\treal_t x = floor(vIn.x * invCellSize);\n" @@ -3667,7 +3471,6 @@ public: << "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * (dy + y * " << size << "));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3680,7 +3483,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Size, prefix + "cell_size", 1)); } @@ -3696,7 +3498,7 @@ template class EMBER_API CpowVariation : public ParametricVariation { public: - CpowVariation(T weight = 1.0) : ParametricVariation("cpow", VAR_CPOW, weight, true, false, false, false, true) + CpowVariation(T weight = 1.0) : ParametricVariation("cpow", eVariationId::VAR_CPOW, weight, true, false, false, false, true) { Init(); } @@ -3709,7 +3511,6 @@ public: T lnr = T(0.5) * std::log(helper.m_PrecalcSumSquares); T angle = m_C * a + m_D * lnr + m_Ang * Floor(m_Power * rand.Frand01()); T m = m_Weight * std::exp(m_C * lnr - m_D * a); - helper.Out.x = m * std::cos(angle); helper.Out.y = m * std::sin(angle); helper.Out.z = m_Weight * helper.In.z; @@ -3727,7 +3528,6 @@ public: string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string d = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string ang = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t a = precalcAtanyx;\n" << "\t\treal_t lnr = (real_t)(0.5) * log(precalcSumSquares);\n" @@ -3738,7 +3538,6 @@ public: << "\t\tvOut.y = m * sin(angle);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3760,11 +3559,10 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_PowerR, prefix + "cpow_r", 1));//Params. m_Params.push_back(ParamWithName(&m_PowerI, prefix + "cpow_i")); - m_Params.push_back(ParamWithName(&m_Power, prefix + "cpow_power", 1, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "cpow_power", 1, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(true, &m_C, prefix + "cpow_c"));//Precalc. m_Params.push_back(ParamWithName(true, &m_D, prefix + "cpow_d")); m_Params.push_back(ParamWithName(true, &m_Ang, prefix + "cpow_ang")); @@ -3786,7 +3584,7 @@ template class EMBER_API CurveVariation : public ParametricVariation { public: - CurveVariation(T weight = 1.0) : ParametricVariation("curve", VAR_CURVE, weight) + CurveVariation(T weight = 1.0) : ParametricVariation("curve", eVariationId::VAR_CURVE, weight) { Init(); } @@ -3814,13 +3612,11 @@ public: string yAmpV = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string xLengthV = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string yLengthV = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x + " << xAmpV << " * exp(-vIn.y * vIn.y * " << xLengthV << ");\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y + " << yAmpV << " * exp(-vIn.x * vIn.x * " << yLengthV << ");\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3844,7 +3640,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_XAmp, prefix + "curve_xamp"));//Params. m_Params.push_back(ParamWithName(&m_YAmp, prefix + "curve_yamp")); @@ -3874,7 +3669,7 @@ template class EMBER_API EdiscVariation : public Variation { public: - EdiscVariation(T weight = 1.0) : Variation("edisc", VAR_EDISC, weight, true) { } + EdiscVariation(T weight = 1.0) : Variation("edisc", eVariationId::VAR_EDISC, weight, true) { } VARCOPY(EdiscVariation) @@ -3889,9 +3684,7 @@ public: T a2 = -std::acos(Clamp(helper.In.x / xmax, -1, 1)); T w = m_Weight / T(11.57034632);//This is an interesting magic number. T snv, csv, snhu, cshu; - sincos(a1, &snv, &csv); - snhu = sinh(a2); cshu = cosh(a2); @@ -3907,7 +3700,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t tmp = precalcSumSquares + (real_t)(1.0);\n" << "\t\treal_t tmp2 = (real_t)(2.0) * vIn.x;\n" @@ -3921,15 +3713,12 @@ public: << "\t\treal_t csv = cos(a1);\n" << "\t\treal_t snhu = sinh(a2);\n" << "\t\treal_t cshu = cosh(a2);\n" - << "\t\tif (vIn.y > 0)\n" << "\t\t snv = -snv;\n" - << "\t\tvOut.x = w * cshu * csv;\n" << "\t\tvOut.y = w * snhu * snv;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -3941,7 +3730,7 @@ template class EMBER_API EllipticVariation : public ParametricVariation { public: - EllipticVariation(T weight = 1.0) : ParametricVariation("elliptic", VAR_ELLIPTIC, weight, true) + EllipticVariation(T weight = 1.0) : ParametricVariation("elliptic", eVariationId::VAR_ELLIPTIC, weight, true) { Init(); } @@ -3985,7 +3774,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string weightDivPiDiv2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tmp = precalcSumSquares + (real_t)(1.0);\n" << "\t\treal_t x2 = (real_t)(2.0) * vIn.x;\n" @@ -4014,7 +3802,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4027,7 +3814,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(true, &m_WeightDivPiDiv2, prefix + "elliptic_weight_div_pi_div_2"));//Precalc. } @@ -4043,7 +3829,7 @@ template class EMBER_API EscherVariation : public ParametricVariation { public: - EscherVariation(T weight = 1.0) : ParametricVariation("escher", VAR_ESCHER, weight, true, false, false, false, true) + EscherVariation(T weight = 1.0) : ParametricVariation("escher", eVariationId::VAR_ESCHER, weight, true, false, false, false, true) { Init(); } @@ -4056,7 +3842,6 @@ public: T lnr = T(0.5) * std::log(helper.m_PrecalcSumSquares); T m = m_Weight * std::exp(m_C * lnr - m_D * a); T n = m_C * a + m_D * lnr; - helper.Out.x = m * std::cos(n); helper.Out.y = m * std::sin(n); helper.Out.z = m_Weight * helper.In.z; @@ -4071,7 +3856,6 @@ public: string beta = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string d = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t a = precalcAtanyx;\n" << "\t\treal_t lnr = (real_t)(0.5) * log(precalcSumSquares);\n" @@ -4082,7 +3866,6 @@ public: << "\t\tvOut.y = m * sin(n);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4114,7 +3897,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Beta, prefix + "escher_beta"));//Params. m_Params.push_back(ParamWithName(true, &m_C, prefix + "escher_beta_c"));//Precalc. @@ -4134,7 +3916,7 @@ template class EMBER_API FociVariation : public Variation { public: - FociVariation(T weight = 1.0) : Variation("foci", VAR_FOCI, weight) { } + FociVariation(T weight = 1.0) : Variation("foci", eVariationId::VAR_FOCI, weight) { } VARCOPY(FociVariation) @@ -4143,11 +3925,8 @@ public: T expx = std::exp(helper.In.x) * T(0.5); T expnx = T(0.25) / expx; T sn, cn, tmp; - sincos(helper.In.y, &sn, &cn); - tmp = m_Weight / Zeps(expx + expnx - cn); - helper.Out.x = tmp * (expx - expnx); helper.Out.y = tmp * sn; helper.Out.z = m_Weight * helper.In.z; @@ -4157,7 +3936,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t expx = exp(vIn.x) * (real_t)(0.5);\n" << "\t\treal_t expnx = (real_t)(0.25) / expx;\n" @@ -4171,7 +3949,6 @@ public: << "\t\tvOut.y = tmp * sn;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4188,7 +3965,7 @@ template class EMBER_API LazySusanVariation : public ParametricVariation { public: - LazySusanVariation(T weight = 1.0) : ParametricVariation("lazysusan", VAR_LAZYSUSAN, weight) + LazySusanVariation(T weight = 1.0) : ParametricVariation("lazysusan", eVariationId::VAR_LAZYSUSAN, weight) { Init(); } @@ -4204,14 +3981,12 @@ public: if (r < m_Weight) { T a = atan2(y, x) + m_Spin + m_Twist * (m_Weight - r); - helper.Out.x = m_Weight * (r * std::cos(a) + m_X);//Fix to make it colapse to 0 when weight is 0.//SMOULDER helper.Out.y = m_Weight * (r * std::sin(a) - m_Y); } else { r = 1 + m_Space / Zeps(r); - helper.Out.x = m_Weight * (r * x + m_X);//Fix to make it colapse to 0 when weight is 0.//SMOULDER helper.Out.y = m_Weight * (r * y - m_Y); } @@ -4230,7 +4005,6 @@ public: string twist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t x = vIn.x - " << x << ";\n" << "\t\treal_t y = vIn.y + " << y << ";\n" @@ -4253,7 +4027,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4287,7 +4060,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Spin, prefix + "lazysusan_spin", T(M_PI))); m_Params.push_back(ParamWithName(&m_Space, prefix + "lazysusan_space")); @@ -4311,7 +4083,7 @@ template class EMBER_API LoonieVariation : public ParametricVariation { public: - LoonieVariation(T weight = 1.0) : ParametricVariation("loonie", VAR_LOONIE, weight, true) + LoonieVariation(T weight = 1.0) : ParametricVariation("loonie", eVariationId::VAR_LOONIE, weight, true) { Init(); } @@ -4323,7 +4095,6 @@ public: if (helper.m_PrecalcSumSquares < m_W2 && helper.m_PrecalcSumSquares != 0) { T r = m_Weight * std::sqrt((m_W2 / helper.m_PrecalcSumSquares) - 1); - helper.Out.x = r * helper.In.x; helper.Out.y = r * helper.In.y; } @@ -4343,7 +4114,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string w2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tif (precalcSumSquares < " << w2 << " && precalcSumSquares != 0)\n" << "\t\t{\n" @@ -4359,7 +4129,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4372,7 +4141,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(true, &m_W2, prefix + "loonie_w2"));//Precalc. } @@ -4388,7 +4156,7 @@ template class EMBER_API ModulusVariation : public ParametricVariation { public: - ModulusVariation(T weight = 1.0) : ParametricVariation("modulus", VAR_MODULUS, weight) + ModulusVariation(T weight = 1.0) : ParametricVariation("modulus", eVariationId::VAR_MODULUS, weight) { Init(); } @@ -4424,7 +4192,6 @@ public: string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string xr = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string yr = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tif (vIn.x > " << x << ")\n" << "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (-" << x << " + fmod(vIn.x + " << x << ", " << xr << "));\n" @@ -4442,7 +4209,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4462,7 +4228,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "modulus_x", 1));//Params. m_Params.push_back(ParamWithName(&m_Y, prefix + "modulus_y", 1)); @@ -4484,7 +4249,7 @@ template class EMBER_API OscilloscopeVariation : public ParametricVariation { public: - OscilloscopeVariation(T weight = 1.0) : ParametricVariation("oscilloscope", VAR_OSCILLOSCOPE, weight) + OscilloscopeVariation(T weight = 1.0) : ParametricVariation("oscilloscope", eVariationId::VAR_OSCILLOSCOPE, weight) { Init(); } @@ -4525,7 +4290,6 @@ public: string amplitude = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string damping = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string tpf = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t t;\n" << "\n" @@ -4547,7 +4311,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4568,7 +4331,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Separation, prefix + "oscilloscope_separation", 1));//Params. m_Params.push_back(ParamWithName(&m_Frequency, prefix + "oscilloscope_frequency", T(M_PI))); @@ -4592,7 +4354,7 @@ template class EMBER_API Polar2Variation : public ParametricVariation { public: - Polar2Variation(T weight = 1.0) : ParametricVariation("polar2", VAR_POLAR2, weight, true, false, false, true) + Polar2Variation(T weight = 1.0) : ParametricVariation("polar2", eVariationId::VAR_POLAR2, weight, true, false, false, true) { Init(); } @@ -4614,13 +4376,11 @@ public: string index = ss2.str(); string vvar = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string vvar2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tvOut.x = " << vvar << " * precalcAtanxy;\n" << "\t\tvOut.y = " << vvar2 << " * log(precalcSumSquares);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4634,7 +4394,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(true, &m_Vvar, prefix + "polar2_vvar"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Vvar2, prefix + "polar2_vvar2")); @@ -4652,7 +4411,7 @@ template class EMBER_API Popcorn2Variation : public ParametricVariation { public: - Popcorn2Variation(T weight = 1.0) : ParametricVariation("popcorn2", VAR_POPCORN2, weight) + Popcorn2Variation(T weight = 1.0) : ParametricVariation("popcorn2", eVariationId::VAR_POPCORN2, weight) { Init(); } @@ -4675,13 +4434,11 @@ public: string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + " << x << " * sin(tan(vIn.y * " << c << ")));\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + " << y << " * sin(tan(vIn.x * " << c << ")));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4696,7 +4453,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "popcorn2_x", T(0.1))); m_Params.push_back(ParamWithName(&m_Y, prefix + "popcorn2_y", T(0.1))); @@ -4719,7 +4475,7 @@ template class EMBER_API ScryVariation : public ParametricVariation { public: - ScryVariation(T weight = 1.0) : ParametricVariation("scry", VAR_SCRY, weight, true, true) + ScryVariation(T weight = 1.0) : ParametricVariation("scry", eVariationId::VAR_SCRY, weight, true, true) { Init(); } @@ -4730,10 +4486,9 @@ public: { T t = helper.m_PrecalcSumSquares; T r = 1 / Zeps(helper.m_PrecalcSqrtSumSquares * (t + m_InvWeight)); - helper.Out.x = helper.In.x * r; helper.Out.y = helper.In.y * r; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -4743,16 +4498,14 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string invWeight = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t t = precalcSumSquares;\n" << "\t\treal_t r = (real_t)(1.0) / Zeps(precalcSqrtSumSquares * (t + " << invWeight << "));\n" << "\n" << "\t\tvOut.x = vIn.x * r;\n" << "\t\tvOut.y = vIn.y * r;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; - return ss.str(); } @@ -4770,7 +4523,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(true, &m_InvWeight, prefix + "scry_inv_weight"));//Precalcs only, no params. } @@ -4786,7 +4538,7 @@ template class EMBER_API SeparationVariation : public ParametricVariation { public: - SeparationVariation(T weight = 1.0) : ParametricVariation("separation", VAR_SEPARATION, weight) + SeparationVariation(T weight = 1.0) : ParametricVariation("separation", eVariationId::VAR_SEPARATION, weight) { Init(); } @@ -4820,7 +4572,6 @@ public: string yInside = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string xx = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string yy = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tif (vIn.x > (real_t)(0.0))\n" << "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (sqrt(vIn.x * vIn.x + " << xx << ") - vIn.x * " << xInside << ");\n" @@ -4834,7 +4585,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4856,7 +4606,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "separation_x", 1));//Params. m_Params.push_back(ParamWithName(&m_XInside, prefix + "separation_xinside")); @@ -4882,7 +4631,7 @@ template class EMBER_API SplitVariation : public ParametricVariation { public: - SplitVariation(T weight = 1.0) : ParametricVariation("split", VAR_SPLIT, weight) + SplitVariation(T weight = 1.0) : ParametricVariation("split", eVariationId::VAR_SPLIT, weight) { Init(); } @@ -4914,7 +4663,6 @@ public: string ySize = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string xAng = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string yAng = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tif (cos(vIn.y * " << yAng << ") >= 0)\n" << "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n" @@ -4928,7 +4676,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4948,7 +4695,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_XSize, prefix + "split_xsize", T(0.5)));//Params. m_Params.push_back(ParamWithName(&m_YSize, prefix + "split_ysize", T(0.5))); @@ -4970,7 +4716,7 @@ template class EMBER_API SplitsVariation : public ParametricVariation { public: - SplitsVariation(T weight = 1.0) : ParametricVariation("splits", VAR_SPLITS, weight) + SplitsVariation(T weight = 1.0) : ParametricVariation("splits", eVariationId::VAR_SPLITS, weight) { Init(); } @@ -5000,7 +4746,6 @@ public: string index = ss2.str(); string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tif (vIn.x >= 0)\n" << "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + " << x << ");\n" @@ -5014,7 +4759,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -5028,7 +4772,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "splits_x")); m_Params.push_back(ParamWithName(&m_Y, prefix + "splits_y")); @@ -5046,7 +4789,7 @@ template class EMBER_API StripesVariation : public ParametricVariation { public: - StripesVariation(T weight = 1.0) : ParametricVariation("stripes", VAR_STRIPES, weight) + StripesVariation(T weight = 1.0) : ParametricVariation("stripes", eVariationId::VAR_STRIPES, weight) { Init(); } @@ -5057,7 +4800,6 @@ public: { T roundx = T(int(helper.In.x >= 0 ? (helper.In.x + T(0.5)) : (helper.In.x - T(0.5)))); T offsetx = helper.In.x - roundx; - helper.Out.x = m_Weight * (offsetx * (1 - m_Space) + roundx); helper.Out.y = m_Weight * (helper.In.y + offsetx * offsetx * m_Warp); helper.Out.z = m_Weight * helper.In.z; @@ -5071,7 +4813,6 @@ public: string index = ss2.str(); string space = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string warp = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t roundx = (real_t)(int)(vIn.x >= 0 ? (vIn.x + (real_t)(0.5)) : (vIn.x - (real_t)(0.5)));\n" << "\t\treal_t offsetx = vIn.x - roundx;\n" @@ -5080,7 +4821,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + offsetx * offsetx * " << warp << ");\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -5094,9 +4834,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Space, prefix + "stripes_space", T(0.5), REAL, T(0.5), 5)); + m_Params.push_back(ParamWithName(&m_Space, prefix + "stripes_space", T(0.5), eParamType::REAL, T(0.5), 5)); m_Params.push_back(ParamWithName(&m_Warp, prefix + "stripes_warp")); } @@ -5112,7 +4851,7 @@ template class EMBER_API WedgeVariation : public ParametricVariation { public: - WedgeVariation(T weight = 1.0) : ParametricVariation("wedge", VAR_WEDGE, weight, true, true, false, false, true) + WedgeVariation(T weight = 1.0) : ParametricVariation("wedge", eVariationId::VAR_WEDGE, weight, true, true, false, false, true) { Init(); } @@ -5124,7 +4863,6 @@ public: T r = helper.m_PrecalcSqrtSumSquares; T a = helper.m_PrecalcAtanyx + m_Swirl * r; T c = T(Floor((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5))); - a = a * m_CompFac + c * m_Angle; r = m_Weight * (r + m_Hole); helper.Out.x = r * std::cos(a); @@ -5143,7 +4881,6 @@ public: string count = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string swirl = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string compFac = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r = precalcSqrtSumSquares;\n" << "\t\treal_t a = precalcAtanyx + " << swirl << " * r;\n" @@ -5155,7 +4892,6 @@ public: << "\t\tvOut.y = r * sin(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -5176,11 +4912,10 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Angle, prefix + "wedge_angle", T(M_PI_2)));//Params. m_Params.push_back(ParamWithName(&m_Hole, prefix + "wedge_hole")); - m_Params.push_back(ParamWithName(&m_Count, prefix + "wedge_count", 2, INTEGER, 1)); + m_Params.push_back(ParamWithName(&m_Count, prefix + "wedge_count", 2, eParamType::INTEGER, 1)); m_Params.push_back(ParamWithName(&m_Swirl, prefix + "wedge_swirl")); m_Params.push_back(ParamWithName(true, &m_CompFac, prefix + "wedge_compfac"));//Precalc. } @@ -5200,7 +4935,7 @@ template class EMBER_API WedgeJuliaVariation : public ParametricVariation { public: - WedgeJuliaVariation(T weight = 1.0) : ParametricVariation("wedge_julia", VAR_WEDGE_JULIA, weight, true, false, false, false, true) + WedgeJuliaVariation(T weight = 1.0) : ParametricVariation("wedge_julia", eVariationId::VAR_WEDGE_JULIA, weight, true, false, false, false, true) { Init(); } @@ -5213,7 +4948,6 @@ public: int tRand = int(m_Rn * rand.Frand01()); T a = (helper.m_PrecalcAtanyx + M_2PI * tRand) / m_Power; T c = T(Floor((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5))); - a = a * m_Cf + c * m_Angle; helper.Out.x = r * std::cos(a); helper.Out.y = r * std::sin(a); @@ -5233,7 +4967,6 @@ public: string rn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc. string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string cf = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * pow(precalcSumSquares, " << cn << ");\n" << "\t\tint tRand = (int)(" << rn << " * MwcNext01(mwc));\n" @@ -5245,7 +4978,6 @@ public: << "\t\tvOut.y = r * sin(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -5268,7 +5000,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Angle, prefix + "wedge_julia_angle"));//Params. m_Params.push_back(ParamWithName(&m_Count, prefix + "wedge_julia_count", 1)); @@ -5296,7 +5027,7 @@ template class EMBER_API WedgeSphVariation : public ParametricVariation { public: - WedgeSphVariation(T weight = 1.0) : ParametricVariation("wedge_sph", VAR_WEDGE_SPH, weight, true, true, false, false, true) + WedgeSphVariation(T weight = 1.0) : ParametricVariation("wedge_sph", eVariationId::VAR_WEDGE_SPH, weight, true, true, false, false, true) { Init(); } @@ -5309,7 +5040,6 @@ public: T a = helper.m_PrecalcAtanyx + m_Swirl * r; T c = T(Floor((m_Count * a + T(M_PI)) * T(M_1_PI) * T(0.5))); T compFac = 1 - m_Angle * m_Count * T(M_1_PI) * T(0.5); - a = a * compFac + c * m_Angle; r = m_Weight * (r + m_Hole); helper.Out.x = r * std::cos(a); @@ -5327,7 +5057,6 @@ public: string count = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string hole = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string swirl = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r = (real_t)(1.0) / Zeps(precalcSqrtSumSquares);\n" << "\t\treal_t a = precalcAtanyx + " << swirl << " * r;\n" @@ -5340,7 +5069,6 @@ public: << "\t\tvOut.y = r * sin(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -5361,7 +5089,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Angle, prefix + "wedge_sph_angle")); m_Params.push_back(ParamWithName(&m_Count, prefix + "wedge_sph_hole", 1)); @@ -5383,7 +5110,7 @@ template class EMBER_API WhorlVariation : public ParametricVariation { public: - WhorlVariation(T weight = 1.0) : ParametricVariation("whorl", VAR_WHORL, weight, true, true, false, false, true) + WhorlVariation(T weight = 1.0) : ParametricVariation("whorl", eVariationId::VAR_WHORL, weight, true, true, false, false, true) { Init(); } @@ -5412,7 +5139,6 @@ public: string index = ss2.str(); string inside = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string outside = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t a;\n" << "\t\treal_t r = precalcSqrtSumSquares;\n" @@ -5426,7 +5152,6 @@ public: << "\t\tvOut.y = (xform->m_VariationWeights[" << varIndex << "] * r * sin(a));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -5440,7 +5165,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Inside, prefix + "whorl_inside", 1)); m_Params.push_back(ParamWithName(&m_Outside, prefix + "whorl_outside", 1)); @@ -5458,7 +5182,7 @@ template class EMBER_API Waves2Variation : public ParametricVariation { public: - Waves2Variation(T weight = 1.0) : ParametricVariation("waves2", VAR_WAVES2, weight, true, true) + Waves2Variation(T weight = 1.0) : ParametricVariation("waves2", eVariationId::VAR_WAVES2, weight, true, true) { Init(); } @@ -5484,13 +5208,11 @@ public: string scaleY = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string freqZ = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string scaleZ = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x + " << scaleX << " * sin(vIn.y * " << freqX << "));\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y + " << scaleY << " * sin(vIn.x * " << freqY << "));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (vIn.z + " << scaleZ << " * sin(precalcSqrtSumSquares * " << freqZ << "));\n" << "\t}\n"; - return ss.str(); } @@ -5508,7 +5230,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_FreqX, prefix + "waves2_freqx", 2)); m_Params.push_back(ParamWithName(&m_ScaleX, prefix + "waves2_scalex")); @@ -5534,14 +5255,13 @@ template class EMBER_API ExpVariation : public Variation { public: - ExpVariation(T weight = 1.0) : Variation("exp", VAR_EXP, weight) { } + ExpVariation(T weight = 1.0) : Variation("exp", eVariationId::VAR_EXP, weight) { } VARCOPY(ExpVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T expe = m_Weight * std::exp(helper.In.x); - helper.Out.x = expe * std::cos(helper.In.y); helper.Out.y = expe * std::sin(helper.In.y); helper.Out.z = m_Weight * helper.In.z; @@ -5551,7 +5271,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t expe = xform->m_VariationWeights[" << varIndex << "] * exp(vIn.x);\n" << "\n" @@ -5559,7 +5278,6 @@ public: << "\t\tvOut.y = expe * sin(vIn.y);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -5571,7 +5289,7 @@ template class EMBER_API LogVariation : public ParametricVariation { public: - LogVariation(T weight = 1.0) : ParametricVariation("log", VAR_LOG, weight, true, false, false, false, true) + LogVariation(T weight = 1.0) : ParametricVariation("log", eVariationId::VAR_LOG, weight, true, false, false, false, true) { Init(); } @@ -5593,13 +5311,11 @@ public: string index = ss2.str(); string base = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string denom = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * log(precalcSumSquares) * " << denom << ";\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * precalcAtanyx;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -5612,9 +5328,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Base, prefix + "log_base", T(M_E), REAL, EPS, TMAX)); + m_Params.push_back(ParamWithName(&m_Base, prefix + "log_base", T(M_E), eParamType::REAL, EPS, TMAX)); m_Params.push_back(ParamWithName(true, &m_Denom, prefix + "log_denom"));//Precalc. } @@ -5630,7 +5345,7 @@ template class EMBER_API SinVariation : public Variation { public: - SinVariation(T weight = 1.0) : Variation("sin", VAR_SIN, weight) { } + SinVariation(T weight = 1.0) : Variation("sin", eVariationId::VAR_SIN, weight) { } VARCOPY(SinVariation) @@ -5645,13 +5360,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) * cosh(vIn.y);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cos(vIn.x) * sinh(vIn.y);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -5663,7 +5376,7 @@ template class EMBER_API CosVariation : public Variation { public: - CosVariation(T weight = 1.0) : Variation("cos", VAR_COS, weight) { } + CosVariation(T weight = 1.0) : Variation("cos", eVariationId::VAR_COS, weight) { } VARCOPY(CosVariation) @@ -5679,13 +5392,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * cos(vIn.x) * cosh(vIn.y);\n" << "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) * sinh(vIn.y));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -5697,14 +5408,13 @@ template class EMBER_API TanVariation : public Variation { public: - TanVariation(T weight = 1.0) : Variation("tan", VAR_TAN, weight) { } + TanVariation(T weight = 1.0) : Variation("tan", eVariationId::VAR_TAN, weight) { } VARCOPY(TanVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T tansin, tancos, tansinh, tancosh, tanden; - sincos(2 * helper.In.x, &tansin, &tancos); tansinh = sinh(2 * helper.In.y); tancosh = cosh(2 * helper.In.y); @@ -5718,7 +5428,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t tansin = sin((real_t)(2.0) * vIn.x);\n" << "\t\treal_t tancos = cos((real_t)(2.0) * vIn.x);\n" @@ -5730,7 +5439,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * tanden * tansinh;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -5742,14 +5450,13 @@ template class EMBER_API SecVariation : public Variation { public: - SecVariation(T weight = 1.0) : Variation("sec", VAR_SEC, weight) { } + SecVariation(T weight = 1.0) : Variation("sec", eVariationId::VAR_SEC, weight) { } VARCOPY(SecVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T secsin, seccos, secsinh, seccosh, secden; - sincos(helper.In.x, &secsin, &seccos); secsinh = sinh(helper.In.y); seccosh = cosh(helper.In.y); @@ -5763,7 +5470,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t secsin = sin(vIn.x);\n" << "\t\treal_t seccos = cos(vIn.x);\n" @@ -5775,7 +5481,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * secden * secsin * secsinh;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -5787,14 +5492,13 @@ template class EMBER_API CscVariation : public Variation { public: - CscVariation(T weight = 1.0) : Variation("csc", VAR_CSC, weight) { } + CscVariation(T weight = 1.0) : Variation("csc", eVariationId::VAR_CSC, weight) { } VARCOPY(CscVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T cscsin, csccos, cscsinh, csccosh, cscden; - sincos(helper.In.x, &cscsin, &csccos); cscsinh = std::sinh(helper.In.y); csccosh = std::cosh(helper.In.y); @@ -5808,7 +5512,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t cscsin = sin(vIn.x);\n" << "\t\treal_t csccos = cos(vIn.x);\n" @@ -5820,7 +5523,6 @@ public: << "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * cscden * csccos * cscsinh);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -5832,14 +5534,13 @@ template class EMBER_API CotVariation : public Variation { public: - CotVariation(T weight = 1.0) : Variation("cot", VAR_COT, weight) { } + CotVariation(T weight = 1.0) : Variation("cot", eVariationId::VAR_COT, weight) { } VARCOPY(CotVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T cotsin, cotcos, cotsinh, cotcosh, cotden; - sincos(2 * helper.In.x, &cotsin, &cotcos); cotsinh = sinh(2 * helper.In.y); cotcosh = cosh(2 * helper.In.y); @@ -5853,7 +5554,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t cotsin = sin((real_t)(2.0) * vIn.x);\n" << "\t\treal_t cotcos = cos((real_t)(2.0) * vIn.x);\n" @@ -5865,7 +5565,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cotden * -1 * cotsinh;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -5877,14 +5576,13 @@ template class EMBER_API SinhVariation : public Variation { public: - SinhVariation(T weight = 1.0) : Variation("sinh", VAR_SINH, weight) { } + SinhVariation(T weight = 1.0) : Variation("sinh", eVariationId::VAR_SINH, weight) { } VARCOPY(SinhVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T sinhsin, sinhcos, sinhsinh, sinhcosh; - sincos(helper.In.y, &sinhsin, &sinhcos); sinhsinh = sinh(helper.In.x); sinhcosh = cosh(helper.In.x); @@ -5897,7 +5595,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t sinhsin = sin(vIn.y);\n" << "\t\treal_t sinhcos = cos(vIn.y);\n" @@ -5908,7 +5605,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinhcosh * sinhsin;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -5920,14 +5616,13 @@ template class EMBER_API CoshVariation : public Variation { public: - CoshVariation(T weight = 1.0) : Variation("cosh", VAR_COSH, weight) { } + CoshVariation(T weight = 1.0) : Variation("cosh", eVariationId::VAR_COSH, weight) { } VARCOPY(CoshVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { - T coshsin,coshcos,coshsinh,coshcosh; - + T coshsin, coshcos, coshsinh, coshcosh; sincos(helper.In.y, &coshsin, &coshcos); coshsinh = sinh(helper.In.x); coshcosh = cosh(helper.In.x); @@ -5940,7 +5635,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t coshsin = sin(vIn.y);\n" << "\t\treal_t coshcos = cos(vIn.y);\n" @@ -5951,7 +5645,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * coshsinh * coshsin;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -5963,14 +5656,13 @@ template class EMBER_API TanhVariation : public Variation { public: - TanhVariation(T weight = 1.0) : Variation("tanh", VAR_TANH, weight) { } + TanhVariation(T weight = 1.0) : Variation("tanh", eVariationId::VAR_TANH, weight) { } VARCOPY(TanhVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T tanhsin, tanhcos, tanhsinh, tanhcosh, tanhden; - sincos(2 * helper.In.y, &tanhsin, &tanhcos); tanhsinh = sinh(2 * helper.In.x); tanhcosh = cosh(2 * helper.In.x); @@ -5984,7 +5676,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t tanhsin = sin((real_t)(2.0) * vIn.y);\n" << "\t\treal_t tanhcos = cos((real_t)(2.0) * vIn.y);\n" @@ -5996,7 +5687,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * tanhden * tanhsin;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -6008,14 +5698,13 @@ template class EMBER_API SechVariation : public Variation { public: - SechVariation(T weight = 1.0) : Variation("sech", VAR_SECH, weight) { } + SechVariation(T weight = 1.0) : Variation("sech", eVariationId::VAR_SECH, weight) { } VARCOPY(SechVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T sechsin, sechcos, sechsinh, sechcosh, sechden; - sincos(helper.In.y, &sechsin, &sechcos); sechsinh = sinh(helper.In.x); sechcosh = cosh(helper.In.x); @@ -6029,7 +5718,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t sechsin = sin(vIn.y);\n" << "\t\treal_t sechcos = cos(vIn.y);\n" @@ -6041,7 +5729,6 @@ public: << "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * sechden * sechsin * sechsinh);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -6053,14 +5740,13 @@ template class EMBER_API CschVariation : public Variation { public: - CschVariation(T weight = 1.0) : Variation("csch", VAR_CSCH, weight) { } + CschVariation(T weight = 1.0) : Variation("csch", eVariationId::VAR_CSCH, weight) { } VARCOPY(CschVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T cschsin, cschcos, cschsinh, cschcosh, cschden; - sincos(helper.In.y, &cschsin, &cschcos); cschsinh = std::sinh(helper.In.x); cschcosh = std::cosh(helper.In.x); @@ -6074,7 +5760,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t cschsin = sin(vIn.y);\n" << "\t\treal_t cschcos = cos(vIn.y);\n" @@ -6086,7 +5771,6 @@ public: << "\t\tvOut.y = -(xform->m_VariationWeights[" << varIndex << "] * cschden * cschcosh * cschsin);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -6098,14 +5782,13 @@ template class EMBER_API CothVariation : public Variation { public: - CothVariation(T weight = 1.0) : Variation("coth", VAR_COTH, weight) { } + CothVariation(T weight = 1.0) : Variation("coth", eVariationId::VAR_COTH, weight) { } VARCOPY(CothVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T cothsin, cothcos, cothsinh, cothcosh, cothden; - sincos(2 * helper.In.y, &cothsin, &cothcos); cothsinh = sinh(2 * helper.In.x); cothcosh = cosh(2 * helper.In.x); @@ -6119,7 +5802,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t cothsin = sin((real_t)(2.0) * vIn.y);\n" << "\t\treal_t cothcos = cos((real_t)(2.0) * vIn.y);\n" @@ -6131,7 +5813,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cothden * cothsin;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -6143,7 +5824,7 @@ template class EMBER_API AugerVariation : public ParametricVariation { public: - AugerVariation(T weight = 1.0) : ParametricVariation("auger", VAR_AUGER, weight) + AugerVariation(T weight = 1.0) : ParametricVariation("auger", eVariationId::VAR_AUGER, weight) { Init(); } @@ -6156,7 +5837,6 @@ public: T t = std::sin(m_Freq * helper.In.y); T dy = helper.In.y + m_AugerWeight * (m_Scale * s / 2 + fabs(helper.In.y) * s); T dx = helper.In.x + m_AugerWeight * (m_Scale * t / 2 + fabs(helper.In.x) * t); - helper.Out.x = m_Weight * (helper.In.x + m_Symmetry * (dx - helper.In.x)); helper.Out.y = m_Weight * dy; helper.Out.z = m_Weight * helper.In.z; @@ -6172,7 +5852,6 @@ public: string augerWeight = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string freq = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t s = sin(" << freq << " * vIn.x);\n" << "\t\treal_t t = sin(" << freq << " * vIn.y);\n" @@ -6183,7 +5862,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * dy;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -6199,7 +5877,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Symmetry, prefix + "auger_sym")); m_Params.push_back(ParamWithName(&m_AugerWeight, prefix + "auger_weight", T(0.5))); @@ -6221,7 +5898,7 @@ template class EMBER_API FluxVariation : public ParametricVariation { public: - FluxVariation(T weight = 1.0) : ParametricVariation("flux", VAR_FLUX, weight) + FluxVariation(T weight = 1.0) : ParametricVariation("flux", eVariationId::VAR_FLUX, weight) { Init(); } @@ -6240,7 +5917,6 @@ public: T avgr = m_Weight * (m_Spr * std::sqrt(std::sqrt(yy + SQR(xpw)) / frac)); T avga = (atan2(helper.In.y, xmw) - atan2(helper.In.y, xpw)) * T(0.5); - helper.Out.x = avgr * std::cos(avga); helper.Out.y = avgr * std::sin(avga); helper.Out.z = helper.In.z; @@ -6254,7 +5930,6 @@ public: string index = ss2.str(); string spread = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string spr = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t xpw = vIn.x + xform->m_VariationWeights[" << varIndex << "];\n" << "\t\treal_t xmw = vIn.x - xform->m_VariationWeights[" << varIndex << "];\n" @@ -6271,7 +5946,6 @@ public: << "\t\tvOut.y = avgr * sin(avga);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -6289,7 +5963,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Spread, prefix + "flux_spread"));//Params. m_Params.push_back(ParamWithName(true, &m_Spr, prefix + "flux_spr"));//Precalc. @@ -6334,16 +6007,16 @@ MAKEPREPOSTPARVAR(Perspective, perspective, PERSPECTIVE) MAKEPREPOSTVAR(Noise, noise, NOISE) MAKEPREPOSTPARVAR(JuliaNGeneric, julian, JULIAN) MAKEPREPOSTPARVAR(JuliaScope, juliascope, JULIASCOPE) -MAKEPREPOSTVARASSIGN(Blur, blur, BLUR, ASSIGNTYPE_SUM) -MAKEPREPOSTVARASSIGN(GaussianBlur, gaussian_blur, GAUSSIAN_BLUR, ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(Blur, blur, BLUR, eVariationAssignType::ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(GaussianBlur, gaussian_blur, GAUSSIAN_BLUR, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(RadialBlur, radial_blur, RADIAL_BLUR) -MAKEPREPOSTPARVARASSIGN(Pie, pie, PIE, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(Pie, pie, PIE, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(Ngon, ngon, NGON) MAKEPREPOSTPARVAR(Curl, curl, CURL) MAKEPREPOSTPARVAR(Rectangles, rectangles, RECTANGLES) -MAKEPREPOSTVARASSIGN(Arch, arch, ARCH, ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(Arch, arch, ARCH, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTVAR(Tangent, tangent, TANGENT) -MAKEPREPOSTVARASSIGN(Square, square, SQUARE, ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(Square, square, SQUARE, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTVAR(Rays, rays, RAYS) MAKEPREPOSTVAR(Blade, blade, BLADE) MAKEPREPOSTVAR(Secant2, secant2, SECANT2) diff --git a/Source/Ember/Variations02.h b/Source/Ember/Variations02.h index b84bf43..af3f6ff 100644 --- a/Source/Ember/Variations02.h +++ b/Source/Ember/Variations02.h @@ -11,7 +11,7 @@ template class EMBER_API HemisphereVariation : public Variation { public: - HemisphereVariation(T weight = 1.0) : Variation("hemisphere", VAR_HEMISPHERE, weight, true) { } + HemisphereVariation(T weight = 1.0) : Variation("hemisphere", eVariationId::VAR_HEMISPHERE, weight, true) { } VARCOPY(HemisphereVariation) @@ -48,7 +48,7 @@ template class EMBER_API EpispiralVariation : public ParametricVariation { public: - EpispiralVariation(T weight = 1.0) : ParametricVariation("epispiral", VAR_EPISPIRAL, weight, false, false, false, false, true) + EpispiralVariation(T weight = 1.0) : ParametricVariation("epispiral", eVariationId::VAR_EPISPIRAL, weight, false, false, false, false, true) { Init(); } @@ -130,7 +130,7 @@ template class EMBER_API BwrapsVariation : public ParametricVariation { public: - BwrapsVariation(T weight = 1.0) : ParametricVariation("bwraps", VAR_BWRAPS, weight) + BwrapsVariation(T weight = 1.0) : ParametricVariation("bwraps", eVariationId::VAR_BWRAPS, weight) { Init(); } @@ -297,7 +297,7 @@ template class EMBER_API BlurCircleVariation : public Variation { public: - BlurCircleVariation(T weight = 1.0) : Variation("blur_circle", VAR_BLUR_CIRCLE, weight) { } + BlurCircleVariation(T weight = 1.0) : Variation("blur_circle", eVariationId::VAR_BLUR_CIRCLE, weight) { } VARCOPY(BlurCircleVariation) @@ -404,7 +404,7 @@ template class EMBER_API BlurZoomVariation : public ParametricVariation { public: - BlurZoomVariation(T weight = 1.0) : ParametricVariation("blur_zoom", VAR_BLUR_ZOOM, weight) + BlurZoomVariation(T weight = 1.0) : ParametricVariation("blur_zoom", eVariationId::VAR_BLUR_ZOOM, weight) { Init(); } @@ -465,7 +465,7 @@ template class EMBER_API BlurPixelizeVariation : public ParametricVariation { public: - BlurPixelizeVariation(T weight = 1.0) : ParametricVariation("blur_pixelize", VAR_BLUR_PIXELIZE, weight) + BlurPixelizeVariation(T weight = 1.0) : ParametricVariation("blur_pixelize", eVariationId::VAR_BLUR_PIXELIZE, weight) { Init(); } @@ -517,7 +517,7 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_BlurPixelizeSize, prefix + "blur_pixelize_size", T(0.1), REAL, EPS)); + m_Params.push_back(ParamWithName(&m_BlurPixelizeSize, prefix + "blur_pixelize_size", T(0.1), eParamType::REAL, EPS)); m_Params.push_back(ParamWithName(&m_BlurPixelizeScale, prefix + "blur_pixelize_scale", 1)); m_Params.push_back(ParamWithName(true, &m_V, prefix + "blur_pixelize_v"));//Precalc. m_Params.push_back(ParamWithName(true, &m_InvSize, prefix + "blur_pixelize_inv_size")); @@ -537,7 +537,7 @@ template class EMBER_API CropVariation : public ParametricVariation { public: - CropVariation(T weight = 1.0) : ParametricVariation("crop", VAR_CROP, weight) + CropVariation(T weight = 1.0) : ParametricVariation("crop", eVariationId::VAR_CROP, weight) { Init(); } @@ -659,8 +659,8 @@ protected: m_Params.push_back(ParamWithName(&m_Y0, prefix + "crop_top", -1)); m_Params.push_back(ParamWithName(&m_X1, prefix + "crop_right", 1)); m_Params.push_back(ParamWithName(&m_Y1, prefix + "crop_bottom", 1)); - m_Params.push_back(ParamWithName(&m_S, prefix + "crop_scatter_area", 0, REAL, -1, 1)); - m_Params.push_back(ParamWithName(&m_Z, prefix + "crop_zero", 0, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_S, prefix + "crop_scatter_area", 0, eParamType::REAL, -1, 1)); + m_Params.push_back(ParamWithName(&m_Z, prefix + "crop_zero", 0, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(true, &m_X0_, prefix + "crop_x0_"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Y0_, prefix + "crop_y0_")); m_Params.push_back(ParamWithName(true, &m_X1_, prefix + "crop_x1_")); @@ -691,7 +691,7 @@ template class EMBER_API BCircleVariation : public ParametricVariation { public: - BCircleVariation(T weight = 1.0) : ParametricVariation("bcircle", VAR_BCIRCLE, weight) + BCircleVariation(T weight = 1.0) : ParametricVariation("bcircle", eVariationId::VAR_BCIRCLE, weight) { Init(); } @@ -800,7 +800,7 @@ template class EMBER_API BlurLinearVariation : public ParametricVariation { public: - BlurLinearVariation(T weight = 1.0) : ParametricVariation("blur_linear", VAR_BLUR_LINEAR, weight) + BlurLinearVariation(T weight = 1.0) : ParametricVariation("blur_linear", eVariationId::VAR_BLUR_LINEAR, weight) { Init(); } @@ -850,7 +850,7 @@ protected: m_Params.clear(); m_Params.push_back(ParamWithName(&m_BlurLinearLength, prefix + "blur_linear_length")); - m_Params.push_back(ParamWithName(&m_BlurLinearAngle, prefix + "blur_linear_angle", 0, REAL_CYCLIC, 0, T(M_2PI))); + m_Params.push_back(ParamWithName(&m_BlurLinearAngle, prefix + "blur_linear_angle", 0, eParamType::REAL_CYCLIC, 0, T(M_2PI))); m_Params.push_back(ParamWithName(true, &m_S, prefix + "blur_linear_s"));//Precalc. m_Params.push_back(ParamWithName(true, &m_C, prefix + "blur_linear_c")); } @@ -869,7 +869,7 @@ template class EMBER_API BlurSquareVariation : public ParametricVariation { public: - BlurSquareVariation(T weight = 1.0) : ParametricVariation("blur_square", VAR_BLUR_SQUARE, weight) + BlurSquareVariation(T weight = 1.0) : ParametricVariation("blur_square", eVariationId::VAR_BLUR_SQUARE, weight) { Init(); } @@ -926,13 +926,13 @@ template class EMBER_API FlattenVariation : public Variation { public: - FlattenVariation(T weight = 1.0) : Variation("flatten", VAR_FLATTEN, weight) { } + FlattenVariation(T weight = 1.0) : Variation("flatten", eVariationId::VAR_FLATTEN, weight) { } VARCOPY(FlattenVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { - if (m_VarType == VARTYPE_REG)//Rare and different usage of in/out. + if (m_VarType == eVariationType::VARTYPE_REG)//Rare and different usage of in/out. { helper.Out.x = helper.Out.y = helper.Out.z = 0; outPoint.m_Z = 0; @@ -949,7 +949,7 @@ public: { ostringstream ss; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t{\n" << "\t\tvOut.x = 0;\n" @@ -979,7 +979,7 @@ template class EMBER_API ZblurVariation : public Variation { public: - ZblurVariation(T weight = 1.0) : Variation("zblur", VAR_ZBLUR, weight) { } + ZblurVariation(T weight = 1.0) : Variation("zblur", eVariationId::VAR_ZBLUR, weight) { } VARCOPY(ZblurVariation) @@ -1011,7 +1011,7 @@ template class EMBER_API ZScaleVariation : public Variation { public: - ZScaleVariation(T weight = 1.0) : Variation("zscale", VAR_ZSCALE, weight) { } + ZScaleVariation(T weight = 1.0) : Variation("zscale", eVariationId::VAR_ZSCALE, weight) { } VARCOPY(ZScaleVariation) @@ -1043,7 +1043,7 @@ template class EMBER_API ZTranslateVariation : public Variation { public: - ZTranslateVariation(T weight = 1.0) : Variation("ztranslate", VAR_ZTRANSLATE, weight) { } + ZTranslateVariation(T weight = 1.0) : Variation("ztranslate", eVariationId::VAR_ZTRANSLATE, weight) { } VARCOPY(ZTranslateVariation) @@ -1075,13 +1075,13 @@ template class EMBER_API ZConeVariation : public Variation { public: - ZConeVariation(T weight = 1.0) : Variation("zcone", VAR_ZCONE, weight, true, true) { } + ZConeVariation(T weight = 1.0) : Variation("zcone", eVariationId::VAR_ZCONE, weight, true, true) { } VARCOPY(ZConeVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { - if (m_VarType == VARTYPE_REG)//Rare and different usage of in/out. + if (m_VarType == eVariationType::VARTYPE_REG)//Rare and different usage of in/out. { helper.Out.x = helper.Out.y = 0; } @@ -1101,7 +1101,7 @@ public: ss << "\t{\n"; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tvOut.x = vOut.y = 0;\n"; } @@ -1125,7 +1125,7 @@ template class EMBER_API Blur3DVariation : public Variation { public: - Blur3DVariation(T weight = 1.0) : Variation("blur3D", VAR_BLUR3D, weight) { } + Blur3DVariation(T weight = 1.0) : Variation("blur3D", eVariationId::VAR_BLUR3D, weight) { } VARCOPY(Blur3DVariation) @@ -1174,7 +1174,7 @@ template class EMBER_API Spherical3DVariation : public Variation { public: - Spherical3DVariation(T weight = 1.0) : Variation("Spherical3D", VAR_SPHERICAL3D, weight, true) { } + Spherical3DVariation(T weight = 1.0) : Variation("Spherical3D", eVariationId::VAR_SPHERICAL3D, weight, true) { } VARCOPY(Spherical3DVariation) @@ -1216,7 +1216,7 @@ template class EMBER_API Curl3DVariation : public ParametricVariation { public: - Curl3DVariation(T weight = 1.0) : ParametricVariation("curl3D", VAR_CURL3D, weight, true) + Curl3DVariation(T weight = 1.0) : ParametricVariation("curl3D", eVariationId::VAR_CURL3D, weight, true) { Init(); } @@ -1304,7 +1304,7 @@ template class EMBER_API Disc3DVariation : public ParametricVariation { public: - Disc3DVariation(T weight = 1.0) : ParametricVariation("disc3d", VAR_DISC3D, weight, true, true, false, true, false) + Disc3DVariation(T weight = 1.0) : ParametricVariation("disc3d", eVariationId::VAR_DISC3D, weight, true, true, false, true, false) { Init(); } @@ -1372,7 +1372,7 @@ template class EMBER_API Boarders2Variation : public ParametricVariation { public: - Boarders2Variation(T weight = 1.0) : ParametricVariation("boarders2", VAR_BOARDERS2, weight) + Boarders2Variation(T weight = 1.0) : ParametricVariation("boarders2", eVariationId::VAR_BOARDERS2, weight) { Init(); } @@ -1525,7 +1525,7 @@ template class EMBER_API CardioidVariation : public ParametricVariation { public: - CardioidVariation(T weight = 1.0) : ParametricVariation("cardioid", VAR_CARDIOID, weight, true, true, true, false, true) + CardioidVariation(T weight = 1.0) : ParametricVariation("cardioid", eVariationId::VAR_CARDIOID, weight, true, true, true, false, true) { Init(); } @@ -1580,7 +1580,7 @@ template class EMBER_API ChecksVariation : public ParametricVariation { public: - ChecksVariation(T weight = 1.0) : ParametricVariation("checks", VAR_CHECKS, weight) + ChecksVariation(T weight = 1.0) : ParametricVariation("checks", eVariationId::VAR_CHECKS, weight) { Init(); } @@ -1703,7 +1703,7 @@ template class EMBER_API CirclizeVariation : public ParametricVariation { public: - CirclizeVariation(T weight = 1.0) : ParametricVariation("circlize", VAR_CIRCLIZE, weight) + CirclizeVariation(T weight = 1.0) : ParametricVariation("circlize", eVariationId::VAR_CIRCLIZE, weight) { Init(); } @@ -1816,7 +1816,7 @@ template class EMBER_API Circlize2Variation : public ParametricVariation { public: - Circlize2Variation(T weight = 1.0) : ParametricVariation("circlize2", VAR_CIRCLIZE2, weight) + Circlize2Variation(T weight = 1.0) : ParametricVariation("circlize2", eVariationId::VAR_CIRCLIZE2, weight) { Init(); } @@ -1921,7 +1921,7 @@ template class EMBER_API CosWrapVariation : public ParametricVariation { public: - CosWrapVariation(T weight = 1.0) : ParametricVariation("coswrap", VAR_COS_WRAP, weight) + CosWrapVariation(T weight = 1.0) : ParametricVariation("coswrap", eVariationId::VAR_COS_WRAP, weight) { Init(); } @@ -1939,7 +1939,7 @@ public: helper.Out.x = -1 + m_Vv2 * Lerp(Lerp(x, Fosc(x, T(4), m_Px), oscnapx), Fosc(bx, T(4), m_Px), oscnapx);//Original did a direct assignment to outPoint, which is incompatible with Ember's design. helper.Out.y = -1 + m_Vv2 * Lerp(Lerp(y, Fosc(y, T(4), m_Py), oscnapy), Fosc(by, T(4), m_Py), oscnapy); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1970,7 +1970,7 @@ public: << "\n" << "\t\tvOut.x = -1 + " << vv2 << " * Lerp(Lerp(x, Fosc(x, 4, " << px << "), oscnapx), Fosc(bx, 4, " << px << "), oscnapx);\n" << "\t\tvOut.y = -1 + " << vv2 << " * Lerp(Lerp(y, Fosc(y, 4, " << py << "), oscnapy), Fosc(by, 4, " << py << "), oscnapy);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -1997,11 +1997,11 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Repeat, prefix + "coswrap_repeat", 1, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Repeat, prefix + "coswrap_repeat", 1, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(&m_AmountX, prefix + "coswrap_amount_x")); m_Params.push_back(ParamWithName(&m_AmountY, prefix + "coswrap_amount_y")); - m_Params.push_back(ParamWithName(&m_PhaseX, prefix + "coswrap_phase_x", 0, REAL_CYCLIC, -1, 1)); - m_Params.push_back(ParamWithName(&m_PhaseY, prefix + "coswrap_phase_y", 0, REAL_CYCLIC, -1, 1)); + m_Params.push_back(ParamWithName(&m_PhaseX, prefix + "coswrap_phase_x", 0, eParamType::REAL_CYCLIC, -1, 1)); + m_Params.push_back(ParamWithName(&m_PhaseY, prefix + "coswrap_phase_y", 0, eParamType::REAL_CYCLIC, -1, 1)); m_Params.push_back(ParamWithName(true, &m_Ax, prefix + "coswrap_ax"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Ay, prefix + "coswrap_ay")); m_Params.push_back(ParamWithName(true, &m_Px, prefix + "coswrap_px")); @@ -2034,7 +2034,7 @@ template class EMBER_API DeltaAVariation : public Variation { public: - DeltaAVariation(T weight = 1.0) : Variation("deltaa", VAR_DELTA_A, weight) { } + DeltaAVariation(T weight = 1.0) : Variation("deltaa", eVariationId::VAR_DELTA_A, weight) { } VARCOPY(DeltaAVariation) @@ -2077,7 +2077,7 @@ template class EMBER_API ExpoVariation : public ParametricVariation { public: - ExpoVariation(T weight = 1.0) : ParametricVariation("expo", VAR_EXPO, weight) + ExpoVariation(T weight = 1.0) : ParametricVariation("expo", eVariationId::VAR_EXPO, weight) { Init(); } @@ -2153,7 +2153,7 @@ template class EMBER_API ExtrudeVariation : public ParametricVariation { public: - ExtrudeVariation(T weight = 1.0) : ParametricVariation("extrude", VAR_EXTRUDE, weight) + ExtrudeVariation(T weight = 1.0) : ParametricVariation("extrude", eVariationId::VAR_EXTRUDE, weight) { Init(); } @@ -2162,7 +2162,7 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.x = helper.Out.y = helper.Out.z = 0; @@ -2191,7 +2191,7 @@ public: string index = ss2.str(); string rootFace = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t{\n" << "\t\tvOut.x = vOut.y = vOut.z = 0;\n" @@ -2238,7 +2238,7 @@ template class EMBER_API FDiscVariation : public Variation { public: - FDiscVariation(T weight = 1.0) : Variation("fdisc", VAR_FDISC, weight, true, true, false, false, true) { } + FDiscVariation(T weight = 1.0) : Variation("fdisc", eVariationId::VAR_FDISC, weight, true, true, false, false, true) { } VARCOPY(FDiscVariation) @@ -2281,7 +2281,7 @@ template class EMBER_API FibonacciVariation : public ParametricVariation { public: - FibonacciVariation(T weight = 1.0) : ParametricVariation("fibonacci", VAR_FIBONACCI, weight) + FibonacciVariation(T weight = 1.0) : ParametricVariation("fibonacci", eVariationId::VAR_FIBONACCI, weight) { Init(); } @@ -2360,7 +2360,7 @@ template class EMBER_API Fibonacci2Variation : public ParametricVariation { public: - Fibonacci2Variation(T weight = 1.0) : ParametricVariation("fibonacci2", VAR_FIBONACCI2, weight) + Fibonacci2Variation(T weight = 1.0) : ParametricVariation("fibonacci2", eVariationId::VAR_FIBONACCI2, weight) { Init(); } @@ -2445,7 +2445,7 @@ template class EMBER_API GlynniaVariation : public ParametricVariation { public: - GlynniaVariation(T weight = 1.0) : ParametricVariation("glynnia", VAR_GLYNNIA, weight, true, true) + GlynniaVariation(T weight = 1.0) : ParametricVariation("glynnia", eVariationId::VAR_GLYNNIA, weight, true, true) { Init(); } @@ -2567,7 +2567,7 @@ template class EMBER_API GridOutVariation : public Variation { public: - GridOutVariation(T weight = 1.0) : Variation("gridout", VAR_GRIDOUT, weight) { } + GridOutVariation(T weight = 1.0) : Variation("gridout", eVariationId::VAR_GRIDOUT, weight) { } VARCOPY(GridOutVariation) @@ -2725,7 +2725,7 @@ template class EMBER_API HoleVariation : public ParametricVariation { public: - HoleVariation(T weight = 1.0) : ParametricVariation("hole", VAR_HOLE, weight, true, true, true, false, true) + HoleVariation(T weight = 1.0) : ParametricVariation("hole", eVariationId::VAR_HOLE, weight, true, true, true, false, true) { Init(); } @@ -2778,7 +2778,7 @@ protected: m_Params.clear(); m_Params.push_back(ParamWithName(&m_A, prefix + "hole_a", 1)); - m_Params.push_back(ParamWithName(&m_Inside, prefix + "hole_inside", 0, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Inside, prefix + "hole_inside", 0, eParamType::INTEGER, 0, 1)); } private: @@ -2793,7 +2793,7 @@ template class EMBER_API HypertileVariation : public ParametricVariation { public: - HypertileVariation(T weight = 1.0) : ParametricVariation("hypertile", VAR_HYPERTILE, weight) + HypertileVariation(T weight = 1.0) : ParametricVariation("hypertile", eVariationId::VAR_HYPERTILE, weight) { Init(); } @@ -2810,7 +2810,7 @@ public: helper.Out.x = vr * (a * c + b * d); helper.Out.y = vr * (b * c - a * d); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -2834,7 +2834,7 @@ public: << "\n" << "\t\tvOut.x = vr * (a * c + b * d);\n" << "\t\tvOut.y = vr * (b * c - a * d);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -2862,9 +2862,9 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile_p", 3, INTEGER, 3, T(0x7fffffff))); - m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile_q", 7, INTEGER, 3, T(0x7fffffff))); - m_Params.push_back(ParamWithName(&m_N, prefix + "hypertile_n", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile_p", 3, eParamType::INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile_q", 7, eParamType::INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_N, prefix + "hypertile_n", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(true, &m_Real, prefix + "hypertile_real"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Imag, prefix + "hypertile_imag")); } @@ -2884,7 +2884,7 @@ template class EMBER_API Hypertile1Variation : public ParametricVariation { public: - Hypertile1Variation(T weight = 1.0) : ParametricVariation("hypertile1", VAR_HYPERTILE1, weight) + Hypertile1Variation(T weight = 1.0) : ParametricVariation("hypertile1", eVariationId::VAR_HYPERTILE1, weight) { Init(); } @@ -2906,7 +2906,7 @@ public: helper.Out.x = vr * (a * c + b * d); helper.Out.y = vr * (b * c - a * d); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -2934,7 +2934,7 @@ public: << "\n" << "\t\tvOut.x = vr * (a * c + b * d);\n" << "\t\tvOut.y = vr * (b * c - a * d);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -2959,8 +2959,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile1_p", 3, INTEGER, 3, T(0x7fffffff))); - m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile1_q", 7, INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile1_p", 3, eParamType::INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile1_q", 7, eParamType::INTEGER, 3, T(0x7fffffff))); m_Params.push_back(ParamWithName(true, &m_Pa, prefix + "hypertile1_pa"));//Precalc. m_Params.push_back(ParamWithName(true, &m_R, prefix + "hypertile1_r")); } @@ -2979,7 +2979,7 @@ template class EMBER_API Hypertile2Variation : public ParametricVariation { public: - Hypertile2Variation(T weight = 1.0) : ParametricVariation("hypertile2", VAR_HYPERTILE2, weight) + Hypertile2Variation(T weight = 1.0) : ParametricVariation("hypertile2", eVariationId::VAR_HYPERTILE2, weight) { Init(); } @@ -3001,7 +3001,7 @@ public: helper.Out.x = vr * (x * cosa + y * sina); helper.Out.y = vr * (y * cosa - x * sina); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -3029,7 +3029,7 @@ public: << "\n" << "\t\tvOut.x = vr * (x * cosa + y * sina);\n" << "\t\tvOut.y = vr * (y * cosa - x * sina);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -3054,8 +3054,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile2_p", 3, INTEGER, 3, T(0x7fffffff))); - m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile2_q", 7, INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile2_p", 3, eParamType::INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile2_q", 7, eParamType::INTEGER, 3, T(0x7fffffff))); m_Params.push_back(ParamWithName(true, &m_Pa, prefix + "hypertile2_pa"));//Precalc. m_Params.push_back(ParamWithName(true, &m_R, prefix + "hypertile2_r")); } @@ -3074,7 +3074,7 @@ template class EMBER_API Hypertile3DVariation : public ParametricVariation { public: - Hypertile3DVariation(T weight = 1.0) : ParametricVariation("hypertile3D", VAR_HYPERTILE3D, weight, true) + Hypertile3DVariation(T weight = 1.0) : ParametricVariation("hypertile3D", eVariationId::VAR_HYPERTILE3D, weight, true) { Init(); } @@ -3155,9 +3155,9 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile3D_p", 3, INTEGER, 3, T(0x7fffffff))); - m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile3D_q", 7, INTEGER, 3, T(0x7fffffff))); - m_Params.push_back(ParamWithName(&m_N, prefix + "hypertile3D_n", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile3D_p", 3, eParamType::INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile3D_q", 7, eParamType::INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_N, prefix + "hypertile3D_n", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(true, &m_Cx, prefix + "hypertile3D_cx"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Cy, prefix + "hypertile3D_cy")); m_Params.push_back(ParamWithName(true, &m_Cz, prefix + "hypertile3D_cz")); @@ -3193,7 +3193,7 @@ template class EMBER_API Hypertile3D1Variation : public ParametricVariation { public: - Hypertile3D1Variation(T weight = 1.0) : ParametricVariation("hypertile3D1", VAR_HYPERTILE3D1, weight, true) + Hypertile3D1Variation(T weight = 1.0) : ParametricVariation("hypertile3D1", eVariationId::VAR_HYPERTILE3D1, weight, true) { Init(); } @@ -3272,8 +3272,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile3D1_p", 3, INTEGER, 3, T(0x7fffffff))); - m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile3D1_q", 7, INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile3D1_p", 3, eParamType::INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile3D1_q", 7, eParamType::INTEGER, 3, T(0x7fffffff))); m_Params.push_back(ParamWithName(true, &m_Pa, prefix + "hypertile3D1_pa"));//Precalc. m_Params.push_back(ParamWithName(true, &m_R, prefix + "hypertile3D1_r")); m_Params.push_back(ParamWithName(true, &m_C2, prefix + "hypertile3D1_c2")); @@ -3296,7 +3296,7 @@ template class EMBER_API Hypertile3D2Variation : public ParametricVariation { public: - Hypertile3D2Variation(T weight = 1.0) : ParametricVariation("hypertile3D2", VAR_HYPERTILE3D2, weight, true) + Hypertile3D2Variation(T weight = 1.0) : ParametricVariation("hypertile3D2", eVariationId::VAR_HYPERTILE3D2, weight, true) { Init(); } @@ -3379,8 +3379,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile3D2_p", 3, INTEGER, 3, T(0x7fffffff))); - m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile3D2_q", 7, INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_P, prefix + "hypertile3D2_p", 3, eParamType::INTEGER, 3, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_Q, prefix + "hypertile3D2_q", 7, eParamType::INTEGER, 3, T(0x7fffffff))); m_Params.push_back(ParamWithName(true, &m_Pa, prefix + "hypertile3D2_pa"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Cx, prefix + "hypertile3D2_cx")); m_Params.push_back(ParamWithName(true, &m_C2, prefix + "hypertile3D2_c2")); @@ -3409,7 +3409,7 @@ template class EMBER_API IDiscVariation : public ParametricVariation { public: - IDiscVariation(T weight = 1.0) : ParametricVariation("idisc", VAR_IDISC, weight, true, true, false, false, true) + IDiscVariation(T weight = 1.0) : ParametricVariation("idisc", eVariationId::VAR_IDISC, weight, true, true, false, false, true) { Init(); } @@ -3475,7 +3475,7 @@ template class EMBER_API Julian2Variation : public ParametricVariation { public: - Julian2Variation(T weight = 1.0) : ParametricVariation("julian2", VAR_JULIAN2, weight) + Julian2Variation(T weight = 1.0) : ParametricVariation("julian2", eVariationId::VAR_JULIAN2, weight) { Init(); } @@ -3550,7 +3550,7 @@ protected: m_Params.push_back(ParamWithName(&m_D, prefix + "julian2_d", 1)); m_Params.push_back(ParamWithName(&m_E, prefix + "julian2_e")); m_Params.push_back(ParamWithName(&m_F, prefix + "julian2_f")); - m_Params.push_back(ParamWithName(&m_Power, prefix + "julian2_power", 2, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "julian2_power", 2, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(&m_Dist, prefix + "julian2_dist", 1)); m_Params.push_back(ParamWithName(true, &m_AbsN, prefix + "julian2_absn"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Cn, prefix + "julian2_cn")); @@ -3576,7 +3576,7 @@ template class EMBER_API JuliaQVariation : public ParametricVariation { public: - JuliaQVariation(T weight = 1.0) : ParametricVariation("juliaq", VAR_JULIAQ, weight, true, false, false, false, true) + JuliaQVariation(T weight = 1.0) : ParametricVariation("juliaq", eVariationId::VAR_JULIAQ, weight, true, false, false, false, true) { Init(); } @@ -3592,7 +3592,7 @@ public: helper.Out.x = r * cosa; helper.Out.y = r * sina; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -3615,7 +3615,7 @@ public: << "\n" << "\t\tvOut.x = r * cosa;\n" << "\t\tvOut.y = r * sina;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -3634,8 +3634,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Power, prefix + "juliaq_power", 3, INTEGER_NONZERO)); - m_Params.push_back(ParamWithName(&m_Divisor, prefix + "juliaq_divisor", 2, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "juliaq_power", 3, eParamType::INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Divisor, prefix + "juliaq_divisor", 2, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(true, &m_HalfInvPower, prefix + "juliaq_half_inv_power"));//Precalc. m_Params.push_back(ParamWithName(true, &m_InvPower, prefix + "juliaq_inv_power")); m_Params.push_back(ParamWithName(true, &m_InvPower2pi, prefix + "juliaq_inv_power_2pi")); @@ -3656,7 +3656,7 @@ template class EMBER_API MurlVariation : public ParametricVariation { public: - MurlVariation(T weight = 1.0) : ParametricVariation("murl", VAR_MURL, weight, true, false, false, false, true) + MurlVariation(T weight = 1.0) : ParametricVariation("murl", eVariationId::VAR_MURL, weight, true, false, false, false, true) { Init(); } @@ -3725,7 +3725,7 @@ protected: m_Params.clear(); m_Params.push_back(ParamWithName(&m_C, prefix + "murl_c")); - m_Params.push_back(ParamWithName(&m_Power, prefix + "murl_power", 2, INTEGER, 2, T(0x7fffffff))); + m_Params.push_back(ParamWithName(&m_Power, prefix + "murl_power", 2, eParamType::INTEGER, 2, T(0x7fffffff))); m_Params.push_back(ParamWithName(true, &m_Cp, prefix + "murl_cp"));//Precalc. m_Params.push_back(ParamWithName(true, &m_P2, prefix + "murl_p2")); m_Params.push_back(ParamWithName(true, &m_Vp, prefix + "murl_vp")); @@ -3746,7 +3746,7 @@ template class EMBER_API Murl2Variation : public ParametricVariation { public: - Murl2Variation(T weight = 1.0) : ParametricVariation("murl2", VAR_MURL2, weight, true, false, false, false, true) + Murl2Variation(T weight = 1.0) : ParametricVariation("murl2", eVariationId::VAR_MURL2, weight, true, false, false, false, true) { Init(); } @@ -3832,8 +3832,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_C, prefix + "murl2_c", 0, REAL, -1, 1)); - m_Params.push_back(ParamWithName(&m_Power, prefix + "murl2_power", 1, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_C, prefix + "murl2_c", 0, eParamType::REAL, -1, 1)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "murl2_power", 1, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(true, &m_P2, prefix + "murl2_p2"));//Precalc. m_Params.push_back(ParamWithName(true, &m_InvP, prefix + "murl2_invp")); m_Params.push_back(ParamWithName(true, &m_InvP2, prefix + "murl2_invp2")); @@ -3856,7 +3856,7 @@ template class EMBER_API NPolarVariation : public ParametricVariation { public: - NPolarVariation(T weight = 1.0) : ParametricVariation("npolar", VAR_NPOLAR, weight, true, false, false, true, false) + NPolarVariation(T weight = 1.0) : ParametricVariation("npolar", eVariationId::VAR_NPOLAR, weight, true, false, false, true, false) { Init(); } @@ -3928,8 +3928,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Parity, prefix + "npolar_parity", 0, INTEGER)); - m_Params.push_back(ParamWithName(&m_N, prefix + "npolar_n", 1, INTEGER)); + m_Params.push_back(ParamWithName(&m_Parity, prefix + "npolar_parity", 0, eParamType::INTEGER)); + m_Params.push_back(ParamWithName(&m_N, prefix + "npolar_n", 1, eParamType::INTEGER)); m_Params.push_back(ParamWithName(true, &m_Nnz, prefix + "npolar_nnz"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Vvar, prefix + "npolar_vvar")); m_Params.push_back(ParamWithName(true, &m_Vvar2, prefix + "npolar_vvar_2")); @@ -3956,7 +3956,7 @@ template class EMBER_API OrthoVariation : public ParametricVariation { public: - OrthoVariation(T weight = 1.0) : ParametricVariation("ortho", VAR_ORTHO, weight, true, false, false, false, true) + OrthoVariation(T weight = 1.0) : ParametricVariation("ortho", eVariationId::VAR_ORTHO, weight, true, false, false, false, true) { Init(); } @@ -4152,8 +4152,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_In, prefix + "ortho_in", 0, REAL_CYCLIC, T(-M_PI), T(M_PI))); - m_Params.push_back(ParamWithName(&m_Out, prefix + "ortho_out", 0, REAL_CYCLIC, T(-M_PI), T(M_PI))); + m_Params.push_back(ParamWithName(&m_In, prefix + "ortho_in", 0, eParamType::REAL_CYCLIC, T(-M_PI), T(M_PI))); + m_Params.push_back(ParamWithName(&m_Out, prefix + "ortho_out", 0, eParamType::REAL_CYCLIC, T(-M_PI), T(M_PI))); } private: @@ -4168,7 +4168,7 @@ template class EMBER_API PoincareVariation : public ParametricVariation { public: - PoincareVariation(T weight = 1.0) : ParametricVariation("poincare", VAR_POINCARE, weight) + PoincareVariation(T weight = 1.0) : ParametricVariation("poincare", eVariationId::VAR_POINCARE, weight) { Init(); } @@ -4232,9 +4232,9 @@ protected: m_Params.clear(); m_Params.push_back(ParamWithName(&m_C1r, prefix + "poincare_c1r", 1)); - m_Params.push_back(ParamWithName(&m_C1a, prefix + "poincare_c1a", -1, REAL_CYCLIC, T(-M_PI), T(M_PI))); + m_Params.push_back(ParamWithName(&m_C1a, prefix + "poincare_c1a", -1, eParamType::REAL_CYCLIC, T(-M_PI), T(M_PI))); m_Params.push_back(ParamWithName(&m_C2r, prefix + "poincare_c2r", 1)); - m_Params.push_back(ParamWithName(&m_C2a, prefix + "poincare_c2a", 1, REAL_CYCLIC, T(-M_PI), T(M_PI))); + m_Params.push_back(ParamWithName(&m_C2a, prefix + "poincare_c2a", 1, eParamType::REAL_CYCLIC, T(-M_PI), T(M_PI))); m_Params.push_back(ParamWithName(true, &m_C1x, prefix + "poincare_c1x"));//Precalc. m_Params.push_back(ParamWithName(true, &m_C1y, prefix + "poincare_c1y")); m_Params.push_back(ParamWithName(true, &m_C2x, prefix + "poincare_c2x")); @@ -4263,7 +4263,7 @@ template class EMBER_API Poincare3DVariation : public ParametricVariation { public: - Poincare3DVariation(T weight = 1.0) : ParametricVariation("poincare3D", VAR_POINCARE3D, weight, true) + Poincare3DVariation(T weight = 1.0) : ParametricVariation("poincare3D", eVariationId::VAR_POINCARE3D, weight, true) { Init(); } @@ -4386,7 +4386,7 @@ template class EMBER_API PolynomialVariation : public ParametricVariation { public: - PolynomialVariation(T weight = 1.0) : ParametricVariation("polynomial", VAR_POLYNOMIAL, weight) + PolynomialVariation(T weight = 1.0) : ParametricVariation("polynomial", eVariationId::VAR_POLYNOMIAL, weight) { Init(); } @@ -4464,7 +4464,7 @@ template class EMBER_API PSphereVariation : public ParametricVariation { public: - PSphereVariation(T weight = 1.0) : ParametricVariation("psphere", VAR_PSPHERE, weight) + PSphereVariation(T weight = 1.0) : ParametricVariation("psphere", eVariationId::VAR_PSPHERE, weight) { Init(); } @@ -4538,7 +4538,7 @@ template class EMBER_API Rational3Variation : public ParametricVariation { public: - Rational3Variation(T weight = 1.0) : ParametricVariation("rational3", VAR_RATIONAL3, weight) + Rational3Variation(T weight = 1.0) : ParametricVariation("rational3", eVariationId::VAR_RATIONAL3, weight) { Init(); } @@ -4636,7 +4636,7 @@ template class EMBER_API RippleVariation : public ParametricVariation { public: - RippleVariation(T weight = 1.0) : ParametricVariation("ripple", VAR_RIPPLE, weight) + RippleVariation(T weight = 1.0) : ParametricVariation("ripple", eVariationId::VAR_RIPPLE, weight) { Init(); } @@ -4674,7 +4674,7 @@ public: //invert the multiplication with scale from before. helper.Out.x = m_Weight * Lerp(u1, u2, m_P) * m_Is;//Original did a direct assignment to outPoint, which is incompatible with Ember's design. helper.Out.y = m_Weight * Lerp(v1, v2, m_P) * m_Is; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -4720,7 +4720,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * Lerp(u1, u2, " << p << ") * " << is << ";\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * Lerp(v1, v2, " << p << ") * " << is << ";\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -4793,7 +4793,7 @@ template class EMBER_API SigmoidVariation : public ParametricVariation { public: - SigmoidVariation(T weight = 1.0) : ParametricVariation("sigmoid", VAR_SIGMOID, weight) + SigmoidVariation(T weight = 1.0) : ParametricVariation("sigmoid", eVariationId::VAR_SIGMOID, weight) { Init(); } @@ -4913,7 +4913,7 @@ template class EMBER_API SinusGridVariation : public ParametricVariation { public: - SinusGridVariation(T weight = 1.0) : ParametricVariation("sinusgrid", VAR_SINUS_GRID, weight) + SinusGridVariation(T weight = 1.0) : ParametricVariation("sinusgrid", eVariationId::VAR_SINUS_GRID, weight) { Init(); } @@ -5013,7 +5013,7 @@ template class EMBER_API StwinVariation : public ParametricVariation { public: - StwinVariation(T weight = 1.0) : ParametricVariation("stwin", VAR_STWIN, weight) + StwinVariation(T weight = 1.0) : ParametricVariation("stwin", eVariationId::VAR_STWIN, weight) { Init(); } @@ -5095,7 +5095,7 @@ template class EMBER_API TwoFaceVariation : public Variation { public: - TwoFaceVariation(T weight = 1.0) : Variation("twoface", VAR_TWO_FACE, weight, true) { } + TwoFaceVariation(T weight = 1.0) : Variation("twoface", eVariationId::VAR_TWO_FACE, weight, true) { } VARCOPY(TwoFaceVariation) @@ -5138,7 +5138,7 @@ template class EMBER_API UnpolarVariation : public ParametricVariation { public: - UnpolarVariation(T weight = 1.0) : ParametricVariation("unpolar", VAR_UNPOLAR, weight) + UnpolarVariation(T weight = 1.0) : ParametricVariation("unpolar", eVariationId::VAR_UNPOLAR, weight) { Init(); } @@ -5202,7 +5202,7 @@ template class EMBER_API WavesNVariation : public ParametricVariation { public: - WavesNVariation(T weight = 1.0) : ParametricVariation("wavesn", VAR_WAVESN, weight, true, false, false, false, true) + WavesNVariation(T weight = 1.0) : ParametricVariation("wavesn", eVariationId::VAR_WAVESN, weight, true, false, false, false, true) { Init(); } @@ -5285,7 +5285,7 @@ protected: m_Params.push_back(ParamWithName(&m_ScaleY, prefix + "wavesn_scaley", 1)); m_Params.push_back(ParamWithName(&m_IncX, prefix + "wavesn_incx")); m_Params.push_back(ParamWithName(&m_IncY, prefix + "wavesn_incy")); - m_Params.push_back(ParamWithName(&m_Power, prefix + "wavesn_power", 1, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "wavesn_power", 1, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(true, &m_AbsN, prefix + "wavesn_absn"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Cn, prefix + "wavesn_cn")); } @@ -5309,7 +5309,7 @@ template class EMBER_API XHeartVariation : public ParametricVariation { public: - XHeartVariation(T weight = 1.0) : ParametricVariation("xheart", VAR_XHEART, weight, true) + XHeartVariation(T weight = 1.0) : ParametricVariation("xheart", eVariationId::VAR_XHEART, weight, true) { Init(); } @@ -5418,7 +5418,7 @@ template class EMBER_API BarycentroidVariation : public ParametricVariation { public: - BarycentroidVariation(T weight = 1.0) : ParametricVariation("barycentroid", VAR_BARYCENTROID, weight) + BarycentroidVariation(T weight = 1.0) : ParametricVariation("barycentroid", eVariationId::VAR_BARYCENTROID, weight) { Init(); } @@ -5513,7 +5513,7 @@ template class EMBER_API BiSplitVariation : public ParametricVariation { public: - BiSplitVariation(T weight = 1.0) : ParametricVariation("bisplit", VAR_BISPLIT, weight) + BiSplitVariation(T weight = 1.0) : ParametricVariation("bisplit", eVariationId::VAR_BISPLIT, weight) { Init(); } @@ -5569,7 +5569,7 @@ template class EMBER_API CrescentsVariation : public Variation { public: - CrescentsVariation(T weight = 1.0) : Variation("crescents", VAR_CRESCENTS, weight) { } + CrescentsVariation(T weight = 1.0) : Variation("crescents", eVariationId::VAR_CRESCENTS, weight) { } VARCOPY(CrescentsVariation) @@ -5617,7 +5617,7 @@ template class EMBER_API MaskVariation : public Variation { public: - MaskVariation(T weight = 1.0) : Variation("mask", VAR_MASK, weight, true) { } + MaskVariation(T weight = 1.0) : Variation("mask", eVariationId::VAR_MASK, weight, true) { } VARCOPY(MaskVariation) @@ -5667,7 +5667,7 @@ template class EMBER_API Cpow2Variation : public ParametricVariation { public: - Cpow2Variation(T weight = 1.0) : ParametricVariation("cpow2", VAR_CPOW2, weight, true, false, false, false, true) + Cpow2Variation(T weight = 1.0) : ParametricVariation("cpow2", eVariationId::VAR_CPOW2, weight, true, false, false, false, true) { Init(); } @@ -5757,8 +5757,8 @@ protected: m_Params.clear(); m_Params.push_back(ParamWithName(&m_R, prefix + "cpow2_r", 1)); m_Params.push_back(ParamWithName(&m_A, prefix + "cpow2_a")); - m_Params.push_back(ParamWithName(&m_Divisor, prefix + "cpow2_divisor", 1, INTEGER_NONZERO)); - m_Params.push_back(ParamWithName(&m_Spread, prefix + "cpow2_spread", 1, INTEGER, 1, T(0x7FFFFFFF))); + m_Params.push_back(ParamWithName(&m_Divisor, prefix + "cpow2_divisor", 1, eParamType::INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Spread, prefix + "cpow2_spread", 1, eParamType::INTEGER, 1, T(0x7FFFFFFF))); m_Params.push_back(ParamWithName(true, &m_C, prefix + "cpow2_c"));//Precalc. m_Params.push_back(ParamWithName(true, &m_HalfC, prefix + "cpow2_halfc")); m_Params.push_back(ParamWithName(true, &m_D, prefix + "cpow2_d")); @@ -5785,18 +5785,18 @@ private: MAKEPREPOSTVAR(Hemisphere, hemisphere, HEMISPHERE) MAKEPREPOSTPARVAR(Epispiral, epispiral, EPISPIRAL) MAKEPREPOSTPARVAR(Bwraps, bwraps, BWRAPS) -MAKEPREPOSTVARASSIGN(BlurCircle, blur_circle, BLUR_CIRCLE, ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(BlurCircle, blur_circle, BLUR_CIRCLE, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(BlurZoom, blur_zoom, BLUR_ZOOM) MAKEPREPOSTPARVAR(BlurPixelize, blur_pixelize, BLUR_PIXELIZE) MAKEPREPOSTPARVAR(Crop, crop, CROP) MAKEPREPOSTPARVAR(BCircle, bcircle, BCIRCLE) MAKEPREPOSTPARVAR(BlurLinear, blur_linear, BLUR_LINEAR) -MAKEPREPOSTPARVARASSIGN(BlurSquare, blur_square, BLUR_SQUARE, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(BlurSquare, blur_square, BLUR_SQUARE, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTVAR(Flatten, flatten, FLATTEN) -MAKEPREPOSTVARASSIGN(Zblur, zblur, ZBLUR, ASSIGNTYPE_SUM) -MAKEPREPOSTVARASSIGN(Blur3D, blur3D, BLUR3D, ASSIGNTYPE_SUM) -MAKEPREPOSTVARASSIGN(ZScale, zscale, ZSCALE, ASSIGNTYPE_SUM) -MAKEPREPOSTVARASSIGN(ZTranslate, ztranslate, ZTRANSLATE, ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(Zblur, zblur, ZBLUR, eVariationAssignType::ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(Blur3D, blur3D, BLUR3D, eVariationAssignType::ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(ZScale, zscale, ZSCALE, eVariationAssignType::ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(ZTranslate, ztranslate, ZTRANSLATE, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTVAR(ZCone, zcone, ZCONE) MAKEPREPOSTVAR(Spherical3D, Spherical3D, SPHERICAL3D) MAKEPREPOSTPARVAR(Curl3D, curl3D, CURL3D) diff --git a/Source/Ember/Variations03.h b/Source/Ember/Variations03.h index 97e2767..94f93e0 100644 --- a/Source/Ember/Variations03.h +++ b/Source/Ember/Variations03.h @@ -11,7 +11,7 @@ template class EMBER_API FunnelVariation : public ParametricVariation { public: - FunnelVariation(T weight = 1.0) : ParametricVariation("funnel", VAR_FUNNEL, weight) + FunnelVariation(T weight = 1.0) : ParametricVariation("funnel", eVariationId::VAR_FUNNEL, weight) { Init(); } @@ -21,7 +21,6 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T temp = 1 / Zeps(cos(helper.In.y)) + m_Effect * T(M_PI); - helper.Out.x = m_Weight * (tanh(helper.In.x) * temp); helper.Out.y = m_Weight * (tanh(helper.In.y) * temp); helper.Out.z = m_Weight * helper.In.z; @@ -34,7 +33,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string effect = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t temp = 1 / Zeps(cos(vIn.y)) + " << effect << " * M_PI;\n" << "\n" @@ -42,7 +40,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (tanh(vIn.y) * temp);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -55,9 +52,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Effect, prefix + "funnel_effect", 8, INTEGER)); + m_Params.push_back(ParamWithName(&m_Effect, prefix + "funnel_effect", 8, eParamType::INTEGER)); } private: @@ -71,7 +67,7 @@ template class EMBER_API Linear3DVariation : public Variation { public: - Linear3DVariation(T weight = 1.0) : Variation("linear3D", VAR_LINEAR3D, weight) { } + Linear3DVariation(T weight = 1.0) : Variation("linear3D", eVariationId::VAR_LINEAR3D, weight) { } VARCOPY(Linear3DVariation) @@ -86,13 +82,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -104,7 +98,7 @@ template class EMBER_API PowBlockVariation : public ParametricVariation { public: - PowBlockVariation(T weight = 1.0) : ParametricVariation("pow_block", VAR_POW_BLOCK, weight, true, false, false, false, true) + PowBlockVariation(T weight = 1.0) : ParametricVariation("pow_block", eVariationId::VAR_POW_BLOCK, weight, true, false, false, false, true) { Init(); } @@ -115,7 +109,6 @@ public: { T r2 = std::pow(helper.m_PrecalcSumSquares, m_Power * T(0.5)) * m_Weight; T ran = (helper.m_PrecalcAtanyx / Zeps(m_Denominator) + (m_Root * M_2PI * Floor(rand.Frand01() * m_Denominator) / Zeps(m_Denominator))) * m_Numerator; - helper.Out.x = r2 * std::cos(ran); helper.Out.y = r2 * std::sin(ran); helper.Out.z = m_Weight * helper.In.z; @@ -133,7 +126,6 @@ public: string correctN = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string correctD = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r2 = pow(precalcSumSquares, " << power << " * (real_t)(0.5)) * xform->m_VariationWeights[" << varIndex << "];\n" << "\t\treal_t ran = (precalcAtanyx / Zeps(" << denominator << ") + (" << root << " * M_2PI * floor(MwcNext01(mwc) * " << denominator << ") / Zeps(" << denominator << "))) * " << numerator << ";\n" @@ -142,7 +134,6 @@ public: << "\t\tvOut.y = r2 * sin(ran);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -160,7 +151,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Numerator, prefix + "pow_block_numerator", 3));//Original used a prefix of pow_, which is incompatible with Ember's design. m_Params.push_back(ParamWithName(&m_Denominator, prefix + "pow_block_denominator", 2)); @@ -186,7 +176,7 @@ template class EMBER_API SquirrelVariation : public ParametricVariation { public: - SquirrelVariation(T weight = 1.0) : ParametricVariation("squirrel", VAR_SQUIRREL, weight) + SquirrelVariation(T weight = 1.0) : ParametricVariation("squirrel", eVariationId::VAR_SQUIRREL, weight) { Init(); } @@ -196,7 +186,6 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T u = std::sqrt(ClampGte0(Zeps(m_A) * SQR(helper.In.x) + Zeps(m_B) * SQR(helper.In.y)));//Original did not clamp. - helper.Out.x = std::cos(u) * SafeTan(helper.In.x) * m_Weight; helper.Out.y = std::sin(u) * SafeTan(helper.In.y) * m_Weight; helper.Out.z = m_Weight * helper.In.z; @@ -210,7 +199,6 @@ public: string index = ss2.str(); string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t u = sqrt(ClampGte(Zeps(" << a << ") * SQR(vIn.x) + Zeps(" << b << ") * SQR(vIn.y), (real_t)(0.0)));\n" << "\n" @@ -218,7 +206,6 @@ public: << "\t\tvOut.y = sin(u) * tan(vIn.y) * xform->m_VariationWeights[" << varIndex << "];\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -231,7 +218,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_A, prefix + "squirrel_a", 1)); m_Params.push_back(ParamWithName(&m_B, prefix + "squirrel_b", 1)); @@ -249,7 +235,7 @@ template class EMBER_API EnnepersVariation : public Variation { public: - EnnepersVariation(T weight = 1.0) : Variation("ennepers", VAR_ENNEPERS, weight) { } + EnnepersVariation(T weight = 1.0) : Variation("ennepers", eVariationId::VAR_ENNEPERS, weight) { } VARCOPY(EnnepersVariation) @@ -264,13 +250,11 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (vIn.x - ((SQR(vIn.x) * vIn.x) / 3)) + vIn.x * SQR(vIn.y);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (vIn.y - ((SQR(vIn.y) * vIn.y) / 3)) + vIn.y * SQR(vIn.x);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -282,7 +266,7 @@ template class EMBER_API SphericalNVariation : public ParametricVariation { public: - SphericalNVariation(T weight = 1.0) : ParametricVariation("SphericalN", VAR_SPHERICALN, weight, true, true, false, false, true) + SphericalNVariation(T weight = 1.0) : ParametricVariation("SphericalN", eVariationId::VAR_SPHERICALN, weight, true, true, false, false, true) { Init(); } @@ -296,7 +280,6 @@ public: T alpha = helper.m_PrecalcAtanyx + n * M_2PI / Zeps(T(Floor(m_Power))); T sina = std::sin(alpha); T cosa = std::cos(alpha); - helper.Out.x = m_Weight * cosa / r; helper.Out.y = m_Weight * sina / r; helper.Out.z = m_Weight * helper.In.z; @@ -310,7 +293,6 @@ public: string index = ss2.str(); string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r = Zeps(pow(precalcSqrtSumSquares, " << dist << "));\n" << "\t\tint n = floor(" << power << " * MwcNext01(mwc));\n" @@ -322,7 +304,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sina / r;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -335,7 +316,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Power, prefix + "SphericalN_Power", 1)); m_Params.push_back(ParamWithName(&m_Dist, prefix + "SphericalN_Dist", 1)); @@ -353,7 +333,7 @@ template class EMBER_API KaleidoscopeVariation : public ParametricVariation { public: - KaleidoscopeVariation(T weight = 1.0) : ParametricVariation("Kaleidoscope", VAR_KALEIDOSCOPE, weight) + KaleidoscopeVariation(T weight = 1.0) : ParametricVariation("Kaleidoscope", eVariationId::VAR_KALEIDOSCOPE, weight) { Init(); } @@ -364,7 +344,6 @@ public: { T sin45 = std::sin(45 * DEG_2_RAD_T);//Was 45 radians? They probably meant to convert this from degrees. T cos45 = std::cos(45 * DEG_2_RAD_T); - helper.Out.x = ((m_Rotate * helper.In.x) * cos45 - helper.In.y * sin45 + m_LineUp) + m_X; //The if function splits the plugin in two. @@ -387,7 +366,6 @@ public: string lineUp = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t sin45 = sin(45 * DEG_2_RAD);\n" << "\t\treal_t cos45 = cos(45 * DEG_2_RAD);\n" @@ -401,7 +379,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -409,7 +386,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Pull, prefix + "Kaleidoscope_pull")); m_Params.push_back(ParamWithName(&m_Rotate, prefix + "Kaleidoscope_rotate", 1)); @@ -433,7 +409,7 @@ template class EMBER_API GlynnSim1Variation : public ParametricVariation { public: - GlynnSim1Variation(T weight = 1.0) : ParametricVariation("GlynnSim1", VAR_GLYNNSIM1, weight, true, true) + GlynnSim1Variation(T weight = 1.0) : ParametricVariation("GlynnSim1", eVariationId::VAR_GLYNNSIM1, weight, true, true) { Init(); } @@ -497,7 +473,6 @@ public: string pow = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string x1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string y1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t x, y, z;\n" << "\n" @@ -539,7 +514,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -569,7 +543,6 @@ public: T val = DEG_2_RAD_T * m_Phi1; T sinPhi1 = std::sin(val); T cosPhi1 = std::cos(val); - m_Pow = fabs(m_Pow); m_X1 = m_Radius * cosPhi1; m_Y1 = m_Radius * sinPhi1; @@ -579,14 +552,13 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Radius, prefix + "GlynnSim1_radius", 1)); m_Params.push_back(ParamWithName(&m_Radius1, prefix + "GlynnSim1_radius1", T(0.1))); m_Params.push_back(ParamWithName(&m_Phi1, prefix + "GlynnSim1_phi1")); - m_Params.push_back(ParamWithName(&m_Thickness, prefix + "GlynnSim1_thickness", T(0.1), REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Thickness, prefix + "GlynnSim1_thickness", T(0.1), eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(&m_Contrast, prefix + "GlynnSim1_contrast", T(1.5))); - m_Params.push_back(ParamWithName(&m_Pow, prefix + "GlynnSim1_pow", T(0.5), REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Pow, prefix + "GlynnSim1_pow", T(0.5), eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(true, &m_X1, prefix + "GlynnSim1_x1"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Y1, prefix + "GlynnSim1_y1")); } @@ -598,7 +570,6 @@ private: T phi = M_2PI * rand.Frand01(); T sinPhi = std::sin(phi); T cosPhi = std::cos(phi); - *x = r * cosPhi + m_X1; *y = r * sinPhi + m_Y1; } @@ -620,7 +591,7 @@ template class EMBER_API GlynnSim2Variation : public ParametricVariation { public: - GlynnSim2Variation(T weight = 1.0) : ParametricVariation("GlynnSim2", VAR_GLYNNSIM2, weight, true, true) + GlynnSim2Variation(T weight = 1.0) : ParametricVariation("GlynnSim2", eVariationId::VAR_GLYNNSIM2, weight, true, true) { Init(); } @@ -633,7 +604,7 @@ public: if (helper.m_PrecalcSqrtSumSquares < m_Radius) { - Circle(rand, &x,&y); + Circle(rand, &x, &y); helper.Out.x = m_Weight * x; helper.Out.y = m_Weight * y; } @@ -672,7 +643,6 @@ public: string phi20 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string gamma = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string delta = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t x, y;\n" << "\n" @@ -700,7 +670,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -738,11 +707,10 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Radius, prefix + "GlynnSim2_radius", 1)); - m_Params.push_back(ParamWithName(&m_Thickness, prefix + "GlynnSim2_thickness", T(0.1), REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_Contrast, prefix + "GlynnSim2_contrast", T(0.5), REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Thickness, prefix + "GlynnSim2_thickness", T(0.1), eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Contrast, prefix + "GlynnSim2_contrast", T(0.5), eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(&m_Pow, prefix + "GlynnSim2_pow", T(1.5))); m_Params.push_back(ParamWithName(&m_Phi1, prefix + "GlynnSim2_Phi1")); m_Params.push_back(ParamWithName(&m_Phi2, prefix + "GlynnSim2_Phi2", 360)); @@ -759,7 +727,6 @@ private: T phi = m_Phi10 + m_Delta * rand.Frand01(); T sinPhi = std::sin(phi); T cosPhi = std::cos(phi); - *x = r * cosPhi; *y = r * sinPhi; } @@ -783,7 +750,7 @@ template class EMBER_API GlynnSim3Variation : public ParametricVariation { public: - GlynnSim3Variation(T weight = 1.0) : ParametricVariation("GlynnSim3", VAR_GLYNNSIM3, weight, true, true) + GlynnSim3Variation(T weight = 1.0) : ParametricVariation("GlynnSim3", eVariationId::VAR_GLYNNSIM3, weight, true, true) { Init(); } @@ -796,7 +763,7 @@ public: if (helper.m_PrecalcSqrtSumSquares < m_Radius1) { - Circle(rand, &x,&y); + Circle(rand, &x, &y); helper.Out.x = m_Weight * x; helper.Out.y = m_Weight * y; } @@ -833,7 +800,6 @@ public: string radius1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string radius2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string gamma = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t x, y;\n" << "\n" @@ -861,7 +827,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -902,12 +867,11 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Radius, prefix + "GlynnSim3_radius", 1)); m_Params.push_back(ParamWithName(&m_Thickness, prefix + "GlynnSim3_thickness", T(0.1))); m_Params.push_back(ParamWithName(&m_Thickness2, prefix + "GlynnSim3_thickness2", T(0.1))); - m_Params.push_back(ParamWithName(&m_Contrast, prefix + "GlynnSim3_contrast", T(0.5), REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Contrast, prefix + "GlynnSim3_contrast", T(0.5), eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(&m_Pow, prefix + "GlynnSim3_pow", T(1.5))); m_Params.push_back(ParamWithName(true, &m_Radius1, prefix + "GlynnSim3_radius1"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Radius2, prefix + "GlynnSim3_radius2")); @@ -948,7 +912,7 @@ template class EMBER_API StarblurVariation : public ParametricVariation { public: - StarblurVariation(T weight = 1.0) : ParametricVariation("starblur", VAR_STARBLUR, weight) + StarblurVariation(T weight = 1.0) : ParametricVariation("starblur", eVariationId::VAR_STARBLUR, weight) { Init(); } @@ -959,9 +923,7 @@ public: { T f = rand.Frand01() * m_Power * 2; T angle = T(int(f)); - f -= angle; - T x = f * m_Length; T z = std::sqrt(1 + SQR(x) - 2 * x * std::cos(m_Alpha)); @@ -971,9 +933,7 @@ public: angle = M_2PI / m_Power * (int(angle) / 2) - std::asin(std::sin(m_Alpha) * x / z); z *= std::sqrt(rand.Frand01()); - T temp = angle - T(M_PI_2); - helper.Out.x = m_Weight * z * std::cos(temp); helper.Out.y = m_Weight * z * std::sin(temp); helper.Out.z = m_Weight * helper.In.z; @@ -989,7 +949,6 @@ public: string range = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string length = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string alpha = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t f = MwcNext01(mwc) * " << power << " * 2;\n" << "\t\treal_t angle = (real_t)(int)(f);\n" @@ -1012,7 +971,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * z * sin(temp);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1027,9 +985,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Power, prefix + "starblur_power", 5, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "starblur_power", 5, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(&m_Range, prefix + "starblur_range", T(0.4016228317))); m_Params.push_back(ParamWithName(true, &m_Length, prefix + "starblur_length"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Alpha, prefix + "starblur_alpha")); @@ -1049,7 +1006,7 @@ template class EMBER_API SineblurVariation : public ParametricVariation { public: - SineblurVariation(T weight = 1.0) : ParametricVariation("sineblur", VAR_SINEBLUR, weight) + SineblurVariation(T weight = 1.0) : ParametricVariation("sineblur", eVariationId::VAR_SINEBLUR, weight) { Init(); } @@ -1062,7 +1019,6 @@ public: T s = std::sin(ang); T c = std::cos(ang); T r = m_Weight * (m_Power == 1 ? std::acos(rand.Frand01() * 2 - 1) / T(M_PI) : std::acos(std::exp(std::log(rand.Frand01()) * m_Power) * 2 - 1) / T(M_PI)); - helper.Out.x = r * c; helper.Out.y = r * s; helper.Out.z = m_Weight * helper.In.z; @@ -1075,7 +1031,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t ang = MwcNext01(mwc) * M_2PI;\n" << "\t\treal_t s = sin(ang);\n" @@ -1086,7 +1041,6 @@ public: << "\t\tvOut.y = r * s;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1094,9 +1048,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Power, prefix + "sineblur_power", 1, REAL, 0)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "sineblur_power", 1, eParamType::REAL, 0)); } private: @@ -1110,7 +1063,7 @@ template class EMBER_API CircleblurVariation : public Variation { public: - CircleblurVariation(T weight = 1.0) : Variation("circleblur", VAR_CIRCLEBLUR, weight) { } + CircleblurVariation(T weight = 1.0) : Variation("circleblur", eVariationId::VAR_CIRCLEBLUR, weight) { } VARCOPY(CircleblurVariation) @@ -1118,7 +1071,6 @@ public: { T rad = std::sqrt(rand.Frand01()); T temp = rand.Frand01() * M_2PI; - helper.Out.x = m_Weight * std::cos(temp) * rad; helper.Out.y = m_Weight * std::sin(temp) * rad; helper.Out.z = m_Weight * helper.In.z; @@ -1128,7 +1080,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t rad = sqrt(MwcNext01(mwc));\n" << "\t\treal_t temp = MwcNext01(mwc) * M_2PI;\n" @@ -1137,7 +1088,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(temp) * rad;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -1149,7 +1099,7 @@ template class EMBER_API DepthVariation : public ParametricVariation { public: - DepthVariation(T weight = 1.0) : ParametricVariation("depth", VAR_DEPTH, weight) + DepthVariation(T weight = 1.0) : ParametricVariation("depth", eVariationId::VAR_DEPTH, weight) { Init(); } @@ -1175,7 +1125,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t coeff = fabs(vIn.z);\n" << "\n" @@ -1186,7 +1135,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (transY + vIn.y * coeff);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (transZ + vIn.z * coeff);\n" << "\t}\n"; - return ss.str(); } @@ -1194,7 +1142,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Power, prefix + "depth_power", 1)); } @@ -1210,7 +1157,7 @@ template class EMBER_API CropNVariation : public ParametricVariation { public: - CropNVariation(T weight = 1.0) : ParametricVariation("cropn", VAR_CROPN, weight, true, true, false, false, true) + CropNVariation(T weight = 1.0) : ParametricVariation("cropn", eVariationId::VAR_CROPN, weight, true, true, false, false, true) { Init(); } @@ -1220,10 +1167,8 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T xang = (helper.m_PrecalcAtanyx + T(M_PI)) / m_Alpha; - xang = (xang - int(xang)) * m_Alpha; xang = std::cos((xang < m_Alpha / 2) ? xang : m_Alpha - xang); - T xr = xang > 0 ? m_Radius / xang : 1; if ((helper.m_PrecalcSqrtSumSquares > xr) == (m_Power > 0)) @@ -1235,7 +1180,6 @@ public: else { T rdc = xr + (rand.Frand01() * T(0.5) * m_ScatterDist); - helper.Out.x = m_Weight * rdc * std::cos(helper.m_PrecalcAtanyx); helper.Out.y = m_Weight * rdc * std::sin(helper.m_PrecalcAtanyx); } @@ -1261,7 +1205,6 @@ public: string zero = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string workPower = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string alpha = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t xang = (precalcAtanyx + M_PI) / " << alpha << ";\n" << "\n" @@ -1292,14 +1235,12 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } virtual void Precalc() override { bool mode = m_Power > 0; - m_WorkPower = mode ? m_Power : -m_Power; ClampGteRef(m_WorkPower, 2); m_Alpha = M_2PI / m_WorkPower; @@ -1309,12 +1250,11 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Power, prefix + "cropn_power", -5)); m_Params.push_back(ParamWithName(&m_Radius, prefix + "cropn_radius", 1)); m_Params.push_back(ParamWithName(&m_ScatterDist, prefix + "cropn_scatterdist")); - m_Params.push_back(ParamWithName(&m_Zero, prefix + "cropn_zero", 0, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Zero, prefix + "cropn_zero", 0, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(true, &m_WorkPower, prefix + "cropn_workpower"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Alpha, prefix + "cropn_alpha")); } @@ -1335,7 +1275,7 @@ template class EMBER_API ShredRadVariation : public ParametricVariation { public: - ShredRadVariation(T weight = 1.0) : ParametricVariation("shredrad", VAR_SHRED_RAD, weight, true, true, false, false, true) + ShredRadVariation(T weight = 1.0) : ParametricVariation("shredrad", eVariationId::VAR_SHRED_RAD, weight, true, true, false, false, true) { Init(); } @@ -1346,7 +1286,6 @@ public: { T xang = (helper.m_PrecalcAtanyx + M_3PI + m_Alpha / 2) / m_Alpha; T zang = ((xang - int(xang)) * m_Width + int(xang)) * m_Alpha - T(M_PI) - m_Alpha / 2 * m_Width; - helper.Out.x = m_Weight * helper.m_PrecalcSqrtSumSquares * std::cos(zang); helper.Out.y = m_Weight * helper.m_PrecalcSqrtSumSquares * std::sin(zang); helper.Out.z = m_Weight * helper.In.z; @@ -1361,7 +1300,6 @@ public: string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string width = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string alpha = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t xang = (precalcAtanyx + M_3PI + " << alpha << " / 2) / " << alpha << ";\n" << "\t\treal_t zang = ((xang - (int)xang) * " << width << " + (int)xang) * " << alpha << " - M_PI - " << alpha << " / 2 * " << width << ";\n" @@ -1370,7 +1308,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * precalcSqrtSumSquares * sin(zang);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1383,10 +1320,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_N, prefix + "shredrad_n", 4, REAL_NONZERO)); - m_Params.push_back(ParamWithName(&m_Width, prefix + "shredrad_width", T(0.5), REAL, -1, 1)); + m_Params.push_back(ParamWithName(&m_N, prefix + "shredrad_n", 4, eParamType::REAL_NONZERO)); + m_Params.push_back(ParamWithName(&m_Width, prefix + "shredrad_width", T(0.5), eParamType::REAL, -1, 1)); m_Params.push_back(ParamWithName(true, &m_Alpha, prefix + "shredrad_alpha"));//Precalc. } @@ -1403,7 +1339,7 @@ template class EMBER_API Blob2Variation : public ParametricVariation { public: - Blob2Variation(T weight = 1.0) : ParametricVariation("blob2", VAR_BLOB2, weight, true, true, false, false, true) + Blob2Variation(T weight = 1.0) : ParametricVariation("blob2", eVariationId::VAR_BLOB2, weight, true, true, false, false, true) { Init(); } @@ -1428,7 +1364,6 @@ public: delta = std::exp(m_Prescale * std::log(delta * positive)) * m_Postscale * positive; T rad = m_Radius + (helper.m_PrecalcSqrtSumSquares - m_Radius) * delta; - helper.Out.x = m_Weight * rad * std::cos(helper.m_PrecalcAtanyx); helper.Out.y = m_Weight * rad * std::sin(helper.m_PrecalcAtanyx); helper.Out.z = m_Weight * helper.In.z; @@ -1450,7 +1385,6 @@ public: string symmetry = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string comp = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string dataHelp = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tif (precalcSqrtSumSquares < " << radius << ")\n" << "\t\t{\n" @@ -1475,7 +1409,6 @@ public: //<< "\t\t transZ += xform->m_VariationWeights[" << varIndex << "] * outPoint->m_Z;\n"//Original had this which is probably wrong. << "\t\t}\n" << "\t}\n"; - return ss.str(); } @@ -1488,15 +1421,14 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Mode, prefix + "blob2_mode", 0, INTEGER, -1, 1)); - m_Params.push_back(ParamWithName(&m_N, prefix + "blob2_n", 5, INTEGER)); + m_Params.push_back(ParamWithName(&m_Mode, prefix + "blob2_mode", 0, eParamType::INTEGER, -1, 1)); + m_Params.push_back(ParamWithName(&m_N, prefix + "blob2_n", 5, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_Radius, prefix + "blob2_radius")); m_Params.push_back(ParamWithName(&m_Prescale, prefix + "blob2_prescale", 1)); m_Params.push_back(ParamWithName(&m_Postscale, prefix + "blob2_postscale", T(0.5))); - m_Params.push_back(ParamWithName(&m_Symmetry, prefix + "blob2_symmetry", 0, REAL, -1, 1)); - m_Params.push_back(ParamWithName(&m_Compensation, prefix + "blob2_compensation", 0, REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Symmetry, prefix + "blob2_symmetry", 0, eParamType::REAL, -1, 1)); + m_Params.push_back(ParamWithName(&m_Compensation, prefix + "blob2_compensation", 0, eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(true, &m_DeltaHelp, prefix + "blob2_deltahelp"));//Precalc. } @@ -1518,7 +1450,7 @@ template class EMBER_API Julia3DVariation : public ParametricVariation { public: - Julia3DVariation(T weight = 1.0) : ParametricVariation("julia3D", VAR_JULIA3D, weight, true, true, false, false, true) + Julia3DVariation(T weight = 1.0) : ParametricVariation("julia3D", eVariationId::VAR_JULIA3D, weight, true, true, false, false, true) { Init(); } @@ -1531,7 +1463,6 @@ public: T r = m_Weight * std::pow(helper.m_PrecalcSumSquares + SQR(z), m_Cn); T tmp = r * helper.m_PrecalcSqrtSumSquares; T ang = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand(uint(m_AbsN))) / m_N; - helper.Out.x = tmp * std::cos(ang); helper.Out.y = tmp * std::sin(ang); helper.Out.z = r * z; @@ -1546,7 +1477,6 @@ public: string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string absn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t z = vIn.z / " << absn << ";\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * pow(precalcSumSquares + SQR(z), " << cn << ");\n" @@ -1557,7 +1487,6 @@ public: << "\t\tvOut.y = tmp * sin(ang);\n" << "\t\tvOut.z = r * z;\n" << "\t}\n"; - return ss.str(); } @@ -1579,9 +1508,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_N, prefix + "julia3D_power", 2, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_N, prefix + "julia3D_power", 2, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(true, &m_AbsN, prefix + "julia3D_absn"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Cn, prefix + "julia3D_cn")); } @@ -1599,7 +1527,7 @@ template class EMBER_API Julia3DzVariation : public ParametricVariation { public: - Julia3DzVariation(T weight = 1.0) : ParametricVariation("julia3Dz", VAR_JULIA3DZ, weight, true, true, false, false, true) + Julia3DzVariation(T weight = 1.0) : ParametricVariation("julia3Dz", eVariationId::VAR_JULIA3DZ, weight, true, true, false, false, true) { Init(); } @@ -1610,7 +1538,6 @@ public: { T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn); T temp = (helper.m_PrecalcAtanyx + M_2PI * rand.Rand(uint(m_AbsN))) / m_N; - helper.Out.x = r * std::cos(temp); helper.Out.y = r * std::sin(temp); helper.Out.z = r * helper.In.z / (helper.m_PrecalcSqrtSumSquares * m_AbsN); @@ -1625,7 +1552,6 @@ public: string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string absn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] * pow(precalcSumSquares, " << cn << ");\n" << "\t\treal_t temp = (precalcAtanyx + M_2PI * MwcNextRange(mwc, (uint)" << absn << ")) / " << n << ";\n" @@ -1634,7 +1560,6 @@ public: << "\t\tvOut.y = r * sin(temp);\n" << "\t\tvOut.z = r * vIn.z / (precalcSqrtSumSquares * " << absn << ");\n" << "\t}\n"; - return ss.str(); } @@ -1656,9 +1581,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_N, prefix + "julia3Dz_power", 2, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_N, prefix + "julia3Dz_power", 2, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(true, &m_AbsN, prefix + "julia3Dz_absn"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Cn, prefix + "julia3Dz_cn")); } @@ -1676,7 +1600,7 @@ template class EMBER_API LinearTVariation : public ParametricVariation { public: - LinearTVariation(T weight = 1.0) : ParametricVariation("linearT", VAR_LINEAR_T, weight) + LinearTVariation(T weight = 1.0) : ParametricVariation("linearT", eVariationId::VAR_LINEAR_T, weight) { Init(); } @@ -1687,7 +1611,7 @@ public: { helper.Out.x = SignNz(helper.In.x) * std::pow(fabs(helper.In.x), m_PowX) * m_Weight; helper.Out.y = SignNz(helper.In.y) * std::pow(fabs(helper.In.y), m_PowY) * m_Weight; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1698,13 +1622,11 @@ public: string index = ss2.str(); string powx = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string powy = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tvOut.x = SignNz(vIn.x) * pow(fabs(vIn.x), " << powx << ") * xform->m_VariationWeights[" << varIndex << "];\n" << "\t\tvOut.y = SignNz(vIn.y) * pow(fabs(vIn.y), " << powy << ") * xform->m_VariationWeights[" << varIndex << "];\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; - return ss.str(); } @@ -1717,7 +1639,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_PowX, prefix + "linearT_powX", 1));//Original used a prefix of lT, which is incompatible with Ember's design. m_Params.push_back(ParamWithName(&m_PowY, prefix + "linearT_powY", 1)); @@ -1735,7 +1656,7 @@ template class EMBER_API LinearT3DVariation : public ParametricVariation { public: - LinearT3DVariation(T weight = 1.0) : ParametricVariation("linearT3D", VAR_LINEAR_T3D, weight) + LinearT3DVariation(T weight = 1.0) : ParametricVariation("linearT3D", eVariationId::VAR_LINEAR_T3D, weight) { Init(); } @@ -1758,13 +1679,11 @@ public: string powx = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string powy = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string powz = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tvOut.x = (real_t)(vIn.x < 0 ? -1 : 1) * pow(fabs(vIn.x), " << powx << ") * xform->m_VariationWeights[" << varIndex << "];\n" << "\t\tvOut.y = (real_t)(vIn.y < 0 ? -1 : 1) * pow(fabs(vIn.y), " << powy << ") * xform->m_VariationWeights[" << varIndex << "];\n" << "\t\tvOut.z = (real_t)(vIn.z < 0 ? -1 : 1) * pow(fabs(vIn.z), " << powz << ") * xform->m_VariationWeights[" << varIndex << "];\n" << "\t}\n"; - return ss.str(); } @@ -1772,7 +1691,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_PowX, prefix + "linearT3D_powX", 1)); m_Params.push_back(ParamWithName(&m_PowY, prefix + "linearT3D_powY", 1)); @@ -1792,7 +1710,7 @@ template class EMBER_API OvoidVariation : public ParametricVariation { public: - OvoidVariation(T weight = 1.0) : ParametricVariation("ovoid", VAR_OVOID, weight, true) + OvoidVariation(T weight = 1.0) : ParametricVariation("ovoid", eVariationId::VAR_OVOID, weight, true) { Init(); } @@ -1802,10 +1720,9 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = m_Weight / Zeps(helper.m_PrecalcSumSquares); - helper.Out.x = helper.In.x * r * m_X; helper.Out.y = helper.In.y * r * m_Y; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1816,15 +1733,13 @@ public: string index = ss2.str(); string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares);\n" << "\n" << "\t\tvOut.x = vIn.x * r * " << x << ";\n" << "\t\tvOut.y = vIn.y * r * " << y << ";\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; - return ss.str(); } @@ -1837,7 +1752,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "ovoid_x", 1)); m_Params.push_back(ParamWithName(&m_Y, prefix + "ovoid_y", 1)); @@ -1855,7 +1769,7 @@ template class EMBER_API Ovoid3DVariation : public ParametricVariation { public: - Ovoid3DVariation(T weight = 1.0) : ParametricVariation("ovoid3d", VAR_OVOID3D, weight, true) + Ovoid3DVariation(T weight = 1.0) : ParametricVariation("ovoid3d", eVariationId::VAR_OVOID3D, weight, true) { Init(); } @@ -1865,7 +1779,6 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T r = m_Weight / Zeps(helper.m_PrecalcSumSquares + SQR(helper.In.z)); - helper.Out.x = helper.In.x * r * m_X; helper.Out.y = helper.In.y * r * m_Y; helper.Out.z = helper.In.z * r * m_Z; @@ -1880,7 +1793,6 @@ public: string x = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string y = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string z = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t r = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares + SQR(vIn.z));\n" << "\n" @@ -1888,7 +1800,6 @@ public: << "\t\tvOut.y = vIn.y * r * " << y << ";\n" << "\t\tvOut.z = vIn.z * r * " << z << ";\n" << "\t}\n"; - return ss.str(); } @@ -1901,7 +1812,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "ovoid3d_x", 1)); m_Params.push_back(ParamWithName(&m_Y, prefix + "ovoid3d_y", 1)); @@ -1921,7 +1831,7 @@ template class EMBER_API SpirographVariation : public ParametricVariation { public: - SpirographVariation(T weight = 1.0) : ParametricVariation("Spirograph", VAR_SPIROGRAPH, weight) + SpirographVariation(T weight = 1.0) : ParametricVariation("Spirograph", eVariationId::VAR_SPIROGRAPH, weight) { Init(); } @@ -1934,7 +1844,6 @@ public: T y = (m_YMax - m_YMin) * rand.Frand01() + m_YMin; T x1 = (m_A + m_B) * std::cos(t) - m_C1 * std::cos((m_A + m_B) / m_B * t); T y1 = (m_A + m_B) * std::sin(t) - m_C2 * std::sin((m_A + m_B) / m_B * t); - helper.Out.x = m_Weight * (x1 + m_D * std::cos(t) + y); helper.Out.y = m_Weight * (y1 + m_D * std::sin(t) + y); helper.Out.z = m_Weight * helper.In.z; @@ -1955,7 +1864,6 @@ public: string ymax = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string c1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t t = (" << tmax << " - " << tmin << ") * MwcNext01(mwc) + " << tmin << ";\n" << "\t\treal_t y = (" << ymax << " - " << ymin << ") * MwcNext01(mwc) + " << ymin << ";\n" @@ -1966,7 +1874,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (y1 + " << d << " * sin(t) + y);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -1974,7 +1881,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_A, prefix + "Spirograph_a", 3)); m_Params.push_back(ParamWithName(&m_B, prefix + "Spirograph_b", 2)); @@ -2006,7 +1912,7 @@ template class EMBER_API PetalVariation : public Variation { public: - PetalVariation(T weight = 1.0) : Variation("petal", VAR_PETAL, weight) { } + PetalVariation(T weight = 1.0) : Variation("petal", eVariationId::VAR_PETAL, weight) { } VARCOPY(PetalVariation) @@ -2017,7 +1923,6 @@ public: T cosY = std::cos(helper.In.y); T bx = Cube(cosX * cosY); T by = Cube(sinX * cosY); - helper.Out.x = m_Weight * cosX * bx; helper.Out.y = m_Weight * cosX * by; helper.Out.z = m_Weight * helper.In.z; @@ -2027,7 +1932,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t sinX = sin(vIn.x);\n" << "\t\treal_t cosX = cos(vIn.x);\n" @@ -2040,7 +1944,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * cosX * by;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2057,14 +1960,13 @@ template class EMBER_API RoundSpherVariation : public Variation { public: - RoundSpherVariation(T weight = 1.0) : Variation("roundspher", VAR_ROUNDSPHER, weight, true) { } + RoundSpherVariation(T weight = 1.0) : Variation("roundspher", eVariationId::VAR_ROUNDSPHER, weight, true) { } VARCOPY(RoundSpherVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T e = 1 / helper.m_PrecalcSumSquares + SQR(T(M_2_PI)); - helper.Out.x = m_Weight * (m_Weight / helper.m_PrecalcSumSquares * helper.In.x / e); helper.Out.y = m_Weight * (m_Weight / helper.m_PrecalcSumSquares * helper.In.y / e); helper.Out.z = m_Weight * helper.In.z; @@ -2074,7 +1976,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t e = 1 / precalcSumSquares + SQR(M_2_PI);\n" << "\n" @@ -2082,7 +1983,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (xform->m_VariationWeights[" << varIndex << "] / precalcSumSquares * vIn.y / e);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -2094,7 +1994,7 @@ template class EMBER_API RoundSpher3DVariation : public Variation { public: - RoundSpher3DVariation(T weight = 1.0) : Variation("roundspher3D", VAR_ROUNDSPHER3D, weight, true, true) { } + RoundSpher3DVariation(T weight = 1.0) : Variation("roundspher3D", eVariationId::VAR_ROUNDSPHER3D, weight, true, true) { } VARCOPY(RoundSpher3DVariation) @@ -2103,7 +2003,7 @@ public: T inZ, otherZ, tempTz, tempPz; inZ = helper.In.z; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) otherZ = helper.m_TransZ; else otherZ = outPoint.m_Z; @@ -2117,14 +2017,14 @@ public: { tempPz = std::cos(helper.m_PrecalcSqrtSumSquares); - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) helper.m_TransZ = 0; else outPoint.m_Z = 0; } else { - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { tempPz = helper.m_TransZ; helper.m_TransZ = 0; @@ -2138,7 +2038,6 @@ public: T d = helper.m_PrecalcSumSquares + SQR(tempTz); T e = 1 / d + SQR(T(M_2_PI)); - helper.Out.x = m_Weight * (m_Weight / d * helper.In.x / e); helper.Out.y = m_Weight * (m_Weight / d * helper.In.y / e); helper.Out.z = tempPz + m_Weight * (m_Weight / d * tempTz / e); @@ -2148,62 +2047,61 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t inZ, otherZ, tempTz, tempPz;\n" << "\t\tinZ = vIn.z;\n" << "\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) ss << "\t\totherZ = transZ;\n"; else ss << "\t\totherZ = outPoint->m_Z;\n"; - ss - << "\n" - << "\t\tif (inZ == 0)\n" - << "\t\t tempTz = cos(precalcSqrtSumSquares);\n" - << "\t\telse\n" - << "\t\t tempTz = vIn.z;\n" - << "\n" - << "\t\tif (otherZ == 0)\n" - << "\t\t{\n" - << "\t\t tempPz = cos(precalcSqrtSumSquares);\n" - << "\n"; - if (m_VarType == VARTYPE_PRE) + ss + << "\n" + << "\t\tif (inZ == 0)\n" + << "\t\t tempTz = cos(precalcSqrtSumSquares);\n" + << "\t\telse\n" + << "\t\t tempTz = vIn.z;\n" + << "\n" + << "\t\tif (otherZ == 0)\n" + << "\t\t{\n" + << "\t\t tempPz = cos(precalcSqrtSumSquares);\n" + << "\n"; + + if (m_VarType == eVariationType::VARTYPE_PRE) ss << "\t\t transZ = 0;\n"; else ss << "\t\t outPoint->m_Z = 0;\n"; ss - << "\t\t}\n" - << "\t\telse\n" - << "\t\t{\n"; + << "\t\t}\n" + << "\t\telse\n" + << "\t\t{\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss - << "\t\t tempPz = transZ;\n" - << "\t\t transZ = 0;\n"; + << "\t\t tempPz = transZ;\n" + << "\t\t transZ = 0;\n"; } else { ss - << "\t\t tempPz = outPoint->m_Z;\n" - << "\t\t outPoint->m_Z = 0;\n"; + << "\t\t tempPz = outPoint->m_Z;\n" + << "\t\t outPoint->m_Z = 0;\n"; } ss - << "\t\t}\n" - << "\n" - << "\t\treal_t d = precalcSumSquares + SQR(tempTz);\n" - << "\t\treal_t e = 1 / d + SQR(M_2_PI);\n" - << "\n" - << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (xform->m_VariationWeights[" << varIndex << "] / d * vIn.x / e);\n" - << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (xform->m_VariationWeights[" << varIndex << "] / d * vIn.y / e);\n" - << "\t\tvOut.z = tempPz + xform->m_VariationWeights[" << varIndex << "] * (xform->m_VariationWeights[" << varIndex << "] / d * tempTz / e);\n" - << "\t}\n"; - + << "\t\t}\n" + << "\n" + << "\t\treal_t d = precalcSumSquares + SQR(tempTz);\n" + << "\t\treal_t e = 1 / d + SQR(M_2_PI);\n" + << "\n" + << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (xform->m_VariationWeights[" << varIndex << "] / d * vIn.x / e);\n" + << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (xform->m_VariationWeights[" << varIndex << "] / d * vIn.y / e);\n" + << "\t\tvOut.z = tempPz + xform->m_VariationWeights[" << varIndex << "] * (xform->m_VariationWeights[" << varIndex << "] / d * tempTz / e);\n" + << "\t}\n"; return ss.str(); } }; @@ -2215,7 +2113,7 @@ template class EMBER_API SpiralWingVariation : public Variation { public: - SpiralWingVariation(T weight = 1.0) : Variation("spiralwing", VAR_SPIRAL_WING, weight, true) { } + SpiralWingVariation(T weight = 1.0) : Variation("spiralwing", eVariationId::VAR_SPIRAL_WING, weight, true) { } VARCOPY(SpiralWingVariation) @@ -2224,7 +2122,6 @@ public: T d = Zeps(helper.m_PrecalcSumSquares); T c1 = Zeps(SQR(helper.In.x)); T c2 = Zeps(SQR(helper.In.y)); - helper.Out.x = m_Weight * ((1 / d) * std::cos(c1) * std::sin(c2)); helper.Out.y = m_Weight * ((1 / d) * std::sin(c1) * std::sin(c2)); helper.Out.z = m_Weight * helper.In.z; @@ -2234,7 +2131,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t d = Zeps(precalcSumSquares);\n" << "\t\treal_t c1 = Zeps(SQR(vIn.x));\n" @@ -2244,7 +2140,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (((real_t)(1.0) / d) * sin(c1) * sin(c2));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2261,7 +2156,7 @@ template class EMBER_API SquarizeVariation : public Variation { public: - SquarizeVariation(T weight = 1.0) : Variation("squarize", VAR_SQUARIZE, weight, true, true, false, false, true) { } + SquarizeVariation(T weight = 1.0) : Variation("squarize", eVariationId::VAR_SQUARIZE, weight, true, true, false, false, true) { } VARCOPY(SquarizeVariation) @@ -2307,7 +2202,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\treal_t a = precalcAtanyx;\n" << "\n" @@ -2344,7 +2238,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -2356,7 +2249,7 @@ template class EMBER_API SschecksVariation : public ParametricVariation { public: - SschecksVariation(T weight = 1.0) : ParametricVariation("sschecks", VAR_SSCHECKS, weight, true) + SschecksVariation(T weight = 1.0) : ParametricVariation("sschecks", eVariationId::VAR_SSCHECKS, weight, true) { Init(); } @@ -2395,7 +2288,6 @@ public: string size = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rand = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string invSize = "parVars[" + ToUpper(m_Params[i++].Name()) + index;//Precalc. - ss << "\t{\n" << "\t\treal_t dx, dy, r = xform->m_VariationWeights[" << varIndex << "] / (precalcSumSquares + EPS);\n" << "\t\tint isXY = LRint(vIn.x * " << invSize << ") + LRint(vIn.y * " << invSize << ");\n" @@ -2415,7 +2307,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (sin(vIn.y) * r + dy);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2433,7 +2324,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "sschecks_x", T(0.5))); m_Params.push_back(ParamWithName(&m_Y, prefix + "sschecks_y", T(0.5))); @@ -2457,7 +2347,7 @@ template class EMBER_API PhoenixJuliaVariation : public ParametricVariation { public: - PhoenixJuliaVariation(T weight = 1.0) : ParametricVariation("phoenix_julia", VAR_PHOENIX_JULIA, weight, true) + PhoenixJuliaVariation(T weight = 1.0) : ParametricVariation("phoenix_julia", eVariationId::VAR_PHOENIX_JULIA, weight, true) { Init(); } @@ -2470,7 +2360,6 @@ public: T preY = helper.In.y * (m_YDistort + 1); T temp = std::atan2(preY, preX) * m_InvN + rand.Rand() * m_Inv2PiN; T r = m_Weight * std::pow(helper.m_PrecalcSumSquares, m_Cn); - helper.Out.x = r * std::cos(temp); helper.Out.y = r * std::sin(temp); helper.Out.z = m_Weight * helper.In.z; @@ -2489,7 +2378,6 @@ public: string cN = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string invN = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string inv2PiN = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t preX = vIn.x * (" << xDistort << " + 1);\n" << "\t\treal_t preY = vIn.y * (" << yDistort << " + 1);\n" @@ -2500,7 +2388,6 @@ public: << "\t\tvOut.y = r * sin(temp);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2515,7 +2402,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Power, prefix + "phoenix_julia_power", 2)); m_Params.push_back(ParamWithName(&m_Dist, prefix + "phoenix_julia_dist", 1)); @@ -2543,7 +2429,7 @@ template class EMBER_API MobiusVariation : public ParametricVariation { public: - MobiusVariation(T weight = 1.0) : ParametricVariation("Mobius", VAR_MOBIUS, weight) + MobiusVariation(T weight = 1.0) : ParametricVariation("Mobius", eVariationId::VAR_MOBIUS, weight) { Init(); } @@ -2557,7 +2443,6 @@ public: T vRe = m_Re_C * helper.In.x - m_Im_C * helper.In.y + m_Re_D; T vIm = m_Re_C * helper.In.y + m_Im_C * helper.In.x + m_Im_D; T vDenom = Zeps(SQR(vRe) + SQR(vIm)); - helper.Out.x = m_Weight * (uRe * vRe + uIm * vIm) / vDenom; helper.Out.y = m_Weight * (uIm * vRe - uRe * vIm) / vDenom; helper.Out.z = m_Weight * helper.In.z; @@ -2577,7 +2462,6 @@ public: string imC = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string reD = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string imD = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t uRe = " << reA << " * vIn.x - " << imA << " * vIn.y + " << reB << ";\n" << "\t\treal_t uIm = " << reA << " * vIn.y + " << imA << " * vIn.x + " << imB << ";\n" @@ -2589,7 +2473,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (uIm * vRe - uRe * vIm) / vDenom;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2602,7 +2485,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Re_A, prefix + "Mobius_Re_A", 1));//Original omitted Mobius_ prefix, which is incompatible with Ember's design. m_Params.push_back(ParamWithName(&m_Im_A, prefix + "Mobius_Im_A")); @@ -2632,7 +2514,7 @@ template class EMBER_API MobiusNVariation : public ParametricVariation { public: - MobiusNVariation(T weight = 1.0) : ParametricVariation("MobiusN", VAR_MOBIUSN, weight, true, true, false, false, true) + MobiusNVariation(T weight = 1.0) : ParametricVariation("MobiusN", eVariationId::VAR_MOBIUSN, weight, true, true, false, false, true) { Init(); } @@ -2642,7 +2524,6 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { intmax_t n; - T z = 4 * m_Dist / m_Power; T r = std::pow(helper.m_PrecalcSqrtSumSquares, z); T alpha = helper.m_PrecalcAtanyx * m_Power; @@ -2653,15 +2534,12 @@ public: T reV = m_Re_C * x - m_Im_C * y + m_Re_D; T imV = m_Re_C * y + m_Im_C * x + m_Im_D; T radV = reV * reV + imV * imV; - x = (reU * reV + imU * imV) / radV; y = (imU * reV - reU * imV) / radV; - z = 1 / z; r = std::pow(std::sqrt(SQR(x) + SQR(y)), z); n = Floor(m_Power * rand.Frand01()); alpha = (std::atan2(y, x) + n * M_2PI) / Floor(m_Power); - helper.Out.x = m_Weight * r * std::cos(alpha); helper.Out.y = m_Weight * r * std::sin(alpha); helper.Out.z = m_Weight * helper.In.z; @@ -2683,7 +2561,6 @@ public: string imD = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tint n;\n" << "\n" @@ -2710,7 +2587,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * r * sin(alpha);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2724,7 +2600,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Re_A, prefix + "MobiusNRe_A", 1)); m_Params.push_back(ParamWithName(&m_Im_A, prefix + "MobiusNIm_A")); @@ -2760,7 +2635,7 @@ template class EMBER_API MobiusStripVariation : public ParametricVariation { public: - MobiusStripVariation(T weight = 1.0) : ParametricVariation("mobius_strip", VAR_MOBIUS_STRIP, weight) + MobiusStripVariation(T weight = 1.0) : ParametricVariation("mobius_strip", eVariationId::VAR_MOBIUS_STRIP, weight) { Init(); } @@ -2771,7 +2646,6 @@ public: { T s, t, mx, my, mz, rx, ry, rz; T deltaT, deltaS; - t = helper.In.x; //Put t in range -rectX to +rectX, then map that to 0 - 2pi. @@ -2804,17 +2678,14 @@ public: mx = (m_Radius + s * std::cos(t / 2)) * std::cos(t); my = (m_Radius + s * std::cos(t / 2)) * std::sin(t); mz = s * sin(t / 2); - //Rotate around X axis (change y & z) and store temporarily in R variables. rx = mx; ry = my * m_RotyCos + mz * m_RotySin; rz = mz * m_RotyCos - my * m_RotySin; - //Rotate around Y axis (change x & z) and store back in M variables. mx = rx * m_RotxCos - rz * m_RotxSin; my = ry; mz = rz * m_RotxCos + rx * m_RotxSin; - //Add final values in to variations totals. helper.Out.x = m_Weight * mx; helper.Out.y = m_Weight * my; @@ -2837,7 +2708,6 @@ public: string rotxCos = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rotySin = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rotyCos = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t s, t, mx, my, mz, rx, ry, rz;\n" << "\t\treal_t deltaT, deltaS;\n" @@ -2884,7 +2754,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * my;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2900,7 +2769,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Radius, prefix + "mobius_strip_radius", 2)); m_Params.push_back(ParamWithName(&m_Width, prefix + "mobius_strip_width", 1)); @@ -2934,7 +2802,7 @@ template class EMBER_API LissajousVariation : public ParametricVariation { public: - LissajousVariation(T weight = 1.0) : ParametricVariation("Lissajous", VAR_LISSAJOUS, weight) + LissajousVariation(T weight = 1.0) : ParametricVariation("Lissajous", eVariationId::VAR_LISSAJOUS, weight) { Init(); } @@ -2947,7 +2815,6 @@ public: T y = rand.Frand01() - T(0.5); T x1 = sin(m_A * t + m_D); T y1 = sin(m_B * t); - helper.Out.x = m_Weight * (x1 + m_C * t + m_E * y); helper.Out.y = m_Weight * (y1 + m_C * t + m_E * y); helper.Out.z = m_Weight * helper.In.z; @@ -2966,7 +2833,6 @@ public: string c = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string d = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string e = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t t = (" << max << " - " << min << ") * MwcNext01(mwc) + " << min << ";\n" << "\t\treal_t y = MwcNext01(mwc) - (real_t)(0.5);\n" @@ -2977,7 +2843,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (y1 + " << c << " * t + " << e << " * y);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -2985,7 +2850,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Min, prefix + "Lissajous_tmin", -T(M_PI))); m_Params.push_back(ParamWithName(&m_Max, prefix + "Lissajous_tmax", T(M_PI))); @@ -3013,7 +2877,7 @@ template class EMBER_API SvfVariation : public ParametricVariation { public: - SvfVariation(T weight = 1.0) : ParametricVariation("svf", VAR_SVF, weight) + SvfVariation(T weight = 1.0) : ParametricVariation("svf", eVariationId::VAR_SVF, weight) { Init(); } @@ -3027,7 +2891,6 @@ public: T cx = std::cos(helper.In.x); T sy = std::sin(helper.In.y); T cy = std::cos(helper.In.y); - helper.Out.x = m_Weight * (cy * (cn * cx)); helper.Out.y = m_Weight * (cy * (cn * sx)); helper.Out.z = m_Weight * (sy * cn); @@ -3040,7 +2903,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t cn = cos(" << n << " * vIn.y);\n" << "\t\treal_t sx = sin(vIn.x);\n" @@ -3052,7 +2914,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (cy * (cn * sx));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (sy * cn);\n" << "\t}\n"; - return ss.str(); } @@ -3060,7 +2921,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_N, prefix + "svf_n", 2)); } @@ -3076,7 +2936,7 @@ template class EMBER_API TargetVariation : public ParametricVariation { public: - TargetVariation(T weight = 1.0) : ParametricVariation("target", VAR_TARGET, weight, true, true, false, false, true) + TargetVariation(T weight = 1.0) : ParametricVariation("target", eVariationId::VAR_TARGET, weight, true, true, false, false, true) { Init(); } @@ -3113,7 +2973,6 @@ public: string odd = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string size = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string sizeDiv2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t a = precalcAtanyx;\n" << "\t\treal_t t = log(precalcSqrtSumSquares);\n" @@ -3132,7 +2991,6 @@ public: << "\t\tvOut.y = precalcSqrtSumSquares * sin(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3145,11 +3003,10 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Even, prefix + "target_even", 0, REAL_CYCLIC, 0, M_2PI)); - m_Params.push_back(ParamWithName(&m_Odd, prefix + "target_odd", 0, REAL_CYCLIC, 0, M_2PI)); - m_Params.push_back(ParamWithName(&m_Size, prefix + "target_size", 1, REAL, EPS, TMAX)); + m_Params.push_back(ParamWithName(&m_Even, prefix + "target_even", 0, eParamType::REAL_CYCLIC, 0, M_2PI)); + m_Params.push_back(ParamWithName(&m_Odd, prefix + "target_odd", 0, eParamType::REAL_CYCLIC, 0, M_2PI)); + m_Params.push_back(ParamWithName(&m_Size, prefix + "target_size", 1, eParamType::REAL, EPS, TMAX)); m_Params.push_back(ParamWithName(true, &m_SizeDiv2, prefix + "target_size_2"));//Precalc. } @@ -3167,7 +3024,7 @@ template class EMBER_API TaurusVariation : public ParametricVariation { public: - TaurusVariation(T weight = 1.0) : ParametricVariation("taurus", VAR_TAURUS, weight) + TaurusVariation(T weight = 1.0) : ParametricVariation("taurus", eVariationId::VAR_TAURUS, weight) { Init(); } @@ -3181,7 +3038,6 @@ public: T sy = std::sin(helper.In.y); T cy = std::cos(helper.In.y); T ir = m_InvTimesR + (m_1MinusInv * (m_R * std::cos(m_N * helper.In.x))); - helper.Out.x = m_Weight * (cx * (ir + sy)); helper.Out.y = m_Weight * (sx * (ir + sy)); helper.Out.z = m_Weight * (m_Sor * cy) + (m_1MinusSor * helper.In.y); @@ -3200,7 +3056,6 @@ public: string invTimesR = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string oneMinusInv = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string oneMinusSor = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t sx = sin(vIn.x);\n" << "\t\treal_t cx = cos(vIn.x);\n" @@ -3212,7 +3067,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (sx * (ir + sy));\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * (" << sor << " * cy) + (" << oneMinusSor << " * vIn.y);\n" << "\t}\n"; - return ss.str(); } @@ -3227,7 +3081,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_R, prefix + "taurus_r", 3)); m_Params.push_back(ParamWithName(&m_N, prefix + "taurus_n", 5)); @@ -3255,7 +3108,7 @@ template class EMBER_API CollideoscopeVariation : public ParametricVariation { public: - CollideoscopeVariation(T weight = 1.0) : ParametricVariation("collideoscope", VAR_COLLIDEOSCOPE, weight, true, true, false, false, true) + CollideoscopeVariation(T weight = 1.0) : ParametricVariation("collideoscope", eVariationId::VAR_COLLIDEOSCOPE, weight, true, true, false, false, true) { Init(); } @@ -3304,7 +3157,6 @@ public: string knpi = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string kakn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string pikn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tint alt;\n" << "\t\treal_t a = precalcAtanyx;\n" @@ -3333,7 +3185,6 @@ public: << "\t\tvOut.y = r * sin(a);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3350,10 +3201,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_A, prefix + "collideoscope_a", 0, REAL_CYCLIC, 0, 1)); - m_Params.push_back(ParamWithName(&m_Num, prefix + "collideoscope_num", 1, INTEGER)); + m_Params.push_back(ParamWithName(&m_A, prefix + "collideoscope_a", 0, eParamType::REAL_CYCLIC, 0, 1)); + m_Params.push_back(ParamWithName(&m_Num, prefix + "collideoscope_num", 1, eParamType::INTEGER)); m_Params.push_back(ParamWithName(true, &m_Ka, prefix + "collideoscope_ka"));//Precalc. m_Params.push_back(ParamWithName(true, &m_KnPi, prefix + "collideoscope_kn_pi")); m_Params.push_back(ParamWithName(true, &m_KaKn, prefix + "collideoscope_ka_kn")); @@ -3376,7 +3226,7 @@ template class EMBER_API BModVariation : public ParametricVariation { public: - BModVariation(T weight = 1.0) : ParametricVariation("bMod", VAR_BMOD, weight) + BModVariation(T weight = 1.0) : ParametricVariation("bMod", eVariationId::VAR_BMOD, weight) { Init(); } @@ -3392,7 +3242,6 @@ public: tau = fmod(tau + m_Radius + m_Distance * m_Radius, 2 * m_Radius) - m_Radius; T temp = std::cosh(tau) - std::cos(sigma); - helper.Out.x = m_Weight * std::sinh(tau) / temp; helper.Out.y = m_Weight * std::sin(sigma) / temp; helper.Out.z = m_Weight * helper.In.z; @@ -3406,7 +3255,6 @@ public: string index = ss2.str(); string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tau = (real_t)(0.5) * (log(Sqr(vIn.x + (real_t)(1.0)) + SQR(vIn.y)) - log(Sqr(vIn.x - (real_t)(1.0)) + SQR(vIn.y)));\n" << "\t\treal_t sigma = M_PI - atan2(vIn.y, vIn.x + (real_t)(1.0)) - atan2(vIn.y, (real_t)(1.0) - vIn.x);\n" @@ -3420,7 +3268,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(sigma) / temp;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3433,10 +3280,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Radius, prefix + "bMod_radius", 1, REAL, 0, TMAX)); - m_Params.push_back(ParamWithName(&m_Distance, prefix + "bMod_distance", 0, REAL_CYCLIC, 0, 2)); + m_Params.push_back(ParamWithName(&m_Radius, prefix + "bMod_radius", 1, eParamType::REAL, 0, TMAX)); + m_Params.push_back(ParamWithName(&m_Distance, prefix + "bMod_distance", 0, eParamType::REAL_CYCLIC, 0, 2)); } private: @@ -3451,7 +3297,7 @@ template class EMBER_API BSwirlVariation : public ParametricVariation { public: - BSwirlVariation(T weight = 1.0) : ParametricVariation("bSwirl", VAR_BSWIRL, weight) + BSwirlVariation(T weight = 1.0) : ParametricVariation("bSwirl", eVariationId::VAR_BSWIRL, weight) { Init(); } @@ -3462,11 +3308,8 @@ public: { T tau = T(0.5) * (std::log(Sqr(helper.In.x + 1) + SQR(helper.In.y)) - std::log(Sqr(helper.In.x - 1) + SQR(helper.In.y))); T sigma = T(M_PI) - std::atan2(helper.In.y, helper.In.x + 1) - std::atan2(helper.In.y, 1 - helper.In.x); - sigma = sigma + tau * m_Out + m_In / tau; - T temp = std::cosh(tau) - std::cos(sigma); - helper.Out.x = m_Weight * std::sinh(tau) / temp; helper.Out.y = m_Weight * std::sin(sigma) / temp; helper.Out.z = m_Weight * helper.In.z; @@ -3480,7 +3323,6 @@ public: string index = ss2.str(); string in = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string out = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tau = (real_t)(0.5) * (log(Sqr(vIn.x + (real_t)(1.0)) + SQR(vIn.y)) - log(Sqr(vIn.x - (real_t)(1.0)) + SQR(vIn.y)));\n" << "\t\treal_t sigma = M_PI - atan2(vIn.y, vIn.x + (real_t)(1.0)) - atan2(vIn.y, (real_t)(1.0) - vIn.x);\n" @@ -3493,7 +3335,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(sigma) / temp;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3506,7 +3347,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_In, prefix + "bSwirl_in")); m_Params.push_back(ParamWithName(&m_Out, prefix + "bSwirl_out")); @@ -3524,7 +3364,7 @@ template class EMBER_API BTransformVariation : public ParametricVariation { public: - BTransformVariation(T weight = 1.0) : ParametricVariation("bTransform", VAR_BTRANSFORM, weight) + BTransformVariation(T weight = 1.0) : ParametricVariation("bTransform", eVariationId::VAR_BTRANSFORM, weight) { Init(); } @@ -3535,7 +3375,6 @@ public: { T tau = T(0.5) * (std::log(Sqr(helper.In.x + 1) + SQR(helper.In.y)) - std::log(Sqr(helper.In.x - 1) + SQR(helper.In.y))) / m_Power + m_Move; T sigma = T(M_PI) - std::atan2(helper.In.y, helper.In.x + 1) - std::atan2(helper.In.y, 1 - helper.In.x) + m_Rotate; - sigma = sigma / m_Power + M_2PI / m_Power * Floor(rand.Frand01() * m_Power); if (helper.In.x >= 0) @@ -3544,7 +3383,6 @@ public: tau -= m_Split; T temp = std::cosh(tau) - std::cos(sigma); - helper.Out.x = m_Weight * std::sinh(tau) / temp; helper.Out.y = m_Weight * std::sin(sigma) / temp; helper.Out.z = m_Weight * helper.In.z; @@ -3560,7 +3398,6 @@ public: string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string move = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string split = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tau = (real_t)(0.5) * (log(Sqr(vIn.x + (real_t)(1.0)) + SQR(vIn.y)) - log(Sqr(vIn.x - (real_t)(1.0)) + SQR(vIn.y))) / " << power << " + " << move << ";\n" << "\t\treal_t sigma = M_PI - atan2(vIn.y, vIn.x + (real_t)(1.0)) - atan2(vIn.y, (real_t)(1.0) - vIn.x) + " << rotate << ";\n" @@ -3578,7 +3415,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(sigma) / temp;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3591,10 +3427,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Rotate, prefix + "bTransform_rotate")); - m_Params.push_back(ParamWithName(&m_Power, prefix + "bTransform_power", 1, INTEGER, 1, T(INT_MAX))); + m_Params.push_back(ParamWithName(&m_Power, prefix + "bTransform_power", 1, eParamType::INTEGER, 1, T(INT_MAX))); m_Params.push_back(ParamWithName(&m_Move, prefix + "bTransform_move")); m_Params.push_back(ParamWithName(&m_Split, prefix + "bTransform_split")); } @@ -3613,7 +3448,7 @@ template class EMBER_API BCollideVariation : public ParametricVariation { public: - BCollideVariation(T weight = 1.0) : ParametricVariation("bCollide", VAR_BCOLLIDE, weight) + BCollideVariation(T weight = 1.0) : ParametricVariation("bCollide", eVariationId::VAR_BCOLLIDE, weight) { Init(); } @@ -3632,7 +3467,6 @@ public: sigma = alt * m_PiCn + fmod(sigma - m_CaCn, m_PiCn); T temp = std::cosh(tau) - std::cos(sigma); - helper.Out.x = m_Weight * sinh(tau) / temp; helper.Out.y = m_Weight * sin(sigma) / temp; helper.Out.z = m_Weight * helper.In.z; @@ -3650,7 +3484,6 @@ public: string cnPi = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string caCn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string piCn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tau = (real_t)(0.5) * (log(Sqr(vIn.x + (real_t)(1.0)) + SQR(vIn.y)) - log(Sqr(vIn.x - (real_t)(1.0)) + SQR(vIn.y)));\n" << "\t\treal_t sigma = M_PI - atan2(vIn.y, vIn.x + (real_t)(1.0)) - atan2(vIn.y, (real_t)(1.0) - vIn.x);\n" @@ -3667,7 +3500,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(sigma) / temp;\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3688,10 +3520,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_A, prefix + "bCollide_a", 0, REAL_CYCLIC, 0, 1)); - m_Params.push_back(ParamWithName(&m_Num, prefix + "bCollide_num", 1, INTEGER, 1, T(INT_MAX))); + m_Params.push_back(ParamWithName(&m_A, prefix + "bCollide_a", 0, eParamType::REAL_CYCLIC, 0, 1)); + m_Params.push_back(ParamWithName(&m_Num, prefix + "bCollide_num", 1, eParamType::INTEGER, 1, T(INT_MAX))); m_Params.push_back(ParamWithName(true, &m_Ca, prefix + "bCollide_ca"));//Precalc. m_Params.push_back(ParamWithName(true, &m_CnPi, prefix + "bCollide_cn_pi")); m_Params.push_back(ParamWithName(true, &m_CaCn, prefix + "bCollide_ca_cn")); @@ -3714,7 +3545,7 @@ template class EMBER_API EclipseVariation : public ParametricVariation { public: - EclipseVariation(T weight = 1.0) : ParametricVariation("eclipse", VAR_ECLIPSE, weight) + EclipseVariation(T weight = 1.0) : ParametricVariation("eclipse", eVariationId::VAR_ECLIPSE, weight) { Init(); } @@ -3761,7 +3592,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string shift = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t x, c2;\n" << "\n" @@ -3793,7 +3623,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3801,9 +3630,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Shift, prefix + "eclipse_shift", 0, REAL_CYCLIC, -2, 2)); + m_Params.push_back(ParamWithName(&m_Shift, prefix + "eclipse_shift", 0, eParamType::REAL_CYCLIC, -2, 2)); } private: @@ -3817,7 +3645,7 @@ template class EMBER_API FlipCircleVariation : public ParametricVariation { public: - FlipCircleVariation(T weight = 1.0) : ParametricVariation("flipcircle", VAR_FLIP_CIRCLE, weight, true) + FlipCircleVariation(T weight = 1.0) : ParametricVariation("flipcircle", eVariationId::VAR_FLIP_CIRCLE, weight, true) { Init(); } @@ -3843,7 +3671,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string ww = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n" << "\n" @@ -3854,7 +3681,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -3867,7 +3693,6 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(true, &m_WeightSquared, prefix + "flipcircle_weight_squared")); } @@ -3883,7 +3708,7 @@ template class EMBER_API FlipYVariation : public Variation { public: - FlipYVariation(T weight = 1.0) : Variation("flipy", VAR_FLIP_Y, weight) { } + FlipYVariation(T weight = 1.0) : Variation("flipy", eVariationId::VAR_FLIP_Y, weight) { } VARCOPY(FlipYVariation) @@ -3903,7 +3728,6 @@ public: { ostringstream ss; intmax_t varIndex = IndexInXform(); - ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vIn.x;\n" << "\n" @@ -3914,7 +3738,6 @@ public: << "\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } }; @@ -3926,7 +3749,7 @@ template class EMBER_API ECollideVariation : public ParametricVariation { public: - ECollideVariation(T weight = 1.0) : ParametricVariation("eCollide", VAR_ECOLLIDE, weight, true) + ECollideVariation(T weight = 1.0) : ParametricVariation("eCollide", eVariationId::VAR_ECOLLIDE, weight, true) { Init(); } @@ -3983,7 +3806,6 @@ public: string cnPi = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string caCn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string piCn = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tmp = precalcSumSquares + 1;\n" << "\t\treal_t tmp2 = 2 * vIn.x;\n" @@ -4020,7 +3842,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sqrt(xmax - 1) * sqrt(xmax + 1) * sin(nu);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4041,10 +3862,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_A, prefix + "eCollide_a", 0, REAL_CYCLIC, 0, 1)); - m_Params.push_back(ParamWithName(&m_Num, prefix + "eCollide_num", 1, INTEGER, 1, T(INT_MAX))); + m_Params.push_back(ParamWithName(&m_A, prefix + "eCollide_a", 0, eParamType::REAL_CYCLIC, 0, 1)); + m_Params.push_back(ParamWithName(&m_Num, prefix + "eCollide_num", 1, eParamType::INTEGER, 1, T(INT_MAX))); m_Params.push_back(ParamWithName(true, &m_Ca, prefix + "eCollide_ca"));//Precalc. m_Params.push_back(ParamWithName(true, &m_CnPi, prefix + "eCollide_cn_pi")); m_Params.push_back(ParamWithName(true, &m_CaCn, prefix + "eCollide_ca_cn")); @@ -4067,7 +3887,7 @@ template class EMBER_API EJuliaVariation : public ParametricVariation { public: - EJuliaVariation(T weight = 1.0) : ParametricVariation("eJulia", VAR_EJULIA, weight, true) + EJuliaVariation(T weight = 1.0) : ParametricVariation("eJulia", eVariationId::VAR_EJULIA, weight, true) { Init(); } @@ -4091,9 +3911,7 @@ public: T tmp = r2 + 1; T tmp2 = 2 * x; T xmax = (SafeSqrt(tmp + tmp2) + SafeSqrt(tmp - tmp2)) * T(0.5); - ClampGteRef(xmax, 1); - T mu = std::acosh(xmax); T nu = std::acos(Clamp(x / xmax, -1, 1));//-Pi < nu < Pi. @@ -4102,7 +3920,6 @@ public: nu = nu / m_Power + M_2PI / m_Power * Floor(rand.Frand01() * m_Power); mu /= m_Power; - helper.Out.x = m_Weight * std::cosh(mu) * std::cos(nu); helper.Out.y = m_Weight * std::sinh(mu) * std::sin(nu); helper.Out.z = m_Weight * helper.In.z; @@ -4116,7 +3933,6 @@ public: string index = ss2.str(); string power = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string sign = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t x, r2 = precalcSumSquares;\n" << "\n" @@ -4150,7 +3966,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4171,9 +3986,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Power, prefix + "eJulia_power", 2, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "eJulia_power", 2, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(true, &m_Sign, prefix + "eJulia_sign"));//Precalc. } @@ -4189,7 +4003,7 @@ template class EMBER_API EModVariation : public ParametricVariation { public: - EModVariation(T weight = 1.0) : ParametricVariation("eMod", VAR_EMOD, weight, true) + EModVariation(T weight = 1.0) : ParametricVariation("eMod", eVariationId::VAR_EMOD, weight, true) { Init(); } @@ -4201,9 +4015,7 @@ public: T tmp = helper.m_PrecalcSumSquares + 1; T tmp2 = 2 * helper.In.x; T xmax = (SafeSqrt(tmp + tmp2) + SafeSqrt(tmp - tmp2)) * T(0.5); - ClampGteRef(xmax, 1); - T mu = std::acosh(xmax); T nu = std::acos(Clamp(helper.In.x / xmax, -1, 1));//-Pi < nu < Pi. @@ -4231,7 +4043,6 @@ public: string index = ss2.str(); string radius = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tmp = precalcSumSquares + 1;\n" << "\t\treal_t tmp2 = 2 * vIn.x;\n" @@ -4258,7 +4069,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4271,10 +4081,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Radius, prefix + "eMod_radius", 1, REAL, 0, TMAX)); - m_Params.push_back(ParamWithName(&m_Distance, prefix + "eMod_distance", 0, REAL_CYCLIC, 0, 2)); + m_Params.push_back(ParamWithName(&m_Radius, prefix + "eMod_radius", 1, eParamType::REAL, 0, TMAX)); + m_Params.push_back(ParamWithName(&m_Distance, prefix + "eMod_distance", 0, eParamType::REAL_CYCLIC, 0, 2)); } private: @@ -4289,7 +4098,7 @@ template class EMBER_API EMotionVariation : public ParametricVariation { public: - EMotionVariation(T weight = 1.0) : ParametricVariation("eMotion", VAR_EMOTION, weight, true) + EMotionVariation(T weight = 1.0) : ParametricVariation("eMotion", eVariationId::VAR_EMOTION, weight, true) { Init(); } @@ -4301,9 +4110,7 @@ public: T tmp = helper.m_PrecalcSumSquares + 1; T tmp2 = 2 * helper.In.x; T xmax = (SafeSqrt(tmp + tmp2) + SafeSqrt(tmp - tmp2)) * T(0.5); - ClampGteRef(xmax, 1); - T mu = std::acosh(xmax); T nu = std::acos(Clamp(helper.In.x / xmax, -1, 1));//-Pi < nu < Pi. @@ -4322,7 +4129,6 @@ public: } nu += m_Rotate; - helper.Out.x = m_Weight * std::cosh(mu) * std::cos(nu); helper.Out.y = m_Weight * std::sinh(mu) * std::sin(nu); helper.Out.z = m_Weight * helper.In.z; @@ -4336,7 +4142,6 @@ public: string index = ss2.str(); string move = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rotate = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tmp = precalcSumSquares + 1;\n" << "\t\treal_t tmp2 = 2 * vIn.x;\n" @@ -4368,7 +4173,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4381,10 +4185,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Move, prefix + "eMotion_move")); - m_Params.push_back(ParamWithName(&m_Rotate, prefix + "eMotion_rotate", 0, REAL_CYCLIC, 0, M_2PI)); + m_Params.push_back(ParamWithName(&m_Rotate, prefix + "eMotion_rotate", 0, eParamType::REAL_CYCLIC, 0, M_2PI)); } private: @@ -4399,7 +4202,7 @@ template class EMBER_API EPushVariation : public ParametricVariation { public: - EPushVariation(T weight = 1.0) : ParametricVariation("ePush", VAR_EPUSH, weight, true) + EPushVariation(T weight = 1.0) : ParametricVariation("ePush", eVariationId::VAR_EPUSH, weight, true) { Init(); } @@ -4411,9 +4214,7 @@ public: T tmp = helper.m_PrecalcSumSquares + 1; T tmp2 = 2 * helper.In.x; T xmax = (SafeSqrt(tmp + tmp2) + SafeSqrt(tmp - tmp2)) * T(0.5); - ClampGteRef(xmax, 1); - T mu = std::acosh(xmax); T nu = std::acos(Clamp(helper.In.x / xmax, -1, 1));//-Pi < nu < Pi. @@ -4423,7 +4224,6 @@ public: nu += m_Rotate; mu *= m_Dist; mu += m_Push; - helper.Out.x = m_Weight * std::cosh(mu) * std::cos(nu); helper.Out.y = m_Weight * std::sinh(mu) * std::sin(nu); helper.Out.z = m_Weight * helper.In.z; @@ -4438,7 +4238,6 @@ public: string push = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string dist = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string rotate = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tmp = precalcSumSquares + 1;\n" << "\t\treal_t tmp2 = 2 * vIn.x;\n" @@ -4461,7 +4260,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4474,11 +4272,10 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); m_Params.push_back(ParamWithName(&m_Push, prefix + "ePush_push")); m_Params.push_back(ParamWithName(&m_Dist, prefix + "ePush_dist", 1)); - m_Params.push_back(ParamWithName(&m_Rotate, prefix + "ePush_rotate", 0, REAL_CYCLIC, T(-M_PI), T(M_PI))); + m_Params.push_back(ParamWithName(&m_Rotate, prefix + "ePush_rotate", 0, eParamType::REAL_CYCLIC, T(-M_PI), T(M_PI))); } private: @@ -4494,7 +4291,7 @@ template class EMBER_API ERotateVariation : public ParametricVariation { public: - ERotateVariation(T weight = 1.0) : ParametricVariation("eRotate", VAR_EROTATE, weight, true) + ERotateVariation(T weight = 1.0) : ParametricVariation("eRotate", eVariationId::VAR_EROTATE, weight, true) { Init(); } @@ -4516,7 +4313,6 @@ public: nu *= -1; nu = fmod(nu + m_Rotate + T(M_PI), M_2PI) - T(M_PI); - helper.Out.x = m_Weight * xmax * std::cos(nu); helper.Out.y = m_Weight * std::sqrt(xmax - 1) * std::sqrt(xmax + 1) * std::sin(nu); helper.Out.z = m_Weight * helper.In.z; @@ -4529,7 +4325,6 @@ public: ss2 << "_" << XformIndexInEmber() << "]"; string index = ss2.str(); string rotate = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tmp = precalcSumSquares + 1;\n" << "\t\treal_t tmp2 = 2 * vIn.x;\n" @@ -4549,7 +4344,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sqrt(xmax - 1) * sqrt(xmax + 1) * sin(nu);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4562,9 +4356,8 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Rotate, prefix + "eRotate_rotate", 0, REAL_CYCLIC, T(-M_PI), T(M_PI))); + m_Params.push_back(ParamWithName(&m_Rotate, prefix + "eRotate_rotate", 0, eParamType::REAL_CYCLIC, T(-M_PI), T(M_PI))); } private: @@ -4578,7 +4371,7 @@ template class EMBER_API EScaleVariation : public ParametricVariation { public: - EScaleVariation(T weight = 1.0) : ParametricVariation("eScale", VAR_ESCALE, weight, true) + EScaleVariation(T weight = 1.0) : ParametricVariation("eScale", eVariationId::VAR_ESCALE, weight, true) { Init(); } @@ -4590,9 +4383,7 @@ public: T tmp = helper.m_PrecalcSumSquares + 1; T tmp2 = 2 * helper.In.x; T xmax = (SafeSqrt(tmp + tmp2) + SafeSqrt(tmp - tmp2)) * T(0.5); - ClampGteRef(xmax, 1); - T mu = std::acosh(xmax); T nu = std::acos(Clamp(helper.In.x / xmax, -1, 1));//-Pi < nu < Pi. @@ -4621,7 +4412,6 @@ public: string index = ss2.str(); string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index; string angle = "parVars[" + ToUpper(m_Params[i++].Name()) + index; - ss << "\t{\n" << "\t\treal_t tmp = precalcSumSquares + 1;\n" << "\t\treal_t tmp2 = 2 * vIn.x;\n" @@ -4649,7 +4439,6 @@ public: << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sinh(mu) * sin(nu);\n" << "\t\tvOut.z = xform->m_VariationWeights[" << varIndex << "] * vIn.z;\n" << "\t}\n"; - return ss.str(); } @@ -4662,10 +4451,9 @@ protected: void Init() { string prefix = Prefix(); - m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Scale, prefix + "eScale_scale", 1, REAL_NONZERO, 0, 1)); - m_Params.push_back(ParamWithName(&m_Angle, prefix + "eScale_angle", 0, REAL_CYCLIC, 0, M_2PI)); + m_Params.push_back(ParamWithName(&m_Scale, prefix + "eScale_scale", 1, eParamType::REAL_NONZERO, 0, 1)); + m_Params.push_back(ParamWithName(&m_Angle, prefix + "eScale_angle", 0, eParamType::REAL_CYCLIC, 0, M_2PI)); } private: @@ -4683,9 +4471,9 @@ MAKEPREPOSTPARVAR(Kaleidoscope, Kaleidoscope, KALEIDOSCOPE) MAKEPREPOSTPARVAR(GlynnSim1, GlynnSim1, GLYNNSIM1) MAKEPREPOSTPARVAR(GlynnSim2, GlynnSim2, GLYNNSIM2) MAKEPREPOSTPARVAR(GlynnSim3, GlynnSim3, GLYNNSIM3) -MAKEPREPOSTPARVARASSIGN(Starblur, starblur, STARBLUR, ASSIGNTYPE_SUM) -MAKEPREPOSTPARVARASSIGN(Sineblur, sineblur, SINEBLUR, ASSIGNTYPE_SUM) -MAKEPREPOSTVARASSIGN(Circleblur, circleblur, CIRCLEBLUR, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(Starblur, starblur, STARBLUR, eVariationAssignType::ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(Sineblur, sineblur, SINEBLUR, eVariationAssignType::ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(Circleblur, circleblur, CIRCLEBLUR, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(Depth, depth, DEPTH) MAKEPREPOSTPARVAR(CropN, cropn, CROPN) MAKEPREPOSTPARVAR(ShredRad, shredrad, SHRED_RAD) @@ -4696,7 +4484,7 @@ MAKEPREPOSTPARVAR(LinearT, linearT, LINEAR_T) MAKEPREPOSTPARVAR(LinearT3D, linearT3D, LINEAR_T3D) MAKEPREPOSTPARVAR(Ovoid, ovoid, OVOID) MAKEPREPOSTPARVAR(Ovoid3D, ovoid3d, OVOID3D) -MAKEPREPOSTPARVARASSIGN(Spirograph, Spirograph, SPIROGRAPH, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(Spirograph, Spirograph, SPIROGRAPH, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTVAR(Petal, petal, PETAL) MAKEPREPOSTVAR(RoundSpher, roundspher, ROUNDSPHER) MAKEPREPOSTVAR(RoundSpher3D, roundspher3D, ROUNDSPHER3D) @@ -4707,7 +4495,7 @@ MAKEPREPOSTPARVAR(PhoenixJulia, phoenix_julia, PHOENIX_JULIA) MAKEPREPOSTPARVAR(Mobius, Mobius, MOBIUS) MAKEPREPOSTPARVAR(MobiusN, MobiusN, MOBIUSN) MAKEPREPOSTPARVAR(MobiusStrip, mobius_strip, MOBIUS_STRIP) -MAKEPREPOSTPARVARASSIGN(Lissajous, Lissajous, LISSAJOUS, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(Lissajous, Lissajous, LISSAJOUS, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(Svf, svf, SVF) MAKEPREPOSTPARVAR(Target, target, TARGET) MAKEPREPOSTPARVAR(Taurus, taurus, TAURUS) diff --git a/Source/Ember/Variations04.h b/Source/Ember/Variations04.h index dbef1a2..7b41e94 100644 --- a/Source/Ember/Variations04.h +++ b/Source/Ember/Variations04.h @@ -11,7 +11,7 @@ template class EMBER_API ESwirlVariation : public ParametricVariation { public: - ESwirlVariation(T weight = 1.0) : ParametricVariation("eSwirl", VAR_ESWIRL, weight, true) + ESwirlVariation(T weight = 1.0) : ParametricVariation("eSwirl", eVariationId::VAR_ESWIRL, weight, true) { Init(); } @@ -99,7 +99,7 @@ template class EMBER_API LazyTravisVariation : public ParametricVariation { public: - LazyTravisVariation(T weight = 1.0) : ParametricVariation("lazyTravis", VAR_LAZY_TRAVIS, weight) + LazyTravisVariation(T weight = 1.0) : ParametricVariation("lazyTravis", eVariationId::VAR_LAZY_TRAVIS, weight) { Init(); } @@ -346,8 +346,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_SpinIn, prefix + "lazyTravis_spin_in", 1, REAL_CYCLIC, 0, 2)); - m_Params.push_back(ParamWithName(&m_SpinOut, prefix + "lazyTravis_spin_out", 0, REAL_CYCLIC, 0, 2)); + m_Params.push_back(ParamWithName(&m_SpinIn, prefix + "lazyTravis_spin_in", 1, eParamType::REAL_CYCLIC, 0, 2)); + m_Params.push_back(ParamWithName(&m_SpinOut, prefix + "lazyTravis_spin_out", 0, eParamType::REAL_CYCLIC, 0, 2)); m_Params.push_back(ParamWithName(&m_Space, prefix + "lazyTravis_space")); m_Params.push_back(ParamWithName(true, &m_In4, prefix + "lazyTravis_in4"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Out4, prefix + "lazyTravis_out4")); @@ -368,7 +368,7 @@ template class EMBER_API SquishVariation : public ParametricVariation { public: - SquishVariation(T weight = 1.0) : ParametricVariation("squish", VAR_SQUISH, weight) + SquishVariation(T weight = 1.0) : ParametricVariation("squish", eVariationId::VAR_SQUISH, weight) { Init(); } @@ -511,7 +511,7 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Power, prefix + "squish_power", 2, INTEGER, 2, T(INT_MAX))); + m_Params.push_back(ParamWithName(&m_Power, prefix + "squish_power", 2, eParamType::INTEGER, 2, T(INT_MAX))); m_Params.push_back(ParamWithName(true, &m_InvPower, prefix + "squish_inv_power"));//Precalc. } @@ -527,7 +527,7 @@ template class EMBER_API CircusVariation : public ParametricVariation { public: - CircusVariation(T weight = 1.0) : ParametricVariation("circus", VAR_CIRCUS, weight, true, true, true) + CircusVariation(T weight = 1.0) : ParametricVariation("circus", eVariationId::VAR_CIRCUS, weight, true, true, true) { Init(); } @@ -600,7 +600,7 @@ template class EMBER_API TancosVariation : public Variation { public: - TancosVariation(T weight = 1.0) : Variation("tancos", VAR_TANCOS, weight, true) { } + TancosVariation(T weight = 1.0) : Variation("tancos", eVariationId::VAR_TANCOS, weight, true) { } VARCOPY(TancosVariation) @@ -642,7 +642,7 @@ template class EMBER_API RippledVariation : public Variation { public: - RippledVariation(T weight = 1.0) : Variation("rippled", VAR_RIPPLED, weight, true) { } + RippledVariation(T weight = 1.0) : Variation("rippled", eVariationId::VAR_RIPPLED, weight, true) { } VARCOPY(RippledVariation) @@ -685,7 +685,7 @@ template class EMBER_API RotateXVariation : public ParametricVariation { public: - RotateXVariation(T weight = 1.0) : ParametricVariation("rotate_x", VAR_ROTATE_X, weight) + RotateXVariation(T weight = 1.0) : ParametricVariation("rotate_x", eVariationId::VAR_ROTATE_X, weight) { Init(); } @@ -696,7 +696,7 @@ public: { T z = m_RxCos * helper.In.z - m_RxSin * helper.In.y; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.x = helper.In.x; outPoint.m_X = 0; @@ -723,7 +723,7 @@ public: << "\t\treal_t z = " << rxCos << " * vIn.z - " << rxSin << " * vIn.y;\n" << "\n"; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tvOut.x = 0;\n" @@ -771,7 +771,7 @@ template class EMBER_API RotateYVariation : public ParametricVariation { public: - RotateYVariation(T weight = 1.0) : ParametricVariation("rotate_y", VAR_ROTATE_Y, weight) + RotateYVariation(T weight = 1.0) : ParametricVariation("rotate_y", eVariationId::VAR_ROTATE_Y, weight) { Init(); } @@ -782,7 +782,7 @@ public: { helper.Out.x = m_RyCos * helper.In.x - m_RySin * helper.In.z; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.y = 0; outPoint.m_Y = helper.In.y; @@ -807,7 +807,7 @@ public: ss << "\t{\n" << "\t\tvOut.x = " << ryCos << " * vIn.x - " << rySin << " * vIn.z;\n"; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tvOut.y = 0;\n" @@ -854,7 +854,7 @@ template class EMBER_API RotateZVariation : public ParametricVariation { public: - RotateZVariation(T weight = 1.0) : ParametricVariation("rotate_z", VAR_ROTATE_Z, weight) + RotateZVariation(T weight = 1.0) : ParametricVariation("rotate_z", eVariationId::VAR_ROTATE_Z, weight) { Init(); } @@ -866,7 +866,7 @@ public: helper.Out.x = m_RzSin * helper.In.y + m_RzCos * helper.In.x; helper.Out.y = m_RzCos * helper.In.y - m_RzSin * helper.In.x; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.z = helper.In.z; outPoint.m_Z = 0; @@ -890,7 +890,7 @@ public: << "\t\tvOut.x = " << rzSin << " * vIn.y + " << rzCos << " * vIn.x;\n" << "\t\tvOut.y = " << rzCos << " * vIn.y - " << rzSin << " * vIn.x;\n"; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tvOut.z = 0;\n" @@ -936,13 +936,13 @@ template class EMBER_API MirrorXVariation : public Variation { public: - MirrorXVariation(T weight = 1.0) : Variation("mirror_x", VAR_MIRROR_X, weight) { } + MirrorXVariation(T weight = 1.0) : Variation("mirror_x", eVariationId::VAR_MIRROR_X, weight) { } VARCOPY(MirrorXVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.x = fabs(outPoint.m_X); @@ -971,7 +971,7 @@ public: ss << "\t{\n"; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tvOut.x = fabs(outPoint->m_X);\n" @@ -1009,13 +1009,13 @@ template class EMBER_API MirrorYVariation : public Variation { public: - MirrorYVariation(T weight = 1.0) : Variation("mirror_y", VAR_MIRROR_Y, weight) { } + MirrorYVariation(T weight = 1.0) : Variation("mirror_y", eVariationId::VAR_MIRROR_Y, weight) { } VARCOPY(MirrorYVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.y = fabs(outPoint.m_Y); @@ -1044,7 +1044,7 @@ public: ss << "\t{\n"; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tvOut.y = fabs(outPoint->m_Y);\n" @@ -1082,13 +1082,13 @@ template class EMBER_API MirrorZVariation : public Variation { public: - MirrorZVariation(T weight = 1.0) : Variation("mirror_z", VAR_MIRROR_Z, weight) { } + MirrorZVariation(T weight = 1.0) : Variation("mirror_z", eVariationId::VAR_MIRROR_Z, weight) { } VARCOPY(MirrorZVariation) virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.z = fabs(outPoint.m_Z); @@ -1117,7 +1117,7 @@ public: ss << "\t{\n"; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tvOut.z = fabs(outPoint->m_Z);\n" @@ -1154,7 +1154,7 @@ template class EMBER_API RBlurVariation : public ParametricVariation { public: - RBlurVariation(T weight = 1.0) : ParametricVariation("rblur", VAR_RBLUR, weight) + RBlurVariation(T weight = 1.0) : ParametricVariation("rblur", eVariationId::VAR_RBLUR, weight) { Init(); } @@ -1235,7 +1235,7 @@ template class EMBER_API JuliaNabVariation : public ParametricVariation { public: - JuliaNabVariation(T weight = 1.0) : ParametricVariation("juliaNab", VAR_JULIANAB, weight, true) + JuliaNabVariation(T weight = 1.0) : ParametricVariation("juliaNab", eVariationId::VAR_JULIANAB, weight, true) { Init(); } @@ -1324,7 +1324,7 @@ template class EMBER_API SintrangeVariation : public ParametricVariation { public: - SintrangeVariation(T weight = 1.0) : ParametricVariation("sintrange", VAR_SINTRANGE, weight) + SintrangeVariation(T weight = 1.0) : ParametricVariation("sintrange", eVariationId::VAR_SINTRANGE, weight) { Init(); } @@ -1339,7 +1339,7 @@ public: helper.Out.x = m_Weight * std::sin(helper.In.x) * (sqX + m_W - v); helper.Out.y = m_Weight * std::sin(helper.In.y) * (sqY + m_W - v); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1357,7 +1357,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.x) * (sqX + " << w << " - v);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * sin(vIn.y) * (sqY + " << w << " - v);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -1383,7 +1383,7 @@ template class EMBER_API VoronVariation : public ParametricVariation { public: - VoronVariation(T weight = 1.0) : ParametricVariation("Voron", VAR_VORON, weight) + VoronVariation(T weight = 1.0) : ParametricVariation("Voron", eVariationId::VAR_VORON, weight) { Init(); } @@ -1429,7 +1429,7 @@ public: helper.Out.x = m_Weight * (m_K * (helper.In.x - x0) + x0); helper.Out.y = m_Weight * (m_K * (helper.In.y - y0) + y0); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1481,7 +1481,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (" << m_k << " * (vIn.x - x0) + x0);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (" << m_k << " * (vIn.y - y0) + y0);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -1509,10 +1509,10 @@ protected: m_Params.clear(); m_Params.push_back(ParamWithName(&m_K, prefix + "Voron_K", T(0.99))); - m_Params.push_back(ParamWithName(&m_Step, prefix + "Voron_Step", T(0.25), REAL_NONZERO)); - m_Params.push_back(ParamWithName(&m_Num, prefix + "Voron_Num", 1, INTEGER, 1, 25)); - m_Params.push_back(ParamWithName(&m_XSeed, prefix + "Voron_XSeed", 3, INTEGER)); - m_Params.push_back(ParamWithName(&m_YSeed, prefix + "Voron_YSeed", 7, INTEGER)); + m_Params.push_back(ParamWithName(&m_Step, prefix + "Voron_Step", T(0.25), eParamType::REAL_NONZERO)); + m_Params.push_back(ParamWithName(&m_Num, prefix + "Voron_Num", 1, eParamType::INTEGER, 1, 25)); + m_Params.push_back(ParamWithName(&m_XSeed, prefix + "Voron_XSeed", 3, eParamType::INTEGER)); + m_Params.push_back(ParamWithName(&m_YSeed, prefix + "Voron_YSeed", 7, eParamType::INTEGER)); } private: @@ -1540,7 +1540,7 @@ template class EMBER_API WaffleVariation : public ParametricVariation { public: - WaffleVariation(T weight = 1.0) : ParametricVariation("waffle", VAR_WAFFLE, weight) + WaffleVariation(T weight = 1.0) : ParametricVariation("waffle", eVariationId::VAR_WAFFLE, weight) { Init(); } @@ -1578,7 +1578,7 @@ public: helper.Out.x = m_CosR * a + m_SinR * r; helper.Out.y = -m_SinR * a + m_CosR * r; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1623,7 +1623,7 @@ public: << "\n" << "\t\tvOut.x = " << cosr << " * a + " << sinr << " * r;\n" << "\t\tvOut.y = -" << sinr << " * a + " << cosr << " * r;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -1641,7 +1641,7 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Slices, prefix + "waffle_slices", 6, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Slices, prefix + "waffle_slices", 6, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(&m_XThickness, prefix + "waffle_xthickness", T(0.5))); m_Params.push_back(ParamWithName(&m_YThickness, prefix + "waffle_ythickness", T(0.5))); m_Params.push_back(ParamWithName(&m_Rotation, prefix + "waffle_rotation")); @@ -1665,7 +1665,7 @@ template class EMBER_API Square3DVariation : public Variation { public: - Square3DVariation(T weight = 1.0) : Variation("square3D", VAR_SQUARE3D, weight) { } + Square3DVariation(T weight = 1.0) : Variation("square3D", eVariationId::VAR_SQUARE3D, weight) { } VARCOPY(Square3DVariation) @@ -1698,7 +1698,7 @@ template class EMBER_API SuperShape3DVariation : public ParametricVariation { public: - SuperShape3DVariation(T weight = 1.0) : ParametricVariation("SuperShape3D", VAR_SUPER_SHAPE3D, weight) + SuperShape3DVariation(T weight = 1.0) : ParametricVariation("SuperShape3D", eVariationId::VAR_SUPER_SHAPE3D, weight) { Init(); } @@ -1861,7 +1861,7 @@ protected: m_Params.push_back(ParamWithName(&m_N3_1, prefix + "SuperShape3D_n3_1", 1)); m_Params.push_back(ParamWithName(&m_N3_2, prefix + "SuperShape3D_n3_2", 1)); m_Params.push_back(ParamWithName(&m_Spiral, prefix + "SuperShape3D_spiral")); - m_Params.push_back(ParamWithName(&m_Toroidmap, prefix + "SuperShape3D_toroidmap", 0, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Toroidmap, prefix + "SuperShape3D_toroidmap", 0, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(true, &m_N1n_1, prefix + "SuperShape3D_n1n1"));//Precalc. m_Params.push_back(ParamWithName(true, &m_N1n_2, prefix + "SuperShape3D_n1n2")); m_Params.push_back(ParamWithName(true, &m_An2_1, prefix + "SuperShape3D_an21")); @@ -1910,7 +1910,7 @@ template class EMBER_API Sphyp3DVariation : public ParametricVariation { public: - Sphyp3DVariation(T weight = 1.0) : ParametricVariation("sphyp3D", VAR_SPHYP3D, weight, true) + Sphyp3DVariation(T weight = 1.0) : ParametricVariation("sphyp3D", eVariationId::VAR_SPHYP3D, weight, true) { Init(); } @@ -1982,7 +1982,7 @@ protected: m_Params.push_back(ParamWithName(&m_StretchX, prefix + "sphyp3D_stretchX", 1)); m_Params.push_back(ParamWithName(&m_StretchY, prefix + "sphyp3D_stretchY", 1)); m_Params.push_back(ParamWithName(&m_StretchZ, prefix + "sphyp3D_stretchZ", 1)); - m_Params.push_back(ParamWithName(&m_ZOn, prefix + "sphyp3D_zOn", 1, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_ZOn, prefix + "sphyp3D_zOn", 1, eParamType::INTEGER, 0, 1)); } private: @@ -1999,7 +1999,7 @@ template class EMBER_API CirclecropVariation : public ParametricVariation { public: - CirclecropVariation(T weight = 1.0) : ParametricVariation("circlecrop", VAR_CIRCLECROP, weight) + CirclecropVariation(T weight = 1.0) : ParametricVariation("circlecrop", eVariationId::VAR_CIRCLECROP, weight) { Init(); } @@ -2022,7 +2022,7 @@ public: if (cr0 && esc) { - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) helper.m_TransX = helper.m_TransY = 0; else outPoint.m_X = outPoint.m_Y = 0; @@ -2079,7 +2079,7 @@ public: << "\t\tif (cr0 && esc)\n" << "\t\t{\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) ss << "\t\t transX = transY = 0;\n"; else ss << "\t\t outPoint->m_X = outPoint->m_Y = 0;\n"; @@ -2126,7 +2126,7 @@ protected: m_Params.push_back(ParamWithName(&m_X, prefix + "circlecrop_x")); m_Params.push_back(ParamWithName(&m_Y, prefix + "circlecrop_y")); m_Params.push_back(ParamWithName(&m_ScatterArea, prefix + "circlecrop_scatter_area")); - m_Params.push_back(ParamWithName(&m_Zero, prefix + "circlecrop_zero", 1, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Zero, prefix + "circlecrop_zero", 1, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(true, &m_Ca, prefix + "circlecrop_ca")); } @@ -2146,7 +2146,7 @@ template class EMBER_API Julian3DxVariation : public ParametricVariation { public: - Julian3DxVariation(T weight = 1.0) : ParametricVariation("julian3Dx", VAR_JULIAN3DX, weight, true, true) + Julian3DxVariation(T weight = 1.0) : ParametricVariation("julian3Dx", eVariationId::VAR_JULIAN3DX, weight, true, true) { Init(); } @@ -2215,7 +2215,7 @@ protected: m_Params.clear(); m_Params.push_back(ParamWithName(&m_Dist, prefix + "julian3Dx_dist", 1)); - m_Params.push_back(ParamWithName(&m_Power, prefix + "julian3Dx_power", 2, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "julian3Dx_power", 2, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(&m_A, prefix + "julian3Dx_a", 1)); m_Params.push_back(ParamWithName(&m_B, prefix + "julian3Dx_b")); m_Params.push_back(ParamWithName(&m_C, prefix + "julian3Dx_c")); @@ -2246,7 +2246,7 @@ template class EMBER_API FourthVariation : public ParametricVariation { public: - FourthVariation(T weight = 1.0) : ParametricVariation("fourth", VAR_FOURTH, weight, true, true, false, false, true) + FourthVariation(T weight = 1.0) : ParametricVariation("fourth", eVariationId::VAR_FOURTH, weight, true, true, false, false, true) { Init(); } @@ -2306,7 +2306,7 @@ public: helper.Out.y = m_Weight * helper.In.y; } - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -2374,7 +2374,7 @@ public: << "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n" << "\t\t}\n" << "\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -2396,7 +2396,7 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Spin, prefix + "fourth_spin", T(M_PI), REAL_CYCLIC, 0, M_2PI)); + m_Params.push_back(ParamWithName(&m_Spin, prefix + "fourth_spin", T(M_PI), eParamType::REAL_CYCLIC, 0, M_2PI)); m_Params.push_back(ParamWithName(&m_Space, prefix + "fourth_space")); m_Params.push_back(ParamWithName(&m_Twist, prefix + "fourth_twist")); m_Params.push_back(ParamWithName(&m_X, prefix + "fourth_x")); @@ -2420,7 +2420,7 @@ template class EMBER_API MobiqVariation : public ParametricVariation { public: - MobiqVariation(T weight = 1.0) : ParametricVariation("mobiq", VAR_MOBIQ, weight) + MobiqVariation(T weight = 1.0) : ParametricVariation("mobiq", eVariationId::VAR_MOBIQ, weight) { Init(); } @@ -2576,7 +2576,7 @@ template class EMBER_API SpherivoidVariation : public ParametricVariation { public: - SpherivoidVariation(T weight = 1.0) : ParametricVariation("spherivoid", VAR_SPHERIVOID, weight, true, true, false, false, true) + SpherivoidVariation(T weight = 1.0) : ParametricVariation("spherivoid", eVariationId::VAR_SPHERIVOID, weight, true, true, false, false, true) { Init(); } @@ -2642,7 +2642,7 @@ template class EMBER_API FarblurVariation : public ParametricVariation { public: - FarblurVariation(T weight = 1.0) : ParametricVariation("farblur", VAR_FARBLUR, weight) + FarblurVariation(T weight = 1.0) : ParametricVariation("farblur", eVariationId::VAR_FARBLUR, weight) { Init(); } @@ -2735,7 +2735,7 @@ template class EMBER_API CurlSPVariation : public ParametricVariation { public: - CurlSPVariation(T weight = 1.0) : ParametricVariation("curl_sp", VAR_CURL_SP, weight) + CurlSPVariation(T weight = 1.0) : ParametricVariation("curl_sp", eVariationId::VAR_CURL_SP, weight) { Init(); } @@ -2814,7 +2814,7 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Power, prefix + "curl_sp_pow", 1, REAL_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "curl_sp_pow", 1, eParamType::REAL_NONZERO)); m_Params.push_back(ParamWithName(&m_C1, prefix + "curl_sp_c1")); m_Params.push_back(ParamWithName(&m_C2, prefix + "curl_sp_c2")); m_Params.push_back(ParamWithName(&m_Sx, prefix + "curl_sp_sx")); @@ -2844,7 +2844,7 @@ template class EMBER_API HeatVariation : public ParametricVariation { public: - HeatVariation(T weight = 1.0) : ParametricVariation("heat", VAR_HEAT, weight, true, false, false, false, true) + HeatVariation(T weight = 1.0) : ParametricVariation("heat", eVariationId::VAR_HEAT, weight, true, false, false, false, true) { Init(); } @@ -2995,7 +2995,7 @@ template class EMBER_API Interference2Variation : public ParametricVariation { public: - Interference2Variation(T weight = 1.0) : ParametricVariation("interference2", VAR_INTERFERENCE2, weight) + Interference2Variation(T weight = 1.0) : ParametricVariation("interference2", eVariationId::VAR_INTERFERENCE2, weight) { Init(); } @@ -3051,7 +3051,7 @@ public: helper.Out.x = m_Weight * (fp1x + fp2x); helper.Out.y = m_Weight * (fp1y + fp2y); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -3119,7 +3119,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (fp1x + fp2x);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (fp1y + fp2y);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -3155,12 +3155,12 @@ protected: m_Params.push_back(ParamWithName(&m_B1, prefix + "interference2_b1", 1)); m_Params.push_back(ParamWithName(&m_C1, prefix + "interference2_c1")); m_Params.push_back(ParamWithName(&m_P1, prefix + "interference2_p1", 1)); - m_Params.push_back(ParamWithName(&m_T1, prefix + "interference2_t1", 0, INTEGER, 0, 2)); + m_Params.push_back(ParamWithName(&m_T1, prefix + "interference2_t1", 0, eParamType::INTEGER, 0, 2)); m_Params.push_back(ParamWithName(&m_A2, prefix + "interference2_a2", 1)); m_Params.push_back(ParamWithName(&m_B2, prefix + "interference2_b2", 1)); m_Params.push_back(ParamWithName(&m_C2, prefix + "interference2_c2")); m_Params.push_back(ParamWithName(&m_P2, prefix + "interference2_p2", 1)); - m_Params.push_back(ParamWithName(&m_T2, prefix + "interference2_t2", 0, INTEGER, 0, 2)); + m_Params.push_back(ParamWithName(&m_T2, prefix + "interference2_t2", 0, eParamType::INTEGER, 0, 2)); } private: @@ -3198,7 +3198,7 @@ template class EMBER_API SinqVariation : public Variation { public: - SinqVariation(T weight = 1.0) : Variation("sinq", VAR_SINQ, weight) { } + SinqVariation(T weight = 1.0) : Variation("sinq", eVariationId::VAR_SINQ, weight) { } VARCOPY(SinqVariation) @@ -3250,7 +3250,7 @@ template class EMBER_API SinhqVariation : public Variation { public: - SinhqVariation(T weight = 1.0) : Variation("sinhq", VAR_SINHQ, weight) { } + SinhqVariation(T weight = 1.0) : Variation("sinhq", eVariationId::VAR_SINHQ, weight) { } VARCOPY(SinhqVariation) @@ -3302,7 +3302,7 @@ template class EMBER_API SecqVariation : public Variation { public: - SecqVariation(T weight = 1.0) : Variation("secq", VAR_SECQ, weight, true) { } + SecqVariation(T weight = 1.0) : Variation("secq", eVariationId::VAR_SECQ, weight, true) { } VARCOPY(SecqVariation) @@ -3356,7 +3356,7 @@ template class EMBER_API SechqVariation : public Variation { public: - SechqVariation(T weight = 1.0) : Variation("sechq", VAR_SECHQ, weight, true) { } + SechqVariation(T weight = 1.0) : Variation("sechq", eVariationId::VAR_SECHQ, weight, true) { } VARCOPY(SechqVariation) @@ -3410,7 +3410,7 @@ template class EMBER_API TanqVariation : public Variation { public: - TanqVariation(T weight = 1.0) : Variation("tanq", VAR_TANQ, weight) { } + TanqVariation(T weight = 1.0) : Variation("tanq", eVariationId::VAR_TANQ, weight) { } VARCOPY(TanqVariation) @@ -3469,7 +3469,7 @@ template class EMBER_API TanhqVariation : public Variation { public: - TanhqVariation(T weight = 1.0) : Variation("tanhq", VAR_TANHQ, weight) { } + TanhqVariation(T weight = 1.0) : Variation("tanhq", eVariationId::VAR_TANHQ, weight) { } VARCOPY(TanhqVariation) @@ -3528,7 +3528,7 @@ template class EMBER_API CosqVariation : public Variation { public: - CosqVariation(T weight = 1.0) : Variation("cosq", VAR_COSQ, weight) { } + CosqVariation(T weight = 1.0) : Variation("cosq", eVariationId::VAR_COSQ, weight) { } VARCOPY(CosqVariation) @@ -3580,7 +3580,7 @@ template class EMBER_API CoshqVariation : public Variation { public: - CoshqVariation(T weight = 1.0) : Variation("coshq", VAR_COSHQ, weight) { } + CoshqVariation(T weight = 1.0) : Variation("coshq", eVariationId::VAR_COSHQ, weight) { } VARCOPY(CoshqVariation) @@ -3632,7 +3632,7 @@ template class EMBER_API CotqVariation : public Variation { public: - CotqVariation(T weight = 1.0) : Variation("cotq", VAR_COTQ, weight) { } + CotqVariation(T weight = 1.0) : Variation("cotq", eVariationId::VAR_COTQ, weight) { } VARCOPY(CotqVariation) @@ -3691,7 +3691,7 @@ template class EMBER_API CothqVariation : public Variation { public: - CothqVariation(T weight = 1.0) : Variation("cothq", VAR_COTHQ, weight) { } + CothqVariation(T weight = 1.0) : Variation("cothq", eVariationId::VAR_COTHQ, weight) { } VARCOPY(CothqVariation) @@ -3750,7 +3750,7 @@ template class EMBER_API CscqVariation : public Variation { public: - CscqVariation(T weight = 1.0) : Variation("cscq", VAR_CSCQ, weight, true) { } + CscqVariation(T weight = 1.0) : Variation("cscq", eVariationId::VAR_CSCQ, weight, true) { } VARCOPY(CscqVariation) @@ -3804,7 +3804,7 @@ template class EMBER_API CschqVariation : public Variation { public: - CschqVariation(T weight = 1.0) : Variation("cschq", VAR_CSCHQ, weight, true) { } + CschqVariation(T weight = 1.0) : Variation("cschq", eVariationId::VAR_CSCHQ, weight, true) { } VARCOPY(CschqVariation) @@ -3858,7 +3858,7 @@ template class EMBER_API EstiqVariation : public Variation { public: - EstiqVariation(T weight = 1.0) : Variation("estiq", VAR_ESTIQ, weight) { } + EstiqVariation(T weight = 1.0) : Variation("estiq", eVariationId::VAR_ESTIQ, weight) { } VARCOPY(EstiqVariation) @@ -3908,7 +3908,7 @@ template class EMBER_API LoqVariation : public ParametricVariation { public: - LoqVariation(T weight = 1.0) : ParametricVariation("loq", VAR_LOQ, weight) + LoqVariation(T weight = 1.0) : ParametricVariation("loq", eVariationId::VAR_LOQ, weight) { Init(); } @@ -3962,7 +3962,7 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Base, prefix + "loq_base", T(M_E), REAL, EPS, TMAX)); + m_Params.push_back(ParamWithName(&m_Base, prefix + "loq_base", T(M_E), eParamType::REAL, EPS, TMAX)); m_Params.push_back(ParamWithName(true, &m_Denom, prefix + "loq_denom"));//Precalc. } @@ -3978,7 +3978,7 @@ template class EMBER_API CurvatureVariation : public Variation { public: - CurvatureVariation(T weight = 1.0) : Variation("curvature", VAR_CURVATURE, weight, true, true, false, false, true) { } + CurvatureVariation(T weight = 1.0) : Variation("curvature", eVariationId::VAR_CURVATURE, weight, true, true, false, false, true) { } VARCOPY(CurvatureVariation) @@ -3986,7 +3986,7 @@ public: { helper.Out.x = m_Weight / Zeps(helper.m_PrecalcSqrtSumSquares); helper.Out.y = helper.m_PrecalcAtanyx; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -3997,7 +3997,7 @@ public: ss << "\t{\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSqrtSumSquares);\n" << "\t\tvOut.y = precalcAtanyx;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -4016,7 +4016,7 @@ template class EMBER_API QodeVariation : public ParametricVariation { public: - QodeVariation(T weight = 1.0) : ParametricVariation("q_ode", VAR_Q_ODE, weight) + QodeVariation(T weight = 1.0) : ParametricVariation("q_ode", eVariationId::VAR_Q_ODE, weight) { Init(); } @@ -4033,7 +4033,7 @@ public: (m_Q04 * xy + m_Q05 * helper.In.y + m_Q06 * sqy); helper.Out.y = (m_Q07 + m_Q08 * helper.In.x + m_Q09 * sqx) + (m_Q10 * xy + m_Weight * m_Q11 * helper.In.y + m_Q12 * sqy); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -4064,7 +4064,7 @@ public: << "\t\t (" << q04 << " * xy + " << q05 << " * vIn.y + " << q06 << " * sqy);\n" << "\t\tvOut.y = (" << q07 << " + " << q08 << " * vIn.x + " << q09 << " * sqx) + \n" << "\t\t (" << q10 << " * xy + xform->m_VariationWeights[" << varIndex << "] * " << q11 << " * vIn.y + " << q12 << " * sqy);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -4112,7 +4112,7 @@ template class EMBER_API BlurHeartVariation : public ParametricVariation { public: - BlurHeartVariation(T weight = 1.0) : ParametricVariation("blur_heart", VAR_BLUR_HEART, weight) + BlurHeartVariation(T weight = 1.0) : ParametricVariation("blur_heart", eVariationId::VAR_BLUR_HEART, weight) { Init(); } @@ -4143,7 +4143,7 @@ public: helper.Out.x = xx * m_Weight; helper.Out.y = yy * m_Weight; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -4177,7 +4177,7 @@ public: << "\n" << "\t\tvOut.x = xx * xform->m_VariationWeights[" << varIndex << "];\n" << "\t\tvOut.y = yy * xform->m_VariationWeights[" << varIndex << "];\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -4212,7 +4212,7 @@ template class EMBER_API TruchetVariation : public ParametricVariation { public: - TruchetVariation(T weight = 1.0) : ParametricVariation("Truchet", VAR_TRUCHET, weight) + TruchetVariation(T weight = 1.0) : ParametricVariation("Truchet", eVariationId::VAR_TRUCHET, weight) { Init(); } @@ -4339,7 +4339,7 @@ public: helper.Out.y += m_Size * (y + Floor(helper.In.y)); } - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -4477,7 +4477,7 @@ public: << "\t\t vOut.y += " << size << " * (y + floor(vIn.y));\n" << "\t\t}\n" << "\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -4503,11 +4503,11 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Extended, prefix + "Truchet_extended", 0, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_Exponent, prefix + "Truchet_exponent", 2, REAL_CYCLIC, T(0.001), 2)); - m_Params.push_back(ParamWithName(&m_ArcWidth, prefix + "Truchet_arc_width", T(0.5), REAL_CYCLIC, T(0.001), 1)); + m_Params.push_back(ParamWithName(&m_Extended, prefix + "Truchet_extended", 0, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Exponent, prefix + "Truchet_exponent", 2, eParamType::REAL_CYCLIC, T(0.001), 2)); + m_Params.push_back(ParamWithName(&m_ArcWidth, prefix + "Truchet_arc_width", T(0.5), eParamType::REAL_CYCLIC, T(0.001), 1)); m_Params.push_back(ParamWithName(&m_Rotation, prefix + "Truchet_rotation")); - m_Params.push_back(ParamWithName(&m_Size, prefix + "Truchet_size", 1, REAL_CYCLIC, T(0.001), 10)); + m_Params.push_back(ParamWithName(&m_Size, prefix + "Truchet_size", 1, eParamType::REAL_CYCLIC, T(0.001), 10)); m_Params.push_back(ParamWithName(&m_Seed, prefix + "Truchet_seed", 50)); m_Params.push_back(ParamWithName(true, &m_OneOverEx, prefix + "Truchet_one_over_ex"));//Precalc. m_Params.push_back(ParamWithName(true, &m_AbsSeed, prefix + "Truchet_abs_seed")); @@ -4537,7 +4537,7 @@ template class EMBER_API GdoffsVariation : public ParametricVariation { public: - GdoffsVariation(T weight = 1.0) : ParametricVariation("gdoffs", VAR_GDOFFS, weight) + GdoffsVariation(T weight = 1.0) : ParametricVariation("gdoffs", eVariationId::VAR_GDOFFS, weight) { Init(); } @@ -4650,14 +4650,14 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_DeltaX, prefix + "gdoffs_delta_x", 0, REAL, 0, 16)); - m_Params.push_back(ParamWithName(&m_DeltaY, prefix + "gdoffs_delta_y", 0, REAL, 0, 16)); + m_Params.push_back(ParamWithName(&m_DeltaX, prefix + "gdoffs_delta_x", 0, eParamType::REAL, 0, 16)); + m_Params.push_back(ParamWithName(&m_DeltaY, prefix + "gdoffs_delta_y", 0, eParamType::REAL, 0, 16)); m_Params.push_back(ParamWithName(&m_AreaX, prefix + "gdoffs_area_x", 2)); m_Params.push_back(ParamWithName(&m_AreaY, prefix + "gdoffs_area_y", 2)); m_Params.push_back(ParamWithName(&m_CenterX, prefix + "gdoffs_center_x")); m_Params.push_back(ParamWithName(&m_CenterY, prefix + "gdoffs_center_y")); - m_Params.push_back(ParamWithName(&m_Gamma, prefix + "gdoffs_gamma", 1, INTEGER, 1, 6)); - m_Params.push_back(ParamWithName(&m_Square, prefix + "gdoffs_square", 0, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Gamma, prefix + "gdoffs_gamma", 1, eParamType::INTEGER, 1, 6)); + m_Params.push_back(ParamWithName(&m_Square, prefix + "gdoffs_square", 0, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(true, &m_Dx, prefix + "gdoffs_dx")); m_Params.push_back(ParamWithName(true, &m_Ax, prefix + "gdoffs_ax")); m_Params.push_back(ParamWithName(true, &m_Cx, prefix + "gdoffs_cx")); @@ -4698,7 +4698,7 @@ template class EMBER_API OctagonVariation : public ParametricVariation { public: - OctagonVariation(T weight = 1.0) : ParametricVariation("octagon", VAR_OCTAGON, weight) + OctagonVariation(T weight = 1.0) : ParametricVariation("octagon", eVariationId::VAR_OCTAGON, weight) { Init(); } @@ -4842,7 +4842,7 @@ template class EMBER_API TradeVariation : public ParametricVariation { public: - TradeVariation(T weight = 1.0) : ParametricVariation("trade", VAR_TRADE, weight) + TradeVariation(T weight = 1.0) : ParametricVariation("trade", eVariationId::VAR_TRADE, weight) { Init(); } @@ -4892,7 +4892,7 @@ public: } } - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -4950,7 +4950,7 @@ public: << "\t\t }\n" << "\t\t}\n" << "\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -4968,10 +4968,10 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_R1, prefix + "trade_r1", 1, REAL, EPS, TMAX)); - m_Params.push_back(ParamWithName(&m_D1, prefix + "trade_d1", 1, REAL, 0, TMAX)); - m_Params.push_back(ParamWithName(&m_R2, prefix + "trade_r2", 1, REAL, EPS, TMAX)); - m_Params.push_back(ParamWithName(&m_D2, prefix + "trade_d2", 1, REAL, 0, TMAX)); + m_Params.push_back(ParamWithName(&m_R1, prefix + "trade_r1", 1, eParamType::REAL, EPS, TMAX)); + m_Params.push_back(ParamWithName(&m_D1, prefix + "trade_d1", 1, eParamType::REAL, 0, TMAX)); + m_Params.push_back(ParamWithName(&m_R2, prefix + "trade_r2", 1, eParamType::REAL, EPS, TMAX)); + m_Params.push_back(ParamWithName(&m_D2, prefix + "trade_d2", 1, eParamType::REAL, 0, TMAX)); m_Params.push_back(ParamWithName(true, &m_C1, prefix + "trade_c1")); m_Params.push_back(ParamWithName(true, &m_C2, prefix + "trade_c2")); } @@ -4992,7 +4992,7 @@ template class EMBER_API JuliacVariation : public ParametricVariation { public: - JuliacVariation(T weight = 1.0) : ParametricVariation("Juliac", VAR_JULIAC, weight, true, false, false, false, true) + JuliacVariation(T weight = 1.0) : ParametricVariation("Juliac", eVariationId::VAR_JULIAC, weight, true, false, false, false, true) { Init(); } @@ -5008,7 +5008,7 @@ public: helper.Out.x = m_Weight * mod2 * std::cos(temp); helper.Out.y = m_Weight * mod2 * std::sin(temp); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -5031,7 +5031,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * mod2 * cos(temp);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * mod2 * sin(temp);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -5071,7 +5071,7 @@ template class EMBER_API Blade3DVariation : public Variation { public: - Blade3DVariation(T weight = 1.0) : Variation("blade3D", VAR_BLADE3D, weight, true, true) { } + Blade3DVariation(T weight = 1.0) : Variation("blade3D", eVariationId::VAR_BLADE3D, weight, true, true) { } VARCOPY(Blade3DVariation) @@ -5112,7 +5112,7 @@ template class EMBER_API Blob3DVariation : public ParametricVariation { public: - Blob3DVariation(T weight = 1.0) : ParametricVariation("blob3D", VAR_BLOB3D, weight, true, true, true, true) + Blob3DVariation(T weight = 1.0) : ParametricVariation("blob3D", eVariationId::VAR_BLOB3D, weight, true, true, true, true) { Init(); } @@ -5188,7 +5188,7 @@ template class EMBER_API BlockyVariation : public ParametricVariation { public: - BlockyVariation(T weight = 1.0) : ParametricVariation("blocky", VAR_BLOCKY, weight, true) + BlockyVariation(T weight = 1.0) : ParametricVariation("blocky", eVariationId::VAR_BLOCKY, weight, true) { Init(); } @@ -5213,7 +5213,7 @@ public: b = SafeSqrt(1 - SQR(a)); helper.Out.y = m_Vy * atan2(a, b) * r; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -5246,7 +5246,7 @@ public: << "\t\tb = SafeSqrt(1 - SQR(a));\n" << "\n" << "\t\tvOut.y = " << vy << " * atan2(a, b) * r;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -5272,7 +5272,7 @@ protected: m_Params.clear(); m_Params.push_back(ParamWithName(&m_X, prefix + "blocky_x", 1)); m_Params.push_back(ParamWithName(&m_Y, prefix + "blocky_y", 1)); - m_Params.push_back(ParamWithName(&m_Mp, prefix + "blocky_mp", 4, REAL_NONZERO)); + m_Params.push_back(ParamWithName(&m_Mp, prefix + "blocky_mp", 4, eParamType::REAL_NONZERO)); m_Params.push_back(ParamWithName(true, &m_V, prefix + "blocky_v"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Vx, prefix + "blocky_vx")); m_Params.push_back(ParamWithName(true, &m_Vy, prefix + "blocky_vy")); @@ -5303,9 +5303,9 @@ MAKEPREPOSTPARVAR(RBlur, rblur, RBLUR) MAKEPREPOSTPARVAR(JuliaNab, juliaNab, JULIANAB) MAKEPREPOSTPARVAR(Sintrange, sintrange, SINTRANGE) MAKEPREPOSTPARVAR(Voron, Voron, VORON) -MAKEPREPOSTPARVARASSIGN(Waffle, waffle, WAFFLE, ASSIGNTYPE_SUM) -MAKEPREPOSTVARASSIGN(Square3D, square3D, SQUARE3D, ASSIGNTYPE_SUM) -MAKEPREPOSTPARVARASSIGN(SuperShape3D, SuperShape3D, SUPER_SHAPE3D, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(Waffle, waffle, WAFFLE, eVariationAssignType::ASSIGNTYPE_SUM) +MAKEPREPOSTVARASSIGN(Square3D, square3D, SQUARE3D, eVariationAssignType::ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(SuperShape3D, SuperShape3D, SUPER_SHAPE3D, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(Sphyp3D, sphyp3D, SPHYP3D) MAKEPREPOSTPARVAR(Circlecrop, circlecrop, CIRCLECROP) MAKEPREPOSTPARVAR(Julian3Dx, julian3Dx, JULIAN3DX) @@ -5332,7 +5332,7 @@ MAKEPREPOSTVAR(Estiq, estiq, ESTIQ) MAKEPREPOSTPARVAR(Loq, loq, LOQ) MAKEPREPOSTVAR(Curvature, curvature, CURVATURE) MAKEPREPOSTPARVAR(Qode, q_ode, Q_ODE) -MAKEPREPOSTPARVARASSIGN(BlurHeart, blur_heart, BLUR_HEART, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(BlurHeart, blur_heart, BLUR_HEART, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(Truchet, Truchet, TRUCHET) MAKEPREPOSTPARVAR(Gdoffs, gdoffs, GDOFFS) MAKEPREPOSTPARVAR(Octagon, octagon, OCTAGON) @@ -5350,7 +5350,7 @@ MAKEPREPOSTPARVAR(Blocky, blocky, BLOCKY) //class EMBER_API LinearXZVariation : public Variation //{ //public: -// LinearXZVariation(T weight = 1.0) : Variation("linearxz", VAR_LINEAR_XZ, weight) { } +// LinearXZVariation(T weight = 1.0) : Variation("linearxz", eVariationId::VAR_LINEAR_XZ, weight) { } // // VARCOPY(LinearXZVariation) // @@ -5381,7 +5381,7 @@ MAKEPREPOSTPARVAR(Blocky, blocky, BLOCKY) //class EMBER_API LinearYZVariation : public Variation //{ //public: -// LinearYZVariation(T weight = 1.0) : Variation("linearyz", VAR_LINEAR_YZ, weight) { } +// LinearYZVariation(T weight = 1.0) : Variation("linearyz", eVariationId::VAR_LINEAR_YZ, weight) { } // // VARCOPY(LinearYZVariation) // diff --git a/Source/Ember/Variations05.h b/Source/Ember/Variations05.h index d8457f1..88ca26d 100644 --- a/Source/Ember/Variations05.h +++ b/Source/Ember/Variations05.h @@ -11,7 +11,7 @@ template class EMBER_API Bubble2Variation : public ParametricVariation { public: - Bubble2Variation(T weight = 1.0) : ParametricVariation("bubble2", VAR_BUBBLE2, weight, true) + Bubble2Variation(T weight = 1.0) : ParametricVariation("bubble2", eVariationId::VAR_BUBBLE2, weight, true) { Init(); } @@ -86,7 +86,7 @@ template class EMBER_API CircleLinearVariation : public ParametricVariation { public: - CircleLinearVariation(T weight = 1.0) : ParametricVariation("CircleLinear", VAR_CIRCLELINEAR, weight) + CircleLinearVariation(T weight = 1.0) : ParametricVariation("CircleLinear", eVariationId::VAR_CIRCLELINEAR, weight) { Init(); } @@ -139,7 +139,7 @@ public: helper.Out.x = m_Weight * (x + (m * 2 + 1) * m_Sc); helper.Out.y = m_Weight * (y + (n * 2 + 1) * m_Sc); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -202,7 +202,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (x + (m * 2 + 1) * " << sc << ");\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (y + (n * 2 + 1) * " << sc << ");\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -234,14 +234,14 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Sc, prefix + "CircleLinear_Sc", 1, REAL_NONZERO)); + m_Params.push_back(ParamWithName(&m_Sc, prefix + "CircleLinear_Sc", 1, eParamType::REAL_NONZERO)); m_Params.push_back(ParamWithName(&m_K, prefix + "CircleLinear_K", T(0.5))); m_Params.push_back(ParamWithName(&m_Dens1, prefix + "CircleLinear_Dens1", T(0.5))); m_Params.push_back(ParamWithName(&m_Dens2, prefix + "CircleLinear_Dens2", T(0.5))); m_Params.push_back(ParamWithName(&m_Reverse, prefix + "CircleLinear_Reverse", 1)); m_Params.push_back(ParamWithName(&m_X, prefix + "CircleLinear_X", 10)); m_Params.push_back(ParamWithName(&m_Y, prefix + "CircleLinear_Y", 10)); - m_Params.push_back(ParamWithName(&m_Seed, prefix + "CircleLinear_Seed", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_Seed, prefix + "CircleLinear_Seed", 0, eParamType::INTEGER)); } private: @@ -273,7 +273,7 @@ template class EMBER_API CircleRandVariation : public ParametricVariation { public: - CircleRandVariation(T weight = 1.0) : ParametricVariation("CircleRand", VAR_CIRCLERAND, weight) + CircleRandVariation(T weight = 1.0) : ParametricVariation("CircleRand", eVariationId::VAR_CIRCLERAND, weight) { Init(); } @@ -302,7 +302,7 @@ public: helper.Out.x = m_Weight * (x + (m * 2 + 1) * m_Sc); helper.Out.y = m_Weight * (y + (n * 2 + 1) * m_Sc); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -338,7 +338,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (x + (m * 2 + 1) * " << sc << ");\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (y + (n * 2 + 1) * " << sc << ");\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -370,11 +370,11 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Sc, prefix + "CircleRand_Sc", 1, REAL_NONZERO)); + m_Params.push_back(ParamWithName(&m_Sc, prefix + "CircleRand_Sc", 1, eParamType::REAL_NONZERO)); m_Params.push_back(ParamWithName(&m_Dens, prefix + "CircleRand_Dens", T(0.5))); m_Params.push_back(ParamWithName(&m_X, prefix + "CircleRand_X", 10)); m_Params.push_back(ParamWithName(&m_Y, prefix + "CircleRand_Y", 10)); - m_Params.push_back(ParamWithName(&m_Seed, prefix + "CircleRand_Seed", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_Seed, prefix + "CircleRand_Seed", 0, eParamType::INTEGER)); } private: @@ -403,7 +403,7 @@ template class EMBER_API CircleTrans1Variation : public ParametricVariation { public: - CircleTrans1Variation(T weight = 1.0) : ParametricVariation("CircleTrans1", VAR_CIRCLETRANS1, weight) + CircleTrans1Variation(T weight = 1.0) : ParametricVariation("CircleTrans1", eVariationId::VAR_CIRCLETRANS1, weight) { Init(); } @@ -435,7 +435,7 @@ public: helper.Out.x = m_Weight * ux; helper.Out.y = m_Weight * uy; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -474,7 +474,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * ux;\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * uy;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -537,11 +537,11 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Sc, prefix + "CircleTrans1_Sc", 1, REAL_NONZERO)); + m_Params.push_back(ParamWithName(&m_Sc, prefix + "CircleTrans1_Sc", 1, eParamType::REAL_NONZERO)); m_Params.push_back(ParamWithName(&m_Dens, prefix + "CircleTrans1_Dens", T(0.5))); m_Params.push_back(ParamWithName(&m_X, prefix + "CircleTrans1_X", 10)); m_Params.push_back(ParamWithName(&m_Y, prefix + "CircleTrans1_Y", 10)); - m_Params.push_back(ParamWithName(&m_Seed, prefix + "CircleTrans1_Seed", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_Seed, prefix + "CircleTrans1_Seed", 0, eParamType::INTEGER)); } private: @@ -600,7 +600,7 @@ template class EMBER_API Cubic3DVariation : public ParametricVariation { public: - Cubic3DVariation(T weight = 1.0) : ParametricVariation("cubic3D", VAR_CUBIC3D, weight) + Cubic3DVariation(T weight = 1.0) : ParametricVariation("cubic3D", eVariationId::VAR_CUBIC3D, weight) { Init(); } @@ -622,7 +622,7 @@ public: else znxy = 1 - (m_SmoothStyle * (1 - ((exnze + wynze) * T(0.5)))); - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { px = helper.In.x; py = helper.In.y; @@ -707,7 +707,7 @@ public: << "\t\telse\n" << "\t\t znxy = 1 - (" << smoothStyle << " * (1 - ((exnze + wynze) * (real_t)(0.5))));\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\tpx = vIn.x;\n" @@ -824,7 +824,7 @@ template class EMBER_API CubicLattice3DVariation : public ParametricVariation { public: - CubicLattice3DVariation(T weight = 1.0) : ParametricVariation("cubicLattice_3D", VAR_CUBIC_LATTICE3D, weight) + CubicLattice3DVariation(T weight = 1.0) : ParametricVariation("cubicLattice_3D", eVariationId::VAR_CUBIC_LATTICE3D, weight) { Init(); } @@ -849,7 +849,7 @@ public: znxy = 1; } - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { px = helper.In.x; py = helper.In.y; @@ -939,7 +939,7 @@ public: << "\t\t znxy = 1;\n" << "\t\t}\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\tpx = vIn.x;\n" @@ -1021,7 +1021,7 @@ protected: m_Params.clear(); m_Params.push_back(ParamWithName(&m_Xpand, prefix + "cubicLattice_3D_xpand", T(0.2)));//Original used a prefix of cubic3D_, which is incompatible with Ember's design. - m_Params.push_back(ParamWithName(&m_Style, prefix + "cubicLattice_3D_style", 1, INTEGER, 1, 2)); + m_Params.push_back(ParamWithName(&m_Style, prefix + "cubicLattice_3D_style", 1, eParamType::INTEGER, 1, 2)); m_Params.push_back(ParamWithName(true, &m_Fill, prefix + "cubicLattice_3D_fill"));//Precalc. } @@ -1038,7 +1038,7 @@ template class EMBER_API Foci3DVariation : public Variation { public: - Foci3DVariation(T weight = 1.0) : Variation("foci_3D", VAR_FOCI3D, weight, false, false, false, false, true) { } + Foci3DVariation(T weight = 1.0) : Variation("foci_3D", eVariationId::VAR_FOCI3D, weight, false, false, false, false, true) { } VARCOPY(Foci3DVariation) @@ -1081,7 +1081,7 @@ template class EMBER_API HoVariation : public ParametricVariation { public: - HoVariation(T weight = 1.0) : ParametricVariation("ho", VAR_HO, weight) + HoVariation(T weight = 1.0) : ParametricVariation("ho", eVariationId::VAR_HO, weight) { Init(); } @@ -1168,7 +1168,7 @@ template class EMBER_API Julia3DqVariation : public ParametricVariation { public: - Julia3DqVariation(T weight = 1.0) : ParametricVariation("julia3Dq", VAR_JULIA3DQ, weight, true, true, false, false, true) + Julia3DqVariation(T weight = 1.0) : ParametricVariation("julia3Dq", eVariationId::VAR_JULIA3DQ, weight, true, true, false, false, true) { Init(); } @@ -1234,8 +1234,8 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Power, prefix + "julia3Dq_power", 3, INTEGER_NONZERO)); - m_Params.push_back(ParamWithName(&m_Divisor, prefix + "julia3Dq_divisor", 2, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "julia3Dq_power", 3, eParamType::INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Divisor, prefix + "julia3Dq_divisor", 2, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(true, &m_InvPower, prefix + "julia3Dq_inv_power"));//Precalc. m_Params.push_back(ParamWithName(true, &m_AbsInvPower, prefix + "julia3Dq_abs_inv_power")); m_Params.push_back(ParamWithName(true, &m_HalfInvPower, prefix + "julia3Dq_half_inv_power")); @@ -1258,7 +1258,7 @@ template class EMBER_API LineVariation : public ParametricVariation { public: - LineVariation(T weight = 1.0) : ParametricVariation("line", VAR_LINE, weight) + LineVariation(T weight = 1.0) : ParametricVariation("line", eVariationId::VAR_LINE, weight) { Init(); } @@ -1340,7 +1340,7 @@ template class EMBER_API Loonie2Variation : public ParametricVariation { public: - Loonie2Variation(T weight = 1.0) : ParametricVariation("loonie2", VAR_LOONIE2, weight, true, true) + Loonie2Variation(T weight = 1.0) : ParametricVariation("loonie2", eVariationId::VAR_LOONIE2, weight, true, true) { Init(); } @@ -1390,7 +1390,7 @@ public: helper.Out.y = m_Weight * helper.In.y; } - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1452,7 +1452,7 @@ public: << "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n" << "\t\t}\n" << "\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -1476,9 +1476,9 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Sides, prefix + "loonie2_sides", 4, INTEGER, 1, 50)); - m_Params.push_back(ParamWithName(&m_Star, prefix + "loonie2_star", 0, REAL, -1, 1)); - m_Params.push_back(ParamWithName(&m_Circle, prefix + "loonie2_circle", 0, REAL, -1, 1)); + m_Params.push_back(ParamWithName(&m_Sides, prefix + "loonie2_sides", 4, eParamType::INTEGER, 1, 50)); + m_Params.push_back(ParamWithName(&m_Star, prefix + "loonie2_star", 0, eParamType::REAL, -1, 1)); + m_Params.push_back(ParamWithName(&m_Circle, prefix + "loonie2_circle", 0, eParamType::REAL, -1, 1)); m_Params.push_back(ParamWithName(true, &m_W2, prefix + "loonie2_w2"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Sina, prefix + "loonie2_sina")); m_Params.push_back(ParamWithName(true, &m_Cosa, prefix + "loonie2_cosa")); @@ -1508,7 +1508,7 @@ template class EMBER_API Loonie3Variation : public ParametricVariation { public: - Loonie3Variation(T weight = 1.0) : ParametricVariation("loonie3", VAR_LOONIE3, weight, true) + Loonie3Variation(T weight = 1.0) : ParametricVariation("loonie3", eVariationId::VAR_LOONIE3, weight, true) { Init(); } @@ -1537,7 +1537,7 @@ public: helper.Out.y = m_Weight * helper.In.y; } - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1569,7 +1569,7 @@ public: << "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * vIn.y;\n" << "\t\t}\n" << "\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -1600,7 +1600,7 @@ template class EMBER_API Loonie3DVariation : public ParametricVariation { public: - Loonie3DVariation(T weight = 1.0) : ParametricVariation("loonie_3D", VAR_LOONIE3D, weight, true, false, false, false, true) + Loonie3DVariation(T weight = 1.0) : ParametricVariation("loonie_3D", eVariationId::VAR_LOONIE3D, weight, true, false, false, false, true) { Init(); } @@ -1686,7 +1686,7 @@ template class EMBER_API McarpetVariation : public ParametricVariation { public: - McarpetVariation(T weight = 1.0) : ParametricVariation("mcarpet", VAR_MCARPET, weight, true) + McarpetVariation(T weight = 1.0) : ParametricVariation("mcarpet", eVariationId::VAR_MCARPET, weight, true) { Init(); } @@ -1702,7 +1702,7 @@ public: helper.Out.y = helper.In.y * r * m_Y; helper.Out.x += (1 - (m_Twist * SQR(helper.In.x)) + helper.In.y) * m_Weight;//The += is intentional. helper.Out.y += m_Tilt * helper.In.x * m_Weight; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1724,7 +1724,7 @@ public: << "\t\tvOut.y = vIn.y * r * " << y << ";\n" << "\t\tvOut.x += (1 - (" << twist << " * SQR(vIn.x)) + vIn.y) * xform->m_VariationWeights[" << varIndex << "];\n" << "\t\tvOut.y += " << tilt << " * vIn.x * xform->m_VariationWeights[" << varIndex << "];\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -1759,7 +1759,7 @@ template class EMBER_API Waves23DVariation : public ParametricVariation { public: - Waves23DVariation(T weight = 1.0) : ParametricVariation("waves2_3D", VAR_WAVES23D, weight) + Waves23DVariation(T weight = 1.0) : ParametricVariation("waves2_3D", eVariationId::VAR_WAVES23D, weight) { Init(); } @@ -1817,7 +1817,7 @@ template class EMBER_API Pie3DVariation : public ParametricVariation { public: - Pie3DVariation(T weight = 1.0) : ParametricVariation("pie3D", VAR_PIE3D, weight) + Pie3DVariation(T weight = 1.0) : ParametricVariation("pie3D", eVariationId::VAR_PIE3D, weight) { Init(); } @@ -1871,9 +1871,9 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Slices, prefix + "pie3D_slices", 6, INTEGER_NONZERO, 1)); - m_Params.push_back(ParamWithName(&m_Rotation, prefix + "pie3D_rotation", T(0.5), REAL_CYCLIC, 0, M_2PI)); - m_Params.push_back(ParamWithName(&m_Thickness, prefix + "pie3D_thickness", T(0.5), REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Slices, prefix + "pie3D_slices", 6, eParamType::INTEGER_NONZERO, 1)); + m_Params.push_back(ParamWithName(&m_Rotation, prefix + "pie3D_rotation", T(0.5), eParamType::REAL_CYCLIC, 0, M_2PI)); + m_Params.push_back(ParamWithName(&m_Thickness, prefix + "pie3D_thickness", T(0.5), eParamType::REAL, 0, 1)); } private: @@ -1889,7 +1889,7 @@ template class EMBER_API Popcorn23DVariation : public ParametricVariation { public: - Popcorn23DVariation(T weight = 1.0) : ParametricVariation("popcorn2_3D", VAR_POPCORN23D, weight, false, false, false, false, true) + Popcorn23DVariation(T weight = 1.0) : ParametricVariation("popcorn2_3D", eVariationId::VAR_POPCORN23D, weight, false, false, false, false, true) { Init(); } @@ -1901,7 +1901,7 @@ public: T otherZ, tempPZ = 0; T tempTZ = helper.In.z == 0 ? m_Vv * m_SinTanC * helper.m_PrecalcAtanyx : helper.In.z; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) otherZ = helper.In.z; else otherZ = outPoint.m_Z; @@ -1932,7 +1932,7 @@ public: << "\t\treal_t otherZ, tempPZ = 0;\n" << "\t\treal_t tempTZ = vIn.z == 0 ? " << vv << " * " << stc << " * precalcAtanyx : vIn.z;\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) ss << "\t\totherZ = vIn.z;\n"; else ss << "\t\totherZ = outPoint->m_Z;\n"; @@ -2004,7 +2004,7 @@ template class EMBER_API Sinusoidal3DVariation : public Variation { public: - Sinusoidal3DVariation(T weight = 1.0) : Variation("sinusoidal3D", VAR_SINUSOIDAL3D, weight) { } + Sinusoidal3DVariation(T weight = 1.0) : Variation("sinusoidal3D", eVariationId::VAR_SINUSOIDAL3D, weight) { } VARCOPY(Sinusoidal3DVariation) @@ -2037,7 +2037,7 @@ template class EMBER_API Scry3DVariation : public ParametricVariation { public: - Scry3DVariation(T weight = 1.0) : ParametricVariation("scry_3D", VAR_SCRY3D, weight, true, false, false, false, true) + Scry3DVariation(T weight = 1.0) : ParametricVariation("scry_3D", eVariationId::VAR_SCRY3D, weight, true, false, false, false, true) { Init(); } @@ -2101,7 +2101,7 @@ template class EMBER_API ShredlinVariation : public ParametricVariation { public: - ShredlinVariation(T weight = 1.0) : ParametricVariation("shredlin", VAR_SHRED_LIN, weight) + ShredlinVariation(T weight = 1.0) : ParametricVariation("shredlin", eVariationId::VAR_SHRED_LIN, weight) { Init(); } @@ -2163,10 +2163,10 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_XDistance, prefix + "shredlin_xdistance", 1, REAL_NONZERO)); - m_Params.push_back(ParamWithName(&m_XWidth, prefix + "shredlin_xwidth", T(0.5), REAL, -1, 1)); - m_Params.push_back(ParamWithName(&m_YDistance, prefix + "shredlin_ydistance", 1, REAL_NONZERO)); - m_Params.push_back(ParamWithName(&m_YWidth, prefix + "shredlin_ywidth", T(0.5), REAL, -1, 1)); + m_Params.push_back(ParamWithName(&m_XDistance, prefix + "shredlin_xdistance", 1, eParamType::REAL_NONZERO)); + m_Params.push_back(ParamWithName(&m_XWidth, prefix + "shredlin_xwidth", T(0.5), eParamType::REAL, -1, 1)); + m_Params.push_back(ParamWithName(&m_YDistance, prefix + "shredlin_ydistance", 1, eParamType::REAL_NONZERO)); + m_Params.push_back(ParamWithName(&m_YWidth, prefix + "shredlin_ywidth", T(0.5), eParamType::REAL, -1, 1)); m_Params.push_back(ParamWithName(true, &m_Xw, prefix + "shredlin_xw")); m_Params.push_back(ParamWithName(true, &m_Yw, prefix + "shredlin_yw")); m_Params.push_back(ParamWithName(true, &m_1mX, prefix + "shredlin_1mx")); @@ -2191,7 +2191,7 @@ template class EMBER_API SplitBrdrVariation : public ParametricVariation { public: - SplitBrdrVariation(T weight = 1.0) : ParametricVariation("SplitBrdr", VAR_SPLIT_BRDR, weight, true) + SplitBrdrVariation(T weight = 1.0) : ParametricVariation("SplitBrdr", eVariationId::VAR_SPLIT_BRDR, weight, true) { Init(); } @@ -2246,7 +2246,7 @@ public: helper.Out.x += helper.In.x * m_Px; helper.Out.y += helper.In.y * m_Py; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -2307,7 +2307,7 @@ public: << "\n" << "\t\tvOut.x += vIn.x * " << px << ";\n" << "\t\tvOut.y += vIn.y * " << py << ";\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -2339,7 +2339,7 @@ template class EMBER_API WdiscVariation : public Variation { public: - WdiscVariation(T weight = 1.0) : Variation("wdisc", VAR_WDISC, weight, true, true, false, false, true) { } + WdiscVariation(T weight = 1.0) : Variation("wdisc", eVariationId::VAR_WDISC, weight, true, true, false, false, true) { } VARCOPY(WdiscVariation) @@ -2353,7 +2353,7 @@ public: helper.Out.x = m_Weight * r * std::cos(a); helper.Out.y = m_Weight * r * std::sin(a); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -2370,7 +2370,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * r * cos(a);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * r * sin(a);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -2384,7 +2384,7 @@ template class EMBER_API FalloffVariation : public ParametricVariation { public: - FalloffVariation(T weight = 1.0) : ParametricVariation("falloff", VAR_FALLOFF, weight, false, false, false, false, true) + FalloffVariation(T weight = 1.0) : ParametricVariation("falloff", eVariationId::VAR_FALLOFF, weight, false, false, false, false, true) { Init(); } @@ -2515,17 +2515,17 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Scatter, prefix + "falloff_scatter", 1, REAL, EPS, TMAX)); - m_Params.push_back(ParamWithName(&m_MinDist, prefix + "falloff_mindist", T(0.5), REAL, 0, TMAX)); - m_Params.push_back(ParamWithName(&m_MulX, prefix + "falloff_mul_x", 1, REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_MulY, prefix + "falloff_mul_y", 1, REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_MulZ, prefix + "falloff_mul_z", 0, REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Scatter, prefix + "falloff_scatter", 1, eParamType::REAL, EPS, TMAX)); + m_Params.push_back(ParamWithName(&m_MinDist, prefix + "falloff_mindist", T(0.5), eParamType::REAL, 0, TMAX)); + m_Params.push_back(ParamWithName(&m_MulX, prefix + "falloff_mul_x", 1, eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_MulY, prefix + "falloff_mul_y", 1, eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_MulZ, prefix + "falloff_mul_z", 0, eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(&m_X0, prefix + "falloff_x0")); m_Params.push_back(ParamWithName(&m_Y0, prefix + "falloff_y0")); m_Params.push_back(ParamWithName(&m_Z0, prefix + "falloff_z0")); - m_Params.push_back(ParamWithName(&m_Invert, prefix + "falloff_invert", 0, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_Type, prefix + "falloff_type", 0, INTEGER, 0, 2)); - m_Params.push_back(ParamWithName(&m_BoxPow, prefix + "falloff_boxpow", 2, INTEGER, 2, 32));//Original defaulted this to 0 which directly contradicts the specified range of 2-32. + m_Params.push_back(ParamWithName(&m_Invert, prefix + "falloff_invert", 0, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Type, prefix + "falloff_type", 0, eParamType::INTEGER, 0, 2)); + m_Params.push_back(ParamWithName(&m_BoxPow, prefix + "falloff_boxpow", 2, eParamType::INTEGER, 2, 32));//Original defaulted this to 0 which directly contradicts the specified range of 2-32. m_Params.push_back(ParamWithName(true, &m_InternalScatter, prefix + "falloff_internal_scatter")); } @@ -2551,7 +2551,7 @@ template class EMBER_API Falloff2Variation : public ParametricVariation { public: - Falloff2Variation(T weight = 1.0) : ParametricVariation("falloff2", VAR_FALLOFF2, weight, true, false, false, false, true) + Falloff2Variation(T weight = 1.0) : ParametricVariation("falloff2", eVariationId::VAR_FALLOFF2, weight, true, false, false, false, true) { Init(); } @@ -2717,17 +2717,17 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Scatter, prefix + "falloff2_scatter", 1, REAL, EPS, TMAX)); - m_Params.push_back(ParamWithName(&m_MinDist, prefix + "falloff2_mindist", T(0.5), REAL, 0, TMAX)); - m_Params.push_back(ParamWithName(&m_MulX, prefix + "falloff2_mul_x", 1, REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_MulY, prefix + "falloff2_mul_y", 1, REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_MulZ, prefix + "falloff2_mul_z", 0, REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_MulC, prefix + "falloff2_mul_c", 0, REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Scatter, prefix + "falloff2_scatter", 1, eParamType::REAL, EPS, TMAX)); + m_Params.push_back(ParamWithName(&m_MinDist, prefix + "falloff2_mindist", T(0.5), eParamType::REAL, 0, TMAX)); + m_Params.push_back(ParamWithName(&m_MulX, prefix + "falloff2_mul_x", 1, eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_MulY, prefix + "falloff2_mul_y", 1, eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_MulZ, prefix + "falloff2_mul_z", 0, eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_MulC, prefix + "falloff2_mul_c", 0, eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(&m_X0, prefix + "falloff2_x0")); m_Params.push_back(ParamWithName(&m_Y0, prefix + "falloff2_y0")); m_Params.push_back(ParamWithName(&m_Z0, prefix + "falloff2_z0")); - m_Params.push_back(ParamWithName(&m_Invert, prefix + "falloff2_invert", 0, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_Type, prefix + "falloff2_type", 0, INTEGER, 0, 2)); + m_Params.push_back(ParamWithName(&m_Invert, prefix + "falloff2_invert", 0, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Type, prefix + "falloff2_type", 0, eParamType::INTEGER, 0, 2)); m_Params.push_back(ParamWithName(true, &m_RMax, prefix + "falloff2_rmax")); } @@ -2753,7 +2753,7 @@ template class EMBER_API Falloff3Variation : public ParametricVariation { public: - Falloff3Variation(T weight = 1.0) : ParametricVariation("falloff3", VAR_FALLOFF3, weight, true, false, false, false, true) + Falloff3Variation(T weight = 1.0) : ParametricVariation("falloff3", eVariationId::VAR_FALLOFF3, weight, true, false, false, false, true) { Init(); } @@ -2948,15 +2948,15 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_BlurType, prefix + "falloff3_blur_type", 0, INTEGER, 0, 3)); - m_Params.push_back(ParamWithName(&m_BlurShape, prefix + "falloff3_blur_shape", 0, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_BlurStrength, prefix + "falloff3_blur_strength", 1, REAL, EPS, TMAX)); - m_Params.push_back(ParamWithName(&m_MinDistance, prefix + "falloff3_min_distance", T(0.5), REAL, 0, TMAX)); - m_Params.push_back(ParamWithName(&m_InvertDistance, prefix + "falloff3_invert_distance", 0, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_MulX, prefix + "falloff3_mul_x", 1, REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_MulY, prefix + "falloff3_mul_y", 1, REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_MulZ, prefix + "falloff3_mul_z", 0, REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_MulC, prefix + "falloff3_mul_c", 0, REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_BlurType, prefix + "falloff3_blur_type", 0, eParamType::INTEGER, 0, 3)); + m_Params.push_back(ParamWithName(&m_BlurShape, prefix + "falloff3_blur_shape", 0, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_BlurStrength, prefix + "falloff3_blur_strength", 1, eParamType::REAL, EPS, TMAX)); + m_Params.push_back(ParamWithName(&m_MinDistance, prefix + "falloff3_min_distance", T(0.5), eParamType::REAL, 0, TMAX)); + m_Params.push_back(ParamWithName(&m_InvertDistance, prefix + "falloff3_invert_distance", 0, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_MulX, prefix + "falloff3_mul_x", 1, eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_MulY, prefix + "falloff3_mul_y", 1, eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_MulZ, prefix + "falloff3_mul_z", 0, eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_MulC, prefix + "falloff3_mul_c", 0, eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(&m_CenterX, prefix + "falloff3_center_x")); m_Params.push_back(ParamWithName(&m_CenterY, prefix + "falloff3_center_y")); m_Params.push_back(ParamWithName(&m_CenterZ, prefix + "falloff3_center_z")); @@ -2988,7 +2988,7 @@ template class EMBER_API XtrbVariation : public ParametricVariation { public: - XtrbVariation(T weight = 1.0) : ParametricVariation("xtrb", VAR_XTRB, weight) + XtrbVariation(T weight = 1.0) : ParametricVariation("xtrb", eVariationId::VAR_XTRB, weight) { Init(); } @@ -3029,7 +3029,7 @@ public: InverseTrilinear(alpha, beta, x, y, rand); helper.Out.x = m_Weight * x; helper.Out.y = m_Weight * y; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -3151,7 +3151,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * x;\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * y;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); @@ -3344,7 +3344,7 @@ protected: string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_Power, prefix + "xtrb_power", 2, INTEGER_NONZERO)); + m_Params.push_back(ParamWithName(&m_Power, prefix + "xtrb_power", 2, eParamType::INTEGER_NONZERO)); m_Params.push_back(ParamWithName(&m_Radius, prefix + "xtrb_radius", 1)); m_Params.push_back(ParamWithName(&m_Width, prefix + "xtrb_width", T(0.5))); m_Params.push_back(ParamWithName(&m_Dist, prefix + "xtrb_dist", 1)); @@ -3538,7 +3538,7 @@ template class EMBER_API Hexaplay3DVariation : public ParametricVariation { public: - Hexaplay3DVariation(T weight = 1.0) : ParametricVariation("hexaplay3D", VAR_HEXAPLAY3D, weight) + Hexaplay3DVariation(T weight = 1.0) : ParametricVariation("hexaplay3D", eVariationId::VAR_HEXAPLAY3D, weight) { Init(); } @@ -3566,7 +3566,7 @@ public: T boost;//Boost is the separation distance between the two planes. T sumX, sumY; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { sumX = helper.In.x; sumY = helper.In.y; @@ -3661,7 +3661,7 @@ public: << "\t\treal_t boost;\n" << "\t\treal_t sumX, sumY;\n\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\tsumX = vIn.x;\n" @@ -3775,9 +3775,9 @@ protected: m_Params.clear(); m_Params.reserve(25); - m_Params.push_back(ParamWithName(&m_MajP, prefix + "hexaplay3D_majp", 1, REAL)); - m_Params.push_back(ParamWithName(&m_Scale, prefix + "hexaplay3D_scale", T(0.25), REAL)); - m_Params.push_back(ParamWithName(&m_ZLift, prefix + "hexaplay3D_zlift", T(0.25), REAL)); + m_Params.push_back(ParamWithName(&m_MajP, prefix + "hexaplay3D_majp", 1, eParamType::REAL)); + m_Params.push_back(ParamWithName(&m_Scale, prefix + "hexaplay3D_scale", T(0.25), eParamType::REAL)); + m_Params.push_back(ParamWithName(&m_ZLift, prefix + "hexaplay3D_zlift", T(0.25), eParamType::REAL)); m_Params.push_back(ParamWithName(true, &m_Seg60[0].x, prefix + "hexaplay3D_seg60x0"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Seg60[1].x, prefix + "hexaplay3D_seg60x1")); m_Params.push_back(ParamWithName(true, &m_Seg60[2].x, prefix + "hexaplay3D_seg60x2")); @@ -3825,7 +3825,7 @@ template class EMBER_API Hexnix3DVariation : public ParametricVariation { public: - Hexnix3DVariation(T weight = 1.0) : ParametricVariation("hexnix3D", VAR_HEXNIX3D, weight) + Hexnix3DVariation(T weight = 1.0) : ParametricVariation("hexnix3D", eVariationId::VAR_HEXNIX3D, weight) { Init(); } @@ -3855,7 +3855,7 @@ public: T gentleZ = 0; T sumX, sumY, sumZ; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { sumX = helper.In.x; sumY = helper.In.y; @@ -3941,7 +3941,7 @@ public: { helper.Out.z = (sumZ - (2 * smooth * sumZ)) + (smooth * posNeg * (helper.In.z * scale * m_ZLift + boost)); - if (m_VarType != VARTYPE_PRE) + if (m_VarType != eVariationType::VARTYPE_PRE) outPoint.m_Z = 0; } } @@ -4018,7 +4018,7 @@ public: << "\t\treal_t gentleZ = 0;\n" << "\t\treal_t sumX, sumY, sumZ;\n\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\tsumX = vIn.x;\n" @@ -4108,7 +4108,7 @@ public: << "\t\t {\n" << "\t\t vOut.z = (sumZ - (2 * smooth * sumZ)) + (smooth * posNeg * (vIn.z * scale * " << zlift << " + boost));\n"; - if (m_VarType != VARTYPE_PRE) + if (m_VarType != eVariationType::VARTYPE_PRE) ss << "\t\t outPoint->m_Z = 0;\n"; ss @@ -4200,10 +4200,10 @@ protected: m_Params.clear(); m_Params.reserve(25); - m_Params.push_back(ParamWithName(&m_MajP, prefix + "hexnix3D_majp", 1, REAL)); - m_Params.push_back(ParamWithName(&m_Scale, prefix + "hexnix3D_scale", T(0.25), REAL)); + m_Params.push_back(ParamWithName(&m_MajP, prefix + "hexnix3D_majp", 1, eParamType::REAL)); + m_Params.push_back(ParamWithName(&m_Scale, prefix + "hexnix3D_scale", T(0.25), eParamType::REAL)); m_Params.push_back(ParamWithName(&m_ZLift, prefix + "hexnix3D_zlift")); - m_Params.push_back(ParamWithName(&m_3side, prefix + "hexnix3D_3side", T(0.667), REAL)); + m_Params.push_back(ParamWithName(&m_3side, prefix + "hexnix3D_3side", T(0.667), eParamType::REAL)); m_Params.push_back(ParamWithName(true, &m_Seg60[0].x, prefix + "hexnix3D_seg60x0"));//Precalc. m_Params.push_back(ParamWithName(true, &m_Seg60[1].x, prefix + "hexnix3D_seg60x1")); m_Params.push_back(ParamWithName(true, &m_Seg60[2].x, prefix + "hexnix3D_seg60x2")); @@ -4246,7 +4246,7 @@ template class EMBER_API HexcropVariation : public ParametricVariation { public: - HexcropVariation(T weight = 1.0) : ParametricVariation("hexcrop", VAR_HEXCROP, weight) + HexcropVariation(T weight = 1.0) : ParametricVariation("hexcrop", eVariationId::VAR_HEXCROP, weight) { Init(); } @@ -4270,7 +4270,7 @@ public: j = n; } - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.x = c != 0 ? outPoint.m_X + i.x * m_Weight : m_Dropoff; helper.Out.y = c != 0 ? outPoint.m_Y + i.y * m_Weight : m_Dropoff; @@ -4324,7 +4324,7 @@ public: << "\t\t}\n" << "\n"; - if (m_VarType == VARTYPE_REG) + if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tvOut.x = c != 0 ? outPoint->m_X + i.x * xform->m_VariationWeights[" << varIndex << "] : " << dropoff << ";\n" @@ -4399,20 +4399,20 @@ private: MAKEPREPOSTPARVAR(Bubble2, bubble2, BUBBLE2) MAKEPREPOSTPARVAR(CircleLinear, CircleLinear, CIRCLELINEAR) -MAKEPREPOSTPARVARASSIGN(CircleRand, CircleRand, CIRCLERAND, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(CircleRand, CircleRand, CIRCLERAND, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(CircleTrans1, CircleTrans1, CIRCLETRANS1) MAKEPREPOSTPARVAR(Cubic3D, cubic3D, CUBIC3D) MAKEPREPOSTPARVAR(CubicLattice3D, cubicLattice_3D, CUBIC_LATTICE3D) MAKEPREPOSTVAR(Foci3D, foci_3D, FOCI3D) MAKEPREPOSTPARVAR(Ho, ho, HO) MAKEPREPOSTPARVAR(Julia3Dq, julia3Dq, JULIA3DQ) -MAKEPREPOSTPARVARASSIGN(Line, line, LINE, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(Line, line, LINE, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(Loonie2, loonie2, LOONIE2) MAKEPREPOSTPARVAR(Loonie3, loonie3, LOONIE3) MAKEPREPOSTPARVAR(Loonie3D, loonie_3D, LOONIE3D) MAKEPREPOSTPARVAR(Mcarpet, mcarpet, MCARPET) MAKEPREPOSTPARVAR(Waves23D, waves2_3D, WAVES23D) -MAKEPREPOSTPARVARASSIGN(Pie3D, pie3D, PIE3D, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(Pie3D, pie3D, PIE3D, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(Popcorn23D, popcorn2_3D, POPCORN23D) MAKEPREPOSTVAR(Sinusoidal3D, sinusoidal3D, SINUSOIDAL3D) MAKEPREPOSTPARVAR(Scry3D, scry_3D, SCRY3D) diff --git a/Source/Ember/Variations06.h b/Source/Ember/Variations06.h index cc137f8..1b32cd8 100644 --- a/Source/Ember/Variations06.h +++ b/Source/Ember/Variations06.h @@ -11,7 +11,7 @@ template class EMBER_API HexesVariation : public ParametricVariation { public: - HexesVariation(T weight = 1.0) : ParametricVariation("hexes", VAR_HEXES, weight) + HexesVariation(T weight = 1.0) : ParametricVariation("hexes", eVariationId::VAR_HEXES, weight) { Init(); } @@ -130,7 +130,7 @@ public: //Finally add values in. helper.Out.x = m_Weight * v.x; helper.Out.y = m_Weight * v.y; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -232,7 +232,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * Vx;\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * Vy;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); } @@ -321,7 +321,7 @@ class EMBER_API NblurVariation : public ParametricVariation }; public: - NblurVariation(T weight = 1.0) : ParametricVariation("nBlur", VAR_NBLUR, weight) + NblurVariation(T weight = 1.0) : ParametricVariation("nBlur", eVariationId::VAR_NBLUR, weight) { Init(); } @@ -366,7 +366,7 @@ public: params.Y = m_Sina * xTmp + m_Cosa * yTmp; helper.Out.x = m_AdjustedWeight * params.X; helper.Out.y = m_AdjustedWeight * params.Y; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -441,7 +441,7 @@ public: << "\n" << "\t\tvOut.x = " << adjustedWeight << " * params.X;\n" << "\t\tvOut.y = " << adjustedWeight << " * params.Y;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); } @@ -821,14 +821,14 @@ protected: string prefix = Prefix(); m_Params.clear(); m_Params.reserve(25); - m_Params.push_back(ParamWithName(&m_NumEdges, prefix + "nBlur_numEdges", 3, INTEGER)); - m_Params.push_back(ParamWithName(&m_NumStripes, prefix + "nBlur_numStripes", 0, INTEGER)); - m_Params.push_back(ParamWithName(&m_RatioStripes, prefix + "nBlur_ratioStripes", 1, REAL, 0, 2)); - m_Params.push_back(ParamWithName(&m_RatioHole, prefix + "nBlur_ratioHole", 0, REAL, 0, 1)); - m_Params.push_back(ParamWithName(&m_CircumCircle, prefix + "nBlur_circumCircle", 0, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_AdjustToLinear, prefix + "nBlur_adjustToLinear", 1, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_EqualBlur, prefix + "nBlur_equalBlur", 1, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_ExactCalc, prefix + "nBlur_exactCalc", 0, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_NumEdges, prefix + "nBlur_numEdges", 3, eParamType::INTEGER)); + m_Params.push_back(ParamWithName(&m_NumStripes, prefix + "nBlur_numStripes", 0, eParamType::INTEGER)); + m_Params.push_back(ParamWithName(&m_RatioStripes, prefix + "nBlur_ratioStripes", 1, eParamType::REAL, 0, 2)); + m_Params.push_back(ParamWithName(&m_RatioHole, prefix + "nBlur_ratioHole", 0, eParamType::REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_CircumCircle, prefix + "nBlur_circumCircle", 0, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_AdjustToLinear, prefix + "nBlur_adjustToLinear", 1, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_EqualBlur, prefix + "nBlur_equalBlur", 1, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_ExactCalc, prefix + "nBlur_exactCalc", 0, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(&m_HighlightEdges, prefix + "nBlur_highlightEdges", 1)); m_Params.push_back(ParamWithName(true, &m_RatioComplement, prefix + "nBlur_ratioComplement"));//Precalc. m_Params.push_back(ParamWithName(true, &m_MidAngle, prefix + "nBlur_midAngle")); @@ -1135,7 +1135,7 @@ template class EMBER_API OctapolVariation : public ParametricVariation { public: - OctapolVariation(T weight = 1.0) : ParametricVariation("octapol", VAR_OCTAPOL, weight) + OctapolVariation(T weight = 1.0) : ParametricVariation("octapol", eVariationId::VAR_OCTAPOL, weight) { Init(); } @@ -1176,7 +1176,7 @@ public: if (clear) { - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { helper.m_TransX = 0; helper.m_TransY = 0; @@ -1267,7 +1267,7 @@ public: << "\t\tif (clear)\n" << "\t\t{\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\t transX = 0;\n" @@ -1474,7 +1474,7 @@ template class EMBER_API CrobVariation : public ParametricVariation { public: - CrobVariation(T weight = 1.0) : ParametricVariation("crob", VAR_CROB, weight) + CrobVariation(T weight = 1.0) : ParametricVariation("crob", eVariationId::VAR_CROB, weight) { Init(); } @@ -1489,12 +1489,12 @@ public: { if (m_Blur == 0) { - if (m_VarType == VARTYPE_PRE)//Setting input point. + if (m_VarType == eVariationType::VARTYPE_PRE)//Setting input point. { helper.m_TransX = 0; helper.m_TransY = 0; } - else if (m_VarType == VARTYPE_REG) + else if (m_VarType == eVariationType::VARTYPE_REG) { helper.In.x = 0; helper.In.y = 0; @@ -1541,12 +1541,12 @@ public: xTmp = m_Left + m_Right - xTmp; } - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { helper.m_TransX = xTmp; helper.m_TransY = yTmp; } - else if (m_VarType == VARTYPE_REG) + else if (m_VarType == eVariationType::VARTYPE_REG) { helper.In.x = xTmp; helper.In.y = yTmp; @@ -1559,12 +1559,12 @@ public: } } - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { helper.Out.x = helper.m_TransX; helper.Out.y = helper.m_TransY; } - else if (m_VarType == VARTYPE_REG) + else if (m_VarType == eVariationType::VARTYPE_REG) { helper.Out.x = helper.In.x; helper.Out.y = helper.In.y; @@ -1575,7 +1575,7 @@ public: helper.Out.y = outPoint.m_Y; } - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -1620,13 +1620,13 @@ public: << "\t\t if (" << blur << " == 0)\n" << "\t\t {\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\t transX = 0;\n" << "\t\t transY = 0;\n"; } - else if (m_VarType == VARTYPE_REG) + else if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\t vIn.x = 0;\n" @@ -1676,13 +1676,13 @@ public: << "\t\t }\n" << "\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\t transX = xTmp;\n" << "\t\t transY = yTmp;\n"; } - else if (m_VarType == VARTYPE_REG) + else if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\t vIn.x = xTmp;\n" @@ -1700,13 +1700,13 @@ public: << "\t\t}\n" << "\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\tvOut.x = transX;\n" << "\t\tvOut.y = transY;\n"; } - else if (m_VarType == VARTYPE_REG) + else if (m_VarType == eVariationType::VARTYPE_REG) { ss << "\t\tvOut.x = vIn.x;\n" @@ -1720,7 +1720,7 @@ public: } ss - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); } @@ -1814,8 +1814,8 @@ protected: m_Params.push_back(ParamWithName(&m_Bottom, prefix + "crob_bottom", 1)); m_Params.push_back(ParamWithName(&m_Left, prefix + "crob_left", -1)); m_Params.push_back(ParamWithName(&m_Right, prefix + "crob_right", 1)); - m_Params.push_back(ParamWithName(&m_Blur, prefix + "crob_blur", 1, INTEGER)); - m_Params.push_back(ParamWithName(&m_RatioBlur, prefix + "crob_ratioBlur", T(0.5), REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_Blur, prefix + "crob_blur", 1, eParamType::INTEGER)); + m_Params.push_back(ParamWithName(&m_RatioBlur, prefix + "crob_ratioBlur", T(0.5), eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(&m_DirectBlur, prefix + "crob_directBlur", 2)); m_Params.push_back(ParamWithName(true, &m_XInterval, prefix + "crob_xinterval")); m_Params.push_back(ParamWithName(true, &m_YInterval, prefix + "crob_yinterval")); @@ -1878,7 +1878,7 @@ template class EMBER_API BubbleT3DVariation : public ParametricVariation { public: - BubbleT3DVariation(T weight = 1.0) : ParametricVariation("bubbleT3D", VAR_BUBBLET3D, weight, true) + BubbleT3DVariation(T weight = 1.0) : ParametricVariation("bubbleT3D", eVariationId::VAR_BUBBLET3D, weight, true) { Init(); } @@ -2331,12 +2331,12 @@ protected: string prefix = Prefix(); m_Params.clear(); m_Params.reserve(14); - m_Params.push_back(ParamWithName(&m_NumberStripes, prefix + "bubbleT3D_number_of_stripes", 0, INTEGER)); - m_Params.push_back(ParamWithName(&m_RatioStripes, prefix + "bubbleT3D_ratio_of_stripes", 1, REAL, 0, 2)); - m_Params.push_back(ParamWithName(&m_AngleHole, prefix + "bubbleT3D_angle_of_hole", 0, REAL, -360, 360)); + m_Params.push_back(ParamWithName(&m_NumberStripes, prefix + "bubbleT3D_number_of_stripes", 0, eParamType::INTEGER)); + m_Params.push_back(ParamWithName(&m_RatioStripes, prefix + "bubbleT3D_ratio_of_stripes", 1, eParamType::REAL, 0, 2)); + m_Params.push_back(ParamWithName(&m_AngleHole, prefix + "bubbleT3D_angle_of_hole", 0, eParamType::REAL, -360, 360)); m_Params.push_back(ParamWithName(&m_ExponentZ, prefix + "bubbleT3D_exponentZ", 1)); - m_Params.push_back(ParamWithName(&m_SymmetryZ, prefix + "bubbleT3D_symmetryZ", 0, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_ModusBlur, prefix + "bubbleT3D_modusBlur", 0, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_SymmetryZ, prefix + "bubbleT3D_symmetryZ", 0, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_ModusBlur, prefix + "bubbleT3D_modusBlur", 0, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(true, &m_AbsNumberStripes, prefix + "bubbleT3D_abs_number_of_stripes"));//Precalc. m_Params.push_back(ParamWithName(true, &m_AngleHoleTemp, prefix + "bubbleT3D_ang_hole_temp")); m_Params.push_back(ParamWithName(true, &m_AngStrip, prefix + "bubbleT3D_ang_strip")); @@ -2432,7 +2432,7 @@ template class EMBER_API SynthVariation : public ParametricVariation { public: - SynthVariation(T weight = 1.0) : ParametricVariation("synth", VAR_SYNTH, weight, true, true, false, true) + SynthVariation(T weight = 1.0) : ParametricVariation("synth", eVariationId::VAR_SYNTH, weight, true, true, false, true) { Init(); } @@ -2749,7 +2749,7 @@ public: break; } - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual string OpenCLString() const override @@ -3048,7 +3048,7 @@ public: << "\t\t break;\n" << "\t\t}\n" << "\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); } @@ -3314,40 +3314,40 @@ protected: m_Params.clear(); m_Params.reserve(34); m_Params.push_back(ParamWithName(&m_SynthA, prefix + "synth_a")); - m_Params.push_back(ParamWithName(&m_SynthMode, prefix + "synth_mode", 3, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthMode, prefix + "synth_mode", 3, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthPower, prefix + "synth_power", -2)); m_Params.push_back(ParamWithName(&m_SynthMix, prefix + "synth_mix")); - m_Params.push_back(ParamWithName(&m_SynthSmooth, prefix + "synth_smooth", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthSmooth, prefix + "synth_smooth", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthB, prefix + "synth_b")); - m_Params.push_back(ParamWithName(&m_SynthBType, prefix + "synth_b_type", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthBType, prefix + "synth_b_type", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthBSkew, prefix + "synth_b_skew")); - m_Params.push_back(ParamWithName(&m_SynthBFrq, prefix + "synth_b_frq", 1, REAL)); + m_Params.push_back(ParamWithName(&m_SynthBFrq, prefix + "synth_b_frq", 1, eParamType::REAL)); m_Params.push_back(ParamWithName(&m_SynthBPhs, prefix + "synth_b_phs")); - m_Params.push_back(ParamWithName(&m_SynthBLayer, prefix + "synth_b_layer", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthBLayer, prefix + "synth_b_layer", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthC, prefix + "synth_c")); - m_Params.push_back(ParamWithName(&m_SynthCType, prefix + "synth_c_type", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthCType, prefix + "synth_c_type", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthCSkew, prefix + "synth_c_skew")); - m_Params.push_back(ParamWithName(&m_SynthCFrq, prefix + "synth_c_frq", 1, REAL)); + m_Params.push_back(ParamWithName(&m_SynthCFrq, prefix + "synth_c_frq", 1, eParamType::REAL)); m_Params.push_back(ParamWithName(&m_SynthCPhs, prefix + "synth_c_phs")); - m_Params.push_back(ParamWithName(&m_SynthCLayer, prefix + "synth_c_layer", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthCLayer, prefix + "synth_c_layer", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthD, prefix + "synth_d")); - m_Params.push_back(ParamWithName(&m_SynthDType, prefix + "synth_d_type", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthDType, prefix + "synth_d_type", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthDSkew, prefix + "synth_d_skew")); - m_Params.push_back(ParamWithName(&m_SynthDFrq, prefix + "synth_d_frq", 1, REAL)); + m_Params.push_back(ParamWithName(&m_SynthDFrq, prefix + "synth_d_frq", 1, eParamType::REAL)); m_Params.push_back(ParamWithName(&m_SynthDPhs, prefix + "synth_d_phs")); - m_Params.push_back(ParamWithName(&m_SynthDLayer, prefix + "synth_d_layer", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthDLayer, prefix + "synth_d_layer", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthE, prefix + "synth_e")); - m_Params.push_back(ParamWithName(&m_SynthEType, prefix + "synth_e_type", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthEType, prefix + "synth_e_type", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthESkew, prefix + "synth_e_skew")); - m_Params.push_back(ParamWithName(&m_SynthEFrq, prefix + "synth_e_frq", 1, REAL)); + m_Params.push_back(ParamWithName(&m_SynthEFrq, prefix + "synth_e_frq", 1, eParamType::REAL)); m_Params.push_back(ParamWithName(&m_SynthEPhs, prefix + "synth_e_phs")); - m_Params.push_back(ParamWithName(&m_SynthELayer, prefix + "synth_e_layer", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthELayer, prefix + "synth_e_layer", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthF, prefix + "synth_f")); - m_Params.push_back(ParamWithName(&m_SynthFType, prefix + "synth_f_type", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthFType, prefix + "synth_f_type", 0, eParamType::INTEGER)); m_Params.push_back(ParamWithName(&m_SynthFSkew, prefix + "synth_f_skew")); - m_Params.push_back(ParamWithName(&m_SynthFFrq, prefix + "synth_f_frq", 1, REAL)); + m_Params.push_back(ParamWithName(&m_SynthFFrq, prefix + "synth_f_frq", 1, eParamType::REAL)); m_Params.push_back(ParamWithName(&m_SynthFPhs, prefix + "synth_f_phs")); - m_Params.push_back(ParamWithName(&m_SynthFLayer, prefix + "synth_f_layer", 0, INTEGER)); + m_Params.push_back(ParamWithName(&m_SynthFLayer, prefix + "synth_f_layer", 0, eParamType::INTEGER)); } private: @@ -3641,7 +3641,7 @@ template class EMBER_API CrackleVariation : public ParametricVariation { public: - CrackleVariation(T weight = 1.0) : ParametricVariation("crackle", VAR_CRACKLE, weight) + CrackleVariation(T weight = 1.0) : ParametricVariation("crackle", eVariationId::VAR_CRACKLE, weight) { Init(); } @@ -3701,7 +3701,7 @@ public: dO += p[4]; helper.Out.x = m_Weight * dO.x; helper.Out.y = m_Weight * dO.y; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; } virtual vector OpenCLGlobalFuncNames() const override @@ -3799,7 +3799,7 @@ public: << "\t\tdO += p[4];\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * dO.x;\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * dO.y;\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t}\n"; return ss.str(); } diff --git a/Source/Ember/VariationsDC.h b/Source/Ember/VariationsDC.h index f836917..ed51647 100644 --- a/Source/Ember/VariationsDC.h +++ b/Source/Ember/VariationsDC.h @@ -12,7 +12,7 @@ template class EMBER_API DCBubbleVariation : public ParametricVariation { public: - DCBubbleVariation(T weight = 1.0) : ParametricVariation("dc_bubble", VAR_DC_BUBBLE, weight, true) + DCBubbleVariation(T weight = 1.0) : ParametricVariation("dc_bubble", eVariationId::VAR_DC_BUBBLE, weight, true) { Init(); } @@ -29,7 +29,7 @@ public: helper.Out.z = m_Weight * (2 / r4_1 - 1); T sumX, sumY; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { sumX = helper.In.x; sumY = helper.In.y; @@ -66,7 +66,7 @@ public: << "\n" << "\t\treal_t sumX, sumY;\n\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\tsumX = vIn.x;\n" @@ -123,7 +123,7 @@ template class EMBER_API DCCarpetVariation : public ParametricVariation { public: - DCCarpetVariation(T weight = 1.0) : ParametricVariation("dc_carpet", VAR_DC_CARPET, weight) + DCCarpetVariation(T weight = 1.0) : ParametricVariation("dc_carpet", eVariationId::VAR_DC_CARPET, weight) { Init(); } @@ -140,7 +140,7 @@ public: T h = -m_H + (1 - x0_xor_y0) * m_H; helper.Out.x = m_Weight * (m_Xform->m_Affine.A() * x + m_Xform->m_Affine.B() * y + m_Xform->m_Affine.E()); helper.Out.y = m_Weight * (m_Xform->m_Affine.C() * x + m_Xform->m_Affine.D() * y + m_Xform->m_Affine.F()); - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; outPoint.m_ColorX = fmod(fabs(outPoint.m_ColorX * T(0.5) * (1 + h) + x0_xor_y0 * (1 - h) * T(0.5)), T(1.0)); } @@ -162,7 +162,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * (xform->m_A * x + xform->m_B * y + xform->m_E);\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * (xform->m_C * x + xform->m_D * y + xform->m_F);\n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t\toutPoint->m_ColorX = fmod(fabs(outPoint->m_ColorX * (real_t)(0.5) * (1 + h) + x0_xor_y0 * (1 - h) * (real_t)(0.5)), (real_t)(1.0));\n" << "\t}\n"; return ss.str(); @@ -194,7 +194,7 @@ template class EMBER_API DCCubeVariation : public ParametricVariation { public: - DCCubeVariation(T weight = 1.0) : ParametricVariation("dc_cube", VAR_DC_CUBE, weight) + DCCubeVariation(T weight = 1.0) : ParametricVariation("dc_cube", eVariationId::VAR_DC_CUBE, weight) { Init(); } @@ -384,7 +384,7 @@ template class EMBER_API DCCylinderVariation : public ParametricVariation { public: - DCCylinderVariation(T weight = 1.0) : ParametricVariation("dc_cylinder", VAR_DC_CYLINDER, weight) + DCCylinderVariation(T weight = 1.0) : ParametricVariation("dc_cylinder", eVariationId::VAR_DC_CYLINDER, weight) { Init(); } @@ -402,7 +402,7 @@ public: helper.Out.z = m_Weight * std::cos(helper.In.x + r * cr); T sumX, sumY; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { sumX = helper.In.x; sumY = helper.In.y; @@ -445,7 +445,7 @@ public: << "\n" << "\t\treal_t sumX, sumY;\n\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\tsumX = vIn.x;\n" @@ -511,7 +511,7 @@ template class EMBER_API DCGridOutVariation : public Variation { public: - DCGridOutVariation(T weight = 1.0) : Variation("dc_gridout", VAR_DC_GRIDOUT, weight) { } + DCGridOutVariation(T weight = 1.0) : Variation("dc_gridout", eVariationId::VAR_DC_GRIDOUT, weight) { } VARCOPY(DCGridOutVariation) @@ -688,7 +688,7 @@ template class EMBER_API DCLinearVariation : public ParametricVariation { public: - DCLinearVariation(T weight = 1.0) : ParametricVariation("dc_linear", VAR_DC_LINEAR, weight) + DCLinearVariation(T weight = 1.0) : ParametricVariation("dc_linear", eVariationId::VAR_DC_LINEAR, weight) { Init(); } @@ -702,7 +702,7 @@ public: helper.Out.z = m_Weight * helper.In.z; T sumX, sumY; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { sumX = helper.In.x; sumY = helper.In.y; @@ -738,7 +738,7 @@ public: << "\n" << "\t\treal_t sumX, sumY;\n\n"; - if (m_VarType == VARTYPE_PRE) + if (m_VarType == eVariationType::VARTYPE_PRE) { ss << "\t\tsumX = vIn.x;\n" @@ -798,7 +798,7 @@ template class EMBER_API DCTriangleVariation : public ParametricVariation { public: - DCTriangleVariation(T weight = 1.0) : ParametricVariation("dc_triangle", VAR_DC_TRIANGLE, weight) + DCTriangleVariation(T weight = 1.0) : ParametricVariation("dc_triangle", eVariationId::VAR_DC_TRIANGLE, weight) { Init(); } @@ -987,8 +987,8 @@ protected: { string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_ScatterArea, prefix + "dc_triangle_scatter_area", 0, REAL, -1, 1));//Params. - m_Params.push_back(ParamWithName(&m_ZeroEdges, prefix + "dc_triangle_zero_edges", 0, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_ScatterArea, prefix + "dc_triangle_scatter_area", 0, eParamType::REAL, -1, 1));//Params. + m_Params.push_back(ParamWithName(&m_ZeroEdges, prefix + "dc_triangle_zero_edges", 0, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(true, &m_A, prefix + "dc_triangle_a"));//Precalc. } @@ -1007,7 +1007,7 @@ template class EMBER_API DCZTranslVariation : public ParametricVariation { public: - DCZTranslVariation(T weight = 1.0) : ParametricVariation("dc_ztransl", VAR_DC_ZTRANSL, weight) + DCZTranslVariation(T weight = 1.0) : ParametricVariation("dc_ztransl", eVariationId::VAR_DC_ZTRANSL, weight) { Init(); } @@ -1073,11 +1073,11 @@ protected: { string prefix = Prefix(); m_Params.clear(); - m_Params.push_back(ParamWithName(&m_X0, prefix + "dc_ztransl_x0", 0, REAL, 0, 1));//Params. - m_Params.push_back(ParamWithName(&m_X1, prefix + "dc_ztransl_x1", 1, REAL, 0, 1)); + m_Params.push_back(ParamWithName(&m_X0, prefix + "dc_ztransl_x0", 0, eParamType::REAL, 0, 1));//Params. + m_Params.push_back(ParamWithName(&m_X1, prefix + "dc_ztransl_x1", 1, eParamType::REAL, 0, 1)); m_Params.push_back(ParamWithName(&m_Factor, prefix + "dc_ztransl_factor", 1)); - m_Params.push_back(ParamWithName(&m_Overwrite, prefix + "dc_ztransl_overwrite", 1, INTEGER, 0, 1)); - m_Params.push_back(ParamWithName(&m_Clamp, prefix + "dc_ztransl_clamp", 0, INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Overwrite, prefix + "dc_ztransl_overwrite", 1, eParamType::INTEGER, 0, 1)); + m_Params.push_back(ParamWithName(&m_Clamp, prefix + "dc_ztransl_clamp", 0, eParamType::INTEGER, 0, 1)); m_Params.push_back(ParamWithName(true, &m_X0_, prefix + "dc_ztransl_x0_"));//Precalc. m_Params.push_back(ParamWithName(true, &m_X1_, prefix + "dc_ztransl_x1_")); m_Params.push_back(ParamWithName(true, &m_X1_m_x0, prefix + "dc_ztransl_x1_m_x0")); @@ -1112,7 +1112,7 @@ template class EMBER_API DCPerlinVariation : public ParametricVariation { public: - DCPerlinVariation(T weight = 1.0) : ParametricVariation("dc_perlin", VAR_DC_PERLIN, weight) + DCPerlinVariation(T weight = 1.0) : ParametricVariation("dc_perlin", eVariationId::VAR_DC_PERLIN, weight) { Init(); } @@ -1158,7 +1158,7 @@ public: break; case SHAPE_BLUR: - default: + default: r = (1 + m_Edge) * rand.Frand01(); if (r > 1 - m_Edge) @@ -1215,7 +1215,7 @@ public: break; case MAP_BUBBLE2: - default: + default: r = T(0.25) - (SQR(vx) + SQR(vy)); if (r < 0) @@ -1242,7 +1242,7 @@ public: // Add blur effect to transform helper.Out.x = m_Weight * vx; helper.Out.y = m_Weight * vy; - helper.Out.z = (m_VarType == VARTYPE_REG) ? 0 : helper.In.z; + helper.Out.z = (m_VarType == eVariationType::VARTYPE_REG) ? 0 : helper.In.z; col = m_Centre + m_Range * p; outPoint.m_ColorX = col - Floor(col); } @@ -1393,7 +1393,7 @@ public: << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * vx; \n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * vy; \n" - << "\t\tvOut.z = " << ((m_VarType == VARTYPE_REG) ? "0" : "vIn.z") << ";\n" + << "\t\tvOut.z = " << ((m_VarType == eVariationType::VARTYPE_REG) ? "0" : "vIn.z") << ";\n" << "\t\tcol = " << centre << " + " << range << " * p; \n" << "\t\toutPoint->m_ColorX = col - floor(col); \n" << "\t}\n"; @@ -1416,19 +1416,19 @@ protected: m_VarFuncs = VarFuncs::Instance(); m_Params.clear(); m_Params.reserve(15); - m_Params.push_back(ParamWithName(&m_Shape, prefix + "dc_perlin_shape", 0, INTEGER, 0, 2));//Params. - m_Params.push_back(ParamWithName(&m_Map, prefix + "dc_perlin_map", 0, INTEGER, 0, 5)); - m_Params.push_back(ParamWithName(&m_SelectCentre, prefix + "dc_perlin_select_centre", 0, REAL, -1, 1)); - m_Params.push_back(ParamWithName(&m_SelectRange, prefix + "dc_perlin_select_range", 1, REAL, T(0.1), 2)); + m_Params.push_back(ParamWithName(&m_Shape, prefix + "dc_perlin_shape", 0, eParamType::INTEGER, 0, 2));//Params. + m_Params.push_back(ParamWithName(&m_Map, prefix + "dc_perlin_map", 0, eParamType::INTEGER, 0, 5)); + m_Params.push_back(ParamWithName(&m_SelectCentre, prefix + "dc_perlin_select_centre", 0, eParamType::REAL, -1, 1)); + m_Params.push_back(ParamWithName(&m_SelectRange, prefix + "dc_perlin_select_range", 1, eParamType::REAL, T(0.1), 2)); m_Params.push_back(ParamWithName(&m_Centre, prefix + "dc_perlin_centre", T(0.25))); m_Params.push_back(ParamWithName(&m_Range, prefix + "dc_perlin_range", T(0.25))); m_Params.push_back(ParamWithName(&m_Edge, prefix + "dc_perlin_edge")); m_Params.push_back(ParamWithName(&m_Scale, prefix + "dc_perlin_scale", 1)); - m_Params.push_back(ParamWithName(&m_Octaves, prefix + "dc_perlin_octaves", 2, INTEGER, 1, 5)); + m_Params.push_back(ParamWithName(&m_Octaves, prefix + "dc_perlin_octaves", 2, eParamType::INTEGER, 1, 5)); m_Params.push_back(ParamWithName(&m_Amps, prefix + "dc_perlin_amps", 2)); m_Params.push_back(ParamWithName(&m_Freqs, prefix + "dc_perlin_freqs", 2)); m_Params.push_back(ParamWithName(&m_Z, prefix + "dc_perlin_z")); - m_Params.push_back(ParamWithName(&m_SelectBailout, prefix + "dc_perlin_select_bailout", 10, INTEGER, 2, 1000)); + m_Params.push_back(ParamWithName(&m_SelectBailout, prefix + "dc_perlin_select_bailout", 10, eParamType::INTEGER, 2, 1000)); m_Params.push_back(ParamWithName(true, &m_NotchBottom, prefix + "dc_perlin_notch_bottom")); m_Params.push_back(ParamWithName(true, &m_NotchTop, prefix + "dc_perlin_notch_top")); } @@ -1453,7 +1453,7 @@ private: MAKEPREPOSTPARVAR(DCBubble, dc_bubble, DC_BUBBLE) MAKEPREPOSTPARVAR(DCCarpet, dc_carpet, DC_CARPET) -MAKEPREPOSTPARVARASSIGN(DCCube, dc_cube, DC_CUBE, ASSIGNTYPE_SUM) +MAKEPREPOSTPARVARASSIGN(DCCube, dc_cube, DC_CUBE, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTPARVAR(DCCylinder, dc_cylinder, DC_CYLINDER) MAKEPREPOSTVAR(DCGridOut, dc_gridout, DC_GRIDOUT) MAKEPREPOSTPARVAR(DCLinear, dc_linear, DC_LINEAR) diff --git a/Source/Ember/Xform.h b/Source/Ember/Xform.h index 3211c18..15dde14 100644 --- a/Source/Ember/Xform.h +++ b/Source/Ember/Xform.h @@ -880,7 +880,7 @@ public: { bool shouldFlatten = true; - if (GetVariationById(VAR_FLATTEN) == nullptr) + if (GetVariationById(eVariationId::VAR_FLATTEN) == nullptr) { AllVarsFunc([&] (vector*>& variations, bool & keepGoing) { @@ -943,15 +943,15 @@ public: switch (varType) { - case VARTYPE_REG: - case VARTYPE_PRE: + case eVariationType::VARTYPE_REG: + case eVariationType::VARTYPE_PRE: s = "\tvIn.x = transX;\n" "\tvIn.y = transY;\n" "\tvIn.z = transZ;\n"; break; - case VARTYPE_POST: + case eVariationType::VARTYPE_POST: default: s = "\tvIn.x = outPoint->m_X;\n" @@ -972,7 +972,7 @@ public: { switch (assignType) { - case ASSIGNTYPE_SET: + case eVariationAssignType::ASSIGNTYPE_SET: { helper.m_TransX = helper.Out.x; helper.m_TransY = helper.Out.y; @@ -980,7 +980,7 @@ public: break; } - case ASSIGNTYPE_SUM: + case eVariationAssignType::ASSIGNTYPE_SUM: default: { helper.m_TransX += helper.Out.x; @@ -1000,7 +1000,7 @@ public: { switch (assignType) { - case ASSIGNTYPE_SET: + case eVariationAssignType::ASSIGNTYPE_SET: { outPoint.m_X = helper.Out.x; outPoint.m_Y = helper.Out.y; @@ -1008,7 +1008,7 @@ public: break; } - case ASSIGNTYPE_SUM: + case eVariationAssignType::ASSIGNTYPE_SUM: default: { outPoint.m_X += helper.Out.x; @@ -1031,7 +1031,7 @@ public: switch (varType) { - case VARTYPE_REG: + case eVariationType::VARTYPE_REG: { s = "\toutPoint->m_X += vOut.x;\n" @@ -1040,11 +1040,11 @@ public: break; } - case VARTYPE_PRE: + case eVariationType::VARTYPE_PRE: { switch (assignType) { - case ASSIGNTYPE_SET: + case eVariationAssignType::ASSIGNTYPE_SET: { s = "\ttransX = vOut.x;\n" @@ -1053,7 +1053,7 @@ public: break; } - case ASSIGNTYPE_SUM: + case eVariationAssignType::ASSIGNTYPE_SUM: default: { s = @@ -1067,12 +1067,12 @@ public: break; } - case VARTYPE_POST: + case eVariationType::VARTYPE_POST: default: { switch (assignType) { - case ASSIGNTYPE_SET: + case eVariationAssignType::ASSIGNTYPE_SET: { s = "\toutPoint->m_X = vOut.x;\n" @@ -1081,7 +1081,7 @@ public: break; } - case ASSIGNTYPE_SUM: + case eVariationAssignType::ASSIGNTYPE_SUM: default: { s = diff --git a/Source/EmberAnimate/EmberAnimate.cpp b/Source/EmberAnimate/EmberAnimate.cpp index e84ded8..423a1c6 100644 --- a/Source/EmberAnimate/EmberAnimate.cpp +++ b/Source/EmberAnimate/EmberAnimate.cpp @@ -15,7 +15,7 @@ bool EmberAnimate(EmberOptions& opt) std::cout.imbue(std::locale("")); if (opt.DumpArgs()) - cout << opt.GetValues(OPT_USE_ANIMATE) << endl; + cout << opt.GetValues(eOptionUse::OPT_USE_ANIMATE) << endl; if (opt.OpenCLInfo()) { @@ -44,7 +44,7 @@ bool EmberAnimate(EmberOptions& opt) if (opt.EmberCL()) { - renderers = CreateRenderers(OPENCL_RENDERER, devices, false, 0, emberReport); + renderers = CreateRenderers(eRendererType::OPENCL_RENDERER, devices, false, 0, emberReport); errorReport = emberReport.ErrorReport(); if (!errorReport.empty()) @@ -89,7 +89,7 @@ bool EmberAnimate(EmberOptions& opt) } else { - unique_ptr> tempRenderer(CreateRenderer(CPU_RENDERER, devices, false, 0, emberReport)); + unique_ptr> tempRenderer(CreateRenderer(eRendererType::CPU_RENDERER, devices, false, 0, emberReport)); errorReport = emberReport.ErrorReport(); if (!errorReport.empty()) @@ -457,7 +457,7 @@ int _tmain(int argc, _TCHAR* argv[]) putenv(const_cast("GPU_MAX_ALLOC_PERCENT=100")); #endif - if (!opt.Populate(argc, argv, OPT_USE_ANIMATE)) + if (!opt.Populate(argc, argv, eOptionUse::OPT_USE_ANIMATE)) { #ifdef DO_DOUBLE diff --git a/Source/EmberCL/IterOpenCLKernelCreator.cpp b/Source/EmberCL/IterOpenCLKernelCreator.cpp index 1e841d8..502c77d 100644 --- a/Source/EmberCL/IterOpenCLKernelCreator.cpp +++ b/Source/EmberCL/IterOpenCLKernelCreator.cpp @@ -123,9 +123,9 @@ string IterOpenCLKernelCreator::CreateIterKernelString(const Ember& ember, { xformFuncs << "\n\t//" << var->Name() << ".\n"; xformFuncs << var->PrecalcOpenCLString(); - xformFuncs << xform->ReadOpenCLString(VARTYPE_PRE) << "\n"; + xformFuncs << xform->ReadOpenCLString(eVariationType::VARTYPE_PRE) << "\n"; xformFuncs << var->OpenCLString() << "\n"; - xformFuncs << xform->WriteOpenCLString(VARTYPE_PRE, var->AssignType()) << "\n"; + xformFuncs << xform->WriteOpenCLString(eVariationType::VARTYPE_PRE, var->AssignType()) << "\n"; } } } @@ -154,7 +154,7 @@ string IterOpenCLKernelCreator::CreateIterKernelString(const Ember& ember, xformFuncs << "\n\toutPoint->m_Y = 0;"; xformFuncs << "\n\toutPoint->m_Z = 0;\n"; xformFuncs << "\n\t//Apply each of the " << xform->VariationCount() << " regular variations in this xform.\n\n"; - xformFuncs << xform->ReadOpenCLString(VARTYPE_REG); + xformFuncs << xform->ReadOpenCLString(eVariationType::VARTYPE_REG); varCount += xform->VariationCount(); //Output the code for each regular variation in this xform. @@ -164,7 +164,7 @@ string IterOpenCLKernelCreator::CreateIterKernelString(const Ember& ember, { xformFuncs << "\n\t//" << var->Name() << ".\n" << var->OpenCLString() << (varIndex == varCount - 1 ? "\n" : "\n\n") - << xform->WriteOpenCLString(VARTYPE_REG, ASSIGNTYPE_SUM); + << xform->WriteOpenCLString(eVariationType::VARTYPE_REG, eVariationAssignType::ASSIGNTYPE_SUM); } } } @@ -189,9 +189,9 @@ string IterOpenCLKernelCreator::CreateIterKernelString(const Ember& ember, { xformFuncs << "\n\t//" << var->Name() << ".\n"; xformFuncs << var->PrecalcOpenCLString(); - xformFuncs << xform->ReadOpenCLString(VARTYPE_POST) << "\n"; + xformFuncs << xform->ReadOpenCLString(eVariationType::VARTYPE_POST) << "\n"; xformFuncs << var->OpenCLString() << "\n"; - xformFuncs << xform->WriteOpenCLString(VARTYPE_POST, var->AssignType()) << (varIndex == varCount - 1 ? "\n" : "\n\n"); + xformFuncs << xform->WriteOpenCLString(eVariationType::VARTYPE_POST, var->AssignType()) << (varIndex == varCount - 1 ? "\n" : "\n\n"); } } } diff --git a/Source/EmberCL/RendererCL.cpp b/Source/EmberCL/RendererCL.cpp index 2774bb3..3417d3b 100644 --- a/Source/EmberCL/RendererCL.cpp +++ b/Source/EmberCL/RendererCL.cpp @@ -571,11 +571,11 @@ bool RendererCL::CreateSpatialFilter(bool& newAlloc) /// /// Get the renderer type enum. /// -/// OPENCL_RENDERER +/// eRendererType::OPENCL_RENDERER template eRendererType RendererCL::RendererType() const { - return OPENCL_RENDERER; + return eRendererType::OPENCL_RENDERER; } /// diff --git a/Source/EmberCommon/EmberCommon.h b/Source/EmberCommon/EmberCommon.h index e7f0e21..023888f 100644 --- a/Source/EmberCommon/EmberCommon.h +++ b/Source/EmberCommon/EmberCommon.h @@ -269,7 +269,7 @@ static Renderer* CreateRenderer(eRendererType renderType, const vector try { - if (renderType == OPENCL_RENDERER && !devices.empty()) + if (renderType == eRendererType::OPENCL_RENDERER && !devices.empty()) { s = "OpenCL"; renderer = unique_ptr>(new RendererCL(devices, shared, texId)); @@ -321,7 +321,7 @@ static vector>> CreateRenderers(eRendererType rend try { - if (renderType == OPENCL_RENDERER && !devices.empty()) + if (renderType == eRendererType::OPENCL_RENDERER && !devices.empty()) { s = "OpenCL"; v.reserve(devices.size()); @@ -348,7 +348,7 @@ static vector>> CreateRenderers(eRendererType rend else { s = "CPU"; - v.push_back(std::move(unique_ptr>(::CreateRenderer(CPU_RENDERER, devices, shared, texId, errorReport)))); + v.push_back(std::move(unique_ptr>(::CreateRenderer(eRendererType::CPU_RENDERER, devices, shared, texId, errorReport)))); } } catch (const std::exception& e) @@ -365,7 +365,7 @@ static vector>> CreateRenderers(eRendererType rend try { s = "CPU"; - v.push_back(std::move(unique_ptr>(::CreateRenderer(CPU_RENDERER, devices, shared, texId, errorReport)))); + v.push_back(std::move(unique_ptr>(::CreateRenderer(eRendererType::CPU_RENDERER, devices, shared, texId, errorReport)))); } catch (const std::exception& e) { diff --git a/Source/EmberCommon/EmberOptions.h b/Source/EmberCommon/EmberOptions.h index b3d83dd..ac2100d 100644 --- a/Source/EmberCommon/EmberOptions.h +++ b/Source/EmberCommon/EmberOptions.h @@ -12,20 +12,20 @@ static const char* DescriptionString = "Ember - Fractal flames C++ port and enha /// Enum for specifying which command line programs an option is meant to be used with. /// If an option is used with multiple programs, their values are ORed together. /// -enum eOptionUse +enum class eOptionUse : et { OPT_USE_RENDER = 1, OPT_USE_ANIMATE = 1 << 1, OPT_USE_GENOME = 1 << 2, - OPT_RENDER_ANIM = OPT_USE_RENDER | OPT_USE_ANIMATE, - OPT_ANIM_GENOME = OPT_USE_ANIMATE | OPT_USE_GENOME, - OPT_USE_ALL = OPT_USE_RENDER | OPT_USE_ANIMATE | OPT_USE_GENOME + OPT_RENDER_ANIM = et(eOptionUse::OPT_USE_RENDER) | et(eOptionUse::OPT_USE_ANIMATE), + OPT_ANIM_GENOME = et(eOptionUse::OPT_USE_ANIMATE) | et(eOptionUse::OPT_USE_GENOME), + OPT_USE_ALL = et(eOptionUse::OPT_USE_RENDER) | et(eOptionUse::OPT_USE_ANIMATE) | et(eOptionUse::OPT_USE_GENOME) }; /// /// Unique identifiers for every available option across all programs. /// -enum eOptionIDs +enum class eOptionIDs : et { //Diagnostic args. OPT_HELP, @@ -132,7 +132,7 @@ class EmberOptions; template class EmberOptionEntry { -friend class EmberOptions; + friend class EmberOptions; private: /// @@ -140,7 +140,7 @@ private: /// EmberOptionEntry() { - m_OptionUse = OPT_USE_ALL; + m_OptionUse = eOptionUse::OPT_USE_ALL; m_Option.nArgType = SO_NONE; m_Option.nId = 0; m_Option.pszArg = _T("--fillmein"); @@ -216,66 +216,66 @@ private: //Bool. #define Eob EmberOptionEntry #define INITBOOLOPTION(member, option) \ - member = option; \ - m_BoolArgs.push_back(&member) + member = option; \ + m_BoolArgs.push_back(&member) -#define PARSEBOOLOPTION(opt, member) \ - case (opt): \ +#define PARSEBOOLOPTION(e, member) \ + case (e): \ + { \ + if (member.m_Option.nArgType == SO_OPT) \ { \ - if (member.m_Option.nArgType == SO_OPT) \ - { \ - member(!strcmp(args.OptionArg(), "true")); \ - } \ - else \ - { \ - member(true); \ - } \ + member(!strcmp(args.OptionArg(), "true")); \ } \ - break + else \ + { \ + member(true); \ + } \ + } \ + break //Int. #define Eoi EmberOptionEntry #define INITINTOPTION(member, option) \ - member = option; \ - m_IntArgs.push_back(&member) + member = option; \ + m_IntArgs.push_back(&member) -#define PARSEINTOPTION(opt, member) \ - case (opt): \ - sscanf_s(args.OptionArg(), "%ld", &member.m_Val); \ - break +#define PARSEINTOPTION(e, member) \ + case (e): \ + sscanf_s(args.OptionArg(), "%ld", &member.m_Val); \ + break //Uint. #define Eou EmberOptionEntry #define INITUINTOPTION(member, option) \ - member = option; \ - m_UintArgs.push_back(&member) + member = option; \ + m_UintArgs.push_back(&member) -#define PARSEUINTOPTION(opt, member) \ - case (opt): \ - sscanf_s(args.OptionArg(), "%lu", &member.m_Val); \ - break +#define PARSEUINTOPTION(e, member) \ + case (e): \ + sscanf_s(args.OptionArg(), "%lu", &member.m_Val); \ + break //Double. #define Eod EmberOptionEntry #define INITDOUBLEOPTION(member, option) \ - member = option; \ - m_DoubleArgs.push_back(&member) + member = option; \ + m_DoubleArgs.push_back(&member) -#define PARSEDOUBLEOPTION(opt, member) \ - case (opt): \ - sscanf_s(args.OptionArg(), "%lf", &member.m_Val); \ - break +#define PARSEDOUBLEOPTION(e, member) \ + case (e): \ + sscanf_s(args.OptionArg(), "%lf", &member.m_Val); \ + break //String. #define Eos EmberOptionEntry #define INITSTRINGOPTION(member, option) \ - member = option; \ - m_StringArgs.push_back(&member) + member = option; \ + m_StringArgs.push_back(&member) -#define PARSESTRINGOPTION(opt, member) \ - case (opt): \ - member.m_Val = args.OptionArg(); \ - break +#define PARSESTRINGOPTION(e, member) \ + case (e): \ + member.m_Val = args.OptionArg(); \ + break /// /// Class for holding all available options across all command line programs. @@ -295,116 +295,108 @@ public: m_UintArgs.reserve(25); m_DoubleArgs.reserve(25); m_StringArgs.reserve(35); - //Diagnostic bools. - INITBOOLOPTION(Help, Eob(OPT_USE_ALL, OPT_HELP, _T("--help"), false, SO_NONE, "\t--help Show this screen.\n")); - INITBOOLOPTION(Version, Eob(OPT_USE_ALL, OPT_VERSION, _T("--version"), false, SO_NONE, "\t--version Show version.\n")); - INITBOOLOPTION(Verbose, Eob(OPT_USE_ALL, OPT_VERBOSE, _T("--verbose"), false, SO_NONE, "\t--verbose Verbose output.\n")); - INITBOOLOPTION(Debug, Eob(OPT_USE_ALL, OPT_DEBUG, _T("--debug"), false, SO_NONE, "\t--debug Debug output.\n")); - INITBOOLOPTION(DumpArgs, Eob(OPT_USE_ALL, OPT_DUMP_ARGS, _T("--dumpargs"), false, SO_NONE, "\t--dumpargs Print all arguments entered from either the command line or environment variables.\n")); - INITBOOLOPTION(DoProgress, Eob(OPT_USE_ALL, OPT_PROGRESS, _T("--progress"), false, SO_NONE, "\t--progress Display progress. This will slow down processing by about 10%%.\n")); - INITBOOLOPTION(OpenCLInfo, Eob(OPT_USE_ALL, OPT_DUMP_OPENCL_INFO, _T("--openclinfo"), false, SO_NONE, "\t--openclinfo Display platforms and devices for OpenCL.\n")); - + INITBOOLOPTION(Help, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_HELP, _T("--help"), false, SO_NONE, "\t--help Show this screen.\n")); + INITBOOLOPTION(Version, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_VERSION, _T("--version"), false, SO_NONE, "\t--version Show version.\n")); + INITBOOLOPTION(Verbose, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_VERBOSE, _T("--verbose"), false, SO_NONE, "\t--verbose Verbose output.\n")); + INITBOOLOPTION(Debug, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_DEBUG, _T("--debug"), false, SO_NONE, "\t--debug Debug output.\n")); + INITBOOLOPTION(DumpArgs, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_DUMP_ARGS, _T("--dumpargs"), false, SO_NONE, "\t--dumpargs Print all arguments entered from either the command line or environment variables.\n")); + INITBOOLOPTION(DoProgress, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_PROGRESS, _T("--progress"), false, SO_NONE, "\t--progress Display progress. This will slow down processing by about 10%%.\n")); + INITBOOLOPTION(OpenCLInfo, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_DUMP_OPENCL_INFO, _T("--openclinfo"), false, SO_NONE, "\t--openclinfo Display platforms and devices for OpenCL.\n")); //Execution bools. - INITBOOLOPTION(EmberCL, Eob(OPT_USE_ALL, OPT_OPENCL, _T("--opencl"), false, SO_NONE, "\t--opencl Use OpenCL renderer (EmberCL) for rendering [default: false].\n")); - INITBOOLOPTION(EarlyClip, Eob(OPT_USE_ALL, OPT_EARLYCLIP, _T("--earlyclip"), false, SO_NONE, "\t--earlyclip Perform clipping of RGB values before spatial filtering for better antialiasing and resizing [default: false].\n")); - INITBOOLOPTION(YAxisUp, Eob(OPT_USE_ALL, OPT_POS_Y_UP, _T("--yaxisup"), false, SO_NONE, "\t--yaxisup Orient the image with the positive y axis pointing up [default: false].\n")); - INITBOOLOPTION(Transparency, Eob(OPT_USE_ALL, OPT_TRANSPARENCY, _T("--transparency"), false, SO_NONE, "\t--transparency Include alpha channel in final output [default: false except for PNG].\n")); - INITBOOLOPTION(NameEnable, Eob(OPT_USE_RENDER, OPT_NAME_ENABLE, _T("--name_enable"), false, SO_NONE, "\t--name_enable Use the name attribute contained in the xml as the output filename [default: false].\n")); - INITBOOLOPTION(IntPalette, Eob(OPT_RENDER_ANIM, OPT_INT_PALETTE, _T("--intpalette"), false, SO_NONE, "\t--intpalette Force palette RGB values to be integers [default: false (float)].\n")); - INITBOOLOPTION(HexPalette, Eob(OPT_USE_ALL, OPT_HEX_PALETTE, _T("--hex_palette"), true, SO_OPT, "\t--hex_palette Force palette RGB values to be hex [default: true].\n")); - INITBOOLOPTION(InsertPalette, Eob(OPT_RENDER_ANIM, OPT_INSERT_PALETTE, _T("--insert_palette"), false, SO_NONE, "\t--insert_palette Insert the palette into the image for debugging purposes [default: false].\n")); - INITBOOLOPTION(JpegComments, Eob(OPT_RENDER_ANIM, OPT_JPEG_COMMENTS, _T("--enable_jpeg_comments"), true, SO_OPT, "\t--enable_jpeg_comments Enables comments in the jpeg header [default: true].\n")); - INITBOOLOPTION(PngComments, Eob(OPT_RENDER_ANIM, OPT_PNG_COMMENTS, _T("--enable_png_comments"), true, SO_OPT, "\t--enable_png_comments Enables comments in the png header [default: true].\n")); - INITBOOLOPTION(WriteGenome, Eob(OPT_USE_ANIMATE, OPT_WRITE_GENOME, _T("--write_genome"), false, SO_NONE, "\t--write_genome Write out flame associated with center of motion blur window [default: false].\n")); - INITBOOLOPTION(ThreadedWrite, Eob(OPT_RENDER_ANIM, OPT_THREADED_WRITE, _T("--threaded_write"), true, SO_OPT, "\t--threaded_write Use a separate thread to write images to disk. This gives better performance, but doubles the memory required for the final output buffer. [default: true].\n")); - INITBOOLOPTION(Enclosed, Eob(OPT_USE_GENOME, OPT_ENCLOSED, _T("--enclosed"), true, SO_OPT, "\t--enclosed Use enclosing XML tags [default: true].\n")); - INITBOOLOPTION(NoEdits, Eob(OPT_USE_GENOME, OPT_NO_EDITS, _T("--noedits"), false, SO_NONE, "\t--noedits Exclude edit tags when writing Xml [default: false].\n")); - INITBOOLOPTION(UnsmoothEdge, Eob(OPT_USE_GENOME, OPT_UNSMOOTH_EDGE, _T("--unsmoother"), false, SO_NONE, "\t--unsmoother Do not use smooth blending for sheep edges [default: false].\n")); - INITBOOLOPTION(LockAccum, Eob(OPT_USE_ALL, OPT_LOCK_ACCUM, _T("--lock_accum"), false, SO_NONE, "\t--lock_accum Lock threads when accumulating to the histogram using the CPU. This will drop performance to that of single threading [default: false].\n")); - INITBOOLOPTION(DumpKernel, Eob(OPT_USE_RENDER, OPT_DUMP_KERNEL, _T("--dump_kernel"), false, SO_NONE, "\t--dump_kernel Print the iteration kernel string when using OpenCL (ignored for CPU) [default: false].\n")); - + INITBOOLOPTION(EmberCL, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_OPENCL, _T("--opencl"), false, SO_NONE, "\t--opencl Use OpenCL renderer (EmberCL) for rendering [default: false].\n")); + INITBOOLOPTION(EarlyClip, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_EARLYCLIP, _T("--earlyclip"), false, SO_NONE, "\t--earlyclip Perform clipping of RGB values before spatial filtering for better antialiasing and resizing [default: false].\n")); + INITBOOLOPTION(YAxisUp, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_POS_Y_UP, _T("--yaxisup"), false, SO_NONE, "\t--yaxisup Orient the image with the positive y axis pointing up [default: false].\n")); + INITBOOLOPTION(Transparency, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_TRANSPARENCY, _T("--transparency"), false, SO_NONE, "\t--transparency Include alpha channel in final output [default: false except for PNG].\n")); + INITBOOLOPTION(NameEnable, Eob(eOptionUse::OPT_USE_RENDER, eOptionIDs::OPT_NAME_ENABLE, _T("--name_enable"), false, SO_NONE, "\t--name_enable Use the name attribute contained in the xml as the output filename [default: false].\n")); + INITBOOLOPTION(IntPalette, Eob(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_INT_PALETTE, _T("--intpalette"), false, SO_NONE, "\t--intpalette Force palette RGB values to be integers [default: false (float)].\n")); + INITBOOLOPTION(HexPalette, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_HEX_PALETTE, _T("--hex_palette"), true, SO_OPT, "\t--hex_palette Force palette RGB values to be hex [default: true].\n")); + INITBOOLOPTION(InsertPalette, Eob(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_INSERT_PALETTE, _T("--insert_palette"), false, SO_NONE, "\t--insert_palette Insert the palette into the image for debugging purposes [default: false].\n")); + INITBOOLOPTION(JpegComments, Eob(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_JPEG_COMMENTS, _T("--enable_jpeg_comments"), true, SO_OPT, "\t--enable_jpeg_comments Enables comments in the jpeg header [default: true].\n")); + INITBOOLOPTION(PngComments, Eob(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_PNG_COMMENTS, _T("--enable_png_comments"), true, SO_OPT, "\t--enable_png_comments Enables comments in the png header [default: true].\n")); + INITBOOLOPTION(WriteGenome, Eob(eOptionUse::OPT_USE_ANIMATE, eOptionIDs::OPT_WRITE_GENOME, _T("--write_genome"), false, SO_NONE, "\t--write_genome Write out flame associated with center of motion blur window [default: false].\n")); + INITBOOLOPTION(ThreadedWrite, Eob(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_THREADED_WRITE, _T("--threaded_write"), true, SO_OPT, "\t--threaded_write Use a separate thread to write images to disk. This gives better performance, but doubles the memory required for the final output buffer. [default: true].\n")); + INITBOOLOPTION(Enclosed, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_ENCLOSED, _T("--enclosed"), true, SO_OPT, "\t--enclosed Use enclosing XML tags [default: true].\n")); + INITBOOLOPTION(NoEdits, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_NO_EDITS, _T("--noedits"), false, SO_NONE, "\t--noedits Exclude edit tags when writing Xml [default: false].\n")); + INITBOOLOPTION(UnsmoothEdge, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_UNSMOOTH_EDGE, _T("--unsmoother"), false, SO_NONE, "\t--unsmoother Do not use smooth blending for sheep edges [default: false].\n")); + INITBOOLOPTION(LockAccum, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_LOCK_ACCUM, _T("--lock_accum"), false, SO_NONE, "\t--lock_accum Lock threads when accumulating to the histogram using the CPU. This will drop performance to that of single threading [default: false].\n")); + INITBOOLOPTION(DumpKernel, Eob(eOptionUse::OPT_USE_RENDER, eOptionIDs::OPT_DUMP_KERNEL, _T("--dump_kernel"), false, SO_NONE, "\t--dump_kernel Print the iteration kernel string when using OpenCL (ignored for CPU) [default: false].\n")); //Int. - INITINTOPTION(Symmetry, Eoi(OPT_USE_GENOME, OPT_SYMMETRY, _T("--symmetry"), 0, SO_REQ_SEP, "\t--symmetry= Set symmetry of result [default: 0].\n")); - INITINTOPTION(SheepGen, Eoi(OPT_USE_GENOME, OPT_SHEEP_GEN, _T("--sheep_gen"), -1, SO_REQ_SEP, "\t--sheep_gen= Sheep generation of this flame [default: -1].\n")); - INITINTOPTION(SheepId, Eoi(OPT_USE_GENOME, OPT_SHEEP_ID, _T("--sheep_id"), -1, SO_REQ_SEP, "\t--sheep_id= Sheep ID of this flame [default: -1].\n")); + INITINTOPTION(Symmetry, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SYMMETRY, _T("--symmetry"), 0, SO_REQ_SEP, "\t--symmetry= Set symmetry of result [default: 0].\n")); + INITINTOPTION(SheepGen, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SHEEP_GEN, _T("--sheep_gen"), -1, SO_REQ_SEP, "\t--sheep_gen= Sheep generation of this flame [default: -1].\n")); + INITINTOPTION(SheepId, Eoi(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SHEEP_ID, _T("--sheep_id"), -1, SO_REQ_SEP, "\t--sheep_id= Sheep ID of this flame [default: -1].\n")); #ifdef _WIN32 - INITINTOPTION(Priority, Eoi(OPT_RENDER_ANIM, OPT_PRIORITY, _T("--priority"), eThreadPriority::NORMAL, SO_REQ_SEP, "\t--priority= The priority of the CPU rendering threads from -2 - 2. This does not apply to OpenCL rendering.\n")); + INITINTOPTION(Priority, Eoi(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_PRIORITY, _T("--priority"), int(eThreadPriority::NORMAL), SO_REQ_SEP, "\t--priority= The priority of the CPU rendering threads from -2 - 2. This does not apply to OpenCL rendering.\n")); #else - INITINTOPTION(Priority, Eoi(OPT_RENDER_ANIM, OPT_PRIORITY, _T("--priority"), eThreadPriority::NORMAL, SO_REQ_SEP, "\t--priority= The priority of the CPU rendering threads, 1, 25, 50, 75, 99. This does not apply to OpenCL rendering.\n")); + INITINTOPTION(Priority, Eoi(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_PRIORITY, _T("--priority"), int(eThreadPriority::NORMAL), SO_REQ_SEP, "\t--priority= The priority of the CPU rendering threads, 1, 25, 50, 75, 99. This does not apply to OpenCL rendering.\n")); #endif - //Uint. - INITUINTOPTION(Seed, Eou(OPT_USE_ALL, OPT_SEED, _T("--seed"), 0, SO_REQ_SEP, "\t--seed= Integer seed to use for the random number generator [default: random].\n")); - INITUINTOPTION(ThreadCount, Eou(OPT_USE_ALL, OPT_NTHREADS, _T("--nthreads"), 0, SO_REQ_SEP, "\t--nthreads= The number of threads to use [default: use all available cores].\n")); - INITUINTOPTION(Strips, Eou(OPT_USE_RENDER, OPT_STRIPS, _T("--nstrips"), 1, SO_REQ_SEP, "\t--nstrips= The number of fractions to split a single render frame into. Useful for print size renders or low memory systems [default: 1].\n")); - INITUINTOPTION(Supersample, Eou(OPT_RENDER_ANIM, OPT_SUPERSAMPLE, _T("--supersample"), 0, SO_REQ_SEP, "\t--supersample= The supersample value used to override the one specified in the file [default: 0 (use value from file)].\n")); - INITUINTOPTION(BitsPerChannel, Eou(OPT_RENDER_ANIM, OPT_BPC, _T("--bpc"), 8, SO_REQ_SEP, "\t--bpc= Bits per channel. 8 or 16 for PNG, 8 for all others [default: 8].\n")); - INITUINTOPTION(SubBatchSize, Eou(OPT_USE_ALL, OPT_SBS, _T("--sub_batch_size"), DEFAULT_SBS, SO_REQ_SEP, "\t--sub_batch_size= The chunk size that iterating will be broken into [default: 10k].\n")); - INITUINTOPTION(Bits, Eou(OPT_USE_ALL, OPT_BITS, _T("--bits"), 33, SO_REQ_SEP, "\t--bits= Determines the types used for the histogram and accumulator [default: 33].\n" - "\t\t\t\t\t32: Histogram: float, Accumulator: float.\n" - "\t\t\t\t\t33: Histogram: float, Accumulator: float.\n"//This differs from the original which used an int hist for bits 33. - "\t\t\t\t\t64: Histogram: double, Accumulator: double.\n")); - - INITUINTOPTION(PrintEditDepth, Eou(OPT_USE_ALL, OPT_PRINT_EDIT_DEPTH, _T("--print_edit_depth"), 0, SO_REQ_SEP, "\t--print_edit_depth= Depth to truncate tag structure when converting a flame to xml. 0 prints all tags [default: 0].\n")); - INITUINTOPTION(JpegQuality, Eou(OPT_RENDER_ANIM, OPT_JPEG, _T("--jpeg"), 95, SO_REQ_SEP, "\t--jpeg= Jpeg quality 0-100 for compression [default: 95].\n")); - INITUINTOPTION(FirstFrame, Eou(OPT_USE_ANIMATE, OPT_BEGIN, _T("--begin"), UINT_MAX, SO_REQ_SEP, "\t--begin= Time of first frame to render [default: first time specified in file].\n")); - INITUINTOPTION(LastFrame, Eou(OPT_USE_ANIMATE, OPT_END, _T("--end"), UINT_MAX, SO_REQ_SEP, "\t--end= Time of last frame to render [default: last time specified in the input file].\n")); - INITUINTOPTION(Time, Eou(OPT_ANIM_GENOME, OPT_TIME, _T("--time"), 0, SO_REQ_SEP, "\t--time= Time of first and last frame (ie do one frame).\n")); - INITUINTOPTION(Frame, Eou(OPT_ANIM_GENOME, OPT_FRAME, _T("--frame"), 0, SO_REQ_SEP, "\t--frame= Synonym for \"time\".\n")); - INITUINTOPTION(Dtime, Eou(OPT_USE_ANIMATE, OPT_DTIME, _T("--dtime"), 1, SO_REQ_SEP, "\t--dtime= Time between frames [default: 1].\n")); - INITUINTOPTION(Frames, Eou(OPT_USE_GENOME, OPT_NFRAMES, _T("--nframes"), 20, SO_REQ_SEP, "\t--nframes= Number of frames for each stage of the animation [default: 20].\n")); - INITUINTOPTION(Repeat, Eou(OPT_USE_GENOME, OPT_REPEAT, _T("--repeat"), 1, SO_REQ_SEP, "\t--repeat= Number of new flames to create. Ignored if sequence, inter or rotate were specified [default: 1].\n")); - INITUINTOPTION(Tries, Eou(OPT_USE_GENOME, OPT_TRIES, _T("--tries"), 10, SO_REQ_SEP, "\t--tries= Number times to try creating a flame that meets the specified constraints. Ignored if sequence, inter or rotate were specified [default: 10].\n")); - INITUINTOPTION(MaxXforms, Eou(OPT_USE_GENOME, OPT_MAX_XFORMS, _T("--maxxforms"), UINT_MAX, SO_REQ_SEP, "\t--maxxforms= The maximum number of xforms allowed in the final output.\n")); - + INITUINTOPTION(Seed, Eou(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_SEED, _T("--seed"), 0, SO_REQ_SEP, "\t--seed= Integer seed to use for the random number generator [default: random].\n")); + INITUINTOPTION(ThreadCount, Eou(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_NTHREADS, _T("--nthreads"), 0, SO_REQ_SEP, "\t--nthreads= The number of threads to use [default: use all available cores].\n")); + INITUINTOPTION(Strips, Eou(eOptionUse::OPT_USE_RENDER, eOptionIDs::OPT_STRIPS, _T("--nstrips"), 1, SO_REQ_SEP, "\t--nstrips= The number of fractions to split a single render frame into. Useful for print size renders or low memory systems [default: 1].\n")); + INITUINTOPTION(Supersample, Eou(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_SUPERSAMPLE, _T("--supersample"), 0, SO_REQ_SEP, "\t--supersample= The supersample value used to override the one specified in the file [default: 0 (use value from file)].\n")); + INITUINTOPTION(BitsPerChannel, Eou(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_BPC, _T("--bpc"), 8, SO_REQ_SEP, "\t--bpc= Bits per channel. 8 or 16 for PNG, 8 for all others [default: 8].\n")); + INITUINTOPTION(SubBatchSize, Eou(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_SBS, _T("--sub_batch_size"), DEFAULT_SBS, SO_REQ_SEP, "\t--sub_batch_size= The chunk size that iterating will be broken into [default: 10k].\n")); + INITUINTOPTION(Bits, Eou(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_BITS, _T("--bits"), 33, SO_REQ_SEP, "\t--bits= Determines the types used for the histogram and accumulator [default: 33].\n" + "\t\t\t\t\t32: Histogram: float, Accumulator: float.\n" + "\t\t\t\t\t33: Histogram: float, Accumulator: float.\n"//This differs from the original which used an int hist for bits 33. + "\t\t\t\t\t64: Histogram: double, Accumulator: double.\n")); + INITUINTOPTION(PrintEditDepth, Eou(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_PRINT_EDIT_DEPTH, _T("--print_edit_depth"), 0, SO_REQ_SEP, "\t--print_edit_depth= Depth to truncate tag structure when converting a flame to xml. 0 prints all tags [default: 0].\n")); + INITUINTOPTION(JpegQuality, Eou(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_JPEG, _T("--jpeg"), 95, SO_REQ_SEP, "\t--jpeg= Jpeg quality 0-100 for compression [default: 95].\n")); + INITUINTOPTION(FirstFrame, Eou(eOptionUse::OPT_USE_ANIMATE, eOptionIDs::OPT_BEGIN, _T("--begin"), UINT_MAX, SO_REQ_SEP, "\t--begin= Time of first frame to render [default: first time specified in file].\n")); + INITUINTOPTION(LastFrame, Eou(eOptionUse::OPT_USE_ANIMATE, eOptionIDs::OPT_END, _T("--end"), UINT_MAX, SO_REQ_SEP, "\t--end= Time of last frame to render [default: last time specified in the input file].\n")); + INITUINTOPTION(Time, Eou(eOptionUse::OPT_ANIM_GENOME, eOptionIDs::OPT_TIME, _T("--time"), 0, SO_REQ_SEP, "\t--time= Time of first and last frame (ie do one frame).\n")); + INITUINTOPTION(Frame, Eou(eOptionUse::OPT_ANIM_GENOME, eOptionIDs::OPT_FRAME, _T("--frame"), 0, SO_REQ_SEP, "\t--frame= Synonym for \"time\".\n")); + INITUINTOPTION(Dtime, Eou(eOptionUse::OPT_USE_ANIMATE, eOptionIDs::OPT_DTIME, _T("--dtime"), 1, SO_REQ_SEP, "\t--dtime= Time between frames [default: 1].\n")); + INITUINTOPTION(Frames, Eou(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_NFRAMES, _T("--nframes"), 20, SO_REQ_SEP, "\t--nframes= Number of frames for each stage of the animation [default: 20].\n")); + INITUINTOPTION(Repeat, Eou(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_REPEAT, _T("--repeat"), 1, SO_REQ_SEP, "\t--repeat= Number of new flames to create. Ignored if sequence, inter or rotate were specified [default: 1].\n")); + INITUINTOPTION(Tries, Eou(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_TRIES, _T("--tries"), 10, SO_REQ_SEP, "\t--tries= Number times to try creating a flame that meets the specified constraints. Ignored if sequence, inter or rotate were specified [default: 10].\n")); + INITUINTOPTION(MaxXforms, Eou(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_MAX_XFORMS, _T("--maxxforms"), UINT_MAX, SO_REQ_SEP, "\t--maxxforms= The maximum number of xforms allowed in the final output.\n")); //Double. - INITDOUBLEOPTION(SizeScale, Eod(OPT_RENDER_ANIM, OPT_SS, _T("--ss"), 1, SO_REQ_SEP, "\t--ss= Size scale. All dimensions are scaled by this amount [default: 1.0].\n")); - INITDOUBLEOPTION(QualityScale, Eod(OPT_RENDER_ANIM, OPT_QS, _T("--qs"), 1, SO_REQ_SEP, "\t--qs= Quality scale. All quality values are scaled by this amount [default: 1.0].\n")); - INITDOUBLEOPTION(AspectRatio, Eod(OPT_USE_ALL, OPT_PIXEL_ASPECT, _T("--pixel_aspect"), 1, SO_REQ_SEP, "\t--pixel_aspect= Aspect ratio of pixels (width over height), eg. 0.90909 for NTSC [default: 1.0].\n")); - INITDOUBLEOPTION(Stagger, Eod(OPT_USE_GENOME, OPT_STAGGER, _T("--stagger"), 0, SO_REQ_SEP, "\t--stagger= Affects simultaneity of xform interpolation during flame interpolation.\n" - "\t Represents how 'separate' the xforms are interpolated. Set to 1 for each\n" - "\t xform to be interpolated individually, fractions control interpolation overlap [default: 0].\n")); - INITDOUBLEOPTION(AvgThresh, Eod(OPT_USE_GENOME, OPT_AVG_THRESH, _T("--avg"), 20.0, SO_REQ_SEP, "\t--avg= Minimum average pixel channel sum (r + g + b) threshold from 0 - 765. Ignored if sequence, inter or rotate were specified [default: 20].\n")); - INITDOUBLEOPTION(BlackThresh, Eod(OPT_USE_GENOME, OPT_BLACK_THRESH, _T("--black"), 0.01, SO_REQ_SEP, "\t--black= Minimum number of allowed black pixels as a percentage from 0 - 1. Ignored if sequence, inter or rotate were specified [default: 0.01].\n")); - INITDOUBLEOPTION(WhiteLimit, Eod(OPT_USE_GENOME, OPT_WHITE_LIMIT, _T("--white"), 0.05, SO_REQ_SEP, "\t--white= Maximum number of allowed white pixels as a percentage from 0 - 1. Ignored if sequence, inter or rotate were specified [default: 0.05].\n")); - INITDOUBLEOPTION(Speed, Eod(OPT_USE_GENOME, OPT_SPEED, _T("--speed"), 0.1, SO_REQ_SEP, "\t--speed= Speed as a percentage from 0 - 1 that the affine transform of an existing flame mutates with the new flame. Ignored if sequence, inter or rotate were specified [default: 0.1].\n")); - INITDOUBLEOPTION(OffsetX, Eod(OPT_USE_GENOME, OPT_OFFSETX, _T("--offsetx"), 0.0, SO_REQ_SEP, "\t--offsetx= Amount to jitter each flame horizontally when applying genome tools [default: 0].\n")); - INITDOUBLEOPTION(OffsetY, Eod(OPT_USE_GENOME, OPT_OFFSETY, _T("--offsety"), 0.0, SO_REQ_SEP, "\t--offsety= Amount to jitter each flame vertically when applying genome tools [default: 0].\n")); - INITDOUBLEOPTION(UseMem, Eod(OPT_USE_RENDER, OPT_USEMEM, _T("--use_mem"), 0.0, SO_REQ_SEP, "\t--use_mem= Number of bytes of memory to use [default: max system memory].\n")); - INITDOUBLEOPTION(Loops, Eod(OPT_USE_GENOME, OPT_LOOPS, _T("--loops"), 1.0, SO_REQ_SEP, "\t--loops= Number of times to rotate each control point in sequence [default: 1].\n")); - + INITDOUBLEOPTION(SizeScale, Eod(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_SS, _T("--ss"), 1, SO_REQ_SEP, "\t--ss= Size scale. All dimensions are scaled by this amount [default: 1.0].\n")); + INITDOUBLEOPTION(QualityScale, Eod(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_QS, _T("--qs"), 1, SO_REQ_SEP, "\t--qs= Quality scale. All quality values are scaled by this amount [default: 1.0].\n")); + INITDOUBLEOPTION(AspectRatio, Eod(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_PIXEL_ASPECT, _T("--pixel_aspect"), 1, SO_REQ_SEP, "\t--pixel_aspect= Aspect ratio of pixels (width over height), eg. 0.90909 for NTSC [default: 1.0].\n")); + INITDOUBLEOPTION(Stagger, Eod(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_STAGGER, _T("--stagger"), 0, SO_REQ_SEP, "\t--stagger= Affects simultaneity of xform interpolation during flame interpolation.\n" + "\t Represents how 'separate' the xforms are interpolated. Set to 1 for each\n" + "\t xform to be interpolated individually, fractions control interpolation overlap [default: 0].\n")); + INITDOUBLEOPTION(AvgThresh, Eod(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_AVG_THRESH, _T("--avg"), 20.0, SO_REQ_SEP, "\t--avg= Minimum average pixel channel sum (r + g + b) threshold from 0 - 765. Ignored if sequence, inter or rotate were specified [default: 20].\n")); + INITDOUBLEOPTION(BlackThresh, Eod(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_BLACK_THRESH, _T("--black"), 0.01, SO_REQ_SEP, "\t--black= Minimum number of allowed black pixels as a percentage from 0 - 1. Ignored if sequence, inter or rotate were specified [default: 0.01].\n")); + INITDOUBLEOPTION(WhiteLimit, Eod(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_WHITE_LIMIT, _T("--white"), 0.05, SO_REQ_SEP, "\t--white= Maximum number of allowed white pixels as a percentage from 0 - 1. Ignored if sequence, inter or rotate were specified [default: 0.05].\n")); + INITDOUBLEOPTION(Speed, Eod(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SPEED, _T("--speed"), 0.1, SO_REQ_SEP, "\t--speed= Speed as a percentage from 0 - 1 that the affine transform of an existing flame mutates with the new flame. Ignored if sequence, inter or rotate were specified [default: 0.1].\n")); + INITDOUBLEOPTION(OffsetX, Eod(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_OFFSETX, _T("--offsetx"), 0.0, SO_REQ_SEP, "\t--offsetx= Amount to jitter each flame horizontally when applying genome tools [default: 0].\n")); + INITDOUBLEOPTION(OffsetY, Eod(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_OFFSETY, _T("--offsety"), 0.0, SO_REQ_SEP, "\t--offsety= Amount to jitter each flame vertically when applying genome tools [default: 0].\n")); + INITDOUBLEOPTION(UseMem, Eod(eOptionUse::OPT_USE_RENDER, eOptionIDs::OPT_USEMEM, _T("--use_mem"), 0.0, SO_REQ_SEP, "\t--use_mem= Number of bytes of memory to use [default: max system memory].\n")); + INITDOUBLEOPTION(Loops, Eod(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_LOOPS, _T("--loops"), 1.0, SO_REQ_SEP, "\t--loops= Number of times to rotate each control point in sequence [default: 1].\n")); //String. - INITSTRINGOPTION(Device, Eos(OPT_USE_ALL, OPT_OPENCL_DEVICE, _T("--device"), "0", SO_REQ_SEP, "\t--device The comma-separated OpenCL device indices to use. Single device: 0 Multi device: 0,1,3,4 [default: 0].\n")); - INITSTRINGOPTION(IsaacSeed, Eos(OPT_USE_ALL, OPT_ISAAC_SEED, _T("--isaac_seed"), "", SO_REQ_SEP, "\t--isaac_seed= Character-based seed for the random number generator [default: random].\n")); - INITSTRINGOPTION(Input, Eos(OPT_RENDER_ANIM, OPT_IN, _T("--in"), "", SO_REQ_SEP, "\t--in= Name of the input file.\n")); - INITSTRINGOPTION(Out, Eos(OPT_USE_RENDER, OPT_OUT, _T("--out"), "", SO_REQ_SEP, "\t--out= Name of a single output file. Not recommended when rendering more than one image.\n")); - INITSTRINGOPTION(Prefix, Eos(OPT_RENDER_ANIM, OPT_PREFIX, _T("--prefix"), "", SO_REQ_SEP, "\t--prefix= Prefix to prepend to all output files.\n")); - INITSTRINGOPTION(Suffix, Eos(OPT_RENDER_ANIM, OPT_SUFFIX, _T("--suffix"), "", SO_REQ_SEP, "\t--suffix= Suffix to append to all output files.\n")); - INITSTRINGOPTION(Format, Eos(OPT_RENDER_ANIM, OPT_FORMAT, _T("--format"), "png", SO_REQ_SEP, "\t--format= Format of the output file. Valid values are: bmp, jpg, png, ppm [default: jpg].\n")); - INITSTRINGOPTION(PalettePath, Eos(OPT_USE_ALL, OPT_PALETTE_FILE, _T("--flam3_palettes"), "flam3-palettes.xml", SO_REQ_SEP, "\t--flam3_palettes= Path and name of the palette file [default: flam3-palettes.xml].\n")); - //INITSTRINGOPTION(PaletteImage, Eos(OPT_USE_ALL, OPT_PALETTE_IMAGE, _T("--image"), "", SO_REQ_SEP, "\t--image= Replace palette with png, jpg, or ppm image.\n")); - INITSTRINGOPTION(Id, Eos(OPT_USE_ALL, OPT_ID, _T("--id"), "", SO_REQ_SEP, "\t--id= ID to use in tags / image comments.\n")); - INITSTRINGOPTION(Url, Eos(OPT_USE_ALL, OPT_URL, _T("--url"), "", SO_REQ_SEP, "\t--url= URL to use in tags / image comments.\n")); - INITSTRINGOPTION(Nick, Eos(OPT_USE_ALL, OPT_NICK, _T("--nick"), "", SO_REQ_SEP, "\t--nick= Nickname to use in tags / image comments.\n")); - INITSTRINGOPTION(Comment, Eos(OPT_USE_GENOME, OPT_COMMENT, _T("--comment"), "", SO_REQ_SEP, "\t--comment= Comment to use in tags.\n")); - - INITSTRINGOPTION(TemplateFile, Eos(OPT_USE_GENOME, OPT_TEMPLATE, _T("--template"), "", SO_REQ_SEP, "\t--template= Apply defaults based on this flame.\n")); - INITSTRINGOPTION(Clone, Eos(OPT_USE_GENOME, OPT_CLONE, _T("--clone"), "", SO_REQ_SEP, "\t--clone= Clone random flame in input.\n")); - INITSTRINGOPTION(CloneAll, Eos(OPT_USE_GENOME, OPT_CLONE_ALL, _T("--clone_all"), "", SO_REQ_SEP, "\t--clone_all= Clones all flames in the input file. Useful for applying template to all flames.\n")); - INITSTRINGOPTION(CloneAction, Eos(OPT_USE_GENOME, OPT_CLONE_ACTION, _T("--clone_action"), "", SO_REQ_SEP, "\t--clone_action= A description of the clone action taking place.\n")); - INITSTRINGOPTION(Animate, Eos(OPT_USE_GENOME, OPT_ANIMATE, _T("--animate"), "", SO_REQ_SEP, "\t--animate= Interpolates between all flames in the input file, using times specified in file.\n")); - INITSTRINGOPTION(Mutate, Eos(OPT_USE_GENOME, OPT_MUTATE, _T("--mutate"), "", SO_REQ_SEP, "\t--mutate= Randomly mutate a random flame from the input file.\n")); - INITSTRINGOPTION(Cross0, Eos(OPT_USE_GENOME, OPT_CROSS0, _T("--cross0"), "", SO_REQ_SEP, "\t--cross0= Randomly select one flame from the input file to genetically cross...\n")); - INITSTRINGOPTION(Cross1, Eos(OPT_USE_GENOME, OPT_CROSS1, _T("--cross1"), "", SO_REQ_SEP, "\t--cross1= ...with one flame from this file.\n")); - INITSTRINGOPTION(Method, Eos(OPT_USE_GENOME, OPT_METHOD, _T("--method"), "", SO_REQ_SEP, "\t--method= Method used for genetic cross: alternate, interpolate, or union. For mutate: all_vars, one_xform, add_symmetry, post_xforms, color_palette, delete_xform, all_coefs [default: random].\n"));//Original ommitted this important documentation for mutate! - INITSTRINGOPTION(Inter, Eos(OPT_USE_GENOME, OPT_INTER, _T("--inter"), "", SO_REQ_SEP, "\t--inter= Interpolate the input file.\n")); - INITSTRINGOPTION(Rotate, Eos(OPT_USE_GENOME, OPT_ROTATE, _T("--rotate"), "", SO_REQ_SEP, "\t--rotate= Rotate the input file.\n")); - INITSTRINGOPTION(Strip, Eos(OPT_USE_GENOME, OPT_STRIP, _T("--strip"), "", SO_REQ_SEP, "\t--strip= Break strip out of each flame in the input file.\n")); - INITSTRINGOPTION(Sequence, Eos(OPT_USE_GENOME, OPT_SEQUENCE, _T("--sequence"), "", SO_REQ_SEP, "\t--sequence= 360 degree rotation 'loops' times of each control point in the input file plus rotating transitions.\n")); - INITSTRINGOPTION(UseVars, Eos(OPT_USE_GENOME, OPT_USE_VARS, _T("--use_vars"), "", SO_REQ_SEP, "\t--use_vars= Comma separated list of variation #'s to use when generating a random flame.\n")); - INITSTRINGOPTION(DontUseVars, Eos(OPT_USE_GENOME, OPT_DONT_USE_VARS, _T("--dont_use_vars"), "", SO_REQ_SEP, "\t--dont_use_vars= Comma separated list of variation #'s to NOT use when generating a random flame.\n")); - INITSTRINGOPTION(Extras, Eos(OPT_USE_GENOME, OPT_EXTRAS, _T("--extras"), "", SO_REQ_SEP, "\t--extras= Extra attributes to place in the flame section of the Xml.\n")); + INITSTRINGOPTION(Device, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_OPENCL_DEVICE, _T("--device"), "0", SO_REQ_SEP, "\t--device The comma-separated OpenCL device indices to use. Single device: 0 Multi device: 0,1,3,4 [default: 0].\n")); + INITSTRINGOPTION(IsaacSeed, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_ISAAC_SEED, _T("--isaac_seed"), "", SO_REQ_SEP, "\t--isaac_seed= Character-based seed for the random number generator [default: random].\n")); + INITSTRINGOPTION(Input, Eos(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_IN, _T("--in"), "", SO_REQ_SEP, "\t--in= Name of the input file.\n")); + INITSTRINGOPTION(Out, Eos(eOptionUse::OPT_USE_RENDER, eOptionIDs::OPT_OUT, _T("--out"), "", SO_REQ_SEP, "\t--out= Name of a single output file. Not recommended when rendering more than one image.\n")); + INITSTRINGOPTION(Prefix, Eos(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_PREFIX, _T("--prefix"), "", SO_REQ_SEP, "\t--prefix= Prefix to prepend to all output files.\n")); + INITSTRINGOPTION(Suffix, Eos(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_SUFFIX, _T("--suffix"), "", SO_REQ_SEP, "\t--suffix= Suffix to append to all output files.\n")); + INITSTRINGOPTION(Format, Eos(eOptionUse::OPT_RENDER_ANIM, eOptionIDs::OPT_FORMAT, _T("--format"), "png", SO_REQ_SEP, "\t--format= Format of the output file. Valid values are: bmp, jpg, png, ppm [default: jpg].\n")); + INITSTRINGOPTION(PalettePath, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_PALETTE_FILE, _T("--flam3_palettes"), "flam3-palettes.xml", SO_REQ_SEP, "\t--flam3_palettes= Path and name of the palette file [default: flam3-palettes.xml].\n")); + //INITSTRINGOPTION(PaletteImage, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_PALETTE_IMAGE, _T("--image"), "", SO_REQ_SEP, "\t--image= Replace palette with png, jpg, or ppm image.\n")); + INITSTRINGOPTION(Id, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_ID, _T("--id"), "", SO_REQ_SEP, "\t--id= ID to use in tags / image comments.\n")); + INITSTRINGOPTION(Url, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_URL, _T("--url"), "", SO_REQ_SEP, "\t--url= URL to use in tags / image comments.\n")); + INITSTRINGOPTION(Nick, Eos(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_NICK, _T("--nick"), "", SO_REQ_SEP, "\t--nick= Nickname to use in tags / image comments.\n")); + INITSTRINGOPTION(Comment, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_COMMENT, _T("--comment"), "", SO_REQ_SEP, "\t--comment= Comment to use in tags.\n")); + INITSTRINGOPTION(TemplateFile, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_TEMPLATE, _T("--template"), "", SO_REQ_SEP, "\t--template= Apply defaults based on this flame.\n")); + INITSTRINGOPTION(Clone, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_CLONE, _T("--clone"), "", SO_REQ_SEP, "\t--clone= Clone random flame in input.\n")); + INITSTRINGOPTION(CloneAll, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_CLONE_ALL, _T("--clone_all"), "", SO_REQ_SEP, "\t--clone_all= Clones all flames in the input file. Useful for applying template to all flames.\n")); + INITSTRINGOPTION(CloneAction, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_CLONE_ACTION, _T("--clone_action"), "", SO_REQ_SEP, "\t--clone_action= A description of the clone action taking place.\n")); + INITSTRINGOPTION(Animate, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_ANIMATE, _T("--animate"), "", SO_REQ_SEP, "\t--animate= Interpolates between all flames in the input file, using times specified in file.\n")); + INITSTRINGOPTION(Mutate, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_MUTATE, _T("--mutate"), "", SO_REQ_SEP, "\t--mutate= Randomly mutate a random flame from the input file.\n")); + INITSTRINGOPTION(Cross0, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_CROSS0, _T("--cross0"), "", SO_REQ_SEP, "\t--cross0= Randomly select one flame from the input file to genetically cross...\n")); + INITSTRINGOPTION(Cross1, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_CROSS1, _T("--cross1"), "", SO_REQ_SEP, "\t--cross1= ...with one flame from this file.\n")); + INITSTRINGOPTION(Method, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_METHOD, _T("--method"), "", SO_REQ_SEP, "\t--method= Method used for genetic cross: alternate, interpolate, or union. For mutate: all_vars, one_xform, add_symmetry, post_xforms, color_palette, delete_xform, all_coefs [default: random].\n"));//Original ommitted this important documentation for mutate! + INITSTRINGOPTION(Inter, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_INTER, _T("--inter"), "", SO_REQ_SEP, "\t--inter= Interpolate the input file.\n")); + INITSTRINGOPTION(Rotate, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_ROTATE, _T("--rotate"), "", SO_REQ_SEP, "\t--rotate= Rotate the input file.\n")); + INITSTRINGOPTION(Strip, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_STRIP, _T("--strip"), "", SO_REQ_SEP, "\t--strip= Break strip out of each flame in the input file.\n")); + INITSTRINGOPTION(Sequence, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SEQUENCE, _T("--sequence"), "", SO_REQ_SEP, "\t--sequence= 360 degree rotation 'loops' times of each control point in the input file plus rotating transitions.\n")); + INITSTRINGOPTION(UseVars, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_USE_VARS, _T("--use_vars"), "", SO_REQ_SEP, "\t--use_vars= Comma separated list of variation #'s to use when generating a random flame.\n")); + INITSTRINGOPTION(DontUseVars, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_DONT_USE_VARS, _T("--dont_use_vars"), "", SO_REQ_SEP, "\t--dont_use_vars= Comma separated list of variation #'s to NOT use when generating a random flame.\n")); + INITSTRINGOPTION(Extras, Eos(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_EXTRAS, _T("--extras"), "", SO_REQ_SEP, "\t--extras= Extra attributes to place in the flame section of the Xml.\n")); } /// @@ -429,106 +421,108 @@ public: if (errorCode == SO_SUCCESS) { - switch (args.OptionId()) + eOptionIDs e = eOptionIDs(args.OptionId()); + + switch (e) { - case OPT_HELP://Bool args. + case eOptionIDs::OPT_HELP://Bool args. { ShowUsage(optUsage); return true; } - case OPT_VERSION: + + case eOptionIDs::OPT_VERSION: { cout << EmberVersion() << endl; return true; } - PARSEBOOLOPTION(OPT_VERBOSE, Verbose); - PARSEBOOLOPTION(OPT_DEBUG, Debug); - PARSEBOOLOPTION(OPT_DUMP_ARGS, DumpArgs); - PARSEBOOLOPTION(OPT_PROGRESS, DoProgress); - PARSEBOOLOPTION(OPT_DUMP_OPENCL_INFO, OpenCLInfo); - PARSEBOOLOPTION(OPT_OPENCL, EmberCL); - PARSEBOOLOPTION(OPT_EARLYCLIP, EarlyClip); - PARSEBOOLOPTION(OPT_POS_Y_UP, YAxisUp); - PARSEBOOLOPTION(OPT_TRANSPARENCY, Transparency); - PARSEBOOLOPTION(OPT_NAME_ENABLE, NameEnable); - PARSEBOOLOPTION(OPT_INT_PALETTE, IntPalette); - PARSEBOOLOPTION(OPT_HEX_PALETTE, HexPalette); - PARSEBOOLOPTION(OPT_INSERT_PALETTE, InsertPalette); - PARSEBOOLOPTION(OPT_JPEG_COMMENTS, JpegComments); - PARSEBOOLOPTION(OPT_PNG_COMMENTS, PngComments); - PARSEBOOLOPTION(OPT_WRITE_GENOME, WriteGenome); - PARSEBOOLOPTION(OPT_THREADED_WRITE, ThreadedWrite); - PARSEBOOLOPTION(OPT_ENCLOSED, Enclosed); - PARSEBOOLOPTION(OPT_NO_EDITS, NoEdits); - PARSEBOOLOPTION(OPT_UNSMOOTH_EDGE, UnsmoothEdge); - PARSEBOOLOPTION(OPT_LOCK_ACCUM, LockAccum); - PARSEBOOLOPTION(OPT_DUMP_KERNEL, DumpKernel); - PARSEINTOPTION(OPT_SYMMETRY, Symmetry);//Int args - PARSEINTOPTION(OPT_SHEEP_GEN, SheepGen); - PARSEINTOPTION(OPT_SHEEP_ID, SheepId); - PARSEINTOPTION(OPT_PRIORITY, Priority); - PARSEUINTOPTION(OPT_SEED, Seed);//uint args. - PARSEUINTOPTION(OPT_NTHREADS, ThreadCount); - PARSEUINTOPTION(OPT_STRIPS, Strips); - PARSEUINTOPTION(OPT_SUPERSAMPLE, Supersample); - PARSEUINTOPTION(OPT_BITS, Bits); - PARSEUINTOPTION(OPT_BPC, BitsPerChannel); - PARSEUINTOPTION(OPT_SBS, SubBatchSize); - PARSEUINTOPTION(OPT_PRINT_EDIT_DEPTH, PrintEditDepth); - PARSEUINTOPTION(OPT_JPEG, JpegQuality); - PARSEUINTOPTION(OPT_BEGIN, FirstFrame); - PARSEUINTOPTION(OPT_END, LastFrame); - PARSEUINTOPTION(OPT_FRAME, Frame); - PARSEUINTOPTION(OPT_TIME, Time); - PARSEUINTOPTION(OPT_DTIME, Dtime); - PARSEUINTOPTION(OPT_NFRAMES, Frames); - PARSEUINTOPTION(OPT_REPEAT, Repeat); - PARSEUINTOPTION(OPT_TRIES, Tries); - PARSEUINTOPTION(OPT_MAX_XFORMS, MaxXforms); + PARSEBOOLOPTION(eOptionIDs::OPT_VERBOSE, Verbose); + PARSEBOOLOPTION(eOptionIDs::OPT_DEBUG, Debug); + PARSEBOOLOPTION(eOptionIDs::OPT_DUMP_ARGS, DumpArgs); + PARSEBOOLOPTION(eOptionIDs::OPT_PROGRESS, DoProgress); + PARSEBOOLOPTION(eOptionIDs::OPT_DUMP_OPENCL_INFO, OpenCLInfo); + PARSEBOOLOPTION(eOptionIDs::OPT_OPENCL, EmberCL); + PARSEBOOLOPTION(eOptionIDs::OPT_EARLYCLIP, EarlyClip); + PARSEBOOLOPTION(eOptionIDs::OPT_POS_Y_UP, YAxisUp); + PARSEBOOLOPTION(eOptionIDs::OPT_TRANSPARENCY, Transparency); + PARSEBOOLOPTION(eOptionIDs::OPT_NAME_ENABLE, NameEnable); + PARSEBOOLOPTION(eOptionIDs::OPT_INT_PALETTE, IntPalette); + PARSEBOOLOPTION(eOptionIDs::OPT_HEX_PALETTE, HexPalette); + PARSEBOOLOPTION(eOptionIDs::OPT_INSERT_PALETTE, InsertPalette); + PARSEBOOLOPTION(eOptionIDs::OPT_JPEG_COMMENTS, JpegComments); + PARSEBOOLOPTION(eOptionIDs::OPT_PNG_COMMENTS, PngComments); + PARSEBOOLOPTION(eOptionIDs::OPT_WRITE_GENOME, WriteGenome); + PARSEBOOLOPTION(eOptionIDs::OPT_THREADED_WRITE, ThreadedWrite); + PARSEBOOLOPTION(eOptionIDs::OPT_ENCLOSED, Enclosed); + PARSEBOOLOPTION(eOptionIDs::OPT_NO_EDITS, NoEdits); + PARSEBOOLOPTION(eOptionIDs::OPT_UNSMOOTH_EDGE, UnsmoothEdge); + PARSEBOOLOPTION(eOptionIDs::OPT_LOCK_ACCUM, LockAccum); + PARSEBOOLOPTION(eOptionIDs::OPT_DUMP_KERNEL, DumpKernel); + PARSEINTOPTION(eOptionIDs::OPT_SYMMETRY, Symmetry);//Int args + PARSEINTOPTION(eOptionIDs::OPT_SHEEP_GEN, SheepGen); + PARSEINTOPTION(eOptionIDs::OPT_SHEEP_ID, SheepId); + PARSEINTOPTION(eOptionIDs::OPT_PRIORITY, Priority); + PARSEUINTOPTION(eOptionIDs::OPT_SEED, Seed);//uint args. + PARSEUINTOPTION(eOptionIDs::OPT_NTHREADS, ThreadCount); + PARSEUINTOPTION(eOptionIDs::OPT_STRIPS, Strips); + PARSEUINTOPTION(eOptionIDs::OPT_SUPERSAMPLE, Supersample); + PARSEUINTOPTION(eOptionIDs::OPT_BITS, Bits); + PARSEUINTOPTION(eOptionIDs::OPT_BPC, BitsPerChannel); + PARSEUINTOPTION(eOptionIDs::OPT_SBS, SubBatchSize); + PARSEUINTOPTION(eOptionIDs::OPT_PRINT_EDIT_DEPTH, PrintEditDepth); + PARSEUINTOPTION(eOptionIDs::OPT_JPEG, JpegQuality); + PARSEUINTOPTION(eOptionIDs::OPT_BEGIN, FirstFrame); + PARSEUINTOPTION(eOptionIDs::OPT_END, LastFrame); + PARSEUINTOPTION(eOptionIDs::OPT_FRAME, Frame); + PARSEUINTOPTION(eOptionIDs::OPT_TIME, Time); + PARSEUINTOPTION(eOptionIDs::OPT_DTIME, Dtime); + PARSEUINTOPTION(eOptionIDs::OPT_NFRAMES, Frames); + PARSEUINTOPTION(eOptionIDs::OPT_REPEAT, Repeat); + PARSEUINTOPTION(eOptionIDs::OPT_TRIES, Tries); + PARSEUINTOPTION(eOptionIDs::OPT_MAX_XFORMS, MaxXforms); + PARSEDOUBLEOPTION(eOptionIDs::OPT_SS, SizeScale);//Float args. + PARSEDOUBLEOPTION(eOptionIDs::OPT_QS, QualityScale); + PARSEDOUBLEOPTION(eOptionIDs::OPT_PIXEL_ASPECT, AspectRatio); + PARSEDOUBLEOPTION(eOptionIDs::OPT_STAGGER, Stagger); + PARSEDOUBLEOPTION(eOptionIDs::OPT_AVG_THRESH, AvgThresh); + PARSEDOUBLEOPTION(eOptionIDs::OPT_BLACK_THRESH, BlackThresh); + PARSEDOUBLEOPTION(eOptionIDs::OPT_WHITE_LIMIT, WhiteLimit); + PARSEDOUBLEOPTION(eOptionIDs::OPT_SPEED, Speed); + PARSEDOUBLEOPTION(eOptionIDs::OPT_OFFSETX, OffsetX); + PARSEDOUBLEOPTION(eOptionIDs::OPT_OFFSETY, OffsetY); + PARSEDOUBLEOPTION(eOptionIDs::OPT_USEMEM, UseMem); + PARSEDOUBLEOPTION(eOptionIDs::OPT_LOOPS, Loops); + PARSESTRINGOPTION(eOptionIDs::OPT_OPENCL_DEVICE, Device);//String args. + PARSESTRINGOPTION(eOptionIDs::OPT_ISAAC_SEED, IsaacSeed); + PARSESTRINGOPTION(eOptionIDs::OPT_IN, Input); + PARSESTRINGOPTION(eOptionIDs::OPT_OUT, Out); + PARSESTRINGOPTION(eOptionIDs::OPT_PREFIX, Prefix); + PARSESTRINGOPTION(eOptionIDs::OPT_SUFFIX, Suffix); + PARSESTRINGOPTION(eOptionIDs::OPT_FORMAT, Format); + PARSESTRINGOPTION(eOptionIDs::OPT_PALETTE_FILE, PalettePath); + //PARSESTRINGOPTION(eOptionIDs::OPT_PALETTE_IMAGE, PaletteImage); + PARSESTRINGOPTION(eOptionIDs::OPT_ID, Id); + PARSESTRINGOPTION(eOptionIDs::OPT_URL, Url); + PARSESTRINGOPTION(eOptionIDs::OPT_NICK, Nick); + PARSESTRINGOPTION(eOptionIDs::OPT_COMMENT, Comment); + PARSESTRINGOPTION(eOptionIDs::OPT_TEMPLATE, TemplateFile); + PARSESTRINGOPTION(eOptionIDs::OPT_CLONE, Clone); + PARSESTRINGOPTION(eOptionIDs::OPT_CLONE_ALL, CloneAll); + PARSESTRINGOPTION(eOptionIDs::OPT_CLONE_ACTION, CloneAction); + PARSESTRINGOPTION(eOptionIDs::OPT_ANIMATE, Animate); + PARSESTRINGOPTION(eOptionIDs::OPT_MUTATE, Mutate); + PARSESTRINGOPTION(eOptionIDs::OPT_CROSS0, Cross0); + PARSESTRINGOPTION(eOptionIDs::OPT_CROSS1, Cross1); + PARSESTRINGOPTION(eOptionIDs::OPT_METHOD, Method); + PARSESTRINGOPTION(eOptionIDs::OPT_INTER, Inter); + PARSESTRINGOPTION(eOptionIDs::OPT_ROTATE, Rotate); + PARSESTRINGOPTION(eOptionIDs::OPT_STRIP, Strip); + PARSESTRINGOPTION(eOptionIDs::OPT_SEQUENCE, Sequence); + PARSESTRINGOPTION(eOptionIDs::OPT_USE_VARS, UseVars); + PARSESTRINGOPTION(eOptionIDs::OPT_DONT_USE_VARS, DontUseVars); + PARSESTRINGOPTION(eOptionIDs::OPT_EXTRAS, Extras); - PARSEDOUBLEOPTION(OPT_SS, SizeScale);//Float args. - PARSEDOUBLEOPTION(OPT_QS, QualityScale); - PARSEDOUBLEOPTION(OPT_PIXEL_ASPECT, AspectRatio); - PARSEDOUBLEOPTION(OPT_STAGGER, Stagger); - PARSEDOUBLEOPTION(OPT_AVG_THRESH, AvgThresh); - PARSEDOUBLEOPTION(OPT_BLACK_THRESH, BlackThresh); - PARSEDOUBLEOPTION(OPT_WHITE_LIMIT, WhiteLimit); - PARSEDOUBLEOPTION(OPT_SPEED, Speed); - PARSEDOUBLEOPTION(OPT_OFFSETX, OffsetX); - PARSEDOUBLEOPTION(OPT_OFFSETY, OffsetY); - PARSEDOUBLEOPTION(OPT_USEMEM, UseMem); - PARSEDOUBLEOPTION(OPT_LOOPS, Loops); - - PARSESTRINGOPTION(OPT_OPENCL_DEVICE, Device);//String args. - PARSESTRINGOPTION(OPT_ISAAC_SEED, IsaacSeed); - PARSESTRINGOPTION(OPT_IN, Input); - PARSESTRINGOPTION(OPT_OUT, Out); - PARSESTRINGOPTION(OPT_PREFIX, Prefix); - PARSESTRINGOPTION(OPT_SUFFIX, Suffix); - PARSESTRINGOPTION(OPT_FORMAT, Format); - PARSESTRINGOPTION(OPT_PALETTE_FILE, PalettePath); - //PARSESTRINGOPTION(OPT_PALETTE_IMAGE, PaletteImage); - PARSESTRINGOPTION(OPT_ID, Id); - PARSESTRINGOPTION(OPT_URL, Url); - PARSESTRINGOPTION(OPT_NICK, Nick); - PARSESTRINGOPTION(OPT_COMMENT, Comment); - PARSESTRINGOPTION(OPT_TEMPLATE, TemplateFile); - PARSESTRINGOPTION(OPT_CLONE, Clone); - PARSESTRINGOPTION(OPT_CLONE_ALL, CloneAll); - PARSESTRINGOPTION(OPT_CLONE_ACTION, CloneAction); - PARSESTRINGOPTION(OPT_ANIMATE, Animate); - PARSESTRINGOPTION(OPT_MUTATE, Mutate); - PARSESTRINGOPTION(OPT_CROSS0, Cross0); - PARSESTRINGOPTION(OPT_CROSS1, Cross1); - PARSESTRINGOPTION(OPT_METHOD, Method); - PARSESTRINGOPTION(OPT_INTER, Inter); - PARSESTRINGOPTION(OPT_ROTATE, Rotate); - PARSESTRINGOPTION(OPT_STRIP, Strip); - PARSESTRINGOPTION(OPT_SEQUENCE, Sequence); - PARSESTRINGOPTION(OPT_USE_VARS, UseVars); - PARSESTRINGOPTION(OPT_DONT_USE_VARS, DontUseVars); - PARSESTRINGOPTION(OPT_EXTRAS, Extras); default: { break;//Do nothing. @@ -550,7 +544,6 @@ public: { size_t device = 0; istringstream istr(s); - istr >> device; if (!istr.bad() && !istr.fail()) @@ -577,17 +570,21 @@ public: /// /// The specified program usage /// A vector of all available options for the specified program - vector GetSimpleOptions(eOptionUse optUsage = OPT_USE_ALL) + vector GetSimpleOptions(eOptionUse optUsage = eOptionUse::OPT_USE_ALL) { vector entries; CSimpleOpt::SOption endOption = SO_END_OF_OPTIONS; entries.reserve(75); - for (auto entry : m_BoolArgs) if (entry->m_OptionUse & optUsage) entries.push_back(entry->m_Option); - for (auto entry : m_IntArgs) if (entry->m_OptionUse & optUsage) entries.push_back(entry->m_Option); - for (auto entry : m_UintArgs) if (entry->m_OptionUse & optUsage) entries.push_back(entry->m_Option); - for (auto entry : m_DoubleArgs) if (entry->m_OptionUse & optUsage) entries.push_back(entry->m_Option); - for (auto entry : m_StringArgs) if (entry->m_OptionUse & optUsage) entries.push_back(entry->m_Option); + for (auto entry : m_BoolArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option); + + for (auto entry : m_IntArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option); + + for (auto entry : m_UintArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option); + + for (auto entry : m_DoubleArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option); + + for (auto entry : m_StringArgs) if (et(entry->m_OptionUse) & et(optUsage)) entries.push_back(entry->m_Option); entries.push_back(endOption); return entries; @@ -598,15 +595,19 @@ public: /// /// The specified program usage /// A string with the descriptions of all available options for the specified program - string GetUsage(eOptionUse optUsage = OPT_USE_ALL) + string GetUsage(eOptionUse optUsage = eOptionUse::OPT_USE_ALL) { ostringstream os; - for (auto entry : m_BoolArgs) if (entry->m_OptionUse & optUsage) os << entry->m_DocString << endl; - for (auto entry : m_IntArgs) if (entry->m_OptionUse & optUsage) os << entry->m_DocString << endl; - for (auto entry : m_UintArgs) if (entry->m_OptionUse & optUsage) os << entry->m_DocString << endl; - for (auto entry : m_DoubleArgs) if (entry->m_OptionUse & optUsage) os << entry->m_DocString << endl; - for (auto entry : m_StringArgs) if (entry->m_OptionUse & optUsage) os << entry->m_DocString << endl; + for (auto entry : m_BoolArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << endl; + + for (auto entry : m_IntArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << endl; + + for (auto entry : m_UintArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << endl; + + for (auto entry : m_DoubleArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << endl; + + for (auto entry : m_StringArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_DocString << endl; return os.str(); } @@ -616,16 +617,20 @@ public: /// /// The specified program usage /// A string with all of the names and values for all available options for the specified program - string GetValues(eOptionUse optUsage = OPT_USE_ALL) + string GetValues(eOptionUse optUsage = eOptionUse::OPT_USE_ALL) { ostringstream os; - os << std::boolalpha; - for (auto entry : m_BoolArgs) if (entry->m_OptionUse & optUsage) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; - for (auto entry : m_IntArgs) if (entry->m_OptionUse & optUsage) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; - for (auto entry : m_UintArgs) if (entry->m_OptionUse & optUsage) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; - for (auto entry : m_DoubleArgs) if (entry->m_OptionUse & optUsage) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; - for (auto entry : m_StringArgs) if (entry->m_OptionUse & optUsage) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; + + for (auto entry : m_BoolArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; + + for (auto entry : m_IntArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; + + for (auto entry : m_UintArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; + + for (auto entry : m_DoubleArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; + + for (auto entry : m_StringArgs) if (et(entry->m_OptionUse) & et(optUsage)) os << entry->m_NameWithoutDashes << ": " << (*entry)() << endl; return os.str(); } @@ -638,20 +643,20 @@ public: { cout << DescriptionString << " version " << EmberVersion() << endl << endl; - if (optUsage == OPT_USE_RENDER) + if (optUsage == eOptionUse::OPT_USE_RENDER) { cout << "Usage:\n" - "\tEmberRender.exe --in=test.flam3 [--out=outfile --format=png --verbose --progress --opencl]\n" << endl; + "\tEmberRender.exe --in=test.flam3 [--out=outfile --format=png --verbose --progress --opencl]\n" << endl; } - else if (optUsage == OPT_USE_ANIMATE) + else if (optUsage == eOptionUse::OPT_USE_ANIMATE) { cout << "Usage:\n" - "\tEmberAnimate.exe --in=sequence.flam3 [--format=png --verbose --progress --opencl]\n" << endl; + "\tEmberAnimate.exe --in=sequence.flam3 [--format=png --verbose --progress --opencl]\n" << endl; } - else if (optUsage == OPT_USE_GENOME) + else if (optUsage == eOptionUse::OPT_USE_GENOME) { cout << "Usage:\n" - "\tEmberGenome.exe --sequence=test.flam3 > sequenceout.flam3\n" << endl; + "\tEmberGenome.exe --sequence=test.flam3 > sequenceout.flam3\n" << endl; } cout << GetUsage(optUsage) << endl; @@ -667,12 +672,19 @@ public: switch (errorCode) { case SO_SUCCESS: return "Success"; + case SO_OPT_INVALID: return "Unrecognized option"; + case SO_OPT_MULTIPLE: return "Option matched multiple strings"; + case SO_ARG_INVALID: return "Option does not accept argument"; + case SO_ARG_INVALID_TYPE: return "Invalid argument format"; + case SO_ARG_MISSING: return "Required argument is missing"; + case SO_ARG_INVALID_DATA: return "Invalid argument data"; + default: return "Unknown error"; } } diff --git a/Source/EmberGenome/EmberGenome.cpp b/Source/EmberGenome/EmberGenome.cpp index 9c1593d..abf0878 100644 --- a/Source/EmberGenome/EmberGenome.cpp +++ b/Source/EmberGenome/EmberGenome.cpp @@ -47,7 +47,7 @@ bool EmberGenome(EmberOptions& opt) std::cout.imbue(std::locale("")); if (opt.DumpArgs()) - cerr << opt.GetValues(OPT_USE_GENOME) << endl; + cerr << opt.GetValues(eOptionUse::OPT_USE_GENOME) << endl; if (opt.OpenCLInfo()) { @@ -79,7 +79,7 @@ bool EmberGenome(EmberOptions& opt) EmberReport emberReport, emberReport2; const vector> devices = Devices(opt.Devices()); unique_ptr> progress(new RenderProgress()); - unique_ptr> renderer(CreateRenderer(opt.EmberCL() ? OPENCL_RENDERER : CPU_RENDERER, devices, false, 0, emberReport)); + unique_ptr> renderer(CreateRenderer(opt.EmberCL() ? eRendererType::OPENCL_RENDERER : eRendererType::CPU_RENDERER, devices, false, 0, emberReport)); QTIsaac rand(ISAAC_INT(t.Tic()), ISAAC_INT(t.Tic() * 2), ISAAC_INT(t.Tic() * 3)); vector errorReport = emberReport.ErrorReport(); os.imbue(std::locale("")); @@ -117,7 +117,7 @@ bool EmberGenome(EmberOptions& opt) } //SheepTools will own the created renderer and will take care of cleaning it up. - SheepTools tools(opt.PalettePath(), CreateRenderer(opt.EmberCL() ? OPENCL_RENDERER : CPU_RENDERER, devices, false, 0, emberReport2)); + SheepTools tools(opt.PalettePath(), CreateRenderer(opt.EmberCL() ? eRendererType::OPENCL_RENDERER : eRendererType::CPU_RENDERER, devices, false, 0, emberReport2)); tools.SetSpinParams(!opt.UnsmoothEdge(), T(opt.Stagger()), T(opt.OffsetX()), @@ -138,18 +138,18 @@ bool EmberGenome(EmberOptions& opt) //Specify reasonable defaults if nothing is specified. if (opt.UseVars() == "" && opt.DontUseVars() == "") { - noVars.push_back(VAR_NOISE); - noVars.push_back(VAR_BLUR); - noVars.push_back(VAR_GAUSSIAN_BLUR); - noVars.push_back(VAR_RADIAL_BLUR); - noVars.push_back(VAR_NGON); - noVars.push_back(VAR_SQUARE); - noVars.push_back(VAR_RAYS); - noVars.push_back(VAR_CROSS); - noVars.push_back(VAR_PRE_BLUR); - noVars.push_back(VAR_SEPARATION); - noVars.push_back(VAR_SPLIT); - noVars.push_back(VAR_SPLITS); + noVars.push_back(eVariationId::VAR_NOISE); + noVars.push_back(eVariationId::VAR_BLUR); + noVars.push_back(eVariationId::VAR_GAUSSIAN_BLUR); + noVars.push_back(eVariationId::VAR_RADIAL_BLUR); + noVars.push_back(eVariationId::VAR_NGON); + noVars.push_back(eVariationId::VAR_SQUARE); + noVars.push_back(eVariationId::VAR_RAYS); + noVars.push_back(eVariationId::VAR_CROSS); + noVars.push_back(eVariationId::VAR_PRE_BLUR); + noVars.push_back(eVariationId::VAR_SEPARATION); + noVars.push_back(eVariationId::VAR_SPLIT); + noVars.push_back(eVariationId::VAR_SPLITS); //Loop over the novars and set ivars to the complement. for (i = 0; i < varList.Size(); i++) @@ -554,25 +554,25 @@ bool EmberGenome(EmberOptions& opt) aselp1 = nullptr; if (opt.Method() == "") - mutMeth = MUTATE_NOT_SPECIFIED; + mutMeth = eMutateMode::MUTATE_NOT_SPECIFIED; else if (opt.Method() == "all_vars") - mutMeth = MUTATE_ALL_VARIATIONS; + mutMeth = eMutateMode::MUTATE_ALL_VARIATIONS; else if (opt.Method() == "one_xform") - mutMeth = MUTATE_ONE_XFORM_COEFS; + mutMeth = eMutateMode::MUTATE_ONE_XFORM_COEFS; else if (opt.Method() == "add_symmetry") - mutMeth = MUTATE_ADD_SYMMETRY; + mutMeth = eMutateMode::MUTATE_ADD_SYMMETRY; else if (opt.Method() == "post_xforms") - mutMeth = MUTATE_POST_XFORMS; + mutMeth = eMutateMode::MUTATE_POST_XFORMS; else if (opt.Method() == "color_palette") - mutMeth = MUTATE_COLOR_PALETTE; + mutMeth = eMutateMode::MUTATE_COLOR_PALETTE; else if (opt.Method() == "delete_xform") - mutMeth = MUTATE_DELETE_XFORM; + mutMeth = eMutateMode::MUTATE_DELETE_XFORM; else if (opt.Method() == "all_coefs") - mutMeth = MUTATE_ALL_COEFS; + mutMeth = eMutateMode::MUTATE_ALL_COEFS; else { cerr << "method " << opt.Method() << " not defined for mutate. Defaulting to random." << endl; - mutMeth = MUTATE_NOT_SPECIFIED; + mutMeth = eMutateMode::MUTATE_NOT_SPECIFIED; } os << tools.Mutate(orig, mutMeth, vars, opt.Symmetry(), T(opt.Speed()), MAX_CL_VARS); @@ -598,17 +598,17 @@ bool EmberGenome(EmberOptions& opt) aselp1 = &selp1; if (opt.Method() == "") - crossMeth = CROSS_NOT_SPECIFIED; + crossMeth = eCrossMode::CROSS_NOT_SPECIFIED; else if (opt.Method() == "union") - crossMeth = CROSS_UNION; + crossMeth = eCrossMode::CROSS_UNION; else if (opt.Method() == "interpolate") - crossMeth = CROSS_INTERPOLATE; + crossMeth = eCrossMode::CROSS_INTERPOLATE; else if (opt.Method() == "alternate") - crossMeth = CROSS_ALTERNATE; + crossMeth = eCrossMode::CROSS_ALTERNATE; else { cerr << "method '" << opt.Method() << "' not defined for cross. Defaulting to random." << endl; - crossMeth = CROSS_NOT_SPECIFIED; + crossMeth = eCrossMode::CROSS_NOT_SPECIFIED; } tools.Cross(embers[i0], embers2[i1], orig, crossMeth); @@ -765,7 +765,7 @@ int _tmain(int argc, _TCHAR* argv[]) putenv(const_cast("GPU_MAX_ALLOC_PERCENT=100")); #endif - if (!opt.Populate(argc, argv, OPT_USE_GENOME)) + if (!opt.Populate(argc, argv, eOptionUse::OPT_USE_GENOME)) { #ifdef DO_DOUBLE diff --git a/Source/EmberRender/EmberRender.cpp b/Source/EmberRender/EmberRender.cpp index 739beda..a1ccba7 100644 --- a/Source/EmberRender/EmberRender.cpp +++ b/Source/EmberRender/EmberRender.cpp @@ -17,7 +17,7 @@ bool EmberRender(EmberOptions& opt) std::cout.imbue(std::locale("")); if (opt.DumpArgs()) - cout << opt.GetValues(OPT_USE_RENDER) << endl; + cout << opt.GetValues(eOptionUse::OPT_USE_RENDER) << endl; if (opt.OpenCLInfo()) { @@ -47,7 +47,7 @@ bool EmberRender(EmberOptions& opt) vector> randVec; const vector> devices = Devices(opt.Devices()); unique_ptr> progress(new RenderProgress()); - unique_ptr> renderer(CreateRenderer(opt.EmberCL() ? OPENCL_RENDERER : CPU_RENDERER, devices, false, 0, emberReport)); + unique_ptr> renderer(CreateRenderer(opt.EmberCL() ? eRendererType::OPENCL_RENDERER : eRendererType::CPU_RENDERER, devices, false, 0, emberReport)); vector errorReport = emberReport.ErrorReport(); if (!errorReport.empty()) @@ -59,7 +59,7 @@ bool EmberRender(EmberOptions& opt) return false; } - if (opt.EmberCL() && renderer->RendererType() != OPENCL_RENDERER)//OpenCL init failed, so fall back to CPU. + if (opt.EmberCL() && renderer->RendererType() != eRendererType::OPENCL_RENDERER)//OpenCL init failed, so fall back to CPU. opt.EmberCL(false); if (!InitPaletteList(opt.PalettePath())) @@ -343,7 +343,7 @@ int _tmain(int argc, _TCHAR* argv[]) putenv(const_cast("GPU_MAX_ALLOC_PERCENT=100")); #endif - if (!opt.Populate(argc, argv, OPT_USE_RENDER)) + if (!opt.Populate(argc, argv, eOptionUse::OPT_USE_RENDER)) { #ifdef DO_DOUBLE diff --git a/Source/EmberTester/EmberTester.cpp b/Source/EmberTester/EmberTester.cpp index 6e59aa9..6dc2139 100644 --- a/Source/EmberTester/EmberTester.cpp +++ b/Source/EmberTester/EmberTester.cpp @@ -120,14 +120,14 @@ void MakeTestAllVarsRegPrePost(vector>& embers) while (index < varList.RegSize()) { - /* if (index != VAR_SYNTH) + /* if (index != eVariationId::VAR_SYNTH) { index++; continue; } */ Ember ember1; - unique_ptr> regVar(varList.GetVariationCopy(index, VARTYPE_REG)); + unique_ptr> regVar(varList.GetVariationCopy(index, eVariationType::VARTYPE_REG)); unique_ptr> preVar(varList.GetVariationCopy("pre_" + regVar->Name())); unique_ptr> postVar(varList.GetVariationCopy("post_" + regVar->Name())); ember1.m_FinalRasW = 640; @@ -342,7 +342,7 @@ static vector*> FindVarsWith(vector& stringVec, bool findAl while (index < vl.RegSize()) { - auto regVar = vl.GetVariation(index, VARTYPE_REG); + auto regVar = vl.GetVariation(index, eVariationType::VARTYPE_REG); if (SearchVar(regVar, stringVec, false)) { @@ -363,18 +363,18 @@ bool TestVarCounts() VariationList vlf; #ifdef DO_DOUBLE VariationList vld; - bool success ((vlf.Size() == vld.Size()) && (vlf.Size() == LAST_VAR)); + bool success((vlf.Size() == vld.Size()) && (vlf.Size() == size_t(eVariationId::LAST_VAR))); #else bool success = true; #endif - uint start = (uint)VAR_ARCH; + uint start = et(eVariationId::VAR_ARCH); if (!success) { - cout << "Variation list size " << vlf.Size() << " does not equal the max var ID enum " << (uint)LAST_VAR << "." << endl; + cout << "Variation list size " << vlf.Size() << " does not equal the max var ID enum " << et(eVariationId::LAST_VAR) << "." << endl; } - for (; start < (uint)LAST_VAR; start++) + for (; start < et(eVariationId::LAST_VAR); start++) { auto var = vlf.GetVariation((eVariationId)start); @@ -480,13 +480,13 @@ bool TestVarEqual(const Variation* var1, const Variation
* var2) if (var1->VariationId() != var2->VariationId()) { - cout << "Variation IDs were not equal: " << var1->VariationId() << " != " << var2->VariationId() << endl; + cout << "Variation IDs were not equal: " << et(var1->VariationId()) << " != " << et(var2->VariationId()) << endl; success = false; } if (var1->VarType() != var2->VarType()) { - cout << "Variation types were not equal: " << var1->VarType() << " != " << var2->VarType() << endl; + cout << "Variation types were not equal: " << et(var1->VarType()) << " != " << et(var2->VarType()) << endl; success = false; } @@ -587,7 +587,7 @@ bool TestVarPrePostNames() auto var = vlf.GetVariation(i); string name = var->Name(); - if (var->VarType() == VARTYPE_REG) + if (var->VarType() == eVariationType::VARTYPE_REG) { if (name.find("pre_") == 0) { @@ -601,7 +601,7 @@ bool TestVarPrePostNames() success = false; } } - else if (var->VarType() == VARTYPE_PRE) + else if (var->VarType() == eVariationType::VARTYPE_PRE) { if (name.find("pre_") != 0) { @@ -609,7 +609,7 @@ bool TestVarPrePostNames() success = false; } } - else if (var->VarType() == VARTYPE_POST) + else if (var->VarType() == eVariationType::VARTYPE_POST) { if (name.find("post_") != 0) { @@ -734,7 +734,7 @@ bool TestVarRegPrePost() for (size_t i = 0; i < vlf.RegSize(); i++) { - auto regVar = vlf.GetVariation(i, VARTYPE_REG); + auto regVar = vlf.GetVariation(i, eVariationType::VARTYPE_REG); if (regVar) { @@ -978,9 +978,9 @@ bool TestVarAssignTypes() string s = var->OpenCLString(); //Only test pre and post. The assign type for regular is ignored, and will always be summed. - if (var->VarType() != VARTYPE_REG) + if (var->VarType() != eVariationType::VARTYPE_REG) { - if (var->AssignType() == ASSIGNTYPE_SET) + if (var->AssignType() == eVariationAssignType::ASSIGNTYPE_SET) { if (!SearchVar(var, vset, false)) { @@ -988,7 +988,7 @@ bool TestVarAssignTypes() success = false; } } - else if (var->AssignType() == ASSIGNTYPE_SUM) + else if (var->AssignType() == eVariationAssignType::ASSIGNTYPE_SUM) { if (SearchVar(var, vsum, false)) { @@ -998,7 +998,7 @@ bool TestVarAssignTypes() } else { - cout << "Variation " << var->Name() << " had an invalid assign type of " << var->AssignType() << endl; + cout << "Variation " << var->Name() << " had an invalid assign type of " << et(var->AssignType()) << endl; } } } @@ -1147,7 +1147,7 @@ void TestXformsInOutPoints() while (index < varList.RegSize()) { vector> xforms; - unique_ptr> regVar(varList.GetVariationCopy(index, VARTYPE_REG)); + unique_ptr> regVar(varList.GetVariationCopy(index, eVariationType::VARTYPE_REG)); string s = regVar->OpenCLString() + regVar->OpenCLFuncsString(); if (s.find("MwcNext") == string::npos) @@ -1263,7 +1263,7 @@ void TestVarTime() { double sum = 0; Xform xform; - Variation* var = vlf.GetVariationCopy(i, VARTYPE_REG); + Variation* var = vlf.GetVariationCopy(i, eVariationType::VARTYPE_REG); xform.AddVariation(var); for (int iter = 0; iter < iters; iter++) @@ -1371,7 +1371,7 @@ void TestVarsSimilar() { double diff = 0, highest = TMAX; Xform xform; - Variation* var = vlf.GetVariationCopy(i, VARTYPE_REG); + Variation* var = vlf.GetVariationCopy(i, eVariationType::VARTYPE_REG); pair match("", TMAX); compIndex = 0; xform.AddVariation(var); @@ -1386,7 +1386,7 @@ void TestVarsSimilar() double sum = 0, xdiff = 0, ydiff = 0, zdiff = 0; Xform xformComp; - Variation* varComp = vlf.GetVariationCopy(compIndex, VARTYPE_REG); + Variation* varComp = vlf.GetVariationCopy(compIndex, eVariationType::VARTYPE_REG); xformComp.AddVariation(varComp); ParametricVariation* parVar = dynamic_cast*>(var); ParametricVariation* parVarComp = dynamic_cast*>(varComp); @@ -1430,7 +1430,7 @@ void TestVarsSimilar() } //For debugging. - if (var->VariationId() == VAR_BWRAPS && varComp->VariationId() == VAR_ECLIPSE) + if (var->VariationId() == eVariationId::VAR_BWRAPS && varComp->VariationId() == eVariationId::VAR_ECLIPSE) { //cout << "Break." << endl; } @@ -1515,7 +1515,7 @@ template void TestCpuGpuResults(size_t platform, size_t device) { bool breakOnBad = true; - int i = 0;//(int)VAR_TARGET;//Start at the one you want to test. + int i = 0;//(int)eVariationId::VAR_TARGET;//Start at the one you want to test. int iters = 10; int skipped = 0; T thresh = T(1e-3); @@ -1531,7 +1531,7 @@ void TestCpuGpuResults(size_t platform, size_t device) { bool bad = false; double sum = 0; - Variation* var = vlf.GetVariation(i, VARTYPE_REG); + Variation* var = vlf.GetVariation(i, eVariationType::VARTYPE_REG); string s = var->OpenCLString() + var->OpenCLFuncsString(); if (s.find("MwcNext") != string::npos) @@ -1622,7 +1622,7 @@ void TestGpuVectorRead(size_t platform, size_t device) vector> devices{ std::make_pair(platform, device) }; RendererCL renderer(devices); points.resize(renderer.TotalIterKernelCount()); - Variation* var = vlf.GetVariation(VAR_LINEAR); + Variation* var = vlf.GetVariation(eVariationId::VAR_LINEAR); bool newAlloc = false; Point p, p2; Ember ember; diff --git a/Source/Fractorium/CurvesGraphicsView.h b/Source/Fractorium/CurvesGraphicsView.h index 4c430f5..c1897e6 100644 --- a/Source/Fractorium/CurvesGraphicsView.h +++ b/Source/Fractorium/CurvesGraphicsView.h @@ -10,7 +10,7 @@ class EllipseItem; /// /// Enumeration used for setting values on a specific curve. /// -enum CurveIndex +enum class CurveIndex : et { ALL, RED, @@ -82,14 +82,13 @@ public: /// The point index within the curve /// The graphics view this point is displayed on /// The parent widget of this item - EllipseItem(const QRectF &rect, int curveIndex, int pointIndex, CurvesGraphicsView* viewParent, QGraphicsItem *parent = 0) + EllipseItem(const QRectF& rect, int curveIndex, int pointIndex, CurvesGraphicsView* viewParent, QGraphicsItem* parent = 0) : QGraphicsEllipseItem(rect, parent) { setFlag(QGraphicsItem::ItemSendsScenePositionChanges); setFlag(QGraphicsItem::ItemIsSelectable); setFlag(QGraphicsItem::ItemIsMovable); setPen(Qt::NoPen); - m_CurveIndex = curveIndex; m_PointIndex = pointIndex; m_ViewParent = viewParent; @@ -108,7 +107,7 @@ protected: /// Unused and just passed to QGraphicsEllipseItem::paint() /// Drawing options used which will have the QStyle::State_Selected flag unset /// Unused and just passed to QGraphicsEllipseItem::paint() - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override + virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override { QStyleOptionGraphicsItem myOption(*option); myOption.state &= ~QStyle::State_Selected; @@ -122,7 +121,7 @@ protected: /// Action is only taken if this value equals ItemPositionChange /// The new position. This will be clamped to the scene rect. /// The new position - virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override + virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value) override { if (change == ItemPositionChange && scene()) { @@ -136,7 +135,7 @@ protected: newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left()))); newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top()))); } - + m_ViewParent->PointChanged(m_CurveIndex, m_PointIndex, newPos); return newPos; } diff --git a/Source/Fractorium/FinalRenderEmberController.cpp b/Source/Fractorium/FinalRenderEmberController.cpp index e2e7f8b..44162a9 100644 --- a/Source/Fractorium/FinalRenderEmberController.cpp +++ b/Source/Fractorium/FinalRenderEmberController.cpp @@ -82,7 +82,7 @@ bool FinalRenderEmberControllerBase::CreateRendererFromGUI() { bool useOpenCL = m_Info->Ok() && m_FinalRenderDialog->OpenCL(); auto v = Devices(m_FinalRenderDialog->Devices()); - return CreateRenderer((useOpenCL && !v.empty()) ? OPENCL_RENDERER : CPU_RENDERER, + return CreateRenderer((useOpenCL && !v.empty()) ? eRendererType::OPENCL_RENDERER : eRendererType::CPU_RENDERER, v, false);//Not shared. } @@ -583,7 +583,7 @@ bool FinalRenderEmberController::SyncGuiToRenderer() if (m_Renderer.get()) { - if (m_Renderer->RendererType() == OPENCL_RENDERER) + if (m_Renderer->RendererType() == eRendererType::OPENCL_RENDERER) channels = 4;//Always using 4 since the GL texture is RGBA. m_Renderer->Callback(this); @@ -598,7 +598,7 @@ bool FinalRenderEmberController::SyncGuiToRenderer() { for (size_t i = 0; i < m_Renderers.size(); i++) { - if (m_Renderers[i]->RendererType() == OPENCL_RENDERER) + if (m_Renderers[i]->RendererType() == eRendererType::OPENCL_RENDERER) channels = 4;//Always using 4 since the GL texture is RGBA. m_Renderers[i]->Callback(!i ? this : nullptr); diff --git a/Source/Fractorium/FractoriumEmberController.cpp b/Source/Fractorium/FractoriumEmberController.cpp index 68cf0ad..5c5290a 100644 --- a/Source/Fractorium/FractoriumEmberController.cpp +++ b/Source/Fractorium/FractoriumEmberController.cpp @@ -15,7 +15,7 @@ FractoriumEmberControllerBase::FractoriumEmberControllerBase(Fractorium* fractor m_Shared = true; m_FailedRenders = 0; m_UndoIndex = 0; - m_RenderType = CPU_RENDERER; + m_RenderType = eRendererType::CPU_RENDERER; m_OutputTexID = 0; m_SubBatchCount = 1;//Will be ovewritten by the options on first render. m_Fractorium = fractorium; @@ -226,7 +226,7 @@ void FractoriumEmberController::Update(std::function func, bool /// If no xforms are selected via the checkboxes, and the update type is UPDATE_SELECTED, then the function will be called only on the currently selected xform. ///
/// The function to call -/// Whether to apply this update operation on the current, all or selected xforms. Default: UPDATE_CURRENT. +/// Whether to apply this update operation on the current, all or selected xforms. Default: eXformUpdate::UPDATE_CURRENT. /// True to update renderer, else false. Default: true. /// The action to add to the rendering queue. Default: eProcessAction::FULL_RENDER. template diff --git a/Source/Fractorium/FractoriumEmberController.h b/Source/Fractorium/FractoriumEmberController.h index d46ebf2..eef6487 100644 --- a/Source/Fractorium/FractoriumEmberController.h +++ b/Source/Fractorium/FractoriumEmberController.h @@ -11,12 +11,12 @@ /// /// An enum representing the type of edit being done. /// -enum eEditUndoState : uint { REGULAR_EDIT, UNDO_REDO, EDIT_UNDO }; +enum class eEditUndoState : et { REGULAR_EDIT, UNDO_REDO, EDIT_UNDO }; /// /// An enum representing which xforms an update should be applied to. /// -enum eXformUpdate : uint { UPDATE_CURRENT, UPDATE_SELECTED, UPDATE_SELECTED_EXCEPT_FINAL, UPDATE_ALL, UPDATE_ALL_EXCEPT_FINAL }; +enum class eXformUpdate : et { UPDATE_CURRENT, UPDATE_SELECTED, UPDATE_SELECTED_EXCEPT_FINAL, UPDATE_ALL, UPDATE_ALL_EXCEPT_FINAL }; /// /// FractoriumEmberController and Fractorium need each other, but each can't include the other. diff --git a/Source/Fractorium/FractoriumMenus.cpp b/Source/Fractorium/FractoriumMenus.cpp index bf99e46..3a72374 100644 --- a/Source/Fractorium/FractoriumMenus.cpp +++ b/Source/Fractorium/FractoriumMenus.cpp @@ -17,7 +17,6 @@ void Fractorium::InitMenusUI() connect(ui.ActionSaveCurrentToOpenedFile, SIGNAL(triggered(bool)), this, SLOT(OnActionSaveCurrentToOpenedFile(bool)), Qt::QueuedConnection); connect(ui.ActionSaveCurrentScreen, SIGNAL(triggered(bool)), this, SLOT(OnActionSaveCurrentScreen(bool)), Qt::QueuedConnection); connect(ui.ActionExit, SIGNAL(triggered(bool)), this, SLOT(OnActionExit(bool)), Qt::QueuedConnection); - //Edit menu. connect(ui.ActionUndo, SIGNAL(triggered(bool)), this, SLOT(OnActionUndo(bool)), Qt::QueuedConnection); connect(ui.ActionRedo, SIGNAL(triggered(bool)), this, SLOT(OnActionRedo(bool)), Qt::QueuedConnection); @@ -28,10 +27,8 @@ void Fractorium::InitMenusUI() connect(ui.ActionCopySelectedXforms, SIGNAL(triggered(bool)), this, SLOT(OnActionCopySelectedXforms(bool)), Qt::QueuedConnection); connect(ui.ActionPasteSelectedXforms, SIGNAL(triggered(bool)), this, SLOT(OnActionPasteSelectedXforms(bool)), Qt::QueuedConnection); ui.ActionPasteSelectedXforms->setEnabled(false); - //View menu. connect(ui.ActionResetWorkspace, SIGNAL(triggered(bool)), this, SLOT(OnActionResetWorkspace(bool)), Qt::QueuedConnection); - //Tools menu. connect(ui.ActionAddReflectiveSymmetry, SIGNAL(triggered(bool)), this, SLOT(OnActionAddReflectiveSymmetry(bool)), Qt::QueuedConnection); connect(ui.ActionAddRotationalSymmetry, SIGNAL(triggered(bool)), this, SLOT(OnActionAddRotationalSymmetry(bool)), Qt::QueuedConnection); @@ -44,7 +41,6 @@ void Fractorium::InitMenusUI() connect(ui.ActionFinalRender, SIGNAL(triggered(bool)), this, SLOT(OnActionFinalRender(bool)), Qt::QueuedConnection); connect(m_FinalRenderDialog, SIGNAL(finished(int)), this, SLOT(OnFinalRenderClose(int)), Qt::QueuedConnection); connect(ui.ActionOptions, SIGNAL(triggered(bool)), this, SLOT(OnActionOptions(bool)), Qt::QueuedConnection); - //Help menu. connect(ui.ActionAbout, SIGNAL(triggered(bool)), this, SLOT(OnActionAbout(bool)), Qt::QueuedConnection); } @@ -57,7 +53,6 @@ template void FractoriumEmberController::NewFlock(size_t count) { Ember ember; - StopPreviewRender(); m_EmberFile.Clear(); m_EmberFile.m_Embers.reserve(count); @@ -98,7 +93,6 @@ void FractoriumEmberController::NewEmptyFlameInCurrentFile() Ember ember; Xform xform; QDateTime local(QDateTime::currentDateTime()); - StopPreviewRender(); ParamsToEmber(ember); xform.m_Weight = T(0.25); @@ -124,7 +118,6 @@ template void FractoriumEmberController::NewRandomFlameInCurrentFile() { Ember ember; - StopPreviewRender(); m_SheepTools->Random(ember, m_FilteredVariations, static_cast(QTIsaac::GlobalRand->Frand(-2, 2)), 0, MAX_CL_VARS); ParamsToEmber(ember); @@ -147,7 +140,6 @@ template void FractoriumEmberController::CopyFlameInCurrentFile() { Ember ember = m_Ember; - StopPreviewRender(); ember.m_Name = EmberFile::DefaultEmberName(m_EmberFile.Size() + 1).toStdString(); ember.m_Index = m_EmberFile.Size(); @@ -181,11 +173,10 @@ void FractoriumEmberController::OpenAndPrepFiles(const QStringList& filenames XmlToEmber parser; vector> embers; uint previousSize = append ? m_EmberFile.Size() : 0; - StopPreviewRender(); emberFile.m_Filename = filenames[0]; - foreach(const QString& filename, filenames) + foreach (const QString& filename, filenames) { embers.clear(); @@ -209,12 +200,11 @@ void FractoriumEmberController::OpenAndPrepFiles(const QStringList& filenames else { vector errors = parser.ErrorReport(); - m_Fractorium->ErrorReportToQTextEdit(errors, m_Fractorium->ui.InfoFileOpeningTextEdit); m_Fractorium->ShowCritical("Open Failed", "Could not open file, see info tab for details."); } } - + if (append) { if (m_EmberFile.m_Filename == "") @@ -273,14 +263,13 @@ void FractoriumEmberController::SaveCurrentAsXml() else filename = m_Fractorium->SetupSaveXmlDialog(QString::fromStdString(m_Ember.m_Name));//More than one ember present, use individual ember name. } - + if (filename != "") { Ember ember = m_Ember; EmberToXml writer; QFileInfo fileInfo(filename); xmlDocPtr tempEdit = ember.m_Edits; - SaveCurrentToOpenedFile();//Save the current ember back to the opened file before writing to disk. ApplyXmlSavingTemplate(ember); ember.m_Edits = writer.CreateNewEditdoc(&ember, nullptr, "edit", s->Nick().toStdString(), s->Url().toStdString(), s->Id().toStdString(), "", 0, 0); @@ -319,13 +308,12 @@ void FractoriumEmberController::SaveEntireFileAsXml() filename = m_LastSaveAll; else filename = m_Fractorium->SetupSaveXmlDialog(m_EmberFile.m_Filename); - + if (filename != "") { EmberFile emberFile; EmberToXml writer; QFileInfo fileInfo(filename); - SaveCurrentToOpenedFile();//Save the current ember back to the opened file before writing to disk. emberFile = m_EmberFile; @@ -384,7 +372,7 @@ void FractoriumEmberController::SaveCurrentToOpenedFile() for (i = 0; i < m_EmberFile.Size(); i++) { if ((m_Ember.m_Name == m_EmberFile.m_Embers[i].m_Name) &&//Check both to be extra sure. - (m_Ember.m_Index == m_EmberFile.m_Embers[i].m_Index)) + (m_Ember.m_Index == m_EmberFile.m_Embers[i].m_Index)) { m_EmberFile.m_Embers[i] = m_Ember; fileFound = true; @@ -426,12 +414,11 @@ void FractoriumEmberController::Undo() if (m_UndoList.size() > 1 && m_UndoIndex > 0) { int index = m_Ember.GetTotalXformIndex(CurrentXform()); - m_LastEditWasUndoRedo = true; m_UndoIndex = std::max(0u, m_UndoIndex - 1u); SetEmber(m_UndoList[m_UndoIndex], true); - m_EditState = UNDO_REDO; - + m_EditState = eEditUndoState::UNDO_REDO; + if (index >= 0) m_Fractorium->CurrentXform(index); @@ -451,12 +438,11 @@ void FractoriumEmberController::Redo() if (m_UndoList.size() > 1 && m_UndoIndex < m_UndoList.size() - 1) { int index = m_Ember.GetTotalXformIndex(CurrentXform()); - m_LastEditWasUndoRedo = true; m_UndoIndex = std::min(m_UndoIndex + 1, m_UndoList.size() - 1); SetEmber(m_UndoList[m_UndoIndex], true); - m_EditState = UNDO_REDO; - + m_EditState = eEditUndoState::UNDO_REDO; + if (index >= 0) m_Fractorium->CurrentXform(index); @@ -477,7 +463,6 @@ void FractoriumEmberController::CopyXml() Ember ember = m_Ember; EmberToXml emberToXml; FractoriumSettings* settings = m_Fractorium->m_Settings; - ember.m_Quality = settings->XmlQuality(); ember.m_Supersample = settings->XmlSupersample(); ember.m_TemporalSamples = settings->XmlTemporalSamples(); @@ -496,13 +481,11 @@ void FractoriumEmberController::CopyAllXml() ostringstream os; EmberToXml emberToXml; FractoriumSettings* settings = m_Fractorium->m_Settings; - os << "\n"; for (auto& e : m_EmberFile.m_Embers) { Ember ember = e; - ApplyXmlSavingTemplate(ember); os << emberToXml.ToString(ember, "", 0, false, false, true); } @@ -529,7 +512,6 @@ void FractoriumEmberController::PasteXmlAppend() vector> embers; QTextCodec* codec = QTextCodec::codecForName("UTF-8"); QByteArray b = codec->fromUnicode(QApplication::clipboard()->text()); - s.reserve(b.size()); for (i = 0; i < b.size(); i++) @@ -554,7 +536,7 @@ void FractoriumEmberController::PasteXmlAppend() { embers[i].m_Index = m_EmberFile.Size(); ConstrainDimensions(embers[i]);//Do not exceed the max texture size. - + //Also ensure it has a name. if (embers[i].m_Name == "" || embers[i].m_Name == "No name") embers[i].m_Name = ToString(embers[i].m_Index).toStdString(); @@ -584,9 +566,8 @@ void FractoriumEmberController::PasteXmlOver() Ember backupEmber = m_EmberFile.m_Embers[0]; QTextCodec* codec = QTextCodec::codecForName("UTF-8"); QByteArray b = codec->fromUnicode(QApplication::clipboard()->text()); - s.reserve(b.size()); - + for (i = 0; i < b.size(); i++) { if (uint(b[i]) < 128u) @@ -610,7 +591,7 @@ void FractoriumEmberController::PasteXmlOver() { m_EmberFile.m_Embers[i].m_Index = i; ConstrainDimensions(m_EmberFile.m_Embers[i]);//Do not exceed the max texture size. - + //Also ensure it has a name. if (m_EmberFile.m_Embers[i].m_Name == "" || m_EmberFile.m_Embers[i].m_Name == "No name") m_EmberFile.m_Embers[i].m_Name = ToString(m_EmberFile.m_Embers[i].m_Index).toStdString(); @@ -639,14 +620,13 @@ void FractoriumEmberController::CopySelectedXforms() { m_CopiedXforms.clear(); m_CopiedFinalXform.Clear(); - UpdateXform([&](Xform* xform) { if (m_Ember.IsFinalXform(xform)) m_CopiedFinalXform = *xform; else m_CopiedXforms.push_back(*xform); - }, UPDATE_SELECTED, false); + }, eXformUpdate::UPDATE_SELECTED, false); m_Fractorium->ui.ActionPasteSelectedXforms->setEnabled(true); } @@ -715,7 +695,6 @@ template void FractoriumEmberController::AddReflectiveSymmetry() { QComboBox* combo = m_Fractorium->ui.CurrentXformCombo; - Update([&]() { m_Ember.AddSymmetry(-1, m_Rand); @@ -734,7 +713,6 @@ template void FractoriumEmberController::AddRotationalSymmetry() { QComboBox* combo = m_Fractorium->ui.CurrentXformCombo; - Update([&]() { m_Ember.AddSymmetry(2, m_Rand); @@ -753,7 +731,6 @@ template void FractoriumEmberController::AddBothSymmetry() { QComboBox* combo = m_Fractorium->ui.CurrentXformCombo; - Update([&]() { m_Ember.AddSymmetry(-2, m_Rand); @@ -771,7 +748,7 @@ void Fractorium::OnActionAddBothSymmetry(bool checked) { m_Controller->AddBothSy template void FractoriumEmberController::Flatten() { UpdateXform([&] (Xform* xform) { m_Ember.Flatten(XmlToEmber::m_FlattenNames); FillVariationTreeWithXform(xform); }); } void Fractorium::OnActionFlatten(bool checked) { m_Controller->Flatten(); } - + /// /// Removes pre/reg/post FlattenVariation from every xform in the current ember. /// Resets the rendering process. @@ -875,5 +852,5 @@ void Fractorium::OnActionAbout(bool checked) template class FractoriumEmberController; #ifdef DO_DOUBLE - template class FractoriumEmberController; +template class FractoriumEmberController; #endif diff --git a/Source/Fractorium/FractoriumRender.cpp b/Source/Fractorium/FractoriumRender.cpp index 00c3f26..52e2dd8 100644 --- a/Source/Fractorium/FractoriumRender.cpp +++ b/Source/Fractorium/FractoriumRender.cpp @@ -246,7 +246,7 @@ void FractoriumEmberController::ClearUndo() { m_UndoIndex = 0; m_UndoList.clear(); - m_EditState = REGULAR_EDIT; + m_EditState = eEditUndoState::REGULAR_EDIT; m_LastEditWasUndoRedo = false; m_Fractorium->ui.ActionUndo->setEnabled(false); m_Fractorium->ui.ActionRedo->setEnabled(false); @@ -276,7 +276,7 @@ bool FractoriumEmberController::SyncSizes() gl->Allocate(); gl->SetViewport(); - if (m_Renderer->RendererType() == OPENCL_RENDERER && (rendererCL = dynamic_cast*>(m_Renderer.get()))) + if (m_Renderer->RendererType() == eRendererType::OPENCL_RENDERER && (rendererCL = dynamic_cast*>(m_Renderer.get()))) rendererCL->SetOutputTexture(gl->OutputTexID()); m_Fractorium->CenterScrollbars(); @@ -325,7 +325,7 @@ bool FractoriumEmberController::Render() action = CondenseAndClearProcessActions();//Combine with all other previously requested actions. - if (m_Renderer->RendererType() == OPENCL_RENDERER) + if (m_Renderer->RendererType() == eRendererType::OPENCL_RENDERER) rendererCL = dynamic_cast*>(m_Renderer.get()); //Force temporal samples to always be 1. Perhaps change later when animation is implemented. @@ -370,9 +370,9 @@ bool FractoriumEmberController::Render() if (iterBegin) { - if (m_Renderer->RendererType() == CPU_RENDERER) + if (m_Renderer->RendererType() == eRendererType::CPU_RENDERER) m_SubBatchCount = m_Fractorium->m_Settings->CpuSubBatch(); - else if (m_Renderer->RendererType() == OPENCL_RENDERER) + else if (m_Renderer->RendererType() == eRendererType::OPENCL_RENDERER) m_SubBatchCount = m_Fractorium->m_Settings->OpenCLSubBatch(); m_Fractorium->m_ProgressBar->setValue(0); @@ -387,7 +387,7 @@ bool FractoriumEmberController::Render() { //The amount to increment sub batch while rendering proceeds is purely empirical. //Change later if better values can be derived/observed. - if (m_Renderer->RendererType() == OPENCL_RENDERER) + if (m_Renderer->RendererType() == eRendererType::OPENCL_RENDERER) { if (m_SubBatchCount < (4 * m_Devices.size()))//More than 3 with OpenCL gives a sluggish UI. m_SubBatchCount += m_Devices.size(); @@ -410,7 +410,7 @@ bool FractoriumEmberController::Render() m_Fractorium->m_ProgressBar->setValue(100); //Only certain stats can be reported with OpenCL. - if (m_Renderer->RendererType() == OPENCL_RENDERER) + if (m_Renderer->RendererType() == eRendererType::OPENCL_RENDERER) { m_Fractorium->m_RenderStatusLabel->setText("Iters: " + iters + ". Scaled quality: " + scaledQuality + ". Total time: " + QString::fromStdString(renderTime) + "."); } @@ -424,9 +424,9 @@ bool FractoriumEmberController::Render() if (m_LastEditWasUndoRedo && (m_UndoIndex == m_UndoList.size() - 1))//Traversing through undo list, reached the end, so put back in regular edit mode. { - m_EditState = REGULAR_EDIT; + m_EditState = eEditUndoState::REGULAR_EDIT; } - else if (m_EditState == REGULAR_EDIT)//Regular edit, just add to the end of the undo list. + else if (m_EditState == eEditUndoState::REGULAR_EDIT)//Regular edit, just add to the end of the undo list. { m_UndoList.push_back(m_Ember); m_UndoIndex = m_UndoList.size() - 1; @@ -551,7 +551,7 @@ bool FractoriumEmberController::CreateRenderer(eRendererType renderType, cons { m_RenderType = m_Renderer->RendererType(); - if (m_RenderType == OPENCL_RENDERER) + if (m_RenderType == eRendererType::OPENCL_RENDERER) { auto val = 30 * m_Fractorium->m_Settings->Devices().size(); m_Fractorium->m_QualitySpin->DoubleClickZero(val); @@ -628,7 +628,7 @@ bool Fractorium::CreateRendererFromOptions() auto v = Devices(m_Settings->Devices()); //The most important option to process is what kind of renderer is desired, so do it first. - if (!m_Controller->CreateRenderer((useOpenCL && !v.empty()) ? OPENCL_RENDERER : CPU_RENDERER, v)) + if (!m_Controller->CreateRenderer((useOpenCL && !v.empty()) ? eRendererType::OPENCL_RENDERER : eRendererType::CPU_RENDERER, v)) { //If using OpenCL, will only get here if creating RendererCL failed, but creating a backup CPU Renderer succeeded. ShowCritical("Renderer Creation Error", "Error creating renderer, most likely a GPU problem. Using CPU instead."); diff --git a/Source/Fractorium/FractoriumXformsVariations.cpp b/Source/Fractorium/FractoriumXformsVariations.cpp index 9079a01..b759417 100644 --- a/Source/Fractorium/FractoriumXformsVariations.cpp +++ b/Source/Fractorium/FractoriumXformsVariations.cpp @@ -7,14 +7,12 @@ void Fractorium::InitXformsVariationsUI() { auto tree = ui.VariationsTree; - tree->clear(); tree->header()->setSectionsClickable(true); connect(tree->header(), SIGNAL(sectionClicked(int)), this, SLOT(OnTreeHeaderSectionClicked(int))); connect(ui.VariationsFilterLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(OnVariationsFilterLineEditTextChanged(const QString&))); connect(ui.VariationsFilterClearButton, SIGNAL(clicked(bool)), this, SLOT(OnVariationsFilterClearButtonClicked(bool))); connect(ui.ActionVariationsDialog, SIGNAL(triggered(bool)), this, SLOT(OnActionVariationsDialog(bool)), Qt::QueuedConnection); - //Setting dimensions in the designer with a layout is futile, so must hard code here. tree->setColumnWidth(0, 160); tree->setColumnWidth(1, 23); @@ -47,7 +45,6 @@ void FractoriumEmberController::Filter(const QString& text) auto& ids = m_Fractorium->m_VarDialog->Map(); auto tree = m_Fractorium->ui.VariationsTree; auto xform = CurrentXform(); - tree->setUpdatesEnabled(false); for (int i = 0; i < tree->topLevelItemCount(); i++) @@ -55,7 +52,7 @@ void FractoriumEmberController::Filter(const QString& text) if (auto item = dynamic_cast(tree->topLevelItem(i))) { auto varName = item->text(0); - + if (xform && xform->GetVariationById(item->Id()))//If it's present then show it no matter what the filter is. { item->setHidden(false); @@ -84,7 +81,6 @@ template void FractoriumEmberController::FilteredVariations() { auto& map = m_Fractorium->m_VarDialog->Map(); - m_FilteredVariations.clear(); m_FilteredVariations.reserve(map.size()); @@ -108,7 +104,6 @@ void FractoriumEmberController::SetupVariationTree() QSize hint0(75, 16); QSize hint1(30, 16); auto tree = m_Fractorium->ui.VariationsTree; - tree->clear(); tree->blockSignals(true); @@ -116,11 +111,9 @@ void FractoriumEmberController::SetupVariationTree() { auto var = m_VariationList.GetVariation(i); auto parVar = dynamic_cast*>(var); - //First add the variation, with a spinner for its weight. auto item = new VariationTreeWidgetItem(var->VariationId(), tree); auto spinBox = new VariationTreeDoubleSpinBox(tree, item, var->VariationId(), ""); - item->setText(0, QString::fromStdString(var->Name())); item->setSizeHint(0, hint0); item->setSizeHint(1, hint1); @@ -144,7 +137,6 @@ void FractoriumEmberController::SetupVariationTree() { auto paramWidget = new VariationTreeWidgetItem(var->VariationId(), item); auto varSpinBox = new VariationTreeDoubleSpinBox(tree, paramWidget, parVar->VariationId(), params[j].Name()); - paramWidget->setText(0, params[j].Name().c_str()); paramWidget->setSizeHint(0, hint0); paramWidget->setSizeHint(1, hint1); @@ -154,7 +146,7 @@ void FractoriumEmberController::SetupVariationTree() varSpinBox->DoubleClickZero(1); varSpinBox->DoubleClickNonZero(0); - if (params[j].Type() == INTEGER || params[j].Type() == INTEGER_NONZERO) + if (params[j].Type() == eParamType::INTEGER || params[j].Type() == eParamType::INTEGER_NONZERO) { varSpinBox->setSingleStep(1); varSpinBox->Step(1); @@ -185,7 +177,6 @@ void FractoriumEmberController::ClearVariationsTree() { QTreeWidgetItem* item = tree->topLevelItem(i); auto* spinBox = dynamic_cast(tree->itemWidget(item, 1)); - spinBox->SetValueStealth(0); for (int j = 0; j < item->childCount(); j++)//Iterate through all of the children, which will be the params. @@ -252,7 +243,6 @@ void FractoriumEmberController::VariationSpinBoxValueChanged(double d)//Would //If the item wasn't a param and the xform did not contain this variation, //it means they went from zero to a non-zero weight, so add a new copy of this xform. auto newVar = var->Copy();//Create a new one with default values. - newVar->m_Weight = d; xform->AddVariation(newVar); widgetItem->setBackgroundColor(0, QColor(200, 200, 200));//Set background to gray when a variation has non-zero weight in this xform. @@ -262,7 +252,7 @@ void FractoriumEmberController::VariationSpinBoxValueChanged(double d)//Would if (parVar) { auto newParVar = dynamic_cast*>(newVar); - + for (int i = 0; i < widgetItem->childCount(); i++)//Iterate through all of the children, which will be the params. { auto childItem = widgetItem->child(i);//Get the child. @@ -271,7 +261,6 @@ void FractoriumEmberController::VariationSpinBoxValueChanged(double d)//Would if (auto spinBox = dynamic_cast(itemWidget))//Cast the widget to the VariationTreeDoubleSpinBox type. { string s = childItem->text(0).toStdString();//Use the name of the child, and the value of the spinner widget to assign the param. - newParVar->SetParamVal(s.c_str(), spinBox->value()); } } @@ -295,7 +284,6 @@ template void FractoriumEmberController::FillVariationTreeWithXform(Xform* xform) { auto tree = m_Fractorium->ui.VariationsTree; - tree->blockSignals(true); m_Fractorium->Filter(); @@ -385,5 +373,5 @@ void Fractorium::OnVariationsFilterClearButtonClicked(bool checked) template class FractoriumEmberController; #ifdef DO_DOUBLE - template class FractoriumEmberController; +template class FractoriumEmberController; #endif diff --git a/Source/Fractorium/GLEmberController.cpp b/Source/Fractorium/GLEmberController.cpp index d7ac26f..0c81d17 100644 --- a/Source/Fractorium/GLEmberController.cpp +++ b/Source/Fractorium/GLEmberController.cpp @@ -13,9 +13,9 @@ GLEmberControllerBase::GLEmberControllerBase(Fractorium* fractorium, GLWidget* g { m_Fractorium = fractorium; m_GL = glWidget; - m_AffineType = AffinePre; - m_HoverType = HoverNone; - m_DragState = DragNone; + m_AffineType = eAffineType::AffinePre; + m_HoverType = eHoverType::HoverNone; + m_DragState = eDragState::DragNone; m_DragModifier = 0; } @@ -37,7 +37,6 @@ GLEmberController::GLEmberController(Fractorium* fractorium, GLWidget* glWidg { GridStep = T(1.0 / 8.0); m_FractoriumEmberController = controller; - m_HoverXform = nullptr; m_SelectedXform = nullptr; m_CenterDownX = 0; @@ -68,7 +67,7 @@ bool GLEmberController::CheckForSizeMismatch(int w, int h) template void GLEmberController::ResetMouseState() { - m_HoverType = HoverNone; + m_HoverType = eHoverType::HoverNone; m_HoverXform = nullptr; m_SelectedXform = nullptr; } @@ -86,10 +85,8 @@ T GLEmberController::CalcScale() v2T windowCenter(T(m_GL->width()) / T(2), T(m_GL->height()) / T(2)); v2T windowMousePosDistanceFromCenter(m_MousePos.x - windowCenter.x, m_MousePos.y - windowCenter.y); v2T windowMouseDownDistanceFromCenter(m_MouseDownPos.x - windowCenter.x, m_MouseDownPos.y - windowCenter.y); - T lengthMousePosFromCenterInPixels = glm::length(windowMousePosDistanceFromCenter); T lengthMouseDownFromCenterInPixels = glm::length(windowMouseDownDistanceFromCenter); - return lengthMousePosFromCenterInPixels - lengthMouseDownFromCenterInPixels; } @@ -103,7 +100,6 @@ T GLEmberController::CalcRotation() { T rotStart = NormalizeDeg180(T(90) - (atan2(-m_MouseDownWorldPos.y, m_MouseDownWorldPos.x) * RAD_2_DEG_T)); T rot = NormalizeDeg180(T(90) - (atan2(-m_MouseWorldPos.y, m_MouseWorldPos.x) * RAD_2_DEG_T)); - return rotStart - rot; } @@ -116,10 +112,8 @@ template typename v3T GLEmberController::SnapToGrid(v3T& vec) { v3T ret; - ret.x = glm::round(vec.x / GridStep) * GridStep; ret.y = glm::round(vec.y / GridStep) * GridStep; - return ret; } @@ -135,7 +129,6 @@ typename v3T GLEmberController::SnapToNormalizedAngle(v3T& vec, uint division T rsq, theta; T bestRsq = numeric_limits::max(); v3T c, best; - best.x = 1; best.y = 0; @@ -167,7 +160,6 @@ typename v3T GLEmberController::WindowToWorld(v3T& v, bool flip) { v3T mouse(v.x, flip ? m_Viewport[3] - v.y : v.y, 0);//Must flip y because in OpenGL, 0,0 is bottom left, but in windows, it's top left. v3T newCoords = glm::unProject(mouse, m_Modelview, m_Projection, m_Viewport);//Perform the calculation. - newCoords.z = 0;//For some reason, unProject() always comes back with the z coordinate as something other than 0. It should be 0 at all times. return newCoords; } @@ -234,7 +226,6 @@ void GLEmberController::QueryMatrices(bool print) { double unitX = fabs(renderer->UpperRightX(false) - renderer->LowerLeftX(false)) / 2.0; double unitY = fabs(renderer->UpperRightY(false) - renderer->LowerLeftY(false)) / 2.0; - m_GL->glMatrixMode(GL_PROJECTION); m_GL->glPushMatrix(); m_GL->glLoadIdentity(); @@ -242,9 +233,7 @@ void GLEmberController::QueryMatrices(bool print) m_GL->glMatrixMode(GL_MODELVIEW); m_GL->glPushMatrix(); m_GL->glLoadIdentity(); - QueryVMP(); - m_GL->glMatrixMode(GL_PROJECTION); m_GL->glPopMatrix(); m_GL->glMatrixMode(GL_MODELVIEW); diff --git a/Source/Fractorium/GLEmberController.h b/Source/Fractorium/GLEmberController.h index b499bbe..350a48b 100644 --- a/Source/Fractorium/GLEmberController.h +++ b/Source/Fractorium/GLEmberController.h @@ -9,22 +9,22 @@ /// /// Use/draw pre or post affine transform. /// -enum eAffineType { AffinePre, AffinePost }; +enum class eAffineType : et { AffinePre, AffinePost }; /// /// Hovering over nothing, the x axis, the y axis or the center. /// -enum eHoverType { HoverNone, HoverXAxis, HoverYAxis, HoverTranslation }; +enum class eHoverType : et { HoverNone, HoverXAxis, HoverYAxis, HoverTranslation }; /// /// Dragging an affine transform or panning, rotating or scaling the image. /// -enum eDragState { DragNone, DragPanning, DragDragging, DragRotateScale }; +enum class eDragState : et { DragNone, DragPanning, DragDragging, DragRotateScale }; /// /// Dragging with no keys pressed, shift, control or alt. /// -enum eDragModifier { DragModNone = 0x00, DragModShift = 0x01, DragModControl = 0x02, DragModAlt = 0x04 }; +enum class eDragModifier : et { DragModNone = 0x00, DragModShift = 0x01, DragModControl = 0x02, DragModAlt = 0x04 }; /// /// GLController, FractoriumEmberController, GLWidget and Fractorium need each other, but each can't all include the other. @@ -50,7 +50,15 @@ public: void ClearDrag(); bool Allocate(bool force = false); - + bool GetAlt(); + bool GetShift(); + bool GetControl(); + void SetAlt(); + void SetShift(); + void SetControl(); + void ClearAlt(); + void ClearShift(); + void ClearControl(); virtual void DrawImage() { } virtual void DrawAffines(bool pre, bool post) { } virtual void ClearWindow() { } @@ -129,7 +137,7 @@ private: v3T m_DragHandlePos; v3T m_DragHandleOffset; v3T m_HoverHandlePos; - + m4T m_Modelview; m4T m_Projection; diff --git a/Source/Fractorium/GLWidget.cpp b/Source/Fractorium/GLWidget.cpp index 0d0051e..ed384b8 100644 --- a/Source/Fractorium/GLWidget.cpp +++ b/Source/Fractorium/GLWidget.cpp @@ -13,18 +13,15 @@ GLWidget::GLWidget(QWidget* p) : QOpenGLWidget(p) { QSurfaceFormat qsf; - m_Init = false; m_Drawing = false; m_TexWidth = 0; m_TexHeight = 0; m_OutputTexID = 0; m_Fractorium = nullptr; - qsf.setSwapInterval(1);//Vsync. qsf.setSwapBehavior(QSurfaceFormat::DoubleBuffer); qsf.setVersion(2, 0); - setFormat(qsf); } @@ -45,11 +42,9 @@ void GLWidget::InitGL() { int w = m_Fractorium->ui.GLParentScrollArea->width(); int h = m_Fractorium->ui.GLParentScrollArea->height(); - SetDimensions(w, h); m_Fractorium->m_WidthSpin->setValue(w); m_Fractorium->m_HeightSpin->setValue(h); - //Start with a flock of 10 random embers. Can't do this until now because the window wasn't maximized yet, so the sizes would have been off. m_Fractorium->OnActionNewFlock(false); m_Fractorium->m_Controller->DelayedStartRenderTimer(); @@ -77,7 +72,7 @@ void GLWidget::DrawQuad() if (m_OutputTexID != 0 && finalImage && !finalImage->empty()) { glBindTexture(GL_TEXTURE_2D, m_OutputTexID);//The texture to draw to. - + //Only draw if the dimensions match exactly. if (m_TexWidth == width() && m_TexHeight == height() && ((m_TexWidth * m_TexHeight * 4) == GLint(finalImage->size()))) { @@ -90,16 +85,14 @@ void GLWidget::DrawQuad() glLoadIdentity(); //Copy data from CPU to OpenGL if using a CPU renderer. This is not needed when using OpenCL. - if (renderer->RendererType() == CPU_RENDERER) + if (renderer->RendererType() == eRendererType::CPU_RENDERER) glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_TexWidth, m_TexHeight, GL_RGBA, GL_UNSIGNED_BYTE, finalImage->data()); glBegin(GL_QUADS);//This will need to be converted to a shader at some point in the future. - glTexCoord2f(0.0, 0.0); glVertex2f(0.0, 0.0); glTexCoord2f(0.0, 1.0); glVertex2f(0.0, 1.0); glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 1.0); glTexCoord2f(1.0, 0.0); glVertex2f(1.0, 0.0); - glEnd(); glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -120,7 +113,7 @@ void GLWidget::DrawQuad() void GLEmberControllerBase::ClearDrag() { m_DragModifier = 0; - m_DragState = DragNone; + m_DragState = eDragState::DragNone; } /// @@ -128,6 +121,20 @@ void GLEmberControllerBase::ClearDrag() /// bool GLEmberControllerBase::Allocate(bool force) { return m_GL->Allocate(force); } +/// +/// Helpers to set/get/clear which keys are pressed while dragging. +/// +/// bool +bool GLEmberControllerBase::GetAlt() { return (m_DragModifier & et(eDragModifier::DragModAlt)) == et(eDragModifier::DragModAlt); } +bool GLEmberControllerBase::GetShift() { return (m_DragModifier & et(eDragModifier::DragModShift)) == et(eDragModifier::DragModShift); } +bool GLEmberControllerBase::GetControl() { return (m_DragModifier & et(eDragModifier::DragModControl)) == et(eDragModifier::DragModControl); } +void GLEmberControllerBase::SetAlt() { m_DragModifier |= et(eDragModifier::DragModAlt); } +void GLEmberControllerBase::SetShift() { m_DragModifier |= et(eDragModifier::DragModShift); } +void GLEmberControllerBase::SetControl() { m_DragModifier |= et(eDragModifier::DragModControl); } +void GLEmberControllerBase::ClearAlt() { m_DragModifier &= ~et(eDragModifier::DragModAlt); } +void GLEmberControllerBase::ClearShift() { m_DragModifier &= ~et(eDragModifier::DragModShift); } +void GLEmberControllerBase::ClearControl() { m_DragModifier &= ~et(eDragModifier::DragModControl); } + /// /// Clear the OpenGL output window to be the background color of the current ember. /// Both buffers must be cleared, else artifacts will show up. @@ -136,7 +143,6 @@ template void GLEmberController::ClearWindow() { Ember* ember = m_FractoriumEmberController->CurrentEmber(); - m_GL->makeCurrent(); m_GL->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); m_GL->glClearColor(ember->m_Background.r, ember->m_Background.g, ember->m_Background.b, 1.0); @@ -191,11 +197,9 @@ void GLWidget::initializeGL() if (!m_Init && initializeOpenGLFunctions() && m_Fractorium) { glClearColor(0.0, 0.0, 0.0, 1.0); - glEnable(GL_TEXTURE_2D); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_MaxTexSize); glDisable(GL_TEXTURE_2D); - m_Fractorium->m_WidthSpin->setMaximum(m_MaxTexSize); m_Fractorium->m_HeightSpin->setMaximum(m_MaxTexSize); } @@ -213,22 +217,18 @@ void GLWidget::paintGL() if (controller && controller->Renderer() && controller->RenderTimerRunning()) { RendererBase* renderer = controller->Renderer(); - m_Drawing = true; controller->GLController()->DrawImage(); - //Affine drawing. bool pre = m_Fractorium->ui.PreAffineGroupBox->isChecked(); bool post = m_Fractorium->ui.PostAffineGroupBox->isChecked(); float unitX = fabs(renderer->UpperRightX(false) - renderer->LowerLeftX(false)) / 2.0f; float unitY = fabs(renderer->UpperRightY(false) - renderer->LowerLeftY(false)) / 2.0f; - glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); glEnable(GL_POINT_SMOOTH); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); - glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); @@ -236,21 +236,16 @@ void GLWidget::paintGL() glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); - glDisable(GL_DEPTH_TEST); - controller->GLController()->DrawAffines(pre, post); - glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); - glDisable(GL_DEPTH_TEST); glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); glDisable(GL_POINT_SMOOTH); - m_Drawing = false; } } @@ -263,23 +258,21 @@ void GLEmberController::DrawImage() { RendererBase* renderer = m_FractoriumEmberController->Renderer(); Ember* ember = m_FractoriumEmberController->CurrentEmber(); - m_GL->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); m_GL->glClearColor(ember->m_Background.r, ember->m_Background.g, ember->m_Background.b, 1.0); m_GL->glDisable(GL_DEPTH_TEST); - renderer->EnterFinalAccum();//Lock, may not be necessary, but just in case. renderer->EnterResize(); - + if (SizesMatch())//Ensure all sizes are correct. If not, do nothing. { vector* finalImage = m_FractoriumEmberController->FinalImage(); - - if (renderer->RendererType() == OPENCL_RENDERER || finalImage)//Final image only matters for CPU renderer. - if (renderer->RendererType() == OPENCL_RENDERER || finalImage->size() == renderer->FinalBufferSize()) + + if ((renderer->RendererType() == eRendererType::OPENCL_RENDERER) || finalImage)//Final image only matters for CPU renderer. + if ((renderer->RendererType() == eRendererType::OPENCL_RENDERER) || finalImage->size() == renderer->FinalBufferSize()) m_GL->DrawQuad();//Output image is drawn here. } - + renderer->LeaveResize();//Unlock, may not be necessary. renderer->LeaveFinalAccum(); } @@ -294,10 +287,10 @@ void GLEmberController::DrawAffines(bool pre, bool post) { QueryVMP();//Resolves to float or double specialization function depending on T. Ember* ember = m_FractoriumEmberController->CurrentEmber(); - bool dragging = m_DragState == DragDragging; + bool dragging = m_DragState == eDragState::DragDragging; //Draw grid if control key is pressed. - if (m_GL->hasFocus() && ((m_DragModifier & DragModControl) == DragModControl)) + if (m_GL->hasFocus() && GetControl()) { m_GL->glLineWidth(1.0f); m_GL->DrawGrid(); @@ -307,7 +300,7 @@ void GLEmberController::DrawAffines(bool pre, bool post) if (!m_Fractorium->m_Settings->ShowAllXforms() && dragging) { if (m_SelectedXform) - DrawAffine(m_SelectedXform, m_AffineType == AffinePre, true); + DrawAffine(m_SelectedXform, m_AffineType == eAffineType::AffinePre, true); } else//Show all while dragging, or not dragging just hovering/mouse move. { @@ -317,7 +310,6 @@ void GLEmberController::DrawAffines(bool pre, bool post) { Xform* xform = ember->GetTotalXform(i); bool selected = dragging ? (m_SelectedXform == xform) : (m_HoverXform == xform); - DrawAffine(xform, true, selected); } } @@ -332,7 +324,6 @@ void GLEmberController::DrawAffines(bool pre, bool post) { Xform* xform = ember->GetTotalXform(i); bool selected = dragging ? (m_SelectedXform == xform) : (m_HoverXform == xform); - DrawAffine(xform, false, selected); } } @@ -351,7 +342,7 @@ void GLEmberController::DrawAffines(bool pre, bool post) m_GL->glEnd(); m_GL->glPointSize(1.0f);//Restore point size. } - else if (m_HoverType != HoverNone && m_HoverXform == m_SelectedXform)//Draw large turquoise dot on hover if they are hovering over the selected xform. + else if (m_HoverType != eHoverType::HoverNone && m_HoverXform == m_SelectedXform)//Draw large turquoise dot on hover if they are hovering over the selected xform. { m_GL->glPointSize(6.0f); m_GL->glBegin(GL_POINTS); @@ -369,24 +360,26 @@ void GLEmberController::DrawAffines(bool pre, bool post) bool GLEmberControllerBase::KeyPress_(QKeyEvent* e) { #ifdef OLDDRAG + if (e->key() == Qt::Key_Shift) - m_DragModifier |= DragModShift; + SetShift(); else if (e->key() == Qt::Key_Control || e->key() == Qt::Key_C) - m_DragModifier |= DragModControl; + SetControl(); else if (e->key() == Qt::Key_Alt || e->key() == Qt::Key_A) - m_DragModifier |= DragModAlt; + SetAlt(); else return false; return true; #else + if (e->key() == Qt::Key_Control) { - m_DragModifier |= DragModControl; + SetControl(); return true; } -#endif +#endif return false; } @@ -409,24 +402,26 @@ void GLWidget::keyPressEvent(QKeyEvent* e) bool GLEmberControllerBase::KeyRelease_(QKeyEvent* e) { #ifdef OLDDRAG + if (e->key() == Qt::Key_Shift) - m_DragModifier &= ~DragModShift; + ClearShift(); else if (e->key() == Qt::Key_Control || e->key() == Qt::Key_C) - m_DragModifier &= ~DragModControl; + ClearControl(); else if (e->key() == Qt::Key_Alt || e->key() == Qt::Key_A) - m_DragModifier &= ~DragModAlt; + ClearAlt(); else return false; return true; #else + if (e->key() == Qt::Key_Control) { - m_DragModifier &= ~DragModControl; + ClearControl(); return true; } -#endif +#endif return false; } @@ -435,7 +430,7 @@ bool GLEmberControllerBase::KeyRelease_(QKeyEvent* e) /// /// The event void GLWidget::keyReleaseEvent(QKeyEvent* e) -{ +{ if (!GLController() || !GLController()->KeyRelease_(e)) QOpenGLWidget::keyReleaseEvent(e); @@ -466,18 +461,20 @@ void GLEmberController::MousePress(QMouseEvent* e) m_BoundsDown.x = renderer->LowerLeftY(false); m_BoundsDown.y = renderer->UpperRightX(false); m_BoundsDown.z = renderer->UpperRightY(false); - #ifndef OLDDRAG Qt::KeyboardModifiers mod = e->modifiers(); - + if (mod.testFlag(Qt::ShiftModifier)) - m_DragModifier |= DragModShift; + SetShift(); + //if (mod.testFlag(Qt::ControlModifier))// || mod.testFlag(Qt::Key_C)) // m_DragModifier |= DragModControl; if (mod.testFlag(Qt::AltModifier))// || mod.testFlag(Qt::Key_A)) - m_DragModifier |= DragModAlt; + SetAlt(); + #endif - if (m_DragState == DragNone)//Only take action if the user wasn't already dragging. + + if (m_DragState == eDragState::DragNone)//Only take action if the user wasn't already dragging. { m_MouseDownWorldPos = m_MouseWorldPos;//Set the mouse down position to the current position. @@ -488,14 +485,12 @@ void GLEmberController::MousePress(QMouseEvent* e) if (m_HoverXform && xformIndex != -1) { m_SelectedXform = m_HoverXform; - m_DragSrcTransform = Affine2D(m_AffineType == AffinePre ? m_SelectedXform->m_Affine : m_SelectedXform->m_Post);//Copy the affine of the xform that was selected. + m_DragSrcTransform = Affine2D(m_AffineType == eAffineType::AffinePre ? m_SelectedXform->m_Affine : m_SelectedXform->m_Post);//Copy the affine of the xform that was selected. m_DragHandlePos = m_HoverHandlePos; m_DragHandleOffset = m_DragHandlePos - m_MouseWorldPos; - m_DragState = DragDragging; - + m_DragState = eDragState::DragDragging; //The user has selected an xform by clicking on it, so update the main GUI by selecting this xform in the combo box. m_Fractorium->CurrentXform(xformIndex); - //Draw large yellow dot on select or drag. m_GL->glPointSize(6.0f); m_GL->glBegin(GL_POINTS); @@ -508,14 +503,14 @@ void GLEmberController::MousePress(QMouseEvent* e) else//Nothing was selected. { //m_SelectedXform = nullptr; - m_DragState = DragNone; + m_DragState = eDragState::DragNone; } } else if (e->button() == Qt::MiddleButton)//Middle button does whole image translation. { m_CenterDownX = ember->m_CenterX;//Capture where the center of the image is because this value will change when panning. m_CenterDownY = ember->m_CenterY; - m_DragState = DragPanning; + m_DragState = eDragState::DragPanning; } else if (e->button() == Qt::RightButton)//Right button does whole image rotation and scaling. { @@ -525,7 +520,7 @@ void GLEmberController::MousePress(QMouseEvent* e) m_CenterDownY = ember->m_CenterY; m_RotationDown = ember->m_Rotate; m_ScaleDown = ember->m_PixelsPerUnit; - m_DragState = DragRotateScale; + m_DragState = eDragState::DragRotateScale; } } } @@ -553,18 +548,15 @@ template void GLEmberController::MouseRelease(QMouseEvent* e) { v3T mouseFlipped(e->x() * m_GL->devicePixelRatio(), m_Viewport[3] - e->y() * m_GL->devicePixelRatio(), 0);//Must flip y because in OpenGL, 0,0 is bottom left, but in windows, it's top left. - m_MouseWorldPos = WindowToWorld(mouseFlipped, false); - - if (m_DragState == DragDragging && (e->button() & Qt::LeftButton)) + + if (m_DragState == eDragState::DragDragging && (e->button() & Qt::LeftButton)) UpdateHover(mouseFlipped); - m_DragState = DragNone; - + m_DragState = eDragState::DragNone; #ifndef OLDDRAG m_DragModifier = 0; #endif - m_GL->repaint();//Force immediate redraw. } @@ -594,7 +586,7 @@ void GLEmberController::MouseMove(QMouseEvent* e) glm::ivec2 mouse(e->x() * m_GL->devicePixelRatio(), e->y() * m_GL->devicePixelRatio()); v3T mouseFlipped(e->x() * m_GL->devicePixelRatio(), m_Viewport[3] - e->y() * m_GL->devicePixelRatio(), 0);//Must flip y because in OpenGL, 0,0 is bottom left, but in windows, it's top left. Ember* ember = m_FractoriumEmberController->CurrentEmber(); - + //First check to see if the mouse actually moved. if (mouse == m_MousePos) return; @@ -607,43 +599,39 @@ void GLEmberController::MouseMove(QMouseEvent* e) if (m_Fractorium->m_Controller->RenderTimerRunning()) m_Fractorium->SetCoordinateStatus(e->x() * m_GL->devicePixelRatio(), e->y() * m_GL->devicePixelRatio(), m_MouseWorldPos.x, m_MouseWorldPos.y); - if (m_SelectedXform && m_DragState == DragDragging)//Dragging and affine. + if (m_SelectedXform && m_DragState == eDragState::DragDragging)//Dragging and affine. { - bool pre = m_AffineType == AffinePre; + bool pre = m_AffineType == eAffineType::AffinePre; Affine2D* affine = pre ? &m_SelectedXform->m_Affine : &m_SelectedXform->m_Post;//Determine pre or post affine. - if (m_HoverType == HoverTranslation) + if (m_HoverType == eHoverType::HoverTranslation) *affine = CalcDragTranslation(); - else if (m_HoverType == HoverXAxis) + else if (m_HoverType == eHoverType::HoverXAxis) *affine = CalcDragXAxis(); - else if (m_HoverType == HoverYAxis) + else if (m_HoverType == eHoverType::HoverYAxis) *affine = CalcDragYAxis(); m_FractoriumEmberController->FillAffineWithXform(m_SelectedXform, pre);//Update the spinners in the affine tab of the main window. m_FractoriumEmberController->UpdateRender();//Restart the rendering process. } - else if (m_DragState == DragPanning)//Translating the whole image. + else if (m_DragState == eDragState::DragPanning)//Translating the whole image. { T x = -(m_MouseWorldPos.x - m_MouseDownWorldPos.x); T y = (m_MouseWorldPos.y - m_MouseDownWorldPos.y); Affine2D rotMat; - rotMat.C(m_CenterDownX); rotMat.F(m_CenterDownY); rotMat.Rotate(ember->m_Rotate); - v2T v1(x, y); v2T v2 = rotMat.TransformVector(v1); - ember->m_CenterX = v2.x; ember->m_CenterY = ember->m_RotCenterY = v2.y; m_FractoriumEmberController->SetCenter(ember->m_CenterX, ember->m_CenterY);//Will restart the rendering process. } - else if (m_DragState == DragRotateScale)//Rotating and scaling the whole image. + else if (m_DragState == eDragState::DragRotateScale)//Rotating and scaling the whole image. { T rot = CalcRotation(); T scale = CalcScale(); - ember->m_Rotate = NormalizeDeg180(m_RotationDown + rot); m_Fractorium->SetRotation(ember->m_Rotate, true); ember->m_PixelsPerUnit = m_ScaleDown + scale; @@ -660,7 +648,7 @@ void GLEmberController::MouseMove(QMouseEvent* e) //In that case, nothing needs to be done. if (UpdateHover(mouseFlipped) == -1) draw = false; - + //Xform* previousHover = m_HoverXform; // //if (UpdateHover(mouseFlipped) == -1) @@ -669,12 +657,13 @@ void GLEmberController::MouseMove(QMouseEvent* e) //if (m_HoverXform == previousHover) // draw = false; } - + //Only update if the user was dragging or hovered over a point. //Use repaint() to update immediately for a more responsive feel. - if ((m_DragState != DragNone) || draw) + if ((m_DragState != eDragState::DragNone) || draw) m_GL->update(); - //m_GL->repaint(); + + //m_GL->repaint(); } /// @@ -684,10 +673,10 @@ void GLEmberController::MouseMove(QMouseEvent* e) void GLWidget::mouseMoveEvent(QMouseEvent* e) { setFocus();//Must do this so that this window gets keyboard events. - + if (GLEmberControllerBase* controller = GLController()) controller->MouseMove(e); - + QOpenGLWidget::mouseMoveEvent(e); } @@ -715,7 +704,7 @@ void GLWidget::wheelEvent(QWheelEvent* e) { if (GLEmberControllerBase* controller = GLController()) controller->Wheel(e); - + //Do not call QOpenGLWidget::wheelEvent(e) because this should only affect the scale and not the position of the scroll bars. } @@ -773,7 +762,6 @@ bool GLWidget::Allocate(bool force) glGenTextures(1, &m_OutputTexID); glBindTexture(GL_TEXTURE_2D, m_OutputTexID); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);//Fractron had this as GL_LINEAR_MIPMAP_LINEAR for OpenCL and Cuda. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); @@ -781,7 +769,7 @@ bool GLWidget::Allocate(bool force) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_TexWidth, m_TexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); alloc = true; } - + if (alloc) { glBindTexture(GL_TEXTURE_2D, 0); @@ -835,14 +823,13 @@ template bool GLEmberController::SizesMatch() { Ember* ember = m_FractoriumEmberController->CurrentEmber(); - return (ember && - ember->m_FinalRasW == m_GL->width() && - ember->m_FinalRasH == m_GL->height() && - m_GL->width() == m_GL->m_TexWidth && - m_GL->height() == m_GL->m_TexHeight && - m_GL->m_TexWidth == m_GL->m_ViewWidth && - m_GL->m_TexHeight == m_GL->m_ViewHeight); + ember->m_FinalRasW == m_GL->width() && + ember->m_FinalRasH == m_GL->height() && + m_GL->width() == m_GL->m_TexWidth && + m_GL->height() == m_GL->m_TexHeight && + m_GL->m_TexWidth == m_GL->m_ViewWidth && + m_GL->m_TexHeight == m_GL->m_ViewHeight); } /// @@ -860,7 +847,6 @@ void GLWidget::DrawGrid() float xHigh = ceil(unitX); float yLow = floor(-unitY); float yHigh = ceil(unitY); - glBegin(GL_LINES); if (rad <= 8.0f) @@ -920,21 +906,19 @@ void GLWidget::DrawUnitSquare() glLineWidth(1.0f); glBegin(GL_LINES); glColor4f(1.0f, 1.0f, 1.0f, 0.25f); - glVertex2f(-1,-1); - glVertex2f( 1,-1); + glVertex2f(-1, -1); + glVertex2f( 1, -1); glVertex2f(-1, 1); glVertex2f( 1, 1); - - glVertex2f(-1,-1); + glVertex2f(-1, -1); glVertex2f(-1, 1); - glVertex2f( 1,-1); + glVertex2f( 1, -1); glVertex2f( 1, 1); - glColor4f(1.0f, 0.0f, 0.0f, 0.5f); glVertex2f(-1, 0); glVertex2f( 1, 0); glColor4f(0.0f, 1.0f, 0.0f, 0.5f); - glVertex2f( 0,-1); + glVertex2f( 0, -1); glVertex2f( 0, 1); glEnd(); } @@ -956,21 +940,17 @@ void GLEmberController::DrawAffine(Xform* xform, bool pre, bool selected) size_t size = ember->m_Palette.m_Entries.size(); v4T color = ember->m_Palette.m_Entries[Clamp(xform->m_ColorX * size, 0, size - 1)]; Affine2D* affine = pre ? &xform->m_Affine : &xform->m_Post; - //For some incredibly strange reason, even though glm and OpenGL use matrices with a column-major //data layout, nothing will work here unless they are flipped to row major order. This is how it was //done in Fractron. m4T mat = affine->ToMat4RowMajor(); - m_GL->glPushMatrix(); m_GL->glLoadIdentity(); MultMatrix(mat); m_GL->glLineWidth(3.0f);//One 3px wide, colored black, except green on x axis for post affine. m_GL->DrawAffineHelper(index, selected, pre, final, true); - m_GL->glLineWidth(1.0f);//Again 1px wide, colored white, to give a white middle with black outline effect. m_GL->DrawAffineHelper(index, selected, pre, final, false); - m_GL->glPointSize(5.0f);//Three black points, one in the center and two on the circle. Drawn big 5px first to give a black outline. m_GL->glBegin(GL_POINTS); m_GL->glColor4f(0.0f, 0.0f, 0.0f, selected ? 1.0f : 0.5f); @@ -978,14 +958,12 @@ void GLEmberController::DrawAffine(Xform* xform, bool pre, bool selected) m_GL->glVertex2f(1.0f, 0.0f); m_GL->glVertex2f(0.0f, 1.0f); m_GL->glEnd(); - m_GL->glLineWidth(2.0f);//Draw lines again for y axis only, without drawing the circle, using the color of the selected xform. m_GL->glBegin(GL_LINES); m_GL->glColor4f(color.r, color.g, color.b, 1.0f); m_GL->glVertex2f(0.0f, 0.0f); m_GL->glVertex2f(0.0f, 1.0f); m_GL->glEnd(); - m_GL->glPointSize(3.0f);//Draw smaller white points, to give a black outline effect. m_GL->glBegin(GL_POINTS); m_GL->glColor4f(1.0f, 1.0f, 1.0f, selected ? 1.0f : 0.5f); @@ -1010,7 +988,6 @@ void GLWidget::DrawAffineHelper(int index, bool selected, bool pre, bool final, float px = 1.0f; float py = 0.0f; QColor col = final ? m_Fractorium->m_FinalXformComboColor : m_Fractorium->m_XformComboColors[index % XFORM_COLOR_COUNT]; - glBegin(GL_LINES); //Circle part. @@ -1030,7 +1007,6 @@ void GLWidget::DrawAffineHelper(int index, bool selected, bool pre, bool final, float theta = float(M_PI) * 2.0f * float(i % 64) / 64.0f; float fx = float(cos(theta)); float fy = float(sin(theta)); - glVertex2f(px, py); glVertex2f(fx, fy); px = fx; @@ -1054,13 +1030,12 @@ void GLWidget::DrawAffineHelper(int index, bool selected, bool pre, bool final, //The lines from the center to the circle. glVertex2f(0.0f, 0.0f);//X axis. glVertex2f(1.0f, 0.0f); - + if (background) glColor4f(0.0f, 0.0f, 0.0f, 1.0f); glVertex2f(0.0f, 0.0f);//Y axis. glVertex2f(0.0f, 1.0f); - glEnd(); } @@ -1080,8 +1055,7 @@ int GLEmberController::UpdateHover(v3T& glCoords) uint bestIndex = -1; T bestDist = 10; Ember* ember = m_FractoriumEmberController->CurrentEmber(); - - m_HoverType = HoverNone; + m_HoverType = eHoverType::HoverNone; //If there's a selected/current xform, check it first so it gets precedence over the others. if (m_SelectedXform) @@ -1154,42 +1128,41 @@ bool GLEmberController::CheckXformHover(Xform* xform, v3T& glCoords, T& be v3T xAxisScreen = glm::project(translation + xAxis, m_Modelview, m_Projection, m_Viewport); v3T yAxis(xform->m_Affine.B(), xform->m_Affine.E(), 0); v3T yAxisScreen = glm::project(translation + yAxis, m_Modelview, m_Projection, m_Viewport); - pos = translation; dist = glm::distance(glCoords, transScreen); if (dist < bestDist) { bestDist = dist; - m_HoverType = HoverTranslation; + m_HoverType = eHoverType::HoverTranslation; m_HoverHandlePos = pos; preFound = true; } pos = translation + xAxis; dist = glm::distance(glCoords, xAxisScreen); - + if (dist < bestDist) { bestDist = dist; - m_HoverType = HoverXAxis; + m_HoverType = eHoverType::HoverXAxis; m_HoverHandlePos = pos; preFound = true; } pos = translation + yAxis; dist = glm::distance(glCoords, yAxisScreen); - + if (dist < bestDist) { bestDist = dist; - m_HoverType = HoverYAxis; + m_HoverType = eHoverType::HoverYAxis; m_HoverHandlePos = pos; preFound = true; } if (preFound) - m_AffineType = AffinePre; + m_AffineType = eAffineType::AffinePre; } if (post) @@ -1200,42 +1173,41 @@ bool GLEmberController::CheckXformHover(Xform* xform, v3T& glCoords, T& be v3T xAxisScreen = glm::project(translation + xAxis, m_Modelview, m_Projection, m_Viewport); v3T yAxis(xform->m_Post.B(), xform->m_Post.E(), 0); v3T yAxisScreen = glm::project(translation + yAxis, m_Modelview, m_Projection, m_Viewport); - pos = translation; dist = glm::distance(glCoords, transScreen); if (dist < bestDist) { bestDist = dist; - m_HoverType = HoverTranslation; + m_HoverType = eHoverType::HoverTranslation; m_HoverHandlePos = pos; postFound = true; } pos = translation + xAxis; dist = glm::distance(glCoords, xAxisScreen); - + if (dist < bestDist) { bestDist = dist; - m_HoverType = HoverXAxis; + m_HoverType = eHoverType::HoverXAxis; m_HoverHandlePos = pos; postFound = true; } pos = translation + yAxis; dist = glm::distance(glCoords, yAxisScreen); - + if (dist < bestDist) { bestDist = dist; - m_HoverType = HoverYAxis; + m_HoverType = eHoverType::HoverYAxis; m_HoverHandlePos = pos; postFound = true; } if (postFound) - m_AffineType = AffinePost; + m_AffineType = eAffineType::AffinePost; } return preFound || postFound; @@ -1264,23 +1236,21 @@ Affine2D GLEmberController::CalcDragXAxis() { v3T t3, newAxis, newPos; Affine2D result = m_DragSrcTransform; - bool worldPivotShiftAlt = !m_Fractorium->LocalPivot() && - ((m_DragModifier & DragModShift) == DragModShift) && - ((m_DragModifier & DragModAlt) == DragModAlt); + bool worldPivotShiftAlt = !m_Fractorium->LocalPivot() && GetShift() && GetAlt(); if (worldPivotShiftAlt) t3 = v3T(0, 0, 0); else t3 = v3T(m_DragSrcTransform.O(), 0); - if ((m_DragModifier & DragModShift) == DragModShift) + if (GetShift()) { v3T targetAxis = m_MouseWorldPos - t3; v3T norm = glm::normalize(targetAxis); - if ((m_DragModifier & DragModControl) == DragModControl) + if (GetControl()) norm = SnapToNormalizedAngle(norm, 24); - + if (worldPivotShiftAlt) newAxis = norm * glm::length(m_DragSrcTransform.O() + m_DragSrcTransform.X()); else @@ -1288,7 +1258,7 @@ Affine2D GLEmberController::CalcDragXAxis() } else { - if ((m_DragModifier & DragModControl) == DragModControl) + if (GetControl()) newPos = SnapToGrid(m_MouseWorldPos); else newPos = m_MouseWorldPos + m_DragHandleOffset; @@ -1296,7 +1266,7 @@ Affine2D GLEmberController::CalcDragXAxis() newAxis = newPos - t3; } - if ((m_DragModifier & DragModAlt) == DragModAlt) + if (GetAlt()) { if (worldPivotShiftAlt) result.X(v2T(newAxis) - m_DragSrcTransform.O()); @@ -1309,7 +1279,6 @@ Affine2D GLEmberController::CalcDragXAxis() } m_DragHandlePos = v3T(result.O() + result.X(), 0); - return result; } @@ -1336,21 +1305,19 @@ Affine2D GLEmberController::CalcDragYAxis() { v3T t3, newAxis, newPos; Affine2D result = m_DragSrcTransform; - bool worldPivotShiftAlt = !m_Fractorium->LocalPivot() && - ((m_DragModifier & DragModShift) == DragModShift) && - ((m_DragModifier & DragModAlt) == DragModAlt); + bool worldPivotShiftAlt = !m_Fractorium->LocalPivot() && GetShift() && GetAlt(); if (worldPivotShiftAlt) t3 = v3T(0, 0, 0); else t3 = v3T(m_DragSrcTransform.O(), 0); - if ((m_DragModifier & DragModShift) == DragModShift) + if (GetShift()) { v3T targetAxis = m_MouseWorldPos - t3; v3T norm = glm::normalize(targetAxis); - if ((m_DragModifier & DragModControl) == DragModControl) + if (GetControl()) norm = SnapToNormalizedAngle(norm, 24); if (worldPivotShiftAlt) @@ -1360,7 +1327,7 @@ Affine2D GLEmberController::CalcDragYAxis() } else { - if ((m_DragModifier & DragModControl) == DragModControl) + if (GetControl()) newPos = SnapToGrid(m_MouseWorldPos); else newPos = m_MouseWorldPos + m_DragHandleOffset; @@ -1368,7 +1335,7 @@ Affine2D GLEmberController::CalcDragYAxis() newAxis = newPos - t3; } - if ((m_DragModifier & DragModAlt) == DragModAlt) + if (GetAlt()) { if (worldPivotShiftAlt) result.Y(v2T(newAxis) - m_DragSrcTransform.O()); @@ -1381,7 +1348,6 @@ Affine2D GLEmberController::CalcDragYAxis() } m_DragHandlePos = v3T(result.O() + result.Y(), 0); - return result; } @@ -1404,15 +1370,15 @@ Affine2D GLEmberController::CalcDragTranslation() { v3T newPos, newX, newY; Affine2D result = m_DragSrcTransform; - bool worldPivotShift = !m_Fractorium->LocalPivot() && ((m_DragModifier & DragModShift) == DragModShift); + bool worldPivotShift = !m_Fractorium->LocalPivot() && GetShift(); - if ((m_DragModifier & DragModShift) == DragModShift) + if (GetShift()) { v3T norm = glm::normalize(m_MouseWorldPos); - - if ((m_DragModifier & DragModControl) == DragModControl) + + if (GetControl()) norm = SnapToNormalizedAngle(norm, 12); - + newPos = glm::length(m_DragSrcTransform.O()) * norm; if (worldPivotShift) @@ -1420,13 +1386,12 @@ Affine2D GLEmberController::CalcDragTranslation() T startAngle = atan2(m_DragSrcTransform.O().y, m_DragSrcTransform.O().x); T endAngle = atan2(newPos.y, newPos.x); T angle = startAngle - endAngle; - result.Rotate(angle * RAD_2_DEG); } } else { - if ((m_DragModifier & DragModControl) == DragModControl) + if (GetControl()) newPos = SnapToGrid(m_MouseWorldPos); else newPos = m_MouseWorldPos + m_DragHandleOffset; @@ -1434,7 +1399,6 @@ Affine2D GLEmberController::CalcDragTranslation() result.O(v2T(newPos)); m_DragHandlePos = newPos; - return result; } @@ -1453,5 +1417,5 @@ GLEmberControllerBase* GLWidget::GLController() template class GLEmberController; #ifdef DO_DOUBLE - template class GLEmberController; +template class GLEmberController; #endif diff --git a/Source/Fractorium/VariationsDialog.cpp b/Source/Fractorium/VariationsDialog.cpp index d049b6d..13816c1 100644 --- a/Source/Fractorium/VariationsDialog.cpp +++ b/Source/Fractorium/VariationsDialog.cpp @@ -10,12 +10,10 @@ /// The window flags. Default: 0. FractoriumVariationsDialog::FractoriumVariationsDialog(FractoriumSettings* settings, QWidget* p, Qt::WindowFlags f) : QDialog(p, f), - m_Settings(settings) + m_Settings(settings) { ui.setupUi(this); - auto table = ui.VariationsTable; - m_Vars = m_Settings->Variations(); Populate(); OnSelectAllButtonClicked(true); @@ -37,7 +35,6 @@ void FractoriumVariationsDialog::ForEachCell(std::functionrowCount(); auto cols = table->columnCount(); - table->model()->blockSignals(true); for (auto row = 0; row < rows; row++) @@ -57,10 +54,9 @@ void FractoriumVariationsDialog::ForEachSelectedCell(std::function selectedItems = table->selectedItems(); - table->model()->blockSignals(true); - foreach(QTableWidgetItem* item, selectedItems) + foreach (QTableWidgetItem* item, selectedItems) if (item) func(item); @@ -74,13 +70,11 @@ void FractoriumVariationsDialog::ForEachSelectedCell(std::function m; - - ForEachCell([&](QTableWidgetItem* cb) + ForEachCell([&](QTableWidgetItem * cb) { if (!cb->text().isEmpty()) m[cb->text()] = cb->checkState() == Qt::CheckState::Checked; }); - m_Settings->Variations(m); } @@ -100,7 +94,7 @@ const QMap& FractoriumVariationsDialog::Map() /// Ignored void FractoriumVariationsDialog::OnSelectAllButtonClicked(bool checked) { - ForEachCell([&](QTableWidgetItem* cb) { cb->setCheckState(Qt::CheckState::Checked); }); + ForEachCell([&](QTableWidgetItem * cb) { cb->setCheckState(Qt::CheckState::Checked); }); } /// @@ -109,7 +103,7 @@ void FractoriumVariationsDialog::OnSelectAllButtonClicked(bool checked) /// Ignored void FractoriumVariationsDialog::OnInvertSelectionButtonClicked(bool checked) { - ForEachCell([&](QTableWidgetItem* cb) + ForEachCell([&](QTableWidgetItem * cb) { if (cb->checkState() != Qt::CheckState::Checked) cb->setCheckState(Qt::CheckState::Checked); @@ -124,7 +118,7 @@ void FractoriumVariationsDialog::OnInvertSelectionButtonClicked(bool checked) /// Ignored void FractoriumVariationsDialog::OnSelectNoneButtonClicked(bool checked) { - ForEachCell([&](QTableWidgetItem* cb) { cb->setCheckState(Qt::CheckState::Unchecked); }); + ForEachCell([&](QTableWidgetItem * cb) { cb->setCheckState(Qt::CheckState::Unchecked); }); } /// @@ -134,7 +128,6 @@ void FractoriumVariationsDialog::Populate() { auto table = ui.VariationsTable; auto size = std::max(std::max(m_VariationList.RegSize(), m_VariationList.PreSize()), m_VariationList.PostSize()); - table->setRowCount(size); for (size_t i = 0; i < size; i++) @@ -152,7 +145,7 @@ void FractoriumVariationsDialog::Populate() table->setItem(i, 1, cb); SetCheckFromMap(cb, reg); } - + if (auto post = m_VariationList.GetVariation(i, eVariationType::VARTYPE_POST)) { auto cb = new QTableWidgetItem(post->Name().c_str()); @@ -174,7 +167,7 @@ void FractoriumVariationsDialog::OnVariationsTableItemChanged(QTableWidgetItem* bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier); if (ctrl) - ForEachSelectedCell([&](QTableWidgetItem* cb) { cb->setCheckState(item->checkState()); }); + ForEachSelectedCell([&](QTableWidgetItem * cb) { cb->setCheckState(item->checkState()); }); } /// @@ -213,7 +206,7 @@ void FractoriumVariationsDialog::showEvent(QShowEvent* e) /// void FractoriumVariationsDialog::DataToGui() { - ForEachCell([&](QTableWidgetItem* cb) + ForEachCell([&](QTableWidgetItem * cb) { if (auto var = m_VariationList.GetVariation(cb->text().toStdString())) SetCheckFromMap(cb, var); @@ -225,7 +218,7 @@ void FractoriumVariationsDialog::DataToGui() /// void FractoriumVariationsDialog::GuiToData() { - ForEachCell([&](QTableWidgetItem* cb) + ForEachCell([&](QTableWidgetItem * cb) { if (auto var = m_VariationList.GetVariation(cb->text().toStdString())) m_Vars[cb->text()] = (cb->checkState() == Qt::Checked); @@ -247,7 +240,6 @@ void FractoriumVariationsDialog::SetCheckFromMap(QTableWidgetItem* cb, const Var else { bool chk = m_Vars[var->Name().c_str()].toBool(); - cb->setCheckState(chk ? Qt::Checked : Qt::Unchecked); } }