Fix bug when using rotation with strips by adding a new member to Ember named m_RotCenterY which is a copy of the original center value since the center value gets changed when using strips.

Change PaletteList Count() member to Size() to be consistent with other code.

Remove PaletteImage option, it's unused. Improve documentation for some other options.

Make ComposePath() always return a unique string.

Add Random Palette and Random Adjustment buttons.

Another attempt at solving the locale bug with the affine adjustment combo boxes.
This commit is contained in:
mfeemster
2014-10-27 14:21:06 -07:00
parent 2a98e8c05b
commit 6b2b6ede7f
19 changed files with 440 additions and 375 deletions

View File

@ -108,6 +108,7 @@ public:
m_CamMat = ember.m_CamMat;
m_CenterX = T(ember.m_CenterX);
m_CenterY = T(ember.m_CenterY);
m_RotCenterY = T(ember.m_RotCenterY);
m_Rotate = T(ember.m_Rotate);
m_Hue = T(ember.m_Hue);
m_Brightness = T(ember.m_Brightness);
@ -201,6 +202,7 @@ public:
m_CamMat = m3T(0);
m_CenterX = 0;
m_CenterY = 0;
m_RotCenterY = 0;
m_Rotate = 0;
m_Hue = 0;
m_Brightness = 4;
@ -761,6 +763,7 @@ public:
InterpI<&Ember<T>::m_Supersample>(embers, coefs, size);
InterpT<&Ember<T>::m_CenterX>(embers, coefs, size);
InterpT<&Ember<T>::m_CenterY>(embers, coefs, size);
InterpT<&Ember<T>::m_RotCenterY>(embers, coefs, size);
InterpX<Color<T>, &Ember<T>::m_Background>(embers, coefs, size); m_Background.a = bgAlphaSave;//Don't interp alpha.
InterpT<&Ember<T>::m_PixelsPerUnit>(embers, coefs, size);
InterpT<&Ember<T>::m_SpatialFilterRadius>(embers, coefs, size);
@ -1269,6 +1272,7 @@ public:
m_Palette.m_Index = -1;
m_CenterX = 0;
m_CenterY = 0;
m_RotCenterY = 0;
m_Gamma = 4;
m_Vibrancy = 1;
m_Brightness = 4;
@ -1392,6 +1396,7 @@ public:
<< "Depth Blur: " << m_CamDepthBlur << endl
<< "CenterX: " << m_CenterX << endl
<< "CenterY: " << m_CenterY << endl
<< "RotCenterY: " << m_RotCenterY << endl
<< "Rotate: " << m_Rotate << endl
<< "Hue: " << m_Hue << endl
<< "Brightness: " << m_Brightness << endl
@ -1523,10 +1528,11 @@ public:
m3T m_CamMat;
//The camera offset from the center of the cartesian plane. Since this is the camera offset, the final output image will be moved in the opposite
//direction of the values specified.
//direction of the values specified. There is also a second copy of the Y coordinate needed because m_CenterY will be modified during strips rendering.
//Xml field: "center".
T m_CenterX;
T m_CenterY;
T m_RotCenterY;
//Rotate the camera by this many degrees. Since this is a camera rotation, the final output image will be rotated counter-clockwise.
//Xml field: "rotate".

View File

@ -100,9 +100,10 @@ public:
}
/// <summary>
/// Return the next random integer between 0 and the value passed in.
/// Return the next random integer between 0 and the value passed in minus 1.
/// </summary>
/// <returns>A value one greater than the maximum value that will be returned</returns>
/// <param name="upper">A value one greater than the maximum value that will be returned</param>
/// <returns>A value between 0 and the value passed in minus 1</returns>
inline T Rand(T upper)
{
return (upper == 0) ? Rand() : Rand() % upper;

View File

@ -80,7 +80,7 @@ public:
if (!m_Palettes.empty())
{
if (i == -1)
return &m_Palettes[QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Rand() % Count()];
return &m_Palettes[QTIsaac<ISAAC_SIZE, ISAAC_INT>::GlobalRand->Rand() % Size()];
else if (i < (int)m_Palettes.size())
return &m_Palettes[i];
}
@ -95,7 +95,7 @@ public:
/// <returns>A pointer to the palette if found, else nullptr</returns>
Palette<T>* GetPaletteByName(const string&& name)
{
for (unsigned int i = 0; i < Count(); i++)
for (unsigned int i = 0; i < Size(); i++)
if (m_Palettes[i].m_Name == name)
return &m_Palettes[i];
@ -136,7 +136,7 @@ public:
/// Accessors.
/// </summary>
bool Init() { return m_Init; }
unsigned int Count() { return (unsigned int)m_Palettes.size(); }
size_t Size() { return m_Palettes.size(); }
private:
/// <summary>

View File

@ -459,6 +459,7 @@ eRenderStatus Renderer<T, bucketT>::Run(vector<unsigned char>& finalImage, doubl
//it.Tic();
if (m_Embers.size() > 1)
Interpolater<T>::Interpolate(m_Embers, temporalTime, 0, m_Ember);//This will perform all necessary precalcs via the ember/xform/variation assignment operators.
//it.Toc("Interp 3");
if (!resume && !AssignIterator())
@ -1478,10 +1479,10 @@ void Renderer<T, bucketT>::Accumulate(Point<T>* samples, size_t sampleCount, con
if (Rotate() != 0)
{
T p00 = samples[i].m_X - CenterX();
T p11 = samples[i].m_Y - CenterY();
T p11 = samples[i].m_Y - m_Ember.m_RotCenterY;
samples[i].m_X = (p00 * m_RotMat.A()) + (p11 * m_RotMat.B()) + CenterX();
samples[i].m_Y = (p00 * m_RotMat.D()) + (p11 * m_RotMat.E()) + CenterY();
samples[i].m_Y = (p00 * m_RotMat.D()) + (p11 * m_RotMat.E()) + m_Ember.m_RotCenterY;
}
//Checking this first before converting gives better performance than converting and checking a single value, which the original did.

View File

@ -655,7 +655,7 @@ private:
}
currentEmber.m_CenterX = T(vals[0]);
currentEmber.m_CenterY = T(vals[1]);
currentEmber.m_CenterY = currentEmber.m_RotCenterY = T(vals[1]);
}
else if (!Compare(curAtt->name, "filter_shape"))
{