--User changes

Implement copying and pasting xforms between flames.

--Code changes
 Make palette filename be a shared_ptr<string> to avoid duplication.
 Ensure random seeds in RendererCL have no duplicates and are not zero.
This commit is contained in:
mfeemster
2015-05-19 19:31:33 -07:00
parent 48ccce69f6
commit cb54605878
9 changed files with 106 additions and 8 deletions

View File

@ -87,6 +87,7 @@ public:
m4T ToMat4ColMajor(bool center = false) const;
m4T ToMat4RowMajor(bool center = false) const;
//Note that returning a copy is actually faster than a const ref&.
T A() const;
T B() const;
T C() const;

View File

@ -578,7 +578,7 @@ public:
int m_Index;//Index in the xml palette file of this palette, use -1 for random.
string m_Name;//Name of this palette.
string m_Filename;//Name of the parent file this palette came from, can be empty.
shared_ptr<string> m_Filename;//Name of the parent file this palette came from, can be empty.
vector<v4T> m_Entries;//Storage for the color values.
};
}

View File

@ -51,11 +51,12 @@ public:
if (doc != nullptr)
{
xmlNode* rootNode = xmlDocGetRootElement(doc);
auto rootNode = xmlDocGetRootElement(doc);
auto pfilename = shared_ptr<string>(new string(filename));
palettes.clear();
palettes.reserve(buf.size() / 2048);//Roughly what it takes per palette.
ParsePalettes(rootNode, filename, palettes);
ParsePalettes(rootNode, pfilename, palettes);
xmlFreeDoc(doc);
added = true;
}
@ -226,7 +227,7 @@ private:
/// <param name="node">The parent note of all palettes in the Xml file.</param>
/// <param name="filename">The name of the Xml file.</param>
/// <param name="palettes">The vector to store the paresed palettes associated with this file in.</param>
void ParsePalettes(xmlNode* node, const string& filename, vector<Palette<T>>& palettes)
void ParsePalettes(xmlNode* node, const shared_ptr<string>& filename, vector<Palette<T>>& palettes)
{
bool hexError = false;
char* val;