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