diff --git a/panda/src/egg/Sources.pp b/panda/src/egg/Sources.pp index fe1d1623ff..79665ca1f3 100644 --- a/panda/src/egg/Sources.pp +++ b/panda/src/egg/Sources.pp @@ -23,7 +23,9 @@ eggMaterialCollection.I eggMaterialCollection.cxx \ eggMaterialCollection.h \ eggMiscFuncs.I \ - eggMiscFuncs.cxx eggMiscFuncs.h eggNamedObject.I eggNamedObject.cxx \ + eggMiscFuncs.cxx eggMiscFuncs.h \ + eggMorph.I eggMorph.h eggMorphList.I eggMorphList.h \ + eggNamedObject.I eggNamedObject.cxx \ eggNamedObject.h eggNameUniquifier.cxx eggNameUniquifier.h \ eggNode.I eggNode.cxx eggNode.h eggNurbsCurve.I \ eggNurbsCurve.cxx eggNurbsCurve.h eggNurbsSurface.I \ diff --git a/panda/src/egg/eggMorph.h b/panda/src/egg/eggMorph.h index be58bdf097..67b2ca8938 100644 --- a/panda/src/egg/eggMorph.h +++ b/panda/src/egg/eggMorph.h @@ -53,11 +53,6 @@ INLINE ostream &operator << (ostream &out, const EggMorphColor &m); // operator again. //INLINE ostream &operator << (ostream &out, const EggMorphNormal &m); -typedef set EggMorphVertices; -typedef set EggMorphNormals; -typedef set EggMorphTexCoords; -typedef set EggMorphColors; - #include "eggMorph.I" #endif diff --git a/panda/src/egg/eggMorphList.I b/panda/src/egg/eggMorphList.I index 1559a10db7..9402d10196 100644 --- a/panda/src/egg/eggMorphList.I +++ b/panda/src/egg/eggMorphList.I @@ -5,6 +5,37 @@ #include +//////////////////////////////////////////////////////////////////// +// Function: EggMorphList::insert +// Access: Public +// Description: This is similar to the insert() interface for sets, +// except it does not guarantee that the resulting list +// is sorted. +// +// We have this member function so the EggMorphList +// resembles a set. It used to *be* a set, but we +// cannot export STL sets from a Windows DLL. +//////////////////////////////////////////////////////////////////// +template +pair::iterator, bool> EggMorphList:: +insert(const MorphType &value) { + pair result; + iterator i; + for (i = begin(); i != end(); ++i) { + if ((*i) == value) { + // This value is already present. + result.first = i; + result.second = false; + return result; + } + } + + // This value is not already present; add it to the list. + push_back(value); + result.first = begin() + size() - 1; + result.second = true; + return result; +} //////////////////////////////////////////////////////////////////// // Function: EggMorphList::write diff --git a/panda/src/egg/eggMorphList.h b/panda/src/egg/eggMorphList.h index c5d4682975..0a9a397949 100644 --- a/panda/src/egg/eggMorphList.h +++ b/panda/src/egg/eggMorphList.h @@ -10,18 +10,30 @@ #include "eggMorph.h" -#include +#include //////////////////////////////////////////////////////////////////// // Class : EggMorphList // Description : A collection of 's or 's or some such. //////////////////////////////////////////////////////////////////// template -class EggMorphList : public set { +class EggMorphList : public vector { public: + pair insert(const MorphType &value); void write(ostream &out, int indent_level) const; }; + +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector) + +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList) + typedef EggMorphList EggMorphVertexList; typedef EggMorphList EggMorphNormalList; typedef EggMorphList EggMorphTexCoordList;