00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "eggToX.h"
00016 #include "config_xfile.h"
00017 #include "pystub.h"
00018
00019
00020
00021
00022
00023
00024 EggToX::
00025 EggToX() : EggToSomething("DirectX", ".x", true, false) {
00026 add_texture_options();
00027 add_delod_options(0.0);
00028
00029 set_program_description
00030 ("This program reads an Egg file and outputs an equivalent, "
00031 "or nearly equivalent, DirectX-style .x file. Only simple "
00032 "hierarchy and polygon meshes are supported; advanced features "
00033 "like LOD's, decals, and animation or skinning are not supported.");
00034
00035 add_option
00036 ("m", "", 0,
00037 "Convert all the objects in the egg file as one big mesh, instead of "
00038 "preserving the normal egg hierarchy.",
00039 &EggToX::dispatch_none, &xfile_one_mesh);
00040
00041
00042 remove_option("cs");
00043 _got_coordinate_system = true;
00044 _coordinate_system = CS_yup_left;
00045
00046
00047
00048 remove_option("f");
00049 _force_complete = true;
00050 }
00051
00052
00053
00054
00055
00056
00057
00058 void EggToX::
00059 run() {
00060 if (!do_reader_options()) {
00061 exit(1);
00062 }
00063
00064 if (!_x.add_tree(_data)) {
00065 nout << "Unable to define egg structure.\n";
00066 exit(1);
00067 }
00068
00069 if (!_x.write(get_output_filename())) {
00070 nout << "Unable to write " << get_output_filename() << ".\n";
00071 exit(1);
00072 }
00073 }
00074
00075
00076 int main(int argc, char *argv[]) {
00077
00078 pystub();
00079
00080 init_libxfile();
00081 EggToX prog;
00082 prog.parse_command_line(argc, argv);
00083 prog.run();
00084 return 0;
00085 }