Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
deb243f994
2 changed files with 103 additions and 0 deletions
  1. 72 0
      pandatool/src/fltprogs/fltToEgg.cxx
  2. 31 0
      pandatool/src/fltprogs/fltToEgg.h

+ 72 - 0
pandatool/src/fltprogs/fltToEgg.cxx

@@ -0,0 +1,72 @@
+// Filename: fltToEgg.cxx
+// Created by:  drose (17Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "fltToEgg.h"
+
+#include <fltToEggConverter.h>
+
+////////////////////////////////////////////////////////////////////
+//     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;
+}

+ 31 - 0
pandatool/src/fltprogs/fltToEgg.h

@@ -0,0 +1,31 @@
+// Filename: fltToEgg.h
+// Created by:  drose (17Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef FLTTOEGG_H
+#define FLTTOEGG_H
+
+#include <pandatoolbase.h>
+
+#include <somethingToEgg.h>
+
+#include <dSearchPath.h>
+
+////////////////////////////////////////////////////////////////////
+// 	 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
+