15 #include "xFileMaker.h" 16 #include "xFileMesh.h" 17 #include "xFileMaterial.h" 18 #include "config_xfile.h" 21 #include "eggGroupNode.h" 24 #include "eggPolysetMaker.h" 25 #include "eggVertexPool.h" 26 #include "eggVertex.h" 27 #include "eggPolygon.h" 30 #include "vector_int.h" 31 #include "string_utils.h" 62 return _x_file->write(filename);
82 if (!recurse_nodes(egg_data, _x_file)) {
88 for (mi = _meshes.begin(); mi != _meshes.end(); ++mi) {
89 if (!finalize_mesh((*mi).first, (*mi).second)) {
106 if (egg_node->
is_of_type(EggBin::get_class_type())) {
107 return add_bin(DCAST(
EggBin, egg_node), x_parent);
109 }
else if (egg_node->
is_of_type(EggGroup::get_class_type())) {
110 return add_group(DCAST(
EggGroup, egg_node), x_parent);
112 }
else if (egg_node->
is_of_type(EggGroupNode::get_class_type())) {
116 if (xfile_one_mesh) {
119 if (!recurse_nodes(egg_group, x_parent)) {
127 if (!recurse_nodes(egg_group, x_frame)) {
146 if (xfile_one_mesh) {
149 if (!recurse_nodes(egg_group, x_parent)) {
162 if (!recurse_nodes(egg_group, x_frame)) {
178 switch (egg_bin->get_bin_number()) {
179 case EggPolysetMaker::BN_polyset:
180 return add_polyset(egg_bin, x_parent);
184 <<
"Unexpected bin type " << egg_bin->get_bin_number() <<
"\n";
201 EggGroupNode::iterator ci;
202 for (ci = egg_bin->begin(); ci != egg_bin->end(); ++ci) {
204 DCAST_INTO_R(poly, *ci,
false);
221 EggGroupNode::iterator ci;
222 for (ci = egg_node->begin(); ci != egg_node->end(); ++ci) {
224 if (!add_node(child, x_parent)) {
240 Meshes::iterator mi = _meshes.find(x_parent);
241 if (mi != _meshes.end()) {
249 _meshes.insert(Meshes::value_type(x_parent, mesh));
264 string mesh_index = format_string(_mesh_index);
This is a collection of polygons; i.e.
A base class for nodes in the hierarchy that are not leaf nodes.
This is the primary interface into all the egg data, and the root of the egg file structure...
bool add_tree(EggData *egg_data)
Adds the egg tree rooted at the indicated node to the X structure.
void add_polygon(EggPolygon *egg_poly)
Adds the indicated polygon to the mesh.
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
A single node of an X file.
The name of a file, such as a texture file or an Egg file.
int remove_invalid_primitives(bool recurse)
Removes primitives at this level and below which appear to be degenerate; e.g.
XFileDataNode * add_Frame(const string &name)
Creates a new Frame instance, as a child of this node.
XFileDataNode * add_FrameTransformMatrix(const LMatrix4d &mat)
Creates a new FrameTransformMatrix instance, as a child of this node.
XFileDataNode * make_x_mesh(XFileNode *x_parent, const string &suffix)
Creates an X structure corresponding to the mesh.
A base class for things that may be directly added into the egg hierarchy.
This is an abstract base class for an XFileNode which is also an XFileDataObject. ...
int make_bins(EggGroupNode *root_group)
The main entry point to EggBinMaker.
A specialization on EggBinMaker for making polysets that share the same basic rendering characteristi...
This represents the complete contents of an X file (file.x) in memory.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
bool write(const Filename &filename)
Writes the .x file data to the indicated filename; returns true on success, false otherwise...
A type of group node that holds related subnodes.