Panda3D
|
00001 // Filename: daeToEgg.cxx 00002 // Created by: pro-rsoft (08May08) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "daeToEgg.h" 00016 00017 #include "daeToEggConverter.h" 00018 #include "pystub.h" 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: DAEToEgg::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 DAEToEgg:: 00026 DAEToEgg(): 00027 SomethingToEgg("COLLADA", ".dae") 00028 { 00029 add_units_options(); 00030 add_normals_options(); 00031 add_transform_options(); 00032 00033 set_program_description 00034 ("This program converts .dae files (COLLADA Digital Asset Exchange) to .egg."); 00035 00036 _coordinate_system = CS_yup_right; 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: DAEToEgg::run 00041 // Access: Public 00042 // Description: 00043 //////////////////////////////////////////////////////////////////// 00044 void DAEToEgg:: 00045 run() { 00046 nout << "Reading " << _input_filename << "\n"; 00047 00048 _data->set_coordinate_system(_coordinate_system); 00049 00050 DAEToEggConverter converter; 00051 converter.set_egg_data(_data); 00052 converter._allow_errors = _allow_errors; 00053 00054 apply_parameters(converter); 00055 00056 if (!converter.convert_file(_input_filename)) { 00057 nout << "Errors in conversion.\n"; 00058 exit(1); 00059 } 00060 00061 write_egg_file(); 00062 nout << "\n"; 00063 } 00064 00065 00066 int main(int argc, char *argv[]) { 00067 // A call to pystub() to force libpystub.so to be linked in. 00068 pystub(); 00069 00070 DAEToEgg prog; 00071 prog.parse_command_line(argc, argv); 00072 prog.run(); 00073 return 0; 00074 }