31 (
"cs",
"coordinate-system", 80,
32 "Specify the coordinate system to operate in. This may be one of "
33 "'y-up', 'z-up', 'y-up-left', or 'z-up-left'.",
34 &EggBase::dispatch_coordinate_system,
35 &_got_coordinate_system, &_coordinate_system);
37 _normals_mode = NM_preserve;
38 _normals_threshold = 0.0;
44 _got_transform =
false;
45 _transform = LMatrix4d::ident_mat();
47 _got_coordinate_system =
false;
48 _coordinate_system = CS_yup_right;
60 static NormalsMode strip = NM_strip;
61 static NormalsMode polygon = NM_polygon;
62 static NormalsMode vertex = NM_vertex;
63 static NormalsMode preserve = NM_preserve;
68 &EggBase::dispatch_normals,
nullptr, &strip);
72 "Strip existing normals and redefine polygon normals.",
73 &EggBase::dispatch_normals,
nullptr, &polygon);
76 (
"nv",
"threshold", 48,
77 "Strip existing normals and redefine vertex normals. Consider an edge "
78 "between adjacent polygons to be smooth if the angle between them "
79 "is less than threshold degrees.",
80 &EggBase::dispatch_normals,
nullptr, &vertex);
84 "Preserve normals exactly as they are. This is the default.",
85 &EggBase::dispatch_normals,
nullptr, &preserve);
89 "Compute tangent and binormal for the named texture coordinate "
90 "set(s). The name may include wildcard characters such as * and ?. "
91 "The normal must already exist or have been computed via one of the "
92 "above options. The tangent and binormal are used to implement "
93 "bump mapping and related texture-based lighting effects. This option "
94 "may be repeated as necessary to name multiple texture coordinate sets.",
95 &EggBase::dispatch_vector_string,
nullptr, &_tbn_names);
99 "Compute tangent and binormal for all texture coordinate "
100 "sets. This is equivalent to -tbn \"*\".",
101 &EggBase::dispatch_none, &_got_tbnall);
105 "Compute tangent and binormal for all normal maps. ",
106 &EggBase::dispatch_none, &_got_tbnauto);
116 "Construct <PointLight> entries for any unreferenced vertices, to make them visible.",
117 &EggBase::dispatch_none, &_make_points);
128 (
"TS",
"sx[,sy,sz]", 49,
129 "Scale the model uniformly by the given factor (if only one number "
130 "is given) or in each axis by sx, sy, sz (if three numbers are given).",
131 &EggBase::dispatch_scale, &_got_transform, &_transform);
135 "Rotate the model x degrees about the x axis, then y degrees about the "
136 "y axis, and then z degrees about the z axis.",
137 &EggBase::dispatch_rotate_xyz, &_got_transform, &_transform);
140 (
"TA",
"angle,x,y,z", 49,
141 "Rotate the model angle degrees counterclockwise about the given "
143 &EggBase::dispatch_rotate_axis, &_got_transform, &_transform);
147 "Translate the model by the indicated amount.\n\n"
148 "All transformation options (-TS, -TR, -TA, -TT) are cumulative and are "
149 "applied in the order they are encountered on the command line.",
150 &EggBase::dispatch_translate, &_got_transform, &_transform);
160 if (node->
is_of_type(EggTexture::get_class_type())) {
165 egg_tex->set_filename(outpath);
169 Filename alpha_fullpath, alpha_outpath;
171 alpha_fullpath, alpha_outpath);
176 }
else if (node->
is_of_type(EggFilenameNode::get_class_type())) {
182 egg_fnode->set_filename(outpath);
185 }
else if (node->
is_of_type(EggGroupNode::get_class_type())) {
187 EggGroupNode::const_iterator ci;
188 for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) {
202 append_command_comment(
EggData *data) {
214 append_command_comment(
EggData *data,
const string &comment) {
215 data->insert(data->begin(),
new EggComment(
"", comment));
224 dispatch_normals(
ProgramBase *
self,
const string &opt,
const string &arg,
void *mode) {
226 return base->ns_dispatch_normals(opt, arg, mode);
235 ns_dispatch_normals(
const string &opt,
const string &arg,
void *mode) {
236 _normals_mode = *(NormalsMode *)mode;
238 if (_normals_mode == NM_vertex) {
240 nout <<
"Invalid numeric parameter for -" << opt <<
": "
253 dispatch_scale(
const string &opt,
const string &arg,
void *var) {
254 LMatrix4d *transform = (LMatrix4d *)var;
262 if (words.size() == 3) {
268 }
else if (words.size() == 1) {
276 <<
" requires one or three numbers separated by commas.\n";
280 *transform = (*transform) * LMatrix4d::scale_mat(sx, sy, sz);
290 dispatch_rotate_xyz(
ProgramBase *
self,
const string &opt,
const string &arg,
void *var) {
292 return base->ns_dispatch_rotate_xyz(opt, arg, var);
300 ns_dispatch_rotate_xyz(
const string &opt,
const string &arg,
void *var) {
301 LMatrix4d *transform = (LMatrix4d *)var;
309 if (words.size() == 3) {
318 <<
" requires three numbers separated by commas.\n";
323 LMatrix4d::rotate_mat(xyz[0], LVector3d(1.0, 0.0, 0.0), _coordinate_system) *
324 LMatrix4d::rotate_mat(xyz[1], LVector3d(0.0, 1.0, 0.0), _coordinate_system) *
325 LMatrix4d::rotate_mat(xyz[2], LVector3d(0.0, 0.0, 1.0), _coordinate_system);
327 *transform = (*transform) * mat;
337 dispatch_rotate_axis(
ProgramBase *
self,
const string &opt,
const string &arg,
void *var) {
339 return base->ns_dispatch_rotate_axis(opt, arg, var);
347 ns_dispatch_rotate_axis(
const string &opt,
const string &arg,
void *var) {
348 LMatrix4d *transform = (LMatrix4d *)var;
357 if (words.size() == 4) {
367 <<
" requires four numbers separated by commas.\n";
371 *transform = (*transform) * LMatrix4d::rotate_mat(angle, axis, _coordinate_system);
380 dispatch_translate(
const string &opt,
const string &arg,
void *var) {
381 LMatrix4d *transform = (LMatrix4d *)var;
389 if (words.size() == 3) {
398 <<
" requires three numbers separated by commas.\n";
402 *transform = (*transform) * LMatrix4d::translate_mat(trans);