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

pandatool/src/lwoprogs/lwoToEgg.cxx

Go to the documentation of this file.
00001 // Filename: lwoToEgg.cxx
00002 // Created by:  drose (17Apr01)
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 "lwoToEgg.h"
00020 
00021 #include "lwoToEggConverter.h"
00022 #include "lwoHeader.h"
00023 #include "lwoInputFile.h"
00024 #include "config_lwo.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //     Function: LwoToEgg::Constructor
00028 //       Access: Public
00029 //  Description:
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 //     Function: LwoToEgg::run
00064 //       Access: Public
00065 //  Description:
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 }

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