Browse Source

call remove_unused_vertices() after recomputing tbn

David Rose 20 years ago
parent
commit
e53f8c7ae4
1 changed files with 11 additions and 3 deletions
  1. 11 3
      pandatool/src/eggbase/eggWriter.cxx

+ 11 - 3
pandatool/src/eggbase/eggWriter.cxx

@@ -139,23 +139,25 @@ post_process_egg_file() {
     _data->transform(_transform);
     _data->transform(_transform);
   }
   }
 
 
+  bool needs_remove = false;
+
   switch (_normals_mode) {
   switch (_normals_mode) {
   case NM_strip:
   case NM_strip:
     nout << "Stripping normals.\n";
     nout << "Stripping normals.\n";
     _data->strip_normals();
     _data->strip_normals();
-    _data->remove_unused_vertices(true);
+    needs_remove = true;
     break;
     break;
 
 
   case NM_polygon:
   case NM_polygon:
     nout << "Recomputing polygon normals.\n";
     nout << "Recomputing polygon normals.\n";
     _data->recompute_polygon_normals();
     _data->recompute_polygon_normals();
-    _data->remove_unused_vertices(true);
+    needs_remove = true;
     break;
     break;
 
 
   case NM_vertex:
   case NM_vertex:
     nout << "Recomputing vertex normals.\n";
     nout << "Recomputing vertex normals.\n";
     _data->recompute_vertex_normals(_normals_threshold);
     _data->recompute_vertex_normals(_normals_threshold);
-    _data->remove_unused_vertices(true);
+    needs_remove = true;
     break;
     break;
 
 
   case NM_preserve:
   case NM_preserve:
@@ -166,6 +168,7 @@ post_process_egg_file() {
   if (_got_tbnall) {
   if (_got_tbnall) {
     nout << "Computing tangent and binormal for all UV sets.\n";
     nout << "Computing tangent and binormal for all UV sets.\n";
     _data->recompute_tangent_binormal(GlobPattern("*"));
     _data->recompute_tangent_binormal(GlobPattern("*"));
+    needs_remove = true;
 
 
   } else {
   } else {
     for (vector_string::const_iterator si = _tbn_names.begin();
     for (vector_string::const_iterator si = _tbn_names.begin();
@@ -174,8 +177,13 @@ post_process_egg_file() {
       GlobPattern uv_name(*si);
       GlobPattern uv_name(*si);
       nout << "Computing tangent and binormal for \"" << uv_name << "\"\n";
       nout << "Computing tangent and binormal for \"" << uv_name << "\"\n";
       _data->recompute_tangent_binormal(uv_name);
       _data->recompute_tangent_binormal(uv_name);
+      needs_remove = true;
     }
     }
   }
   }
+
+  if (needs_remove) {
+    _data->remove_unused_vertices(true);
+  }
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////