16 #include "eggGroupUniquifier.h" 26 add_path_replace_options();
27 add_path_store_options();
33 set_program_brief(
"apply transformations and optimizations to an .egg file");
34 set_program_description
35 (
"egg-trans reads an egg file and writes an essentially equivalent " 36 "egg file to the standard output, or to the file specified with -o. " 37 "Some simple operations on the egg file are supported.");
41 "Flatten out transforms.",
42 &EggTrans::dispatch_none, &_flatten_transforms);
46 "Apply texture matrices to UV's.",
47 &EggTrans::dispatch_none, &_apply_texmats);
51 "Collapse equivalent texture references.",
52 &EggTrans::dispatch_none, &_collapse_equivalent_textures);
56 "Clean out degenerate polygons and unused vertices.",
57 &EggTrans::dispatch_none, &_remove_invalid_primitives);
61 "Clean out higher-order polygons by subdividing into triangles.",
62 &EggTrans::dispatch_none, &_triangulate_polygons);
66 "Mesh triangles into triangle strips. This is mainly useful as a " 67 "tool to visualize the work that the mesher will do, since triangles " 68 "are automatically meshed whenever an egg file is loaded. Note that, " 69 "unlike the automatic meshing at load time, you are must ensure that " 70 "you do not start out with multiple triangles with different attributes " 71 "(e.g. texture) together in the same group.",
72 &EggTrans::dispatch_none, &_mesh_triangles);
76 "Standardize and uniquify group names.",
77 &EggTrans::dispatch_none, &_standardize_names);
88 if (_remove_invalid_primitives) {
89 nout <<
"Removing invalid primitives.\n";
90 int num_removed = _data->remove_invalid_primitives(
true);
91 nout <<
" (" << num_removed <<
" removed.)\n";
92 _data->remove_unused_vertices(
true);
95 if (_triangulate_polygons) {
96 nout <<
"Triangulating polygons.\n";
97 int num_produced = _data->triangulate_polygons(~0);
98 nout <<
" (" << num_produced <<
" triangles produced.)\n";
101 if (_mesh_triangles) {
102 nout <<
"Meshing triangles.\n";
103 _data->mesh_triangles(~0);
106 if (_apply_texmats) {
107 nout <<
"Applying texture matrices.\n";
108 _data->apply_texmats();
109 _data->remove_unused_vertices(
true);
112 if (_collapse_equivalent_textures) {
113 nout <<
"Collapsing equivalent textures.\n";
114 int num_removed = _data->collapse_equivalent_textures();
115 nout <<
" (" << num_removed <<
" removed.)\n";
118 if (_flatten_transforms) {
119 nout <<
"Flattening transforms.\n";
120 _data->flatten_transforms();
121 _data->remove_unused_vertices(
true);
124 if (_standardize_names) {
125 nout <<
"Standardizing group names.\n";
130 if (!do_reader_options()) {
138 int main(
int argc,
char *argv[]) {
void add_delod_options(double default_delod=-1.0)
Adds -delod as a valid option for this program.
A program to read an egg file and write an equivalent egg file, possibly performing some minor operat...
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
void add_texture_options()
Adds -td, -te, etc.
This is a specialization of EggNameUniquifier to generate unique names for EggGroup nodes...
void add_normals_options()
Adds -no, -np, etc.
void uniquify(EggNode *node)
Begins the traversal from the indicated node.
void write_egg_file()
Writes out the egg file as the normal result of the program.
void add_transform_options()
Adds -TS, -TT, etc.