--User changes

-Add new options to EmberGenome to better help assess which variations have certain characteristics. The options are:
  --sumvars: Display the names of all regular variations which have the default behavior of summing their outputs and exit.
  --assignvars: Display the names of all regular variations which have the non-standard behavior of assigning their outputs and exit.
  --ppsumvars: Display the names of all pre/post variations which have the non-standard behavior of summing their outputs and exit.
  --ppassignvars: Display the names of all pre/post variations which have the default behavior of assigning their outputs and exit.
  --dcvars: Display the names of all variations which use direct coloring and exit.
  --parvars: Display the names of all variations which have parameters and exit.
  --nonparvars: Display the names of all variations which do not have parameters (weight only) and exit.

--Code changes
 -Make VariationList vectors have const elements since no callers should ever change them.
 -Add new function to VariationList to retrieve a const ref to the parametric variations.
 -Move some search functions out of EmberTester and into EmberCommon.h.
 -General code cleanup.
This commit is contained in:
mfeemster
2016-05-14 23:33:08 -07:00
parent 5b6c62b95d
commit 5aec58b4a2
11 changed files with 283 additions and 135 deletions

View File

@ -83,7 +83,6 @@ void Renderer<T, bucketT>::ComputeBounds()
//It also prevents the renderer from only performing filtering or final accum based on a filter parameter change, since that
//change may have changed the gutter.
//By using a fixed gutter, a filter change can be applied without fully restarting iteration.
//m_GutterWidth = 10;
m_GutterWidth = 10 * Supersample();//Should be enough to fully accommodate most spatial and density filter widths.
m_SuperRasW = (Supersample() * FinalRasW()) + (2 * m_GutterWidth);
m_SuperRasH = (Supersample() * FinalRasH()) + (2 * m_GutterWidth);

View File

@ -357,13 +357,14 @@ VariationList<T>::VariationList()
ADDPREPOSTREGVAR(DCTriangle)
ADDPREPOSTREGVAR(DCZTransl)
for (auto var : m_Variations) var->Precalc();
for (auto var : m_Variations) const_cast<Variation<T>*>(var)->Precalc();//Modify once here, then const after this.
std::sort(m_Variations.begin(), m_Variations.end(), [&](const Variation<T>* var1, const Variation<T>* var2) { return var1->VariationId() < var2->VariationId(); });
m_RegVariations.reserve(m_Variations.size() / 3);
m_PreVariations.reserve(m_Variations.size() / 3);
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.
m_NonParametricVariations.reserve(size_t(m_Variations.size() * 0.20));//This is a rough guess at how many are not parametric. These don't add to 1 just to allow extra padding.
//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.
@ -377,8 +378,10 @@ VariationList<T>::VariationList()
else if (var->VarType() == eVariationType::VARTYPE_POST)
m_PostVariations.push_back(var);
if (auto parVar = dynamic_cast<ParametricVariation<T>*>(var))
if (auto parVar = dynamic_cast<const ParametricVariation<T>*>(var))
m_ParametricVariations.push_back(parVar);
else
m_NonParametricVariations.push_back(var);
}
}
@ -543,10 +546,13 @@ template <typename T> size_t VariationList<T>::RegSize() const { return m_RegVar
template <typename T> size_t VariationList<T>::PreSize() const { return m_PreVariations.size(); }
template <typename T> size_t VariationList<T>::PostSize() const { return m_PostVariations.size(); }
template <typename T> size_t VariationList<T>::ParametricSize() const { return m_ParametricVariations.size(); }
template <typename T> const vector<Variation<T>*>& VariationList<T>::AllVars() const { return m_Variations; }
template <typename T> const vector<Variation<T>*>& VariationList<T>::RegVars() const { return m_RegVariations; }
template <typename T> const vector<Variation<T>*>& VariationList<T>::PreVars() const { return m_PreVariations; }
template <typename T> const vector<Variation<T>*>& VariationList<T>::PostVars() const { return m_PostVariations; }
template <typename T> size_t VariationList<T>::NonParametricSize() const { return m_NonParametricVariations.size(); }
template <typename T> const vector<const Variation<T>*>& VariationList<T>::AllVars() const { return m_Variations; }
template <typename T> const vector<const Variation<T>*>& VariationList<T>::RegVars() const { return m_RegVariations; }
template <typename T> const vector<const Variation<T>*>& VariationList<T>::PreVars() const { return m_PreVariations; }
template <typename T> const vector<const Variation<T>*>& VariationList<T>::PostVars() const { return m_PostVariations; }
template <typename T> const vector<const Variation<T>*>& VariationList<T>::NonParametricVariations() const { return m_NonParametricVariations; }
template <typename T> const vector<const ParametricVariation<T>*>& VariationList<T>::ParametricVariations() const { return m_ParametricVariations; }
/// <summary>
/// Make a dyncamically allocated copy of a variation and assign it a specified weight.

View File

@ -38,11 +38,14 @@ public:
size_t PreSize() const;
size_t PostSize() const;
size_t ParametricSize() const;
size_t NonParametricSize() const;
const vector<Variation<T>*>& AllVars() const;
const vector<Variation<T>*>& RegVars() const;
const vector<Variation<T>*>& PreVars() const;
const vector<Variation<T>*>& PostVars() const;
const vector<const Variation<T>*>& AllVars() const;
const vector<const Variation<T>*>& RegVars() const;
const vector<const Variation<T>*>& PreVars() const;
const vector<const Variation<T>*>& PostVars() const;
const vector<const Variation<T>*>& NonParametricVariations() const;
const vector<const ParametricVariation<T>*>& ParametricVariations() const;
SINGLETON_DERIVED_DECL(VariationList<T>);
@ -50,10 +53,11 @@ private:
VariationList();
Variation<T>* MakeCopyWithWeight(const Variation<T>* var, T weight) const;
vector<Variation<T>*> m_Variations;//A list of pointers to dynamically allocated variation objects.
vector<Variation<T>*> m_RegVariations;
vector<Variation<T>*> m_PreVariations;
vector<Variation<T>*> m_PostVariations;
vector<ParametricVariation<T>*> m_ParametricVariations;//A list of pointers to elements in m_Variations which are derived from ParametricVariation.
vector<const Variation<T>*> m_Variations;//A list of pointers to dynamically allocated variation objects.
vector<const Variation<T>*> m_RegVariations;
vector<const Variation<T>*> m_PreVariations;
vector<const Variation<T>*> m_PostVariations;
vector<const Variation<T>*> m_NonParametricVariations;
vector<const ParametricVariation<T>*> m_ParametricVariations;//A list of pointers to elements in m_Variations which are derived from ParametricVariation.
};
}

