From 0851b8294ac17b4ffaa9222fa6aedbc27b6f654e Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 20 Jun 2001 23:43:10 +0000 Subject: [PATCH] *** empty log message *** --- pandatool/src/xfile/bam2x.cxx | 134 ---------------------------------- pandatool/src/xfile/bam2x.h | 53 -------------- 2 files changed, 187 deletions(-) delete mode 100644 pandatool/src/xfile/bam2x.cxx delete mode 100644 pandatool/src/xfile/bam2x.h diff --git a/pandatool/src/xfile/bam2x.cxx b/pandatool/src/xfile/bam2x.cxx deleted file mode 100644 index a416616b53..0000000000 --- a/pandatool/src/xfile/bam2x.cxx +++ /dev/null @@ -1,134 +0,0 @@ -// Filename: bamInfo.cxx -// Created by: drose (19Jun01) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#include "bam2x.h" - -#include -#include -#include -#include - -#include - -//////////////////////////////////////////////////////////////////// -// Function: Bam2X::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -Bam2X:: -Bam2X() : WithOutputFile(true, false, true) { - set_program_description - ("This program reads a Bam file and outputs an equivalent, " - "or nearly equivalent, DirectX-style .x file. Meshes as generated " - "by the Panda mesher are preserved, but advanced features like " - "LOD's and characters cannot be supported."); - - clear_runlines(); - add_runline("[opts] input.bam output.x"); - add_runline("[opts] -o output.x input.bam"); - - add_option - ("o", "filename", 50, - "Specify the filename to which the resulting .x file will be written. " - "If this option is omitted, the last parameter name is taken to be the " - "name of the output file.", - &Bam2X::dispatch_filename, &_got_output_filename, &_output_filename); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Bam2X::run -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void Bam2X:: -run() { - BamFile bam_file; - - if (!bam_file.open_read(_input_filename)) { - nout << "Unable to read.\n"; - exit(1); - } - - typedef vector Objects; - Objects objects; - TypedWritable *object = bam_file.read_object(); - while (object != (TypedWritable *)NULL || !bam_file.is_eof()) { - if (object != (TypedWritable *)NULL) { - objects.push_back(object); - } - object = bam_file.read_object(); - } - bam_file.resolve(); - bam_file.close(); - - if (objects.size() == 1 && objects[0]->is_of_type(Node::get_class_type())) { - convert_scene_graph(DCAST(Node, objects[0])); - } else { - nout << _input_filename << " does not contain a scene graph.\n"; - exit(1); - } -} - - -//////////////////////////////////////////////////////////////////// -// Function: Bam2X::handle_args -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -bool Bam2X:: -handle_args(ProgramBase::Args &args) { - if (!check_last_arg(args, 1)) { - return false; - } - - if (args.size() != 1) { - nout << "You must specify one Bam file to read on the command line.\n"; - return false; - } - - _input_filename = args[0]; - return true; -} - -int main(int argc, char *argv[]) { - Bam2X prog; - prog.parse_command_line(argc, argv); - prog.run(); - return 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: Bam2X::convert_scene_graph -// Access: Private -// Description: -//////////////////////////////////////////////////////////////////// -void Bam2X:: -convert_scene_graph(Node *root) { - nout << "Got root: " << *root << "\n"; - - if (!_x.open(get_output_filename())) { - nout << "Unable to open " << get_output_filename() << " for output.\n"; - exit(1); - } - if (!_x.add_node(root)) { - nout << "Unable to add " << *root << " to output.\n"; - exit(1); - } - _x.close(); -} diff --git a/pandatool/src/xfile/bam2x.h b/pandatool/src/xfile/bam2x.h deleted file mode 100644 index 458951cd7c..0000000000 --- a/pandatool/src/xfile/bam2x.h +++ /dev/null @@ -1,53 +0,0 @@ -// Filename: bam2X.h -// Created by: drose (19Jun01) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://www.panda3d.org/license.txt . -// -// To contact the maintainers of this program write to -// panda3d@yahoogroups.com . -// -//////////////////////////////////////////////////////////////////// - -#ifndef BAM2X_H -#define BAM2X_H - -#include -#include "xFileMaker.h" - -#include -#include -#include - -class Node; - -//////////////////////////////////////////////////////////////////// -// Class : Bam2X -// Description : A program to read in a bam file and write an -// equivalent, or nearly equivalent, DirectX-style "x" -// file. -//////////////////////////////////////////////////////////////////// -class Bam2X : public ProgramBase, public WithOutputFile { -public: - Bam2X(); - - void run(); - -protected: - virtual bool handle_args(Args &args); - -private: - void convert_scene_graph(Node *root); - - Filename _input_filename; - XFileMaker _x; -}; - -#endif