Panda3D
vrmlToEgg.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 vrmlToEgg.cxx
10  * @author drose
11  * @date 2004-10-01
12  */
13 
14 #include "vrmlToEgg.h"
15 
16 #include "vrmlToEggConverter.h"
17 
18 /**
19  *
20  */
21 VRMLToEgg::
22 VRMLToEgg() :
23  SomethingToEgg("VRML", ".wrl")
24 {
25  add_units_options();
26  add_normals_options();
27  add_transform_options();
28 
29  set_program_brief("convert VRML 2.0 model files to .egg");
30  set_program_description
31  ("This program converts VRML 2.0 model files to egg. Animated files, "
32  "and VRML 1.0 files, are not supported.");
33 
34  redescribe_option
35  ("cs",
36  "Specify the coordinate system of the input " + _format_name +
37  " file. Normally, this is y-up.");
38 
39  _coordinate_system = CS_yup_right;
40 }
41 
42 /**
43  *
44  */
45 void VRMLToEgg::
46 run() {
47  nout << "Reading " << _input_filename << "\n";
48 
49  _data->set_coordinate_system(_coordinate_system);
50 
51  VRMLToEggConverter converter;
52  converter.set_egg_data(_data);
53  converter._allow_errors = _allow_errors;
54 
55  apply_parameters(converter);
56 
57  if (!converter.convert_file(_input_filename)) {
58  nout << "Errors in conversion.\n";
59  exit(1);
60  }
61 
63  nout << "\n";
64 }
65 
66 
67 int main(int argc, char *argv[]) {
68  VRMLToEgg prog;
69  prog.parse_command_line(argc, argv);
70  prog.run();
71  return 0;
72 }
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_...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A program to read a VRML file and generate an egg file.
Definition: vrmlToEgg.h:25
This class supervises the construction of an EggData structure from a VRML file.
void set_egg_data(EggData *egg_data)
Sets the egg data that will be filled in when convert_file() is called.
void write_egg_file()
Writes out the egg file as the normal result of the program.
Definition: eggWriter.cxx:177
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.
virtual bool convert_file(const Filename &filename)
Handles the reading of the input file and converting it to egg.