00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "xFileToEgg.h"
00020 #include "xFileToEggConverter.h"
00021 #include "config_xfile.h"
00022
00023
00024
00025
00026
00027
00028 XFileToEgg::
00029 XFileToEgg() :
00030 SomethingToEgg("DirectX", ".x")
00031 {
00032 add_normals_options();
00033 add_transform_options();
00034 add_texture_path_options();
00035 add_rel_dir_options();
00036 add_search_path_options(true);
00037
00038 set_program_description
00039 ("This program converts DirectX retained-mode (.x) files to egg. This "
00040 "is a simple file format that only supports basic polygons, materials, "
00041 "and textures, in a hierarchy.");
00042
00043 redescribe_option
00044 ("cs",
00045 "Specify the coordinate system of the input " + _format_name +
00046 " file. Normally, this is y-up-left.");
00047
00048 _coordinate_system = CS_yup_left;
00049 }
00050
00051
00052
00053
00054
00055
00056 void XFileToEgg::
00057 run() {
00058 _data.set_coordinate_system(_coordinate_system);
00059
00060 XFileToEggConverter converter;
00061 converter.set_egg_data(&_data, false);
00062 converter.set_texture_path_convert(_texture_path_convert, _make_rel_dir);
00063
00064 if (!converter.convert_file(_input_filename)) {
00065 nout << "Unable to read " << _input_filename << "\n";
00066 exit(1);
00067 }
00068
00069 write_egg_file();
00070 nout << "\n";
00071 }
00072
00073
00074 int main(int argc, char *argv[]) {
00075 init_libxfile();
00076 XFileToEgg prog;
00077 prog.parse_command_line(argc, argv);
00078 prog.run();
00079 return 0;
00080 }