22 add_path_replace_options();
23 add_path_store_options();
29 set_program_brief(
"apply transformations and optimizations to an .egg file");
30 set_program_description
31 (
"egg-trans reads an egg file and writes an essentially equivalent " 32 "egg file to the standard output, or to the file specified with -o. " 33 "Some simple operations on the egg file are supported.");
37 "Flatten out transforms.",
38 &EggTrans::dispatch_none, &_flatten_transforms);
42 "Apply texture matrices to UV's.",
43 &EggTrans::dispatch_none, &_apply_texmats);
47 "Collapse equivalent texture references.",
48 &EggTrans::dispatch_none, &_collapse_equivalent_textures);
52 "Clean out degenerate polygons and unused vertices.",
53 &EggTrans::dispatch_none, &_remove_invalid_primitives);
57 "Clean out higher-order polygons by subdividing into triangles.",
58 &EggTrans::dispatch_none, &_triangulate_polygons);
62 "Mesh triangles into triangle strips. This is mainly useful as a " 63 "tool to visualize the work that the mesher will do, since triangles " 64 "are automatically meshed whenever an egg file is loaded. Note that, " 65 "unlike the automatic meshing at load time, you are must ensure that " 66 "you do not start out with multiple triangles with different attributes " 67 "(e.g. texture) together in the same group.",
68 &EggTrans::dispatch_none, &_mesh_triangles);
72 "Standardize and uniquify group names.",
73 &EggTrans::dispatch_none, &_standardize_names);
82 if (_remove_invalid_primitives) {
83 nout <<
"Removing invalid primitives.\n";
84 int num_removed = _data->remove_invalid_primitives(
true);
85 nout <<
" (" << num_removed <<
" removed.)\n";
86 _data->remove_unused_vertices(
true);
89 if (_triangulate_polygons) {
90 nout <<
"Triangulating polygons.\n";
91 int num_produced = _data->triangulate_polygons(~0);
92 nout <<
" (" << num_produced <<
" triangles produced.)\n";
95 if (_mesh_triangles) {
96 nout <<
"Meshing triangles.\n";
97 _data->mesh_triangles(~0);
100 if (_apply_texmats) {
101 nout <<
"Applying texture matrices.\n";
102 _data->apply_texmats();
103 _data->remove_unused_vertices(
true);
106 if (_collapse_equivalent_textures) {
107 nout <<
"Collapsing equivalent textures.\n";
108 int num_removed = _data->collapse_equivalent_textures();
109 nout <<
" (" << num_removed <<
" removed.)\n";
112 if (_flatten_transforms) {
113 nout <<
"Flattening transforms.\n";
114 _data->flatten_transforms();
115 _data->remove_unused_vertices(
true);
118 if (_standardize_names) {
119 nout <<
"Standardizing group names.\n";
124 if (!do_reader_options()) {
132 int main(
int argc,
char *argv[]) {
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.