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);
116 for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
117 if ((*ei)->recompute_tangent_binormal(
GlobPattern(
"*"))) {
118 (*ei)->remove_unused_vertices(
true);
123 for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
124 if ((*ei)->recompute_tangent_binormal_auto()) {
125 (*ei)->remove_unused_vertices(
true);
130 for (vector_string::const_iterator si = _tbn_names.begin();
131 si != _tbn_names.end();
134 nout <<
"Computing tangent and binormal for \"" << uv_name <<
"\"\n";
135 for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
136 (*ei)->recompute_tangent_binormal(uv_name);
137 (*ei)->remove_unused_vertices(
true);
157 read_egg(
const Filename &filename) {
160 if (!data->read(filename)) {
165 if (_noabs && data->original_had_absolute_pathnames()) {
167 <<
" includes absolute pathnames!\n";
182 if (_force_complete) {
183 if (!data->load_externals()) {
192 if (_got_coordinate_system) {
193 data->set_coordinate_system(_coordinate_system);
195 _coordinate_system = data->get_coordinate_system();
196 _got_coordinate_system =
true;
string get_dirname() const
Returns the directory part of the filename.
string get_basename() const
Returns the basename part of the filename.
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...
This class can be used to test for string matches against standard Unix-shell filename globbing conve...