15 #include "xFileToEgg.h"
16 #include "xFileToEggConverter.h"
17 #include "config_xfile.h"
29 add_path_replace_options();
30 add_path_store_options();
35 set_program_brief(
"convert a DirectX .x file to an .egg file");
36 set_program_description
37 (
"This program converts DirectX retained-mode (.x) files to egg. "
38 "Polygon meshes, materials, and textures, as well as skeleton "
39 "animation and skinning data, are supported. All animations "
40 "found in the source .x file are written together into the same "
45 "Specify the name of the animated character to generate. This option "
46 "forces the model to be converted as an animatable character, even "
47 "if animation channels are not found in the file. Without this "
48 "option, the model is converted as a static model (which "
49 "is usually more efficient to load within Panda), unless animation "
50 "channels are present in the .x file.",
51 &XFileToEgg::dispatch_string, &_make_char, &_char_name);
55 "Specify the frame rate of the resulting animation. If this is "
56 "omitted or 0, the frame rate is inferred from the file itself; but "
57 "note that the file must contain evenly-spaced keyframes.",
58 &XFileToEgg::dispatch_double, NULL, &_frame_rate);
62 "Generate animation data only (all geometry will be discarded).",
63 &XFileToEgg::dispatch_none, &_keep_animation);
67 "Generate model data only (all animation data will be discarded).",
68 &XFileToEgg::dispatch_none, &_keep_model);
72 "Specify the units of the input " + _format_name +
" file.");
76 "Specify the units of the resulting egg file. If both this and -ui are "
77 "specified, the vertices in the egg file will be scaled as "
78 "necessary to make the appropriate units conversion; otherwise, "
79 "the vertices will be left as they are.");
83 "Specify the coordinate system of the input " + _format_name +
84 " file. Normally, this is y-up-left.");
87 _coordinate_system = CS_yup_left;
97 _data->set_coordinate_system(_coordinate_system);
102 converter._frame_rate = _frame_rate;
103 converter._make_char = _make_char;
104 converter._char_name = _char_name;
105 converter._keep_model = _keep_model;
106 converter._keep_animation = _keep_animation;
109 apply_parameters(converter);
112 nout <<
"Unable to read " << _input_filename <<
"\n";
121 int main(
int argc,
char *argv[]) {
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 add_normals_options()
Adds -no, -np, etc.
virtual bool convert_file(const Filename &filename)
Handles the reading of the input file and converting it to egg.
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.
void add_transform_options()
Adds -TS, -TT, etc.
This is the general base class for a file-converter program that reads some model file format and gen...
A program to read a DirectX "x" file and generate an egg file.
void add_units_options()
Adds -ui and -uo as valid options for this program.