Browse Source

forgot some egg texture check in

Asad M. Zaman 21 years ago
parent
commit
3b59b1d592

+ 5 - 0
panda/src/egg/eggTexture.cxx

@@ -284,10 +284,12 @@ write(ostream &out, int indent_level) const {
 bool EggTexture::
 is_equivalent_to(const EggTexture &other, int eq) const {
   if ((eq & E_complete_filename) == E_complete_filename) {
+    //cout << "compared by filename" << endl;
     if (get_filename() != other.get_filename()) {
       return false;
     }
   } else {
+    //cout << "compared by not complete filename" << endl;
     const Filename &a = get_filename();
     const Filename &b = other.get_filename();
 
@@ -309,6 +311,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
   }
 
   if (eq & E_transform) {
+    //cout << "compared by transform" << endl;
     if (transform_is_identity() != other.transform_is_identity()) {
       return false;
     }
@@ -321,6 +324,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
   }
 
   if (eq & E_attributes) {
+    //cout << "compared by attributes" << endl;
     if (_format != other._format ||
         _wrap_mode != other._wrap_mode ||
         _wrap_u != other._wrap_u ||
@@ -336,6 +340,7 @@ is_equivalent_to(const EggTexture &other, int eq) const {
   }
 
   if (eq & E_tref_name) {
+    //cout << "compared by tref_name" << endl;
     if (get_name() != other.get_name()) {
       return false;
     }

+ 2 - 1
panda/src/egg/eggTextureCollection.cxx

@@ -496,10 +496,11 @@ create_unique_texture(const EggTexture &copy, int eq) {
        ++oti) {
     EggTexture *tex = (*oti);
     if (copy.is_equivalent_to(*tex, eq)) {
+      //cout << "tex:" << tex->get_name() << "---copy:" << copy.get_name() << endl;
       return tex;
     }
   }
-
+  //cout << "adding a texture to collection: " << copy.get_name() << endl;
   EggTexture *new_texture = new EggTexture(copy);
   add_texture(new_texture);
   return new_texture;

+ 0 - 18
panda/src/egg2pg/eggLoader.cxx

@@ -735,12 +735,6 @@ load_textures() {
   EggTextureCollection tc;
   tc.find_used_textures(&_data);
 
-  // Collapse the textures down by filename only.  Should we also
-  // differentiate by attributes?  Maybe.
-  EggTextureCollection::TextureReplacement replace;
-  tc.collapse_equivalent_textures(EggTexture::E_complete_filename,
-                                  replace);
-
   EggTextureCollection::iterator ti;
   for (ti = tc.begin(); ti != tc.end(); ++ti) {
     PT_EggTexture egg_tex = (*ti);
@@ -752,18 +746,6 @@ load_textures() {
       _textures[egg_tex] = def;
     }
   }
-
-  // Finally, associate all of the removed texture references back to
-  // the same pointers as the others.
-  EggTextureCollection::TextureReplacement::const_iterator ri;
-  for (ri = replace.begin(); ri != replace.end(); ++ri) {
-    PT_EggTexture orig = (*ri).first;
-    PT_EggTexture repl = (*ri).second;
-
-    TextureDef &def = _textures[orig];
-    def = _textures[repl];
-    def._egg_tex = orig;
-  }
 }