David Rose 25 лет назад
Родитель
Сommit
1883b289f5
4 измененных файлов с 48 добавлено и 8 удалено
  1. 3 1
      panda/src/egg/Sources.pp
  2. 0 5
      panda/src/egg/eggMorph.h
  3. 31 0
      panda/src/egg/eggMorphList.I
  4. 14 2
      panda/src/egg/eggMorphList.h

+ 3 - 1
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 \

+ 0 - 5
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<EggMorphVertex> EggMorphVertices;
-typedef set<EggMorphNormal> EggMorphNormals;
-typedef set<EggMorphTexCoord> EggMorphTexCoords;
-typedef set<EggMorphColor> EggMorphColors;
-
 #include "eggMorph.I"
 
 #endif

+ 31 - 0
panda/src/egg/eggMorphList.I

@@ -5,6 +5,37 @@
 
 #include <indent.h>
 
+////////////////////////////////////////////////////////////////////
+//     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<class MorphType>
+pair<EggMorphList<MorphType>::iterator, bool> EggMorphList<MorphType>::
+insert(const MorphType &value) {
+  pair<iterator, bool> 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

+ 14 - 2
panda/src/egg/eggMorphList.h

@@ -10,18 +10,30 @@
 
 #include "eggMorph.h"
 
-#include <set>
+#include <vector>
 
 ////////////////////////////////////////////////////////////////////
 // 	 Class : EggMorphList
 // Description : A collection of <Dxyz>'s or <Duv>'s or some such.
 ////////////////////////////////////////////////////////////////////
 template<class MorphType>
-class EggMorphList : public set<MorphType> {
+class EggMorphList : public vector<MorphType> {
 public:
+  pair<iterator, bool> insert(const MorphType &value);
   void write(ostream &out, int indent_level) const;
 };
 
+
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector<EggMorphVertex>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector<EggMorphNormal>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector<EggMorphTexCoord>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, std::vector<EggMorphColor>)
+
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList<EggMorphVertex>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList<EggMorphNormal>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList<EggMorphTexCoord>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList<EggMorphColor>)
+
 typedef EggMorphList<EggMorphVertex> EggMorphVertexList;
 typedef EggMorphList<EggMorphNormal> EggMorphNormalList;
 typedef EggMorphList<EggMorphTexCoord> EggMorphTexCoordList;