浏览代码

Added new command line option: -tbnauto

Josh Yelon 18 年之前
父节点
当前提交
be97920b58

+ 6 - 0
pandatool/src/eggbase/eggBase.cxx

@@ -43,6 +43,7 @@ EggBase() {
   _normals_threshold = 0.0;
 
   _got_tbnall = false;
+  _got_tbnauto = false;
 
   _got_transform = false;
   _transform = LMatrix4d::ident_mat();
@@ -105,6 +106,11 @@ add_normals_options() {
      "Compute tangent and binormal for all texture coordinate "
      "sets.  This is equivalent to -tbn \"*\".",
      &EggBase::dispatch_none, &_got_tbnall);
+
+  add_option
+    ("tbnauto", "", 48,
+     "Compute tangent and binormal for all normal maps. ",
+     &EggBase::dispatch_none, &_got_tbnauto);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
pandatool/src/eggbase/eggBase.h

@@ -68,6 +68,7 @@ protected:
   double _normals_threshold;
   vector_string _tbn_names;
   bool _got_tbnall;
+  bool _got_tbnauto;
 
   bool _got_transform;
   LMatrix4d _transform;

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

@@ -166,19 +166,12 @@ post_process_egg_file() {
   }
 
   if (_got_tbnall) {
-    nout << "Computing tangent and binormal for all UV sets.\n";
-    _data->recompute_tangent_binormal(GlobPattern("*"));
-    needs_remove = true;
-
+    needs_remove |= _data->recompute_tangent_binormal(GlobPattern("*"));
   } else {
-    for (vector_string::const_iterator si = _tbn_names.begin();
-         si != _tbn_names.end();
-         ++si) {
-      GlobPattern uv_name(*si);
-      nout << "Computing tangent and binormal for \"" << uv_name << "\"\n";
-      _data->recompute_tangent_binormal(uv_name);
-      needs_remove = true;
+    if (_got_tbnauto) {
+      needs_remove |= _data->recompute_tangent_binormal_auto();
     }
+    needs_remove |= _data->recompute_tangent_binormal(_tbn_names);
   }
 
   if (needs_remove) {

+ 1 - 0
pandatool/src/mayaprogs/mayaToEgg.cxx

@@ -147,6 +147,7 @@ MayaToEgg() :
   _verbose = 0;
   _polygon_tolerance = 0.01;
   _transform_type = MayaToEggConverter::TT_model;
+  _got_tbnauto = true;
 }
 
 ////////////////////////////////////////////////////////////////////