From deb243f994e56035ba2d65e394cd776090ce9f98 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 18 Apr 2001 16:48:18 +0000 Subject: [PATCH] *** empty log message *** --- pandatool/src/fltprogs/fltToEgg.cxx | 72 +++++++++++++++++++++++++++++ pandatool/src/fltprogs/fltToEgg.h | 31 +++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 pandatool/src/fltprogs/fltToEgg.cxx create mode 100644 pandatool/src/fltprogs/fltToEgg.h diff --git a/pandatool/src/fltprogs/fltToEgg.cxx b/pandatool/src/fltprogs/fltToEgg.cxx new file mode 100644 index 0000000000..8067e5c60c --- /dev/null +++ b/pandatool/src/fltprogs/fltToEgg.cxx @@ -0,0 +1,72 @@ +// Filename: fltToEgg.cxx +// Created by: drose (17Apr01) +// +//////////////////////////////////////////////////////////////////// + +#include "fltToEgg.h" + +#include + +//////////////////////////////////////////////////////////////////// +// Function: FltToEgg::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +FltToEgg:: +FltToEgg() : + SomethingToEgg("MultiGen", ".flt") +{ + add_normals_options(); + + set_program_description + ("This program converts MultiGen OpenFlight (.flt) files to egg. " + "Nothing fancy yet."); + + add_option + ("tp", "path", 0, + "Add the indicated colon-delimited paths to the path that is searched " + "for textures referenced by the flt file. This " + "option may also be repeated to add multiple paths.", + &FltToEgg::dispatch_search_path, NULL, &_texture_path); + + redescribe_option + ("cs", + "Specify the coordinate system of the input " + _format_name + + "file. Normally, this is z-up."); + + _coordinate_system = CS_zup_right; +} + +//////////////////////////////////////////////////////////////////// +// Function: FltToEgg::run +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +void FltToEgg:: +run() { + PT(FltHeader) header = new FltHeader; + header->set_texture_path(_texture_path); + + nout << "Reading " << _input_filename << "\n"; + FltError result = header->read_flt(_input_filename); + if (result != FE_ok) { + nout << "Unable to read: " << result << "\n"; + exit(1); + } + + header->check_version(); + + _data.set_coordinate_system(_coordinate_system); + + FltToEggConverter converter(_data); + converter.convert_flt(header); + write_egg_file(); +} + + +int main(int argc, char *argv[]) { + FltToEgg prog; + prog.parse_command_line(argc, argv); + prog.run(); + return 0; +} diff --git a/pandatool/src/fltprogs/fltToEgg.h b/pandatool/src/fltprogs/fltToEgg.h new file mode 100644 index 0000000000..ff58ea2e60 --- /dev/null +++ b/pandatool/src/fltprogs/fltToEgg.h @@ -0,0 +1,31 @@ +// Filename: fltToEgg.h +// Created by: drose (17Apr01) +// +//////////////////////////////////////////////////////////////////// + +#ifndef FLTTOEGG_H +#define FLTTOEGG_H + +#include + +#include + +#include + +//////////////////////////////////////////////////////////////////// +// Class : FltToEgg +// Description : A program to read a flt file and generate an egg +// file. +//////////////////////////////////////////////////////////////////// +class FltToEgg : public SomethingToEgg { +public: + FltToEgg(); + + void run(); + +protected: + DSearchPath _texture_path; +}; + +#endif +