Panda3D

Loading...
Searching...
No Matches
lwoToEgg.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 lwoToEgg.cxx
10 * @author drose
11 * @date 2001-04-17
12 */
13
14#include "lwoToEgg.h"
15
16#include "lwoToEggConverter.h"
17#include "lwoHeader.h"
18#include "lwoInputFile.h"
19#include "config_lwo.h"
20
21/**
22 *
23 */
24LwoToEgg::
25LwoToEgg() :
26 SomethingToEgg("Lightwave", ".lwo")
27{
28 add_path_replace_options();
29 add_path_store_options();
30 add_units_options();
31 add_normals_options();
32 add_transform_options();
33
34 set_program_brief("convert a Lightwave Object file to .egg");
35 set_program_description
36 ("This program converts Lightwave Object (.lwo) files to egg. Many "
37 "rendering characteristics of Lightwave (like layered shaders, etc.) "
38 "are not supported, but fundamental things like polygons and texture "
39 "maps are. This program is primarily designed to support files written "
40 "by Lightwave version 6.x (LWO2 files), but it also has some limited "
41 "support for version 5.x files (LWOB files).");
42
43 redescribe_option
44 ("cs",
45 "Specify the coordinate system of the input " + _format_name +
46 " file. Normally, this is y-up-left.");
47
48 redescribe_option
49 ("ui",
50 "Specify the units of the input Lightwave file. By convention, "
51 "this is assumed to be meters if it is unspecified.");
52
53 _coordinate_system = CS_yup_left;
54}
55
56/**
57 *
58 */
59 void LwoToEgg::
60run() {
61 _data->set_coordinate_system(_coordinate_system);
62
63 if (_input_units == DU_invalid) {
64 _input_units = DU_meters;
65 }
66
67 LwoToEggConverter converter;
68 converter.set_egg_data(_data);
69 apply_parameters(converter);
70
71 if (!converter.convert_file(_input_filename)) {
72 nout << "Errors in conversion.\n";
73 exit(1);
74 }
75
76 write_egg_file();
77 nout << "\n";
78}
79
80
81 int main(int argc, char *argv[]) {
82 init_liblwo();
83 LwoToEgg prog;
84 prog.parse_command_line(argc, argv);
85 prog.run();
86 return 0;
87}
EggWriter::write_egg_file
void write_egg_file()
Writes out the egg file as the normal result of the program.
Definition eggWriter.cxx:177
LwoToEggConverter::convert_file
virtual bool convert_file(const Filename &filename)
Handles the reading of the input file and converting it to egg.
Definition lwoToEggConverter.cxx:103
LwoToEgg
A program to read a Lightwave file and generate an egg file.
Definition lwoToEgg.h:27
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
init_liblwo
void init_liblwo()
Initializes the library.
Definition config_lwo.cxx:68
config_lwo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lwoHeader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lwoInputFile.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lwoToEggConverter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lwoToEgg.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.