diff --git a/Source/Ember/Ember.cpp b/Source/Ember/Ember.cpp index a0c9f7c..04f10e7 100644 --- a/Source/Ember/Ember.cpp +++ b/Source/Ember/Ember.cpp @@ -120,6 +120,9 @@ uint Timing::m_ProcessorCount; EXPORTPREPOSTREGVAR(Tangent, T) \ EXPORTPREPOSTREGVAR(Square, T) \ EXPORTPREPOSTREGVAR(Rays, T) \ + EXPORTPREPOSTREGVAR(Rays1, T) \ + EXPORTPREPOSTREGVAR(Rays2, T) \ + EXPORTPREPOSTREGVAR(Rays3, T) \ EXPORTPREPOSTREGVAR(Blade, T) \ EXPORTPREPOSTREGVAR(Secant2, T) \ EXPORTPREPOSTREGVAR(TwinTrian, T) \ diff --git a/Source/Ember/Variation.h b/Source/Ember/Variation.h index 338327d..78ee52b 100644 --- a/Source/Ember/Variation.h +++ b/Source/Ember/Variation.h @@ -286,6 +286,9 @@ enum class eVariationId : et VAR_RAND_CUBES , VAR_RATIONAL3 , VAR_RAYS , + VAR_RAYS1 , + VAR_RAYS2 , + VAR_RAYS3 , VAR_RBLUR, VAR_RECTANGLES , VAR_RINGS , @@ -625,6 +628,9 @@ enum class eVariationId : et VAR_PRE_RAND_CUBES, VAR_PRE_RATIONAL3, VAR_PRE_RAYS, + VAR_PRE_RAYS1, + VAR_PRE_RAYS2, + VAR_PRE_RAYS3, VAR_PRE_RBLUR, VAR_PRE_RECTANGLES, VAR_PRE_RINGS, @@ -964,6 +970,9 @@ enum class eVariationId : et VAR_POST_RAND_CUBES, VAR_POST_RATIONAL3, VAR_POST_RAYS, + VAR_POST_RAYS1, + VAR_POST_RAYS2, + VAR_POST_RAYS3, VAR_POST_RBLUR, VAR_POST_RECTANGLES, VAR_POST_RINGS, diff --git a/Source/Ember/VariationList.cpp b/Source/Ember/VariationList.cpp index f957e1d..2899ea5 100644 --- a/Source/Ember/VariationList.cpp +++ b/Source/Ember/VariationList.cpp @@ -68,6 +68,9 @@ VariationList::VariationList() ADDPREPOSTREGVAR(Tangent) ADDPREPOSTREGVAR(Square) ADDPREPOSTREGVAR(Rays) + ADDPREPOSTREGVAR(Rays1) + ADDPREPOSTREGVAR(Rays2) + ADDPREPOSTREGVAR(Rays3) ADDPREPOSTREGVAR(Blade) ADDPREPOSTREGVAR(Secant2) ADDPREPOSTREGVAR(TwinTrian) diff --git a/Source/Ember/Variations01.h b/Source/Ember/Variations01.h index 31b5fe2..e4cf94b 100644 --- a/Source/Ember/Variations01.h +++ b/Source/Ember/Variations01.h @@ -2482,6 +2482,152 @@ public: } }; +/// +/// Rays1 from JWildfire by Raykoid666. +/// +template +class Rays1Variation : public Variation +{ +public: + Rays1Variation(T weight = 1.0) : Variation("rays1", eVariationId::VAR_RAYS1, weight, true, true) { } + + VARCOPY(Rays1Variation) + + virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override + { + T u = 1 / Zeps(SafeTan(helper.m_PrecalcSqrtSumSquares)) + (m_Weight * T(SQR(M_2_PI))); + + if (m_VarType == eVariationType::VARTYPE_REG) + outPoint.m_X = outPoint.m_Y = 0;//This variation assigns, instead of summing, so order will matter. + + helper.Out.x = m_Weight * u * helper.m_PrecalcSumSquares / Zeps(helper.In.x); + helper.Out.y = m_Weight * u * helper.m_PrecalcSumSquares / Zeps(helper.In.y); + helper.Out.z = m_Weight * helper.In.z; + } + + virtual string OpenCLString() const override + { + ostringstream ss; + string weight = WeightDefineString(); + intmax_t varIndex = IndexInXform(); + ss << "\t{\n" + << "\t\treal_t u = 1 / Zeps(tan(precalcSqrtSumSquares)) + (" << weight << " * SQR(M_2_PI));\n"; + + if (m_VarType == eVariationType::VARTYPE_REG) + ss << "\t\toutPoint->m_X = outPoint->m_Y = 0;\n"; + + ss + << "\t\tvOut.x = " << weight << " * u * precalcSumSquares / Zeps(vIn.x);\n" + << "\t\tvOut.y = " << weight << " * u * precalcSumSquares / Zeps(vIn.y);\n" + << "\t\tvOut.z = " << weight << " * vIn.z;\n" + << "\t}\n"; + return ss.str(); + } + + virtual vector OpenCLGlobalFuncNames() const override + { + return vector { "Zeps" }; + } +}; + +/// +/// Rays2 from JWildfire by Raykoid666. +/// +template +class Rays2Variation : public Variation +{ +public: + Rays2Variation(T weight = 1.0) : Variation("rays2", eVariationId::VAR_RAYS2, weight, true) { } + + VARCOPY(Rays2Variation) + + virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override + { + T u = 1 / std::cos(helper.m_PrecalcSumSquares * std::tan(1 / Zeps(helper.m_PrecalcSumSquares))); + + if (m_VarType == eVariationType::VARTYPE_REG) + outPoint.m_X = outPoint.m_Y = 0;//This variation assigns, instead of summing, so order will matter. + + helper.Out.x = (m_Weight / 10) * u * helper.m_PrecalcSumSquares / Zeps(helper.In.x); + helper.Out.y = (m_Weight / 10) * u * helper.m_PrecalcSumSquares / Zeps(helper.In.y); + helper.Out.z = m_Weight * helper.In.z; + } + + virtual string OpenCLString() const override + { + ostringstream ss; + string weight = WeightDefineString(); + intmax_t varIndex = IndexInXform(); + ss << "\t{\n" + << "\t\treal_t u = 1 / cos(precalcSumSquares * tan(1 / Zeps(precalcSumSquares)));\n"; + + if (m_VarType == eVariationType::VARTYPE_REG) + ss << "\t\toutPoint->m_X = outPoint->m_Y = 0;\n"; + + ss + << "\t\tvOut.x = (" << weight << " / 10) * u * precalcSumSquares / Zeps(vIn.x);\n" + << "\t\tvOut.y = (" << weight << " / 10) * u * precalcSumSquares / Zeps(vIn.y);\n" + << "\t\tvOut.z = " << weight << " * vIn.z;\n" + << "\t}\n"; + return ss.str(); + } + + virtual vector OpenCLGlobalFuncNames() const override + { + return vector { "Zeps" }; + } +}; + +/// +/// Rays3 from JWildfire by Raykoid666. +/// +template +class Rays3Variation : public Variation +{ +public: + Rays3Variation(T weight = 1.0) : Variation("rays3", eVariationId::VAR_RAYS3, weight, true) { } + + VARCOPY(Rays3Variation) + + virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override + { + T sq = SQR(helper.m_PrecalcSumSquares); + T u = 1 / std::sqrt(std::cos(std::sin(sq) * std::sin(1 / Zeps(sq)))); + + if (m_VarType == eVariationType::VARTYPE_REG) + outPoint.m_X = outPoint.m_Y = 0;//This variation assigns, instead of summing, so order will matter. + + helper.Out.x = (m_Weight / 10) * u * std::cos(helper.m_PrecalcSumSquares) * helper.m_PrecalcSumSquares / Zeps(helper.In.x); + helper.Out.y = (m_Weight / 10) * u * std::tan(helper.m_PrecalcSumSquares) * helper.m_PrecalcSumSquares / Zeps(helper.In.y); + helper.Out.z = m_Weight * helper.In.z; + } + + virtual string OpenCLString() const override + { + ostringstream ss; + string weight = WeightDefineString(); + intmax_t varIndex = IndexInXform(); + ss << "\t{\n" + << "\t\treal_t sq = SQR(precalcSumSquares);\n" + << "\t\treal_t u = 1 / sqrt(cos(sin(sq) * sin(1 / Zeps(sq))));\n"; + + if (m_VarType == eVariationType::VARTYPE_REG) + ss << "\t\toutPoint->m_X = outPoint->m_Y = 0;\n"; + + ss + << "\t\tvOut.x = (" << weight << " / 10) * u * cos(precalcSumSquares) * precalcSumSquares / Zeps(vIn.x);\n" + << "\t\tvOut.y = (" << weight << " / 10) * u * tan(precalcSumSquares) * precalcSumSquares / Zeps(vIn.y);\n" + << "\t\tvOut.z = " << weight << " * vIn.z;\n" + << "\t}\n"; + return ss.str(); + } + + virtual vector OpenCLGlobalFuncNames() const override + { + return vector { "Zeps" }; + } +}; + /// /// Blade. /// @@ -6258,6 +6404,9 @@ MAKEPREPOSTVARASSIGN(Arch, arch, ARCH, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTVAR(Tangent, tangent, TANGENT) MAKEPREPOSTVARASSIGN(Square, square, SQUARE, eVariationAssignType::ASSIGNTYPE_SUM) MAKEPREPOSTVAR(Rays, rays, RAYS) +MAKEPREPOSTVAR(Rays1, rays1, RAYS1) +MAKEPREPOSTVAR(Rays2, rays2, RAYS2) +MAKEPREPOSTVAR(Rays3, rays3, RAYS3) MAKEPREPOSTVAR(Blade, blade, BLADE) MAKEPREPOSTVAR(Secant2, secant2, SECANT2) MAKEPREPOSTVAR(TwinTrian, TwinTrian, TWINTRIAN)