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

pandatool/src/xfileprogs/xFileToEgg.cxx

Go to the documentation of this file.
00001 // Filename: xFileToEgg.cxx
00002 // Created by:  drose (21Jun01)
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 "xFileToEgg.h"
00020 #include "xFileToEggConverter.h"
00021 #include "config_xfile.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //     Function: XFileToEgg::Constructor
00025 //       Access: Public
00026 //  Description:
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 //     Function: XFileToEgg::run
00053 //       Access: Public
00054 //  Description:
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 }

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