View File

@ -4109,16 +4109,16 @@ public:
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string cx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string cy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string cz = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string c2x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string c2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string c2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string cx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string cy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string cz = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string c2x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string c2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string c2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string s2x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string s2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string s2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4298,8 +4298,8 @@ public:
int i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string zscale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string vpi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string zscale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string vpi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t c0 = vIn.x * " << vpi << ";\n"
<< "\t\treal_t c1 = vIn.y * " << vpi << ";\n"
@ -4371,14 +4371,14 @@ public:
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string t3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string t2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string t1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string tc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string bc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string t3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string t2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string t1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string tc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string bc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t xsqr = vIn.x * vIn.x;\n"
<< "\t\treal_t ysqr = vIn.y * vIn.y;\n"
@ -4474,16 +4474,16 @@ public:
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string frequency = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string velocity = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string amplitude = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string centerx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string centery = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string phase = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string f = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string frequency = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string velocity = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string amplitude = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string centerx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string centery = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string phase = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string f = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string s = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string is = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string vxp = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
@ -4604,13 +4604,13 @@ public:
intmax_t i = 0;
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string shiftX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string shiftY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string sx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string sy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string ax = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string ay = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string vv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string shiftX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string shiftY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string sx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string sy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string ax = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string ay = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string vv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t c0 = " << ax << " / (1 + exp(" << sx << " * vIn.x));\n"
<< "\t\treal_t c1 = " << ay << " / (1 + exp(" << sy << " * vIn.y));\n"

View File

@ -1143,11 +1143,11 @@ public:
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string strength = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string offset = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string centerX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string centerY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string s2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string strength = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string offset = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string centerX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string centerY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string s2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
ss << "\t{\n"
<< "\t\treal_t sx = vIn.x - " << centerX << ";\n"
<< "\t\treal_t sy = vIn.y - " << centerY << ";\n"
@ -1221,12 +1221,12 @@ public:
intmax_t i = 0, varIndex = IndexInXform();
ss2 << "_" << XformIndexInEmber() << "]";
string index = ss2.str();
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string sep = "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;
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
string sep = "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 jun = Zeps(fabs(" << n << "));\n"
<< "\n"
@ -2033,7 +2033,7 @@ public:
<< "\t\tconst int esc = rad > " << radius << ";\n"
<< "\t\tconst int cr0 = (int)" << zero << ";\n"
<< "\n"
<< "\t\tif (cr0 && esc)\n"
<< "\t\tif (cr0 && esc)\n"
<< "\t\t{\n"
<< "\t\t vOut.x = vOut.y = 0;\n";

View File

@ -80,6 +80,8 @@ public:
if (!m_Init)
{
//This list is for variation params which are incorrect, but their parent variation name may or may not be correct.
//This has some overlap with the list below since some of these have parent variation names that are incorrect.
m_BadParamNames = unordered_map<string, string>
{
{ "swtin_distort" , "stwin_distort" },//stwin.
@ -215,7 +217,7 @@ public:
"post_rotate_y",
"curl3D_cz",
};
//This is a vector of the param names as they are in the legacy, badly named flam3/Apophysis code.
//This is a vector of the incorrect variation names and their param names as they are in the legacy, badly named flam3/Apophysis code.
vector<string> badParams =
{
"bwraps7_cellsize",