15 #include "eggMultiBase.h"
18 #include "eggComment.h"
20 #include "dSearchPath.h"
31 "Force complete loading: load up the egg file along with all of its "
32 "external references.",
33 &EggMultiBase::dispatch_none, &_force_complete);
37 "Don't allow any of the named egg files to have absolute pathnames. "
38 "If any do, abort with an error. This option is designed to help "
39 "detect errors when populating or building a standalone model tree, "
40 "which should be self-contained and include only relative pathnames.",
41 &EggMultiBase::dispatch_none, &_noabs);
65 nout <<
"Applying transform matrix:\n";
66 _transform.write(nout, 2);
68 if (decompose_matrix(_transform, scale, hpr, translate,
69 _eggs[0]->get_coordinate_system())) {
70 nout <<
"(scale " << scale <<
", hpr " << hpr <<
", translate "
71 << translate <<
")\n";
73 for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
74 (*ei)->transform(_transform);
79 nout <<
"Making points\n";
80 for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
81 (*ei)->make_point_primitives();
85 switch (_normals_mode) {
87 nout <<
"Stripping normals.\n";
88 for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
89 (*ei)->strip_normals();
90 (*ei)->remove_unused_vertices(
true);
95 nout <<
"Recomputing polygon normals.\n";
96 for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
97 (*ei)->recompute_polygon_normals();
98 (*ei)->remove_unused_vertices(
true);
103 nout <<
"Recomputing vertex normals.\n";
104 for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
105 (*ei)->recompute_vertex_normals(_normals_threshold);
106 (*ei)->remove_unused_vertices(
true);
130 read_egg(const
Filename &filename) {
133 if (!data->read(filename)) {
135 return (EggData *)NULL;
138 if (_noabs && data->original_had_absolute_pathnames()) {
139 nout << filename.get_basename()
140 <<
" includes absolute pathnames!\n";
141 return (EggData *)NULL;
155 if (_force_complete) {
156 if (!data->load_externals()) {
157 return (EggData *)NULL;
165 if (_got_coordinate_system) {
166 data->set_coordinate_system(_coordinate_system);
168 _coordinate_system = data->get_coordinate_system();
169 _got_coordinate_system =
true;
This specialization of ProgramBase is intended for programs that read and/or write multiple egg files...
void append_directory(const Filename &directory)
Adds a new directory to the end of the search list.
This is the primary interface into all the egg data, and the root of the egg file structure...
static void convert_paths(EggNode *node, PathReplace *path_replace, const DSearchPath &additional_path)
Recursively walks the egg hierarchy.
The name of a file, such as a texture file or an Egg file.
This is the base class for all three-component vectors and points.
void post_process_egg_files()
Performs any processing of the egg file(s) that is appropriate before writing them out...
This class stores a list of directories that can be searched, in order, to locate a particular file...