--User changes

-Add new variations: rays1, rays2, rays3.
This commit is contained in:
Person 2017-12-17 20:44:40 -08:00
parent 244d2f5dc2
commit 6d38e57b38
4 changed files with 164 additions and 0 deletions

View File

@ -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) \

View File

@ -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,

View File

@ -68,6 +68,9 @@ VariationList<T>::VariationList()
ADDPREPOSTREGVAR(Tangent)
ADDPREPOSTREGVAR(Square)
ADDPREPOSTREGVAR(Rays)
ADDPREPOSTREGVAR(Rays1)
ADDPREPOSTREGVAR(Rays2)
ADDPREPOSTREGVAR(Rays3)
ADDPREPOSTREGVAR(Blade)
ADDPREPOSTREGVAR(Secant2)
ADDPREPOSTREGVAR(TwinTrian)

View File

@ -2482,6 +2482,152 @@ public:
}
};
/// <summary>
/// Rays1 from JWildfire by Raykoid666.
/// </summary>
template <typename T>
class Rays1Variation : public Variation<T>
{
public:
Rays1Variation(T weight = 1.0) : Variation<T>("rays1", eVariationId::VAR_RAYS1, weight, true, true) { }
VARCOPY(Rays1Variation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& rand) override
{
T u = 1 / Zeps(SafeTan<T>(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<string> OpenCLGlobalFuncNames() const override
{
return vector<string> { "Zeps" };
}
};
/// <summary>
/// Rays2 from JWildfire by Raykoid666.
/// </summary>
template <typename T>
class Rays2Variation : public Variation<T>
{
public:
Rays2Variation(T weight = 1.0) : Variation<T>("rays2", eVariationId::VAR_RAYS2, weight, true) { }
VARCOPY(Rays2Variation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& 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<string> OpenCLGlobalFuncNames() const override
{
return vector<string> { "Zeps" };
}
};
/// <summary>
/// Rays3 from JWildfire by Raykoid666.
/// </summary>
template <typename T>
class Rays3Variation : public Variation<T>
{
public:
Rays3Variation(T weight = 1.0) : Variation<T>("rays3", eVariationId::VAR_RAYS3, weight, true) { }
VARCOPY(Rays3Variation)
virtual void Func(IteratorHelper<T>& helper, Point<T>& outPoint, QTIsaac<ISAAC_SIZE, ISAAC_INT>& 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<string> OpenCLGlobalFuncNames() const override
{
return vector<string> { "Zeps" };
}
};
/// <summary>
/// Blade.
/// </summary>
@ -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)