Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/xfileprogs/eggToX.cxx

Go to the documentation of this file.
00001 // Filename: eggToX.cxx
00002 // Created by:  drose (19Jun01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "eggToX.h"
00020 #include "config_xfile.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //     Function: EggToX::Constructor
00024 //       Access: Public
00025 //  Description:
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   // X files are always y-up-left.
00045   remove_option("cs");
00046   _got_coordinate_system = true;
00047   _coordinate_system = CS_yup_left;
00048 
00049   // We always have -f on: force complete load.  X files don't support
00050   // external references.
00051   remove_option("f");
00052   _force_complete = true;
00053 }
00054 
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: EggToX::run
00058 //       Access: Public
00059 //  Description:
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 }

Generated on Fri May 2 03:21:57 2003 for Panda-Tool by doxygen1.3