15 #include "eggWriter.h" 17 #include "string_utils.h" 18 #include "compose_matrix.h" 19 #include "globPattern.h" 41 EggWriter(
bool allow_last_param,
bool allow_stdout) :
46 _preferred_extension =
".egg";
49 if (_allow_last_param) {
50 add_runline(
"[opts] output.egg");
52 add_runline(
"[opts] -o output.egg");
54 add_runline(
"[opts] >output.egg");
60 if (_allow_last_param) {
62 "Specify the filename to which the resulting egg file will be written. " 63 "If this option is omitted, the last parameter name is taken to be the " 64 "name of the output file, or standard output is used if there are no " 68 "Specify the filename to which the resulting egg file will be written. " 69 "If this option is omitted, the egg file is written to standard output.";
72 if (_allow_last_param) {
74 "Specify the filename to which the resulting egg file will be written. " 75 "If this option is omitted, the last parameter name is taken to be the " 76 "name of the output file.";
79 "Specify the filename to which the resulting egg file will be written.";
84 (
"o",
"filename", 50, o_description,
85 &EggWriter::dispatch_filename, &_got_output_filename, &_output_filename);
89 "Specify the coordinate system of the resulting egg file. This may be " 90 "one of 'y-up', 'z-up', 'y-up-left', or 'z-up-left'. The default is " 126 if (_got_transform) {
127 nout <<
"Applying transform matrix:\n";
128 _transform.write(nout, 2);
130 if (decompose_matrix(_transform, scale, hpr, translate,
131 _data->get_coordinate_system())) {
132 nout <<
"(scale " << scale <<
", hpr " << hpr <<
", translate " 133 << translate <<
")\n";
135 _data->transform(_transform);
139 nout <<
"Making points\n";
140 _data->make_point_primitives();
143 bool needs_remove =
false;
145 switch (_normals_mode) {
147 nout <<
"Stripping normals.\n";
148 _data->strip_normals();
153 nout <<
"Recomputing polygon normals.\n";
154 _data->recompute_polygon_normals();
159 nout <<
"Recomputing vertex normals.\n";
160 _data->recompute_vertex_normals(_normals_threshold);
170 needs_remove |= _data->recompute_tangent_binormal(
GlobPattern(
"*"));
173 needs_remove |= _data->recompute_tangent_binormal_auto();
175 needs_remove |= _data->recompute_tangent_binormal(_tbn_names);
179 _data->remove_unused_vertices(
true);
208 if (!check_last_arg(args, 0)) {
213 nout <<
"Unexpected arguments on command line:\n";
214 Args::const_iterator ai;
215 for (ai = args.begin(); ai != args.end(); ++ai) {
216 nout << (*ai) <<
" ";
222 if (!_got_path_directory && _got_output_filename) {
224 _path_replace->_path_directory = _output_filename.get_dirname();
236 post_command_line() {
237 if (!_allow_stdout && !_got_output_filename) {
238 nout <<
"You must specify the filename to write with -o.\n";
242 append_command_comment(_data);
244 return EggSingleBase::post_command_line();
This is the base class for all three-component vectors and points.
virtual void post_process_egg_file()
Performs any processing of the egg file that is appropriate before writing it out.
void write_egg_file()
Writes out the egg file as the normal result of the program.
virtual EggWriter * as_writer()
Returns this object as an EggWriter pointer, if it is in fact an EggWriter, or NULL if it is not...
This is the bare functionality (intended to be inherited from along with ProgramBase or some derivati...
ostream & get_output()
Returns an output stream that corresponds to the user's intended egg file output–either stdout...
This is the base class for a program that generates an egg file output, but doesn't read any for inpu...
EggWriter(bool allow_last_param=false, bool allow_stdout=true)
Egg-writing type programs may specify their output file using either the last-filename convention...
This class can be used to test for string matches against standard Unix-shell filename globbing conve...