Panda3D

vrmlToEgg.cxx

00001 // Filename: vrmlToEgg.cxx
00002 // Created by:  drose (01Oct04)
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 "vrmlToEgg.h"
00016 
00017 #include "vrmlToEggConverter.h"
00018 #include "pystub.h"
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: VRMLToEgg::Constructor
00022 //       Access: Public
00023 //  Description:
00024 ////////////////////////////////////////////////////////////////////
00025 VRMLToEgg::
00026 VRMLToEgg() :
00027   SomethingToEgg("VRML", ".wrl")
00028 {
00029   add_units_options();
00030   add_normals_options();
00031   add_transform_options();
00032 
00033   set_program_description
00034     ("This program converts VRML 2.0 model files to egg.  Animated files, "
00035      "and VRML 1.0 files, are not supported.");
00036 
00037   redescribe_option
00038     ("cs",
00039      "Specify the coordinate system of the input " + _format_name +
00040      " file.  Normally, this is y-up.");
00041 
00042   _coordinate_system = CS_yup_right;
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: VRMLToEgg::run
00047 //       Access: Public
00048 //  Description:
00049 ////////////////////////////////////////////////////////////////////
00050 void VRMLToEgg::
00051 run() {
00052   nout << "Reading " << _input_filename << "\n";
00053 
00054   _data->set_coordinate_system(_coordinate_system);
00055 
00056   VRMLToEggConverter converter;
00057   converter.set_egg_data(_data);
00058   converter._allow_errors = _allow_errors;
00059 
00060   apply_parameters(converter);
00061 
00062   if (!converter.convert_file(_input_filename)) {
00063     nout << "Errors in conversion.\n";
00064     exit(1);
00065   }
00066 
00067   write_egg_file();
00068   nout << "\n";
00069 }
00070 
00071 
00072 int main(int argc, char *argv[]) {
00073   // A call to pystub() to force libpystub.so to be linked in.
00074   pystub();
00075 
00076   VRMLToEgg prog;
00077   prog.parse_command_line(argc, argv);
00078   prog.run();
00079   return 0;
00080 }
 All Classes Functions Variables Enumerations