27 _preferred_extension =
".flt";
29 set_program_brief(
"apply various operations to a MultiGen .flt file");
30 set_program_description
31 (
"This program reads a MultiGen OpenFlight (.flt) file and writes an " 32 "essentially equivalent .flt file, to the file specified with -o (or " 33 "as the second parameter). Some simple operations may be performed.");
36 add_runline(
"[opts] input.flt output.flt");
37 add_runline(
"[opts] -o output.flt input.flt");
39 add_path_replace_options();
40 add_path_store_options();
44 "Upgrade (or downgrade) the flt file to the indicated version. This " 45 "may not be completely correct for all version-to-version combinations.",
46 &FltTrans::dispatch_double, &_got_new_version, &_new_version);
50 "Specify the filename to which the resulting .flt file will be written. " 51 "If this option is omitted, the last parameter name is taken to be the " 52 "name of the output file.",
53 &FltTrans::dispatch_filename, &_got_output_filename, &_output_filename);
62 if (_got_new_version) {
63 int new_version = (int)floor(_new_version * 100.0 + 0.5);
66 nout <<
"Cannot write flt files of version " << new_version / 100.0
67 <<
". This program only understands how to write flt files between version " 76 nout <<
"Reading " << _input_filename <<
"\n";
77 FltError result = header->read_flt(_input_filename);
78 if (result != FE_ok) {
79 nout <<
"Unable to read: " << result <<
"\n";
83 if (header->check_version()) {
84 nout <<
"Version is " << header->get_flt_version() / 100.0 <<
"\n";
87 if (_got_new_version) {
88 int new_version = (int)floor(_new_version * 100.0 + 0.5);
89 header->set_flt_version(new_version);
92 header->apply_converted_filenames();
95 if (result != FE_ok) {
96 nout <<
"Unable to write: " << result <<
"\n";
100 nout <<
"Successfully written.\n";
109 if (!check_last_arg(args, 1)) {
114 nout <<
"You must specify the .flt file to read on the command line.\n";
117 }
else if (args.size() != 1) {
118 nout <<
"You must specify only one .flt file to read on the command line.\n";
122 _input_filename = args[0];
128 int main(
int argc,
char *argv[]) {
A program to read a flt file and write an equivalent flt file, possibly performing some minor operati...
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_...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the bare functionality (intended to be inherited from along with ProgramBase or some derivati...
std::ostream & get_output()
Returns an output stream that corresponds to the user's intended egg file output–either stdout,...