mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-15 20:54:53 -04:00
--User changes
-Add a palette editor. -Add support for reading .ugr/.gradient/.gradients palette files. -Allow toggling on spinners whose minimum value is not zero. -Allow toggling display of image, affines and grid. -Add new variations: cylinder2, circlesplit, tile_log, truchet_fill, waves2_radial. --Bug fixes -cpow2 was wrong. -Palettes with rapid changes in color would produce slightly different outputs from Apo/Chaotica. This was due to a long standing bug from flam3. -Use exec() on Apple and show() on all other OSes for dialog boxes. -Trying to render a sequence with no frames would crash. -Selecting multiple xforms and rotating them would produce the wrong rotation. -Better handling when parsing flames using different encoding, such as unicode and UTF-8. -Switching between SP/DP didn't reselect the selected flame in the Library tab. --Code changes -Make all types concerning palettes be floats, including PaletteTableWidgetItem. -PaletteTableWidgetItem is no longer templated because all palettes are float. -Include the source colors for user created gradients. -Change parallel_for() calls to work with very old versions of TBB which are lingering on some systems. -Split conditional out of accumulation loop on the CPU for better performance. -Vectorize summing when doing density filter for better performance. -Make all usage of palettes be of type float, double is pointless. -Allow palettes to reside in multiple folders, while ensuring only one of each name is added. -Refactor some palette path searching code. -Make ReadFile() throw and catch an exception if the file operation fails. -A little extra safety in foci and foci3D with a call to Zeps(). -Cast to (real_t) in the OpenCL string for the w variation, which was having trouble compiling on Mac. -Fixing missing comma between paths in InitPaletteList(). -Move Xml and PaletteList classes into cpp to shorten build times when working on them. -Remove default param values for IterOpenCLKernelCreator<T>::SharedDataIndexDefines in cpp file. -Change more NULL to nullptr.
This commit is contained in:
@ -13,6 +13,9 @@ namespace EmberNs
|
||||
/// The palette stores a set of 256 colors which are what get accumulated to the histogram
|
||||
/// for each iteration. The colors come from either the main palette Xml file or directly
|
||||
/// from the ember parameter file. Either way, they come in as 0-255 and get normalized to 0-1.
|
||||
/// The palette may have also come from a palette editor where the user specifies key colors, then
|
||||
/// those are interpolated to make a smooth palette. In that case, the m_SourceColors map will
|
||||
/// be populated.
|
||||
/// In the future, 2D palette support might be added in which case this class will have to be modified.
|
||||
/// Template argument expected to be float or double.
|
||||
/// </summary>
|
||||
@ -90,13 +93,27 @@ public:
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
m_Entries[i].a = T(palette15[i * 4 + 0]);
|
||||
m_Entries[i].r = T(palette15[i * 4 + 1]);
|
||||
m_Entries[i].g = T(palette15[i * 4 + 2]);
|
||||
m_Entries[i].b = T(palette15[i * 4 + 3]);
|
||||
m_Entries[i].r = T(palette15[i * 4 + 1]) / T(255);
|
||||
m_Entries[i].g = T(palette15[i * 4 + 2]) / T(255);
|
||||
m_Entries[i].b = T(palette15[i * 4 + 3]) / T(255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor which takes the vector of colors as well as the source colors which were
|
||||
/// used to create it in a palette editor. The burden is on the user to not let the two get out of sync.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the palette</param>
|
||||
/// <param name="entries">A vector of color entries</param>
|
||||
/// <param name="sourceColors">A map of colors which was used to create entries in a palette editor</param>
|
||||
Palette(const string& name, vector<v4T>& entries, map<T, v4T>& sourceColors)
|
||||
{
|
||||
m_Name = name;
|
||||
m_Entries = entries;
|
||||
m_SourceColors = sourceColors;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default copy constructor.
|
||||
/// </summary>
|
||||
@ -145,6 +162,11 @@ public:
|
||||
m_Name = palette.m_Name;
|
||||
m_Filename = palette.m_Filename;
|
||||
CopyCont(m_Entries, palette.m_Entries);
|
||||
m_SourceColors.clear();
|
||||
|
||||
for (auto& kv : palette.m_SourceColors)
|
||||
m_SourceColors[T(kv.first)] = v4T(kv.second);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -183,6 +205,13 @@ public:
|
||||
/// <returns>The size of the color entries vector</returns>
|
||||
size_t Size() { return m_Entries.size(); }
|
||||
|
||||
/// <summary>
|
||||
/// The size of the source color entries vector which was used to create the palette.
|
||||
/// Note this will only be non-zero if this palette was created in the palette editor.
|
||||
/// </summary>
|
||||
/// <returns>The size of the source colors map</returns>
|
||||
size_t SourceColorSize() { return m_SourceColors.size(); }
|
||||
|
||||
/// <summary>
|
||||
/// Set all colors to either black or white, including the alpha channel.
|
||||
/// </summary>
|
||||
@ -585,5 +614,6 @@ public:
|
||||
string m_Name = "-";//Name of this palette.
|
||||
shared_ptr<string> m_Filename;//Name of the parent file this palette came from, can be empty.
|
||||
vector<v4T> m_Entries;
|
||||
map<T, v4T> m_SourceColors;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user