add -tbnall

This commit is contained in:
David Rose 2005-08-02 22:53:39 +00:00
parent ff51585276
commit 2362924423
3 changed files with 20 additions and 9 deletions

View File

@ -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);
}
////////////////////////////////////////////////////////////////////

View File

@ -67,6 +67,7 @@ protected:
NormalsMode _normals_mode;
double _normals_threshold;
vector_string _tbn_names;
bool _got_tbnall;
bool _got_transform;
LMatrix4d _transform;

View File

@ -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);
}
}
}