Panda3D
Loading...
Searching...
No Matches
daeToEgg.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 daeToEgg.cxx
10 * @author rdb
11 * @date 2008-05-08
12 */
13
14#include "daeToEgg.h"
15
16#include "daeToEggConverter.h"
17
18/**
19 *
20 */
21DAEToEgg::
22DAEToEgg():
23 SomethingToEgg("COLLADA", ".dae")
24{
25 add_animation_options();
26 add_units_options();
27 add_normals_options();
28 add_transform_options();
29
30 add_option
31 ("invtrans", "", false,
32 "Import the .dae file using inverted transparency. "
33 "This is useful when importing COLLADA files from some authoring tools "
34 "that export models with inverted transparency, such as Google SketchUp.",
35 &SomethingToEgg::dispatch_none, &_invert_transparency);
36
37 set_program_brief("convert COLLADA assets into .egg files");
38 set_program_description
39 ("This program converts .dae files (COLLADA Digital Asset Exchange) to .egg.");
40
41 _coordinate_system = CS_yup_right;
42 _animation_convert = AC_both;
43}
44
45/**
46 *
47 */
48void DAEToEgg::
49run() {
50 if (_animation_convert != AC_both && _animation_convert != AC_none &&
51 _animation_convert != AC_chan && _animation_convert != AC_model) {
52 std::cerr << "Unsupported animation convert option.\n";
53 exit(1);
54 }
55
56 nout << "Reading " << _input_filename << "\n";
57
58 _data->set_coordinate_system(_coordinate_system);
59
60 DAEToEggConverter converter;
61 converter.set_egg_data(_data);
62 converter._allow_errors = _allow_errors;
63 converter._invert_transparency = _invert_transparency;
64
65 apply_parameters(converter);
66
67 if (!converter.convert_file(_input_filename)) {
68 nout << "Errors in conversion.\n";
69 exit(1);
70 }
71
73 nout << "\n";
74}
75
76
77int main(int argc, char *argv[]) {
78 DAEToEgg prog;
79 prog.parse_command_line(argc, argv);
80 prog.run();
81 return 0;
82}
This class supervises the construction of an EggData structure from a DAE file.
virtual bool convert_file(const Filename &filename)
Handles the reading of the input file and converting it to egg.
A program to read a DAE file and generate an egg file.
Definition daeToEgg.h:25
void write_egg_file()
Writes out the egg file as the normal result of the program.
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_...
void set_egg_data(EggData *egg_data)
Sets the egg data that will be filled in when convert_file() is called.
This is the general base class for a file-converter program that reads some model file format and gen...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.