From 236292442340fc86f17b39942e4f28fe654f877a Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 2 Aug 2005 22:53:39 +0000 Subject: [PATCH] add -tbnall --- pandatool/src/eggbase/eggBase.cxx | 10 +++++++--- pandatool/src/eggbase/eggBase.h | 1 + pandatool/src/eggbase/eggWriter.cxx | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/pandatool/src/eggbase/eggBase.cxx b/pandatool/src/eggbase/eggBase.cxx index a6ff6c0475..8736412203 100644 --- a/pandatool/src/eggbase/eggBase.cxx +++ b/pandatool/src/eggbase/eggBase.cxx @@ -91,14 +91,18 @@ add_normals_options() { add_option ("tbn", "name", 48, "Compute tangent and binormal for the named texture coordinate " - "set(s). The name may include wildcard characters such as * and ?; " - "use \"*\" to recompute tangent and binormal for all texture coordinate " - "sets. " + "set(s). The name may include wildcard characters such as * and ?. " "The normal must already exist or have been computed via one of the " "above options. The tangent and binormal are used to implement " "bump mapping and related texture-based lighting effects. This option " "may be repeated as necessary to name multiple texture coordinate sets.", &EggBase::dispatch_vector_string, NULL, &_tbn_names); + + add_option + ("tbnall", "", 48, + "Compute tangent and binormal for all texture coordinate " + "set(s). This is equivalent to -tbn \"*\".", + &EggBase::dispatch_none, &_got_tbnall); } //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/eggbase/eggBase.h b/pandatool/src/eggbase/eggBase.h index e870fd0b5a..213bfe2974 100644 --- a/pandatool/src/eggbase/eggBase.h +++ b/pandatool/src/eggbase/eggBase.h @@ -67,6 +67,7 @@ protected: NormalsMode _normals_mode; double _normals_threshold; vector_string _tbn_names; + bool _got_tbnall; bool _got_transform; LMatrix4d _transform; diff --git a/pandatool/src/eggbase/eggWriter.cxx b/pandatool/src/eggbase/eggWriter.cxx index a302122fe3..ebe4a8d382 100644 --- a/pandatool/src/eggbase/eggWriter.cxx +++ b/pandatool/src/eggbase/eggWriter.cxx @@ -163,12 +163,18 @@ post_process_egg_file() { break; } - 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); + if (_got_tbnall) { + nout << "Computing tangent and binormal for all UV sets.\n"; + _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); + } } }