mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 21:20:07 -05:00
8a4127d5d7
-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.
77 lines
2.8 KiB
C++
77 lines
2.8 KiB
C++
#pragma once
|
|
|
|
#include "Utils.h"
|
|
#include "PaletteList.h"
|
|
#include "VariationList.h"
|
|
#include "Ember.h"
|
|
|
|
#ifdef __APPLE__
|
|
#include <libgen.h>
|
|
#endif
|
|
|
|
/// <summary>
|
|
/// XmlToEmber and Locale classes.
|
|
/// </summary>
|
|
|
|
namespace EmberNs
|
|
{
|
|
/// <summary>
|
|
/// Convenience class for setting and resetting the locale.
|
|
/// It's set up in the constructor and restored in the destructor.
|
|
/// This relieves the caller of having to manually do it everywhere.
|
|
/// </summary>
|
|
class EMBER_API Locale
|
|
{
|
|
public:
|
|
Locale(int category = LC_NUMERIC, const char* loc = "C");
|
|
~Locale();
|
|
|
|
private:
|
|
int m_Category;
|
|
string m_NewLocale;
|
|
string m_OriginalLocale;
|
|
};
|
|
|
|
/// <summary>
|
|
/// Class for reading Xml files into ember objects.
|
|
/// This class derives from EmberReport, so the caller is able
|
|
/// to retrieve a text dump of error information if any errors occur.
|
|
/// Since this class contains a VariationList object, it's important to declare one
|
|
/// instance and reuse it for the duration of the program instead of creating and deleting
|
|
/// them as local variables.
|
|
/// Template argument expected to be float or double.
|
|
/// </summary>
|
|
template <typename T>
|
|
class EMBER_API XmlToEmber : public EmberReport
|
|
{
|
|
public:
|
|
XmlToEmber();
|
|
template <typename Alloc, template <typename, typename> class C>
|
|
bool Parse(byte* buf, const char* filename, C<Ember<T>, Alloc>& embers, bool useDefaults = true);
|
|
template <typename Alloc, template <typename, typename> class C>
|
|
bool Parse(const char* filename, C<Ember<T>, Alloc>& embers, bool useDefaults = true);
|
|
template <typename valT>
|
|
bool Aton(const char* str, valT& val);
|
|
static vector<string> m_FlattenNames;
|
|
|
|
private:
|
|
template <typename Alloc, template <typename, typename> class C>
|
|
void ScanForEmberNodes(xmlNode* curNode, char* parentFile, C<Ember<T>, Alloc>& embers, bool useDefaults);
|
|
bool ParseEmberElement(xmlNode* emberNode, Ember<T>& currentEmber);
|
|
bool AttToEmberMotionFloat(xmlAttrPtr att, const char* attStr, eEmberMotionParam param, EmberMotion<T>& motion);
|
|
bool ParseXform(xmlNode* childNode, Xform<T>& xform, bool motion, bool fromEmber);
|
|
static string GetCorrectedParamName(const unordered_map<string, string>& names, const char* name);
|
|
static string GetCorrectedVariationName(vector<pair<pair<string, string>, vector<string>>>& vec, xmlAttrPtr att);
|
|
static bool XmlContainsTag(xmlAttrPtr att, const char* name);
|
|
bool ParseHexColors(char* colstr, Ember<T>& ember, size_t numColors, intmax_t chan);
|
|
template <typename valT>
|
|
bool ParseAndAssign(const xmlChar* name, const char* attStr, const char* str, valT& val, bool& b);
|
|
|
|
static bool m_Init;
|
|
static unordered_map<string, string> m_BadParamNames;
|
|
static vector<pair<pair<string, string>, vector<string>>> m_BadVariationNames;
|
|
shared_ptr<VariationList<T>> m_VariationList;//The variation list used to make copies of variations to populate the embers with.
|
|
PaletteList<T> m_PaletteList;
|
|
};
|
|
}
|