Panda3D

objToEgg.cxx
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file objToEgg.cxx
10 * @author drose
11 * @date 2004-05-04
12 */
13
14 #include "objToEgg.h"
15
16 #include "objToEggConverter.h"
17
18 /**
19 *
20 */
21 ObjToEgg::
22 ObjToEgg() :
23 SomethingToEgg("obj", ".obj")
24 {
25 add_units_options();
26 add_points_options();
27 add_normals_options();
28 add_transform_options();
29
30 set_program_brief("convert .obj files to .egg");
31 set_program_description
32 ("This program converts obj files to egg. It "
33 "only converts polygon data, with no fancy tricks. "
34 "Very bare-bones at the moment; not even texture maps are supported.");
35
36 redescribe_option
37 ("cs",
38 "Specify the coordinate system of the input " + _format_name +
39 " file. Normally, this is z-up.");
40
41 _coordinate_system = CS_zup_right;
42 }
43
44 /**
45 *
46 */
47 void ObjToEgg::
48 run() {
49 nout << "Reading " << _input_filename << "\n";
50
51 _data->set_coordinate_system(_coordinate_system);
52
53 ObjToEggConverter converter;
54 converter.set_egg_data(_data);
55 converter._allow_errors = _allow_errors;
56
57 apply_parameters(converter);
58
59 if (!converter.convert_file(_input_filename)) {
60 nout << "Errors in conversion.\n";
61 exit(1);
62 }
63
64 write_egg_file();
65 nout << "\n";
66 }
67
68
69 int main(int argc, char *argv[]) {
70 ObjToEgg prog;
71 prog.parse_command_line(argc, argv);
72 prog.run();
73 return 0;
74 }
EggWriter::write_egg_file
void write_egg_file()
Writes out the egg file as the normal result of the program.
Definition: eggWriter.cxx:177
ObjToEggConverter
Convert an Obj file to egg data.
Definition: objToEggConverter.h:33
ObjToEggConverter::convert_file
virtual bool convert_file(const Filename &filename)
Handles the reading of the input file and converting it to egg.
Definition: objToEggConverter.cxx:106
ObjToEgg
A program to read a Obj file and generate an egg file.
Definition: objToEgg.h:25
ProgramBase::parse_command_line
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
Definition: programBase.cxx:286
SomethingToEggConverter::set_egg_data
void set_egg_data(EggData *egg_data)
Sets the egg data that will be filled in when convert_file() is called.
Definition: somethingToEggConverter.cxx:66
SomethingToEgg
This is the general base class for a file-converter program that reads some model file format and gen...
Definition: somethingToEgg.h:29
objToEggConverter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
objToEgg.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.