00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "lwoToEgg.h"
00020
00021 #include "lwoToEggConverter.h"
00022 #include "lwoHeader.h"
00023 #include "lwoInputFile.h"
00024 #include "config_lwo.h"
00025
00026
00027
00028
00029
00030
00031 LwoToEgg::
00032 LwoToEgg() :
00033 SomethingToEgg("Lightwave", ".lwo")
00034 {
00035 add_path_replace_options();
00036 add_path_store_options();
00037 add_units_options();
00038 add_normals_options();
00039 add_transform_options();
00040
00041 set_program_description
00042 ("This program converts Lightwave Object (.lwo) files to egg. Many "
00043 "rendering characteristics of Lightwave (like layered shaders, etc.) "
00044 "are not supported, but fundamental things like polygons and texture "
00045 "maps are. This program is primarily designed to support files written "
00046 "by Lightwave version 6.x (LWO2 files), but it also has some limited "
00047 "support for version 5.x files (LWOB files).");
00048
00049 redescribe_option
00050 ("cs",
00051 "Specify the coordinate system of the input " + _format_name +
00052 " file. Normally, this is y-up-left.");
00053
00054 redescribe_option
00055 ("ui",
00056 "Specify the units of the input Lightwave file. By convention, "
00057 "this is assumed to be meters if it is unspecified.");
00058
00059 _coordinate_system = CS_yup_left;
00060 }
00061
00062
00063
00064
00065
00066
00067 void LwoToEgg::
00068 run() {
00069 _data.set_coordinate_system(_coordinate_system);
00070
00071 if (_input_units == DU_invalid) {
00072 _input_units = DU_meters;
00073 }
00074
00075 LwoToEggConverter converter;
00076 converter.set_egg_data(&_data, false);
00077 apply_parameters(converter);
00078
00079 if (!converter.convert_file(_input_filename)) {
00080 nout << "Errors in conversion.\n";
00081 exit(1);
00082 }
00083
00084 write_egg_file();
00085 nout << "\n";
00086 }
00087
00088
00089 int main(int argc, char *argv[]) {
00090 init_liblwo();
00091 LwoToEgg prog;
00092 prog.parse_command_line(argc, argv);
00093 prog.run();
00094 return 0;
00095 }